most-box 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/about/index.html +2 -2
- package/out/admin/index.html +0 -0
- package/out/app/index.html +0 -0
- package/out/assets/{AccountMenu-D-wa5tux.js → AccountMenu-B26qus-Q.js} +1 -1
- package/out/assets/{AppShell-BdRKZIZ9.js → AppShell-BiYQsNO8.js} +1 -1
- package/out/assets/{AppTop-BE5kKBYH.js → AppTop-D-qYC0ep.js} +1 -1
- package/out/assets/ChatRestoringIndicator-CLV78gNW.js +1 -0
- package/out/assets/{CopyButton-DnFqfCN9.js → CopyButton-BrEkzqEq.js} +1 -1
- package/out/assets/{MarketingHeader-8gNzHawY.js → MarketingHeader-CJXpogPY.js} +1 -1
- package/out/assets/{MarketingLayout-BPdjpEfc.js → MarketingLayout-Ch4sw5Qm.js} +1 -1
- package/out/assets/{MilkdownEditor-C388llV6.js → MilkdownEditor-DfhuT9eU.js} +1 -1
- package/out/assets/{OpenSidebarButton-OP8zl7ad.js → OpenSidebarButton-Bvwr7B6k.js} +1 -1
- package/out/assets/{chatJoinInvite-CeC6H6t8.js → chatJoinInvite-7tuD-STm.js} +1 -1
- package/out/assets/i18n-DKsg67mH.js +1 -0
- package/out/assets/index-FEwag7ej.css +1 -0
- package/out/assets/{index-D1mozno-.js → index-mjFWLwue.js} +3 -3
- package/out/assets/{index.lazy-B1iJsXQ8.js → index.lazy-8GSHLIGt.js} +1 -1
- package/out/assets/{index.lazy-CX2l1_Gi.js → index.lazy-B3jH9yBA.js} +1 -1
- package/out/assets/index.lazy-B5JMiv3z.js +1 -0
- package/out/assets/{index.lazy-CVFcovqX.js → index.lazy-BAr7-dhf.js} +1 -1
- package/out/assets/index.lazy-BMFwyE_Z.js +3 -0
- package/out/assets/{index.lazy-Bz77Jlzu.js → index.lazy-BbA_1LnY.js} +1 -1
- package/out/assets/{index.lazy-m9XAzMt1.js → index.lazy-BmpOpQqg.js} +1 -1
- package/out/assets/{index.lazy-FvXAYdEO.js → index.lazy-CB3C6kMj.js} +1 -1
- package/out/assets/{index.lazy-ClrSkRx5.js → index.lazy-CVOAOO0_.js} +1 -1
- package/out/assets/{index.lazy-CflWbocP.js → index.lazy-CyFSwJuo.js} +1 -1
- package/out/assets/{index.lazy-DzaN9qwA.js → index.lazy-D3iEq2ZW.js} +2 -2
- package/out/assets/{index.lazy-CsTaY5WS.js → index.lazy-F3iHN_Ao.js} +1 -1
- package/out/assets/{index.lazy-D7E1pb1S.js → index.lazy-PnZR3z1V.js} +1 -1
- package/out/assets/{index.lazy-59kmyNMW.js → index.lazy-qDpRLqXu.js} +1 -1
- package/out/assets/{index.lazy-C_J9afOY.js → index.lazy-s6Ok77GI.js} +1 -1
- package/out/assets/{saveLocalFile-2CNt4X0T.js → saveLocalFile-BLTn3Z18.js} +1 -1
- package/out/assets/useChannelMessages-DKlO_2oW.js +4 -0
- package/out/assets/{useGameRoom-asr2gyY6.js → useGameRoom-DLN636mz.js} +1 -1
- package/out/chat/index.html +0 -0
- package/out/chat/join/demo/index.html +0 -0
- package/out/chat/join/index.html +0 -0
- package/out/download/index.html +2 -2
- package/out/game/gandengyan/index.html +0 -0
- package/out/game/index.html +0 -0
- package/out/game/zhajinhua/index.html +0 -0
- package/out/index.html +2 -2
- package/out/note/index.html +0 -0
- package/out/ping/index.html +2 -2
- package/out/profile/index.html +0 -0
- package/out/web3/index.html +0 -0
- package/package.json +1 -1
- package/server/src/index.js +191 -76
- package/out/assets/i18n-C6yaqRst.js +0 -1
- package/out/assets/index-C6IjeTBh.css +0 -1
- package/out/assets/index.lazy-CazlK1-Y.js +0 -3
- package/out/assets/index.lazy-JwrS2vDI.js +0 -1
- package/out/assets/useChannelMessages-DDBqKBXU.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/game-s6irY8hS.js","assets/jsx-runtime-Bt-cYkS5.js","assets/useNavigate-DWlBD_-b.js","assets/index.lazy-
|
|
2
|
-
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-Bt-cYkS5.js";import{At as i,B as a,Ct as o,Dt as s,E as c,Et as l,J as u,K as d,M as f,Mt as p,Ot as m,P as h,Q as g,S as _,St as v,Tt as y,U as b,V as x,W as S,X as C,Y as w,Z as E,_t as ee,a as te,at as ne,bt as re,ct as ie,d as ae,dt as oe,et as se,f as ce,ft as D,gt as O,ht as le,i as ue,it as de,j as fe,jt as pe,kt as me,lt as he,m as ge,mt as _e,n as ve,nt as ye,ot as be,p as xe,pt as Se,q as Ce,r as we,rt as Te,st as Ee,t as De,tt as Oe,u as ke,ut as Ae,vt as je,w as Me,wt as Ne,xt as Pe,yt as Fe}from"./useAppStore-DNhyhD20.js";import{a as Ie,c as Le,i as Re,l as ze,n as Be,r as Ve}from"./useNavigate-DWlBD_-b.js";import{a as He,i as Ue,n as We,r as Ge,s as Ke,t as qe}from"./i18n-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/game-s6irY8hS.js","assets/jsx-runtime-Bt-cYkS5.js","assets/useNavigate-DWlBD_-b.js","assets/index.lazy-BbA_1LnY.js","assets/useAppStore-DNhyhD20.js","assets/i18n-DKsg67mH.js","assets/arrow-right-BsHzC0ZL.js","assets/AccountMenu-B26qus-Q.js","assets/download-Cy2BlfKM.js","assets/external-link-D_AQSgxW.js","assets/folder-open-DOJ4bB58.js","assets/gamepad-2-BYqNgCQr.js","assets/hard-drive-DL1KJHmG.js","assets/message-square-CfApq8Ou.js","assets/notebook-pen-Bcd3MrtD.js","assets/wallet-D6HZocla.js","assets/MarketingLayout-Ch4sw5Qm.js","assets/LogoIcon-B2fFe0l1.js","assets/index.lazy-8GSHLIGt.js","assets/fingerprint-pattern-BT73ASEB.js","assets/CopyButton-BrEkzqEq.js","assets/copy-OwXDsstV.js","assets/lock-yG7M7GkB.js","assets/AppShell-BiYQsNO8.js","assets/AppTop-D-qYC0ep.js","assets/mp-cEQteKUC.js","assets/dayjs.min-Dcc0B6Je.js","assets/index.lazy-CB3C6kMj.js","assets/circle-alert-DXVkx8p8.js","assets/loader-C4pED_QP.js","assets/save-CfYzXcxH.js","assets/shield-check-2-h_eEXp.js","assets/upload-BmufnMFu.js","assets/MarketingHeader-CJXpogPY.js","assets/index.lazy-BAr7-dhf.js","assets/smartphone-CrsocYJo.js","assets/music-Br2x8TKX.js","assets/play-DSHtNcOe.js","assets/search-DLBOUfny.js","assets/send-Bie9hgHI.js","assets/wifi-CILQyKk0.js","assets/index.lazy-D3iEq2ZW.js","assets/chatNoteDraft-DTy6In5R.js","assets/OpenSidebarButton-Bvwr7B6k.js","assets/trash-2-B9gno5q6.js","assets/folder-6pYYnS2-.js","assets/index.lazy-CVOAOO0_.js","assets/format-CAKfypjK.js","assets/index.lazy-BMFwyE_Z.js","assets/saveLocalFile-BLTn3Z18.js","assets/file-text-zvTER2mN.js","assets/downloadValidation-Dd43i9_9.js","assets/channelApi-C5eHetoJ.js","assets/useChannelMessages-DKlO_2oW.js","assets/ChatRestoringIndicator-CLV78gNW.js","assets/index.lazy-s6Ok77GI.js","assets/arrow-up-down-DvLSz6Ma.js","assets/index.lazy-PnZR3z1V.js","assets/triangle-alert-BhNtjKm2.js","assets/refresh-cw-CfkUlTK9.js","assets/index.lazy-F3iHN_Ao.js","assets/index.lazy-B3jH9yBA.js","assets/useGameRoom-DLN636mz.js","assets/index-BRhsWNj1.css","assets/index.lazy-qDpRLqXu.js","assets/index-CYVRmppz.css","assets/index.lazy-BmpOpQqg.js","assets/index.lazy-B5JMiv3z.js","assets/chatJoinInvite-7tuD-STm.js","assets/index.lazy-CyFSwJuo.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-Bt-cYkS5.js";import{At as i,B as a,Ct as o,Dt as s,E as c,Et as l,J as u,K as d,M as f,Mt as p,Ot as m,P as h,Q as g,S as _,St as v,Tt as y,U as b,V as x,W as S,X as C,Y as w,Z as E,_t as ee,a as te,at as ne,bt as re,ct as ie,d as ae,dt as oe,et as se,f as ce,ft as D,gt as O,ht as le,i as ue,it as de,j as fe,jt as pe,kt as me,lt as he,m as ge,mt as _e,n as ve,nt as ye,ot as be,p as xe,pt as Se,q as Ce,r as we,rt as Te,st as Ee,t as De,tt as Oe,u as ke,ut as Ae,vt as je,w as Me,wt as Ne,xt as Pe,yt as Fe}from"./useAppStore-DNhyhD20.js";import{a as Ie,c as Le,i as Re,l as ze,n as Be,r as Ve}from"./useNavigate-DWlBD_-b.js";import{a as He,i as Ue,n as We,r as Ge,s as Ke,t as qe}from"./i18n-DKsg67mH.js";var Je=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,ne());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}var S=!1,C=-1,w=5,E=-1;function ee(){return g?!0:!(e.unstable_now()-E<w)}function te(){if(g=!1,S){var t=e.unstable_now();E=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ne():S=!1}}}var ne;if(typeof y==`function`)ne=function(){y(te)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=te,ne=function(){ie.postMessage(null)}}else ne=function(){_(te,0)};function ae(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ne()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Ye=n(((e,t)=>{t.exports=Je()})),Xe=n((t=>{var n=Ye(),r=e(),i=p();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),te=Symbol.for(`react.lazy`),ne=Symbol.for(`react.activity`),re=Symbol.for(`react.memo_cache_sentinel`),ie=Symbol.iterator;function ae(e){return typeof e!=`object`||!e?null:(e=ie&&e[ie]||e[`@@iterator`],typeof e==`function`?e:null)}var oe=Symbol.for(`react.client.reference`);function se(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===oe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case E:return`SuspenseList`;case ne:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?se(e.type)||`Memo`:t;case te:t=e._payload,e=e._init;try{return se(e(t))}catch{}}return null}var ce=Array.isArray,D=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},ue=[],de=-1;function fe(e){return{current:e}}function pe(e){0>de||(e.current=ue[de],ue[de]=null,de--)}function me(e,t){de++,ue[de]=e.current,e.current=t}var he=fe(null),ge=fe(null),_e=fe(null),ve=fe(null);function ye(e,t){switch(me(_e,t),me(ge,e),me(he,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}pe(he),me(he,e)}function be(){pe(he),pe(ge),pe(_e)}function xe(e){e.memoizedState!==null&&me(ve,e);var t=he.current,n=Kd(t,e.type);t!==n&&(me(ge,e),me(he,n))}function Se(e){ge.current===e&&(pe(he),pe(ge)),ve.current===e&&(pe(ve),$f._currentValue=le)}var Ce,we;function Te(e){if(Ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ce=t&&t[1]||``,we=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Ce+e+we}var Ee=!1;function De(e,t){if(!e||Ee)return``;Ee=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -28,4 +28,4 @@ Error generating stack: `+e.message+`
|
|
|
28
28
|
window.onunhandledrejection = function(event) {
|
|
29
29
|
console.error('[Unhandled Promise Rejection]', event.reason);
|
|
30
30
|
};
|
|
31
|
-
`}})}var sm=x(`/`)({}),cm=x(`/web3/`)({}),lm=x(`/profile/`)({head:()=>({meta:[{title:Ue(`profile.meta.title`)},{name:`description`,content:Ue(`profile.meta.desc`)}]})}),um=x(`/ping/`)({head:()=>({meta:[{title:Ue(`ping.meta.title`)},{name:`description`,content:Ue(`ping.meta.desc`)}]})}),dm=x(`/note/`)({validateSearch:e=>({cid:typeof e.cid==`string`?e.cid:void 0,file:typeof e.file==`string`?e.file:void 0,path:typeof e.path==`string`?e.path:void 0,chatDraft:typeof e.chatDraft==`string`?e.chatDraft:void 0,mode:e.mode===`edit`?`edit`:void 0})}),fm=`modulepreload`,pm=function(e){return`/`+e},mm={},hm=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=pm(t,n),t=s(t),t in mm)return;mm[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:fm,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},gm=x(`/game/`)({component:Ds(()=>hm(()=>import(`./game-s6irY8hS.js`),__vite__mapDeps([0,1,2])),`component`)}),_m=x(`/download/`)({head:()=>({meta:[{title:Ue(`download.meta.title`)},{name:`description`,content:Ue(`download.meta.desc`)}]})}),vm=x(`/chat/`)({}),ym=x(`/app/`)({}),bm=x(`/admin/`)({}),xm=x(`/about/`)({head:()=>({meta:[{title:Ue(`about.meta.title`)},{name:`description`,content:Ue(`about.meta.desc`)}]})}),Sm=x(`/game/zhajinhua/`)({}),Cm=x(`/game/gandengyan/`)({}),wm=x(`/cid/$cid/`)({head:()=>({meta:[{title:Ue(`cid.meta.title`)},{name:`description`,content:Ue(`cid.meta.desc`)}]})}),Tm=x(`/chat/join/`)({validateSearch:e=>({token:typeof e.token==`string`?e.token:void 0,pub:typeof e.pub==`string`?e.pub:void 0,fixture:typeof e.fixture==`string`?e.fixture:void 0})}),Em=x(`/chat/join/demo/`)({}),Dm=sm.update({id:`/`,path:`/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-
|
|
31
|
+
`}})}var sm=x(`/`)({}),cm=x(`/web3/`)({}),lm=x(`/profile/`)({head:()=>({meta:[{title:Ue(`profile.meta.title`)},{name:`description`,content:Ue(`profile.meta.desc`)}]})}),um=x(`/ping/`)({head:()=>({meta:[{title:Ue(`ping.meta.title`)},{name:`description`,content:Ue(`ping.meta.desc`)}]})}),dm=x(`/note/`)({validateSearch:e=>({cid:typeof e.cid==`string`?e.cid:void 0,file:typeof e.file==`string`?e.file:void 0,path:typeof e.path==`string`?e.path:void 0,chatDraft:typeof e.chatDraft==`string`?e.chatDraft:void 0,mode:e.mode===`edit`?`edit`:void 0})}),fm=`modulepreload`,pm=function(e){return`/`+e},mm={},hm=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=pm(t,n),t=s(t),t in mm)return;mm[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:fm,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},gm=x(`/game/`)({component:Ds(()=>hm(()=>import(`./game-s6irY8hS.js`),__vite__mapDeps([0,1,2])),`component`)}),_m=x(`/download/`)({head:()=>({meta:[{title:Ue(`download.meta.title`)},{name:`description`,content:Ue(`download.meta.desc`)}]})}),vm=x(`/chat/`)({}),ym=x(`/app/`)({}),bm=x(`/admin/`)({}),xm=x(`/about/`)({head:()=>({meta:[{title:Ue(`about.meta.title`)},{name:`description`,content:Ue(`about.meta.desc`)}]})}),Sm=x(`/game/zhajinhua/`)({}),Cm=x(`/game/gandengyan/`)({}),wm=x(`/cid/$cid/`)({head:()=>({meta:[{title:Ue(`cid.meta.title`)},{name:`description`,content:Ue(`cid.meta.desc`)}]})}),Tm=x(`/chat/join/`)({validateSearch:e=>({token:typeof e.token==`string`?e.token:void 0,pub:typeof e.pub==`string`?e.pub:void 0,fixture:typeof e.fixture==`string`?e.fixture:void 0})}),Em=x(`/chat/join/demo/`)({}),Dm=sm.update({id:`/`,path:`/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-BbA_1LnY.js`).then(e=>e.Route),__vite__mapDeps([3,1,4,2,5,6,7,8,9,10,11,12,13,14,15,16,17]))),Om=cm.update({id:`/web3/`,path:`/web3/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-8GSHLIGt.js`).then(e=>e.Route),__vite__mapDeps([18,1,4,2,5,19,7,8,9,20,21,22,23,15,24,25,26]))),km=lm.update({id:`/profile/`,path:`/profile/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-CB3C6kMj.js`).then(e=>e.Route),__vite__mapDeps([27,1,4,2,5,19,28,7,8,9,20,21,29,30,31,32,16,17,33,25,26]))),Am=um.update({id:`/ping/`,path:`/ping/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-BAr7-dhf.js`).then(e=>e.Route),__vite__mapDeps([34,1,4,2,5,35,13,36,37,38,39,40,16,7,8,17]))),jm=dm.update({id:`/note/`,path:`/note/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-D3iEq2ZW.js`).then(e=>e.Route),__vite__mapDeps([41,1,4,2,5,42,43,23,7,44,10,45,22,14,30,38,24]))),Mm=gm.update({id:`/game/`,path:`/game/`,getParentRoute:()=>rm}),Nm=_m.update({id:`/download/`,path:`/download/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-CVOAOO0_.js`).then(e=>e.Route),__vite__mapDeps([46,1,4,2,5,35,8,33,7,47]))),Pm=vm.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-BMFwyE_Z.js`).then(e=>e.Route),__vite__mapDeps([48,1,4,2,5,28,42,43,23,7,49,8,50,29,36,6,44,9,13,38,24,17,47,51,52,53,54]))),Fm=ym.update({id:`/app/`,path:`/app/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-s6Ok77GI.js`).then(e=>e.Route),__vite__mapDeps([55,1,4,2,5,43,23,7,49,8,50,29,36,56,44,21,45,38,32,24,47,51]))),Im=bm.update({id:`/admin/`,path:`/admin/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-PnZR3z1V.js`).then(e=>e.Route),__vite__mapDeps([57,1,4,2,5,58,56,44,8,50,12,59,30,31,40,26,33,7,47]))),Lm=xm.update({id:`/about/`,path:`/about/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-F3iHN_Ao.js`).then(e=>e.Route),__vite__mapDeps([60,1,4,2,5,19,6,7,8,11,13,14,15,24,16,17]))),Rm=Sm.update({id:`/game/zhajinhua/`,path:`/game/zhajinhua/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-B3jH9yBA.js`).then(e=>e.Route),__vite__mapDeps([61,1,4,2,5,21,23,7,37,62,24,52,53,63]))),zm=Cm.update({id:`/game/gandengyan/`,path:`/game/gandengyan/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-qDpRLqXu.js`).then(e=>e.Route),__vite__mapDeps([64,1,4,2,5,21,23,7,37,39,62,24,52,53,65]))),Bm=wm.update({id:`/cid/$cid/`,path:`/cid/$cid/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-BmpOpQqg.js`).then(e=>e.Route),__vite__mapDeps([66,1,4,2,5,58,8,9,50,12,59,33,7,47,51]))),Vm={IndexRoute:Dm,AboutIndexRoute:Lm,AdminIndexRoute:Im,AppIndexRoute:Fm,ChatIndexRoute:Pm,DownloadIndexRoute:Nm,GameIndexRoute:Mm,NoteIndexRoute:jm,PingIndexRoute:Am,ProfileIndexRoute:km,Web3IndexRoute:Om,ChatJoinIndexRoute:Tm.update({id:`/chat/join/`,path:`/chat/join/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-B5JMiv3z.js`).then(e=>e.Route),__vite__mapDeps([67,1,4,2,5,28,59,52,54,68]))),CidCidIndexRoute:Bm,GameGandengyanIndexRoute:zm,GameZhajinhuaIndexRoute:Rm,ChatJoinDemoIndexRoute:Em.update({id:`/chat/join/demo/`,path:`/chat/join/demo/`,getParentRoute:()=>rm}).lazy(()=>hm(()=>import(`./index.lazy-CyFSwJuo.js`).then(e=>e.Route),__vite__mapDeps([69,1,4,2,5,9,20,7,21,23,59,24,68])))},Hm=rm._addFileChildren(Vm);function Um(){return Us({routeTree:Hm,defaultPreload:`intent`,scrollRestoration:!0,trailingSlash:`always`})}async function Wm(){let e=await Um(),t=[];return window.__TSS_START_OPTIONS__={serializationAdapters:t},t.push(ts),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:``,serializationAdapters:t}),e.stores.matchesId.get().length||await is(e),e}var Gm=Wm;async function Km(){let e=await Gm();return window.$_TSR?.h(),e}var qm;function Jm(){return qm||=Km(),(0,F.jsx)(os,{promise:qm,children:e=>(0,F.jsx)(Ys,{router:e})})}var Ym=Ze();(0,P.startTransition)(()=>{(0,Ym.hydrateRoot)(document,(0,F.jsx)(P.StrictMode,{children:(0,F.jsx)(Jm,{})}))});export{vc as A,zc as C,wc as D,Pc as E,lc as F,sc as I,Xs as L,pc as M,fc as N,Cc as O,uc as P,Hc as S,Ic as T,Mf as _,qp as a,Kc as b,op as c,rp as d,sp as f,Rf as g,Af as h,Gp as i,gc as j,bc as k,cp as l,ap as m,nm as n,Mp as o,ip as p,Kp as r,np as s,hm as t,tp as u,Ff as v,Rc as w,Wc as x,If as y};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,E as a,F as o,H as s,I as c,N as l,O as u,R as d,k as f,t as p}from"./useAppStore-DNhyhD20.js";import{a as m}from"./i18n-C6yaqRst.js";import{t as h}from"./fingerprint-pattern-BT73ASEB.js";import{i as g}from"./AccountMenu-D-wa5tux.js";import{t as _}from"./download-Cy2BlfKM.js";import{t as v}from"./external-link-D_AQSgxW.js";import{n as y,t as b}from"./CopyButton-DnFqfCN9.js";import{t as x}from"./lock-yG7M7GkB.js";import{t as S}from"./AppShell-BdRKZIZ9.js";import{t as C}from"./wallet-D6HZocla.js";import{M as w,N as T,P as E,g as ee}from"./index-D1mozno-.js";import{t as te}from"./AppTop-BE5kKBYH.js";import{n as ne,t as re}from"./mp-cEQteKUC.js";var ie=i(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ae=i(`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`}]]),oe=i(`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`}]]),se=i(`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`}]]),ce=i(`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`}]]),D=t(e()),O=n();function le(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function k({title:e,username:t,password:n,showPassword:r,showPrivateKey:i,account:a,onUsernameChange:o,onPasswordChange:s,onTogglePassword:c,onTogglePrivateKey:l,onGenerate:u}){let{t:d}=m();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:d(`web3.box.account.desc`)})]})}),(0,O.jsxs)(`div`,{className:`web3-box-login`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:d(`login.username.placeholder`),value:t,onChange:e=>o(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:r?`text`:`password`,placeholder:d(`web3.login.passwordOptional`),value:n,onChange:e=>s(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:c,type:`button`,children:r?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:u,disabled:!t.trim(),type:`button`,children:[(0,O.jsx)(y,{size:16}),d(`web3.box.account.generate`)]})]}),a?(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:d(`web3.label.address`)}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:a.address.toLowerCase()}),(0,O.jsx)(b,{text:a.address.toLowerCase()})]})]}),(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.x25519Public`)}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:a.publicKey}),(0,O.jsx)(b,{text:a.publicKey})]})]}),(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.x25519Private`)}),(0,O.jsxs)(`div`,{className:`mono-row danger`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:i?a.privateKey:le(a.privateKey)}),(0,O.jsx)(`button`,{className:`btn btn-icon`,onClick:l,title:d(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,O.jsx)(w,{size:14}):(0,O.jsx)(T,{size:14})})]})]})]}):null]})}function ue(e,t){return Number.isFinite(e)?t(e):`-`}function A({title:e,description:t,message:n,cipherText:r,decryptedText:i,error:a,encryptLabel:o,decryptLabel:s,messagePlaceholder:l,cipherPlaceholder:u,onMessageChange:d,onCipherTextChange:f,onEncrypt:p,onDecrypt:h}){let{t:g,formatDateTime:_}=m(),v=`box-message-${e.replaceAll(/\s+/g,`-`)}`,b=c(r);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:v,children:g(`web3.box.plaintext`)}),(0,O.jsx)(`textarea`,{id:v,className:`textarea`,value:n,onChange:e=>d(e.target.value),rows:4,placeholder:l,translate:`no`}),(0,O.jsxs)(`div`,{className:`web3-box-actions`,children:[(0,O.jsxs)(`button`,{className:`btn btn-primary`,onClick:p,type:`button`,children:[(0,O.jsx)(x,{size:16}),o]}),(0,O.jsxs)(`button`,{className:`btn btn-secondary`,onClick:h,type:`button`,children:[(0,O.jsx)(y,{size:16}),s]})]}),a&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:a}),(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:g(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:r,onChange:e=>f(e.target.value),rows:5,placeholder:u,translate:`no`})]}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:g(`web3.box.decryptResult`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:i,readOnly:!0,rows:5,placeholder:g(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]}),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:g(`web3.box.timestamp`)}),(0,O.jsx)(`code`,{translate:`no`,children:ue(b.timestampMs,_)})]}),(0,O.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,O.jsx)(`span`,{children:g(`web3.box.nonce`)}),(0,O.jsx)(`code`,{translate:`no`,children:b.nonce})]})]})]})}function de(e){let{t}=m();return(0,O.jsxs)(`div`,{className:`web3-box-workspace`,children:[(0,O.jsxs)(`div`,{className:`web3-box-grid`,children:[(0,O.jsx)(k,{title:t(`web3.box.accountA`),username:e.boxAUsername,password:e.boxAPassword,showPassword:e.boxAShowPassword,showPrivateKey:e.boxAShowPrivateKey,account:e.boxAAccount,onUsernameChange:e.onBoxAUsernameChange,onPasswordChange:e.onBoxAPasswordChange,onTogglePassword:e.onBoxAShowPasswordToggle,onTogglePrivateKey:e.onBoxAShowPrivateKeyToggle,onGenerate:e.onGenerateBoxA}),(0,O.jsx)(k,{title:t(`web3.box.accountB`),username:e.boxBUsername,password:e.boxBPassword,showPassword:e.boxBShowPassword,showPrivateKey:e.boxBShowPrivateKey,account:e.boxBAccount,onUsernameChange:e.onBoxBUsernameChange,onPasswordChange:e.onBoxBPasswordChange,onTogglePassword:e.onBoxBShowPasswordToggle,onTogglePrivateKey:e.onBoxBShowPrivateKeyToggle,onGenerate:e.onGenerateBoxB})]}),(0,O.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,O.jsx)(A,{title:`A → B`,description:t(`web3.box.flowAB.desc`),message:e.boxABMessage,cipherText:e.boxABCipherText,decryptedText:e.boxABDecryptedText,error:e.boxABError,encryptLabel:t(`web3.box.flowAB.encrypt`),decryptLabel:t(`web3.box.flowAB.decrypt`),messagePlaceholder:t(`web3.box.flowAB.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxABMessageChange,onCipherTextChange:e.onBoxABCipherTextChange,onEncrypt:e.onEncryptBoxAB,onDecrypt:e.onDecryptBoxAB}),(0,O.jsx)(A,{title:`B → A`,description:t(`web3.box.flowBA.desc`),message:e.boxBAMessage,cipherText:e.boxBACipherText,decryptedText:e.boxBADecryptedText,error:e.boxBAError,encryptLabel:t(`web3.box.flowBA.encrypt`),decryptLabel:t(`web3.box.flowBA.decrypt`),messagePlaceholder:t(`web3.box.flowBA.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxBAMessageChange,onCipherTextChange:e.onBoxBACipherTextChange,onEncrypt:e.onEncryptBoxBA,onDecrypt:e.onDecryptBoxBA})]}),(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:t(`web3.box.encryptTitle`)}),(0,O.jsx)(`p`,{children:t(`web3.box.encryptDesc`)})]})}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:e.boxEncryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.senderPrivatePlaceholder`),value:e.boxEncryptSenderPrivateKey,onChange:t=>e.onBoxEncryptSenderPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxEncryptShowPrivateKeyToggle,type:`button`,children:e.boxEncryptShowPrivateKey?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,O.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.recipientPublicPlaceholder`),value:e.boxEncryptRecipientPublicKey,onChange:t=>e.onBoxEncryptRecipientPublicKeyChange(t.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:t(`web3.box.plaintext`)})}),(0,O.jsx)(`textarea`,{className:`textarea`,value:e.boxEncryptMessage,onChange:t=>e.onBoxEncryptMessageChange(t.target.value),rows:4,placeholder:t(`web3.box.messagePlaceholder`),translate:`no`}),(0,O.jsx)(`div`,{className:`web3-box-actions`,children:(0,O.jsxs)(`button`,{className:`btn btn-primary`,onClick:e.onEncryptOnly,type:`button`,children:[(0,O.jsx)(x,{size:16}),t(`web3.box.encryptTitle`)]})}),e.boxEncryptError&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxEncryptError}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxEncryptCipherText,readOnly:!0,rows:5,placeholder:t(`web3.box.encryptResultPlaceholder`),translate:`no`})]})]}),(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:t(`web3.box.decryptTitle`)}),(0,O.jsx)(`p`,{children:t(`web3.box.decryptDesc`)})]})}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,O.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.senderPublicPlaceholder`),value:e.boxDecryptSenderPublicKey,onChange:t=>e.onBoxDecryptSenderPublicKeyChange(t.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:t(`web3.box.recipient`)})}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:e.boxDecryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.recipientPrivatePlaceholder`),value:e.boxDecryptRecipientPrivateKey,onChange:t=>e.onBoxDecryptRecipientPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxDecryptShowPrivateKeyToggle,type:`button`,children:e.boxDecryptShowPrivateKey?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptCipherText,onChange:t=>e.onBoxDecryptCipherTextChange(t.target.value),rows:5,placeholder:t(`web3.box.cipherDecryptPlaceholder`),translate:`no`}),(0,O.jsx)(`div`,{className:`web3-box-actions`,children:(0,O.jsxs)(`button`,{className:`btn btn-secondary`,onClick:e.onDecryptOnly,type:`button`,children:[(0,O.jsx)(y,{size:16}),t(`web3.box.decryptTitle`)]})}),e.boxDecryptError&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxDecryptError}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.decryptResult`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptResult,readOnly:!0,rows:5,placeholder:t(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]})]})]})}function j({icon:e,message:t,className:n=`empty-state glass`}){return(0,O.jsxs)(`div`,{className:n,children:[(0,O.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,O.jsx)(`p`,{children:t})]})}function fe({label:e,pem:t,filename:n}){let{t:r}=m();function i(){let e=new Blob([t],{type:`text/plain`}),r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=n,i.click(),URL.revokeObjectURL(r)}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.jsx)(b,{text:t,label:r(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:i,title:r(`common.download`),children:[(0,O.jsx)(_,{size:14}),r(`common.download`)]})]})]}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:t,readOnly:!0,rows:6,translate:`no`})]})}function pe({walletResult:e,publicPem:t,privatePem:n}){let{t:r}=m();if(!t||!n)return(0,O.jsx)(j,{icon:(0,O.jsx)(x,{size:36}),message:r(`web3.empty.pem`)});let i=e?.username||`wallet`;return(0,O.jsxs)(`div`,{className:`web3-pem-list`,children:[(0,O.jsx)(fe,{label:`${i}.pub`,pem:t,filename:`${i}.pub`}),(0,O.jsx)(fe,{label:`${i}.pem`,pem:n,filename:`${i}.pem`})]})}var me=Object.defineProperty,M=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,he=(e,t,n)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t)=>{for(var n in t||={})N.call(t,n)&&he(e,n,t[n]);if(M)for(var n of M(t))P.call(t,n)&&he(e,n,t[n]);return e},I=(e,t)=>{var n={};for(var r in e)N.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&M)for(var r of M(e))t.indexOf(r)<0&&P.call(e,r)&&(n[r]=e[r]);return n},L;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}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 n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,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;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};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;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),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 r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}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 n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(L||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(L||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(L||={});var R=L,ge={L:R.QrCode.Ecc.LOW,M:R.QrCode.Ecc.MEDIUM,Q:R.QrCode.Ecc.QUARTILE,H:R.QrCode.Ecc.HIGH},z=128,B=`L`,V=`#FFFFFF`,H=`#000000`,U=!1,W=1,_e=4,ve=0,G=.1;function K(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ye(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function be(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*G),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function xe(e,t){return t==null?e?_e:ve:Math.max(Math.floor(t),0)}function q({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=D.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...R.QrSegment.makeSegments(t)),e),[]);return R.QrCode.encodeSegments(r,ge[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=D.useMemo(()=>{let e=c.getModules(),t=xe(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:be(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Se=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Ce=D.forwardRef(function(e,t){let n=e,{value:r,size:i=z,level:a=B,bgColor:o=V,fgColor:s=H,includeMargin:c=U,minVersion:l=W,boostLevel:u,marginSize:d,imageSettings:f}=n,p=I(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=I(p,[`style`]),g=f?.src,_=D.useRef(null),v=D.useRef(null),y=D.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=D.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});D.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ye(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Se?t.fill(new Path2D(K(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),D.useEffect(()=>{x(!1)},[g]);let E=F({height:i,width:i},m),ee=null;return g!=null&&(ee=D.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),D.createElement(D.Fragment,null,D.createElement(`canvas`,F({style:E,height:i,width:i,ref:y,role:`img`},h)),ee)});Ce.displayName=`QRCodeCanvas`;var J=D.forwardRef(function(e,t){let n=e,{value:r,size:i=z,level:a=B,bgColor:o=V,fgColor:s=H,includeMargin:c=U,minVersion:l=W,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=I(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ye(g,v.excavation)),b=D.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=K(y,h);return D.createElement(`svg`,F({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&D.createElement(`title`,null,d),D.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),D.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});J.displayName=`QRCodeSVG`;function we({walletResult:e,mnemonicPhrase:t,deriveBatch:n,deriveList:r,deriveShowIndex:i,deriveShowAddress:a,deriveShowPrivateKey:o,showAddressQr:s,showMnemonicReveal:c,showMnemonicQr:l,onToggleAddressQr:u,onToggleMnemonicReveal:d,onToggleMnemonicQr:f,onToggleDeriveIndex:p,onToggleDeriveAddress:h,onToggleDerivePrivateKey:g,onDerive:_}){let{t:v}=m(),x=e?.address||``;return!e||!x?(0,O.jsx)(j,{icon:(0,O.jsx)(C,{size:36}),message:v(`web3.empty.walletTools`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,O.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:u,children:[(0,O.jsx)(oe,{size:14}),v(s?`web3.action.hideAddressQr`:`web3.action.showAddressQr`),s?(0,O.jsx)(ie,{size:14}):(0,O.jsx)(E,{size:14})]}),s&&(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`,translate:`no`,children:x}),(0,O.jsx)(b,{text:x})]}),(0,O.jsx)(`div`,{className:`qr-wrap`,children:(0,O.jsx)(J,{value:x,size:200})})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,O.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:d,children:[(0,O.jsx)(y,{size:14}),v(c?`web3.action.hideMnemonic`:`web3.action.showMnemonic`),c?(0,O.jsx)(ie,{size:14}):(0,O.jsx)(E,{size:14})]}),c&&(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`,translate:`no`,children:t}),(0,O.jsx)(b,{text:t})]}),(0,O.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,O.jsx)(se,{size:14}),v(`web3.warning.mnemonic`)]}),(0,O.jsx)(`button`,{className:`web3-tools-toggle`,onClick:f,children:v(l?`web3.action.hideMnemonicQr`:`web3.action.showMnemonicQr`)}),l&&(0,O.jsx)(`div`,{className:`qr-wrap`,children:(0,O.jsx)(J,{value:t,size:260})})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,O.jsx)(`div`,{children:(0,O.jsx)(`button`,{className:`btn btn-primary`,onClick:_,children:v(`web3.action.deriveAddresses`,{count:n})})}),(0,O.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,O.jsx)(se,{size:14}),v(`web3.warning.privateKey`)]}),r.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:p,className:`web3-derive-th`,children:v(`web3.label.account`)}),(0,O.jsx)(`th`,{onClick:h,className:`web3-derive-th`,children:v(`web3.label.address`)}),(0,O.jsx)(`th`,{onClick:g,className:`web3-derive-th danger`,children:v(`web3.label.privateKeyToggle`,{action:v(o?`web3.action.hide`:`web3.action.show`)})})]})}),(0,O.jsx)(`tbody`,{children:r.map(e=>(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{children:i?e.index+1:``}),(0,O.jsx)(`td`,{translate:`no`,children:a?e.address:``}),(0,O.jsx)(`td`,{className:`danger`,children:(0,O.jsx)(`span`,{translate:`no`,children:o?e.privateKey:``})})]},e.index))})]})})]})]})}function Y({title:e,icon:t,children:n,accent:r=!1}){return(0,O.jsxs)(`div`,{className:`web3-key-card ${r?`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`,translate:`no`,children:n})]})}function Te(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function Ee({walletResult:e,keys:t,ipns:n,avatarSrc:r,showPrivateKey:i,onTogglePrivateKey:a}){let{t:o}=m(),s=e?.address||``;return!e||!s?(0,O.jsx)(j,{icon:(0,O.jsx)(g,{size:36}),message:o(`web3.empty.identity`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`web3-identity-card`,children:[(0,O.jsx)(`img`,{src:r,alt:`avatar`,className:`web3-identity-avatar`}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h1`,{className:`web3-identity-name`,children:e.username||o(`web3.notSignedIn`)}),(0,O.jsxs)(`div`,{className:`web3-identity-address`,children:[(0,O.jsx)(`code`,{translate:`no`,children:s.toLowerCase()}),(0,O.jsx)(b,{text:s.toLowerCase()}),(0,O.jsxs)(`a`,{href:`https://debank.com/profile/${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`link`,children:[(0,O.jsx)(v,{size:14}),o(`web3.action.view`)]})]})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-key-grid`,children:[(0,O.jsx)(Y,{title:o(`web3.label.ed25519Public`),icon:(0,O.jsx)(h,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:t.ed_public_key}),(0,O.jsx)(b,{text:t.ed_public_key})]})}),(0,O.jsx)(Y,{title:o(`web3.label.x25519Public`),icon:(0,O.jsx)(y,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:t.public_key}),(0,O.jsx)(b,{text:t.public_key})]})}),(0,O.jsx)(Y,{title:o(`web3.label.combinedPrivate`),icon:(0,O.jsx)(ce,{size:18}),accent:!0,children:(0,O.jsxs)(`div`,{className:`mono-row danger`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:i?t.private_key:Te(t.private_key)}),(0,O.jsx)(`button`,{className:`btn btn-icon`,onClick:a,title:o(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,O.jsx)(w,{size:14}):(0,O.jsx)(T,{size:14})})]})}),(0,O.jsx)(Y,{title:`IPNS ID`,icon:(0,O.jsx)(ae,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,O.jsx)(b,{text:n})]})})]})]})}function De({username:e,password:t,showPassword:n,generating:r,onUsernameChange:i,onPasswordChange:a,onTogglePassword:o,onGenerate:s}){let{t:c}=m();return(0,O.jsxs)(`div`,{className:`input-panel`,children:[(0,O.jsxs)(`div`,{className:`web3-tools-inputs`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:c(`login.username.placeholder`),value:e,onChange:e=>i(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:n?`text`:`password`,placeholder:c(`web3.login.passwordOptional`),value:t,onChange:e=>a(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:o,type:`button`,children:n?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]})]}),(0,O.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:s,disabled:!e.trim()||r,type:`button`,children:r?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`spinner`}),c(`web3.login.generating`)]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{size:16}),c(`web3.login.generateAndSignIn`)]})})]})}var X=e=>btoa(String.fromCharCode(...e)),Oe=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([4,34,4,32,...e.slice(0,32)]),r=new Uint8Array([2,1,0]),i=r.length+t.length+n.length,a=new Uint8Array(2+i);a[0]=48,a[1]=i;let o=2;return a.set(r,o),o+=r.length,a.set(t,o),o+=t.length,a.set(n,o),`-----BEGIN PRIVATE KEY-----\n${X(a).match(/.{1,64}/g)?.join(`
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,E as a,F as o,H as s,I as c,N as l,O as u,R as d,k as f,t as p}from"./useAppStore-DNhyhD20.js";import{a as m}from"./i18n-DKsg67mH.js";import{t as h}from"./fingerprint-pattern-BT73ASEB.js";import{i as g}from"./AccountMenu-B26qus-Q.js";import{t as _}from"./download-Cy2BlfKM.js";import{t as v}from"./external-link-D_AQSgxW.js";import{n as y,t as b}from"./CopyButton-BrEkzqEq.js";import{t as x}from"./lock-yG7M7GkB.js";import{t as S}from"./AppShell-BiYQsNO8.js";import{t as C}from"./wallet-D6HZocla.js";import{M as w,N as T,P as E,g as ee}from"./index-mjFWLwue.js";import{t as te}from"./AppTop-D-qYC0ep.js";import{n as ne,t as re}from"./mp-cEQteKUC.js";var ie=i(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ae=i(`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`}]]),oe=i(`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`}]]),se=i(`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`}]]),ce=i(`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`}]]),D=t(e()),O=n();function le(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function k({title:e,username:t,password:n,showPassword:r,showPrivateKey:i,account:a,onUsernameChange:o,onPasswordChange:s,onTogglePassword:c,onTogglePrivateKey:l,onGenerate:u}){let{t:d}=m();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:d(`web3.box.account.desc`)})]})}),(0,O.jsxs)(`div`,{className:`web3-box-login`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:d(`login.username.placeholder`),value:t,onChange:e=>o(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:r?`text`:`password`,placeholder:d(`web3.login.passwordOptional`),value:n,onChange:e=>s(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:c,type:`button`,children:r?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:u,disabled:!t.trim(),type:`button`,children:[(0,O.jsx)(y,{size:16}),d(`web3.box.account.generate`)]})]}),a?(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:d(`web3.label.address`)}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:a.address.toLowerCase()}),(0,O.jsx)(b,{text:a.address.toLowerCase()})]})]}),(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.x25519Public`)}),(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:a.publicKey}),(0,O.jsx)(b,{text:a.publicKey})]})]}),(0,O.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,O.jsx)(`span`,{children:d(`web3.label.x25519Private`)}),(0,O.jsxs)(`div`,{className:`mono-row danger`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:i?a.privateKey:le(a.privateKey)}),(0,O.jsx)(`button`,{className:`btn btn-icon`,onClick:l,title:d(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,O.jsx)(w,{size:14}):(0,O.jsx)(T,{size:14})})]})]})]}):null]})}function ue(e,t){return Number.isFinite(e)?t(e):`-`}function A({title:e,description:t,message:n,cipherText:r,decryptedText:i,error:a,encryptLabel:o,decryptLabel:s,messagePlaceholder:l,cipherPlaceholder:u,onMessageChange:d,onCipherTextChange:f,onEncrypt:p,onDecrypt:h}){let{t:g,formatDateTime:_}=m(),v=`box-message-${e.replaceAll(/\s+/g,`-`)}`,b=c(r);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:v,children:g(`web3.box.plaintext`)}),(0,O.jsx)(`textarea`,{id:v,className:`textarea`,value:n,onChange:e=>d(e.target.value),rows:4,placeholder:l,translate:`no`}),(0,O.jsxs)(`div`,{className:`web3-box-actions`,children:[(0,O.jsxs)(`button`,{className:`btn btn-primary`,onClick:p,type:`button`,children:[(0,O.jsx)(x,{size:16}),o]}),(0,O.jsxs)(`button`,{className:`btn btn-secondary`,onClick:h,type:`button`,children:[(0,O.jsx)(y,{size:16}),s]})]}),a&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:a}),(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:g(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:r,onChange:e=>f(e.target.value),rows:5,placeholder:u,translate:`no`})]}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:g(`web3.box.decryptResult`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:i,readOnly:!0,rows:5,placeholder:g(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]}),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:g(`web3.box.timestamp`)}),(0,O.jsx)(`code`,{translate:`no`,children:ue(b.timestampMs,_)})]}),(0,O.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,O.jsx)(`span`,{children:g(`web3.box.nonce`)}),(0,O.jsx)(`code`,{translate:`no`,children:b.nonce})]})]})]})}function de(e){let{t}=m();return(0,O.jsxs)(`div`,{className:`web3-box-workspace`,children:[(0,O.jsxs)(`div`,{className:`web3-box-grid`,children:[(0,O.jsx)(k,{title:t(`web3.box.accountA`),username:e.boxAUsername,password:e.boxAPassword,showPassword:e.boxAShowPassword,showPrivateKey:e.boxAShowPrivateKey,account:e.boxAAccount,onUsernameChange:e.onBoxAUsernameChange,onPasswordChange:e.onBoxAPasswordChange,onTogglePassword:e.onBoxAShowPasswordToggle,onTogglePrivateKey:e.onBoxAShowPrivateKeyToggle,onGenerate:e.onGenerateBoxA}),(0,O.jsx)(k,{title:t(`web3.box.accountB`),username:e.boxBUsername,password:e.boxBPassword,showPassword:e.boxBShowPassword,showPrivateKey:e.boxBShowPrivateKey,account:e.boxBAccount,onUsernameChange:e.onBoxBUsernameChange,onPasswordChange:e.onBoxBPasswordChange,onTogglePassword:e.onBoxBShowPasswordToggle,onTogglePrivateKey:e.onBoxBShowPrivateKeyToggle,onGenerate:e.onGenerateBoxB})]}),(0,O.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,O.jsx)(A,{title:`A → B`,description:t(`web3.box.flowAB.desc`),message:e.boxABMessage,cipherText:e.boxABCipherText,decryptedText:e.boxABDecryptedText,error:e.boxABError,encryptLabel:t(`web3.box.flowAB.encrypt`),decryptLabel:t(`web3.box.flowAB.decrypt`),messagePlaceholder:t(`web3.box.flowAB.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxABMessageChange,onCipherTextChange:e.onBoxABCipherTextChange,onEncrypt:e.onEncryptBoxAB,onDecrypt:e.onDecryptBoxAB}),(0,O.jsx)(A,{title:`B → A`,description:t(`web3.box.flowBA.desc`),message:e.boxBAMessage,cipherText:e.boxBACipherText,decryptedText:e.boxBADecryptedText,error:e.boxBAError,encryptLabel:t(`web3.box.flowBA.encrypt`),decryptLabel:t(`web3.box.flowBA.decrypt`),messagePlaceholder:t(`web3.box.flowBA.messagePlaceholder`),cipherPlaceholder:t(`web3.box.cipherPlaceholder`),onMessageChange:e.onBoxBAMessageChange,onCipherTextChange:e.onBoxBACipherTextChange,onEncrypt:e.onEncryptBoxBA,onDecrypt:e.onDecryptBoxBA})]}),(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:t(`web3.box.encryptTitle`)}),(0,O.jsx)(`p`,{children:t(`web3.box.encryptDesc`)})]})}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:e.boxEncryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.senderPrivatePlaceholder`),value:e.boxEncryptSenderPrivateKey,onChange:t=>e.onBoxEncryptSenderPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxEncryptShowPrivateKeyToggle,type:`button`,children:e.boxEncryptShowPrivateKey?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,O.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.recipientPublicPlaceholder`),value:e.boxEncryptRecipientPublicKey,onChange:t=>e.onBoxEncryptRecipientPublicKeyChange(t.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:t(`web3.box.plaintext`)})}),(0,O.jsx)(`textarea`,{className:`textarea`,value:e.boxEncryptMessage,onChange:t=>e.onBoxEncryptMessageChange(t.target.value),rows:4,placeholder:t(`web3.box.messagePlaceholder`),translate:`no`}),(0,O.jsx)(`div`,{className:`web3-box-actions`,children:(0,O.jsxs)(`button`,{className:`btn btn-primary`,onClick:e.onEncryptOnly,type:`button`,children:[(0,O.jsx)(x,{size:16}),t(`web3.box.encryptTitle`)]})}),e.boxEncryptError&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxEncryptError}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxEncryptCipherText,readOnly:!0,rows:5,placeholder:t(`web3.box.encryptResultPlaceholder`),translate:`no`})]})]}),(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:t(`web3.box.decryptTitle`)}),(0,O.jsx)(`p`,{children:t(`web3.box.decryptDesc`)})]})}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,O.jsx)(`input`,{type:`text`,placeholder:t(`web3.box.senderPublicPlaceholder`),value:e.boxDecryptSenderPublicKey,onChange:t=>e.onBoxDecryptSenderPublicKeyChange(t.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:t(`web3.box.recipient`)})}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:e.boxDecryptShowPrivateKey?`text`:`password`,placeholder:t(`web3.box.recipientPrivatePlaceholder`),value:e.boxDecryptRecipientPrivateKey,onChange:t=>e.onBoxDecryptRecipientPrivateKeyChange(t.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxDecryptShowPrivateKeyToggle,type:`button`,children:e.boxDecryptShowPrivateKey?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]}),(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptCipherText,onChange:t=>e.onBoxDecryptCipherTextChange(t.target.value),rows:5,placeholder:t(`web3.box.cipherDecryptPlaceholder`),translate:`no`}),(0,O.jsx)(`div`,{className:`web3-box-actions`,children:(0,O.jsxs)(`button`,{className:`btn btn-secondary`,onClick:e.onDecryptOnly,type:`button`,children:[(0,O.jsx)(y,{size:16}),t(`web3.box.decryptTitle`)]})}),e.boxDecryptError&&(0,O.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxDecryptError}),(0,O.jsxs)(`div`,{className:`web3-box-result`,children:[(0,O.jsx)(`label`,{className:`web3-box-result-header`,children:(0,O.jsx)(`span`,{children:t(`web3.box.decryptResult`)})}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptResult,readOnly:!0,rows:5,placeholder:t(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]})]})]})}function j({icon:e,message:t,className:n=`empty-state glass`}){return(0,O.jsxs)(`div`,{className:n,children:[(0,O.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,O.jsx)(`p`,{children:t})]})}function fe({label:e,pem:t,filename:n}){let{t:r}=m();function i(){let e=new Blob([t],{type:`text/plain`}),r=URL.createObjectURL(e),i=document.createElement(`a`);i.href=r,i.download=n,i.click(),URL.revokeObjectURL(r)}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.jsx)(b,{text:t,label:r(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,O.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:i,title:r(`common.download`),children:[(0,O.jsx)(_,{size:14}),r(`common.download`)]})]})]}),(0,O.jsx)(`textarea`,{className:`textarea mono`,value:t,readOnly:!0,rows:6,translate:`no`})]})}function pe({walletResult:e,publicPem:t,privatePem:n}){let{t:r}=m();if(!t||!n)return(0,O.jsx)(j,{icon:(0,O.jsx)(x,{size:36}),message:r(`web3.empty.pem`)});let i=e?.username||`wallet`;return(0,O.jsxs)(`div`,{className:`web3-pem-list`,children:[(0,O.jsx)(fe,{label:`${i}.pub`,pem:t,filename:`${i}.pub`}),(0,O.jsx)(fe,{label:`${i}.pem`,pem:n,filename:`${i}.pem`})]})}var me=Object.defineProperty,M=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,he=(e,t,n)=>t in e?me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t)=>{for(var n in t||={})N.call(t,n)&&he(e,n,t[n]);if(M)for(var n of M(t))P.call(t,n)&&he(e,n,t[n]);return e},I=(e,t)=>{var n={};for(var r in e)N.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&M)for(var r of M(e))t.indexOf(r)<0&&P.call(e,r)&&(n[r]=e[r]);return n},L;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}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 n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,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;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};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;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),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 r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}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 n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(L||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(L||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(L||={});var R=L,ge={L:R.QrCode.Ecc.LOW,M:R.QrCode.Ecc.MEDIUM,Q:R.QrCode.Ecc.QUARTILE,H:R.QrCode.Ecc.HIGH},z=128,B=`L`,V=`#FFFFFF`,H=`#000000`,U=!1,W=1,_e=4,ve=0,G=.1;function K(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ye(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function be(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*G),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function xe(e,t){return t==null?e?_e:ve:Math.max(Math.floor(t),0)}function q({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=D.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...R.QrSegment.makeSegments(t)),e),[]);return R.QrCode.encodeSegments(r,ge[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=D.useMemo(()=>{let e=c.getModules(),t=xe(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:be(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Se=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Ce=D.forwardRef(function(e,t){let n=e,{value:r,size:i=z,level:a=B,bgColor:o=V,fgColor:s=H,includeMargin:c=U,minVersion:l=W,boostLevel:u,marginSize:d,imageSettings:f}=n,p=I(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=I(p,[`style`]),g=f?.src,_=D.useRef(null),v=D.useRef(null),y=D.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=D.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});D.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ye(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Se?t.fill(new Path2D(K(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),D.useEffect(()=>{x(!1)},[g]);let E=F({height:i,width:i},m),ee=null;return g!=null&&(ee=D.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),D.createElement(D.Fragment,null,D.createElement(`canvas`,F({style:E,height:i,width:i,ref:y,role:`img`},h)),ee)});Ce.displayName=`QRCodeCanvas`;var J=D.forwardRef(function(e,t){let n=e,{value:r,size:i=z,level:a=B,bgColor:o=V,fgColor:s=H,includeMargin:c=U,minVersion:l=W,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=I(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=q({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ye(g,v.excavation)),b=D.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=K(y,h);return D.createElement(`svg`,F({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&D.createElement(`title`,null,d),D.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),D.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});J.displayName=`QRCodeSVG`;function we({walletResult:e,mnemonicPhrase:t,deriveBatch:n,deriveList:r,deriveShowIndex:i,deriveShowAddress:a,deriveShowPrivateKey:o,showAddressQr:s,showMnemonicReveal:c,showMnemonicQr:l,onToggleAddressQr:u,onToggleMnemonicReveal:d,onToggleMnemonicQr:f,onToggleDeriveIndex:p,onToggleDeriveAddress:h,onToggleDerivePrivateKey:g,onDerive:_}){let{t:v}=m(),x=e?.address||``;return!e||!x?(0,O.jsx)(j,{icon:(0,O.jsx)(C,{size:36}),message:v(`web3.empty.walletTools`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,O.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:u,children:[(0,O.jsx)(oe,{size:14}),v(s?`web3.action.hideAddressQr`:`web3.action.showAddressQr`),s?(0,O.jsx)(ie,{size:14}):(0,O.jsx)(E,{size:14})]}),s&&(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`,translate:`no`,children:x}),(0,O.jsx)(b,{text:x})]}),(0,O.jsx)(`div`,{className:`qr-wrap`,children:(0,O.jsx)(J,{value:x,size:200})})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,O.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:d,children:[(0,O.jsx)(y,{size:14}),v(c?`web3.action.hideMnemonic`:`web3.action.showMnemonic`),c?(0,O.jsx)(ie,{size:14}):(0,O.jsx)(E,{size:14})]}),c&&(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`,translate:`no`,children:t}),(0,O.jsx)(b,{text:t})]}),(0,O.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,O.jsx)(se,{size:14}),v(`web3.warning.mnemonic`)]}),(0,O.jsx)(`button`,{className:`web3-tools-toggle`,onClick:f,children:v(l?`web3.action.hideMnemonicQr`:`web3.action.showMnemonicQr`)}),l&&(0,O.jsx)(`div`,{className:`qr-wrap`,children:(0,O.jsx)(J,{value:t,size:260})})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,O.jsx)(`div`,{children:(0,O.jsx)(`button`,{className:`btn btn-primary`,onClick:_,children:v(`web3.action.deriveAddresses`,{count:n})})}),(0,O.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,O.jsx)(se,{size:14}),v(`web3.warning.privateKey`)]}),r.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:p,className:`web3-derive-th`,children:v(`web3.label.account`)}),(0,O.jsx)(`th`,{onClick:h,className:`web3-derive-th`,children:v(`web3.label.address`)}),(0,O.jsx)(`th`,{onClick:g,className:`web3-derive-th danger`,children:v(`web3.label.privateKeyToggle`,{action:v(o?`web3.action.hide`:`web3.action.show`)})})]})}),(0,O.jsx)(`tbody`,{children:r.map(e=>(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`td`,{children:i?e.index+1:``}),(0,O.jsx)(`td`,{translate:`no`,children:a?e.address:``}),(0,O.jsx)(`td`,{className:`danger`,children:(0,O.jsx)(`span`,{translate:`no`,children:o?e.privateKey:``})})]},e.index))})]})})]})]})}function Y({title:e,icon:t,children:n,accent:r=!1}){return(0,O.jsxs)(`div`,{className:`web3-key-card ${r?`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`,translate:`no`,children:n})]})}function Te(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function Ee({walletResult:e,keys:t,ipns:n,avatarSrc:r,showPrivateKey:i,onTogglePrivateKey:a}){let{t:o}=m(),s=e?.address||``;return!e||!s?(0,O.jsx)(j,{icon:(0,O.jsx)(g,{size:36}),message:o(`web3.empty.identity`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`web3-identity-card`,children:[(0,O.jsx)(`img`,{src:r,alt:`avatar`,className:`web3-identity-avatar`}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h1`,{className:`web3-identity-name`,children:e.username||o(`web3.notSignedIn`)}),(0,O.jsxs)(`div`,{className:`web3-identity-address`,children:[(0,O.jsx)(`code`,{translate:`no`,children:s.toLowerCase()}),(0,O.jsx)(b,{text:s.toLowerCase()}),(0,O.jsxs)(`a`,{href:`https://debank.com/profile/${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`link`,children:[(0,O.jsx)(v,{size:14}),o(`web3.action.view`)]})]})]})]}),t&&(0,O.jsxs)(`div`,{className:`web3-key-grid`,children:[(0,O.jsx)(Y,{title:o(`web3.label.ed25519Public`),icon:(0,O.jsx)(h,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:t.ed_public_key}),(0,O.jsx)(b,{text:t.ed_public_key})]})}),(0,O.jsx)(Y,{title:o(`web3.label.x25519Public`),icon:(0,O.jsx)(y,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:t.public_key}),(0,O.jsx)(b,{text:t.public_key})]})}),(0,O.jsx)(Y,{title:o(`web3.label.combinedPrivate`),icon:(0,O.jsx)(ce,{size:18}),accent:!0,children:(0,O.jsxs)(`div`,{className:`mono-row danger`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:i?t.private_key:Te(t.private_key)}),(0,O.jsx)(`button`,{className:`btn btn-icon`,onClick:a,title:o(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,O.jsx)(w,{size:14}):(0,O.jsx)(T,{size:14})})]})}),(0,O.jsx)(Y,{title:`IPNS ID`,icon:(0,O.jsx)(ae,{size:18}),children:(0,O.jsxs)(`div`,{className:`mono-row`,children:[(0,O.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,O.jsx)(b,{text:n})]})})]})]})}function De({username:e,password:t,showPassword:n,generating:r,onUsernameChange:i,onPasswordChange:a,onTogglePassword:o,onGenerate:s}){let{t:c}=m();return(0,O.jsxs)(`div`,{className:`input-panel`,children:[(0,O.jsxs)(`div`,{className:`web3-tools-inputs`,children:[(0,O.jsx)(`input`,{type:`text`,placeholder:c(`login.username.placeholder`),value:e,onChange:e=>i(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsxs)(`div`,{className:`input-wrap`,children:[(0,O.jsx)(`input`,{type:n?`text`:`password`,placeholder:c(`web3.login.passwordOptional`),value:t,onChange:e=>a(e.target.value),className:`input`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`}),(0,O.jsx)(`button`,{className:`input-eye`,onClick:o,type:`button`,children:n?(0,O.jsx)(T,{size:16}):(0,O.jsx)(w,{size:16})})]})]}),(0,O.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:s,disabled:!e.trim()||r,type:`button`,children:r?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`spinner`}),c(`web3.login.generating`)]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{size:16}),c(`web3.login.generateAndSignIn`)]})})]})}var X=e=>btoa(String.fromCharCode(...e)),Oe=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([4,34,4,32,...e.slice(0,32)]),r=new Uint8Array([2,1,0]),i=r.length+t.length+n.length,a=new Uint8Array(2+i);a[0]=48,a[1]=i;let o=2;return a.set(r,o),o+=r.length,a.set(t,o),o+=t.length,a.set(n,o),`-----BEGIN PRIVATE KEY-----\n${X(a).match(/.{1,64}/g)?.join(`
|
|
2
2
|
`)}\n-----END PRIVATE KEY-----`},ke=e=>{let t=new Uint8Array([48,5,6,3,43,101,112]),n=new Uint8Array([3,33,0,...e]),r=t.length+n.length,i=new Uint8Array(2+r);i[0]=48,i[1]=r;let a=2;return i.set(t,a),a+=t.length,i.set(n,a),`-----BEGIN PUBLIC KEY-----\n${X(i).match(/.{1,64}/g)?.join(`
|
|
3
3
|
`)}\n-----END PUBLIC KEY-----`},Ae=[`wallet`,`pem`,`export`,`EA`];function je(){let e=window.location.hash.replace(`#`,``);return Ae.includes(e)?e:`wallet`}function Me(){let{t:e}=m(),t=p(e=>e.addToast),n=a(e=>e.setUserIdentity),[i,s]=(0,D.useState)(`wallet`),[c,h]=(0,D.useState)(``),[_,v]=(0,D.useState)(``),[b,w]=(0,D.useState)(!1),[T,E]=(0,D.useState)(null),[ie,ae]=(0,D.useState)(null),[oe,se]=(0,D.useState)(``),[ce,le]=(0,D.useState)(``),[k,ue]=(0,D.useState)(``),[A,j]=(0,D.useState)(``),[fe,me]=(0,D.useState)([]),[M,N]=(0,D.useState)(0),[P,he]=(0,D.useState)(!0),[F,I]=(0,D.useState)(!0),[L,R]=(0,D.useState)(!1),[ge,z]=(0,D.useState)(!1),[B,V]=(0,D.useState)(!1),[H,U]=(0,D.useState)(!1),[W,_e]=(0,D.useState)(!1),[ve,G]=(0,D.useState)(!1),[K,ye]=(0,D.useState)(``),[be,xe]=(0,D.useState)(``),[q,Se]=(0,D.useState)(!1),[Ce,J]=(0,D.useState)(!1),[Y,Te]=(0,D.useState)(null),[X,Ae]=(0,D.useState)(``),[Me,Ne]=(0,D.useState)(``),[Pe,Fe]=(0,D.useState)(!1),[Ie,Le]=(0,D.useState)(!1),[Z,Re]=(0,D.useState)(null),[ze,Be]=(0,D.useState)(`Hello B. This is from A.`),[Ve,He]=(0,D.useState)(``),[Ue,We]=(0,D.useState)(``),[Ge,Ke]=(0,D.useState)(``),[qe,Je]=(0,D.useState)(`Hello A. This is from B.`),[Ye,Xe]=(0,D.useState)(``),[Ze,Qe]=(0,D.useState)(``),[$e,et]=(0,D.useState)(``),[tt,nt]=(0,D.useState)(``),[rt,it]=(0,D.useState)(``),[at,ot]=(0,D.useState)(``),[st,ct]=(0,D.useState)(``),[lt,Q]=(0,D.useState)(``),[ut,dt]=(0,D.useState)(!1),[ft,pt]=(0,D.useState)(``),[mt,ht]=(0,D.useState)(``),[gt,_t]=(0,D.useState)(``),[vt,yt]=(0,D.useState)(``),[bt,$]=(0,D.useState)(``),[xt,St]=(0,D.useState)(!1);(0,D.useEffect)(()=>{s(je());let e=()=>s(je());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let Ct=e=>{s(e),window.location.hash=e},wt=(0,D.useCallback)(async()=>{if(!c.trim())return;G(!0),await new Promise(e=>setTimeout(e,0));let r=o(c.trim(),_),i=`${r.username}#${r.address.slice(-4).toUpperCase()}`;E(r),n({...r,displayName:i}),t(e(`login.toast.signedIn`,{username:r.username}),`success`),j(l(r.danger));let a=u(r.danger);ae(a),se(ne(a.private_key,a.ed_public_key));let s=re(a.private_key,a.ed_public_key);le(Oe(s.secretKey)),ue(ke(s.publicKey)),me([]),N(0),z(!1),V(!1),U(!1),_e(!1),G(!1)},[t,_,n,e,c]);function Tt(n,r,i){let a=n.trim();if(!a)return;let s=o(a,r),c=u(s.danger);i({username:s.username,address:s.address,publicKey:c.public_key,privateKey:c.private_key}),We(``),Ke(``),Qe(``),et(``),t(e(`web3.toast.accountGenerated`),`success`)}function Et({senderAccount:t,recipientAccount:n,message:i,setCipherText:a,setDecryptedText:o,setError:s}){if(!t||!n){s(e(`web3.error.accountsRequired`));return}if(!i.trim()){s(e(`web3.error.messageRequired`));return}a(r(i,{senderPrivateKey:t.privateKey,recipientPublicKey:n.publicKey})),o(``),s(``)}function Dt({senderAccount:t,recipientAccount:n,cipherText:r,setDecryptedText:i,setError:a}){if(!t||!n){a(e(`web3.error.accountsRequired`));return}if(!r.trim()){a(e(`web3.error.cipherRequired`));return}let o=f(r,{senderPublicKey:t.publicKey,recipientPrivateKey:n.privateKey});if(!o){a(e(`web3.error.decryptFailed`)),i(``);return}i(o),a(``)}function Ot(){if(!tt.trim()){Q(e(`web3.error.senderPublicRequired`));return}if(!rt.trim()){Q(e(`web3.error.recipientPrivateRequired`));return}if(!at.trim()){Q(e(`web3.error.cipherRequired`));return}let t=f(at,{senderPublicKey:tt.trim(),recipientPrivateKey:rt.trim()});if(!t){Q(e(`web3.error.decryptFailed`)),ct(``);return}ct(t),Q(``)}function kt(){if(!ft.trim()){$(e(`web3.error.senderPrivateRequired`));return}if(!mt.trim()){$(e(`web3.error.recipientPublicRequired`));return}if(!gt.trim()){$(e(`web3.error.messageRequired`));return}yt(r(gt,{senderPrivateKey:ft.trim(),recipientPublicKey:mt.trim()})),$(``)}let At=()=>{if(!A)return;let e=[];for(let t=M;t<M+10;t++){let n=`m/44'/60'/0'/0/${t}`,r=d.fromPhrase(A,void 0,n);e.push({index:t,address:r.address,privateKey:r.privateKey})}me(t=>[...t,...e]),N(e=>e+10)},jt=ee(T?.address||void 0),Mt=i===`wallet`?`web3.view.wallet`:i===`pem`?`web3.view.pem`:i===`EA`?`web3.view.asymmetric`:`web3.view.export`,Nt=[{id:`wallet`,icon:(0,O.jsx)(g,{size:16}),labelKey:`web3.view.wallet`},{id:`pem`,icon:(0,O.jsx)(x,{size:16}),labelKey:`web3.view.pem`},{id:`export`,icon:(0,O.jsx)(C,{size:16}),labelKey:`web3.view.export`},{id:`EA`,icon:(0,O.jsx)(y,{size:16}),labelKey:`web3.view.asymmetric`}],Pt=i!==`EA`;return(0,O.jsx)(S,{sidebar:({closeSidebar:t})=>(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(te,{onNavigate:t}),(0,O.jsx)(`nav`,{className:`sidebar-nav`,children:Nt.map(n=>(0,O.jsxs)(`button`,{onClick:()=>{Ct(n.id),t()},className:`sidebar-nav-btn ${i===n.id?`active`:``}`,children:[n.icon,(0,O.jsx)(`span`,{children:e(n.labelKey)})]},n.id))})]}),headerTitle:(0,O.jsx)(`h2`,{className:`header-title`,children:e(Mt)}),children:(0,O.jsx)(`div`,{className:`web3-page`,children:(0,O.jsxs)(`div`,{className:`web3-container ${i===`EA`?`wide`:``}`,children:[Pt&&(0,O.jsx)(De,{username:c,password:_,showPassword:b,generating:ve,onUsernameChange:h,onPasswordChange:v,onTogglePassword:()=>w(!b),onGenerate:wt}),i===`wallet`&&(0,O.jsx)(Ee,{walletResult:T,keys:ie,ipns:oe,avatarSrc:jt,showPrivateKey:W,onTogglePrivateKey:()=>_e(!W)}),i===`pem`&&(0,O.jsx)(pe,{walletResult:T,publicPem:k,privatePem:ce}),i===`export`&&(0,O.jsx)(we,{walletResult:T,mnemonicPhrase:A,deriveBatch:10,deriveList:fe,deriveShowIndex:P,deriveShowAddress:F,deriveShowPrivateKey:L,showAddressQr:ge,showMnemonicReveal:B,showMnemonicQr:H,onToggleAddressQr:()=>z(!ge),onToggleMnemonicReveal:()=>V(!B),onToggleMnemonicQr:()=>U(!H),onToggleDeriveIndex:()=>he(!P),onToggleDeriveAddress:()=>I(!F),onToggleDerivePrivateKey:()=>R(!L),onDerive:At}),i===`EA`&&(0,O.jsx)(de,{boxAUsername:K,boxAPassword:be,boxAShowPassword:q,boxAShowPrivateKey:Ce,boxAAccount:Y,boxBUsername:X,boxBPassword:Me,boxBShowPassword:Pe,boxBShowPrivateKey:Ie,boxBAccount:Z,boxABMessage:ze,boxABCipherText:Ve,boxABDecryptedText:Ue,boxABError:Ge,boxBAMessage:qe,boxBACipherText:Ye,boxBADecryptedText:Ze,boxBAError:$e,boxEncryptSenderPrivateKey:ft,boxEncryptRecipientPublicKey:mt,boxEncryptMessage:gt,boxEncryptCipherText:vt,boxEncryptError:bt,boxEncryptShowPrivateKey:xt,boxDecryptSenderPublicKey:tt,boxDecryptRecipientPrivateKey:rt,boxDecryptCipherText:at,boxDecryptResult:st,boxDecryptError:lt,boxDecryptShowPrivateKey:ut,onBoxAUsernameChange:ye,onBoxAPasswordChange:xe,onBoxAShowPasswordToggle:()=>Se(!q),onBoxAShowPrivateKeyToggle:()=>J(!Ce),onGenerateBoxA:()=>Tt(K,be,Te),onBoxBUsernameChange:Ae,onBoxBPasswordChange:Ne,onBoxBShowPasswordToggle:()=>Fe(!Pe),onBoxBShowPrivateKeyToggle:()=>Le(!Ie),onGenerateBoxB:()=>Tt(X,Me,Re),onBoxABMessageChange:Be,onBoxABCipherTextChange:He,onEncryptBoxAB:()=>Et({senderAccount:Y,recipientAccount:Z,message:ze,setCipherText:He,setDecryptedText:We,setError:Ke}),onDecryptBoxAB:()=>Dt({senderAccount:Y,recipientAccount:Z,cipherText:Ve,setDecryptedText:We,setError:Ke}),onBoxBAMessageChange:Je,onBoxBACipherTextChange:Xe,onEncryptBoxBA:()=>Et({senderAccount:Z,recipientAccount:Y,message:qe,setCipherText:Xe,setDecryptedText:Qe,setError:et}),onDecryptBoxBA:()=>Dt({senderAccount:Z,recipientAccount:Y,cipherText:Ye,setDecryptedText:Qe,setError:et}),onBoxEncryptSenderPrivateKeyChange:pt,onBoxEncryptRecipientPublicKeyChange:ht,onBoxEncryptMessageChange:_t,onBoxEncryptShowPrivateKeyToggle:()=>St(!xt),onEncryptOnly:kt,onBoxDecryptSenderPublicKeyChange:nt,onBoxDecryptRecipientPrivateKeyChange:it,onBoxDecryptCipherTextChange:ot,onBoxDecryptShowPrivateKeyToggle:()=>dt(!ut),onDecryptOnly:Ot})]})})})}var Ne=s(`/web3/`)({component:Me});export{Ne as Route};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,E as a,H as o,O as s,_ as c,g as l,h as u,k as d,t as f,x as p,y as m}from"./useAppStore-DNhyhD20.js";import{a as h}from"./i18n-C6yaqRst.js";import{t as g}from"./copy-OwXDsstV.js";import{t as _}from"./AppShell-BdRKZIZ9.js";import{t as ee}from"./play-DSHtNcOe.js";import{a as v,i as te,n as ne,r as re,t as ie}from"./useGameRoom-asr2gyY6.js";import{M as ae,g as oe}from"./index-D1mozno-.js";var se=i(`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`}]]),y=t(e(),1),b=[10,20,50,100],x=[`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`J`,`Q`,`K`,`A`],S=[`D`,`C`,`H`,`S`],C=new Map(x.map((e,t)=>[e,t+2])),ce=new Map(S.map((e,t)=>[e,t+1])),w={high:1,pair:2,straight:3,flush:4,straightFlush:5,triple:6},le={[w.high]:`散牌`,[w.pair]:`对子`,[w.straight]:`顺子`,[w.flush]:`金花`,[w.straightFlush]:`顺金`,[w.triple]:`豹子`};function T(e){return m(e)}function E(e=`zhajinhua`){return u(e)}function D(){return E(`round`)}function O(){let e=[];for(let t of S)for(let n of x)e.push(`${n}${t}`);return e}function k(e=O(),t=Math.random){let n=[...e];for(let e=n.length-1;e>0;e--){let r=Math.floor(t()*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}function A(e){let t=String(e||``).trim().toUpperCase(),n=t.slice(-1),r=t.slice(0,-1);if(!C.has(r)||!ce.has(n))throw Error(`Invalid card: ${e}`);return{id:`${r}${n}`,rank:r,suit:n,rankValue:C.get(r),suitValue:ce.get(n)}}function j(e,t){let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r]||0,i=t[r]||0;if(n!==i)return n-i}return 0}function M(e){let t=[...new Set(e)].sort((e,t)=>e-t);return t.length===3?t[0]===2&&t[1]===3&&t[2]===14?3:t[0]+1===t[1]&&t[1]+1===t[2]?t[2]:0:0}function N(e){if(!Array.isArray(e)||e.length!==3)throw Error(`炸金花手牌必须是 3 张牌`);let t=e.map(A),n=t.map(e=>e.rankValue),r=new Map;for(let e of n)r.set(e,(r.get(e)||0)+1);let i=new Set(t.map(e=>e.suit)).size===1,a=M(n),o=[...n].sort((e,t)=>t-e),s=Math.max(...t.map(e=>e.suitValue)),c=w.high,l=o;return r.size===1?(c=w.triple,l=[o[0]]):a&&i?(c=w.straightFlush,l=[a]):i?(c=w.flush,l=o):a?(c=w.straight,l=[a]):r.size===2&&(c=w.pair,l=[[...r.entries()].find(([,e])=>e===2)[0],[...r.entries()].find(([,e])=>e===1)[0]]),{category:c,label:le[c],tiebreakers:l,tieSuit:s,cards:t.map(e=>e.id)}}function P(e,t){let n=N(e),r=N(t);if(n.category!==r.category)return n.category-r.category;let i=j(n.tiebreakers,r.tiebreakers);return i===0?n.tieSuit-r.tieSuit:i}function ue(e){return N(e).label}function de({roundId:e,action:t,amount:n,target:r}){return{roundId:e,eventId:E(`action`),action:t,amount:n,target:r}}function fe(e=[]){let t=e.filter(e=>Number(e.chips)>=10);return t.length>=2&&t.length<=5}function pe({roomCode:e,players:t,hostAddress:n,previousSeq:r=0,previousWinner:i=``,roundId:a=D(),random:o=Math.random}){let s=t.filter(e=>Number(e.chips)>=10).slice(0,5);if(s.length<2)throw Error(`至少需要 2 名有足够筹码的玩家`);let u=k(O(),o),d={},f=s.map((e,t)=>{let n=u.slice(t*3,t*3+3);return d[e.address]=n,{address:e.address,name:e.name,avatar:c(e.avatar),publicKey:e.publicKey,chips:Number(e.chips)-10,status:`active`,looked:!1,bet:10}}),p,m=l(i),h=m?f.findIndex(e=>l(e.address)===m):-1;return p=h>=0?f[h].address:f[Math.floor(o()*f.length)].address,{roomCode:T(e),roundId:a,status:`playing`,host:l(n),seq:r+1,startedAt:Date.now(),ante:10,pot:10*f.length,currentBet:10,turnAddress:p,players:f,lastAction:`本局开始`,winner:null,showdown:null,appliedEventIds:[],hands:d,actionCounts:{},compareReveal:{}}}function me(e){if(!e)return null;let t={...e};return delete t.hands,W(t)}function he(e,t){let n=F(e);return!n||!t||typeof t!=`object`?null:{...n,hands:W(t)}}function F(e){return!e||typeof e!=`object`||!e.roundId||!Array.isArray(e.players)?null:{roomCode:T(e.roomCode),roundId:String(e.roundId),status:e.status===`finished`?`finished`:`playing`,host:l(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:l(e.turnAddress),players:e.players.map(U).filter(Boolean),lastAction:String(e.lastAction||``),winner:e.winner?l(e.winner):null,showdown:e.showdown&&typeof e.showdown==`object`?W(e.showdown):null,appliedEventIds:Array.isArray(e.appliedEventIds)?e.appliedEventIds.map(String):[],actionCounts:e.actionCounts&&typeof e.actionCounts==`object`?W(e.actionCounts):{},compareReveal:e.compareReveal&&typeof e.compareReveal==`object`?W(e.compareReveal):{},lastCompare:e.lastCompare&&typeof e.lastCompare==`object`?W(e.lastCompare):null,finishedAt:e.finishedAt?Number(e.finishedAt):null}}function I(e,t,n){let r=F(e);if(!r||r.status!==`playing`)return{ok:!1,error:`当前没有进行中的牌局`};let i=l(n),a=r.players.find(e=>e.address===i);if(!a||a.status!==`active`)return{ok:!1,error:`玩家不在本轮牌局中`};if(r.turnAddress!==i)return{ok:!1,error:`还没有轮到你操作`};let o=t?.action;if(![`look`,`call`,`raise`,`compare`,`fold`].includes(o))return{ok:!1,error:`未知操作`};if(o===`look`)return a.looked?{ok:!1,error:`已经看过牌`}:{ok:!0};if(o===`call`)return a.chips>=10?{ok:!0}:{ok:!1,error:`筹码不足,不能跟注`};if(o===`raise`){let e=Number(t.amount);if(!b.includes(e))return{ok:!1,error:`加注档位无效`};let n=r.currentBet+e-a.bet;return a.chips>=n?{ok:!0}:{ok:!1,error:`筹码不足,不能加注`}}if(o===`compare`){let e=l(t.target),n=r.players.find(t=>t.address===e);if(!e||e===i||!n||n.status!==`active`)return{ok:!1,error:`请选择有效的比牌对象`};if(!r.players.filter(e=>e.status===`active`).every(e=>(r.actionCounts?.[e.address]||0)>=1))return{ok:!1,error:`第一轮不能比牌,请先跟注或加注`};let o=Math.max(0,r.currentBet-a.bet);return a.chips>=o?{ok:!0}:{ok:!1,error:`筹码不足,不能比牌`}}return{ok:!0}}function L(e,t,n){let r=I(e,t,n);if(!r.ok)return{ok:!1,error:r.error,state:e};let i=W(e),a=l(n),o=i.players.find(e=>e.address===a),s=String(t.eventId);if(i.appliedEventIds?.includes(s))return{ok:!0,state:i,duplicate:!0};if(Array.isArray(i.appliedEventIds)||(i.appliedEventIds=[]),i.appliedEventIds.push(s),t.action===`look`)return o.looked=!0,i.lastAction=`${o.name} 看牌`,H(i);if(t.action===`fold`)return o.status=`folded`,i.lastAction=`${o.name} 弃牌`,B(i,a),V(i,a);if(t.action===`call`)return o.chips-=10,o.bet+=10,i.pot+=10,i.lastAction=`${o.name} 跟注`,B(i,a),V(i,a);if(t.action===`raise`){let e=Number(t.amount);return i.currentBet+=e,z(i,o),i.lastAction=`${o.name} 加注 ${e}`,B(i,a),V(i,a)}if(t.action===`compare`){z(i,o);let e=l(t.target),n=i.players.find(t=>t.address===e),r=o.looked,s=n.looked,c=P(i.hands?.[a]||[],i.hands?.[e]||[]),u=c>=0?o:n,d=c>=0?n:o;d.status=`folded`,d.looked=!0,i.compareReveal||={};let f=r&&s,p=!r&&!s;if(f)i.compareReveal[a]=i.hands?.[e]||[],i.compareReveal[e]=i.hands?.[a]||[];else if(p)i.compareReveal[d.address]=i.hands?.[u.address]||[];else{let e=r?o:n,t=r?n:o;i.compareReveal[e.address]=i.hands?.[t.address]||[],i.compareReveal[d.address]=i.hands?.[u.address]||[]}return i.lastCompare={initiator:a,target:e,winner:u.address,loser:d.address,initiatorLooked:r,targetLooked:s,timestamp:Date.now()},i.lastAction=`${o.name} 与 ${n.name} 比牌,${d.name} 出局`,B(i,a),V(i,a)}return{ok:!1,error:`未知操作`,state:e}}function R(e){return(e?.players||[]).filter(e=>e.status===`active`)}function ge(e,t){let n=(e?.players||[]).find(e=>e.address===l(t));if(!e||e.status!==`playing`||!n||n.status!==`active`||e.turnAddress!==n.address)return[];let r=[];return n.looked||r.push(`look`),I(e,{action:`call`},n.address).ok&&r.push(`call`),b.some(t=>I(e,{action:`raise`,amount:t},n.address).ok)&&r.push(`raise`),R(e).length>1&&e.players.filter(e=>e.status===`active`).every(t=>(e.actionCounts?.[t.address]||0)>=1)&&r.push(`compare`),r.push(`fold`),r}function z(e,t){let n=Math.max(0,e.currentBet-t.bet);t.chips-=n,t.bet+=n,e.pot+=n}function B(e,t){e.actionCounts||={},e.actionCounts[t]=(e.actionCounts[t]||0)+1}function V(e,t){let n=R(e);return n.length===1?_e(e,n[0].address):(e.turnAddress=ve(e,t),H(e))}function _e(e,t){let n=e.players.find(e=>e.address===t),r=e.pot;return n&&(n.chips+=e.pot),e.status=`finished`,e.winner=t,e.winAmount=r,e.turnAddress=``,e.showdown=e.hands?W(e.hands):null,e.lastAction=n?`${n.name} 赢得 ${r} 筹码`:`本局结束`,e.pot=0,e.finishedAt=Date.now(),H(e)}function ve(e,t){let n=e.players,r=Math.max(0,n.findIndex(e=>e.address===l(t)));for(let e=1;e<=n.length;e++){let t=n[(r+e)%n.length];if(t.status===`active`)return t.address}return``}function H(e){return e.seq=Number(e.seq||0)+1,{ok:!0,state:e}}function U(e){if(!e||typeof e!=`object`)return null;let t=l(e.address);return t?{address:t,name:String(e.name||p(t)).slice(0,50),avatar:c(e.avatar),publicKey:String(e.publicKey||``),chips:Math.max(0,Number(e.chips)||0),status:e.status===`folded`?`folded`:`active`,looked:e.looked===!0,bet:Math.max(0,Number(e.bet)||0)}:null}function W(e){return JSON.parse(JSON.stringify(e))}var G={page:`_page_p8eol_1`,headerActions:`_headerActions_p8eol_12`,entry:`_entry_p8eol_18`,entryBrand:`_entryBrand_p8eol_28`,cardMark:`_cardMark_p8eol_34`,entryPanel:`_entryPanel_p8eol_62`,accountLine:`_accountLine_p8eol_72`,joinForm:`_joinForm_p8eol_89`,status:`_status_p8eol_110`,board:`_board_p8eol_116`,table:`_table_p8eol_123`,tableCenter:`_tableCenter_p8eol_144`,finishBanner:`_finishBanner_p8eol_173`,finishBannerIcon:`_finishBannerIcon_p8eol_192`,seats:`_seats_p8eol_196`,seat:`_seat_p8eol_196`,seatTurn:`_seatTurn_p8eol_218`,seatWinner:`_seatWinner_p8eol_223`,seatFolded:`_seatFolded_p8eol_228`,seatAvatar:`_seatAvatar_p8eol_232`,seatAvatarOffline:`_seatAvatarOffline_p8eol_252`,onlineDot:`_onlineDot_p8eol_257`,seatMain:`_seatMain_p8eol_269`,seatMeta:`_seatMeta_p8eol_270`,panel:`_panel_p8eol_301`,panelSection:`_panelSection_p8eol_308`,panelTitle:`_panelTitle_p8eol_318`,hand:`_hand_p8eol_328`,card:`_card_p8eol_34`,red:`_red_p8eol_362`,black:`_black_p8eol_366`,cardBack:`_cardBack_p8eol_370`,handLabel:`_handLabel_p8eol_391`,actionGrid:`_actionGrid_p8eol_398`,raiseRow:`_raiseRow_p8eol_399`,statusGrid:`_statusGrid_p8eol_410`,muted:`_muted_p8eol_428`,compareOverlay:`_compareOverlay_p8eol_435`,compareBox:`_compareBox_p8eol_447`,compareTitle:`_compareTitle_p8eol_461`,comparePlayers:`_comparePlayers_p8eol_467`,compareSide:`_compareSide_p8eol_474`,compareWinner:`_compareWinner_p8eol_486`,compareName:`_compareName_p8eol_491`,compareCards:`_compareCards_p8eol_502`,compareLabel:`_compareLabel_p8eol_527`,compareVs:`_compareVs_p8eol_533`,compareResult:`_compareResult_p8eol_540`},K=n(),q=`zhajinhua`;function J(...e){return e.filter(Boolean).join(` `)}function Y(e,t){return String(e||``).toLowerCase()===String(t||``).toLowerCase()}function ye(e=``){return e?`${e.slice(0,6)}...${e.slice(-4)}`:``}function be(e){return e.displayName||e.username}function xe(e){let t=String(e||``),n=t.slice(-1);return{rank:t.slice(0,-1),suit:{S:`♠`,H:`♥`,C:`♣`,D:`♦`}[n]||n,color:n===`H`||n===`D`?`red`:`black`}}function X(){let{t:e}=h(),t=f(e=>e.addToast),n=a(e=>e.initializeUser),[i,o]=(0,y.useState)(``),[c,l]=(0,y.useState)(!1),u=(0,y.useRef)(``),p=(0,y.useRef)(!1),[m,x]=(0,y.useState)(20),[S,C]=(0,y.useState)(``),[ce,w]=(0,y.useState)({}),[le,T]=(0,y.useState)(!0),[E,D]=(0,y.useState)(!1),O=(0,y.useRef)(null),k=(0,y.useRef)(new Set),A=ie({gameId:q,onError:e=>t(e,`error`),getPlayerPayload:e=>{let t=s(e.danger);return{address:e.address,name:be(e),avatar:e.avatar||``,publicKey:t.public_key,joinedAt:Date.now()}}}),j=(0,y.useMemo)(()=>A.userIdentity?.danger?s(A.userIdentity.danger):null,[A.userIdentity?.danger]);(0,y.useEffect)(()=>{n()},[n]),(0,y.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get(`room`)?.toUpperCase();e&&(o(e),u.current=e)},[]),(0,y.useEffect)(()=>{let n=u.current;!n||p.current||!A.isBackendReady||!A.userIdentity||(p.current=!0,u.current=``,A.joinRoom(n).then(n=>{n&&t(e(`game.toast.joinedRoom`),`success`)}))},[A.isBackendReady,A.userIdentity,A.joinRoom,t,e]),(0,y.useEffect)(()=>{if(!A.roomCode)return;let e=`/game/zhajinhua?room=${A.roomCode}`;`${window.location.pathname}${window.location.search}`!==e&&window.history.replaceState(null,``,e)},[A.roomCode]);let M=(0,y.useMemo)(()=>ne(A.messages,{gameId:q,roomCode:A.roomCode}),[A.messages,A.roomCode]),N=(0,y.useMemo)(()=>re(A.messages,{gameId:q,roomCode:A.roomCode}),[A.messages,A.roomCode])?.payload?.round||null,P=N?.host||M.hostAddress,F=Y(P,A.userIdentity?.address),I=A.userIdentity?.address?.toLowerCase()||``,z=N?.players.find(e=>Y(e.address,I)),B=z||M.players.find(e=>Y(e.address,I)),V=ce[N?.roundId||``]||null,_e=N?.showdown&&I?N.showdown[I]:null,ve=N?.compareReveal&&I?N.compareReveal[I]:null,H=_e||ve||(z?.looked?V:null),U=ge(N,I),W=R(N),X=F&&fe(M.players.map(e=>({...e,chips:N?.players.find(t=>Y(t.address,e.address))?.chips??1e3}))),Q=A.roomCode&&typeof window<`u`?`${window.location.origin}/game/zhajinhua?room=${A.roomCode}`:``;(0,y.useEffect)(()=>{if(!(!N||!A.userIdentity||!j||!P))for(let e of A.roomEvents){let t=e.event;if(!t||t.event!==`deal:private`)continue;let n=t.payload;if(n.roundId!==N.roundId||!Y(n.recipient,A.userIdentity.address))continue;let r=d(n.encrypted||``,{senderPublicKey:n.senderPublicKey||``,recipientPrivateKey:j.private_key});if(r)try{let e=JSON.parse(r);Array.isArray(e)&&w(t=>({...t,[N.roundId]:e.map(String)}))}catch{}}},[N?.roundId,A.roomEvents,A.userIdentity,P,j?.private_key]),(0,y.useEffect)(()=>{if(N?.status===`finished`&&N.winner){T(!0);let e=setTimeout(()=>T(!1),5e3);return()=>clearTimeout(e)}},[N?.finishedAt,N?.status,N?.winner]),(0,y.useEffect)(()=>{if(N?.lastCompare?.timestamp){D(!0);let e=setTimeout(()=>D(!1),5e3);return()=>clearTimeout(e)}else D(!1)},[N?.lastCompare?.timestamp,N?.roundId]),(0,y.useEffect)(()=>{if(!F||!N||N.status!==`playing`)return;let e=O.current;if(!e)return;let t=A.roomEvents.filter(e=>{let t=e.event;if(!t||t.event!==`player:action`)return!1;let n=t.payload.actionEvent;return!(!n||n.roundId!==N.roundId||k.current.has(n.eventId)||N.appliedEventIds?.includes(n.eventId))});if(t.length===0)return;let n=!1;async function r(){let r=he(N,e);if(r)for(let e of t){if(n)return;let t=(e.event?.payload).actionEvent,i=L(r,t,e.message.author);if(!i.ok){let n=e.message.author;if(!Y(n,A.userIdentity?.address)&&r.status===`playing`&&Y(r.turnAddress,n)){let e=L(r,de({roundId:r.roundId,action:`call`,amount:void 0,target:void 0}),n);if(e.ok)i=e;else{let e=L(r,de({roundId:r.roundId,action:`fold`,amount:void 0,target:void 0}),n);e.ok&&(i=e)}}if(!i.ok){k.current.add(t.eventId);continue}}if(r=i.state,O.current=i.state.hands,await De(i.state)&&k.current.add(t.eventId),i.state.status===`finished`)break}}return r(),()=>{n=!0}},[N?.roundId,N?.seq,N?.status,A.roomEvents,F]);async function we(){await A.createRoom()&&t(e(`game.toast.roomCreated`),`success`)}async function Te(n){n.preventDefault(),await A.joinRoom(i)&&t(e(`game.toast.joinedRoom`),`success`)}async function Ee(){Q&&(await navigator.clipboard.writeText(Q),l(!0),setTimeout(()=>l(!1),1400))}async function De(e){return A.sendRoomEvent(`room:state`,{round:me(e),seq:e.seq})}async function Oe(){if(!A.userIdentity||!j||!X){t(e(`game.zhajinhua.error.notEnoughPlayers`),`error`);return}try{let n=M.players.map(e=>({...e,chips:N?.players.find(t=>Y(t.address,e.address))?.chips??1e3})),i=pe({roomCode:A.roomCode,players:n,hostAddress:A.userIdentity.address,previousSeq:N?.seq||0,previousWinner:N?.winner||``});O.current=i.hands,k.current.clear(),await De(i);for(let e of i.players){let t=r(JSON.stringify(i.hands[e.address]),{senderPrivateKey:j.private_key,recipientPublicKey:e.publicKey});await A.sendRoomEvent(`deal:private`,{roundId:i.roundId,recipient:e.address,senderPublicKey:j.public_key,encrypted:t})}w(e=>({...e,[i.roundId]:i.hands[A.userIdentity.address.toLowerCase()]})),t(e(`game.zhajinhua.toast.roundStarted`),`success`)}catch(n){t(n instanceof Error?n.message:e(`game.zhajinhua.error.startFailed`),`error`)}}async function $(e,t={}){if(!N||!A.userIdentity)return;let n=de({roundId:N.roundId,action:e,amount:t.amount,target:t.target});await A.sendRoomEvent(`player:action`,{actionEvent:n})}let ke=N?.status===`playing`?Y(N.turnAddress,I)?e(`game.zhajinhua.status.yourTurn`):N.turnAddress?e(`game.zhajinhua.status.waitingPlayer`,{player:Z(N.turnAddress,M.players,A.presenceByAddress)}):e(`game.status.playing`):N?.status===`finished`?e(`game.status.finished`):e(`game.status.waitingStart`),Ae=W.filter(e=>!Y(e.address,I));return(0,K.jsx)(_,{sidebar:({closeSidebar:e})=>(0,K.jsx)(te,{activeGame:`zhajinhua`,closeSidebar:e}),headerTitle:(0,K.jsx)(`h2`,{className:`header-title`,children:e(`game.zhajinhua.title`)}),headerRight:(0,K.jsx)(`div`,{className:G.headerActions,children:A.roomCode&&(0,K.jsxs)(`button`,{className:`btn btn-sm`,onClick:Ee,children:[(0,K.jsx)(g,{size:14}),e(c?`common.copied`:`game.action.shareRoom`)]})}),children:(0,K.jsx)(`main`,{className:G.page,children:A.roomCode?(0,K.jsxs)(`div`,{className:G.board,children:[(0,K.jsxs)(`section`,{className:G.table,children:[N?.status===`finished`&&N.winner&&le&&(0,K.jsxs)(`div`,{className:G.finishBanner,children:[(0,K.jsx)(`span`,{className:G.finishBannerIcon,children:`🏆`}),(0,K.jsx)(`span`,{children:e(`game.zhajinhua.result.winChips`,{player:Z(N.winner,M.players,A.presenceByAddress),amount:N.winAmount??0})})]}),N?.lastCompare&&E&&(0,K.jsx)(Se,{lastCompare:N.lastCompare,compareReveal:N.compareReveal||{},myAddress:I,myDealtHand:V,lobbyPlayers:M.players,presenceByAddress:A.presenceByAddress,onClose:()=>D(!1)}),(0,K.jsxs)(`div`,{className:G.tableCenter,children:[(0,K.jsx)(`span`,{children:e(`game.zhajinhua.pot`)}),(0,K.jsx)(`strong`,{children:N?.pot||0}),(0,K.jsx)(`small`,{children:e(`game.zhajinhua.currentBet`,{amount:N?.currentBet||0})})]}),(0,K.jsx)(`div`,{className:G.seats,children:M.players.map(t=>{let n=N?.players.find(e=>Y(e.address,t.address)),r=Ce(t,A.presenceByAddress,A.onlineAddresses),i=N?.turnAddress===t.address,a=N?.winner===t.address,o=n?.status===`folded`;return(0,K.jsxs)(`div`,{className:J(G.seat,i&&G.seatTurn,a&&G.seatWinner,o&&G.seatFolded),children:[(0,K.jsxs)(`div`,{className:J(G.seatAvatar,!r.online&&G.seatAvatarOffline),children:[(0,K.jsx)(`img`,{src:oe(t.address,r.avatar),alt:``}),r.online&&(0,K.jsx)(`span`,{className:G.onlineDot})]}),(0,K.jsxs)(`div`,{className:G.seatMain,children:[(0,K.jsx)(`strong`,{translate:`no`,children:r.name}),(0,K.jsx)(`span`,{translate:`no`,children:ye(t.address)})]}),(0,K.jsxs)(`div`,{className:G.seatMeta,children:[(0,K.jsx)(`span`,{children:e(`game.zhajinhua.chips`,{amount:n?.chips??1e3})}),(0,K.jsx)(`span`,{children:n?.status===`folded`?e(`game.zhajinhua.player.folded`):n?.looked?e(`game.zhajinhua.player.looked`):e(N?`game.zhajinhua.player.inRound`:`game.status.waitingStart`)})]})]},t.address)})})]}),(0,K.jsxs)(`aside`,{className:G.panel,children:[(0,K.jsxs)(`div`,{className:G.panelSection,children:[(0,K.jsxs)(`div`,{className:G.panelTitle,children:[(0,K.jsx)(v,{size:16}),(0,K.jsx)(`span`,{children:e(`game.zhajinhua.myHand`)})]}),(0,K.jsx)(`div`,{className:G.hand,children:H?H.map(e=>{let t=xe(e),n=`${t.suit}${t.rank}`;return(0,K.jsxs)(`div`,{className:J(G.card,G[t.color]),children:[(0,K.jsx)(`span`,{children:n}),(0,K.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,K.jsx)(`div`,{className:G.cardBack,children:(0,K.jsx)(v,{size:18})},e))}),(0,K.jsx)(`p`,{className:G.handLabel,children:H?ue(H):e(V?`game.zhajinhua.hand.unlooked`:`game.zhajinhua.hand.waitingDeal`)})]}),(0,K.jsxs)(`div`,{className:G.panelSection,children:[(0,K.jsxs)(`div`,{className:G.panelTitle,children:[(0,K.jsx)(ee,{size:16}),(0,K.jsx)(`span`,{children:e(`game.actions`)})]}),F?(0,K.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:Oe,disabled:!X||N?.status===`playing`,children:[(0,K.jsx)(se,{size:16}),N?.status===`finished`?e(`game.action.nextRound`):e(`game.action.startRound`)]}):(0,K.jsx)(`p`,{className:G.muted,children:e(`game.waitingHost`)}),F&&N?.status===`finished`&&!X&&(0,K.jsx)(`p`,{className:G.muted,children:e(`game.zhajinhua.error.tooManyLowChips`)}),(0,K.jsxs)(`div`,{className:G.actionGrid,children:[(0,K.jsxs)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`look`),onClick:()=>$(`look`),children:[(0,K.jsx)(ae,{size:16}),e(`game.zhajinhua.action.look`)]}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`call`),onClick:()=>$(`call`),children:e(`game.zhajinhua.action.call`)}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`fold`),onClick:()=>$(`fold`),children:e(`game.zhajinhua.action.fold`)})]}),(0,K.jsxs)(`div`,{className:G.raiseRow,children:[(0,K.jsx)(`select`,{className:`input input-compact`,value:m,onChange:e=>x(Number(e.target.value)),children:b.map(t=>(0,K.jsx)(`option`,{value:t,children:e(`game.zhajinhua.action.raiseOption`,{amount:t})},t))}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`raise`),onClick:()=>$(`raise`,{amount:m}),children:e(`game.zhajinhua.action.raise`)})]}),(0,K.jsxs)(`div`,{className:G.raiseRow,children:[(0,K.jsxs)(`select`,{className:`input input-compact`,value:S,onChange:e=>C(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:e(`game.zhajinhua.action.comparePlaceholder`)}),Ae.map(e=>(0,K.jsx)(`option`,{value:e.address,children:Z(e.address,Ae,A.presenceByAddress)},e.address))]}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`compare`)||!S,onClick:()=>$(`compare`,{target:S}),children:e(`game.zhajinhua.action.compare`)})]})]}),(0,K.jsxs)(`div`,{className:G.panelSection,children:[(0,K.jsx)(`div`,{className:G.panelTitle,children:e(`game.status.title`)}),(0,K.jsxs)(`div`,{className:G.statusGrid,children:[(0,K.jsx)(`span`,{children:e(`game.host`)}),(0,K.jsx)(`strong`,{children:P?ye(P):`-`}),(0,K.jsx)(`span`,{children:e(`game.zhajinhua.myChips`)}),(0,K.jsx)(`strong`,{children:B?.chips??1e3}),(0,K.jsx)(`span`,{children:e(`game.round`)}),(0,K.jsx)(`strong`,{children:ke}),(0,K.jsx)(`span`,{children:e(`game.hint`)}),(0,K.jsx)(`strong`,{children:N?.lastAction||e(`game.waitingPlayers`)})]})]})]})]}):(0,K.jsxs)(`section`,{className:G.entry,children:[(0,K.jsxs)(`div`,{className:G.entryBrand,children:[(0,K.jsx)(`div`,{className:G.cardMark,children:(0,K.jsx)(v,{size:48})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{children:e(`game.zhajinhua.hero.title`)}),(0,K.jsx)(`p`,{children:e(`game.hero.desc`)})]})]}),(0,K.jsxs)(`div`,{className:G.entryPanel,children:[(0,K.jsxs)(`div`,{className:G.accountLine,children:[(0,K.jsx)(`span`,{children:e(`game.currentAccount`)}),(0,K.jsx)(`strong`,{translate:`no`,children:A.userIdentity?.displayName||e(`web3.notSignedIn`)})]}),(0,K.jsxs)(`button`,{className:`btn btn-primary`,disabled:A.joining,onClick:we,children:[(0,K.jsx)(ee,{size:16}),e(`game.action.createRoom`)]}),(0,K.jsxs)(`form`,{onSubmit:Te,className:G.joinForm,children:[(0,K.jsxs)(`label`,{children:[e(`game.roomCode`),(0,K.jsx)(`input`,{value:i,maxLength:8,onChange:e=>o(e.target.value.toUpperCase()),placeholder:e(`game.roomCode.placeholder`)})]}),(0,K.jsx)(`button`,{className:`btn`,disabled:A.joining||!i,children:e(`game.action.joinRoom`)})]}),(0,K.jsx)(`p`,{className:G.status,children:A.isBackendReady?e(`game.status.nodeConnected`):e(`game.status.nodeConnecting`)})]})]})})})}function Se({lastCompare:e,compareReveal:t,myAddress:n,myDealtHand:r,lobbyPlayers:i,presenceByAddress:a,onClose:o}){let{t:s}=h(),c=Z(e.initiator,i,a),l=Z(e.target,i,a),u=Z(e.winner,i,a),d=Y(n,e.initiator),f=Y(n,e.target),p=d||f;function m(e,i){return t[e]||(p&&Y(e,n)&&i&&r?r:null)}let g=m(e.initiator,e.initiatorLooked),_=m(e.target,e.targetLooked);return(0,K.jsx)(`div`,{className:G.compareOverlay,onClick:o,children:(0,K.jsxs)(`div`,{className:G.compareBox,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`div`,{className:G.compareTitle,children:s(`game.zhajinhua.compareResult`)}),(0,K.jsxs)(`div`,{className:G.comparePlayers,children:[(0,K.jsxs)(`div`,{className:J(G.compareSide,Y(e.winner,e.initiator)&&G.compareWinner),children:[(0,K.jsx)(`div`,{className:G.compareName,children:c}),(0,K.jsx)(`div`,{className:G.compareCards,children:g?g.map(e=>{let t=xe(e);return(0,K.jsxs)(`div`,{className:J(G.card,G[t.color]),children:[(0,K.jsx)(`span`,{children:t.rank}),(0,K.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,K.jsx)(`div`,{className:G.cardBack,children:(0,K.jsx)(v,{size:18})},e))}),g&&(0,K.jsx)(`div`,{className:G.compareLabel,children:ue(g)})]}),(0,K.jsx)(`div`,{className:G.compareVs,children:`VS`}),(0,K.jsxs)(`div`,{className:J(G.compareSide,Y(e.winner,e.target)&&G.compareWinner),children:[(0,K.jsx)(`div`,{className:G.compareName,children:l}),(0,K.jsx)(`div`,{className:G.compareCards,children:_?_.map(e=>{let t=xe(e);return(0,K.jsxs)(`div`,{className:J(G.card,G[t.color]),children:[(0,K.jsx)(`span`,{children:t.rank}),(0,K.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,K.jsx)(`div`,{className:G.cardBack,children:(0,K.jsx)(v,{size:18})},e))}),_&&(0,K.jsx)(`div`,{className:G.compareLabel,children:ue(_)})]})]}),(0,K.jsx)(`div`,{className:G.compareResult,children:s(`game.zhajinhua.result.winner`,{player:u})}),(0,K.jsx)(`button`,{className:`btn btn-sm`,onClick:o,children:s(`common.close`)})]})})}function Z(e,t,n){let r=Q(e);return n.get(r)?.displayName||t.find(e=>Q(e.address)===r)?.name||ye(e)}function Q(e=``){return String(e||``).trim().toLowerCase()}function Ce(e,t,n){let r=Q(e.address),i=t.get(r);return{name:Z(e.address,[e],t),avatar:i?.avatar||e.avatar||``,online:r?n.has(r):!1}}var we=o(`/game/zhajinhua/`)({component:X});export{we as Route};
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{A as r,B as i,E as a,H as o,O as s,_ as c,g as l,h as u,k as d,t as f,x as p,y as m}from"./useAppStore-DNhyhD20.js";import{a as h}from"./i18n-DKsg67mH.js";import{t as g}from"./copy-OwXDsstV.js";import{t as _}from"./AppShell-BiYQsNO8.js";import{t as ee}from"./play-DSHtNcOe.js";import{a as v,i as te,n as ne,r as re,t as ie}from"./useGameRoom-DLN636mz.js";import{M as ae,g as oe}from"./index-mjFWLwue.js";var se=i(`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`}]]),y=t(e(),1),b=[10,20,50,100],x=[`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`J`,`Q`,`K`,`A`],S=[`D`,`C`,`H`,`S`],C=new Map(x.map((e,t)=>[e,t+2])),ce=new Map(S.map((e,t)=>[e,t+1])),w={high:1,pair:2,straight:3,flush:4,straightFlush:5,triple:6},le={[w.high]:`散牌`,[w.pair]:`对子`,[w.straight]:`顺子`,[w.flush]:`金花`,[w.straightFlush]:`顺金`,[w.triple]:`豹子`};function T(e){return m(e)}function E(e=`zhajinhua`){return u(e)}function D(){return E(`round`)}function O(){let e=[];for(let t of S)for(let n of x)e.push(`${n}${t}`);return e}function k(e=O(),t=Math.random){let n=[...e];for(let e=n.length-1;e>0;e--){let r=Math.floor(t()*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}function A(e){let t=String(e||``).trim().toUpperCase(),n=t.slice(-1),r=t.slice(0,-1);if(!C.has(r)||!ce.has(n))throw Error(`Invalid card: ${e}`);return{id:`${r}${n}`,rank:r,suit:n,rankValue:C.get(r),suitValue:ce.get(n)}}function j(e,t){let n=Math.max(e.length,t.length);for(let r=0;r<n;r++){let n=e[r]||0,i=t[r]||0;if(n!==i)return n-i}return 0}function M(e){let t=[...new Set(e)].sort((e,t)=>e-t);return t.length===3?t[0]===2&&t[1]===3&&t[2]===14?3:t[0]+1===t[1]&&t[1]+1===t[2]?t[2]:0:0}function N(e){if(!Array.isArray(e)||e.length!==3)throw Error(`炸金花手牌必须是 3 张牌`);let t=e.map(A),n=t.map(e=>e.rankValue),r=new Map;for(let e of n)r.set(e,(r.get(e)||0)+1);let i=new Set(t.map(e=>e.suit)).size===1,a=M(n),o=[...n].sort((e,t)=>t-e),s=Math.max(...t.map(e=>e.suitValue)),c=w.high,l=o;return r.size===1?(c=w.triple,l=[o[0]]):a&&i?(c=w.straightFlush,l=[a]):i?(c=w.flush,l=o):a?(c=w.straight,l=[a]):r.size===2&&(c=w.pair,l=[[...r.entries()].find(([,e])=>e===2)[0],[...r.entries()].find(([,e])=>e===1)[0]]),{category:c,label:le[c],tiebreakers:l,tieSuit:s,cards:t.map(e=>e.id)}}function P(e,t){let n=N(e),r=N(t);if(n.category!==r.category)return n.category-r.category;let i=j(n.tiebreakers,r.tiebreakers);return i===0?n.tieSuit-r.tieSuit:i}function ue(e){return N(e).label}function de({roundId:e,action:t,amount:n,target:r}){return{roundId:e,eventId:E(`action`),action:t,amount:n,target:r}}function fe(e=[]){let t=e.filter(e=>Number(e.chips)>=10);return t.length>=2&&t.length<=5}function pe({roomCode:e,players:t,hostAddress:n,previousSeq:r=0,previousWinner:i=``,roundId:a=D(),random:o=Math.random}){let s=t.filter(e=>Number(e.chips)>=10).slice(0,5);if(s.length<2)throw Error(`至少需要 2 名有足够筹码的玩家`);let u=k(O(),o),d={},f=s.map((e,t)=>{let n=u.slice(t*3,t*3+3);return d[e.address]=n,{address:e.address,name:e.name,avatar:c(e.avatar),publicKey:e.publicKey,chips:Number(e.chips)-10,status:`active`,looked:!1,bet:10}}),p,m=l(i),h=m?f.findIndex(e=>l(e.address)===m):-1;return p=h>=0?f[h].address:f[Math.floor(o()*f.length)].address,{roomCode:T(e),roundId:a,status:`playing`,host:l(n),seq:r+1,startedAt:Date.now(),ante:10,pot:10*f.length,currentBet:10,turnAddress:p,players:f,lastAction:`本局开始`,winner:null,showdown:null,appliedEventIds:[],hands:d,actionCounts:{},compareReveal:{}}}function me(e){if(!e)return null;let t={...e};return delete t.hands,W(t)}function he(e,t){let n=F(e);return!n||!t||typeof t!=`object`?null:{...n,hands:W(t)}}function F(e){return!e||typeof e!=`object`||!e.roundId||!Array.isArray(e.players)?null:{roomCode:T(e.roomCode),roundId:String(e.roundId),status:e.status===`finished`?`finished`:`playing`,host:l(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:l(e.turnAddress),players:e.players.map(U).filter(Boolean),lastAction:String(e.lastAction||``),winner:e.winner?l(e.winner):null,showdown:e.showdown&&typeof e.showdown==`object`?W(e.showdown):null,appliedEventIds:Array.isArray(e.appliedEventIds)?e.appliedEventIds.map(String):[],actionCounts:e.actionCounts&&typeof e.actionCounts==`object`?W(e.actionCounts):{},compareReveal:e.compareReveal&&typeof e.compareReveal==`object`?W(e.compareReveal):{},lastCompare:e.lastCompare&&typeof e.lastCompare==`object`?W(e.lastCompare):null,finishedAt:e.finishedAt?Number(e.finishedAt):null}}function I(e,t,n){let r=F(e);if(!r||r.status!==`playing`)return{ok:!1,error:`当前没有进行中的牌局`};let i=l(n),a=r.players.find(e=>e.address===i);if(!a||a.status!==`active`)return{ok:!1,error:`玩家不在本轮牌局中`};if(r.turnAddress!==i)return{ok:!1,error:`还没有轮到你操作`};let o=t?.action;if(![`look`,`call`,`raise`,`compare`,`fold`].includes(o))return{ok:!1,error:`未知操作`};if(o===`look`)return a.looked?{ok:!1,error:`已经看过牌`}:{ok:!0};if(o===`call`)return a.chips>=10?{ok:!0}:{ok:!1,error:`筹码不足,不能跟注`};if(o===`raise`){let e=Number(t.amount);if(!b.includes(e))return{ok:!1,error:`加注档位无效`};let n=r.currentBet+e-a.bet;return a.chips>=n?{ok:!0}:{ok:!1,error:`筹码不足,不能加注`}}if(o===`compare`){let e=l(t.target),n=r.players.find(t=>t.address===e);if(!e||e===i||!n||n.status!==`active`)return{ok:!1,error:`请选择有效的比牌对象`};if(!r.players.filter(e=>e.status===`active`).every(e=>(r.actionCounts?.[e.address]||0)>=1))return{ok:!1,error:`第一轮不能比牌,请先跟注或加注`};let o=Math.max(0,r.currentBet-a.bet);return a.chips>=o?{ok:!0}:{ok:!1,error:`筹码不足,不能比牌`}}return{ok:!0}}function L(e,t,n){let r=I(e,t,n);if(!r.ok)return{ok:!1,error:r.error,state:e};let i=W(e),a=l(n),o=i.players.find(e=>e.address===a),s=String(t.eventId);if(i.appliedEventIds?.includes(s))return{ok:!0,state:i,duplicate:!0};if(Array.isArray(i.appliedEventIds)||(i.appliedEventIds=[]),i.appliedEventIds.push(s),t.action===`look`)return o.looked=!0,i.lastAction=`${o.name} 看牌`,H(i);if(t.action===`fold`)return o.status=`folded`,i.lastAction=`${o.name} 弃牌`,B(i,a),V(i,a);if(t.action===`call`)return o.chips-=10,o.bet+=10,i.pot+=10,i.lastAction=`${o.name} 跟注`,B(i,a),V(i,a);if(t.action===`raise`){let e=Number(t.amount);return i.currentBet+=e,z(i,o),i.lastAction=`${o.name} 加注 ${e}`,B(i,a),V(i,a)}if(t.action===`compare`){z(i,o);let e=l(t.target),n=i.players.find(t=>t.address===e),r=o.looked,s=n.looked,c=P(i.hands?.[a]||[],i.hands?.[e]||[]),u=c>=0?o:n,d=c>=0?n:o;d.status=`folded`,d.looked=!0,i.compareReveal||={};let f=r&&s,p=!r&&!s;if(f)i.compareReveal[a]=i.hands?.[e]||[],i.compareReveal[e]=i.hands?.[a]||[];else if(p)i.compareReveal[d.address]=i.hands?.[u.address]||[];else{let e=r?o:n,t=r?n:o;i.compareReveal[e.address]=i.hands?.[t.address]||[],i.compareReveal[d.address]=i.hands?.[u.address]||[]}return i.lastCompare={initiator:a,target:e,winner:u.address,loser:d.address,initiatorLooked:r,targetLooked:s,timestamp:Date.now()},i.lastAction=`${o.name} 与 ${n.name} 比牌,${d.name} 出局`,B(i,a),V(i,a)}return{ok:!1,error:`未知操作`,state:e}}function R(e){return(e?.players||[]).filter(e=>e.status===`active`)}function ge(e,t){let n=(e?.players||[]).find(e=>e.address===l(t));if(!e||e.status!==`playing`||!n||n.status!==`active`||e.turnAddress!==n.address)return[];let r=[];return n.looked||r.push(`look`),I(e,{action:`call`},n.address).ok&&r.push(`call`),b.some(t=>I(e,{action:`raise`,amount:t},n.address).ok)&&r.push(`raise`),R(e).length>1&&e.players.filter(e=>e.status===`active`).every(t=>(e.actionCounts?.[t.address]||0)>=1)&&r.push(`compare`),r.push(`fold`),r}function z(e,t){let n=Math.max(0,e.currentBet-t.bet);t.chips-=n,t.bet+=n,e.pot+=n}function B(e,t){e.actionCounts||={},e.actionCounts[t]=(e.actionCounts[t]||0)+1}function V(e,t){let n=R(e);return n.length===1?_e(e,n[0].address):(e.turnAddress=ve(e,t),H(e))}function _e(e,t){let n=e.players.find(e=>e.address===t),r=e.pot;return n&&(n.chips+=e.pot),e.status=`finished`,e.winner=t,e.winAmount=r,e.turnAddress=``,e.showdown=e.hands?W(e.hands):null,e.lastAction=n?`${n.name} 赢得 ${r} 筹码`:`本局结束`,e.pot=0,e.finishedAt=Date.now(),H(e)}function ve(e,t){let n=e.players,r=Math.max(0,n.findIndex(e=>e.address===l(t)));for(let e=1;e<=n.length;e++){let t=n[(r+e)%n.length];if(t.status===`active`)return t.address}return``}function H(e){return e.seq=Number(e.seq||0)+1,{ok:!0,state:e}}function U(e){if(!e||typeof e!=`object`)return null;let t=l(e.address);return t?{address:t,name:String(e.name||p(t)).slice(0,50),avatar:c(e.avatar),publicKey:String(e.publicKey||``),chips:Math.max(0,Number(e.chips)||0),status:e.status===`folded`?`folded`:`active`,looked:e.looked===!0,bet:Math.max(0,Number(e.bet)||0)}:null}function W(e){return JSON.parse(JSON.stringify(e))}var G={page:`_page_p8eol_1`,headerActions:`_headerActions_p8eol_12`,entry:`_entry_p8eol_18`,entryBrand:`_entryBrand_p8eol_28`,cardMark:`_cardMark_p8eol_34`,entryPanel:`_entryPanel_p8eol_62`,accountLine:`_accountLine_p8eol_72`,joinForm:`_joinForm_p8eol_89`,status:`_status_p8eol_110`,board:`_board_p8eol_116`,table:`_table_p8eol_123`,tableCenter:`_tableCenter_p8eol_144`,finishBanner:`_finishBanner_p8eol_173`,finishBannerIcon:`_finishBannerIcon_p8eol_192`,seats:`_seats_p8eol_196`,seat:`_seat_p8eol_196`,seatTurn:`_seatTurn_p8eol_218`,seatWinner:`_seatWinner_p8eol_223`,seatFolded:`_seatFolded_p8eol_228`,seatAvatar:`_seatAvatar_p8eol_232`,seatAvatarOffline:`_seatAvatarOffline_p8eol_252`,onlineDot:`_onlineDot_p8eol_257`,seatMain:`_seatMain_p8eol_269`,seatMeta:`_seatMeta_p8eol_270`,panel:`_panel_p8eol_301`,panelSection:`_panelSection_p8eol_308`,panelTitle:`_panelTitle_p8eol_318`,hand:`_hand_p8eol_328`,card:`_card_p8eol_34`,red:`_red_p8eol_362`,black:`_black_p8eol_366`,cardBack:`_cardBack_p8eol_370`,handLabel:`_handLabel_p8eol_391`,actionGrid:`_actionGrid_p8eol_398`,raiseRow:`_raiseRow_p8eol_399`,statusGrid:`_statusGrid_p8eol_410`,muted:`_muted_p8eol_428`,compareOverlay:`_compareOverlay_p8eol_435`,compareBox:`_compareBox_p8eol_447`,compareTitle:`_compareTitle_p8eol_461`,comparePlayers:`_comparePlayers_p8eol_467`,compareSide:`_compareSide_p8eol_474`,compareWinner:`_compareWinner_p8eol_486`,compareName:`_compareName_p8eol_491`,compareCards:`_compareCards_p8eol_502`,compareLabel:`_compareLabel_p8eol_527`,compareVs:`_compareVs_p8eol_533`,compareResult:`_compareResult_p8eol_540`},K=n(),q=`zhajinhua`;function J(...e){return e.filter(Boolean).join(` `)}function Y(e,t){return String(e||``).toLowerCase()===String(t||``).toLowerCase()}function ye(e=``){return e?`${e.slice(0,6)}...${e.slice(-4)}`:``}function be(e){return e.displayName||e.username}function xe(e){let t=String(e||``),n=t.slice(-1);return{rank:t.slice(0,-1),suit:{S:`♠`,H:`♥`,C:`♣`,D:`♦`}[n]||n,color:n===`H`||n===`D`?`red`:`black`}}function X(){let{t:e}=h(),t=f(e=>e.addToast),n=a(e=>e.initializeUser),[i,o]=(0,y.useState)(``),[c,l]=(0,y.useState)(!1),u=(0,y.useRef)(``),p=(0,y.useRef)(!1),[m,x]=(0,y.useState)(20),[S,C]=(0,y.useState)(``),[ce,w]=(0,y.useState)({}),[le,T]=(0,y.useState)(!0),[E,D]=(0,y.useState)(!1),O=(0,y.useRef)(null),k=(0,y.useRef)(new Set),A=ie({gameId:q,onError:e=>t(e,`error`),getPlayerPayload:e=>{let t=s(e.danger);return{address:e.address,name:be(e),avatar:e.avatar||``,publicKey:t.public_key,joinedAt:Date.now()}}}),j=(0,y.useMemo)(()=>A.userIdentity?.danger?s(A.userIdentity.danger):null,[A.userIdentity?.danger]);(0,y.useEffect)(()=>{n()},[n]),(0,y.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get(`room`)?.toUpperCase();e&&(o(e),u.current=e)},[]),(0,y.useEffect)(()=>{let n=u.current;!n||p.current||!A.isBackendReady||!A.userIdentity||(p.current=!0,u.current=``,A.joinRoom(n).then(n=>{n&&t(e(`game.toast.joinedRoom`),`success`)}))},[A.isBackendReady,A.userIdentity,A.joinRoom,t,e]),(0,y.useEffect)(()=>{if(!A.roomCode)return;let e=`/game/zhajinhua?room=${A.roomCode}`;`${window.location.pathname}${window.location.search}`!==e&&window.history.replaceState(null,``,e)},[A.roomCode]);let M=(0,y.useMemo)(()=>ne(A.messages,{gameId:q,roomCode:A.roomCode}),[A.messages,A.roomCode]),N=(0,y.useMemo)(()=>re(A.messages,{gameId:q,roomCode:A.roomCode}),[A.messages,A.roomCode])?.payload?.round||null,P=N?.host||M.hostAddress,F=Y(P,A.userIdentity?.address),I=A.userIdentity?.address?.toLowerCase()||``,z=N?.players.find(e=>Y(e.address,I)),B=z||M.players.find(e=>Y(e.address,I)),V=ce[N?.roundId||``]||null,_e=N?.showdown&&I?N.showdown[I]:null,ve=N?.compareReveal&&I?N.compareReveal[I]:null,H=_e||ve||(z?.looked?V:null),U=ge(N,I),W=R(N),X=F&&fe(M.players.map(e=>({...e,chips:N?.players.find(t=>Y(t.address,e.address))?.chips??1e3}))),Q=A.roomCode&&typeof window<`u`?`${window.location.origin}/game/zhajinhua?room=${A.roomCode}`:``;(0,y.useEffect)(()=>{if(!(!N||!A.userIdentity||!j||!P))for(let e of A.roomEvents){let t=e.event;if(!t||t.event!==`deal:private`)continue;let n=t.payload;if(n.roundId!==N.roundId||!Y(n.recipient,A.userIdentity.address))continue;let r=d(n.encrypted||``,{senderPublicKey:n.senderPublicKey||``,recipientPrivateKey:j.private_key});if(r)try{let e=JSON.parse(r);Array.isArray(e)&&w(t=>({...t,[N.roundId]:e.map(String)}))}catch{}}},[N?.roundId,A.roomEvents,A.userIdentity,P,j?.private_key]),(0,y.useEffect)(()=>{if(N?.status===`finished`&&N.winner){T(!0);let e=setTimeout(()=>T(!1),5e3);return()=>clearTimeout(e)}},[N?.finishedAt,N?.status,N?.winner]),(0,y.useEffect)(()=>{if(N?.lastCompare?.timestamp){D(!0);let e=setTimeout(()=>D(!1),5e3);return()=>clearTimeout(e)}else D(!1)},[N?.lastCompare?.timestamp,N?.roundId]),(0,y.useEffect)(()=>{if(!F||!N||N.status!==`playing`)return;let e=O.current;if(!e)return;let t=A.roomEvents.filter(e=>{let t=e.event;if(!t||t.event!==`player:action`)return!1;let n=t.payload.actionEvent;return!(!n||n.roundId!==N.roundId||k.current.has(n.eventId)||N.appliedEventIds?.includes(n.eventId))});if(t.length===0)return;let n=!1;async function r(){let r=he(N,e);if(r)for(let e of t){if(n)return;let t=(e.event?.payload).actionEvent,i=L(r,t,e.message.author);if(!i.ok){let n=e.message.author;if(!Y(n,A.userIdentity?.address)&&r.status===`playing`&&Y(r.turnAddress,n)){let e=L(r,de({roundId:r.roundId,action:`call`,amount:void 0,target:void 0}),n);if(e.ok)i=e;else{let e=L(r,de({roundId:r.roundId,action:`fold`,amount:void 0,target:void 0}),n);e.ok&&(i=e)}}if(!i.ok){k.current.add(t.eventId);continue}}if(r=i.state,O.current=i.state.hands,await De(i.state)&&k.current.add(t.eventId),i.state.status===`finished`)break}}return r(),()=>{n=!0}},[N?.roundId,N?.seq,N?.status,A.roomEvents,F]);async function we(){await A.createRoom()&&t(e(`game.toast.roomCreated`),`success`)}async function Te(n){n.preventDefault(),await A.joinRoom(i)&&t(e(`game.toast.joinedRoom`),`success`)}async function Ee(){Q&&(await navigator.clipboard.writeText(Q),l(!0),setTimeout(()=>l(!1),1400))}async function De(e){return A.sendRoomEvent(`room:state`,{round:me(e),seq:e.seq})}async function Oe(){if(!A.userIdentity||!j||!X){t(e(`game.zhajinhua.error.notEnoughPlayers`),`error`);return}try{let n=M.players.map(e=>({...e,chips:N?.players.find(t=>Y(t.address,e.address))?.chips??1e3})),i=pe({roomCode:A.roomCode,players:n,hostAddress:A.userIdentity.address,previousSeq:N?.seq||0,previousWinner:N?.winner||``});O.current=i.hands,k.current.clear(),await De(i);for(let e of i.players){let t=r(JSON.stringify(i.hands[e.address]),{senderPrivateKey:j.private_key,recipientPublicKey:e.publicKey});await A.sendRoomEvent(`deal:private`,{roundId:i.roundId,recipient:e.address,senderPublicKey:j.public_key,encrypted:t})}w(e=>({...e,[i.roundId]:i.hands[A.userIdentity.address.toLowerCase()]})),t(e(`game.zhajinhua.toast.roundStarted`),`success`)}catch(n){t(n instanceof Error?n.message:e(`game.zhajinhua.error.startFailed`),`error`)}}async function $(e,t={}){if(!N||!A.userIdentity)return;let n=de({roundId:N.roundId,action:e,amount:t.amount,target:t.target});await A.sendRoomEvent(`player:action`,{actionEvent:n})}let ke=N?.status===`playing`?Y(N.turnAddress,I)?e(`game.zhajinhua.status.yourTurn`):N.turnAddress?e(`game.zhajinhua.status.waitingPlayer`,{player:Z(N.turnAddress,M.players,A.presenceByAddress)}):e(`game.status.playing`):N?.status===`finished`?e(`game.status.finished`):e(`game.status.waitingStart`),Ae=W.filter(e=>!Y(e.address,I));return(0,K.jsx)(_,{sidebar:({closeSidebar:e})=>(0,K.jsx)(te,{activeGame:`zhajinhua`,closeSidebar:e}),headerTitle:(0,K.jsx)(`h2`,{className:`header-title`,children:e(`game.zhajinhua.title`)}),headerRight:(0,K.jsx)(`div`,{className:G.headerActions,children:A.roomCode&&(0,K.jsxs)(`button`,{className:`btn btn-sm`,onClick:Ee,children:[(0,K.jsx)(g,{size:14}),e(c?`common.copied`:`game.action.shareRoom`)]})}),children:(0,K.jsx)(`main`,{className:G.page,children:A.roomCode?(0,K.jsxs)(`div`,{className:G.board,children:[(0,K.jsxs)(`section`,{className:G.table,children:[N?.status===`finished`&&N.winner&&le&&(0,K.jsxs)(`div`,{className:G.finishBanner,children:[(0,K.jsx)(`span`,{className:G.finishBannerIcon,children:`🏆`}),(0,K.jsx)(`span`,{children:e(`game.zhajinhua.result.winChips`,{player:Z(N.winner,M.players,A.presenceByAddress),amount:N.winAmount??0})})]}),N?.lastCompare&&E&&(0,K.jsx)(Se,{lastCompare:N.lastCompare,compareReveal:N.compareReveal||{},myAddress:I,myDealtHand:V,lobbyPlayers:M.players,presenceByAddress:A.presenceByAddress,onClose:()=>D(!1)}),(0,K.jsxs)(`div`,{className:G.tableCenter,children:[(0,K.jsx)(`span`,{children:e(`game.zhajinhua.pot`)}),(0,K.jsx)(`strong`,{children:N?.pot||0}),(0,K.jsx)(`small`,{children:e(`game.zhajinhua.currentBet`,{amount:N?.currentBet||0})})]}),(0,K.jsx)(`div`,{className:G.seats,children:M.players.map(t=>{let n=N?.players.find(e=>Y(e.address,t.address)),r=Ce(t,A.presenceByAddress,A.onlineAddresses),i=N?.turnAddress===t.address,a=N?.winner===t.address,o=n?.status===`folded`;return(0,K.jsxs)(`div`,{className:J(G.seat,i&&G.seatTurn,a&&G.seatWinner,o&&G.seatFolded),children:[(0,K.jsxs)(`div`,{className:J(G.seatAvatar,!r.online&&G.seatAvatarOffline),children:[(0,K.jsx)(`img`,{src:oe(t.address,r.avatar),alt:``}),r.online&&(0,K.jsx)(`span`,{className:G.onlineDot})]}),(0,K.jsxs)(`div`,{className:G.seatMain,children:[(0,K.jsx)(`strong`,{translate:`no`,children:r.name}),(0,K.jsx)(`span`,{translate:`no`,children:ye(t.address)})]}),(0,K.jsxs)(`div`,{className:G.seatMeta,children:[(0,K.jsx)(`span`,{children:e(`game.zhajinhua.chips`,{amount:n?.chips??1e3})}),(0,K.jsx)(`span`,{children:n?.status===`folded`?e(`game.zhajinhua.player.folded`):n?.looked?e(`game.zhajinhua.player.looked`):e(N?`game.zhajinhua.player.inRound`:`game.status.waitingStart`)})]})]},t.address)})})]}),(0,K.jsxs)(`aside`,{className:G.panel,children:[(0,K.jsxs)(`div`,{className:G.panelSection,children:[(0,K.jsxs)(`div`,{className:G.panelTitle,children:[(0,K.jsx)(v,{size:16}),(0,K.jsx)(`span`,{children:e(`game.zhajinhua.myHand`)})]}),(0,K.jsx)(`div`,{className:G.hand,children:H?H.map(e=>{let t=xe(e),n=`${t.suit}${t.rank}`;return(0,K.jsxs)(`div`,{className:J(G.card,G[t.color]),children:[(0,K.jsx)(`span`,{children:n}),(0,K.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,K.jsx)(`div`,{className:G.cardBack,children:(0,K.jsx)(v,{size:18})},e))}),(0,K.jsx)(`p`,{className:G.handLabel,children:H?ue(H):e(V?`game.zhajinhua.hand.unlooked`:`game.zhajinhua.hand.waitingDeal`)})]}),(0,K.jsxs)(`div`,{className:G.panelSection,children:[(0,K.jsxs)(`div`,{className:G.panelTitle,children:[(0,K.jsx)(ee,{size:16}),(0,K.jsx)(`span`,{children:e(`game.actions`)})]}),F?(0,K.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:Oe,disabled:!X||N?.status===`playing`,children:[(0,K.jsx)(se,{size:16}),N?.status===`finished`?e(`game.action.nextRound`):e(`game.action.startRound`)]}):(0,K.jsx)(`p`,{className:G.muted,children:e(`game.waitingHost`)}),F&&N?.status===`finished`&&!X&&(0,K.jsx)(`p`,{className:G.muted,children:e(`game.zhajinhua.error.tooManyLowChips`)}),(0,K.jsxs)(`div`,{className:G.actionGrid,children:[(0,K.jsxs)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`look`),onClick:()=>$(`look`),children:[(0,K.jsx)(ae,{size:16}),e(`game.zhajinhua.action.look`)]}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`call`),onClick:()=>$(`call`),children:e(`game.zhajinhua.action.call`)}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`fold`),onClick:()=>$(`fold`),children:e(`game.zhajinhua.action.fold`)})]}),(0,K.jsxs)(`div`,{className:G.raiseRow,children:[(0,K.jsx)(`select`,{className:`input input-compact`,value:m,onChange:e=>x(Number(e.target.value)),children:b.map(t=>(0,K.jsx)(`option`,{value:t,children:e(`game.zhajinhua.action.raiseOption`,{amount:t})},t))}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`raise`),onClick:()=>$(`raise`,{amount:m}),children:e(`game.zhajinhua.action.raise`)})]}),(0,K.jsxs)(`div`,{className:G.raiseRow,children:[(0,K.jsxs)(`select`,{className:`input input-compact`,value:S,onChange:e=>C(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:e(`game.zhajinhua.action.comparePlaceholder`)}),Ae.map(e=>(0,K.jsx)(`option`,{value:e.address,children:Z(e.address,Ae,A.presenceByAddress)},e.address))]}),(0,K.jsx)(`button`,{className:`btn btn-secondary`,disabled:!U.includes(`compare`)||!S,onClick:()=>$(`compare`,{target:S}),children:e(`game.zhajinhua.action.compare`)})]})]}),(0,K.jsxs)(`div`,{className:G.panelSection,children:[(0,K.jsx)(`div`,{className:G.panelTitle,children:e(`game.status.title`)}),(0,K.jsxs)(`div`,{className:G.statusGrid,children:[(0,K.jsx)(`span`,{children:e(`game.host`)}),(0,K.jsx)(`strong`,{children:P?ye(P):`-`}),(0,K.jsx)(`span`,{children:e(`game.zhajinhua.myChips`)}),(0,K.jsx)(`strong`,{children:B?.chips??1e3}),(0,K.jsx)(`span`,{children:e(`game.round`)}),(0,K.jsx)(`strong`,{children:ke}),(0,K.jsx)(`span`,{children:e(`game.hint`)}),(0,K.jsx)(`strong`,{children:N?.lastAction||e(`game.waitingPlayers`)})]})]})]})]}):(0,K.jsxs)(`section`,{className:G.entry,children:[(0,K.jsxs)(`div`,{className:G.entryBrand,children:[(0,K.jsx)(`div`,{className:G.cardMark,children:(0,K.jsx)(v,{size:48})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{children:e(`game.zhajinhua.hero.title`)}),(0,K.jsx)(`p`,{children:e(`game.hero.desc`)})]})]}),(0,K.jsxs)(`div`,{className:G.entryPanel,children:[(0,K.jsxs)(`div`,{className:G.accountLine,children:[(0,K.jsx)(`span`,{children:e(`game.currentAccount`)}),(0,K.jsx)(`strong`,{translate:`no`,children:A.userIdentity?.displayName||e(`web3.notSignedIn`)})]}),(0,K.jsxs)(`button`,{className:`btn btn-primary`,disabled:A.joining,onClick:we,children:[(0,K.jsx)(ee,{size:16}),e(`game.action.createRoom`)]}),(0,K.jsxs)(`form`,{onSubmit:Te,className:G.joinForm,children:[(0,K.jsxs)(`label`,{children:[e(`game.roomCode`),(0,K.jsx)(`input`,{value:i,maxLength:8,onChange:e=>o(e.target.value.toUpperCase()),placeholder:e(`game.roomCode.placeholder`)})]}),(0,K.jsx)(`button`,{className:`btn`,disabled:A.joining||!i,children:e(`game.action.joinRoom`)})]}),(0,K.jsx)(`p`,{className:G.status,children:A.isBackendReady?e(`game.status.nodeConnected`):e(`game.status.nodeConnecting`)})]})]})})})}function Se({lastCompare:e,compareReveal:t,myAddress:n,myDealtHand:r,lobbyPlayers:i,presenceByAddress:a,onClose:o}){let{t:s}=h(),c=Z(e.initiator,i,a),l=Z(e.target,i,a),u=Z(e.winner,i,a),d=Y(n,e.initiator),f=Y(n,e.target),p=d||f;function m(e,i){return t[e]||(p&&Y(e,n)&&i&&r?r:null)}let g=m(e.initiator,e.initiatorLooked),_=m(e.target,e.targetLooked);return(0,K.jsx)(`div`,{className:G.compareOverlay,onClick:o,children:(0,K.jsxs)(`div`,{className:G.compareBox,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`div`,{className:G.compareTitle,children:s(`game.zhajinhua.compareResult`)}),(0,K.jsxs)(`div`,{className:G.comparePlayers,children:[(0,K.jsxs)(`div`,{className:J(G.compareSide,Y(e.winner,e.initiator)&&G.compareWinner),children:[(0,K.jsx)(`div`,{className:G.compareName,children:c}),(0,K.jsx)(`div`,{className:G.compareCards,children:g?g.map(e=>{let t=xe(e);return(0,K.jsxs)(`div`,{className:J(G.card,G[t.color]),children:[(0,K.jsx)(`span`,{children:t.rank}),(0,K.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,K.jsx)(`div`,{className:G.cardBack,children:(0,K.jsx)(v,{size:18})},e))}),g&&(0,K.jsx)(`div`,{className:G.compareLabel,children:ue(g)})]}),(0,K.jsx)(`div`,{className:G.compareVs,children:`VS`}),(0,K.jsxs)(`div`,{className:J(G.compareSide,Y(e.winner,e.target)&&G.compareWinner),children:[(0,K.jsx)(`div`,{className:G.compareName,children:l}),(0,K.jsx)(`div`,{className:G.compareCards,children:_?_.map(e=>{let t=xe(e);return(0,K.jsxs)(`div`,{className:J(G.card,G[t.color]),children:[(0,K.jsx)(`span`,{children:t.rank}),(0,K.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,K.jsx)(`div`,{className:G.cardBack,children:(0,K.jsx)(v,{size:18})},e))}),_&&(0,K.jsx)(`div`,{className:G.compareLabel,children:ue(_)})]})]}),(0,K.jsx)(`div`,{className:G.compareResult,children:s(`game.zhajinhua.result.winner`,{player:u})}),(0,K.jsx)(`button`,{className:`btn btn-sm`,onClick:o,children:s(`common.close`)})]})})}function Z(e,t,n){let r=Q(e);return n.get(r)?.displayName||t.find(e=>Q(e.address)===r)?.name||ye(e)}function Q(e=``){return String(e||``).trim().toLowerCase()}function Ce(e,t,n){let r=Q(e.address),i=t.get(r);return{name:Z(e.address,[e],t),avatar:i?.avatar||e.avatar||``,online:r?n.has(r):!1}}var we=o(`/game/zhajinhua/`)({component:X});export{we as Route};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{D as r,E as i,H as a,a as o,d as s,m as c,p as l,r as u,t as d}from"./useAppStore-DNhyhD20.js";import{a as f,i as p}from"./i18n-DKsg67mH.js";import{t as m}from"./circle-alert-DXVkx8p8.js";import{t as h}from"./refresh-cw-CfkUlTK9.js";import{L as g,r as _}from"./index-mjFWLwue.js";import{t as v}from"./channelApi-C5eHetoJ.js";import{t as y}from"./ChatRestoringIndicator-CLV78gNW.js";import{r as b,t as x}from"./chatJoinInvite-7tuD-STm.js";var S=t(e(),1),C=n();function w({children:e,className:t=``}){return(0,C.jsx)(`main`,{className:t,children:e})}function T(e){return String(e||``).trim().replace(/\/+$/,``)}function E(e){return String(e||``).trim()}function D({inviteNodeUrl:e,inviteNodeInvite:t,hasBackend:n,activeBackendUrl:r,activeRemoteUrl:i,activeRemoteInvite:a}){let o=T(e),s=T(i),c=T(r);return!!o&&!!s&&n===!0&&c===s&&s===o&&E(a)===E(t)}function O(e){return!!T(e.inviteNodeUrl)&&!D(e)}var k=`data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"%3E%3Crect width="64" height="64" rx="16" fill="%232f7dd1"/%3E%3Ccircle cx="32" cy="25" r="11" fill="%23f8fbff"/%3E%3Cpath d="M14 56c3-12 12-18 18-18s15 6 18 18" fill="%23f8fbff"/%3E%3C/svg%3E`,A=`data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"%3E%3Crect width="64" height="64" rx="16" fill="%230f9f7a"/%3E%3Cpath d="M18 20h28v22H18z" rx="6" fill="%23f7fff9"/%3E%3Ccircle cx="27" cy="31" r="3" fill="%230f9f7a"/%3E%3Ccircle cx="37" cy="31" r="3" fill="%230f9f7a"/%3E%3Cpath d="M29 39h6" stroke="%230f9f7a" stroke-width="4" stroke-linecap="round"/%3E%3Cpath d="M32 12v8" stroke="%23f7fff9" stroke-width="5" stroke-linecap="round"/%3E%3C/svg%3E`,j=Object.freeze({id:`chatjoin_support`,name:`User / Service 测试频道`}),M=Object.freeze([Object.freeze({uid:`user`,theme:`sparkbit`,name:`测试用户`,avatar:k}),Object.freeze({uid:`service`,name:`测试客服`,avatar:A})]),N=Object.freeze(M.map(e=>Object.freeze({locale:`zh-CN`,uid:e.uid,theme:e.theme,avatar:e.avatar,name:e.name,channels:[j]})));function P(e){let t=String(e||``).trim();return N.find(e=>e.uid===t)||null}var F=50,I=x;function L(e){try{return JSON.parse(e)}catch{return null}}function R(e,t,n){if(t&&typeof t==`object`&&`error`in t){let e=t.error;if(typeof e==`string`)return e}return e||n}function z(e){return`/chat?channel=${encodeURIComponent(e)}`}function B(e){return String(e||``).trim().slice(0,F)}function V(){let{t:e,setLocale:t}=f(),n=g({select:e=>e.searchStr}),{token:a,pub:x,fixture:T}=(0,S.useMemo)(()=>{let e=new URLSearchParams(n);return{token:e.get(`token`)||``,pub:e.get(`pub`)||``,fixture:e.get(`fixture`)||``}},[n]),E=d(e=>e.hasBackend),D=d(e=>e.setIsDarkMode),k=i(e=>e.setUserIdentity),[A,j]=(0,S.useState)(``),[M,N]=(0,S.useState)(!0),[F,V]=(0,S.useState)(0),H=(0,S.useRef)(``);function U(){H.current=``,j(``),N(!0),V(e=>e+1)}return(0,S.useEffect)(()=>{let n=P(T);if(T&&!n){j(e(`chatJoin.error.unknownFixture`,{fixture:T})),N(!1);return}if(!n&&!a){j(e(`chatJoin.error.missingToken`)),N(!1);return}if(!n&&!x){j(e(`chatJoin.error.missingPub`)),N(!1);return}if(E===null)return;let i=n?`fixture:${T}`:`${a}:${x}`;if(H.current===i)return;H.current=i;async function f(n){let i=(t,r)=>n.locale?p(t,n.locale,r):e(t,r);n.locale&&t(n.locale),n.appearance===`dark`&&D(!0),n.appearance===`light`&&D(!1);let a=c(),f=l(),m=s();if(O({inviteNodeUrl:n.node_url,inviteNodeInvite:n.node_invite,hasBackend:E,activeBackendUrl:m,activeRemoteUrl:a,activeRemoteInvite:f})){if(!(await u({url:n.node_url,invite:n.node_invite||``})).ok)throw Error(i(`chatJoin.error.remoteConnectFailed`));o({url:n.node_url,invite:n.node_invite||``}),d.setState({hasBackend:!0})}else if(!E)throw Error(i(`chatJoin.error.noBackend`));let h=r(n.uid,``),g={...h,theme:n.theme,displayName:n.name||h.displayName,logo:n.logo,logo_dark:n.logo_dark,data:n.data,avatar:n.avatar};k(g);let y=``;for(let e of n.channels){let t=await v.createChannel(e.id,`public`,_(g)),n=t.channelKey||t.key||e.id;y||=n;let r=B(e.name);r&&await v.setChannelRemark(n,r)}let b=n.channels[0];window.location.href=z(y||b.id)}async function m(){try{if(n){await f(n);return}let t=await fetch(`${I}/api/chat.join.decrypt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:a,pub:x})}),r=await t.text(),i=L(r);if(!t.ok)j(R(r,i,e(`chatJoin.error.decrypt`)));else{let t=b(i);if(!t){j(e(`chatJoin.error.invalidInvite`));return}await f(t)}}catch(t){j(e(`chatJoin.error.request`,{message:t instanceof Error?t.message:String(t)}))}finally{N(!1)}}m()},[T,E,x,F,D,t,k,e,a]),(0,C.jsx)(w,{className:`chat-join-loading-page`,children:(0,C.jsx)(`div`,{className:`chat-join-loading-panel`,children:M?(0,C.jsx)(y,{}):A?(0,C.jsxs)(`div`,{className:`chat-join-error`,children:[(0,C.jsx)(m,{size:32}),(0,C.jsx)(`p`,{children:A}),(0,C.jsx)(`div`,{className:`chat-join-actions`,children:(0,C.jsxs)(`button`,{type:`button`,className:`btn btn-primary`,onClick:U,children:[(0,C.jsx)(h,{size:16}),e(`chatJoin.action.retry`)]})})]}):(0,C.jsx)(y,{})})})}function H(){return(0,C.jsx)(S.Suspense,{children:(0,C.jsx)(V,{})})}var U=a(`/chat/join/`)({component:H});export{U as Route};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,H as i}from"./useAppStore-DNhyhD20.js";import{a}from"./i18n-C6yaqRst.js";import{n as o,t as s}from"./smartphone-CrsocYJo.js";import{t as c}from"./message-square-CfApq8Ou.js";import{t as l}from"./music-Br2x8TKX.js";import{t as u}from"./play-DSHtNcOe.js";import{t as d}from"./search-DLBOUfny.js";import{t as f}from"./send-Bie9hgHI.js";import{t as p}from"./wifi-CILQyKk0.js";import{t as m}from"./MarketingLayout-BPdjpEfc.js";var h=r(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),g=r(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),_=r(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),v=r(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),y=r(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),b=r(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),x=r(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),ee=r(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),te=r(`triangle`,[[`path`,{d:`M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z`,key:`14u9p9`}]]),S=t(e(),1);function ne(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}var re=Object.freeze({left:0,top:0,width:16,height:16}),C=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),w=Object.freeze({...re,...C}),T=Object.freeze({...w,body:``,hidden:!1});function ie(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function E(e,t){let n=ie(e,t);for(let r in T)r in C?r in e&&!(r in n)&&(n[r]=C[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function ae(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=E(r[e]||i[e],a)}return o(t),n.forEach(o),E(e,a)}function oe(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=ne(e);for(let i in r){let a=r[i];a&&(t(i,ae(e,i,a)),n.push(i))}return n}var se={provider:``,aliases:{},not_found:{},...re};function D(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function O(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!D(e,se))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!D(t,T))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!D(t,T))return null}return t}var k=Object.create(null);function ce(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function A(e,t){let n=k[e]||(k[e]=Object.create(null));return n[t]||(n[t]=ce(e,t))}function le(e,t){return O(t)?oe(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function ue(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var de=/^[a-z0-9]+(-[a-z0-9]+)*$/,j=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!M(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!M(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!M(e,n)?null:e}return null},M=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,N=!1;function P(e){return typeof e==`boolean`&&(N=e),N}function F(e){let t=typeof e==`string`?j(e,!0,N):e;if(t){let e=A(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function fe(e,t){let n=j(e,!0,N);if(!n)return!1;let r=A(n.provider,n.prefix);return t?ue(r,n.name,t):(r.missing.add(n.name),!0)}function pe(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),N&&!t&&!e.prefix){let t=!1;return O(e)&&(e.prefix=``,oe(e,(e,n)=>{fe(e,n)&&(t=!0)})),t}let n=e.prefix;return M({prefix:n,name:`a`})?!!le(A(t,n),e):!1}var I=Object.freeze({width:null,height:null}),L=Object.freeze({...I,...C}),me=/(-?[0-9.]*[0-9]+[0-9.]*)/g,he=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function R(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(me);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=he.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function ge(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function _e(e,t){return e?`<defs>`+e+`</defs>`+t:t}function ve(e,t,n){let r=ge(e);return _e(r.defs,t+r.content+n)}var ye=e=>e===`unset`||e===`undefined`||e===`none`;function be(e,t){let n={...w,...e},r={...L,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=ve(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=R(d,c/l)):(u=o===`auto`?c:o,d=s===null?R(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{ye(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var xe=/\sid="(\S+)"/g,Se=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),Ce=0;function we(e,t=Se){let n=[],r;for(;r=xe.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(Ce++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var z=Object.create(null);function Te(e,t){z[e]=t}function B(e){return z[e]||z[``]}function V(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var H=Object.create(null),U=[`https://api.simplesvg.com`,`https://api.unisvg.com`],W=[];U.length>0;)U.length===1||Math.random()>.5?W.push(U.shift()):W.push(U.pop());H[``]=V({resources:[`https://api.iconify.design`].concat(W)});function Ee(e,t){let n=V(t);return n===null?!1:(H[e]=n,!0)}function G(e){return H[e]}var K=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function De(e,t){let n=G(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function Oe(e){return e===404}var ke=(e,t,n)=>{let r=[],i=De(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function Ae(e){if(typeof e==`string`){let t=G(e);if(t)return t.path}return`/`}var je={prepare:ke,send:(e,t,n)=>{if(!K){n(`abort`,424);return}let r=Ae(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;K(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(Oe(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function q(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function Me(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||q([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var Ne=0;function Pe(e,t,n){let r=Ne++,i=q.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function Fe(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=A(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function Ie(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?j(e,t,n):e;i&&r.push(i)}),r}var Le={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Re(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function ze(e){let t={...Le,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=Re(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function Be(){}var J=Object.create(null);function Ve(e){if(!J[e]){let t=G(e);if(!t)return;J[e]={config:t,redundancy:ze(t)}}return J[e]}function He(e,t,n){let r,i;if(typeof e==`string`){let t=B(e);if(!t)return n(void 0,424),Be;i=t.send;let a=Ve(e);a&&(r=a.redundancy)}else{let t=V(e);if(t){r=ze(t);let n=B(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),Be):r.query(t,i,n)().abort}function Ue(){}function We(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Me(e)}))}function Ge(e){let t=[],n=[];return e.forEach(e=>{(e.match(de)?t:n).push(e)}),{valid:t,invalid:n}}function Y(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!le(e,n).length){r();return}}catch(e){console.error(e)}r(),We(e)}function Ke(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function qe(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Ke(e.loadIcons(r,n,t),t=>{Y(e,r,t)});return}if(i){r.forEach(r=>{Ke(i(r,n,t),t=>{Y(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=Ge(r);if(o.length&&Y(e,o,null),!a.length)return;let s=n.match(de)?B(t):null;if(!s){Y(e,a,null);return}s.prepare(t,n,a).forEach(n=>{He(t,n,t=>{Y(e,n.icons,t)})})}))}var Je=(e,t)=>{let n=Fe(Ie(e,!0,P()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,Ue)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(A(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=A(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&qe(e,t)}),t?Pe(t,n,i):Ue};function Ye(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in I?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var Xe=/[\s,]+/;function Ze(e,t){t.split(Xe).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function Qe(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function $e(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function et(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function tt(e){return`data:image/svg+xml,`+et(e)}function nt(e){return`url("`+tt(e)+`")`}var X;function rt(){try{X=window.trustedTypes.createPolicy(`iconify`,{createHTML:e=>e})}catch{X=null}}function it(e){return X===void 0&&rt(),X?X.createHTML(e):e}var at={...L,inline:!1},ot={xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},st={display:`inline-block`},Z={backgroundColor:`currentColor`},ct={backgroundColor:`transparent`},lt={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},ut={WebkitMask:Z,mask:Z,background:ct};for(let e in ut){let t=ut[e];for(let n in lt)t[e+n]=lt[n]}var dt={...at,inline:!0};function ft(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var pt=(e,t,n)=>{let r=t.inline?dt:at,i=Ye(r,t),a=t.mode||`svg`,o={},s=t.style||{},c={...a===`svg`?ot:{}};if(n){let e=j(n,!1,!0);if(e){let t=[`iconify`];for(let n of[`provider`,`prefix`])e[n]&&t.push(`iconify--`+e[n]);c.className=t.join(` `)}}for(let e in t){let n=t[e];if(n!==void 0)switch(e){case`icon`:case`style`:case`children`:case`onLoad`:case`mode`:case`ssr`:case`fallback`:break;case`_ref`:c.ref=n;break;case`className`:c[e]=(c[e]?c[e]+` `:``)+n;break;case`inline`:case`hFlip`:case`vFlip`:i[e]=n===!0||n===`true`||n===1;break;case`flip`:typeof n==`string`&&Ze(i,n);break;case`color`:o.color=n;break;case`rotate`:typeof n==`string`?i[e]=Qe(n):typeof n==`number`&&(i[e]=n);break;case`ariaHidden`:case`aria-hidden`:n!==!0&&n!==`true`&&delete c[`aria-hidden`];break;default:r[e]===void 0&&(c[e]=n)}}let l=be(e,i),u=l.attributes;if(i.inline&&(o.verticalAlign=`-0.125em`),a===`svg`){c.style={...o,...s},Object.assign(c,u);let e=0,n=t.id;return typeof n==`string`&&(n=n.replace(/-/g,`_`)),c.dangerouslySetInnerHTML={__html:it(we(l.body,n?()=>n+`ID`+e++:`iconifyReact`))},(0,S.createElement)(`svg`,c)}let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=$e(d,{...u,width:f+``,height:p+``});return c.style={...o,"--svg":nt(h),width:ft(u.width),height:ft(u.height),...st,...m?Z:ct,...s},(0,S.createElement)(`span`,c)};if(P(!0),Te(``,je),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!pe(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;Ee(e,r)||console.error(n)}catch{console.error(n)}}}}function mt(e){let[t,n]=(0,S.useState)(!!e.ssr),[r,i]=(0,S.useState)({});function a(t){if(t){let t=e.icon;if(typeof t==`object`)return{name:``,data:t};let n=F(t);if(n)return{name:t,data:n}}return{name:``}}let[o,s]=(0,S.useState)(a(!!e.ssr));function c(){let e=r.callback;e&&(e(),i({}))}function l(e){if(JSON.stringify(o)!==JSON.stringify(e))return c(),s(e),!0}function u(){var t;let n=e.icon;if(typeof n==`object`){l({name:``,data:n});return}let r=F(n);l({name:n,data:r})&&(r===void 0?i({callback:Je([n],u)}):r&&((t=e.onLoad)==null||t.call(e,n)))}(0,S.useEffect)(()=>(n(!0),c),[]),(0,S.useEffect)(()=>{t&&u()},[e.icon,t]);let{name:d,data:f}=o;return f?pt({...w,...f},e,d):e.children?e.children:e.fallback?e.fallback:(0,S.createElement)(`span`,{})}var ht=(0,S.forwardRef)((e,t)=>mt({...e,_ref:t}));(0,S.forwardRef)((e,t)=>mt({inline:!0,...e,_ref:t}));var Q=n(),$=[{name:`Google`,host:`google.com`,icon:`simple-icons:google`,fallback:(0,Q.jsx)(d,{size:20})},{name:`Cloudflare`,host:`cloudflare.com`,icon:`simple-icons:cloudflare`,fallback:(0,Q.jsx)(o,{size:20})},{name:`YouTube`,host:`youtube.com`,icon:`simple-icons:youtube`,fallback:(0,Q.jsx)(u,{size:20})},{name:`GitHub`,host:`github.com`,icon:`simple-icons:github`,fallback:(0,Q.jsx)(ee,{size:20})},{name:`ChatGPT`,host:`chatgpt.com`,icon:`simple-icons:openai`,fallback:(0,Q.jsx)(_,{size:20})},{name:`X`,host:`x.com`,icon:`simple-icons:x`,fallback:(0,Q.jsx)(h,{size:20})},{name:`Instagram`,host:`instagram.com`,icon:`simple-icons:instagram`,fallback:(0,Q.jsx)(v,{size:20})},{name:`Reddit`,host:`reddit.com`,icon:`simple-icons:reddit`,fallback:(0,Q.jsx)(c,{size:20})},{name:`Wikipedia`,host:`wikipedia.org`,icon:`simple-icons:wikipedia`,fallback:(0,Q.jsx)(g,{size:20})},{name:`Apple`,host:`apple.com`,icon:`simple-icons:apple`,fallback:(0,Q.jsx)(s,{size:20})},{name:`Telegram`,host:`telegram.org`,icon:`simple-icons:telegram`,fallback:(0,Q.jsx)(f,{size:20})},{name:`Discord`,host:`discord.com`,icon:`simple-icons:discord`,fallback:(0,Q.jsx)(y,{size:20})},{name:`TikTok`,host:`tiktok.com`,icon:`simple-icons:tiktok`,fallback:(0,Q.jsx)(l,{size:20})},{name:`npm`,host:`npmjs.com`,icon:`simple-icons:npm`,fallback:(0,Q.jsx)(b,{size:20})},{name:`Vercel`,host:`vercel.com`,icon:`simple-icons:vercel`,fallback:(0,Q.jsx)(te,{size:20})}],gt=5e3;function _t({icon:e,fallback:t}){let[n,r]=(0,S.useState)(!1);return(0,S.useEffect)(()=>{let t=new Image;t.onload=()=>r(!0),t.onerror=()=>r(!1),t.src=`https://api.iconify.design/${e.replace(`:`,`/`)}.svg`},[e]),(0,Q.jsxs)(`span`,{className:`brand-icon-wrap`,children:[(0,Q.jsx)(`span`,{className:`brand-icon-fallback ${n?`hidden`:``}`,children:t}),(0,Q.jsx)(`span`,{className:`brand-icon-real ${n?`visible`:``}`,children:(0,Q.jsx)(ht,{icon:e,width:20,height:20})})]})}function vt(){let{t:e,formatNumber:t}=a(),[n,r]=(0,S.useState)(new Map),[i,o]=(0,S.useState)(!1),s=(0,S.useRef)(new Map);(0,S.useEffect)(()=>{document.title=e(`ping.meta.title`)},[e]);let c=(0,S.useCallback)(e=>{r(t=>{let n=new Map(t);return n.set(e,{status:`pending`,latency:0}),n});let t=new AbortController;s.current.set(e,t);let n=performance.now(),i=(t,n)=>{r(r=>{let i=new Map(r);return i.set(e,{status:t,latency:n}),i})},a=setTimeout(()=>{t.abort()},gt);fetch(`https://${e}/`,{method:`HEAD`,mode:`no-cors`,cache:`no-store`,signal:t.signal}).then(()=>{clearTimeout(a),i(`ok`,Math.round(performance.now()-n))}).catch(()=>{clearTimeout(a),i(`timeout`,0)})},[]),l=(0,S.useCallback)(()=>{o(!0);let e=new Map;$.forEach(t=>{e.set(t.host,{status:`pending`,latency:0})}),r(e);let t=new Set($.map(e=>e.host));$.forEach(e=>{let n=new AbortController;s.current.set(e.host,n);let i=performance.now(),a=(n,i)=>{t.has(e.host)&&(t.delete(e.host),r(t=>{let r=new Map(t);return r.set(e.host,{status:n,latency:i}),r}),t.size===0&&o(!1))},c=setTimeout(()=>{n.abort()},gt);fetch(`https://${e.host}/`,{method:`HEAD`,mode:`no-cors`,cache:`no-store`,signal:n.signal}).then(()=>{clearTimeout(c),a(`ok`,Math.round(performance.now()-i))}).catch(()=>{clearTimeout(c),a(`timeout`,0)})})},[]);return(0,S.useEffect)(()=>(l(),()=>{s.current.forEach(e=>e.abort()),s.current.clear()}),[l]),(0,Q.jsxs)(`div`,{className:`ping-page`,children:[(0,Q.jsxs)(`div`,{className:`ping-header`,children:[(0,Q.jsxs)(`div`,{className:`ping-title-wrap`,children:[(0,Q.jsx)(p,{size:28,className:`ping-title-icon`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`ping-title`,children:e(`ping.title`)}),(0,Q.jsx)(`p`,{className:`ping-subtitle`,children:e(`ping.subtitle`)})]})]}),(0,Q.jsx)(`button`,{className:`btn btn-icon`,onClick:l,disabled:i,"aria-label":e(`ping.retryAll`),title:e(`ping.retryAll`),children:(0,Q.jsx)(x,{size:18,className:i?`ping-spin`:``})})]}),(0,Q.jsx)(`div`,{className:`ping-grid`,children:$.map(r=>{let i=n.get(r.host),a=!i||i.status===`pending`,o=i?.status===`timeout`;return(0,Q.jsxs)(`div`,{className:`ping-card ${a?`pending`:``}`,children:[(0,Q.jsxs)(`div`,{className:`ping-card-top`,children:[(0,Q.jsx)(`span`,{className:`ping-card-icon`,children:(0,Q.jsx)(_t,{icon:r.icon,fallback:r.fallback})}),(0,Q.jsx)(`a`,{href:`https://${r.host}`,target:`_blank`,rel:`noreferrer`,className:`ping-card-name`,children:r.name}),(0,Q.jsx)(`button`,{className:`ping-card-refresh`,onClick:()=>c(r.host),disabled:a,"aria-label":e(`ping.retryOne`,{name:r.name}),title:e(`ping.retry`),children:(0,Q.jsx)(x,{size:13,className:a?`ping-spin`:``})})]}),(0,Q.jsxs)(`div`,{className:`ping-card-bottom`,children:[a?(0,Q.jsx)(`span`,{className:`ping-pulse-dot`}):(0,Q.jsx)(`span`,{className:`ping-status-label ${o?`is-error`:`is-success`}`,children:e(o?`ping.unavailable`:`ping.available`)}),(0,Q.jsx)(`span`,{className:`ping-latency ${a?`is-muted`:o?`is-error`:`is-success`}`,children:a?`--`:o?e(`ping.timeout`):`${t(i.latency)} ms`})]})]},r.host)})})]})}function yt(){return(0,Q.jsx)(m,{children:(0,Q.jsx)(vt,{})})}var bt=i(`/ping/`)({component:yt});export{bt as Route};
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{B as r,H as i}from"./useAppStore-DNhyhD20.js";import{a}from"./i18n-DKsg67mH.js";import{n as o,t as s}from"./smartphone-CrsocYJo.js";import{t as c}from"./message-square-CfApq8Ou.js";import{t as l}from"./music-Br2x8TKX.js";import{t as u}from"./play-DSHtNcOe.js";import{t as d}from"./search-DLBOUfny.js";import{t as f}from"./send-Bie9hgHI.js";import{t as p}from"./wifi-CILQyKk0.js";import{t as m}from"./MarketingLayout-Ch4sw5Qm.js";var h=r(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),g=r(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),_=r(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),v=r(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),y=r(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),b=r(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),x=r(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),ee=r(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),te=r(`triangle`,[[`path`,{d:`M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z`,key:`14u9p9`}]]),S=t(e(),1);function ne(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}var re=Object.freeze({left:0,top:0,width:16,height:16}),C=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),w=Object.freeze({...re,...C}),T=Object.freeze({...w,body:``,hidden:!1});function ie(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function E(e,t){let n=ie(e,t);for(let r in T)r in C?r in e&&!(r in n)&&(n[r]=C[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function ae(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=E(r[e]||i[e],a)}return o(t),n.forEach(o),E(e,a)}function oe(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=ne(e);for(let i in r){let a=r[i];a&&(t(i,ae(e,i,a)),n.push(i))}return n}var se={provider:``,aliases:{},not_found:{},...re};function D(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function O(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!D(e,se))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!D(t,T))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!D(t,T))return null}return t}var k=Object.create(null);function ce(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function A(e,t){let n=k[e]||(k[e]=Object.create(null));return n[t]||(n[t]=ce(e,t))}function le(e,t){return O(t)?oe(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function ue(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var de=/^[a-z0-9]+(-[a-z0-9]+)*$/,j=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!M(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!M(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!M(e,n)?null:e}return null},M=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,N=!1;function P(e){return typeof e==`boolean`&&(N=e),N}function F(e){let t=typeof e==`string`?j(e,!0,N):e;if(t){let e=A(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function fe(e,t){let n=j(e,!0,N);if(!n)return!1;let r=A(n.provider,n.prefix);return t?ue(r,n.name,t):(r.missing.add(n.name),!0)}function pe(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),N&&!t&&!e.prefix){let t=!1;return O(e)&&(e.prefix=``,oe(e,(e,n)=>{fe(e,n)&&(t=!0)})),t}let n=e.prefix;return M({prefix:n,name:`a`})?!!le(A(t,n),e):!1}var I=Object.freeze({width:null,height:null}),L=Object.freeze({...I,...C}),me=/(-?[0-9.]*[0-9]+[0-9.]*)/g,he=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function R(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(me);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=he.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function ge(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function _e(e,t){return e?`<defs>`+e+`</defs>`+t:t}function ve(e,t,n){let r=ge(e);return _e(r.defs,t+r.content+n)}var ye=e=>e===`unset`||e===`undefined`||e===`none`;function be(e,t){let n={...w,...e},r={...L,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=ve(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=R(d,c/l)):(u=o===`auto`?c:o,d=s===null?R(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{ye(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var xe=/\sid="(\S+)"/g,Se=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),Ce=0;function we(e,t=Se){let n=[],r;for(;r=xe.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(Ce++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var z=Object.create(null);function Te(e,t){z[e]=t}function B(e){return z[e]||z[``]}function V(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var H=Object.create(null),U=[`https://api.simplesvg.com`,`https://api.unisvg.com`],W=[];U.length>0;)U.length===1||Math.random()>.5?W.push(U.shift()):W.push(U.pop());H[``]=V({resources:[`https://api.iconify.design`].concat(W)});function Ee(e,t){let n=V(t);return n===null?!1:(H[e]=n,!0)}function G(e){return H[e]}var K=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function De(e,t){let n=G(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function Oe(e){return e===404}var ke=(e,t,n)=>{let r=[],i=De(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function Ae(e){if(typeof e==`string`){let t=G(e);if(t)return t.path}return`/`}var je={prepare:ke,send:(e,t,n)=>{if(!K){n(`abort`,424);return}let r=Ae(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;K(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(Oe(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function q(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function Me(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||q([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var Ne=0;function Pe(e,t,n){let r=Ne++,i=q.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function Fe(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=A(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function Ie(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?j(e,t,n):e;i&&r.push(i)}),r}var Le={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Re(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function ze(e){let t={...Le,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=Re(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function Be(){}var J=Object.create(null);function Ve(e){if(!J[e]){let t=G(e);if(!t)return;J[e]={config:t,redundancy:ze(t)}}return J[e]}function He(e,t,n){let r,i;if(typeof e==`string`){let t=B(e);if(!t)return n(void 0,424),Be;i=t.send;let a=Ve(e);a&&(r=a.redundancy)}else{let t=V(e);if(t){r=ze(t);let n=B(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),Be):r.query(t,i,n)().abort}function Ue(){}function We(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Me(e)}))}function Ge(e){let t=[],n=[];return e.forEach(e=>{(e.match(de)?t:n).push(e)}),{valid:t,invalid:n}}function Y(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!le(e,n).length){r();return}}catch(e){console.error(e)}r(),We(e)}function Ke(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function qe(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Ke(e.loadIcons(r,n,t),t=>{Y(e,r,t)});return}if(i){r.forEach(r=>{Ke(i(r,n,t),t=>{Y(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=Ge(r);if(o.length&&Y(e,o,null),!a.length)return;let s=n.match(de)?B(t):null;if(!s){Y(e,a,null);return}s.prepare(t,n,a).forEach(n=>{He(t,n,t=>{Y(e,n.icons,t)})})}))}var Je=(e,t)=>{let n=Fe(Ie(e,!0,P()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,Ue)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(A(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=A(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&qe(e,t)}),t?Pe(t,n,i):Ue};function Ye(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in I?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var Xe=/[\s,]+/;function Ze(e,t){t.split(Xe).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function Qe(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function $e(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function et(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function tt(e){return`data:image/svg+xml,`+et(e)}function nt(e){return`url("`+tt(e)+`")`}var X;function rt(){try{X=window.trustedTypes.createPolicy(`iconify`,{createHTML:e=>e})}catch{X=null}}function it(e){return X===void 0&&rt(),X?X.createHTML(e):e}var at={...L,inline:!1},ot={xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},st={display:`inline-block`},Z={backgroundColor:`currentColor`},ct={backgroundColor:`transparent`},lt={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},ut={WebkitMask:Z,mask:Z,background:ct};for(let e in ut){let t=ut[e];for(let n in lt)t[e+n]=lt[n]}var dt={...at,inline:!0};function ft(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var pt=(e,t,n)=>{let r=t.inline?dt:at,i=Ye(r,t),a=t.mode||`svg`,o={},s=t.style||{},c={...a===`svg`?ot:{}};if(n){let e=j(n,!1,!0);if(e){let t=[`iconify`];for(let n of[`provider`,`prefix`])e[n]&&t.push(`iconify--`+e[n]);c.className=t.join(` `)}}for(let e in t){let n=t[e];if(n!==void 0)switch(e){case`icon`:case`style`:case`children`:case`onLoad`:case`mode`:case`ssr`:case`fallback`:break;case`_ref`:c.ref=n;break;case`className`:c[e]=(c[e]?c[e]+` `:``)+n;break;case`inline`:case`hFlip`:case`vFlip`:i[e]=n===!0||n===`true`||n===1;break;case`flip`:typeof n==`string`&&Ze(i,n);break;case`color`:o.color=n;break;case`rotate`:typeof n==`string`?i[e]=Qe(n):typeof n==`number`&&(i[e]=n);break;case`ariaHidden`:case`aria-hidden`:n!==!0&&n!==`true`&&delete c[`aria-hidden`];break;default:r[e]===void 0&&(c[e]=n)}}let l=be(e,i),u=l.attributes;if(i.inline&&(o.verticalAlign=`-0.125em`),a===`svg`){c.style={...o,...s},Object.assign(c,u);let e=0,n=t.id;return typeof n==`string`&&(n=n.replace(/-/g,`_`)),c.dangerouslySetInnerHTML={__html:it(we(l.body,n?()=>n+`ID`+e++:`iconifyReact`))},(0,S.createElement)(`svg`,c)}let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=$e(d,{...u,width:f+``,height:p+``});return c.style={...o,"--svg":nt(h),width:ft(u.width),height:ft(u.height),...st,...m?Z:ct,...s},(0,S.createElement)(`span`,c)};if(P(!0),Te(``,je),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!pe(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;Ee(e,r)||console.error(n)}catch{console.error(n)}}}}function mt(e){let[t,n]=(0,S.useState)(!!e.ssr),[r,i]=(0,S.useState)({});function a(t){if(t){let t=e.icon;if(typeof t==`object`)return{name:``,data:t};let n=F(t);if(n)return{name:t,data:n}}return{name:``}}let[o,s]=(0,S.useState)(a(!!e.ssr));function c(){let e=r.callback;e&&(e(),i({}))}function l(e){if(JSON.stringify(o)!==JSON.stringify(e))return c(),s(e),!0}function u(){var t;let n=e.icon;if(typeof n==`object`){l({name:``,data:n});return}let r=F(n);l({name:n,data:r})&&(r===void 0?i({callback:Je([n],u)}):r&&((t=e.onLoad)==null||t.call(e,n)))}(0,S.useEffect)(()=>(n(!0),c),[]),(0,S.useEffect)(()=>{t&&u()},[e.icon,t]);let{name:d,data:f}=o;return f?pt({...w,...f},e,d):e.children?e.children:e.fallback?e.fallback:(0,S.createElement)(`span`,{})}var ht=(0,S.forwardRef)((e,t)=>mt({...e,_ref:t}));(0,S.forwardRef)((e,t)=>mt({inline:!0,...e,_ref:t}));var Q=n(),$=[{name:`Google`,host:`google.com`,icon:`simple-icons:google`,fallback:(0,Q.jsx)(d,{size:20})},{name:`Cloudflare`,host:`cloudflare.com`,icon:`simple-icons:cloudflare`,fallback:(0,Q.jsx)(o,{size:20})},{name:`YouTube`,host:`youtube.com`,icon:`simple-icons:youtube`,fallback:(0,Q.jsx)(u,{size:20})},{name:`GitHub`,host:`github.com`,icon:`simple-icons:github`,fallback:(0,Q.jsx)(ee,{size:20})},{name:`ChatGPT`,host:`chatgpt.com`,icon:`simple-icons:openai`,fallback:(0,Q.jsx)(_,{size:20})},{name:`X`,host:`x.com`,icon:`simple-icons:x`,fallback:(0,Q.jsx)(h,{size:20})},{name:`Instagram`,host:`instagram.com`,icon:`simple-icons:instagram`,fallback:(0,Q.jsx)(v,{size:20})},{name:`Reddit`,host:`reddit.com`,icon:`simple-icons:reddit`,fallback:(0,Q.jsx)(c,{size:20})},{name:`Wikipedia`,host:`wikipedia.org`,icon:`simple-icons:wikipedia`,fallback:(0,Q.jsx)(g,{size:20})},{name:`Apple`,host:`apple.com`,icon:`simple-icons:apple`,fallback:(0,Q.jsx)(s,{size:20})},{name:`Telegram`,host:`telegram.org`,icon:`simple-icons:telegram`,fallback:(0,Q.jsx)(f,{size:20})},{name:`Discord`,host:`discord.com`,icon:`simple-icons:discord`,fallback:(0,Q.jsx)(y,{size:20})},{name:`TikTok`,host:`tiktok.com`,icon:`simple-icons:tiktok`,fallback:(0,Q.jsx)(l,{size:20})},{name:`npm`,host:`npmjs.com`,icon:`simple-icons:npm`,fallback:(0,Q.jsx)(b,{size:20})},{name:`Vercel`,host:`vercel.com`,icon:`simple-icons:vercel`,fallback:(0,Q.jsx)(te,{size:20})}],gt=5e3;function _t({icon:e,fallback:t}){let[n,r]=(0,S.useState)(!1);return(0,S.useEffect)(()=>{let t=new Image;t.onload=()=>r(!0),t.onerror=()=>r(!1),t.src=`https://api.iconify.design/${e.replace(`:`,`/`)}.svg`},[e]),(0,Q.jsxs)(`span`,{className:`brand-icon-wrap`,children:[(0,Q.jsx)(`span`,{className:`brand-icon-fallback ${n?`hidden`:``}`,children:t}),(0,Q.jsx)(`span`,{className:`brand-icon-real ${n?`visible`:``}`,children:(0,Q.jsx)(ht,{icon:e,width:20,height:20})})]})}function vt(){let{t:e,formatNumber:t}=a(),[n,r]=(0,S.useState)(new Map),[i,o]=(0,S.useState)(!1),s=(0,S.useRef)(new Map);(0,S.useEffect)(()=>{document.title=e(`ping.meta.title`)},[e]);let c=(0,S.useCallback)(e=>{r(t=>{let n=new Map(t);return n.set(e,{status:`pending`,latency:0}),n});let t=new AbortController;s.current.set(e,t);let n=performance.now(),i=(t,n)=>{r(r=>{let i=new Map(r);return i.set(e,{status:t,latency:n}),i})},a=setTimeout(()=>{t.abort()},gt);fetch(`https://${e}/`,{method:`HEAD`,mode:`no-cors`,cache:`no-store`,signal:t.signal}).then(()=>{clearTimeout(a),i(`ok`,Math.round(performance.now()-n))}).catch(()=>{clearTimeout(a),i(`timeout`,0)})},[]),l=(0,S.useCallback)(()=>{o(!0);let e=new Map;$.forEach(t=>{e.set(t.host,{status:`pending`,latency:0})}),r(e);let t=new Set($.map(e=>e.host));$.forEach(e=>{let n=new AbortController;s.current.set(e.host,n);let i=performance.now(),a=(n,i)=>{t.has(e.host)&&(t.delete(e.host),r(t=>{let r=new Map(t);return r.set(e.host,{status:n,latency:i}),r}),t.size===0&&o(!1))},c=setTimeout(()=>{n.abort()},gt);fetch(`https://${e.host}/`,{method:`HEAD`,mode:`no-cors`,cache:`no-store`,signal:n.signal}).then(()=>{clearTimeout(c),a(`ok`,Math.round(performance.now()-i))}).catch(()=>{clearTimeout(c),a(`timeout`,0)})})},[]);return(0,S.useEffect)(()=>(l(),()=>{s.current.forEach(e=>e.abort()),s.current.clear()}),[l]),(0,Q.jsxs)(`div`,{className:`ping-page`,children:[(0,Q.jsxs)(`div`,{className:`ping-header`,children:[(0,Q.jsxs)(`div`,{className:`ping-title-wrap`,children:[(0,Q.jsx)(p,{size:28,className:`ping-title-icon`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`ping-title`,children:e(`ping.title`)}),(0,Q.jsx)(`p`,{className:`ping-subtitle`,children:e(`ping.subtitle`)})]})]}),(0,Q.jsx)(`button`,{className:`btn btn-icon`,onClick:l,disabled:i,"aria-label":e(`ping.retryAll`),title:e(`ping.retryAll`),children:(0,Q.jsx)(x,{size:18,className:i?`ping-spin`:``})})]}),(0,Q.jsx)(`div`,{className:`ping-grid`,children:$.map(r=>{let i=n.get(r.host),a=!i||i.status===`pending`,o=i?.status===`timeout`;return(0,Q.jsxs)(`div`,{className:`ping-card ${a?`pending`:``}`,children:[(0,Q.jsxs)(`div`,{className:`ping-card-top`,children:[(0,Q.jsx)(`span`,{className:`ping-card-icon`,children:(0,Q.jsx)(_t,{icon:r.icon,fallback:r.fallback})}),(0,Q.jsx)(`a`,{href:`https://${r.host}`,target:`_blank`,rel:`noreferrer`,className:`ping-card-name`,children:r.name}),(0,Q.jsx)(`button`,{className:`ping-card-refresh`,onClick:()=>c(r.host),disabled:a,"aria-label":e(`ping.retryOne`,{name:r.name}),title:e(`ping.retry`),children:(0,Q.jsx)(x,{size:13,className:a?`ping-spin`:``})})]}),(0,Q.jsxs)(`div`,{className:`ping-card-bottom`,children:[a?(0,Q.jsx)(`span`,{className:`ping-pulse-dot`}):(0,Q.jsx)(`span`,{className:`ping-status-label ${o?`is-error`:`is-success`}`,children:e(o?`ping.unavailable`:`ping.available`)}),(0,Q.jsx)(`span`,{className:`ping-latency ${a?`is-muted`:o?`is-error`:`is-success`}`,children:a?`--`:o?e(`ping.timeout`):`${t(i.latency)} ms`})]})]},r.host)})})]})}function yt(){return(0,Q.jsx)(m,{children:(0,Q.jsx)(vt,{})})}var bt=i(`/ping/`)({component:yt});export{bt as Route};
|