most-box 0.2.3 → 0.2.5
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/README.md +3 -26
- package/electron/main.js +366 -30
- package/electron/preload.js +16 -1
- package/electron/updateChecker.js +18 -11
- package/electron/updateChecker.test.js +23 -7
- package/out/admin/index.html +0 -0
- package/out/app/index.html +0 -0
- package/out/assets/AppShell-oF8wPXde.js +1 -0
- package/out/assets/FilePreviewOverlay-DTBZt89J.js +1 -0
- package/out/assets/LanguageToggle-HAJ3D6Ne.js +1 -0
- package/out/assets/MarketingHeader-B3vYocUz.js +1 -0
- package/out/assets/MarketingLayout-CapVVXTP.js +1 -0
- package/out/assets/{MarketingThemeToggle-DHVvLtms.js → MarketingThemeToggle-B47H68ro.js} +1 -1
- package/out/assets/{MilkdownEditor-WdGJyEa8.js → MilkdownEditor-CRA9oxMp.js} +1 -1
- package/out/assets/{OpenSidebarButton-CtsDYSq0.js → OpenSidebarButton-D3JRO-Hh.js} +1 -1
- package/out/assets/{SidebarAccount-4NFTcAF7.js → SidebarAccount-8_hQAYXx.js} +1 -1
- package/out/assets/arrow-right-mNO53HQi.js +1 -0
- package/out/assets/{circle-alert-BQoSDxUe.js → circle-alert-CofRTRHr.js} +1 -1
- package/out/assets/cloud-DAGFCFIp.js +1 -0
- package/out/assets/{copy-BtJHJnqH.js → copy-5aEv78Eq.js} +1 -1
- package/out/assets/{download-Bg-OdoxM.js → download-Bhqn6hL1.js} +1 -1
- package/out/assets/{downloadValidation-DS9_BV-n.js → downloadValidation-eInMiVSX.js} +1 -1
- package/out/assets/{external-link-m8ZIQe4p.js → external-link-CNR21yFA.js} +1 -1
- package/out/assets/{file-text-DG1orIkZ.js → file-text-CFfvvCnM.js} +1 -1
- package/out/assets/folder-BGJCjyba.js +1 -0
- package/out/assets/{hard-drive-BB-sllXA.js → hard-drive-4vHpA5kz.js} +1 -1
- package/out/assets/index--p9MKNEl.js +31 -0
- package/out/assets/index-DEu4udaa.css +1 -0
- package/out/assets/index.lazy-2K3f5PZe.js +1 -0
- package/out/assets/index.lazy-B-2etVwK.js +1 -0
- package/out/assets/index.lazy-B4WTQF5E.js +1 -0
- package/out/assets/index.lazy-BFfsQrRe.js +1 -0
- package/out/assets/index.lazy-C5udBnrO.js +1 -0
- package/out/assets/{index.lazy-DwKnzBXo.js → index.lazy-C84HrZpm.js} +1 -1
- package/out/assets/index.lazy-CBC2N5p_.js +3 -0
- package/out/assets/index.lazy-CzANViGX.js +1 -0
- package/out/assets/index.lazy-D3cw7yyA.js +2 -0
- package/out/assets/{index.lazy-C3z-lGsL.js → index.lazy-DVVZzbCN.js} +1 -1
- package/out/assets/index.lazy-DxZgywoV.js +1 -0
- package/out/assets/{index.lazy-DSjaivix.js → index.lazy-RBLN4SE9.js} +1 -1
- package/out/assets/index.lazy-s4E2z9AY.js +2 -0
- package/out/assets/{key-round-DIQ3Xt5F.js → key-round-BpSdpOHi.js} +1 -1
- package/out/assets/loader-ByMmV2_4.js +1 -0
- package/out/assets/{lock-tf1t2yuy.js → lock-C0pdaery.js} +1 -1
- package/out/assets/{message-square-DaQH7q-P.js → message-square-Eu86zZup.js} +1 -1
- package/out/assets/{mp-DYPYks13.js → mp-CJWipckT.js} +1 -1
- package/out/assets/{music-DaFvU2DL.js → music-Btrhub6z.js} +1 -1
- package/out/assets/{notebook-pen-CqEFOHKx.js → notebook-pen-CfdFgaDE.js} +1 -1
- package/out/assets/play-D5r9Yvbq.js +1 -0
- package/out/assets/plus-Mlh7r_bm.js +1 -0
- package/out/assets/{refresh-cw-roxAhABl.js → refresh-cw--JB8k6mH.js} +1 -1
- package/out/assets/{save-DR0O9ReR.js → save-DN4eprSt.js} +1 -1
- package/out/assets/search-CbzMyENy.js +1 -0
- package/out/assets/{send-m1XCcuPn.js → send-D8p6f8OD.js} +1 -1
- package/out/assets/{shield-check-BwcvTU4U.js → shield-check-c0labdRH.js} +1 -1
- package/out/assets/{trash-2-CNpsqYc1.js → trash-2-zdhWec_U.js} +1 -1
- package/out/assets/triangle-alert-CO_5uXy2.js +1 -0
- package/out/assets/upload-BD23c5Pz.js +1 -0
- package/out/assets/{useChannelMessages-qJTlBnzX.js → useChannelMessages-D_306Ymv.js} +2 -2
- package/out/assets/useGameRoom-CURx56m6.js +1 -0
- package/out/assets/userProfile-oeBvU6ch.js +1 -0
- package/out/assets/{userStore-C4vdYsQp.js → userStore-q0BBZsIV.js} +1 -1
- package/out/assets/{wallet-CozFU6yK.js → wallet-DmZMdK9A.js} +1 -1
- package/out/assets/{wifi-DIR3g_8A.js → wifi-CVqaPDcv.js} +1 -1
- package/out/chat/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 +8 -1
- package/server/index.js +2 -2
- package/server/src/core/syncTimestamp.js +10 -0
- package/server/src/http/nodeStatus.js +16 -16
- package/server/src/http/routePolicy.js +2 -2
- package/server/src/http/routes/nodeRoutes.js +21 -19
- package/server/src/index.js +578 -960
- package/server/src/utils/accountBackup.js +134 -0
- package/server/src/utils/api.js +149 -9
- package/out/assets/AppShell-B1U4lDqV.js +0 -1
- package/out/assets/FilePreviewOverlay-Cme4vUhr.js +0 -1
- package/out/assets/LanguageToggle-CBpXWdO9.js +0 -1
- package/out/assets/MarketingHeader-CkcBATx2.js +0 -1
- package/out/assets/MarketingLayout-mQV6ciYc.js +0 -1
- package/out/assets/arrow-right-RldN7Rwi.js +0 -1
- package/out/assets/cloud-DHoTMeZY.js +0 -1
- package/out/assets/index-BJ7E8LJN.js +0 -31
- package/out/assets/index-C0xqKeu-.css +0 -1
- package/out/assets/index.lazy-B5hOQuoO.js +0 -2
- package/out/assets/index.lazy-B9ligvAg.js +0 -1
- package/out/assets/index.lazy-BZ7nMBcY.js +0 -3
- package/out/assets/index.lazy-C-2BI6Ew.js +0 -1
- package/out/assets/index.lazy-Cda9sU_h.js +0 -1
- package/out/assets/index.lazy-D5ybxeOu.js +0 -1
- package/out/assets/index.lazy-DMZi3gid.js +0 -1
- package/out/assets/index.lazy-Dvgt53xN.js +0 -1
- package/out/assets/index.lazy-Dvo4Ncqe.js +0 -2
- package/out/assets/index.lazy-GQILyi6o.js +0 -1
- package/out/assets/play-B7q6F75-.js +0 -1
- package/out/assets/plus-H2i2mspM.js +0 -1
- package/out/assets/search-ncblG-zw.js +0 -1
- package/out/assets/triangle-alert-DP9EP7IM.js +0 -1
- package/out/assets/upload-V--8p13l.js +0 -1
- package/out/assets/useGameRoom-C9hu7Cez.js +0 -1
- package/server/src/core/userSyncKeys.js +0 -36
- package/server/src/utils/noteBackup.js +0 -116
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{g as r,t as i,v as a}from"./userStore-q0BBZsIV.js";import{t as o}from"./arrow-right-mNO53HQi.js";import{i as s,r as c}from"./LanguageToggle-HAJ3D6Ne.js";import{t as l}from"./circle-alert-CofRTRHr.js";import{t as u}from"./download-Bhqn6hL1.js";import{t as d}from"./file-text-CFfvvCnM.js";import{a as f,i as p,n as ee,r as te,t as ne}from"./FilePreviewOverlay-DTBZt89J.js";import{t as re}from"./loader-ByMmV2_4.js";import{r as ie,t as ae}from"./AppShell-oF8wPXde.js";import{t as oe}from"./message-square-Eu86zZup.js";import{t as m}from"./music-Btrhub6z.js";import{t as se}from"./OpenSidebarButton-D3JRO-Hh.js";import{t as ce}from"./plus-Mlh7r_bm.js";import{t as le}from"./search-CbzMyENy.js";import{t as h}from"./trash-2-zdhWec_U.js";import{A as ue,F as de,M as g,R as _,c as v,d as fe,h as pe,i as me,k as he,l as ge,m as y,u as _e,v as ve}from"./index--p9MKNEl.js";import{t as ye}from"./SidebarAccount-8_hQAYXx.js";import{n as b,r as be,t as xe}from"./downloadValidation-eInMiVSX.js";import{t as Se}from"./LogoIcon-B2fFe0l1.js";import{i as x,t as Ce}from"./userProfile-oeBvU6ch.js";import{t as we}from"./useChannelMessages-D_306Ymv.js";var Te=r(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),Ee=r(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),De=r(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Oe=r(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),ke=r(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),Ae=r(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),S=t(e(),1),C=n();function je(e){return!e||e<=0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function Me(e){let t=String(e||``).split(`/`);return t[t.length-1]||e}function Ne(e){return e===`image`?(0,C.jsx)(p,{size:20}):e===`video`?(0,C.jsx)(f,{size:20}):e===`audio`?(0,C.jsx)(m,{size:20}):(0,C.jsx)(d,{size:20})}function Pe({attachment:e,status:t=`idle`,pending:n=!1,onOpen:r}){let{t:i}=_(),a=t===`checking`,o=[`ui-file-action`,`chat-attachment-action`,t===`error`?`error`:``,t===`available`?`available`:``].filter(Boolean).join(` `),s=je(e.size)||i(`chat.mostboxFile`);return(0,C.jsxs)(`button`,{type:`button`,className:`ui-file-card chat-attachment-card`,onClick:()=>r?.(e),disabled:n||a,title:e.link,translate:`no`,children:[(0,C.jsx)(`span`,{className:`ui-file-icon chat-attachment-icon ${e.kind}`,children:a?(0,C.jsx)(re,{size:20,className:`ui-spinner chat-attachment-spinner`}):Ne(e.kind)}),(0,C.jsxs)(`span`,{className:`ui-file-info chat-attachment-info`,children:[(0,C.jsx)(`span`,{className:`ui-file-name chat-attachment-name`,translate:`no`,children:Me(e.fileName)}),(0,C.jsx)(`span`,{className:`ui-file-meta chat-attachment-meta`,translate:`yes`,children:n?i(`chat.sending`):s})]}),(0,C.jsx)(`span`,{className:o,translate:`yes`,children:a?i(`chat.checking`):t===`available`?(0,C.jsx)(g,{size:16}):t===`error`?(0,C.jsx)(l,{size:17}):(0,C.jsx)(u,{size:16})})]})}var Fe=[{key:`image`,labelKey:`chat.attachment.image`,accept:`image/*`,icon:p},{key:`video`,labelKey:`chat.attachment.video`,accept:`video/*`,icon:f},{key:`file`,labelKey:`chat.attachment.file`,accept:``,icon:d}],Ie=Fe.map(e=>e.accept).join(`,`);function Le({children:e}){return(0,C.jsx)(`div`,{className:`message-bubble`,translate:`no`,children:e})}function Re({children:e}){return(0,C.jsx)(`div`,{className:`message-bubble has-attachment`,children:e})}function ze({variant:e,pending:t=!1,avatarSrc:n,author:r,time:i,children:a}){return(0,C.jsxs)(`div`,{className:[`chat-message`,e,t?`pending`:``].filter(Boolean).join(` `),children:[(0,C.jsx)(`img`,{className:`msg-avatar`,src:n,alt:`avatar`}),(0,C.jsxs)(`div`,{className:`msg-content`,children:[(0,C.jsx)(`span`,{className:`message-author`,translate:`no`,children:r}),a,(0,C.jsx)(`span`,{className:`message-time`,children:i})]})]})}function Be({active:e=!1,pinned:t=!1,unread:n=!1,title:r,onSelect:i,onTogglePin:a,onRename:o,onLeave:s}){let{t:c}=_(),l=!!(a||o||s);return(0,C.jsxs)(`div`,{className:[`sidebar-nav-btn`,e?`active`:``,t?`pinned`:``,n?`unread`:``].filter(Boolean).join(` `),onClick:i,role:`button`,tabIndex:0,onKeyDown:e=>{e.target===e.currentTarget&&e.key===`Enter`&&i?.()},children:[(0,C.jsxs)(`span`,{className:`chat-channel-icon-wrap`,children:[(0,C.jsx)(oe,{size:16}),n&&(0,C.jsx)(`span`,{className:`chat-channel-unread-dot`,title:c(`chat.unread`),"aria-hidden":`true`})]}),(0,C.jsx)(`span`,{className:`chat-channel-title`,children:(0,C.jsx)(`span`,{className:`chat-channel-title-text`,translate:`no`,children:r})}),l&&(0,C.jsx)(v,{ariaLabel:c(`chat.channelActions`),className:`channel-actions-anchor`,placement:`bottom-end`,items:[{key:`pin`,label:c(t?`chat.unpin`:`chat.pin`),icon:t?(0,C.jsx)(ke,{size:16}):(0,C.jsx)(Oe,{size:16}),onSelect:()=>a?.()},{key:`rename`,label:c(`chat.rename`),icon:(0,C.jsx)(te,{size:16}),onSelect:()=>o?.()},{key:`delete`,label:c(`chat.delete`),icon:(0,C.jsx)(h,{size:16}),onSelect:()=>s?.()}],renderTrigger:e=>(0,C.jsx)(`button`,{...e,className:`leave-channel-btn channel-actions-trigger`,title:c(`common.moreActions`),"aria-label":c(`common.moreActions`),children:(0,C.jsx)(Ee,{size:16})})})]})}function Ve({members:e,isLoading:t=!1}){let{t:n}=_();return t&&e.length===0?(0,C.jsx)(`div`,{className:`ui-empty-inline channel-members-empty`,children:n(`chat.loadingMembers`)}):e.length===0?(0,C.jsx)(`div`,{className:`ui-empty-inline channel-members-empty`,children:n(`chat.noMembers`)}):(0,C.jsx)(`div`,{className:`channel-members-grid`,children:e.map(e=>(0,C.jsxs)(`div`,{className:`channel-member`,children:[(0,C.jsx)(`img`,{className:`channel-member-avatar`,src:e.avatarSrc,alt:`avatar`}),(0,C.jsx)(`span`,{className:`channel-member-name`,translate:`no`,children:e.name})]},e.id))})}function He({message:e,placeholder:t,disabled:n=!1,isPublishingAttachment:r=!1,attachmentButtonTitle:i,attachmentInputRef:a,onMessageChange:s,onSend:c,onSelectAttachmentFiles:l}){let{t:u}=_(),d=n||r,f=n||!e.trim(),p=i||u(`chat.attachment.add`);function ee(e,t){t?.(e.currentTarget.files),e.currentTarget.value=``}function te(t){t.key===`Enter`&&e.trim()&&c()}function ne(e){if(d)return;let t=a?.current;t&&(t.accept=e,t.click())}return(0,C.jsxs)(`div`,{className:`chat-input-area`,children:[(0,C.jsx)(`input`,{ref:a,type:`file`,accept:Ie,className:`chat-file-input`,onChange:e=>ee(e,l)}),(0,C.jsx)(v,{ariaLabel:u(`chat.attachmentType`),placement:`top-start`,disabled:d,items:Fe.map(e=>{let t=e.icon;return{key:e.key,label:u(e.labelKey),icon:(0,C.jsx)(t,{size:16}),onSelect:()=>ne(e.accept)}}),renderTrigger:e=>(0,C.jsx)(`button`,{...e,className:`btn btn-circle chat-tool-btn`,"aria-label":p,children:r?(0,C.jsx)(re,{size:18,className:`ui-spinner chat-attachment-spinner`}):(0,C.jsx)(ce,{size:18})})}),(0,C.jsx)(`input`,{type:`text`,className:`input input-pill`,placeholder:t,value:e,disabled:n,onChange:e=>s(e.target.value),onKeyDown:te}),(0,C.jsx)(`button`,{type:`button`,className:`btn btn-circle btn-primary send-btn`,onClick:c,disabled:f,title:u(`chat.sendMessage`),children:(0,C.jsx)(o,{size:18})})]})}var Ue=`mostbox.chat.lastReadAt`;function w(e){return Date.parse(e?.lastMessageAt||``)||Date.parse(e?.createdAt||``)||0}function We(e){let t=String(e||``).trim().toLowerCase();return t?`${Ue}:${t}`:``}function T(e,t=Date.now()){let n=Number(e);return Math.max(0,Math.floor(Number.isFinite(n)&&n>0?n:t))}function Ge(e,t=E()){if(!e||!t)return{};try{let n=t.getItem(e);if(!n)return{};let r=JSON.parse(n);return!r||typeof r!=`object`?{}:Object.entries(r).reduce((e,[t,n])=>{let r=Number(n);return t&&Number.isFinite(r)&&r>=0&&(e[t]=r),e},{})}catch{return{}}}function Ke(e,t,n=E()){if(!(!e||!n))try{n.setItem(e,JSON.stringify(t))}catch{}}function qe(e,t,n=Date.now(),r=Date.now()){if(!t)return{changed:!1,value:e};let i=T(n,r);return(e[t]||0)>=i?{changed:!1,value:e}:{changed:!0,value:{...e,[t]:i}}}function Je(e,t,n=Date.now()){let r=!1,i={...e};for(let e of t){let t=e?.channelKey||e?.name;!t||i[t]!==void 0||(i[t]=T(w(e),n),r=!0)}return{changed:r,value:r?i:e}}function Ye(e,{channelName:t,messageTime:n,activeChannelName:r=``,messageAuthor:i=``,userAddress:a=``,now:o=Date.now()}){if(!t)return{changed:!1,notify:!1,value:e};let s=T(n,o),c=t===r,l=String(i||``).toLowerCase()===String(a||``).toLowerCase();if(c||l)return{...qe(e,t,s,o),notify:!1};let u=e[t]||0;if(u<s)return{changed:!1,notify:!0,value:e};let d=Math.max(0,s-1);return u===d?{changed:!1,notify:!0,value:e}:{changed:!0,notify:!0,value:{...e,[t]:d}}}function Xe(e,t){let n=e?.channelKey||e?.name;return w(e)>(t[n]||0)}function E(){if(!(typeof window>`u`))return window.localStorage}var Ze=3,Qe=30,$e=/^[a-zA-Z0-9_-]+$/,et=1e4,tt=12e3,nt=1200;function D(e){return e?.channelKey||e?.name||``}function O(e){return e?.channelId||e?.name||``}function k(e){return e?.remark||O(e)}var rt=`chat-file`;function it(e,t){return e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:e.type.startsWith(`audio/`)?`audio`:e.type.startsWith(`text/`)?`text`:ee(t)}function at(e){return e?`${e.slice(0,6)}...${e.slice(-4)}`:`Unknown`}function ot(e){return/#[a-fA-F0-9]{4}$/.test(String(e||``).trim())}function st(){if(typeof window>`u`)return;let e=window;return e.AudioContext||e.webkitAudioContext}function ct(){let e=y(e=>e.isDarkMode),t=y(e=>e.setIsDarkMode),n=y(e=>e.hasBackend),r=y(e=>e.addToast),a=y(e=>e.openConnectModal),o=i(e=>e.identity),l=i(e=>e.openLoginModal),u=he(),[d,f]=(0,S.useState)([]),[p,m]=(0,S.useState)(null),[h,g]=(0,S.useState)(``),[v,Ee]=(0,S.useState)(``),[Oe,ke]=(0,S.useState)(``),[je,Ne]=ie(!1),[Fe,Ie]=(0,S.useState)(``),[Ue,T]=(0,S.useState)(!1),[E,ct]=(0,S.useState)(!1),[lt,A]=ie(!1),[ut,j]=(0,S.useState)(null),[M,dt]=(0,S.useState)(null),[ft,N]=(0,S.useState)(!1),[pt,mt]=(0,S.useState)(``),[ht,gt]=(0,S.useState)(!1),[_t,vt]=(0,S.useState)(null),[yt,bt]=(0,S.useState)(!1),[P,F]=(0,S.useState)({}),[I,L]=(0,S.useState)(null),[xt,R]=(0,S.useState)([]),[St,Ct]=(0,S.useState)(!1),[wt,Tt]=(0,S.useState)(!1),[Et,Dt]=(0,S.useState)(!1),[Ot,z]=(0,S.useState)({}),B=o?.identity===`user`,kt=B&&!Et?o.logo:``,At=(0,S.useRef)(null),jt=(0,S.useRef)(null),Mt=(0,S.useRef)(``),V=(0,S.useRef)(null),H=(0,S.useRef)(!1),Nt=(0,S.useRef)(0),U=(0,S.useRef)(new Map),W=(0,S.useRef)(new Set),G=n===!0,{t:K,compareStrings:Pt,formatDate:Ft,formatTime:It}=_(),q=(0,S.useCallback)(async(e,t)=>{r(await ve(e,t),`error`)},[r]),J=(0,S.useMemo)(()=>We(o?.address),[o?.address]),Lt=(0,S.useCallback)((e,t=Date.now())=>{e&&z(n=>{let r=qe(n,e,t);return r.changed?(Ke(J,r.value),r.value):n})},[J]),Y=(0,S.useCallback)(()=>{if(H.current||typeof window>`u`)return;let e=st();if(e)try{let t=V.current||new e;V.current=t,t.state===`suspended`&&t.resume().catch(()=>{}),H.current=!0}catch{}},[]),Rt=(0,S.useCallback)(()=>{if(!H.current)return;let e=Date.now();if(e-Nt.current<nt)return;Nt.current=e;let t=st();if(t)try{let e=V.current||new t;if(V.current=e,e.state===`suspended`){e.resume().catch(()=>{});return}let n=e.createGain();n.gain.setValueAtTime(1e-4,e.currentTime),n.gain.exponentialRampToValueAtTime(.08,e.currentTime+.015),n.gain.exponentialRampToValueAtTime(1e-4,e.currentTime+.18),n.connect(e.destination),[740,980].forEach((t,r)=>{let i=e.createOscillator();i.type=`sine`,i.frequency.setValueAtTime(t,e.currentTime),i.connect(n),i.start(e.currentTime+r*.035),i.stop(e.currentTime+.16+r*.035)})}catch{}},[]),X=(0,S.useCallback)(async(e=D(p))=>{if(!e||!G||!o){R([]);return}Ct(!0);try{R(await x.getChannelMembers(e))}catch(e){R([]),await q(e,K(`chat.error.members`))}finally{Ct(!1)}},[p,G,q,K,o]);function zt(e,t){switch(e){case`channel:message`:{let e=t?.channelKey||t?.channel,n=t?.message,r=Number(n?.timestamp)||Date.now();if(e){f(t=>t.map(t=>D(t)===e?{...t,lastMessageAt:new Date(r).toISOString()}:t));let t=e===Mt.current;z(i=>{let a=Ye(i,{channelName:e,messageTime:r,activeChannelName:t?e:``,messageAuthor:n?.author,userAddress:o?.address});return a.changed&&Ke(J,a.value),a.notify&&Rt(),a.changed?a.value:i})}break}case`channel:peer:online`:case`channel:peer:offline`:p&&x.getChannelPeers(D(p)).catch(e=>{console.warn(`[Chat] Failed to fetch peers on event:`,e.message)});break;case`channel:joined`:case`channel:left`:$(),X();break;case`user:metadata:updated`:t?.scope===`channels`&&($(),X(Mt.current));break;case`download:success`:{let e=U.current.get(t.taskId);e&&(U.current.delete(t.taskId),W.current.delete(e.cid),F(t=>({...t,[e.cid]:{status:`available`}})),r(K(`chat.attachment.downloadCompleted`,{fileName:t.fileName||Me(e.fileName)}),`success`),Kt(e,t.fileName||e.fileName));break}case`download:error`:case`download:cancelled`:{let n=U.current.get(t.taskId);n&&(U.current.delete(t.taskId),W.current.delete(n.cid),F(r=>({...r,[n.cid]:{status:`error`,message:e===`download:cancelled`?K(`chat.attachment.downloadCancelled`):t.error||K(`chat.attachment.downloadFailed`)}})),r(e===`download:cancelled`?K(`chat.attachment.downloadCancelled`):t.error||K(`chat.attachment.downloadFailed`),`error`));break}}}let Bt=(0,S.useMemo)(()=>d.map(e=>D(e)),[d]),{clearMessages:Vt,messages:Ht,sendMessage:Ut,syncMessages:Wt}=we({isReady:G,enabled:!!o,channelName:D(p),extraSubscribedChannelNames:Bt,peerId:Fe,waitForPeerId:!0,onSyncError:e=>q(e,K(`chat.error.messages`)),onSocketEvent:zt,onReconnect:$});function Z(){return G?!0:(a(),!1)}function Q(){return o?!0:(l(),!1)}(0,S.useEffect)(()=>{let e=()=>{g(new URLSearchParams(window.location.search).get(`channel`)||``)};return e(),window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,S.useEffect)(()=>{o&&g(new URLSearchParams(window.location.search).get(`channel`)||``)},[o?.address]),(0,S.useEffect)(()=>{Dt(!1)},[o?.logo]),(0,S.useEffect)(()=>{Mt.current=D(p)},[p]),(0,S.useEffect)(()=>{z(Ge(J))},[J]),(0,S.useEffect)(()=>{!J||d.length===0||z(e=>{let t=Je(e,d);return t.changed&&Ke(J,t.value),t.changed?t.value:e})},[J,d]),(0,S.useEffect)(()=>(window.addEventListener(`pointerdown`,Y,{passive:!0}),window.addEventListener(`keydown`,Y),()=>{window.removeEventListener(`pointerdown`,Y),window.removeEventListener(`keydown`,Y)}),[Y]),(0,S.useEffect)(()=>()=>{V.current?.close().catch(()=>{}),V.current=null,H.current=!1},[]),(0,S.useEffect)(()=>{At.current?.scrollIntoView({behavior:`smooth`})},[Ht]),(0,S.useEffect)(()=>{if(!G){Ie(``);return}pe.get(`/api/node-id`).json().then(e=>Ie(e.id)).catch(e=>{console.warn(`[Chat] Failed to fetch node ID:`,e.message),q(e,K(`chat.error.nodeId`))})},[G,q,K]),(0,S.useEffect)(()=>{G&&o&&$()},[n,G,o?.address]),(0,S.useEffect)(()=>{if(p&&G){let e=D(p);Wt(e,{replace:!0}),x.getChannelPeers(e).catch(()=>{}),X(e)}},[p,n,G,X,Wt]),(0,S.useEffect)(()=>{!ft||!p||X(D(p))},[p,X,ft]),(0,S.useEffect)(()=>{if(h&&d.length>0){let e=d.find(e=>D(e)===h)||d.find(e=>O(e)===h);e&&(!p||D(p)!==D(e))?Xt(e):e&&p&&D(p)===D(e)&&(p.createdAt!==e.createdAt||p.coreKey!==e.coreKey||p.lastMessageAt!==e.lastMessageAt||p.pinned!==e.pinned||p.remark!==e.remark||p.type!==e.type)&&m(e)}},[d,p,h]),(0,S.useEffect)(()=>{o||(f([]),m(null),g(``),dt(null),Vt(),ke(``),Ie(``),N(!1),vt(null),R([]),F({}),z({}),W.current.clear(),U.current.clear())},[Vt,o?.address]);function Gt(e){return e.length<Ze?K(`chat.validation.nameMin`,{count:Ze}):e.length>Qe?K(`chat.validation.nameMax`,{count:Qe}):e.includes(`.`)?K(`chat.validation.dotReserved`):$e.test(e)?``:K(`chat.validation.allowedChars`)}async function $(){if(G)try{f(await x.getChannels())}catch(e){f([]),await q(e,K(`chat.error.channelList`))}}function Kt(e,t=e.fileName){let n=ee(t);vt({cid:e.cid,fileName:t,subtype:n===`file`?e.kind:n})}async function qt(e){let t=xe(e.link,K);if(t)return F(n=>({...n,[e.cid]:{status:`error`,message:t}})),!1;try{F(t=>({...t,[e.cid]:{status:`checking`}}));let t=await b.checkDownload(e.link,{timeout:et,requestTimeout:tt});return F(n=>({...n,[e.cid]:{status:`available`,message:t.alreadyExists?K(`chat.attachment.localAvailable`):K(`chat.attachment.previewAvailable`)}})),!0}catch(t){let n=await be(t);return F(t=>({...t,[e.cid]:{status:`error`,message:n}})),!1}}async function Jt(e){L(null),await qt(e)&&await Yt(e)}async function Yt(e){if(!W.current.has(e.cid)){W.current.add(e.cid),F(t=>({...t,[e.cid]:{status:`available`}}));try{let t=await b.downloadFile(e.link);if(t.alreadyExists||t.fileName){W.current.delete(e.cid),F(t=>({...t,[e.cid]:{status:`available`}})),Kt({...e,fileName:t.fileName||e.fileName},t.fileName||e.fileName);return}t.taskId&&(U.current.set(t.taskId,e),r(K(`chat.attachment.downloadStarted`),`success`))}catch(t){let n=await be(t);W.current.delete(e.cid),F(t=>({...t,[e.cid]:{status:`error`,message:n}}))}}}async function Xt(e){if(!Q()||!Z())return;let t=D(e);Lt(t,Math.max(w(e),Date.now())),m(e),g(t),window.history.pushState({},``,`?channel=${encodeURIComponent(t)}`)}async function Zt(e,t){if(t&&t.stopPropagation(),Q()&&Z()&&!E){ct(!0);try{if(await x.leaveChannel(e),D(p)===e){m(null),g(``),Vt();let e=new URL(window.location.href);e.searchParams.delete(`channel`),window.history.pushState({},``,e.pathname)}$(),A.close(),j(null)}catch(e){await q(e,K(`chat.error.leave`))}finally{ct(!1)}}}async function Qt(e){if(!Q()||!Z())return;let t=!e.pinned,n=D(e);try{let e=await x.setChannelPinned(n,t);f(t=>t.map(t=>D(t)===n?{...t,pinned:e.pinned}:t)),m(t=>t&&D(t)===n?{...t,pinned:e.pinned}:t)}catch(e){await q(e,K(t?`chat.error.pin`:`chat.error.unpin`))}}async function $t(e){let t=e.trim();if(!t||Ue)return;let n=Gt(t);if(n){r(n,`error`);return}if(Q()&&Z()){T(!0);try{let e=await x.createChannel(t,`public`,Ce(o)),n=e.channelKey||e.key||e.name||t,r=d.find(e=>D(e)===n),i={...r,name:e.name||t,channelId:e.channelId||e.name||t,channelKey:e.channelKey||e.key||r?.channelKey,type:e.type||r?.type||`public`,createdAt:e.createdAt||r?.createdAt,coreKey:e.coreKey||e.key||r?.coreKey,localWriterCoreKey:e.localWriterCoreKey||r?.localWriterCoreKey,writerCoreKeys:e.writerCoreKeys||r?.writerCoreKeys,remark:e.remark||r?.remark},a=D(i);f(e=>e.some(e=>D(e)===a)?e.map(e=>D(e)===a?{...e,...i}:e):[...e,i]),Ne.close(),await Xt(i),X(a),$()}catch(e){await q(e,K(`chat.error.join`))}finally{T(!1)}}}async function en(e,t){if(!e.trim()||!p||!Q()||!Z())return!1;let n=e.trim(),r=D(p);try{let e=await Ut({channelName:r,content:n,attachment:t});return f(t=>t.map(t=>D(t)===r?{...t,lastMessageAt:new Date(Number(e?.timestamp)||Date.now()).toISOString()}:t)),e&&Lt(r,Number(e.timestamp)||Date.now()),X(r),!0}catch(e){return await q(e,K(`chat.error.send`)),!1}}async function tn(){if(!Oe.trim())return;let e=Oe.trim();ke(``),await en(e)}function nn(e,t){return`${rt}/${e}/${t}`}async function rn(e){if(!(!e||e.length===0||!p)&&Q()&&Z()&&!yt){bt(!0);try{for(let t of Array.from(e)){let e=nn(O(p),t.name),n=await b.publishFile(t,e),i=n.fileName||e,a=n.link||`most://${n.cid}?filename=${encodeURIComponent(i)}`;await en(a,{kind:it(t,i),cid:n.cid,fileName:i,link:a,mimeType:t.type||void 0,size:t.size})&&r(K(`chat.attachment.published`,{fileName:Me(i)}),`success`)}}catch(e){await q(e,K(`chat.error.attachmentSend`))}finally{bt(!1)}}}async function an(e){if(!Q()||!Z())return;let t=P[e.cid];if(t?.status!==`checking`){if(t?.status===`error`){L(e);return}if(t?.status!==`available`){await qt(e)&&await Yt(e);return}await Yt(e)}}async function on(e,t){if(!Q()||!Z())return;let n=D(e),r=await x.setChannelRemark(n,t);return f(e=>e.map(e=>D(e)===n?{...e,remark:r.remark}:e)),m(e=>e&&D(e)===n?{...e,remark:r.remark}:e),r.remark}async function sn(){if(p)try{await on(p,pt)}catch(e){await q(e,K(`chat.error.remark`))}}async function cn(e){if(!(!M||ht)){gt(!0);try{await on(M,e),dt(null)}catch(e){await q(e,K(`chat.error.rename`))}finally{gt(!1)}}}function ln(e){if(!e.attachment)return(0,C.jsx)(Le,{children:e.content});let t=e.attachment,n=P[t.cid]?.status;return(0,C.jsx)(Re,{children:(0,C.jsx)(Pe,{attachment:t,status:n,pending:e.pending,onOpen:an})})}function un(e,t){let n=String(e||``).trim();return n?wt?ot(n)?n:t?`${n}#${t.slice(-4).toUpperCase()}`:n:n.replace(/#[a-fA-F0-9]{4}$/,``):at(t)}function dn(){return(0,C.jsx)(Ve,{isLoading:St,members:xt.map(e=>({id:e.address,name:un(e.displayName,e.address),avatarSrc:me(e.address,e.avatar)}))})}let fn=B&&!!h&&!p,pn=p?(0,C.jsx)(`h2`,{className:`header-title`,translate:`no`,children:k(p)}):(0,C.jsx)(`h2`,{className:`header-title`,children:K(`chat.title`)}),mn=v.trim().toLowerCase(),hn=(0,S.useMemo)(()=>[...d].sort((e,t)=>{let n=Number(!!t.pinned)-Number(!!e.pinned);if(n!==0)return n;let r=w(t)-w(e);return r===0?Pt(k(e),k(t)):r}),[d,Pt]),gn=mn?hn.filter(e=>[k(e),O(e),D(e)].some(e=>e.toLowerCase().includes(mn))):hn;return(0,C.jsxs)(ae,{className:`chat-app-layout`,defaultHide:B,sidebar:({closeSidebar:e})=>(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`button`,{type:`button`,className:`sidebar-header sidebar-header-link`,onClick:u,children:[(0,C.jsx)(de,{size:18}),(0,C.jsx)(`h1`,{children:`MOST PEOPLE`})]}),(0,C.jsx)(`div`,{className:`chat-channel-search`,children:(0,C.jsxs)(`div`,{className:`ui-input-control`,children:[(0,C.jsx)(le,{className:`ui-input-icon`,size:15}),(0,C.jsx)(`input`,{type:`search`,className:`input input-compact`,placeholder:K(`chat.search.placeholder`),value:v,onChange:e=>Ee(e.target.value),"aria-label":K(`chat.search.placeholder`)})]})}),(0,C.jsx)(`nav`,{className:`sidebar-nav`,children:d.length===0?(0,C.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,C.jsx)(`p`,{children:K(`chat.empty.noChannels`)})}):gn.length===0?(0,C.jsx)(`div`,{className:`sidebar-empty-state`,children:(0,C.jsx)(`p`,{children:K(`chat.empty.noMatches`)})}):gn.map(t=>(0,C.jsx)(Be,{active:D(p)===D(t),pinned:!!t.pinned,unread:Xe(t,Ot),title:k(t),onSelect:()=>{Xt(t),e()},onTogglePin:()=>void Qt(t),onRename:()=>dt(t),onLeave:()=>{j(t),A.open()}},D(t)))}),(0,C.jsxs)(`button`,{className:`ui-action-dashed create-channel-btn`,onClick:()=>{!Q()||!Z()||Ne.open()},children:[(0,C.jsx)(ce,{size:16}),K(`chat.joinChannel`)]}),(0,C.jsx)(ye,{})]}),headerTitle:pn,sidebarToggleReplacement:B?(0,C.jsx)(`span`,{className:`sidebar-toggle-static-logo`,"aria-hidden":`true`,children:kt?(0,C.jsx)(`img`,{className:`sidebar-toggle-static-logo-img`,src:kt,alt:``,onError:()=>Dt(!0)}):(0,C.jsx)(Se,{size:18})}):void 0,headerRight:(0,C.jsxs)(`div`,{className:`header-right-actions`,children:[(0,C.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>t(!e),title:K(`common.theme.toggle`),children:e?(0,C.jsx)(c,{size:16}):(0,C.jsx)(s,{size:16})}),p&&(0,C.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>N(!0),title:K(`chat.channelSettings`),children:(0,C.jsx)(Ae,{size:16})})]}),children:[p?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`chat-messages`,children:[Ht.length===0?(0,C.jsxs)(`div`,{className:`ui-empty-state chat-messages-empty`,children:[(0,C.jsx)(`div`,{className:`ui-empty-icon empty-icon`,children:(0,C.jsx)(oe,{size:28})}),(0,C.jsx)(`p`,{children:K(`chat.empty.noMessages`)})]}):Ht.map(e=>{let t=e.author?.toLowerCase()===o?.address.toLowerCase();return(0,C.jsx)(ze,{variant:t?`self`:`other`,pending:e.pending,avatarSrc:me(e.author,e.avatar||(t?o.avatar:void 0)),author:un(e.authorName,e.author),time:It(e.timestamp),children:ln(e)},e.id||`${e.author}-${e.timestamp}`)}),(0,C.jsx)(`div`,{ref:At})]}),(0,C.jsx)(He,{message:Oe,placeholder:K(o?`chat.composer.placeholder`:`chat.composer.signInPlaceholder`),disabled:!o,isPublishingAttachment:yt,attachmentInputRef:jt,onMessageChange:ke,onSend:tn,onSelectAttachmentFiles:e=>{rn(e)}})]}):fn?(0,C.jsxs)(`div`,{className:`ui-empty-state chat-welcome`,children:[(0,C.jsx)(`div`,{className:`ui-empty-icon ui-empty-icon-lg welcome-icon`,children:(0,C.jsx)(re,{size:36,className:`ui-spinner`})}),(0,C.jsx)(`h2`,{className:`ui-empty-title`,children:K(`chat.restoring.title`)}),(0,C.jsx)(`p`,{className:`ui-empty-desc`,children:K(`chat.restoring.desc`)})]}):(0,C.jsx)(C.Fragment,{children:(0,C.jsxs)(`div`,{className:`ui-empty-state chat-welcome`,children:[(0,C.jsx)(`div`,{className:`ui-empty-icon ui-empty-icon-lg welcome-icon`,children:(0,C.jsx)(oe,{size:36})}),(0,C.jsx)(`h2`,{className:`ui-empty-title`,children:K(`chat.select.title`)}),(0,C.jsx)(`p`,{className:`ui-empty-desc`,children:K(`chat.select.desc`)}),(0,C.jsx)(se,{label:K(`chat.openChannelList`)})]})}),je&&(0,C.jsx)(ge,{title:K(`chat.joinChannel`),placeholder:K(`chat.join.placeholder`),confirmText:K(`chat.join.confirm`),validate:Gt,onConfirm:$t,onClose:()=>Ne.close(),isLoading:Ue,loadingText:K(`chat.join.joining`)}),M&&(0,C.jsx)(ge,{title:K(`chat.renameChannel`),placeholder:K(`chat.remark.placeholder`),defaultValue:M.remark||``,confirmText:K(`chat.remark.save`),onConfirm:cn,onClose:()=>{ht||dt(null)},isLoading:ht,loadingText:K(`chat.remark.saving`),allowEmpty:!0,validate:e=>e.length>50?K(`chat.remark.tooLong`):``}),lt&&ut&&(0,C.jsx)(_e,{title:K(`chat.leaveChannel`),message:K(`chat.leaveConfirm`,{channel:k(ut)}),confirmText:K(E?`chat.leaving`:`chat.leaveChannel`),onConfirm:()=>Zt(D(ut),void 0),danger:!0,onClose:()=>{A.close(),j(null)}}),I&&(0,C.jsx)(fe,{onClose:()=>L(null),children:(0,C.jsxs)(`div`,{className:`confirm-modal`,onClick:e=>e.stopPropagation(),children:[(0,C.jsxs)(`div`,{className:`modal-header`,children:[(0,C.jsx)(`h3`,{children:K(`chat.attachment.noSeedsTitle`)}),(0,C.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>L(null),"aria-label":K(`common.close`),children:(0,C.jsx)(ue,{size:18})})]}),(0,C.jsx)(`p`,{children:P[I.cid]?.message||K(`chat.attachment.noSeedsFallback`)}),(0,C.jsxs)(`div`,{className:`modal-actions`,children:[(0,C.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:()=>L(null),children:K(`common.cancel`)}),(0,C.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>Jt(I),disabled:P[I.cid]?.status===`checking`,children:P[I.cid]?.status===`checking`?K(`app.checking`):K(`chat.attachment.retryCheck`)})]})]})}),_t&&(0,C.jsx)(ne,{item:_t,isBackendReady:G,getFileDownloadUrl:b.getFileDownloadUrl,onClose:()=>vt(null)}),ft&&p&&(0,C.jsx)(`div`,{className:`channel-detail-overlay`,onClick:()=>N(!1),children:(0,C.jsxs)(`div`,{className:`channel-detail-drawer`,onClick:e=>e.stopPropagation(),children:[(0,C.jsxs)(`div`,{className:`channel-detail-header`,children:[(0,C.jsx)(`h3`,{children:K(`chat.details.title`)}),(0,C.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>N(!1),children:(0,C.jsx)(ue,{size:18})})]}),(0,C.jsxs)(`div`,{className:`channel-detail-body`,children:[(0,C.jsxs)(`div`,{className:`channel-detail-section channel-members-section`,children:[(0,C.jsx)(`div`,{className:`channel-detail-label`,children:(0,C.jsx)(`span`,{children:K(`chat.details.members`,{count:xt.length})})}),dn()]}),!B&&(0,C.jsx)(`div`,{className:`channel-detail-section`,children:(0,C.jsxs)(`label`,{className:`setting-switch`,children:[(0,C.jsx)(`span`,{children:K(`chat.details.showAddressSuffix`)}),(0,C.jsx)(`input`,{type:`checkbox`,checked:wt,onChange:e=>Tt(e.target.checked)})]})}),!B&&(0,C.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,C.jsxs)(`div`,{className:`channel-detail-label`,children:[(0,C.jsx)(De,{size:14}),(0,C.jsx)(`span`,{children:K(`chat.details.channelId`)})]}),(0,C.jsx)(`div`,{className:`ui-meta-box channel-detail-value channel-detail-mono`,translate:`no`,children:O(p)})]}),(0,C.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,C.jsxs)(`div`,{className:`channel-detail-label`,children:[(0,C.jsx)(te,{size:14}),(0,C.jsx)(`span`,{children:K(`chat.remark.placeholder`)})]}),(0,C.jsx)(`input`,{type:`text`,className:`input input-compact`,placeholder:K(`chat.remark.placeholder`),value:pt,onChange:e=>mt(e.target.value),onFocus:()=>mt(p.remark||``),onBlur:()=>sn(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},maxLength:50})]}),(0,C.jsxs)(`div`,{className:`channel-detail-section`,children:[(0,C.jsxs)(`div`,{className:`channel-detail-label`,children:[(0,C.jsx)(Te,{size:14}),(0,C.jsx)(`span`,{children:K(`chat.channel.createdAt`)})]}),(0,C.jsx)(`div`,{className:`ui-meta-box channel-detail-value`,children:p.createdAt?Ft(p.createdAt):`-`})]})]}),!B&&(0,C.jsx)(`div`,{className:`channel-detail-footer`,children:(0,C.jsx)(`button`,{className:`btn btn-secondary btn-block`,onClick:()=>{N(!1),j(p),A.open()},children:K(`chat.leaveChannel`)})})]})})]})}var lt=a(`/chat/`)({component:ct});export{lt as Route};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{n as r,t as i,v as a}from"./userStore-q0BBZsIV.js";import{a as o,i as s,r as c}from"./LanguageToggle-HAJ3D6Ne.js";import{t as l}from"./circle-alert-CofRTRHr.js";import{t as u}from"./key-round-BpSdpOHi.js";import{t as d}from"./AppShell-oF8wPXde.js";import{C as f,F as p,I as m,L as h,R as g,V as _,_ as v,g as y,k as b,m as x,w as S}from"./index--p9MKNEl.js";import{i as C,t as w}from"./userProfile-oeBvU6ch.js";var T=t(e(),1),E=[{name:`node_url`,required:!1,descriptionKey:`chatJoin.field.nodeUrl`},{name:`node_invite`,required:!1,descriptionKey:`chatJoin.field.nodeInvite`},{name:`uid`,required:!0,descriptionKey:`chatJoin.field.uid`},{name:`identity`,required:!1,descriptionKey:`chatJoin.field.identity`},{name:`logo`,required:!1,descriptionKey:`chatJoin.field.logo`},{name:`avatar`,required:!1,descriptionKey:`chatJoin.field.avatar`},{name:`name`,required:!1,descriptionKey:`chatJoin.field.name`},{name:`locale`,required:!1,descriptionKey:`chatJoin.field.locale`},{name:`channels[].id`,required:!0,descriptionKey:`chatJoin.field.channelId`},{name:`channels[].name`,required:!1,descriptionKey:`chatJoin.field.channelName`}];function D(e){let t=typeof e==`string`?e.trim():e;return m(t)?t:void 0}var O=`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`,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="%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`,A=Object.freeze({id:`chatjoin_support`,name:`User / Service 测试频道`}),j=Object.freeze([Object.freeze({uid:`user`,identity:`user`,name:`测试用户`,avatar:O}),Object.freeze({uid:`service`,identity:`service`,name:`测试客服`,avatar:k})]),M=Object.freeze(j.map(e=>Object.freeze({locale:`zh-CN`,uid:e.uid,identity:e.identity,avatar:e.avatar,name:e.name,channels:[A]})));function N(e){let t=String(e||``).trim();return M.find(e=>e.uid===t)||null}function P(e){return JSON.stringify(e,null,2)}var F=n(),I=`0x955fe80bdb8312165471fcacd6a8f83df88a770dda6f38657ca4e62ec28d5b54`,L=50,R=`https://api.most.box`;function z(e){try{return JSON.parse(e)}catch{return null}}function B(e){return typeof e==`string`?z(e):e}function V(e,t){return t===null?e:JSON.stringify(t,null,2)}function H(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 U(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function W(e){return typeof e==`string`?e.trim():``}function G(e){let t=W(e);return t===`user`||t===`service`||t===`service_ai`?t:void 0}function K(e){let t=B(e);if(!U(t))return null;let n=W(t.uid),r=(Array.isArray(t.channels)?t.channels:[]).filter(U).map(e=>({id:W(e.id),name:W(e.name)||void 0})).filter(e=>e.id);return!n||r.length===0?null:{node_url:W(t.node_url)||void 0,node_invite:W(t.node_invite)||void 0,locale:D(t.locale),uid:n,identity:G(t.identity),logo:W(t.logo)||void 0,avatar:W(t.avatar)||void 0,name:W(t.name)||void 0,channels:r}}function q(e){return`/chat?channel=${encodeURIComponent(e)}`}function J(e){return String(e||``).trim().slice(0,L)}function Y(e){return e.trim().replace(/\/+$/,``)}function X(){let{t:e,setLocale:t}=g(),n=_({select:e=>e.searchStr}),{token:a,pub:m,fixture:D}=(0,T.useMemo)(()=>{let e=new URLSearchParams(n);return{token:e.get(`token`)||``,pub:e.get(`pub`)||``,fixture:e.get(`fixture`)||``}},[n]),O=x(e=>e.isDarkMode),k=x(e=>e.setIsDarkMode),A=x(e=>e.hasBackend),j=i(e=>e.setUserIdentity),M=b(),[L,B]=(0,T.useState)(``),[U,W]=(0,T.useState)(``),[G,X]=(0,T.useState)(!0),[Z,Q]=(0,T.useState)(``),$=(0,T.useRef)(``);return(0,T.useEffect)(()=>{let n=N(D);if(D&&!n){W(e(`chatJoin.error.unknownFixture`,{fixture:D})),X(!1);return}if(!n&&!a){W(e(`chatJoin.error.missingToken`)),X(!1);return}if(!n&&!m){W(e(`chatJoin.error.missingPub`)),X(!1);return}if(A===null){Q(e(`chatJoin.status.checkingBackend`));return}let i=n?`fixture:${D}`:`${a}:${m}`;if($.current===i)return;$.current=i;async function o(n){let i=(t,r)=>n.locale?h(t,n.locale,r):e(t,r);n.locale&&t(n.locale);let a=S(),o=f(),s=!!a&&A===!0&&Y(o)===Y(a);if(n.node_url&&!s){if(Q(i(`chatJoin.status.connectingRemote`)),!(await y({url:n.node_url,invite:n.node_invite||``})).ok)throw Error(i(`chatJoin.error.remoteConnectFailed`));v({url:n.node_url,invite:n.node_invite||``}),x.setState({hasBackend:!0})}else if(!A)throw Error(i(`chatJoin.error.noBackend`));Q(i(`chatJoin.status.signingIn`));let c=r(n.uid,``),l={...c,identity:n.identity,displayName:n.name||c.displayName,logo:n.logo,avatar:n.avatar};j(l),Q(i(`chatJoin.status.joiningChannel`));let u=``;for(let e of n.channels){let t=await C.createChannel(e.id,`public`,w(l)),n=t.channelKey||t.key||e.id;u||=n;let r=J(e.name);r&&await C.setChannelRemark(n,r)}let d=n.channels[0];Q(i(`chatJoin.status.openingChannel`)),window.location.href=q(u||d.id)}async function s(){try{if(n){Q(e(`chatJoin.status.loadingFixture`,{name:n.name||D})),B(P(n)),await o(n);return}Q(e(`chatJoin.status.decryptingInvite`));let t=await fetch(`${R}/api/chat.join.decrypt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:a,pub:m})}),r=await t.text(),i=z(r);if(!t.ok)W(H(r,i,e(`chatJoin.error.decrypt`)));else{B(V(r,i));let t=K(i);if(!t){W(e(`chatJoin.error.invalidInvite`));return}await o(t)}}catch(t){W(e(`chatJoin.error.request`,{message:t instanceof Error?t.message:String(t)}))}finally{X(!1)}}s()},[D,A,m,t,j,e,a]),(0,F.jsx)(d,{sidebar:()=>(0,F.jsxs)(`button`,{type:`button`,className:`sidebar-header sidebar-header-link`,onClick:M,children:[(0,F.jsx)(p,{size:18}),(0,F.jsx)(`h1`,{children:`MOST PEOPLE`})]}),headerTitle:(0,F.jsx)(`h2`,{className:`header-title`,children:e(`chatJoin.title`)}),headerRight:(0,F.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>k(!O),title:e(`common.theme.toggle`),children:O?(0,F.jsx)(c,{size:16}):(0,F.jsx)(s,{size:16})}),children:(0,F.jsx)(`div`,{className:`chat-join-container`,children:(0,F.jsxs)(`div`,{className:`chat-join-panel`,children:[G?(0,F.jsxs)(`div`,{className:`chat-join-loading`,children:[(0,F.jsx)(u,{size:32}),(0,F.jsx)(`p`,{children:Z||e(`chatJoin.status.decrypting`)})]}):U?(0,F.jsxs)(`div`,{className:`chat-join-error`,children:[(0,F.jsx)(l,{size:32}),(0,F.jsx)(`p`,{children:U}),Z&&(0,F.jsx)(`p`,{className:`chat-join-status`,children:Z}),L&&(0,F.jsx)(`pre`,{className:`chat-join-result`,translate:`no`,children:L})]}):(0,F.jsxs)(`div`,{className:`chat-join-success`,children:[(0,F.jsx)(o,{size:32}),(0,F.jsx)(`p`,{children:Z||e(`chatJoin.status.decryptSuccess`)}),(0,F.jsx)(`pre`,{className:`chat-join-result`,translate:`no`,children:L})]}),(0,F.jsxs)(`section`,{className:`chat-join-spec`,"aria-labelledby":`chat-join-spec-title`,children:[(0,F.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,F.jsx)(u,{size:18}),(0,F.jsx)(`h3`,{id:`chat-join-spec-title`,children:e(`chatJoin.specTitle`)})]}),(0,F.jsx)(`div`,{className:`chat-join-field-list`,children:E.map(t=>(0,F.jsxs)(`div`,{className:`chat-join-field`,children:[(0,F.jsxs)(`div`,{className:`chat-join-field-meta`,children:[(0,F.jsx)(`code`,{className:`chat-join-field-name`,children:t.name}),(0,F.jsx)(`span`,{children:t.required?e(`chatJoin.field.required`):e(`chatJoin.field.optional`)})]}),(0,F.jsx)(`p`,{children:e(t.descriptionKey)})]},t.name))})]}),(0,F.jsxs)(`section`,{className:`chat-join-helper`,"aria-labelledby":`ea-test-title`,children:[(0,F.jsxs)(`div`,{className:`chat-join-helper-title`,children:[(0,F.jsx)(u,{size:18}),(0,F.jsx)(`h3`,{id:`ea-test-title`,children:e(`chatJoin.testPublicKey`)})]}),(0,F.jsx)(`code`,{className:`ui-code-box chat-join-public-key`,translate:`no`,children:I}),(0,F.jsx)(`a`,{className:`btn`,href:`/web3/#EA`,target:`_blank`,children:e(`chatJoin.openWeb3`)})]})]})})})}function Z(){return(0,F.jsx)(T.Suspense,{children:(0,F.jsx)(X,{})})}var Q=a(`/chat/join/`)({component:Z});export{Q as Route};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{b as r,g as i,t as a,v as o,x as ee}from"./userStore-q0BBZsIV.js";import{t as s}from"./download-Bhqn6hL1.js";import{t as te}from"./external-link-CNR21yFA.js";import{t as c}from"./file-text-CFfvvCnM.js";import{t as ne}from"./hard-drive-4vHpA5kz.js";import{t as re}from"./refresh-cw--JB8k6mH.js";import{t as l}from"./triangle-alert-CO_5uXy2.js";import{P as u,R as d,S as ie,V as ae,m as f,v as oe}from"./index--p9MKNEl.js";import{t as p}from"./format-CR8oUWq6.js";import{i as se,n as m,r as h,t as g}from"./downloadValidation-eInMiVSX.js";var ce=i(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),_=i(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),v=i(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),y=i(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),b=t(e(),1),x=n(),le=1800;function S(e,t){return`most://${e}${t||``}`}function C(e,t){let n=e.trim().replace(/[\\/]+$/,``);return n?`${n}${n.includes(`\\`)?`\\`:`/`}downloads`:t}function w(e,t){let n=e[t];return typeof n==`string`?n:void 0}function T(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function ue(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`)return null;let n=t,r=w(n,`event`),i=n.data;if(!r||!i||typeof i!=`object`)return null;let a=i;return{event:r,payload:{taskId:w(a,`taskId`),percent:T(a,`percent`),loaded:T(a,`loaded`),total:T(a,`total`),file:w(a,`file`),fileName:w(a,`fileName`),error:w(a,`error`)}}}function E(){let{t:e}=d(),{cid:t}=ee({from:`/cid/$cid/`}),n=ae({select:e=>e.searchStr}),i=f(e=>e.hasBackend),o=f(e=>e.addToast),u=f(e=>e.openConnectModal),w=a(e=>e.identity),T=a(e=>e.openLoginModal),E=(0,b.useMemo)(()=>S(t,n),[t,n]),k=(0,b.useMemo)(()=>se(E),[E]),A=(0,b.useMemo)(()=>g(E,e),[E,e]),de=k.fileName||t,[j,M]=(0,b.useState)({status:`idle`,message:``}),[N,P]=(0,b.useState)(null),[F,I]=(0,b.useState)({status:`idle`,message:``}),[L,R]=(0,b.useState)(``),[z,B]=(0,b.useState)(0),[V,H]=(0,b.useState)(null),[U,W]=(0,b.useState)(null),[fe,G]=(0,b.useState)(``),[pe,K]=(0,b.useState)(!1),q=(0,b.useRef)(0),J=(0,b.useRef)(null),Y=N?.fileName||de,X=N?.size??U,Z=j.status===`available`||j.status===`already-local`,Q=F.status===`starting`||F.status===`downloading`,me=C(fe,e(`cid.saveToFallback`)),$=(0,b.useCallback)(async()=>{let t=q.current+1;if(q.current=t,R(``),B(0),H(null),W(null),I({status:`idle`,message:``}),A){P(null),M({status:`error`,message:A});return}if(i===null){P(null),M({status:`waiting-backend`,message:e(`cid.status.waitingBackend`)});return}if(i!==!0){P(null),M({status:`backend-missing`,message:e(`cid.status.backendMissing`)});return}if(!w){P(null),M({status:`login-required`,message:e(`cid.status.loginRequired`)});return}M({status:`checking`,message:e(`cid.status.checking`)}),P(null);try{let n=await m.checkDownload(E);if(q.current!==t)return;P(n),M({status:n.alreadyExists?`already-local`:`available`,message:n.alreadyExists?e(`cid.status.alreadyLocal`,{fileName:n.fileName}):e(`cid.status.available`,{fileName:n.fileName})})}catch(e){if(q.current!==t)return;M({status:`error`,message:await h(e)}),P(null)}},[i,E,e,w,A]);(0,b.useEffect)(()=>{document.title=e(`cid.meta.title`)},[e]),(0,b.useEffect)(()=>{let e=()=>{J.current!==null&&(window.clearTimeout(J.current),J.current=null)},t=()=>{document.visibilityState===`hidden`&&(e(),K(!1))};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`pagehide`,t),()=>{e(),document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`pagehide`,t)}},[]),(0,b.useEffect)(()=>{$()},[$]),(0,b.useEffect)(()=>{if(i!==!0)return;let e=!1;return m.getDataPath().then(t=>{e||G(t.dataPath)}).catch(()=>{e||G(``)}),()=>{e=!0}},[i]),(0,b.useEffect)(()=>{if(!L||!w)return;let t=null,n=!1;return(async()=>{if(t=new WebSocket(await ie(`/ws`)),n){t.close();return}t.onmessage=t=>{let n=ue(t.data);!n||n.payload.taskId!==L||(n.event===`download:progress`&&(B(n.payload.percent||0),H(n.payload.loaded??null),W(n.payload.total??null)),n.event===`download:status`&&I({status:`downloading`,message:n.payload.file?e(`cid.status.downloadingFile`,{fileName:n.payload.file}):e(`cid.status.downloading`)}),n.event===`download:success`&&(B(100),I({status:`completed`,message:e(`cid.status.downloadComplete`,{fileName:n.payload.fileName||Y})}),o(e(`cid.toast.downloadComplete`),`success`)),n.event===`download:error`&&(I({status:`error`,message:n.payload.error||e(`cid.status.downloadFailed`,{error:``})}),o(e(`cid.toast.downloadFailed`,{error:n.payload.error||e(`cid.errorFallback`)}),`error`)),n.event===`download:cancelled`&&(I({status:`cancelled`,message:e(`cid.status.cancelled`)}),o(e(`cid.toast.cancelled`),`warning`)))}})(),()=>{n=!0,t?.close()}},[o,Y,e,L,w]);let he=async()=>{if(!w){T();return}if(i!==!0){u();return}if(!(!Z||Q)){I({status:`starting`,message:e(`cid.status.startingDownload`)}),B(0);try{let t=await m.downloadFile(E);if(t.alreadyExists){I({status:`completed`,message:e(`cid.status.alreadyLocal`,{fileName:t.fileName||Y})}),o(e(`cid.toast.alreadyLocal`),`warning`);return}t.taskId&&(R(t.taskId),I({status:`downloading`,message:e(`cid.status.downloading`)}),o(e(`cid.toast.downloadStarted`),`info`))}catch(t){let n=await oe(t,e(`cid.status.downloadFailed`,{error:e(`cid.errorFallback`)}));I({status:`error`,message:n}),o(n,`error`)}}},ge=()=>{K(!1),J.current!==null&&window.clearTimeout(J.current),J.current=window.setTimeout(()=>{J.current=null,document.visibilityState!==`hidden`&&K(!0)},le)},_e=async()=>{L&&await m.cancelDownload(L).catch(()=>{})},ve=D(j.status,F.status);return(0,x.jsx)(`main`,{className:`cid-page`,children:(0,x.jsxs)(`section`,{className:`cid-shell`,children:[(0,x.jsxs)(`div`,{className:`cid-heading`,children:[(0,x.jsx)(`span`,{className:`cid-kicker`,children:e(`cid.kicker`)}),(0,x.jsx)(`h1`,{children:e(`cid.title`)}),(0,x.jsx)(`p`,{children:e(`cid.subtitle`)})]}),(0,x.jsxs)(`div`,{className:`cid-panel`,children:[(0,x.jsxs)(`div`,{className:`cid-handoff`,"aria-label":e(`cid.handoff.title`),children:[(0,x.jsxs)(`div`,{className:`cid-handoff-copy`,children:[(0,x.jsx)(`p`,{className:`cid-handoff-title`,children:e(`cid.handoff.title`)}),(0,x.jsx)(`p`,{children:e(`cid.handoff.desc`)})]}),(0,x.jsxs)(`a`,{className:`btn btn-primary`,href:E,onClick:ge,children:[(0,x.jsx)(te,{size:16}),e(`cid.handoff.action`)]})]}),pe&&(0,x.jsxs)(`div`,{className:`cid-handoff-fallback`,role:`status`,children:[(0,x.jsx)(l,{size:18}),(0,x.jsx)(`p`,{children:e(`cid.handoff.fallback`)}),(0,x.jsxs)(r,{to:`/download/`,className:`btn btn-secondary`,children:[(0,x.jsx)(s,{size:16}),e(`cid.handoff.downloadAction`)]})]}),(0,x.jsxs)(`div`,{className:`cid-status`,children:[(0,x.jsx)(`span`,{className:`cid-status-icon ${j.status}`,children:ve}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`p`,{className:`cid-status-label`,children:O(j.status,e)}),(0,x.jsx)(`p`,{className:`cid-status-message`,children:j.message})]})]}),(0,x.jsxs)(`dl`,{className:`cid-details`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`dt`,{children:[(0,x.jsx)(c,{size:16}),e(`cid.fileNameLabel`)]}),(0,x.jsx)(`dd`,{children:Y})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{children:e(`cid.cidLabel`)}),(0,x.jsx)(`dd`,{className:`cid-mono`,children:t})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`dt`,{children:e(`cid.sizeLabel`)}),(0,x.jsx)(`dd`,{children:X?p(X):e(`cid.unknownSize`)})]}),(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`dt`,{children:[(0,x.jsx)(ne,{size:16}),e(`cid.saveToLabel`)]}),(0,x.jsx)(`dd`,{children:me})]})]}),F.status!==`idle`&&(0,x.jsxs)(`div`,{className:`cid-download-state ${F.status}`,children:[(0,x.jsx)(`p`,{children:F.message}),(F.status===`starting`||F.status===`downloading`)&&(0,x.jsxs)(`div`,{className:`cid-progress`,children:[(0,x.jsx)(`progress`,{className:`cid-progress-bar`,value:z,max:100}),(0,x.jsx)(`span`,{children:V!==null&&U!==null?`${p(V)} / ${p(U)}`:`${z}%`})]})]}),(0,x.jsxs)(`div`,{className:`cid-actions`,children:[j.status===`login-required`&&(0,x.jsxs)(`button`,{className:`btn btn-primary`,onClick:T,children:[(0,x.jsx)(v,{size:16}),e(`cid.loginAction`)]}),j.status===`backend-missing`&&(0,x.jsxs)(`button`,{className:`btn btn-primary`,onClick:u,children:[(0,x.jsx)(y,{size:16}),e(`cid.connectAction`)]}),(0,x.jsxs)(`button`,{className:`btn btn-primary`,disabled:!Z||Q,onClick:he,children:[Q?(0,x.jsx)(_,{className:`cid-spin-icon`,size:16}):(0,x.jsx)(s,{size:16}),e(Q?`cid.downloadingAction`:`cid.startAction`)]}),L&&F.status===`downloading`&&(0,x.jsxs)(`button`,{className:`btn btn-secondary`,onClick:_e,children:[(0,x.jsx)(ce,{size:16}),e(`cid.cancelAction`)]}),(0,x.jsxs)(`button`,{className:`btn btn-secondary`,disabled:j.status===`checking`,onClick:$,children:[(0,x.jsx)(re,{size:16}),e(`cid.retryAction`)]}),(0,x.jsx)(r,{to:`/app/`,className:`btn btn-secondary`,children:e(`cid.openAppAction`)})]})]})]})})}function D(e,t){return t===`completed`?(0,x.jsx)(u,{size:28}):t===`error`||e===`error`?(0,x.jsx)(l,{size:28}):e===`checking`||e===`waiting-backend`||t===`starting`||t===`downloading`?(0,x.jsx)(_,{size:28}):e===`backend-missing`?(0,x.jsx)(y,{size:28}):e===`login-required`?(0,x.jsx)(v,{size:28}):(0,x.jsx)(u,{size:28})}function O(e,t){switch(e){case`checking`:return t(`cid.label.checking`);case`available`:return t(`cid.label.available`);case`already-local`:return t(`cid.label.alreadyLocal`);case`login-required`:return t(`cid.label.loginRequired`);case`backend-missing`:return t(`cid.label.backendMissing`);case`waiting-backend`:return t(`cid.label.waitingBackend`);case`error`:return t(`cid.label.error`);default:return t(`cid.label.idle`)}}var k=o(`/cid/$cid/`)({component:E});export{k as Route};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{a as r,g as i,i as a,r as o,t as s,v as c}from"./userStore-q0BBZsIV.js";import{i as l,r as u}from"./LanguageToggle-HAJ3D6Ne.js";import{t as d}from"./copy-5aEv78Eq.js";import{t as f}from"./AppShell-oF8wPXde.js";import{t as p}from"./play-D5r9Yvbq.js";import{a as m,i as h,n as g,r as ee,t as te}from"./useGameRoom-CURx56m6.js";import{M as ne,R as re,i as ie,m as _}from"./index--p9MKNEl.js";var ae=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`}]]),v=t(e(),1),oe=[10,20,50,100],y=[`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`J`,`Q`,`K`,`A`],b=[`D`,`C`,`H`,`S`],x=new Map(y.map((e,t)=>[e,t+2])),S=new Map(b.map((e,t)=>[e,t+1])),C={high:1,pair:2,straight:3,flush:4,straightFlush:5,triple:6},w={[C.high]:`散牌`,[C.pair]:`对子`,[C.straight]:`顺子`,[C.flush]:`金花`,[C.straightFlush]:`顺金`,[C.triple]:`豹子`};function T(e){return String(e||``).trim().toUpperCase().replace(/[^A-Z0-9]/g,``).slice(0,8)}function E(e=`zhajinhua`){return`${e}_${Date.now()}_${ve(4)}`}function D(){return E(`round`)}function O(){let e=[];for(let t of b)for(let n of y)e.push(`${n}${t}`);return e}function se(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 k(e){let t=String(e||``).trim().toUpperCase(),n=t.slice(-1),r=t.slice(0,-1);if(!x.has(r)||!S.has(n))throw Error(`Invalid card: ${e}`);return{id:`${r}${n}`,rank:r,suit:n,rankValue:x.get(r),suitValue:S.get(n)}}function ce(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 le(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 A(e){if(!Array.isArray(e)||e.length!==3)throw Error(`炸金花手牌必须是 3 张牌`);let t=e.map(k),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=le(n),o=[...n].sort((e,t)=>t-e),s=Math.max(...t.map(e=>e.suitValue)),c=C.high,l=o;return r.size===1?(c=C.triple,l=[o[0]]):a&&i?(c=C.straightFlush,l=[a]):i?(c=C.flush,l=o):a?(c=C.straight,l=[a]):r.size===2&&(c=C.pair,l=[[...r.entries()].find(([,e])=>e===2)[0],[...r.entries()].find(([,e])=>e===1)[0]]),{category:c,label:w[c],tiebreakers:l,tieSuit:s,cards:t.map(e=>e.id)}}function j(e,t){let n=A(e),r=A(t);if(n.category!==r.category)return n.category-r.category;let i=ce(n.tiebreakers,r.tiebreakers);return i===0?n.tieSuit-r.tieSuit:i}function ue(e){return A(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 c=se(O(),o),l={},u=s.map((e,t)=>{let n=c.slice(t*3,t*3+3);return l[e.address]=n,{address:e.address,name:e.name,avatar:W(e.avatar),publicKey:e.publicKey,chips:Number(e.chips)-10,status:`active`,looked:!1,bet:10}}),d,f=U(i),p=f?u.findIndex(e=>U(e.address)===f):-1;return d=p>=0?u[p].address:u[Math.floor(o()*u.length)].address,{roomCode:T(e),roundId:a,status:`playing`,host:U(n),seq:r+1,startedAt:Date.now(),ante:10,pot:10*u.length,currentBet:10,turnAddress:d,players:u,lastAction:`本局开始`,winner:null,showdown:null,appliedEventIds:[],hands:l,actionCounts:{},compareReveal:{}}}function me(e){if(!e)return null;let t={...e};return delete t.hands,G(t)}function he(e,t){let n=M(e);return!n||!t||typeof t!=`object`?null:{...n,hands:G(t)}}function M(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:U(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:U(e.turnAddress),players:e.players.map(H).filter(Boolean),lastAction:String(e.lastAction||``),winner:e.winner?U(e.winner):null,showdown:e.showdown&&typeof e.showdown==`object`?G(e.showdown):null,appliedEventIds:Array.isArray(e.appliedEventIds)?e.appliedEventIds.map(String):[],actionCounts:e.actionCounts&&typeof e.actionCounts==`object`?G(e.actionCounts):{},compareReveal:e.compareReveal&&typeof e.compareReveal==`object`?G(e.compareReveal):{},lastCompare:e.lastCompare&&typeof e.lastCompare==`object`?G(e.lastCompare):null,finishedAt:e.finishedAt?Number(e.finishedAt):null}}function N(e,t,n){let r=M(e);if(!r||r.status!==`playing`)return{ok:!1,error:`当前没有进行中的牌局`};let i=U(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(!oe.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=U(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 P(e,t,n){let r=N(e,t,n);if(!r.ok)return{ok:!1,error:r.error,state:e};let i=G(e),a=U(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} 看牌`,V(i);if(t.action===`fold`)return o.status=`folded`,i.lastAction=`${o.name} 弃牌`,L(i,a),R(i,a);if(t.action===`call`)return o.chips-=10,o.bet+=10,i.pot+=10,i.lastAction=`${o.name} 跟注`,L(i,a),R(i,a);if(t.action===`raise`){let e=Number(t.amount);return i.currentBet+=e,I(i,o),i.lastAction=`${o.name} 加注 ${e}`,L(i,a),R(i,a)}if(t.action===`compare`){I(i,o);let e=U(t.target),n=i.players.find(t=>t.address===e),r=o.looked,s=n.looked,c=j(i.hands?.[a]||[],i.hands?.[e]||[]),l=c>=0?o:n,u=c>=0?n:o;u.status=`folded`,u.looked=!0,i.compareReveal||={};let d=r&&s,f=!r&&!s;if(d)i.compareReveal[a]=i.hands?.[e]||[],i.compareReveal[e]=i.hands?.[a]||[];else if(f)i.compareReveal[u.address]=i.hands?.[l.address]||[];else{let e=r?o:n,t=r?n:o;i.compareReveal[e.address]=i.hands?.[t.address]||[],i.compareReveal[u.address]=i.hands?.[l.address]||[]}return i.lastCompare={initiator:a,target:e,winner:l.address,loser:u.address,initiatorLooked:r,targetLooked:s,timestamp:Date.now()},i.lastAction=`${o.name} 与 ${n.name} 比牌,${u.name} 出局`,L(i,a),R(i,a)}return{ok:!1,error:`未知操作`,state:e}}function F(e){return(e?.players||[]).filter(e=>e.status===`active`)}function ge(e,t){let n=(e?.players||[]).find(e=>e.address===U(t));if(!e||e.status!==`playing`||!n||n.status!==`active`||e.turnAddress!==n.address)return[];let r=[];return n.looked||r.push(`look`),N(e,{action:`call`},n.address).ok&&r.push(`call`),oe.some(t=>N(e,{action:`raise`,amount:t},n.address).ok)&&r.push(`raise`),F(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 I(e,t){let n=Math.max(0,e.currentBet-t.bet);t.chips-=n,t.bet+=n,e.pot+=n}function L(e,t){e.actionCounts||={},e.actionCounts[t]=(e.actionCounts[t]||0)+1}function R(e,t){let n=F(e);return n.length===1?z(e,n[0].address):(e.turnAddress=B(e,t),V(e))}function z(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?G(e.hands):null,e.lastAction=n?`${n.name} 赢得 ${r} 筹码`:`本局结束`,e.pot=0,e.finishedAt=Date.now(),V(e)}function B(e,t){let n=e.players,r=Math.max(0,n.findIndex(e=>e.address===U(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 V(e){return e.seq=Number(e.seq||0)+1,{ok:!0,state:e}}function H(e){if(!e||typeof e!=`object`)return null;let t=U(e.address);return t?{address:t,name:String(e.name||_e(t)).slice(0,50),avatar:W(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 U(e){let t=String(e||``).trim();return/^0x[a-fA-F0-9]{40}$/.test(t)?t.toLowerCase():``}function _e(e){return e?`${e.slice(0,6)}...${e.slice(-4)}`:``}function W(e){return String(e||``).trim().slice(0,4096)}function G(e){return JSON.parse(JSON.stringify(e))}function ve(e){let t=new Uint8Array(e);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(t);else for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256);return[...t].map(e=>e.toString(16).padStart(2,`0`)).join(``)}var K={page:`_page_1yyew_1`,headerActions:`_headerActions_1yyew_12`,entry:`_entry_1yyew_18`,entryBrand:`_entryBrand_1yyew_28`,cardMark:`_cardMark_1yyew_34`,entryPanel:`_entryPanel_1yyew_62`,accountLine:`_accountLine_1yyew_72`,joinForm:`_joinForm_1yyew_89`,status:`_status_1yyew_110`,board:`_board_1yyew_116`,table:`_table_1yyew_123`,tableCenter:`_tableCenter_1yyew_144`,finishBanner:`_finishBanner_1yyew_173`,finishBannerIcon:`_finishBannerIcon_1yyew_192`,seats:`_seats_1yyew_196`,seat:`_seat_1yyew_196`,seatTurn:`_seatTurn_1yyew_218`,seatWinner:`_seatWinner_1yyew_223`,seatFolded:`_seatFolded_1yyew_228`,seatAvatar:`_seatAvatar_1yyew_232`,seatMain:`_seatMain_1yyew_251`,seatMeta:`_seatMeta_1yyew_252`,panel:`_panel_1yyew_283`,panelSection:`_panelSection_1yyew_290`,panelTitle:`_panelTitle_1yyew_300`,hand:`_hand_1yyew_310`,card:`_card_1yyew_34`,red:`_red_1yyew_344`,black:`_black_1yyew_348`,cardBack:`_cardBack_1yyew_352`,handLabel:`_handLabel_1yyew_373`,actionGrid:`_actionGrid_1yyew_380`,raiseRow:`_raiseRow_1yyew_381`,statusGrid:`_statusGrid_1yyew_392`,muted:`_muted_1yyew_410`,compareOverlay:`_compareOverlay_1yyew_417`,compareBox:`_compareBox_1yyew_429`,compareTitle:`_compareTitle_1yyew_443`,comparePlayers:`_comparePlayers_1yyew_449`,compareSide:`_compareSide_1yyew_456`,compareWinner:`_compareWinner_1yyew_468`,compareName:`_compareName_1yyew_473`,compareCards:`_compareCards_1yyew_484`,compareLabel:`_compareLabel_1yyew_509`,compareVs:`_compareVs_1yyew_515`,compareResult:`_compareResult_1yyew_522`},q=n(),ye=`zhajinhua`;function J(...e){return e.filter(Boolean).join(` `)}function Y(e,t){return String(e||``).toLowerCase()===String(t||``).toLowerCase()}function be(e=``){return e?`${e.slice(0,6)}...${e.slice(-4)}`:``}function xe(e){return e.displayName||e.username}function Se(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}=re(),t=_(e=>e.isDarkMode),n=_(e=>e.setIsDarkMode),i=_(e=>e.addToast),c=s(e=>e.initializeUser),[y,b]=(0,v.useState)(``),[x,S]=(0,v.useState)(!1),C=(0,v.useRef)(``),w=(0,v.useRef)(!1),[T,E]=(0,v.useState)(20),[D,O]=(0,v.useState)(``),[se,k]=(0,v.useState)({}),[ce,le]=(0,v.useState)(!0),[A,j]=(0,v.useState)(!1),M=(0,v.useRef)(null),N=(0,v.useRef)(new Set),I=te({gameId:ye,onError:e=>i(e,`error`),getPlayerPayload:e=>{let t=o(e.danger);return{address:e.address,name:xe(e),avatar:e.avatar||``,publicKey:t.public_key,joinedAt:Date.now()}}}),L=(0,v.useMemo)(()=>I.userIdentity?.danger?o(I.userIdentity.danger):null,[I.userIdentity?.danger]);(0,v.useEffect)(()=>{c()},[c]),(0,v.useEffect)(()=>{let e=new URLSearchParams(window.location.search).get(`room`)?.toUpperCase();e&&(b(e),C.current=e)},[]),(0,v.useEffect)(()=>{let t=C.current;!t||w.current||!I.isBackendReady||!I.userIdentity||(w.current=!0,C.current=``,I.joinRoom(t).then(t=>{t&&i(e(`game.toast.joinedRoom`),`success`)}))},[I.isBackendReady,I.userIdentity,I.joinRoom,i,e]),(0,v.useEffect)(()=>{if(!I.roomCode)return;let e=`/game/zhajinhua?room=${I.roomCode}`;`${window.location.pathname}${window.location.search}`!==e&&window.history.replaceState(null,``,e)},[I.roomCode]);let R=(0,v.useMemo)(()=>g(I.messages,{gameId:ye,roomCode:I.roomCode}),[I.messages,I.roomCode]),z=(0,v.useMemo)(()=>ee(I.messages,{gameId:ye,roomCode:I.roomCode}),[I.messages,I.roomCode])?.payload?.round||null,B=z?.host||R.hostAddress,V=Y(B,I.userIdentity?.address),H=I.userIdentity?.address?.toLowerCase()||``,U=z?.players.find(e=>Y(e.address,H)),_e=U||R.players.find(e=>Y(e.address,H)),W=se[z?.roundId||``]||null,G=z?.showdown&&H?z.showdown[H]:null,ve=z?.compareReveal&&H?z.compareReveal[H]:null,X=G||ve||(U?.looked?W:null),Q=ge(z,H),we=F(z),Te=V&&fe(R.players.map(e=>({...e,chips:z?.players.find(t=>Y(t.address,e.address))?.chips??1e3}))),Ee=I.roomCode&&typeof window<`u`?`${window.location.origin}/game/zhajinhua?room=${I.roomCode}`:``;(0,v.useEffect)(()=>{if(!(!z||!I.userIdentity||!L||!B))for(let e of I.roomEvents){let t=e.event;if(!t||t.event!==`deal:private`)continue;let n=t.payload;if(n.roundId!==z.roundId||!Y(n.recipient,I.userIdentity.address))continue;let r=a(n.encrypted||``,{senderPublicKey:n.senderPublicKey||``,recipientPrivateKey:L.private_key});if(r)try{let e=JSON.parse(r);Array.isArray(e)&&k(t=>({...t,[z.roundId]:e.map(String)}))}catch{}}},[z?.roundId,I.roomEvents,I.userIdentity,B,L?.private_key]),(0,v.useEffect)(()=>{if(z?.status===`finished`&&z.winner){le(!0);let e=setTimeout(()=>le(!1),5e3);return()=>clearTimeout(e)}},[z?.finishedAt,z?.status,z?.winner]),(0,v.useEffect)(()=>{if(z?.lastCompare?.timestamp){j(!0);let e=setTimeout(()=>j(!1),5e3);return()=>clearTimeout(e)}else j(!1)},[z?.lastCompare?.timestamp,z?.roundId]),(0,v.useEffect)(()=>{if(!V||!z||z.status!==`playing`)return;let e=M.current;if(!e)return;let t=I.roomEvents.filter(e=>{let t=e.event;if(!t||t.event!==`player:action`)return!1;let n=t.payload.actionEvent;return!(!n||n.roundId!==z.roundId||N.current.has(n.eventId)||z.appliedEventIds?.includes(n.eventId))});if(t.length===0)return;let n=!1;async function r(){let r=he(z,e);if(r)for(let e of t){if(n)return;let t=(e.event?.payload).actionEvent,i=P(r,t,e.message.author);if(!i.ok){let n=e.message.author;if(!Y(n,I.userIdentity?.address)&&r.status===`playing`&&Y(r.turnAddress,n)){let e=P(r,de({roundId:r.roundId,action:`call`,amount:void 0,target:void 0}),n);if(e.ok)i=e;else{let e=P(r,de({roundId:r.roundId,action:`fold`,amount:void 0,target:void 0}),n);e.ok&&(i=e)}}if(!i.ok){N.current.add(t.eventId);continue}}if(r=i.state,M.current=i.state.hands,await Ae(i.state)&&N.current.add(t.eventId),i.state.status===`finished`)break}}return r(),()=>{n=!0}},[z?.roundId,z?.seq,z?.status,I.roomEvents,V]);async function De(){await I.createRoom()&&i(e(`game.toast.roomCreated`),`success`)}async function Oe(t){t.preventDefault(),await I.joinRoom(y)&&i(e(`game.toast.joinedRoom`),`success`)}async function ke(){Ee&&(await navigator.clipboard.writeText(Ee),S(!0),setTimeout(()=>S(!1),1400))}async function Ae(e){return I.sendRoomEvent(`room:state`,{round:me(e),seq:e.seq})}async function je(){if(!I.userIdentity||!L||!Te){i(e(`game.zhajinhua.error.notEnoughPlayers`),`error`);return}try{let t=R.players.map(e=>({...e,chips:z?.players.find(t=>Y(t.address,e.address))?.chips??1e3})),n=pe({roomCode:I.roomCode,players:t,hostAddress:I.userIdentity.address,previousSeq:z?.seq||0,previousWinner:z?.winner||``});M.current=n.hands,N.current.clear(),await Ae(n);for(let e of n.players){let t=r(JSON.stringify(n.hands[e.address]),{senderPrivateKey:L.private_key,recipientPublicKey:e.publicKey});await I.sendRoomEvent(`deal:private`,{roundId:n.roundId,recipient:e.address,senderPublicKey:L.public_key,encrypted:t})}k(e=>({...e,[n.roundId]:n.hands[I.userIdentity.address.toLowerCase()]})),i(e(`game.zhajinhua.toast.roundStarted`),`success`)}catch(t){i(t instanceof Error?t.message:e(`game.zhajinhua.error.startFailed`),`error`)}}async function $(e,t={}){if(!z||!I.userIdentity)return;let n=de({roundId:z.roundId,action:e,amount:t.amount,target:t.target});await I.sendRoomEvent(`player:action`,{actionEvent:n})}let Me=z?.status===`playing`?Y(z.turnAddress,H)?e(`game.zhajinhua.status.yourTurn`):z.turnAddress?e(`game.zhajinhua.status.waitingPlayer`,{player:Z(z.turnAddress,R.players)}):e(`game.status.playing`):z?.status===`finished`?e(`game.status.finished`):e(`game.status.waitingStart`),Ne=we.filter(e=>!Y(e.address,H));return(0,q.jsx)(f,{sidebar:({closeSidebar:e})=>(0,q.jsx)(h,{activeGame:`zhajinhua`,closeSidebar:e}),headerTitle:(0,q.jsx)(`h2`,{className:`header-title`,children:e(`game.zhajinhua.title`)}),headerRight:(0,q.jsxs)(`div`,{className:K.headerActions,children:[I.roomCode&&(0,q.jsxs)(`button`,{className:`btn btn-sm`,onClick:ke,children:[(0,q.jsx)(d,{size:14}),e(x?`common.copied`:`game.action.shareRoom`)]}),(0,q.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>n(!t),title:e(`common.theme.toggle`),children:t?(0,q.jsx)(u,{size:16}):(0,q.jsx)(l,{size:16})})]}),children:(0,q.jsx)(`main`,{className:K.page,children:I.roomCode?(0,q.jsxs)(`div`,{className:K.board,children:[(0,q.jsxs)(`section`,{className:K.table,children:[z?.status===`finished`&&z.winner&&ce&&(0,q.jsxs)(`div`,{className:K.finishBanner,children:[(0,q.jsx)(`span`,{className:K.finishBannerIcon,children:`🏆`}),(0,q.jsx)(`span`,{children:e(`game.zhajinhua.result.winChips`,{player:Z(z.winner,R.players),amount:z.winAmount??0})})]}),z?.lastCompare&&A&&(0,q.jsx)(Ce,{lastCompare:z.lastCompare,compareReveal:z.compareReveal||{},myAddress:H,myDealtHand:W,lobbyPlayers:R.players,onClose:()=>j(!1)}),(0,q.jsxs)(`div`,{className:K.tableCenter,children:[(0,q.jsx)(`span`,{children:e(`game.zhajinhua.pot`)}),(0,q.jsx)(`strong`,{children:z?.pot||0}),(0,q.jsx)(`small`,{children:e(`game.zhajinhua.currentBet`,{amount:z?.currentBet||0})})]}),(0,q.jsx)(`div`,{className:K.seats,children:R.players.map(t=>{let n=z?.players.find(e=>Y(e.address,t.address)),r=z?.turnAddress===t.address,i=z?.winner===t.address,a=n?.status===`folded`;return(0,q.jsxs)(`div`,{className:J(K.seat,r&&K.seatTurn,i&&K.seatWinner,a&&K.seatFolded),children:[(0,q.jsx)(`div`,{className:K.seatAvatar,children:(0,q.jsx)(`img`,{src:ie(t.address,t.avatar),alt:``})}),(0,q.jsxs)(`div`,{className:K.seatMain,children:[(0,q.jsx)(`strong`,{translate:`no`,children:t.name}),(0,q.jsx)(`span`,{translate:`no`,children:be(t.address)})]}),(0,q.jsxs)(`div`,{className:K.seatMeta,children:[(0,q.jsx)(`span`,{children:e(`game.zhajinhua.chips`,{amount:n?.chips??1e3})}),(0,q.jsx)(`span`,{children:n?.status===`folded`?e(`game.zhajinhua.player.folded`):n?.looked?e(`game.zhajinhua.player.looked`):e(z?`game.zhajinhua.player.inRound`:`game.status.waitingStart`)})]})]},t.address)})})]}),(0,q.jsxs)(`aside`,{className:K.panel,children:[(0,q.jsxs)(`div`,{className:K.panelSection,children:[(0,q.jsxs)(`div`,{className:K.panelTitle,children:[(0,q.jsx)(m,{size:16}),(0,q.jsx)(`span`,{children:e(`game.zhajinhua.myHand`)})]}),(0,q.jsx)(`div`,{className:K.hand,children:X?X.map(e=>{let t=Se(e),n=`${t.suit}${t.rank}`;return(0,q.jsxs)(`div`,{className:J(K.card,K[t.color]),children:[(0,q.jsx)(`span`,{children:n}),(0,q.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,q.jsx)(`div`,{className:K.cardBack,children:(0,q.jsx)(m,{size:18})},e))}),(0,q.jsx)(`p`,{className:K.handLabel,children:X?ue(X):e(W?`game.zhajinhua.hand.unlooked`:`game.zhajinhua.hand.waitingDeal`)})]}),(0,q.jsxs)(`div`,{className:K.panelSection,children:[(0,q.jsxs)(`div`,{className:K.panelTitle,children:[(0,q.jsx)(p,{size:16}),(0,q.jsx)(`span`,{children:e(`game.actions`)})]}),V?(0,q.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:je,disabled:!Te||z?.status===`playing`,children:[(0,q.jsx)(ae,{size:16}),z?.status===`finished`?e(`game.action.nextRound`):e(`game.action.startRound`)]}):(0,q.jsx)(`p`,{className:K.muted,children:e(`game.waitingHost`)}),V&&z?.status===`finished`&&!Te&&(0,q.jsx)(`p`,{className:K.muted,children:e(`game.zhajinhua.error.tooManyLowChips`)}),(0,q.jsxs)(`div`,{className:K.actionGrid,children:[(0,q.jsxs)(`button`,{className:`btn btn-secondary`,disabled:!Q.includes(`look`),onClick:()=>$(`look`),children:[(0,q.jsx)(ne,{size:16}),e(`game.zhajinhua.action.look`)]}),(0,q.jsx)(`button`,{className:`btn btn-secondary`,disabled:!Q.includes(`call`),onClick:()=>$(`call`),children:e(`game.zhajinhua.action.call`)}),(0,q.jsx)(`button`,{className:`btn btn-secondary`,disabled:!Q.includes(`fold`),onClick:()=>$(`fold`),children:e(`game.zhajinhua.action.fold`)})]}),(0,q.jsxs)(`div`,{className:K.raiseRow,children:[(0,q.jsx)(`select`,{className:`input input-compact`,value:T,onChange:e=>E(Number(e.target.value)),children:oe.map(t=>(0,q.jsx)(`option`,{value:t,children:e(`game.zhajinhua.action.raiseOption`,{amount:t})},t))}),(0,q.jsx)(`button`,{className:`btn btn-secondary`,disabled:!Q.includes(`raise`),onClick:()=>$(`raise`,{amount:T}),children:e(`game.zhajinhua.action.raise`)})]}),(0,q.jsxs)(`div`,{className:K.raiseRow,children:[(0,q.jsxs)(`select`,{className:`input input-compact`,value:D,onChange:e=>O(e.target.value),children:[(0,q.jsx)(`option`,{value:``,children:e(`game.zhajinhua.action.comparePlaceholder`)}),Ne.map(e=>(0,q.jsx)(`option`,{value:e.address,children:e.name},e.address))]}),(0,q.jsx)(`button`,{className:`btn btn-secondary`,disabled:!Q.includes(`compare`)||!D,onClick:()=>$(`compare`,{target:D}),children:e(`game.zhajinhua.action.compare`)})]})]}),(0,q.jsxs)(`div`,{className:K.panelSection,children:[(0,q.jsx)(`div`,{className:K.panelTitle,children:e(`game.status.title`)}),(0,q.jsxs)(`div`,{className:K.statusGrid,children:[(0,q.jsx)(`span`,{children:e(`game.host`)}),(0,q.jsx)(`strong`,{children:B?be(B):`-`}),(0,q.jsx)(`span`,{children:e(`game.zhajinhua.myChips`)}),(0,q.jsx)(`strong`,{children:_e?.chips??1e3}),(0,q.jsx)(`span`,{children:e(`game.round`)}),(0,q.jsx)(`strong`,{children:Me}),(0,q.jsx)(`span`,{children:e(`game.hint`)}),(0,q.jsx)(`strong`,{children:z?.lastAction||e(`game.waitingPlayers`)})]})]})]})]}):(0,q.jsxs)(`section`,{className:K.entry,children:[(0,q.jsxs)(`div`,{className:K.entryBrand,children:[(0,q.jsx)(`div`,{className:K.cardMark,children:(0,q.jsx)(m,{size:48})}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{children:e(`game.zhajinhua.hero.title`)}),(0,q.jsx)(`p`,{children:e(`game.hero.desc`)})]})]}),(0,q.jsxs)(`div`,{className:K.entryPanel,children:[(0,q.jsxs)(`div`,{className:K.accountLine,children:[(0,q.jsx)(`span`,{children:e(`game.currentAccount`)}),(0,q.jsx)(`strong`,{translate:`no`,children:I.userIdentity?.displayName||e(`web3.notSignedIn`)})]}),(0,q.jsxs)(`button`,{className:`btn btn-primary`,disabled:I.joining,onClick:De,children:[(0,q.jsx)(p,{size:16}),e(`game.action.createRoom`)]}),(0,q.jsxs)(`form`,{onSubmit:Oe,className:K.joinForm,children:[(0,q.jsxs)(`label`,{children:[e(`game.roomCode`),(0,q.jsx)(`input`,{value:y,maxLength:8,onChange:e=>b(e.target.value.toUpperCase()),placeholder:e(`game.roomCode.placeholder`)})]}),(0,q.jsx)(`button`,{className:`btn`,disabled:I.joining||!y,children:e(`game.action.joinRoom`)})]}),(0,q.jsx)(`p`,{className:K.status,children:I.isBackendReady?e(`game.status.nodeConnected`):e(`game.status.nodeConnecting`)})]})]})})})}function Ce({lastCompare:e,compareReveal:t,myAddress:n,myDealtHand:r,lobbyPlayers:i,onClose:a}){let{t:o}=re(),s=Z(e.initiator,i),c=Z(e.target,i),l=Z(e.winner,i),u=Y(n,e.initiator),d=Y(n,e.target),f=u||d;function p(e,i){return t[e]||(f&&Y(e,n)&&i&&r?r:null)}let h=p(e.initiator,e.initiatorLooked),g=p(e.target,e.targetLooked);return(0,q.jsx)(`div`,{className:K.compareOverlay,onClick:a,children:(0,q.jsxs)(`div`,{className:K.compareBox,onClick:e=>e.stopPropagation(),children:[(0,q.jsx)(`div`,{className:K.compareTitle,children:o(`game.zhajinhua.compareResult`)}),(0,q.jsxs)(`div`,{className:K.comparePlayers,children:[(0,q.jsxs)(`div`,{className:J(K.compareSide,Y(e.winner,e.initiator)&&K.compareWinner),children:[(0,q.jsx)(`div`,{className:K.compareName,children:s}),(0,q.jsx)(`div`,{className:K.compareCards,children:h?h.map(e=>{let t=Se(e);return(0,q.jsxs)(`div`,{className:J(K.card,K[t.color]),children:[(0,q.jsx)(`span`,{children:t.rank}),(0,q.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,q.jsx)(`div`,{className:K.cardBack,children:(0,q.jsx)(m,{size:18})},e))}),h&&(0,q.jsx)(`div`,{className:K.compareLabel,children:ue(h)})]}),(0,q.jsx)(`div`,{className:K.compareVs,children:`VS`}),(0,q.jsxs)(`div`,{className:J(K.compareSide,Y(e.winner,e.target)&&K.compareWinner),children:[(0,q.jsx)(`div`,{className:K.compareName,children:c}),(0,q.jsx)(`div`,{className:K.compareCards,children:g?g.map(e=>{let t=Se(e);return(0,q.jsxs)(`div`,{className:J(K.card,K[t.color]),children:[(0,q.jsx)(`span`,{children:t.rank}),(0,q.jsx)(`i`,{children:t.suit})]},e)}):[0,1,2].map(e=>(0,q.jsx)(`div`,{className:K.cardBack,children:(0,q.jsx)(m,{size:18})},e))}),g&&(0,q.jsx)(`div`,{className:K.compareLabel,children:ue(g)})]})]}),(0,q.jsx)(`div`,{className:K.compareResult,children:o(`game.zhajinhua.result.winner`,{player:l})}),(0,q.jsx)(`button`,{className:`btn btn-sm`,onClick:a,children:o(`common.close`)})]})})}function Z(e,t){let n=e.toLowerCase();return t.find(e=>e.address===n)?.name||be(e)}var Q=c(`/game/zhajinhua/`)({component:X});export{Q as Route};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{x as r,y as i}from"./userStore-C4vdYsQp.js";import{t as a}from"./cloud-DHoTMeZY.js";import{t as o}from"./message-square-DaQH7q-P.js";import{t as s}from"./music-DaFvU2DL.js";import{t as c}from"./play-B7q6F75-.js";import{t as l}from"./search-ncblG-zw.js";import{t as u}from"./send-m1XCcuPn.js";import{t as d}from"./wifi-DIR3g_8A.js";import{B as f}from"./index-BJ7E8LJN.js";import{t as p}from"./MarketingLayout-mQV6ciYc.js";var m=i(`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`}]]),h=i(`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`}]]),g=i(`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`}]]),_=i(`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`}]]),v=i(`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`}]]),y=i(`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`}]]),b=i(`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`}]]),x=i(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),ee=i(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),te=i(`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 D(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 oe={provider:``,aliases:{},not_found:{},...re};function O(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function k(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!O(e,oe))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!O(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]||!O(t,T))return null}return t}var A=Object.create(null);function se(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function j(e,t){let n=A[e]||(A[e]=Object.create(null));return n[t]||(n[t]=se(e,t))}function ce(e,t){return k(t)?D(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function le(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var ue=/^[a-z0-9]+(-[a-z0-9]+)*$/,M=(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&&!N(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&&!N(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!N(e,n)?null:e}return null},N=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,P=!1;function F(e){return typeof e==`boolean`&&(P=e),P}function I(e){let t=typeof e==`string`?M(e,!0,P):e;if(t){let e=j(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function de(e,t){let n=M(e,!0,P);if(!n)return!1;let r=j(n.provider,n.prefix);return t?le(r,n.name,t):(r.missing.add(n.name),!0)}function fe(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),P&&!t&&!e.prefix){let t=!1;return k(e)&&(e.prefix=``,D(e,(e,n)=>{de(e,n)&&(t=!0)})),t}let n=e.prefix;return N({prefix:n,name:`a`})?!!ce(j(t,n),e):!1}var L=Object.freeze({width:null,height:null}),R=Object.freeze({...L,...C}),pe=/(-?[0-9.]*[0-9]+[0-9.]*)/g,me=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function z(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(pe);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=me.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 he(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 ge(e,t){return e?`<defs>`+e+`</defs>`+t:t}function _e(e,t,n){let r=he(e);return ge(r.defs,t+r.content+n)}var ve=e=>e===`unset`||e===`undefined`||e===`none`;function ye(e,t){let n={...w,...e},r={...R,...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=_e(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=z(d,c/l)):(u=o===`auto`?c:o,d=s===null?z(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{ve(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 be=/\sid="(\S+)"/g,xe=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),Se=0;function Ce(e,t=xe){let n=[],r;for(;r=be.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+(Se++).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 B=Object.create(null);function we(e,t){B[e]=t}function V(e){return B[e]||B[``]}function H(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 U=Object.create(null),W=[`https://api.simplesvg.com`,`https://api.unisvg.com`],G=[];W.length>0;)W.length===1||Math.random()>.5?G.push(W.shift()):G.push(W.pop());U[``]=H({resources:[`https://api.iconify.design`].concat(G)});function Te(e,t){let n=H(t);return n===null?!1:(U[e]=n,!0)}function K(e){return U[e]}var q=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function Ee(e,t){let n=K(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 De(e){return e===404}var Oe=(e,t,n)=>{let r=[],i=Ee(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 ke(e){if(typeof e==`string`){let t=K(e);if(t)return t.path}return`/`}var Ae={prepare:Oe,send:(e,t,n)=>{if(!q){n(`abort`,424);return}let r=ke(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;q(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(De(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 je(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||je([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=je.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]=j(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`?M(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=K(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=V(e);if(!t)return n(void 0,424),Be;i=t.send;let a=Ve(e);a&&(r=a.redundancy)}else{let t=H(e);if(t){r=ze(t);let n=V(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(ue)?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(!ce(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(ue)?V(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,F()));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(j(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=j(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 L?(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={...R,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=M(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=ye(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(Ce(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(F(!0),we(``,Ae),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`||!fe(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;Te(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=I(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=I(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)(l,{size:20})},{name:`Cloudflare`,host:`cloudflare.com`,icon:`simple-icons:cloudflare`,fallback:(0,Q.jsx)(a,{size:20})},{name:`YouTube`,host:`youtube.com`,icon:`simple-icons:youtube`,fallback:(0,Q.jsx)(c,{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)(g,{size:20})},{name:`X`,host:`x.com`,icon:`simple-icons:x`,fallback:(0,Q.jsx)(m,{size:20})},{name:`Instagram`,host:`instagram.com`,icon:`simple-icons:instagram`,fallback:(0,Q.jsx)(_,{size:20})},{name:`Reddit`,host:`reddit.com`,icon:`simple-icons:reddit`,fallback:(0,Q.jsx)(o,{size:20})},{name:`Wikipedia`,host:`wikipedia.org`,icon:`simple-icons:wikipedia`,fallback:(0,Q.jsx)(h,{size:20})},{name:`Apple`,host:`apple.com`,icon:`simple-icons:apple`,fallback:(0,Q.jsx)(x,{size:20})},{name:`Telegram`,host:`telegram.org`,icon:`simple-icons:telegram`,fallback:(0,Q.jsx)(u,{size:20})},{name:`Discord`,host:`discord.com`,icon:`simple-icons:discord`,fallback:(0,Q.jsx)(v,{size:20})},{name:`TikTok`,host:`tiktok.com`,icon:`simple-icons:tiktok`,fallback:(0,Q.jsx)(s,{size:20})},{name:`npm`,host:`npmjs.com`,icon:`simple-icons:npm`,fallback:(0,Q.jsx)(y,{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}=f(),[n,r]=(0,S.useState)(new Map),[i,a]=(0,S.useState)(!1),o=(0,S.useRef)(new Map);(0,S.useEffect)(()=>{document.title=e(`ping.meta.title`)},[e]);let s=(0,S.useCallback)(e=>{r(t=>{let n=new Map(t);return n.set(e,{status:`pending`,latency:0}),n});let t=new AbortController;o.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)})},[]),c=(0,S.useCallback)(()=>{a(!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;o.current.set(e.host,n);let i=performance.now(),s=(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&&a(!1))},c=setTimeout(()=>{n.abort()},gt);fetch(`https://${e.host}/`,{method:`HEAD`,mode:`no-cors`,cache:`no-store`,signal:n.signal}).then(()=>{clearTimeout(c),s(`ok`,Math.round(performance.now()-i))}).catch(()=>{clearTimeout(c),s(`timeout`,0)})})},[]);return(0,S.useEffect)(()=>(c(),()=>{o.current.forEach(e=>e.abort()),o.current.clear()}),[c]),(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)(d,{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:c,disabled:i,"aria-label":e(`ping.retryAll`),title:e(`ping.retryAll`),children:(0,Q.jsx)(b,{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:()=>s(r.host),disabled:a,"aria-label":e(`ping.retryOne`,{name:r.name}),title:e(`ping.retry`),children:(0,Q.jsx)(b,{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)(p,{children:(0,Q.jsx)(vt,{})})}var bt=r(`/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{g as r,v as i}from"./userStore-q0BBZsIV.js";import{t as a}from"./cloud-DAGFCFIp.js";import{t as o}from"./message-square-Eu86zZup.js";import{t as s}from"./music-Btrhub6z.js";import{t as c}from"./play-D5r9Yvbq.js";import{t as l}from"./search-CbzMyENy.js";import{t as u}from"./send-D8p6f8OD.js";import{t as d}from"./wifi-CVqaPDcv.js";import{R as f}from"./index--p9MKNEl.js";import{t as p}from"./MarketingLayout-CapVVXTP.js";var m=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`}]]),h=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`}]]),g=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`}]]),_=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`}]]),v=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`}]]),y=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`}]]),b=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`}]]),x=r(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),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 D(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 oe={provider:``,aliases:{},not_found:{},...re};function O(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function k(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!O(e,oe))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!O(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]||!O(t,T))return null}return t}var A=Object.create(null);function se(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function j(e,t){let n=A[e]||(A[e]=Object.create(null));return n[t]||(n[t]=se(e,t))}function ce(e,t){return k(t)?D(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function le(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var ue=/^[a-z0-9]+(-[a-z0-9]+)*$/,M=(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&&!N(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&&!N(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!N(e,n)?null:e}return null},N=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,P=!1;function F(e){return typeof e==`boolean`&&(P=e),P}function I(e){let t=typeof e==`string`?M(e,!0,P):e;if(t){let e=j(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function de(e,t){let n=M(e,!0,P);if(!n)return!1;let r=j(n.provider,n.prefix);return t?le(r,n.name,t):(r.missing.add(n.name),!0)}function fe(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),P&&!t&&!e.prefix){let t=!1;return k(e)&&(e.prefix=``,D(e,(e,n)=>{de(e,n)&&(t=!0)})),t}let n=e.prefix;return N({prefix:n,name:`a`})?!!ce(j(t,n),e):!1}var L=Object.freeze({width:null,height:null}),R=Object.freeze({...L,...C}),pe=/(-?[0-9.]*[0-9]+[0-9.]*)/g,me=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function z(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(pe);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=me.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 he(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 ge(e,t){return e?`<defs>`+e+`</defs>`+t:t}function _e(e,t,n){let r=he(e);return ge(r.defs,t+r.content+n)}var ve=e=>e===`unset`||e===`undefined`||e===`none`;function ye(e,t){let n={...w,...e},r={...R,...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=_e(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=z(d,c/l)):(u=o===`auto`?c:o,d=s===null?z(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{ve(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 be=/\sid="(\S+)"/g,xe=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),Se=0;function Ce(e,t=xe){let n=[],r;for(;r=be.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+(Se++).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 B=Object.create(null);function we(e,t){B[e]=t}function V(e){return B[e]||B[``]}function H(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 U=Object.create(null),W=[`https://api.simplesvg.com`,`https://api.unisvg.com`],G=[];W.length>0;)W.length===1||Math.random()>.5?G.push(W.shift()):G.push(W.pop());U[``]=H({resources:[`https://api.iconify.design`].concat(G)});function Te(e,t){let n=H(t);return n===null?!1:(U[e]=n,!0)}function K(e){return U[e]}var q=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function Ee(e,t){let n=K(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 De(e){return e===404}var Oe=(e,t,n)=>{let r=[],i=Ee(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 ke(e){if(typeof e==`string`){let t=K(e);if(t)return t.path}return`/`}var Ae={prepare:Oe,send:(e,t,n)=>{if(!q){n(`abort`,424);return}let r=ke(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;q(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(De(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 je(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||je([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=je.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]=j(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`?M(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=K(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=V(e);if(!t)return n(void 0,424),Be;i=t.send;let a=Ve(e);a&&(r=a.redundancy)}else{let t=H(e);if(t){r=ze(t);let n=V(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(ue)?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(!ce(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(ue)?V(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,F()));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(j(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=j(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 L?(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={...R,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=M(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=ye(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(Ce(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(F(!0),we(``,Ae),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`||!fe(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;Te(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=I(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=I(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)(l,{size:20})},{name:`Cloudflare`,host:`cloudflare.com`,icon:`simple-icons:cloudflare`,fallback:(0,Q.jsx)(a,{size:20})},{name:`YouTube`,host:`youtube.com`,icon:`simple-icons:youtube`,fallback:(0,Q.jsx)(c,{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)(g,{size:20})},{name:`X`,host:`x.com`,icon:`simple-icons:x`,fallback:(0,Q.jsx)(m,{size:20})},{name:`Instagram`,host:`instagram.com`,icon:`simple-icons:instagram`,fallback:(0,Q.jsx)(_,{size:20})},{name:`Reddit`,host:`reddit.com`,icon:`simple-icons:reddit`,fallback:(0,Q.jsx)(o,{size:20})},{name:`Wikipedia`,host:`wikipedia.org`,icon:`simple-icons:wikipedia`,fallback:(0,Q.jsx)(h,{size:20})},{name:`Apple`,host:`apple.com`,icon:`simple-icons:apple`,fallback:(0,Q.jsx)(x,{size:20})},{name:`Telegram`,host:`telegram.org`,icon:`simple-icons:telegram`,fallback:(0,Q.jsx)(u,{size:20})},{name:`Discord`,host:`discord.com`,icon:`simple-icons:discord`,fallback:(0,Q.jsx)(v,{size:20})},{name:`TikTok`,host:`tiktok.com`,icon:`simple-icons:tiktok`,fallback:(0,Q.jsx)(s,{size:20})},{name:`npm`,host:`npmjs.com`,icon:`simple-icons:npm`,fallback:(0,Q.jsx)(y,{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}=f(),[n,r]=(0,S.useState)(new Map),[i,a]=(0,S.useState)(!1),o=(0,S.useRef)(new Map);(0,S.useEffect)(()=>{document.title=e(`ping.meta.title`)},[e]);let s=(0,S.useCallback)(e=>{r(t=>{let n=new Map(t);return n.set(e,{status:`pending`,latency:0}),n});let t=new AbortController;o.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)})},[]),c=(0,S.useCallback)(()=>{a(!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;o.current.set(e.host,n);let i=performance.now(),s=(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&&a(!1))},c=setTimeout(()=>{n.abort()},gt);fetch(`https://${e.host}/`,{method:`HEAD`,mode:`no-cors`,cache:`no-store`,signal:n.signal}).then(()=>{clearTimeout(c),s(`ok`,Math.round(performance.now()-i))}).catch(()=>{clearTimeout(c),s(`timeout`,0)})})},[]);return(0,S.useEffect)(()=>(c(),()=>{o.current.forEach(e=>e.abort()),o.current.clear()}),[c]),(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)(d,{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:c,disabled:i,"aria-label":e(`ping.retryAll`),title:e(`ping.retryAll`),children:(0,Q.jsx)(b,{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:()=>s(r.host),disabled:a,"aria-label":e(`ping.retryOne`,{name:r.name}),title:e(`ping.retry`),children:(0,Q.jsx)(b,{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)(p,{children:(0,Q.jsx)(vt,{})})}var bt=i(`/ping/`)({component:yt});export{bt as Route};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{a as r,c as i,d as a,g as o,i as s,p as c,r as l,t as u,u as d,v as f}from"./userStore-q0BBZsIV.js";import{i as p,r as m}from"./LanguageToggle-HAJ3D6Ne.js";import{n as h,t as g}from"./lock-C0pdaery.js";import{t as _}from"./download-Bhqn6hL1.js";import{t as v}from"./external-link-CNR21yFA.js";import{a as y,i as b,n as x,r as S,t as C}from"./mp-CJWipckT.js";import{t as w}from"./key-round-BpSdpOHi.js";import{t as T}from"./AppShell-oF8wPXde.js";import{t as E}from"./wallet-DmZMdK9A.js";import{F as ee,M as D,N as O,R as k,i as te,k as ne,m as re}from"./index--p9MKNEl.js";var ie=o(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),A=o(`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`}]]),ae=o(`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`}]]),oe=o(`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`}]]),se=o(`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`}]]),j=t(e()),M=n();function ce(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function le({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}=k();return(0,M.jsxs)(`div`,{className:`web3-box-account`,children:[(0,M.jsx)(`div`,{className:`web3-box-account-header`,children:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{children:e}),(0,M.jsx)(`p`,{children:d(`web3.box.account.desc`)})]})}),(0,M.jsxs)(`div`,{className:`web3-box-login`,children:[(0,M.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,M.jsxs)(`div`,{className:`input-wrap`,children:[(0,M.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,M.jsx)(`button`,{className:`input-eye`,onClick:c,type:`button`,children:r?(0,M.jsx)(O,{size:16}):(0,M.jsx)(D,{size:16})})]}),(0,M.jsxs)(`button`,{className:`btn btn-primary btn-full`,onClick:u,disabled:!t.trim(),type:`button`,children:[(0,M.jsx)(w,{size:16}),d(`web3.box.account.generate`)]})]}),a?(0,M.jsxs)(`div`,{className:`web3-box-key-list`,children:[(0,M.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,M.jsx)(`span`,{children:d(`web3.label.address`)}),(0,M.jsxs)(`div`,{className:`mono-row`,children:[(0,M.jsx)(`code`,{className:`mono`,translate:`no`,children:a.address.toLowerCase()}),(0,M.jsx)(S,{text:a.address.toLowerCase()})]})]}),(0,M.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,M.jsx)(`span`,{children:d(`web3.label.x25519Public`)}),(0,M.jsxs)(`div`,{className:`mono-row`,children:[(0,M.jsx)(`code`,{className:`mono`,translate:`no`,children:a.publicKey}),(0,M.jsx)(S,{text:a.publicKey})]})]}),(0,M.jsxs)(`div`,{className:`web3-box-key-row`,children:[(0,M.jsx)(`span`,{children:d(`web3.label.x25519Private`)}),(0,M.jsxs)(`div`,{className:`mono-row danger`,children:[(0,M.jsx)(`code`,{className:`mono`,translate:`no`,children:i?a.privateKey:ce(a.privateKey)}),(0,M.jsx)(`button`,{className:`btn btn-icon`,onClick:l,title:d(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,M.jsx)(D,{size:14}):(0,M.jsx)(O,{size:14})})]})]})]}):null]})}function ue(e,t){return Number.isFinite(e)?t(e):`-`}function de({title:e,description:t,message:n,cipherText:r,decryptedText:i,error:o,encryptLabel:s,decryptLabel:c,messagePlaceholder:l,cipherPlaceholder:u,onMessageChange:d,onCipherTextChange:f,onEncrypt:p,onDecrypt:m}){let{t:h,formatDateTime:_}=k(),v=`box-message-${e.replaceAll(/\s+/g,`-`)}`,y=a(r);return(0,M.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,M.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{children:e}),(0,M.jsx)(`p`,{children:t})]})}),(0,M.jsx)(`label`,{className:`web3-box-label`,htmlFor:v,children:h(`web3.box.plaintext`)}),(0,M.jsx)(`textarea`,{id:v,className:`textarea`,value:n,onChange:e=>d(e.target.value),rows:4,placeholder:l,translate:`no`}),(0,M.jsxs)(`div`,{className:`web3-box-actions`,children:[(0,M.jsxs)(`button`,{className:`btn btn-primary`,onClick:p,type:`button`,children:[(0,M.jsx)(g,{size:16}),s]}),(0,M.jsxs)(`button`,{className:`btn btn-secondary`,onClick:m,type:`button`,children:[(0,M.jsx)(w,{size:16}),c]})]}),o&&(0,M.jsx)(`p`,{className:`web3-tools-danger`,children:o}),(0,M.jsxs)(`div`,{className:`web3-box-result-grid`,children:[(0,M.jsxs)(`div`,{className:`web3-box-result`,children:[(0,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:h(`web3.box.ciphertext`)})}),(0,M.jsx)(`textarea`,{className:`textarea mono`,value:r,onChange:e=>f(e.target.value),rows:5,placeholder:u,translate:`no`})]}),(0,M.jsxs)(`div`,{className:`web3-box-result`,children:[(0,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:h(`web3.box.decryptResult`)})}),(0,M.jsx)(`textarea`,{className:`textarea mono`,value:i,readOnly:!0,rows:5,placeholder:h(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]}),y&&(0,M.jsxs)(`div`,{className:`web3-box-token-meta`,children:[(0,M.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,M.jsx)(`span`,{children:h(`web3.box.timestamp`)}),(0,M.jsx)(`code`,{translate:`no`,children:ue(y.timestampMs,_)})]}),(0,M.jsxs)(`div`,{className:`web3-box-token-meta-row`,children:[(0,M.jsx)(`span`,{children:h(`web3.box.nonce`)}),(0,M.jsx)(`code`,{translate:`no`,children:y.nonce})]})]})]})}function fe(e){let{t}=k();return(0,M.jsxs)(`div`,{className:`web3-box-workspace`,children:[(0,M.jsxs)(`div`,{className:`web3-box-grid`,children:[(0,M.jsx)(le,{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,M.jsx)(le,{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,M.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,M.jsx)(de,{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,M.jsx)(de,{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,M.jsxs)(`div`,{className:`web3-box-flow-grid`,children:[(0,M.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,M.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{children:t(`web3.box.encryptTitle`)}),(0,M.jsx)(`p`,{children:t(`web3.box.encryptDesc`)})]})}),(0,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,M.jsxs)(`div`,{className:`input-wrap`,children:[(0,M.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,M.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxEncryptShowPrivateKeyToggle,type:`button`,children:e.boxEncryptShowPrivateKey?(0,M.jsx)(O,{size:16}):(0,M.jsx)(D,{size:16})})]}),(0,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,M.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,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:t(`web3.box.plaintext`)})}),(0,M.jsx)(`textarea`,{className:`textarea`,value:e.boxEncryptMessage,onChange:t=>e.onBoxEncryptMessageChange(t.target.value),rows:4,placeholder:t(`web3.box.messagePlaceholder`),translate:`no`}),(0,M.jsx)(`div`,{className:`web3-box-actions`,children:(0,M.jsxs)(`button`,{className:`btn btn-primary`,onClick:e.onEncryptOnly,type:`button`,children:[(0,M.jsx)(g,{size:16}),t(`web3.box.encryptTitle`)]})}),e.boxEncryptError&&(0,M.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxEncryptError}),(0,M.jsxs)(`div`,{className:`web3-box-result`,children:[(0,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,M.jsx)(`textarea`,{className:`textarea mono`,value:e.boxEncryptCipherText,readOnly:!0,rows:5,placeholder:t(`web3.box.encryptResultPlaceholder`),translate:`no`})]})]}),(0,M.jsxs)(`section`,{className:`web3-box-flow`,children:[(0,M.jsx)(`div`,{className:`web3-box-flow-header`,children:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{children:t(`web3.box.decryptTitle`)}),(0,M.jsx)(`p`,{children:t(`web3.box.decryptDesc`)})]})}),(0,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:t(`web3.box.sender`)})}),(0,M.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,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:t(`web3.box.recipient`)})}),(0,M.jsxs)(`div`,{className:`input-wrap`,children:[(0,M.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,M.jsx)(`button`,{className:`input-eye`,onClick:e.onBoxDecryptShowPrivateKeyToggle,type:`button`,children:e.boxDecryptShowPrivateKey?(0,M.jsx)(O,{size:16}):(0,M.jsx)(D,{size:16})})]}),(0,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:t(`web3.box.ciphertext`)})}),(0,M.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,M.jsx)(`div`,{className:`web3-box-actions`,children:(0,M.jsxs)(`button`,{className:`btn btn-secondary`,onClick:e.onDecryptOnly,type:`button`,children:[(0,M.jsx)(w,{size:16}),t(`web3.box.decryptTitle`)]})}),e.boxDecryptError&&(0,M.jsx)(`p`,{className:`web3-tools-danger`,children:e.boxDecryptError}),(0,M.jsxs)(`div`,{className:`web3-box-result`,children:[(0,M.jsx)(`label`,{className:`web3-box-result-header`,children:(0,M.jsx)(`span`,{children:t(`web3.box.decryptResult`)})}),(0,M.jsx)(`textarea`,{className:`textarea mono`,value:e.boxDecryptResult,readOnly:!0,rows:5,placeholder:t(`web3.box.decryptResultPlaceholder`),translate:`no`})]})]})]})]})}function N({icon:e,message:t,className:n=`empty-state glass`}){return(0,M.jsxs)(`div`,{className:n,children:[(0,M.jsx)(`div`,{className:`empty-state-icon`,children:e}),(0,M.jsx)(`p`,{children:t})]})}function pe({label:e,pem:t,filename:n}){let{t:r}=k();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,M.jsxs)(`div`,{className:`web3-pem-block`,children:[(0,M.jsxs)(`div`,{className:`web3-pem-header`,children:[(0,M.jsx)(`span`,{className:`web3-pem-label`,children:e}),(0,M.jsxs)(`div`,{className:`web3-pem-actions`,children:[(0,M.jsx)(S,{text:t,label:r(`common.copy`),className:`btn btn-sm`,iconSize:14}),(0,M.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:i,title:r(`common.download`),children:[(0,M.jsx)(_,{size:14}),r(`common.download`)]})]})]}),(0,M.jsx)(`textarea`,{className:`textarea mono`,value:t,readOnly:!0,rows:6,translate:`no`})]})}function me({walletResult:e,publicPem:t,privatePem:n}){let{t:r}=k();if(!t||!n)return(0,M.jsx)(N,{icon:(0,M.jsx)(g,{size:36}),message:r(`web3.empty.pem`)});let i=e?.username||`wallet`;return(0,M.jsxs)(`div`,{className:`web3-pem-list`,children:[(0,M.jsx)(pe,{label:`${i}.pub`,pem:t,filename:`${i}.pub`}),(0,M.jsx)(pe,{label:`${i}.pem`,pem:n,filename:`${i}.pem`})]})}var P=Object.defineProperty,F=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,L=(e,t,n)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t)=>{for(var n in t||={})he.call(t,n)&&L(e,n,t[n]);if(F)for(var n of F(t))I.call(t,n)&&L(e,n,t[n]);return e},z=(e,t)=>{var n={};for(var r in e)he.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&F)for(var r of F(e))t.indexOf(r)<0&&I.call(e,r)&&(n[r]=e[r]);return n},B;(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})(B||={}),(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||={})})(B||={}),(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||={})})(B||={});var V=B,ge={L:V.QrCode.Ecc.LOW,M:V.QrCode.Ecc.MEDIUM,Q:V.QrCode.Ecc.QUARTILE,H:V.QrCode.Ecc.HIGH},H=128,_e=`L`,U=`#FFFFFF`,W=`#000000`,G=!1,K=1,ve=4,ye=0,be=.1;function q(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 xe(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 Se(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*be),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 Ce(e,t){return t==null?e?ve:ye:Math.max(Math.floor(t),0)}function we({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=j.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...V.QrSegment.makeSegments(t)),e),[]);return V.QrCode.encodeSegments(r,ge[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=j.useMemo(()=>{let e=c.getModules(),t=Ce(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:Se(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Te=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Ee=j.forwardRef(function(e,t){let n=e,{value:r,size:i=H,level:a=_e,bgColor:o=U,fgColor:s=W,includeMargin:c=G,minVersion:l=K,boostLevel:u,marginSize:d,imageSettings:f}=n,p=z(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=z(p,[`style`]),g=f?.src,_=j.useRef(null),v=j.useRef(null),y=j.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=j.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=we({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});j.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=xe(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,Te?t.fill(new Path2D(q(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)}}),j.useEffect(()=>{x(!1)},[g]);let E=R({height:i,width:i},m),ee=null;return g!=null&&(ee=j.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),j.createElement(j.Fragment,null,j.createElement(`canvas`,R({style:E,height:i,width:i,ref:y,role:`img`},h)),ee)});Ee.displayName=`QRCodeCanvas`;var J=j.forwardRef(function(e,t){let n=e,{value:r,size:i=H,level:a=_e,bgColor:o=U,fgColor:s=W,includeMargin:c=G,minVersion:l=K,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=z(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=we({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=xe(g,v.excavation)),b=j.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=q(y,h);return j.createElement(`svg`,R({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&j.createElement(`title`,null,d),j.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),j.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});J.displayName=`QRCodeSVG`;function De({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:m,onToggleDerivePrivateKey:g,onDerive:_}){let{t:v}=k(),y=e?.address||``;return!e||!y?(0,M.jsx)(N,{icon:(0,M.jsx)(E,{size:36}),message:v(`web3.empty.walletTools`)}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,M.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:u,children:[(0,M.jsx)(ae,{size:14}),v(s?`web3.action.hideAddressQr`:`web3.action.showAddressQr`),s?(0,M.jsx)(ie,{size:14}):(0,M.jsx)(h,{size:14})]}),s&&(0,M.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,M.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,M.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:y}),(0,M.jsx)(S,{text:y})]}),(0,M.jsx)(`div`,{className:`qr-wrap`,children:(0,M.jsx)(J,{value:y,size:200})})]})]}),t&&(0,M.jsxs)(`div`,{className:`web3-tools-section`,children:[(0,M.jsxs)(`button`,{className:`web3-tools-toggle`,onClick:d,children:[(0,M.jsx)(w,{size:14}),v(c?`web3.action.hideMnemonic`:`web3.action.showMnemonic`),c?(0,M.jsx)(ie,{size:14}):(0,M.jsx)(h,{size:14})]}),c&&(0,M.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,M.jsxs)(`div`,{className:`web3-mnemonic-card`,children:[(0,M.jsx)(`p`,{className:`web3-mnemonic-text`,translate:`no`,children:t}),(0,M.jsx)(S,{text:t})]}),(0,M.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,M.jsx)(oe,{size:14}),v(`web3.warning.mnemonic`)]}),(0,M.jsx)(`button`,{className:`web3-tools-toggle`,onClick:f,children:v(l?`web3.action.hideMnemonicQr`:`web3.action.showMnemonicQr`)}),l&&(0,M.jsx)(`div`,{className:`qr-wrap`,children:(0,M.jsx)(J,{value:t,size:260})})]})]}),t&&(0,M.jsxs)(`div`,{className:`web3-mnemonic-reveal`,children:[(0,M.jsx)(`div`,{children:(0,M.jsx)(`button`,{className:`btn btn-primary`,onClick:_,children:v(`web3.action.deriveAddresses`,{count:n})})}),(0,M.jsxs)(`p`,{className:`web3-tools-danger`,children:[(0,M.jsx)(oe,{size:14}),v(`web3.warning.privateKey`)]}),r.length>0&&(0,M.jsx)(`div`,{className:`web3-derive-table-wrap`,children:(0,M.jsxs)(`table`,{className:`web3-derive-table`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{onClick:p,className:`web3-derive-th`,children:v(`web3.label.account`)}),(0,M.jsx)(`th`,{onClick:m,className:`web3-derive-th`,children:v(`web3.label.address`)}),(0,M.jsx)(`th`,{onClick:g,className:`web3-derive-th danger`,children:v(`web3.label.privateKeyToggle`,{action:v(o?`web3.action.hide`:`web3.action.show`)})})]})}),(0,M.jsx)(`tbody`,{children:r.map(e=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`td`,{children:i?e.index+1:``}),(0,M.jsx)(`td`,{translate:`no`,children:a?e.address:``}),(0,M.jsx)(`td`,{className:`danger`,children:(0,M.jsx)(`span`,{translate:`no`,children:o?e.privateKey:``})})]},e.index))})]})})]})]})}function Y({title:e,icon:t,children:n,accent:r=!1}){return(0,M.jsxs)(`div`,{className:`web3-key-card ${r?`accent`:``}`,children:[(0,M.jsxs)(`div`,{className:`web3-key-card-header`,children:[(0,M.jsx)(`span`,{className:`web3-key-card-icon`,children:t}),(0,M.jsx)(`span`,{className:`web3-key-card-title`,children:e})]}),(0,M.jsx)(`div`,{className:`web3-key-card-body`,translate:`no`,children:n})]})}function Oe(e){return e?`•`.repeat(Math.min(e.length,32)):`-`}function ke({walletResult:e,keys:t,ipns:n,avatarSrc:r,showPrivateKey:i,onTogglePrivateKey:a}){let{t:o}=k(),s=e?.address||``;return!e||!s?(0,M.jsx)(N,{icon:(0,M.jsx)(b,{size:36}),message:o(`web3.empty.identity`)}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`web3-identity-card`,children:[(0,M.jsx)(`img`,{src:r,alt:`avatar`,className:`web3-identity-avatar`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`web3-identity-name`,children:e.username||o(`web3.notSignedIn`)}),(0,M.jsxs)(`div`,{className:`web3-identity-address`,children:[(0,M.jsx)(`code`,{translate:`no`,children:s.toLowerCase()}),(0,M.jsx)(S,{text:s.toLowerCase()}),(0,M.jsxs)(`a`,{href:`https://debank.com/profile/${s}`,target:`_blank`,rel:`noopener noreferrer`,className:`link`,children:[(0,M.jsx)(v,{size:14}),o(`web3.action.view`)]})]})]})]}),t&&(0,M.jsxs)(`div`,{className:`web3-key-grid`,children:[(0,M.jsx)(Y,{title:o(`web3.label.ed25519Public`),icon:(0,M.jsx)(y,{size:18}),children:(0,M.jsxs)(`div`,{className:`mono-row`,children:[(0,M.jsx)(`code`,{className:`mono`,translate:`no`,children:t.ed_public_key}),(0,M.jsx)(S,{text:t.ed_public_key})]})}),(0,M.jsx)(Y,{title:o(`web3.label.x25519Public`),icon:(0,M.jsx)(w,{size:18}),children:(0,M.jsxs)(`div`,{className:`mono-row`,children:[(0,M.jsx)(`code`,{className:`mono`,translate:`no`,children:t.public_key}),(0,M.jsx)(S,{text:t.public_key})]})}),(0,M.jsx)(Y,{title:o(`web3.label.combinedPrivate`),icon:(0,M.jsx)(se,{size:18}),accent:!0,children:(0,M.jsxs)(`div`,{className:`mono-row danger`,children:[(0,M.jsx)(`code`,{className:`mono`,translate:`no`,children:i?t.private_key:Oe(t.private_key)}),(0,M.jsx)(`button`,{className:`btn btn-icon`,onClick:a,title:o(i?`web3.action.hidePrivateKey`:`web3.action.showPrivateKey`),type:`button`,children:i?(0,M.jsx)(D,{size:14}):(0,M.jsx)(O,{size:14})})]})}),(0,M.jsx)(Y,{title:`IPNS ID`,icon:(0,M.jsx)(A,{size:18}),children:(0,M.jsxs)(`div`,{className:`mono-row`,children:[(0,M.jsx)(`code`,{className:`mono`,translate:`no`,children:n}),(0,M.jsx)(S,{text:n})]})})]})]})}function Ae({username:e,password:t,showPassword:n,generating:r,onUsernameChange:i,onPasswordChange:a,onTogglePassword:o,onGenerate:s}){let{t:c}=k();return(0,M.jsxs)(`div`,{className:`input-panel`,children:[(0,M.jsxs)(`div`,{className:`web3-tools-inputs`,children:[(0,M.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,M.jsxs)(`div`,{className:`input-wrap`,children:[(0,M.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,M.jsx)(`button`,{className:`input-eye`,onClick:o,type:`button`,children:n?(0,M.jsx)(O,{size:16}):(0,M.jsx)(D,{size:16})})]})]}),(0,M.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:s,disabled:!e.trim()||r,type:`button`,children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`spinner`}),c(`web3.login.generating`)]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(E,{size:16}),c(`web3.login.generateAndSignIn`)]})})]})}var je=e=>btoa(String.fromCharCode(...e)),Me=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${je(a).match(/.{1,64}/g)?.join(`
|
|
2
|
+
`)}\n-----END PRIVATE KEY-----`},Ne=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${je(i).match(/.{1,64}/g)?.join(`
|
|
3
|
+
`)}\n-----END PUBLIC KEY-----`},X=[`wallet`,`pem`,`export`,`EA`];function Pe(){let e=window.location.hash.replace(`#`,``);return X.includes(e)?e:`wallet`}function Fe(){let{t:e}=k(),t=ne(),n=re(e=>e.isDarkMode),a=re(e=>e.setIsDarkMode),o=re(e=>e.addToast),f=u(e=>e.setUserIdentity),[h,_]=(0,j.useState)(`wallet`),[v,y]=(0,j.useState)(``),[S,D]=(0,j.useState)(``),[O,ie]=(0,j.useState)(!1),[A,ae]=(0,j.useState)(null),[oe,se]=(0,j.useState)(null),[ce,le]=(0,j.useState)(``),[ue,de]=(0,j.useState)(``),[N,pe]=(0,j.useState)(``),[P,F]=(0,j.useState)(``),[he,I]=(0,j.useState)([]),[L,R]=(0,j.useState)(0),[z,B]=(0,j.useState)(!0),[V,ge]=(0,j.useState)(!0),[H,_e]=(0,j.useState)(!1),[U,W]=(0,j.useState)(!1),[G,K]=(0,j.useState)(!1),[ve,ye]=(0,j.useState)(!1),[be,q]=(0,j.useState)(!1),[xe,Se]=(0,j.useState)(!1),[Ce,we]=(0,j.useState)(``),[Te,Ee]=(0,j.useState)(``),[J,Y]=(0,j.useState)(!1),[Oe,je]=(0,j.useState)(!1),[X,Fe]=(0,j.useState)(null),[Ie,Le]=(0,j.useState)(``),[Re,ze]=(0,j.useState)(``),[Be,Ve]=(0,j.useState)(!1),[He,Ue]=(0,j.useState)(!1),[Z,We]=(0,j.useState)(null),[Ge,Ke]=(0,j.useState)(`Hello B. This is from A.`),[qe,Je]=(0,j.useState)(``),[Ye,Xe]=(0,j.useState)(``),[Ze,Qe]=(0,j.useState)(``),[$e,et]=(0,j.useState)(`Hello A. This is from B.`),[tt,nt]=(0,j.useState)(``),[rt,it]=(0,j.useState)(``),[at,ot]=(0,j.useState)(``),[st,ct]=(0,j.useState)(``),[lt,ut]=(0,j.useState)(``),[dt,ft]=(0,j.useState)(``),[pt,mt]=(0,j.useState)(``),[ht,Q]=(0,j.useState)(``),[gt,_t]=(0,j.useState)(!1),[vt,yt]=(0,j.useState)(``),[bt,xt]=(0,j.useState)(``),[St,Ct]=(0,j.useState)(``),[wt,Tt]=(0,j.useState)(``),[Et,$]=(0,j.useState)(``),[Dt,Ot]=(0,j.useState)(!1);(0,j.useEffect)(()=>{_(Pe());let e=()=>_(Pe());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let kt=e=>{_(e),window.location.hash=e},At=(0,j.useCallback)(async()=>{if(!v.trim())return;Se(!0),await new Promise(e=>setTimeout(e,0));let t=d(v.trim(),S),n=`${t.username}#${t.address.slice(-4).toUpperCase()}`;ae(t),f({...t,displayName:n}),o(e(`login.toast.signedIn`,{username:t.username}),`success`),F(i(t.danger));let r=l(t.danger);se(r),le(x(r.private_key,r.ed_public_key));let a=C(r.private_key,r.ed_public_key);de(Me(a.secretKey)),pe(Ne(a.publicKey)),I([]),R(0),W(!1),K(!1),ye(!1),q(!1),Se(!1)},[o,S,f,e,v]);function jt(t,n,r){let i=t.trim();if(!i)return;let a=d(i,n),s=l(a.danger);r({username:a.username,address:a.address,publicKey:s.public_key,privateKey:s.private_key}),Xe(``),Qe(``),it(``),ot(``),o(e(`web3.toast.accountGenerated`),`success`)}function Mt({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 Nt({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=s(r,{senderPublicKey:t.publicKey,recipientPrivateKey:n.privateKey});if(!o){a(e(`web3.error.decryptFailed`)),i(``);return}i(o),a(``)}function Pt(){if(!st.trim()){Q(e(`web3.error.senderPublicRequired`));return}if(!lt.trim()){Q(e(`web3.error.recipientPrivateRequired`));return}if(!dt.trim()){Q(e(`web3.error.cipherRequired`));return}let t=s(dt,{senderPublicKey:st.trim(),recipientPrivateKey:lt.trim()});if(!t){Q(e(`web3.error.decryptFailed`)),mt(``);return}mt(t),Q(``)}function Ft(){if(!vt.trim()){$(e(`web3.error.senderPrivateRequired`));return}if(!bt.trim()){$(e(`web3.error.recipientPublicRequired`));return}if(!St.trim()){$(e(`web3.error.messageRequired`));return}Tt(r(St,{senderPrivateKey:vt.trim(),recipientPublicKey:bt.trim()})),$(``)}let It=()=>{if(!P)return;let e=[];for(let t=L;t<L+10;t++){let n=`m/44'/60'/0'/0/${t}`,r=c.fromPhrase(P,void 0,n);e.push({index:t,address:r.address,privateKey:r.privateKey})}I(t=>[...t,...e]),R(e=>e+10)},Lt=te(A?.address||void 0),Rt=h===`wallet`?`web3.view.wallet`:h===`pem`?`web3.view.pem`:h===`EA`?`web3.view.asymmetric`:`web3.view.export`,zt=[{id:`wallet`,icon:(0,M.jsx)(b,{size:16}),labelKey:`web3.view.wallet`},{id:`pem`,icon:(0,M.jsx)(g,{size:16}),labelKey:`web3.view.pem`},{id:`export`,icon:(0,M.jsx)(E,{size:16}),labelKey:`web3.view.export`},{id:`EA`,icon:(0,M.jsx)(w,{size:16}),labelKey:`web3.view.asymmetric`}],Bt=h!==`EA`;return(0,M.jsx)(T,{sidebar:({closeSidebar:n})=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`button`,{type:`button`,className:`sidebar-header sidebar-header-link`,onClick:t,children:[(0,M.jsx)(ee,{size:18}),(0,M.jsx)(`h1`,{children:`MOST PEOPLE`})]}),(0,M.jsx)(`nav`,{className:`sidebar-nav`,children:zt.map(t=>(0,M.jsxs)(`button`,{onClick:()=>{kt(t.id),n()},className:`sidebar-nav-btn ${h===t.id?`active`:``}`,children:[t.icon,(0,M.jsx)(`span`,{children:e(t.labelKey)})]},t.id))})]}),headerTitle:(0,M.jsx)(`h2`,{className:`header-title`,children:e(Rt)}),headerRight:(0,M.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>a(!n),title:e(`common.theme.toggle`),children:n?(0,M.jsx)(m,{size:16}):(0,M.jsx)(p,{size:16})}),children:(0,M.jsx)(`div`,{className:`web3-page`,children:(0,M.jsxs)(`div`,{className:`web3-container ${h===`EA`?`wide`:``}`,children:[Bt&&(0,M.jsx)(Ae,{username:v,password:S,showPassword:O,generating:xe,onUsernameChange:y,onPasswordChange:D,onTogglePassword:()=>ie(!O),onGenerate:At}),h===`wallet`&&(0,M.jsx)(ke,{walletResult:A,keys:oe,ipns:ce,avatarSrc:Lt,showPrivateKey:be,onTogglePrivateKey:()=>q(!be)}),h===`pem`&&(0,M.jsx)(me,{walletResult:A,publicPem:N,privatePem:ue}),h===`export`&&(0,M.jsx)(De,{walletResult:A,mnemonicPhrase:P,deriveBatch:10,deriveList:he,deriveShowIndex:z,deriveShowAddress:V,deriveShowPrivateKey:H,showAddressQr:U,showMnemonicReveal:G,showMnemonicQr:ve,onToggleAddressQr:()=>W(!U),onToggleMnemonicReveal:()=>K(!G),onToggleMnemonicQr:()=>ye(!ve),onToggleDeriveIndex:()=>B(!z),onToggleDeriveAddress:()=>ge(!V),onToggleDerivePrivateKey:()=>_e(!H),onDerive:It}),h===`EA`&&(0,M.jsx)(fe,{boxAUsername:Ce,boxAPassword:Te,boxAShowPassword:J,boxAShowPrivateKey:Oe,boxAAccount:X,boxBUsername:Ie,boxBPassword:Re,boxBShowPassword:Be,boxBShowPrivateKey:He,boxBAccount:Z,boxABMessage:Ge,boxABCipherText:qe,boxABDecryptedText:Ye,boxABError:Ze,boxBAMessage:$e,boxBACipherText:tt,boxBADecryptedText:rt,boxBAError:at,boxEncryptSenderPrivateKey:vt,boxEncryptRecipientPublicKey:bt,boxEncryptMessage:St,boxEncryptCipherText:wt,boxEncryptError:Et,boxEncryptShowPrivateKey:Dt,boxDecryptSenderPublicKey:st,boxDecryptRecipientPrivateKey:lt,boxDecryptCipherText:dt,boxDecryptResult:pt,boxDecryptError:ht,boxDecryptShowPrivateKey:gt,onBoxAUsernameChange:we,onBoxAPasswordChange:Ee,onBoxAShowPasswordToggle:()=>Y(!J),onBoxAShowPrivateKeyToggle:()=>je(!Oe),onGenerateBoxA:()=>jt(Ce,Te,Fe),onBoxBUsernameChange:Le,onBoxBPasswordChange:ze,onBoxBShowPasswordToggle:()=>Ve(!Be),onBoxBShowPrivateKeyToggle:()=>Ue(!He),onGenerateBoxB:()=>jt(Ie,Re,We),onBoxABMessageChange:Ke,onBoxABCipherTextChange:Je,onEncryptBoxAB:()=>Mt({senderAccount:X,recipientAccount:Z,message:Ge,setCipherText:Je,setDecryptedText:Xe,setError:Qe}),onDecryptBoxAB:()=>Nt({senderAccount:X,recipientAccount:Z,cipherText:qe,setDecryptedText:Xe,setError:Qe}),onBoxBAMessageChange:et,onBoxBACipherTextChange:nt,onEncryptBoxBA:()=>Mt({senderAccount:Z,recipientAccount:X,message:$e,setCipherText:nt,setDecryptedText:it,setError:ot}),onDecryptBoxBA:()=>Nt({senderAccount:Z,recipientAccount:X,cipherText:tt,setDecryptedText:it,setError:ot}),onBoxEncryptSenderPrivateKeyChange:yt,onBoxEncryptRecipientPublicKeyChange:xt,onBoxEncryptMessageChange:Ct,onBoxEncryptShowPrivateKeyToggle:()=>Ot(!Dt),onEncryptOnly:Ft,onBoxDecryptSenderPublicKeyChange:ct,onBoxDecryptRecipientPrivateKeyChange:ut,onBoxDecryptCipherTextChange:ft,onBoxDecryptShowPrivateKeyToggle:()=>_t(!gt),onDecryptOnly:Pt})]})})})}var Ie=f(`/web3/`)({component:Fe});export{Ie as Route};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{b as r,g as i,v as a}from"./userStore-q0BBZsIV.js";import{t as o}from"./cloud-DAGFCFIp.js";import{t as s}from"./download-Bhqn6hL1.js";import{R as c}from"./index--p9MKNEl.js";import{t as l}from"./MarketingHeader-B3vYocUz.js";import{n as u}from"./format-CR8oUWq6.js";var d=i(`apple`,[[`path`,{d:`M12 6.528V3a1 1 0 0 1 1-1h0`,key:`11qiee`}],[`path`,{d:`M18.237 21A15 15 0 0 0 22 11a6 6 0 0 0-10-4.472A6 6 0 0 0 2 11a15.1 15.1 0 0 0 3.763 10 3 3 0 0 0 3.648.648 5.5 5.5 0 0 1 5.178 0A3 3 0 0 0 18.237 21`,key:`110c12`}]]),f=i(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),p=i(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),m=i(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),h=t(e(),1),g=n(),_=`https://github.com/most-people/most/releases/latest`,v=`${`https://download.most.box`.replace(/\/+$/,``)}/releases/latest.json`,y=[{platform:`windows`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:_},{platform:`windows`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:_},{platform:`macos`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:_},{platform:`macos`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:_},{platform:`linux`,arch:`x64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:_},{platform:`linux`,arch:`arm64`,kind:`installer`,filename:`GitHub Releases`,githubUrl:_}],b={windows:{name:`Windows`,ext:`.exe`,descKey:`download.platform.windows.desc`,icon:m},macos:{name:`macOS`,ext:`.dmg`,descKey:`download.platform.macos.desc`,icon:d},linux:{name:`Linux`,ext:`.AppImage`,descKey:`download.platform.linux.desc`,icon:p}};function x(e){return typeof e==`object`&&!!e}function S(e){return x(e)?[`windows`,`macos`,`linux`].includes(String(e.platform))&&[`x64`,`arm64`].includes(String(e.arch))&&(e.kind===`installer`||e.kind===`updater`)&&typeof e.filename==`string`&&typeof e.githubUrl==`string`&&(typeof e.r2Url==`string`||e.r2Url===void 0):!1}function C(e){return!x(e)||typeof e.version!=`string`||typeof e.publishedAt!=`string`||!Array.isArray(e.assets)?!1:e.assets.every(S)}function w(){return[navigator.userAgentData?.platform,navigator.platform,navigator.userAgent].filter(Boolean).join(` `).toLowerCase()}function T(){if(typeof navigator>`u`)return`windows:x64`;let e=w(),t=/arm|aarch64/.test(e)?`arm64`:`x64`;return/mac|darwin/.test(e)?`macos:${t}`:/linux/.test(e)?`linux:${t}`:`windows:${t}`}function E(){let{t:e}=c(),[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(v?`loading`:`fallback`),[a,l]=(0,h.useState)(`windows:x64`),[d,p]=(0,h.useState)(`r2`);(0,h.useEffect)(()=>{l(T())},[]),(0,h.useEffect)(()=>{if(!v)return;let e=new AbortController;return fetch(v,{cache:`no-store`,signal:e.signal}).then(e=>{if(!e.ok)throw Error(`Manifest request failed: ${e.status}`);return e.json()}).then(e=>{if(!C(e))throw Error(`Invalid download manifest`);n(e),i(`ready`)}).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||(n(null),i(`fallback`))}),()=>e.abort()},[]),(0,h.useEffect)(()=>{r===`fallback`&&p(`github`)},[r]);let m=t?.assets.filter(e=>e.kind===`installer`)||[],_=m.length?m:y,x=_.some(e=>e.r2Url),S=d===`r2`&&x?`r2`:`github`;return(0,g.jsxs)(`div`,{className:`download-options`,children:[(0,g.jsxs)(`div`,{className:`ui-segmented-control download-source-tabs`,role:`tablist`,"aria-label":e(`download.source.label`),children:[(0,g.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`r2`,disabled:!x,className:S===`r2`?`ui-segmented-option download-source-tab is-active`:`ui-segmented-option download-source-tab`,onClick:()=>p(`r2`),children:[(0,g.jsx)(o,{size:15}),`Cloudflare R2`]}),(0,g.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`github`,className:S===`github`?`ui-segmented-option download-source-tab is-active`:`ui-segmented-option download-source-tab`,onClick:()=>p(`github`),children:[(0,g.jsx)(f,{size:15}),`GitHub Releases`]})]}),(0,g.jsx)(`p`,{className:`download-source-note`,children:r===`loading`?e(`download.source.loading`):r===`ready`&&t?e(`download.source.ready`,{version:t.version}):e(`download.source.fallback`)}),(0,g.jsx)(`div`,{className:`download-platform-grid`,children:_.map(t=>{let n=b[t.platform],r=n.icon,i=`${t.platform}:${t.arch}`,o=S===`r2`&&t.r2Url?t.r2Url:t.githubUrl,c=i===a;return(0,g.jsxs)(`article`,{className:c?`download-platform-card is-recommended`:`download-platform-card`,children:[(0,g.jsx)(`div`,{className:`download-platform-icon`,children:(0,g.jsx)(r,{size:32})}),(0,g.jsxs)(`div`,{className:`download-platform-content`,children:[(0,g.jsxs)(`div`,{className:`download-platform-heading`,children:[(0,g.jsx)(`h3`,{children:n.name}),(0,g.jsx)(`span`,{children:t.arch})]}),(0,g.jsx)(`p`,{children:e(n.descKey)}),(0,g.jsxs)(`dl`,{className:`download-platform-meta`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`dt`,{children:e(`download.platform.source`)}),(0,g.jsx)(`dd`,{children:S===`r2`&&t.r2Url?e(`download.source.r2Mirror`):`GitHub Releases`})]}),t.size?(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`dt`,{children:e(`download.platform.size`)}),(0,g.jsx)(`dd`,{children:u(t.size)})]}):null,t.cid?(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`dt`,{children:`CID`}),(0,g.jsx)(`dd`,{children:t.cid.slice(0,12)})]}):null]}),(0,g.jsx)(`div`,{className:`download-platform-actions`,children:(0,g.jsxs)(`a`,{href:o,className:`btn btn-primary`,children:[(0,g.jsx)(s,{size:16}),e(`download.platform.action`,{ext:n.ext})]})})]}),c?(0,g.jsx)(`span`,{className:`download-recommended-badge`,children:e(`download.platform.current`)}):null]},i)})})]})}var D=[{featureKey:`download.comparison.node`,webKey:`download.comparison.webConnectsNode`,desktopKey:`download.comparison.desktopBuiltinNode`},{featureKey:`download.comparison.fileSharing`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopFull`},{featureKey:`download.comparison.verification`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopFull`},{featureKey:`download.comparison.seeding`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktopDefaultOn`},{featureKey:`download.comparison.largeFiles`,webKey:`download.comparison.webDependsNode`,desktopKey:`download.comparison.desktop10gb`}];function O(){let{t:e}=c();return(0,h.useEffect)(()=>{document.title=e(`download.meta.title`)},[e]),(0,g.jsxs)(`div`,{className:`download-page`,children:[(0,g.jsx)(l,{}),(0,g.jsx)(`section`,{className:`download-hero`,children:(0,g.jsxs)(`div`,{className:`mkt-container`,children:[(0,g.jsx)(`div`,{className:`download-hero-icon`,children:(0,g.jsx)(s,{size:40})}),(0,g.jsx)(`h1`,{className:`download-hero-title`,children:e(`download.hero.title`)}),(0,g.jsx)(`p`,{className:`download-hero-desc`,children:e(`download.hero.desc`)})]})}),(0,g.jsx)(`section`,{className:`download-platforms`,children:(0,g.jsxs)(`div`,{className:`mkt-container`,children:[(0,g.jsx)(`h2`,{className:`download-section-title`,children:e(`download.platforms.title`)}),(0,g.jsx)(E,{})]})}),(0,g.jsx)(`section`,{className:`download-comparison`,children:(0,g.jsxs)(`div`,{className:`mkt-container`,children:[(0,g.jsx)(`h2`,{className:`download-section-title`,children:e(`download.comparison.title`)}),(0,g.jsx)(`div`,{className:`download-table-wrap`,children:(0,g.jsxs)(`table`,{className:`download-table`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`th`,{children:e(`download.comparison.feature`)}),(0,g.jsx)(`th`,{children:e(`download.comparison.web`)}),(0,g.jsx)(`th`,{children:e(`download.comparison.desktop`)})]})}),(0,g.jsx)(`tbody`,{children:D.map(t=>(0,g.jsxs)(`tr`,{children:[(0,g.jsx)(`td`,{children:e(t.featureKey)}),(0,g.jsx)(`td`,{className:`col-web`,children:e(t.webKey)}),(0,g.jsx)(`td`,{className:`col-desktop`,children:e(t.desktopKey)})]},t.featureKey))})]})})]})}),(0,g.jsx)(`section`,{className:`download-cta`,children:(0,g.jsx)(`div`,{className:`mkt-container`,children:(0,g.jsx)(`p`,{className:`download-hero-desc`,children:e(`download.npmNote`)})})}),(0,g.jsx)(`section`,{className:`download-cta`,children:(0,g.jsx)(`div`,{className:`mkt-container`,children:(0,g.jsx)(r,{to:`/`,className:`btn btn-primary`,children:e(`common.backHome`)})})}),(0,g.jsx)(`footer`,{className:`mkt-footer`,children:(0,g.jsx)(`div`,{className:`mkt-container`,children:(0,g.jsx)(`div`,{className:`mkt-footer-inner`,children:(0,g.jsx)(`p`,{className:`mkt-footer-copy`,children:`MostBox`})})})})]})}var k=a(`/download/`)({component:O});export{k as Route};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MilkdownEditor-CRA9oxMp.js","assets/jsx-runtime-Bt-cYkS5.js","assets/index--p9MKNEl.js","assets/userStore-q0BBZsIV.js","assets/useNavigate-DWlBD_-b.js","assets/index-DEu4udaa.css","assets/dist-zyJb88Zz.js","assets/dist-CbTzBiwL.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{g as r,o as i,s as ee,t as a,v as o}from"./userStore-q0BBZsIV.js";import{n as s}from"./useNavigate-DWlBD_-b.js";import{i as te,r as c}from"./LanguageToggle-HAJ3D6Ne.js";import{n as l,t as u}from"./lock-C0pdaery.js";import{n as d,t as f}from"./folder-BGJCjyba.js";import{t as p}from"./file-text-CFfvvCnM.js";import{t as ne}from"./AppShell-oF8wPXde.js";import{t as m}from"./notebook-pen-CfdFgaDE.js";import{t as h}from"./OpenSidebarButton-D3JRO-Hh.js";import{t as g}from"./plus-Mlh7r_bm.js";import{t as _}from"./save-DN4eprSt.js";import{t as re}from"./search-CbzMyENy.js";import{t as ie}from"./trash-2-zdhWec_U.js";import{A as ae,D as v,E as y,F as b,M as oe,R as x,T as se,V as ce,d as le,k as ue,l as de,m as S,t as C,u as fe}from"./index--p9MKNEl.js";import{t as pe}from"./SidebarAccount-8_hQAYXx.js";var me=r(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]),he=r(`pencil-ruler`,[[`path`,{d:`M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13`,key:`orapub`}],[`path`,{d:`m8 6 2-2`,key:`115y1s`}],[`path`,{d:`m18 16 2-2`,key:`ee94s4`}],[`path`,{d:`m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17`,key:`cfq27r`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),w=t(e(),1),T=n();function E(e){return e.type===`directory`?v(e.path?`${e.path}/${e.name}`:e.name):y(e)}function ge({target:e,directories:t,onMove:n,onClose:r}){let{t:i}=x(),ee=v(e.path||``),a=E(e),o=t.filter(t=>e.type===`directory`?t.path!==a&&!t.path.startsWith(`${a}/`):!0),[s,te]=(0,w.useState)(ee),[c,u]=(0,w.useState)(``),[p,ne]=(0,w.useState)(new Set),m=v(c),h=c.trim()?m:s,g=v(h)===ee,_=new Map;for(let e of o){let t=_.get(e.parentPath)||[];t.push(e),_.set(e.parentPath,t)}let re=o.filter(e=>{if(!e.parentPath)return!0;let t=e.parentPath.split(`/`).filter(Boolean);return t.every((e,n)=>p.has(t.slice(0,n+1).join(`/`)))}),ie=[{label:i(`note.root`),path:``},...s.split(`/`).filter(Boolean).map((e,t,n)=>({label:e,path:n.slice(0,t+1).join(`/`)}))];function y(e){te(v(e)),u(``)}function b(e){y(e),_.has(e)&&ne(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function oe(){g||n(h)}return(0,T.jsx)(le,{onClose:r,children:(0,T.jsxs)(`div`,{className:`note-move-modal`,onClick:e=>e.stopPropagation(),children:[(0,T.jsxs)(`div`,{className:`modal-header`,children:[(0,T.jsx)(`h3`,{children:i(`note.move.title`)}),(0,T.jsx)(`button`,{className:`btn btn-icon`,onClick:r,children:(0,T.jsx)(ae,{size:18})})]}),(0,T.jsxs)(`div`,{className:`note-move-target`,children:[(0,T.jsx)(`span`,{children:i(`note.move.moving`)}),(0,T.jsx)(`strong`,{translate:`no`,children:e.name})]}),(0,T.jsx)(`div`,{className:`note-move-path`,children:ie.map((e,t)=>(0,T.jsxs)(w.Fragment,{children:[t>0&&(0,T.jsx)(`span`,{children:`/`}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>y(e.path),children:(0,T.jsx)(`span`,{translate:e.path?`no`:`yes`,children:e.label})})]},e.path||`root`))}),(0,T.jsxs)(`div`,{className:`note-move-folder-list`,children:[(0,T.jsxs)(`button`,{type:`button`,className:`note-move-folder-item ${s===``?`selected`:``}`,onClick:()=>y(``),children:[(0,T.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,T.jsx)(f,{className:`note-move-folder-icon`,size:16}),(0,T.jsx)(`span`,{children:i(`note.root`)})]}),o.length===0?(0,T.jsx)(`p`,{className:`note-move-empty`,children:i(`note.move.noFolders`)}):re.map(e=>{let t=_.has(e.path),n=p.has(e.path);return(0,T.jsxs)(`button`,{type:`button`,className:`note-move-folder-item note-move-depth-${Math.min(e.depth,4)} ${s===e.path?`selected`:``}`,onClick:()=>b(e.path),children:[t?n?(0,T.jsx)(l,{className:`note-move-expander`,size:14}):(0,T.jsx)(d,{className:`note-move-expander`,size:14}):(0,T.jsx)(`span`,{className:`note-move-folder-spacer`}),(0,T.jsx)(f,{className:`note-move-folder-icon`,size:16}),(0,T.jsx)(`span`,{translate:`no`,children:e.name}),e.parentPath&&(0,T.jsx)(`small`,{translate:`no`,children:e.parentPath})]},e.path)})]}),(0,T.jsx)(`input`,{className:`input input-compact`,value:c,onChange:e=>u(e.target.value),placeholder:i(`note.move.pathPlaceholder`),translate:`no`}),(0,T.jsxs)(`div`,{className:`note-move-destination`,children:[(0,T.jsx)(`span`,{children:i(`note.move.destinationLabel`)}),(0,T.jsx)(`span`,{translate:h?`no`:`yes`,children:h||i(`note.root`)})]}),(0,T.jsxs)(`div`,{className:`modal-actions`,children:[(0,T.jsx)(`button`,{className:`btn btn-secondary`,onClick:r,children:i(`common.cancel`)}),(0,T.jsx)(`button`,{className:`btn btn-primary`,onClick:oe,disabled:g,children:i(`note.action.move`)})]})]})})}function _e({children:e}){return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`button`,{type:`button`,className:`sidebar-header sidebar-header-link`,onClick:ue(),children:[(0,T.jsx)(b,{size:18}),(0,T.jsx)(`h1`,{children:`MOST PEOPLE`})]}),e,(0,T.jsx)(pe,{})]})}var ve=(0,w.lazy)(async()=>({default:(await C(()=>import(`./MilkdownEditor-CRA9oxMp.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))).MilkdownEditor}));function ye(e){let t=new URLSearchParams(e),n=t.get(`mode`);return{cid:t.get(`cid`)||void 0,mode:n===`edit`?`edit`:void 0}}function be(e={}){let t=new URLSearchParams;e.cid&&t.set(`cid`,e.cid),e.mode&&t.set(`mode`,e.mode);let n=t.toString();return n?`/note/?${n}`:`/note/`}function xe(e,t){return e.isSecret||e.content.startsWith(`mp://1`)?t(`note.preview.encrypted`):String(e.content||``).replace(/```[\s\S]*?```/g,` `).replace(/!\[[^\]]*]\([^)]*\)/g,` `).replace(/\[([^\]]+)]\([^)]*\)/g,`$1`).replace(/[#>*_`~|-]/g,` `).replace(/\s+/g,` `).trim()||t(`note.preview.empty`)}var D={"note.error.nameRequired":`note.error.nameRequired`,"note.error.nameNoSlash":`note.error.nameNoSlash`,"note.error.nameNoBackslash":`note.error.nameNoBackslash`,"note.error.nameInvalid":`note.error.nameInvalid`,"note.error.nameConflict":`note.error.nameConflict`,"note.error.moveIntoSelf":`note.error.moveIntoSelf`};function O(e,t,n){let r=e instanceof Error?e.message:``,i=D[r];return i?n(i):r||t}function Se(e){return e.type===`directory`?v(e.path?`${e.path}/${e.name}`:e.name):y(e)}function Ce(e,t){let n=new Set;for(let t of e){let e=v(t.path).split(`/`).filter(Boolean);for(let t=0;t<e.length;t+=1)n.add(e.slice(0,t+1).join(`/`))}return Array.from(n).sort(t).map(e=>{let t=e.split(`/`);return{path:e,name:t[t.length-1]||e,parentPath:t.slice(0,-1).join(`/`),depth:Math.max(t.length-1,0)}})}function k(){let{t:e,formatDate:t,compareStrings:n}=x(),r=s(),o=ce({select:e=>e.searchStr}),l=(0,w.useMemo)(()=>ye(o),[o]),d=(0,w.useRef)(null),b=S(e=>e.addToast),le=S(e=>e.isDarkMode),ue=S(e=>e.setIsDarkMode),C=a(e=>e.wallet),pe=a(e=>e.openLoginModal),E=S(e=>e.notes),D=S(e=>e.notesPath),k=S(e=>e.setNotesPath),A=S(e=>e.saveNote),we=S(e=>e.deleteNote),Te=S(e=>e.renameNote),j=S(e=>e.localDataReady),M=l.cid||``,N=E.find(e=>e.cid===M),P=!!M,F=P&&l.mode===`edit`,[I,Ee]=(0,w.useState)(``),[L,R]=(0,w.useState)(null),[z,B]=(0,w.useState)(null),[V,H]=(0,w.useState)(null),[De,U]=(0,w.useState)(``),[W,G]=(0,w.useState)(``),[Oe,K]=(0,w.useState)(``),[q,J]=(0,w.useState)(``),[ke,Ae]=(0,w.useState)(``),[je,Y]=(0,w.useState)(``),[X,Me]=(0,w.useState)(!1),[Ne,Z]=(0,w.useState)(``),[Pe,Fe]=(0,w.useState)(!1);(0,w.useEffect)(()=>{if(!M){U(``),G(``);return}if(!N){U(``),G(j?e(`note.error.notFound`):``);return}if(N.content.startsWith(`mp://1`)){if(!C){U(``),G(e(`note.error.loginToDecrypt`));return}let t=i(N.content,C.danger);if(!t){U(``),G(e(`note.error.decryptFailed`));return}U(t),G(``);return}U(N.content||``),G(``)},[M,j,N,e,C]),(0,w.useEffect)(()=>{if(!F){Fe(!1);return}if(!M||!N){J(``),Ae(``),Y(``),Me(!1),Z(j?e(`note.error.notFound`):``);return}if(J(N.name),Ae(N.path||``),Me(N.isSecret===!0||N.content.startsWith(`mp://1`)),N.content.startsWith(`mp://1`)){if(!C){Y(``),Z(e(`note.error.loginToDecrypt`));return}let t=i(N.content,C.danger);if(!t){Y(``),Z(e(`note.error.decryptFailed`));return}Y(t),Z(``);return}Y(N.content||``),Z(``)},[M,F,j,N,e,C]),(0,w.useEffect)(()=>{K(N?.name||``)},[N?.cid,N?.name]);let Ie=(0,w.useMemo)(()=>se(E,D,I),[E,D,I]),Le=Ie.filter(e=>e.type===`file`).length,Re=N?.isSecret===!0||N?.content.startsWith(`mp://1`)===!0,ze=e(F?X?`note.privacy.secret`:`note.privacy.public`:Re?`note.privacy.secret`:`note.privacy.public`),Be=(0,w.useMemo)(()=>{let t=D.split(`/`).filter(Boolean);return[{label:e(`note.root`),path:``},...t.map((e,n)=>({label:e,path:t.slice(0,n+1).join(`/`)}))]},[D,e]),Ve=(0,w.useMemo)(()=>Ce(E,n),[n,E]);function Q(e={},t=!1){r({href:be(e),replace:t})}function He(e){Q({cid:e.cid})}function Ue(e){Q({cid:e.cid,mode:`edit`})}function $(){return C?!0:(pe(),!1)}function We(){Q(N?{cid:N.cid}:{})}async function Ge(){if($()){if(!N){b(e(`note.toast.notFound`),`error`);return}if(!q.trim()){b(e(`note.toast.nameRequired`),`warning`);return}Fe(!0);try{let t=d.current?.getMarkdown()??je,n=X?ee(t,C.danger):t,r=await A({cid:N.cid,name:q,path:ke,content:n,isSecret:X});Y(t),Q({cid:r},!0),b(e(`note.toast.saved`),`success`)}catch(t){b(O(t,e(`note.toast.saveFailed`),e),`error`)}finally{Fe(!1)}}}function Ke(){$()&&R({title:e(`note.create.title`),placeholder:e(`note.namePlaceholder`),confirmText:e(`note.create.action`),onConfirm:async t=>{if($())try{let n=await A({name:t,path:D,content:``,isSecret:!1});R(null),b(e(`note.toast.created`),`success`),Q({cid:n,mode:`edit`})}catch(t){b(O(t,e(`note.toast.createFailed`),e),`error`)}}})}async function qe(){if(!$()||!N)return;let t=Oe.trim();if(!t){K(N.name),b(e(`note.toast.nameRequired`),`warning`);return}if(t!==N.name)try{Te(y(N),N.path,t),b(e(`note.toast.renamed`),`success`)}catch(t){K(N.name),b(O(t,e(`note.toast.renameFailed`),e),`error`)}}function Je(e){$()&&H(e)}async function Ye(t){if(V)try{Te(Se(V),t,V.name),H(null),b(e(`note.toast.moved`),`success`)}catch(t){b(O(t,e(`note.toast.moveFailed`),e),`error`)}}function Xe(t){if(!$())return;let n=t.type===`directory`;B({title:e(n?`note.delete.folderTitle`:`note.delete.noteTitle`),message:e(`note.delete.message`,{name:t.name}),confirmText:e(`note.action.delete`),onConfirm:async()=>{we(n?void 0:t.cid,t.path,t.name),B(null),b(e(`note.toast.deleted`),`success`),t.type===`file`&&t.cid===M&&Q()}})}let Ze=(0,T.jsxs)(`div`,{className:`note-header-title`,children:[(0,T.jsx)(`h2`,{className:`header-title`,children:e(`note.title`)}),(0,T.jsx)(`span`,{children:e(`note.count`,{count:E.length})})]}),Qe=(0,T.jsx)(`div`,{className:`note-theme-wrap`,children:(0,T.jsx)(`button`,{className:`btn btn-icon`,onClick:()=>ue(!le),title:e(`common.theme.toggle`),"aria-label":e(`common.theme.toggle`),children:le?(0,T.jsx)(c,{size:16}):(0,T.jsx)(te,{size:16})})}),$e=(0,T.jsxs)(`section`,{className:`note-list-panel note-sidebar-list`,"aria-label":e(`note.listLabel`),children:[(0,T.jsxs)(`div`,{className:`note-list-header`,children:[(0,T.jsx)(`div`,{className:`note-current-location`,children:(0,T.jsx)(`div`,{className:`note-breadcrumbs`,children:Be.map((e,t)=>(0,T.jsxs)(w.Fragment,{children:[t>0&&(0,T.jsx)(`span`,{children:`/`}),(0,T.jsx)(`button`,{onClick:()=>k(e.path),children:(0,T.jsx)(`span`,{translate:e.path?`no`:`yes`,children:e.label})})]},e.path||`root`))})}),(0,T.jsx)(`span`,{className:`note-count`,children:e(`note.count`,{count:Le})})]}),(0,T.jsxs)(`div`,{className:`note-search`,children:[(0,T.jsx)(re,{size:16}),(0,T.jsx)(`input`,{className:`input input-flex`,value:I,onChange:e=>Ee(e.target.value),placeholder:e(`note.search.placeholder`)})]}),Ie.length===0?(0,T.jsxs)(`div`,{className:`ui-empty-state note-empty-state`,children:[(0,T.jsx)(m,{size:32}),(0,T.jsx)(`p`,{children:e(I?`note.empty.noMatches`:`note.empty.noNotes`)})]}):(0,T.jsx)(`div`,{className:`note-list`,children:Ie.map(n=>(0,T.jsx)(`article`,{className:`ui-list-item note-list-item ${n.type===`file`&&n.cid===M?`active`:``}`,children:(0,T.jsxs)(`button`,{className:`ui-list-item-main note-list-item-main ${n.type===`directory`?`folder`:``}`,onClick:()=>{n.type===`directory`?k(v(n.path?`${n.path}/${n.name}`:n.name)):He(n)},children:[(0,T.jsx)(`span`,{className:`ui-list-icon note-list-icon ${n.type===`directory`?`warning`:``}`,children:n.type===`directory`?(0,T.jsx)(f,{size:18}):n.isSecret?(0,T.jsx)(u,{size:18}):(0,T.jsx)(p,{size:18})}),(0,T.jsxs)(`span`,{className:`ui-list-copy note-list-copy`,children:[(0,T.jsx)(`span`,{className:`ui-list-title note-list-name`,translate:`no`,children:n.name}),n.type===`file`?(0,T.jsx)(`span`,{className:`ui-list-desc note-list-preview`,translate:`no`,children:xe(n,e)}):(0,T.jsx)(`span`,{className:`ui-list-desc note-list-preview`,children:e(`note.folder`)})]}),n.type===`file`&&(0,T.jsx)(`span`,{className:`ui-list-meta note-list-date`,children:t(n.updated_at)})]})},`${n.cid}:${n.path}:${n.name}`))}),(0,T.jsx)(`div`,{className:`note-create-btn`,children:(0,T.jsxs)(`button`,{className:`btn`,onClick:Ke,children:[(0,T.jsx)(g,{size:16}),e(`note.newNote`)]})})]});return(0,T.jsxs)(ne,{sidebar:()=>(0,T.jsx)(_e,{children:$e}),headerTitle:Ze,headerRight:Qe,children:[(0,T.jsx)(`main`,{className:`note-page note-browser-page ${P?`has-editor`:``}`,children:(0,T.jsx)(`section`,{className:`note-workspace`,children:(0,T.jsx)(`section`,{className:`note-editor-panel`,"aria-label":e(F?`note.editorLabel.edit`:`note.editorLabel.read`),children:P?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:`note-editor-panel-header`,children:[(0,T.jsxs)(`div`,{className:`note-editor-title-area`,children:[F?(0,T.jsx)(`input`,{className:`note-title-input`,value:q,onChange:e=>J(e.target.value),placeholder:e(`note.namePlaceholder`),translate:`no`,disabled:!N}):N?(0,T.jsx)(`input`,{className:`note-title-input`,value:Oe,onBlur:qe,onChange:e=>K(e.target.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(K(N.name),e.currentTarget.blur())},placeholder:e(`note.namePlaceholder`),title:e(`app.rename`),translate:`no`}):(0,T.jsx)(`h3`,{children:e(`note.untitled`)}),N&&(0,T.jsxs)(`div`,{className:`note-editor-info`,children:[(0,T.jsx)(`span`,{children:e(F?`note.mode.edit`:`note.mode.read`)}),(0,T.jsx)(`span`,{children:ze}),(0,T.jsx)(`span`,{children:t(N.updated_at)})]})]}),(0,T.jsxs)(`div`,{className:`note-editor-actions`,children:[(0,T.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:F?We:()=>Q(),title:e(F?`common.cancel`:`common.close`),"aria-label":e(F?`common.cancel`:`common.close`),children:(0,T.jsx)(ae,{size:16})}),F?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`button`,{className:`btn btn-sm ${X?`btn-warning`:`btn-secondary`}`,onClick:()=>Me(!X),disabled:!N,children:[X?(0,T.jsx)(u,{size:16}):(0,T.jsx)(oe,{size:16}),e(X?`note.privacy.secret`:`note.privacy.public`)]}),(0,T.jsxs)(`button`,{className:`btn btn-sm btn-primary`,onClick:Ge,disabled:Pe||!!Ne||!N,children:[(0,T.jsx)(_,{size:16}),e(Pe?`note.action.saving`:`note.action.save`)]})]}):N&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`button`,{type:`button`,className:`btn btn-icon`,onClick:()=>Je(N),title:e(`note.action.move`),"aria-label":e(`note.action.move`),children:(0,T.jsx)(me,{size:16})}),(0,T.jsx)(`button`,{type:`button`,className:`btn btn-icon note-editor-action-danger`,onClick:()=>Xe(N),title:e(`note.action.delete`),"aria-label":e(`note.action.delete`),children:(0,T.jsx)(ie,{size:16})}),(0,T.jsxs)(`button`,{type:`button`,className:`btn btn-sm btn-primary`,onClick:()=>Ue(N),disabled:!!W,title:e(`note.action.edit`),"aria-label":e(`note.action.edit`),children:[(0,T.jsx)(he,{size:16}),e(`note.action.edit`)]})]})]})]}),F?Ne?(0,T.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,T.jsx)(u,{size:36}),(0,T.jsx)(`p`,{children:Ne})]}):N?(0,T.jsx)(`div`,{className:`note-editor-frame editing`,children:(0,T.jsx)(ve,{ref:d,content:je,onChange:Y,className:`milkdown-editor`})}):(0,T.jsxs)(`div`,{className:`note-empty-state editor-error`,children:[(0,T.jsx)(m,{size:36}),(0,T.jsx)(`p`,{children:e(j?`note.error.notFound`:`note.loading`)})]}):W?(0,T.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,T.jsx)(u,{size:36}),(0,T.jsx)(`p`,{children:W})]}):N?(0,T.jsx)(`div`,{className:`note-editor-frame reading`,children:(0,T.jsx)(ve,{content:De,readOnly:!0,className:`milkdown-editor`})}):(0,T.jsxs)(`div`,{className:`ui-empty-state note-empty-state editor-error`,children:[(0,T.jsx)(m,{size:36}),(0,T.jsx)(`p`,{children:e(j?`note.error.notFound`:`note.loading`)})]})]}):(0,T.jsxs)(`div`,{className:`ui-empty-state note-editor-empty`,children:[(0,T.jsx)(`div`,{className:`ui-empty-icon note-editor-empty-icon`,children:(0,T.jsx)(m,{size:32})}),(0,T.jsx)(`h3`,{className:`ui-empty-title`,children:e(`note.noOpen.title`)}),(0,T.jsx)(`p`,{className:`ui-empty-desc`,children:E.length>0?e(`note.noOpen.select`):e(`note.noOpen.createFirst`)}),(0,T.jsx)(h,{label:e(`note.openList`),variant:`default`})]})})})}),L&&(0,T.jsx)(de,{title:L.title,placeholder:L.placeholder,defaultValue:L.defaultValue,confirmText:L.confirmText,onConfirm:L.onConfirm,onClose:()=>R(null)}),z&&(0,T.jsx)(fe,{title:z.title,message:z.message,confirmText:z.confirmText,danger:!0,onConfirm:z.onConfirm,onClose:()=>B(null)}),V&&(0,T.jsx)(ge,{target:V,directories:Ve,onMove:Ye,onClose:()=>H(null)})]})}function A(){let{t:e}=x();return(0,T.jsx)(w.Suspense,{fallback:(0,T.jsx)(`div`,{className:`note-editor-loading`,children:e(`note.loading`)}),children:(0,T.jsx)(k,{})})}var we=o(`/note/`)({component:A});export{we as Route};
|