most-box 0.3.0 → 0.3.1

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.
Files changed (131) hide show
  1. package/README.md +41 -21
  2. package/electron/main.js +18 -1
  3. package/electron/preload.cjs +8 -0
  4. package/out/admin/index.html +0 -0
  5. package/out/app/index.html +0 -0
  6. package/out/assets/AccountMenu-NjOgag0d.js +1 -0
  7. package/out/assets/FilePreviewOverlay-CZp6F1s_.js +1 -0
  8. package/out/assets/MarketingHeader-7B-OT2XX.js +1 -0
  9. package/out/assets/MarketingLayout-CyiSCygk.js +1 -0
  10. package/out/assets/{MilkdownEditor-BTq9bDAf.js → MilkdownEditor-WedhCoFH.js} +1 -1
  11. package/out/assets/OpenSidebarButton-BoSmO8CY.js +1 -0
  12. package/out/assets/SidebarHomeLink-CkhGDvZ8.js +1 -0
  13. package/out/assets/arrow-right-DUxAoZqb.js +1 -0
  14. package/out/assets/{ui-BpDGD3IR.js → avatar-BZwHW4ll.js} +2 -2
  15. package/out/assets/circle-alert-DSZ0bG_3.js +1 -0
  16. package/out/assets/copy-CK7HMulu.js +1 -0
  17. package/out/assets/download-Q1uCiwif.js +1 -0
  18. package/out/assets/downloadValidation-Ch966YTl.js +1 -0
  19. package/out/assets/external-link-DGzNJOqQ.js +1 -0
  20. package/out/assets/file-text-C3v0L_lQ.js +1 -0
  21. package/out/assets/folder-CwtLO09O.js +1 -0
  22. package/out/assets/hard-drive-B2V5USzR.js +1 -0
  23. package/out/assets/i18n-DZaOYCSO.js +1 -0
  24. package/out/assets/index-CBkHUp3F.css +1 -0
  25. package/out/assets/index-DluhgSHX.js +31 -0
  26. package/out/assets/index.lazy-B5TYRvFJ.js +1 -0
  27. package/out/assets/index.lazy-BeDctVci.js +1 -0
  28. package/out/assets/index.lazy-BjmAkVtV.js +1 -0
  29. package/out/assets/index.lazy-CHJbzlK6.js +1 -0
  30. package/out/assets/index.lazy-CITrkWMQ.js +1 -0
  31. package/out/assets/index.lazy-CTGE5fUt.js +2 -0
  32. package/out/assets/index.lazy-CUxcXUMy.js +2 -0
  33. package/out/assets/index.lazy-D84xQtPb.js +3 -0
  34. package/out/assets/index.lazy-DRqAgqpV.js +1 -0
  35. package/out/assets/index.lazy-DSAmY1q_.js +1 -0
  36. package/out/assets/index.lazy-DvbVQRSL.js +1 -0
  37. package/out/assets/index.lazy-gAJi-rJV.js +1 -0
  38. package/out/assets/index.lazy-rzyMd-Gz.js +1 -0
  39. package/out/assets/key-round-Dn5tud-4.js +1 -0
  40. package/out/assets/loader-CLoDCtNy.js +1 -0
  41. package/out/assets/lock-BEWKuIqK.js +1 -0
  42. package/out/assets/message-square-C8ZiYztG.js +1 -0
  43. package/out/assets/mp-CGBtY36n.js +1 -0
  44. package/out/assets/music-BsTA8b_M.js +1 -0
  45. package/out/assets/notebook-pen-DgWzxf2y.js +1 -0
  46. package/out/assets/play-CVkbAJJU.js +1 -0
  47. package/out/assets/plus-D1kCYb8G.js +1 -0
  48. package/out/assets/save-X5c7jlCg.js +1 -0
  49. package/out/assets/search-DAV9vDOq.js +1 -0
  50. package/out/assets/send-C5JjYo-A.js +1 -0
  51. package/out/assets/shield-check-DuD6OLde.js +1 -0
  52. package/out/assets/smartphone-gVFruyjO.js +1 -0
  53. package/out/assets/trash-2-CE-3Dc63.js +1 -0
  54. package/out/assets/triangle-alert-DnOxsFpB.js +1 -0
  55. package/out/assets/upload-CsnBv3pd.js +1 -0
  56. package/out/assets/{useChannelMessages-DOaWHdAP.js → useChannelMessages-Bs_RWgO4.js} +1 -1
  57. package/out/assets/useGameRoom-BxDxm3rp.js +1 -0
  58. package/out/assets/userProfile-UphvP_bG.js +1 -0
  59. package/out/assets/wallet-VDaoXwjI.js +1 -0
  60. package/out/assets/wifi-DfWbmlGE.js +1 -0
  61. package/out/chat/index.html +0 -0
  62. package/out/chat/join/index.html +0 -0
  63. package/out/download/index.html +2 -2
  64. package/out/game/gandengyan/index.html +0 -0
  65. package/out/game/index.html +0 -0
  66. package/out/game/zhajinhua/index.html +0 -0
  67. package/out/index.html +2 -2
  68. package/out/note/index.html +0 -0
  69. package/out/ping/index.html +2 -2
  70. package/out/profile/index.html +0 -0
  71. package/out/web3/index.html +0 -0
  72. package/package.json +2 -5
  73. package/server/src/http/app.js +2 -0
  74. package/server/src/http/routePolicy.js +1 -0
  75. package/server/src/http/routes/noteVaultRoutes.js +85 -0
  76. package/server/src/utils/noteVault.js +327 -0
  77. package/electron/preload.js +0 -6
  78. package/out/assets/FilePreviewOverlay-CM5IqnZD.js +0 -1
  79. package/out/assets/LanguageToggle-CSQtRZ3A.js +0 -1
  80. package/out/assets/MarketingHeader-B45AaM29.js +0 -1
  81. package/out/assets/MarketingLayout-A00pEOa2.js +0 -1
  82. package/out/assets/MarketingThemeToggle-CIKP8x9W.js +0 -1
  83. package/out/assets/OpenSidebarButton-D8qfUGzU.js +0 -1
  84. package/out/assets/SidebarAccount-_RBE5K_o.js +0 -1
  85. package/out/assets/SidebarHomeLink-qMFEGjZt.js +0 -1
  86. package/out/assets/arrow-right-BU9c_SL4.js +0 -1
  87. package/out/assets/circle-alert-iuHzciph.js +0 -1
  88. package/out/assets/copy-DEzFUzeX.js +0 -1
  89. package/out/assets/download-jEPn2njL.js +0 -1
  90. package/out/assets/downloadValidation-CSXwoQKW.js +0 -1
  91. package/out/assets/external-link-BFaoZeK0.js +0 -1
  92. package/out/assets/file-text-DPA1riJ_.js +0 -1
  93. package/out/assets/folder-Cfgc70_F.js +0 -1
  94. package/out/assets/hard-drive-Dar_AZEq.js +0 -1
  95. package/out/assets/i18n-NjvOSuV6.js +0 -1
  96. package/out/assets/index-BHZhApbo.css +0 -1
  97. package/out/assets/index-C-_ZwxuN.js +0 -31
  98. package/out/assets/index.lazy-0YYV0CR3.js +0 -1
  99. package/out/assets/index.lazy-BTYGr9Vb.js +0 -1
  100. package/out/assets/index.lazy-BVAtQtTa.js +0 -3
  101. package/out/assets/index.lazy-BbdLA2L-.js +0 -1
  102. package/out/assets/index.lazy-CbiLtziY.js +0 -1
  103. package/out/assets/index.lazy-CcEdBg3i.js +0 -2
  104. package/out/assets/index.lazy-CePHsLXG.js +0 -1
  105. package/out/assets/index.lazy-DG_3_VdF.js +0 -1
  106. package/out/assets/index.lazy-DR0rWEWZ.js +0 -2
  107. package/out/assets/index.lazy-DSyTSCJD.js +0 -1
  108. package/out/assets/index.lazy-DUhsuPLv.js +0 -1
  109. package/out/assets/index.lazy-DVnhWbzH.js +0 -1
  110. package/out/assets/index.lazy-DZpkg1DJ.js +0 -1
  111. package/out/assets/key-round-DNcpSuMw.js +0 -1
  112. package/out/assets/loader-BXQtdens.js +0 -1
  113. package/out/assets/lock-CLIE8cct.js +0 -1
  114. package/out/assets/message-square-Dp09WY1I.js +0 -1
  115. package/out/assets/mp-B6kdA94c.js +0 -1
  116. package/out/assets/music-B19Tg557.js +0 -1
  117. package/out/assets/notebook-pen-C8TlK5sB.js +0 -1
  118. package/out/assets/play-B-BjsTZz.js +0 -1
  119. package/out/assets/plus-4hygj-1Z.js +0 -1
  120. package/out/assets/save-BjrbPwhJ.js +0 -1
  121. package/out/assets/search-DSkiWdvX.js +0 -1
  122. package/out/assets/send-BL4d5iOt.js +0 -1
  123. package/out/assets/shield-check-DzDuWO8r.js +0 -1
  124. package/out/assets/smartphone-tRRFFO0a.js +0 -1
  125. package/out/assets/trash-2-V12tJ8lI.js +0 -1
  126. package/out/assets/triangle-alert-DGWc8ZHu.js +0 -1
  127. package/out/assets/upload-CoCptKya.js +0 -1
  128. package/out/assets/useGameRoom-hHkV65ii.js +0 -1
  129. package/out/assets/userProfile-DwZip0Dt.js +0 -1
  130. package/out/assets/wallet-T7ONZ3Kg.js +0 -1
  131. package/out/assets/wifi-Bgo8eHY0.js +0 -1
@@ -0,0 +1,327 @@
1
+ import crypto from 'node:crypto'
2
+ import fs from 'node:fs/promises'
3
+ import fsSync from 'node:fs'
4
+ import path from 'node:path'
5
+ import { PathSecurityError, ValidationError } from './errors.js'
6
+
7
+ const CONFIG_FILE_NAME = 'note-vault.json'
8
+ const MARKDOWN_EXTENSION = '.md'
9
+ const EXCLUDED_DIRECTORY_NAMES = new Set(['node_modules'])
10
+
11
+ function getNoteVaultConfigPath(configDir) {
12
+ return path.join(configDir, CONFIG_FILE_NAME)
13
+ }
14
+
15
+ function isPathInside(parentPath, childPath) {
16
+ const relative = path.relative(parentPath, childPath)
17
+ return (
18
+ relative === '' ||
19
+ (!relative.startsWith('..') && !path.isAbsolute(relative))
20
+ )
21
+ }
22
+
23
+ function isDisallowedDirectoryName(name) {
24
+ return name.startsWith('.') || EXCLUDED_DIRECTORY_NAMES.has(name)
25
+ }
26
+
27
+ function toNativePath(relativePath) {
28
+ return relativePath.split('/').join(path.sep)
29
+ }
30
+
31
+ async function pathExists(filePath) {
32
+ try {
33
+ await fs.access(filePath)
34
+ return true
35
+ } catch {
36
+ return false
37
+ }
38
+ }
39
+
40
+ async function getVaultDirectoryInfo(vaultPath, options = {}) {
41
+ const rawPath = String(vaultPath || '').trim()
42
+ if (!rawPath) {
43
+ throw new ValidationError(
44
+ 'note vault is not configured',
45
+ 'NOTE_VAULT_NOT_CONFIGURED'
46
+ )
47
+ }
48
+
49
+ const resolvedPath = path.resolve(rawPath)
50
+ let stat
51
+ try {
52
+ stat = await fs.stat(resolvedPath)
53
+ } catch {
54
+ throw new ValidationError(
55
+ 'note vault directory does not exist',
56
+ 'NOTE_VAULT_NOT_FOUND'
57
+ )
58
+ }
59
+
60
+ if (!stat.isDirectory()) {
61
+ throw new ValidationError(
62
+ 'note vault path must be a directory',
63
+ 'NOTE_VAULT_NOT_DIRECTORY'
64
+ )
65
+ }
66
+
67
+ const realPath = await fs.realpath(resolvedPath)
68
+ await fs.access(realPath, fsSync.constants.R_OK)
69
+ if (options.requireWritable) {
70
+ await fs.access(realPath, fsSync.constants.W_OK)
71
+ }
72
+
73
+ return { path: resolvedPath, realPath }
74
+ }
75
+
76
+ async function readNoteVaultConfig(configDir) {
77
+ try {
78
+ const raw = await fs.readFile(getNoteVaultConfigPath(configDir), 'utf8')
79
+ const parsed = JSON.parse(raw)
80
+ return {
81
+ vaultPath:
82
+ typeof parsed.vaultPath === 'string' ? parsed.vaultPath.trim() : '',
83
+ updatedAt:
84
+ typeof parsed.updatedAt === 'string' ? parsed.updatedAt : undefined,
85
+ }
86
+ } catch {
87
+ return { vaultPath: '' }
88
+ }
89
+ }
90
+
91
+ async function writeNoteVaultConfig(configDir, config) {
92
+ await fs.mkdir(configDir, { recursive: true })
93
+ const configPath = getNoteVaultConfigPath(configDir)
94
+ const tempPath = `${configPath}.${process.pid}.${Date.now()}.tmp`
95
+ await fs.writeFile(tempPath, JSON.stringify(config, null, 2), 'utf8')
96
+ await fs.rename(tempPath, configPath)
97
+ }
98
+
99
+ export function normalizeNoteVaultRelativePath(input) {
100
+ const raw = String(input || '').trim()
101
+ if (!raw) {
102
+ throw new ValidationError(
103
+ 'note vault file path is required',
104
+ 'NOTE_VAULT_PATH_REQUIRED'
105
+ )
106
+ }
107
+ if (raw.includes('\0')) {
108
+ throw new PathSecurityError('Invalid note vault path')
109
+ }
110
+ if (path.isAbsolute(raw) || path.win32.isAbsolute(raw)) {
111
+ throw new PathSecurityError('Absolute note vault paths are not allowed')
112
+ }
113
+
114
+ const slashPath = raw.replace(/\\/g, '/')
115
+ const normalized = path.posix.normalize(slashPath)
116
+ if (
117
+ normalized === '.' ||
118
+ normalized === '..' ||
119
+ normalized.startsWith('../')
120
+ ) {
121
+ throw new PathSecurityError('Path traversal is not allowed')
122
+ }
123
+
124
+ const parts = normalized.split('/').filter(Boolean)
125
+ if (
126
+ parts.length === 0 ||
127
+ parts.some(part => part === '.' || part === '..' || !part.trim())
128
+ ) {
129
+ throw new PathSecurityError('Invalid note vault path')
130
+ }
131
+
132
+ const directoryParts = parts.slice(0, -1)
133
+ if (directoryParts.some(isDisallowedDirectoryName)) {
134
+ throw new PathSecurityError('Hidden or excluded directories are not allowed')
135
+ }
136
+
137
+ const fileName = parts[parts.length - 1]
138
+ if (!fileName.toLowerCase().endsWith(MARKDOWN_EXTENSION)) {
139
+ throw new ValidationError(
140
+ 'only Markdown files are allowed',
141
+ 'NOTE_VAULT_MARKDOWN_REQUIRED'
142
+ )
143
+ }
144
+
145
+ return parts.join('/')
146
+ }
147
+
148
+ export async function configureNoteVault(configDir, vaultPath) {
149
+ const info = await getVaultDirectoryInfo(vaultPath, { requireWritable: true })
150
+ const config = {
151
+ vaultPath: info.realPath,
152
+ updatedAt: new Date().toISOString(),
153
+ }
154
+ await writeNoteVaultConfig(configDir, config)
155
+ return getNoteVaultStatus(configDir)
156
+ }
157
+
158
+ export async function getConfiguredNoteVaultPath(configDir) {
159
+ const config = await readNoteVaultConfig(configDir)
160
+ const info = await getVaultDirectoryInfo(config.vaultPath)
161
+ return info.realPath
162
+ }
163
+
164
+ export async function getNoteVaultStatus(configDir) {
165
+ const config = await readNoteVaultConfig(configDir)
166
+ if (!config.vaultPath) {
167
+ return {
168
+ configured: false,
169
+ vaultPath: '',
170
+ fileCount: 0,
171
+ writable: false,
172
+ }
173
+ }
174
+
175
+ try {
176
+ const info = await getVaultDirectoryInfo(config.vaultPath)
177
+ const files = await listMarkdownFiles(info.realPath)
178
+ const writable = await fs
179
+ .access(info.realPath, fsSync.constants.W_OK)
180
+ .then(() => true)
181
+ .catch(() => false)
182
+ return {
183
+ configured: true,
184
+ vaultPath: info.realPath,
185
+ fileCount: files.length,
186
+ writable,
187
+ updatedAt: config.updatedAt,
188
+ }
189
+ } catch (err) {
190
+ return {
191
+ configured: false,
192
+ vaultPath: config.vaultPath,
193
+ fileCount: 0,
194
+ writable: false,
195
+ error: err instanceof Error ? err.message : 'note vault unavailable',
196
+ }
197
+ }
198
+ }
199
+
200
+ export async function listMarkdownFiles(vaultPath) {
201
+ const info = await getVaultDirectoryInfo(vaultPath)
202
+ const files = []
203
+
204
+ async function scanDirectory(currentPath, relativeParts = []) {
205
+ const entries = await fs.readdir(currentPath, { withFileTypes: true })
206
+
207
+ for (const entry of entries) {
208
+ if (entry.isSymbolicLink()) continue
209
+ if (entry.isDirectory()) {
210
+ if (isDisallowedDirectoryName(entry.name)) continue
211
+ const directoryPath = path.join(currentPath, entry.name)
212
+ const realDirectoryPath = await fs.realpath(directoryPath)
213
+ if (!isPathInside(info.realPath, realDirectoryPath)) continue
214
+ await scanDirectory(realDirectoryPath, [...relativeParts, entry.name])
215
+ continue
216
+ }
217
+
218
+ if (!entry.isFile()) continue
219
+ if (!entry.name.toLowerCase().endsWith(MARKDOWN_EXTENSION)) continue
220
+
221
+ const filePath = path.join(currentPath, entry.name)
222
+ const realFilePath = await fs.realpath(filePath)
223
+ if (!isPathInside(info.realPath, realFilePath)) continue
224
+
225
+ const stat = await fs.stat(realFilePath)
226
+ const relativePath = [...relativeParts, entry.name].join('/')
227
+ files.push({
228
+ path: relativePath,
229
+ name: entry.name,
230
+ directory: relativeParts.join('/'),
231
+ size: stat.size,
232
+ mtimeMs: stat.mtimeMs,
233
+ })
234
+ }
235
+ }
236
+
237
+ await scanDirectory(info.realPath)
238
+ return files.sort((left, right) => left.path.localeCompare(right.path))
239
+ }
240
+
241
+ export async function readMarkdownFile(vaultPath, relativePath) {
242
+ const info = await getVaultDirectoryInfo(vaultPath)
243
+ const normalizedPath = normalizeNoteVaultRelativePath(relativePath)
244
+ const targetPath = path.resolve(info.realPath, toNativePath(normalizedPath))
245
+
246
+ let realFilePath
247
+ try {
248
+ realFilePath = await fs.realpath(targetPath)
249
+ } catch {
250
+ throw new ValidationError(
251
+ 'note vault file not found',
252
+ 'NOTE_VAULT_FILE_NOT_FOUND'
253
+ )
254
+ }
255
+
256
+ if (!isPathInside(info.realPath, realFilePath)) {
257
+ throw new PathSecurityError('Note vault file escapes the configured vault')
258
+ }
259
+
260
+ const stat = await fs.stat(realFilePath)
261
+ if (!stat.isFile()) {
262
+ throw new ValidationError(
263
+ 'note vault path is not a file',
264
+ 'NOTE_VAULT_NOT_FILE'
265
+ )
266
+ }
267
+
268
+ return {
269
+ path: normalizedPath,
270
+ name: path.posix.basename(normalizedPath),
271
+ directory: path.posix.dirname(normalizedPath) === '.'
272
+ ? ''
273
+ : path.posix.dirname(normalizedPath),
274
+ content: await fs.readFile(realFilePath, 'utf8'),
275
+ size: stat.size,
276
+ mtimeMs: stat.mtimeMs,
277
+ }
278
+ }
279
+
280
+ export async function writeMarkdownFile(vaultPath, relativePath, content) {
281
+ const info = await getVaultDirectoryInfo(vaultPath, { requireWritable: true })
282
+ const normalizedPath = normalizeNoteVaultRelativePath(relativePath)
283
+ const targetPath = path.resolve(info.realPath, toNativePath(normalizedPath))
284
+ const parentPath = path.dirname(targetPath)
285
+
286
+ await fs.mkdir(parentPath, { recursive: true })
287
+ const realParentPath = await fs.realpath(parentPath)
288
+ if (!isPathInside(info.realPath, realParentPath)) {
289
+ throw new PathSecurityError('Note vault file escapes the configured vault')
290
+ }
291
+
292
+ if (await pathExists(targetPath)) {
293
+ const targetStat = await fs.lstat(targetPath)
294
+ if (targetStat.isSymbolicLink()) {
295
+ throw new PathSecurityError('Symlink Markdown files are not writable')
296
+ }
297
+ if (!targetStat.isFile()) {
298
+ throw new ValidationError(
299
+ 'note vault path is not a file',
300
+ 'NOTE_VAULT_NOT_FILE'
301
+ )
302
+ }
303
+ const realTargetPath = await fs.realpath(targetPath)
304
+ if (!isPathInside(info.realPath, realTargetPath)) {
305
+ throw new PathSecurityError(
306
+ 'Note vault file escapes the configured vault'
307
+ )
308
+ }
309
+ }
310
+
311
+ const tempPath = path.join(
312
+ parentPath,
313
+ `.${path.basename(targetPath)}.${process.pid}.${Date.now()}.${crypto
314
+ .randomBytes(4)
315
+ .toString('hex')}.tmp`
316
+ )
317
+
318
+ try {
319
+ await fs.writeFile(tempPath, String(content ?? ''), 'utf8')
320
+ await fs.rename(tempPath, targetPath)
321
+ } catch (err) {
322
+ await fs.rm(tempPath, { force: true }).catch(() => {})
323
+ throw err
324
+ }
325
+
326
+ return readMarkdownFile(info.realPath, normalizedPath)
327
+ }
@@ -1,6 +0,0 @@
1
- import { contextBridge } from 'electron'
2
-
3
- contextBridge.exposeInMainWorld('electronAPI', {
4
- platform: process.platform,
5
- isElectron: true,
6
- })
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,S as i}from"./ui-BpDGD3IR.js";import{a}from"./i18n-NjvOSuV6.js";import{t as o}from"./file-text-DPA1riJ_.js";import{t as s}from"./loader-BXQtdens.js";import{t as c}from"./music-B19Tg557.js";import{m as l}from"./index-C-_ZwxuN.js";var u=r(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),d=r(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),f=r(`pen`,[[`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`}]]);function p(e){let t=String(e||``).split(`.`).pop()?.toLowerCase()||``,n=[`jpg`,`jpeg`,`png`,`gif`,`webp`,`svg`,`bmp`,`ico`,`tiff`,`heic`,`heif`],r=[`mp4`,`webm`,`mov`,`avi`,`mkv`,`flv`,`wmv`,`m4v`,`mpeg`,`3gp`],i=[`mp3`,`wav`,`ogg`,`flac`,`aac`,`m4a`,`wma`,`opus`],a=`txt.md.js.ts.jsx.tsx.css.scss.less.json.xml.html.htm.yaml.yml.toml.ini.cfg.conf.log.sh.bash.py.rb.go.rs.java.c.cpp.h.hpp.cs.php.sql.graphql.env.gitignore.dockerfile.readme`.split(`.`);return n.includes(t)?`image`:r.includes(t)?`video`:i.includes(t)?`audio`:a.includes(t)?`text`:`file`}var m=t(e(),1),h=n();function g(e){return e===`image`||e===`video`||e===`audio`}function _({item:e,isBackendReady:t,getFileDownloadUrl:n,onClose:r}){let{t:u}=a(),[d,f]=(0,m.useState)(``),[p,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(``),[b,x]=(0,m.useState)(``);return(0,m.useEffect)(()=>{if(e.subtype!==`text`)return;let r=!1;if(f(``),x(``),!t){f(u(`preview.loadFailed`));return}return _(!0),(async()=>{try{let t=await fetch(n(e.cid),{headers:{...await l(`GET`,`/api/files/${e.cid}/download`),Range:`bytes=0-9999`}});if(!t.ok)throw Error(u(`preview.loadFailed`));let i=await t.text();r||f(i||u(`preview.emptyFile`))}catch{r||f(u(`preview.loadFailed`))}finally{r||_(!1)}})(),()=>{r=!0}},[n,t,e.cid,e.subtype]),(0,m.useEffect)(()=>{if(!g(e.subtype)){y(``);return}if(y(``),x(``),!t){x(u(`preview.loadFailed`));return}let r=``,i=!1;return(async()=>{try{let t=await fetch(n(e.cid),{headers:await l(`GET`,`/api/files/${e.cid}/download`)});if(!t.ok)throw Error(u(`preview.loadFailed`));let a=URL.createObjectURL(await t.blob());r=a,i||y(a)}catch{i||x(u(`preview.loadFailed`))}})(),()=>{i=!0,r&&URL.revokeObjectURL(r)}},[n,t,e.cid,e.subtype]),(0,h.jsxs)(`div`,{className:`preview-overlay`,onClick:r,children:[(0,h.jsx)(`button`,{type:`button`,className:`preview-close`,onClick:r,"aria-label":u(`preview.close`),children:(0,h.jsx)(i,{size:20})}),(0,h.jsxs)(`div`,{onClick:e=>e.stopPropagation(),children:[e.subtype===`image`&&(0,h.jsx)(`div`,{className:`preview-media-wrapper`,children:v?(0,h.jsx)(`img`,{src:v,alt:e.fileName,translate:`no`}):b?(0,h.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,h.jsx)(o,{size:48,className:`preview-file-icon`}),(0,h.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,h.jsx)(`p`,{className:`preview-unsupported-hint`,children:b})]}):(0,h.jsx)(`div`,{className:`preview-loading`,children:(0,h.jsx)(`div`,{className:`preview-loading-spinner`})})}),e.subtype===`video`&&(0,h.jsx)(`div`,{className:`preview-media-wrapper`,children:v?(0,h.jsx)(`video`,{src:v,controls:!0}):b?(0,h.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,h.jsx)(o,{size:48,className:`preview-file-icon`}),(0,h.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,h.jsx)(`p`,{className:`preview-unsupported-hint`,children:b})]}):(0,h.jsx)(`div`,{className:`preview-loading`,children:(0,h.jsx)(`div`,{className:`preview-loading-spinner`})})}),e.subtype===`audio`&&(0,h.jsxs)(`div`,{className:`preview-audio`,children:[(0,h.jsx)(`div`,{className:`preview-audio-icon`,children:(0,h.jsx)(c,{size:36,color:`var(--accent)`})}),(0,h.jsx)(`p`,{className:`preview-audio-filename`,translate:`no`,children:e.fileName}),v?(0,h.jsx)(`audio`,{className:`preview-audio-player`,src:v,controls:!0}):(0,h.jsx)(`div`,{className:`preview-text-loading`,children:b?(0,h.jsx)(`p`,{children:b}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{size:24,className:`preview-text-spinner`}),(0,h.jsx)(`p`,{children:u(`preview.audioLoading`)})]})})]}),e.subtype===`file`&&(0,h.jsxs)(`div`,{className:`preview-unsupported`,children:[(0,h.jsx)(o,{size:48,className:`preview-file-icon`}),(0,h.jsx)(`p`,{translate:`no`,children:e.fileName}),(0,h.jsx)(`p`,{className:`preview-unsupported-hint`,children:u(`preview.unsupported`)})]}),e.subtype===`text`&&(0,h.jsxs)(`div`,{className:`preview-text-container`,children:[(0,h.jsx)(`div`,{className:`preview-text-header`,children:(0,h.jsx)(`span`,{translate:`no`,children:e.fileName})}),p?(0,h.jsxs)(`div`,{className:`preview-text-loading`,children:[(0,h.jsx)(s,{size:24,className:`preview-text-spinner`}),(0,h.jsx)(`p`,{children:u(`preview.textLoading`)}),(0,h.jsx)(`p`,{className:`preview-text-loading-hint`,children:u(`preview.firstSyncHint`)})]}):(0,h.jsx)(`pre`,{className:`preview-text`,translate:`no`,children:d||u(`preview.emptyFile`)})]})]})]})}export{u as a,d as i,p as n,f as r,_ as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{C as t,t as n}from"./ui-BpDGD3IR.js";import{a as r,c as i,o as a}from"./i18n-NjvOSuV6.js";var o=t(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),s=t(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),c=t(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),l=t(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),u=e();function d({className:e=``}){let{locale:t,localeName:c,setLocale:l,t:d}=r(),f=d(`common.locale.choose`),p=`${f} (${d(`common.locale.current`)}: ${c})`;return(0,u.jsx)(n,{ariaLabel:f,placement:`bottom-end`,items:a.map(e=>({key:e,label:i[e],icon:e===t?(0,u.jsx)(o,{size:16}):(0,u.jsx)(`span`,{"aria-hidden":`true`}),onSelect:()=>{e!==t&&l(e)}})),renderTrigger:t=>(0,u.jsx)(`button`,{...t,className:[`language-toggle`,e].filter(Boolean).join(` `),"aria-label":f,title:p,children:(0,u.jsx)(s,{size:16})})})}export{o as i,l as n,c as r,d as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{t}from"./LanguageToggle-CSQtRZ3A.js";import{I as n,j as r}from"./index-C-_ZwxuN.js";import{t as i}from"./MarketingThemeToggle-CIKP8x9W.js";var a=e();function o(){return(0,a.jsx)(`nav`,{className:`mkt-nav`,children:(0,a.jsxs)(`div`,{className:`mkt-nav-inner`,children:[(0,a.jsxs)(`button`,{type:`button`,className:`mkt-nav-logo`,onClick:r(),children:[(0,a.jsx)(n,{size:18}),(0,a.jsx)(`span`,{children:`MOST PEOPLE`})]}),(0,a.jsxs)(`div`,{className:`mkt-nav-cta`,children:[(0,a.jsx)(i,{}),(0,a.jsx)(t,{className:`mkt-theme-toggle`})]})]})})}export{o as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{D as t,o as n,s as r}from"./ui-BpDGD3IR.js";import{a as i}from"./i18n-NjvOSuV6.js";import{t as a}from"./LanguageToggle-CSQtRZ3A.js";import{t as o}from"./download-jEPn2njL.js";import{i as s}from"./index-C-_ZwxuN.js";import{t as c}from"./MarketingThemeToggle-CIKP8x9W.js";import{t as l}from"./LogoIcon-B2fFe0l1.js";var u={name:`most-box`,version:`0.3.0`,description:`MostBox - P2P file sharing application`,type:`module`,main:`electron/main.js`,bin:{"most-box":`server/cli.js`},files:[`out`,`public`,`electron`,`server/src`,`server/index.js`,`server/cli.js`],scripts:{start:`vite`,server:`node --watch server/index.js`,dev:`vite`,build:`vite build && node scripts/prepare-start-static.mjs`,preview:`vite preview`,serve:`npm run build && node server/index.js`,test:`node --test server/tests/**/*.test.js`,"test:unit":`node --test server/tests/unit/*.test.js`,"test:desktop":`node --test electron/*.test.js`,"test:frontend":`node --test src/tests/*.test.js`,"test:protocol":`node --test --test-name-pattern "extracts CID and filename|matches golden CID samples|publishes a file from Buffer|lists published files|pulls through local seed nodes" server/tests/unit/cid.test.js server/tests/integration/cid.test.js server/tests/integration/engine.test.js`,android:`npm --prefix mobile/android start`,"android:build":`npm --prefix mobile/android run apk`,"android:test":`npm --prefix mobile/android test`,typecheck:`tsc -p tsconfig.typecheck.json`,"typecheck:strict-router":`tsc -p tsconfig.strict-router.json`,"check:static-output":`node scripts/check-static-output.mjs`,format:`npx prettier --write .`,lint:`npx eslint .`,"r2:cors":`node scripts/configure-r2-cors.mjs`,"electron:dev":`concurrently "npm run build" "wait-on out/index.html && electron ."`,"electron:rebuild":`electron-rebuild -f -w sodium-native`,"electron:build":`npm run build && npm run electron:rebuild && electron-builder`,"electron:build:win":`npm run build && npm run electron:rebuild && electron-builder --win`,"electron:build:win:x64":`npm run electron:build:win -- --x64`,"electron:build:win:arm64":`npm run electron:build:win -- --arm64`,"electron:build:mac":`npm run build && npm run electron:rebuild && electron-builder --mac`,"electron:build:linux":`npm run build && npm run electron:rebuild && electron-builder --linux`},keywords:[`p2p`,`file-sharing`,`hyperswarm`,`hyperdrive`],license:`MIT`,dependencies:{"@dicebear/collection":`^9.4.2`,"@dicebear/core":`^9.4.2`,"@hono/node-server":`^2.0.4`,"@tanstack/react-router":`^1.170.15`,"@tanstack/react-start":`^1.168.25`,b4a:`^1.8.1`,busboy:`^1.6.0`,corestore:`^7.10.0`,dayjs:`^1.11.21`,ethers:`^6.16.0`,eventemitter3:`^5.0.4`,hono:`^4.12.23`,hypercore:`^11.33.1`,hyperdrive:`^13.3.2`,hyperswarm:`^4.17.0`,"ipfs-unixfs-importer":`^17.0.1`,multiformats:`^14.0.0`,tweetnacl:`^1.0.3`,ws:`^8.21.0`},devDependencies:{"@electron/rebuild":`^4.0.4`,"@eslint/js":`^10.0.1`,"@iconify/react":`^6.0.2`,"@mantine/hooks":`^9.3.0`,"@milkdown/crepe":`^7.21.2`,"@milkdown/utils":`^7.21.2`,"@types/react":`^19.2.16`,"@vitejs/plugin-react":`^6.0.2`,concurrently:`^10.0.3`,electron:`^42.3.3`,"electron-builder":`^26.8.1`,esbuild:`^0.28.0`,eslint:`^10.4.1`,globals:`^17.6.0`,ky:`^2.0.2`,"lucide-react":`^1.17.0`,prettier:`^3.8.3`,"qrcode.react":`^4.2.0`,react:`^19.2.7`,"react-dom":`^19.2.7`,typescript:`6.0.3`,"typescript-eslint":`^8.60.1`,vite:`^8.0.16`,"wait-on":`^9.0.10`,zustand:`^5.0.14`},overrides:{"brace-expansion":`5.0.6`,postcss:`8.5.15`,ws:`$ws`},build:{appId:`com.mostbox.app`,productName:`MostBox`,publish:[{provider:`github`,releaseType:`release`}],directories:{output:`dist`},afterPack:`electron/afterPack.cjs`,files:[`out/**/*`,`electron/**/*`,`server/src/**/*`,`server/index.js`,`server/cli.js`,`package.json`,`!**/*.map`,`!electron/**/*.test.js`,`!server/tests/**/*`],asarUnpack:[`**/*.node`,`**/sodium-native/**`],protocols:[{name:`MostBox Link`,schemes:[`most`]}],win:{target:[`nsis`],artifactName:"${productName}-${version}-win-${arch}-setup.${ext}",icon:`public/logo.ico`},nsis:{oneClick:!1,allowToChangeInstallationDirectory:!0,createDesktopShortcut:!0,createStartMenuShortcut:!0,shortcutName:`MostBox`},mac:{artifactName:"${productName}-${version}-mac-${arch}.${ext}",target:[{target:`dmg`,arch:[`x64`,`arm64`]}],icon:`public/logo-512.png`,category:`public.app-category.utilities`},dmg:{contents:[{x:130,y:220},{x:410,y:220,type:`link`,path:`/Applications`}]},linux:{artifactName:"${productName}-${version}-linux-${arch}.${ext}",target:[{target:`AppImage`,arch:[`x64`,`arm64`]}],icon:`public/logo-512.png`,category:`Utility`}}},d=e(),f=[{to:`/`,labelKey:`footer.about`},{to:`/ping/`,labelKey:`footer.network`},{href:`https://github.com/most-people/most`,labelKey:null,label:`GitHub`,external:!0}],p=u.version;function m(){let{t:e}=i();return(0,d.jsx)(`footer`,{className:`mkt-footer`,children:(0,d.jsx)(`div`,{className:`mkt-container`,children:(0,d.jsxs)(`div`,{className:`mkt-footer-inner`,children:[(0,d.jsx)(`div`,{className:`mkt-footer-links`,children:f.map(n=>`external`in n?(0,d.jsx)(`a`,{href:n.href,target:`_blank`,rel:`noopener noreferrer`,children:n.label},n.href):(0,d.jsx)(t,{to:n.to,children:e(n.labelKey)},n.to))}),(0,d.jsxs)(`span`,{className:`mkt-footer-copy`,children:[`© `,new Date().getFullYear(),` MOST PEOPLE · MIT License`]}),(0,d.jsxs)(`span`,{className:`mkt-footer-build`,translate:`no`,children:[`v`,p]})]})})})}function h({children:e,header:t}){return(0,d.jsxs)(`div`,{className:`mkt-layout`,children:[t??(0,d.jsx)(g,{}),(0,d.jsx)(`main`,{className:`mkt-layout-main`,children:e}),(0,d.jsx)(m,{})]})}function g(){let e=r(e=>e.identity),u=r(e=>e.openLoginModal),{t:f}=i(),p=n(),m=e?.displayName||e?.username||f(`nav.openWeb`);return(0,d.jsx)(`nav`,{className:`mkt-nav`,children:(0,d.jsxs)(`div`,{className:`mkt-nav-inner`,children:[(0,d.jsxs)(t,{to:`/`,className:`mkt-nav-logo`,children:[(0,d.jsx)(l,{}),`MOST PEOPLE`]}),(0,d.jsxs)(`div`,{className:`mkt-nav-cta`,children:[(0,d.jsx)(c,{}),(0,d.jsx)(a,{className:`mkt-theme-toggle`}),!p&&(0,d.jsxs)(t,{to:`/download/`,className:`btn btn-primary mkt-nav-preview`,children:[(0,d.jsx)(o,{size:16}),f(`nav.downloadClient`)]}),e?(0,d.jsx)(t,{to:`/profile/`,className:`mkt-nav-avatar-trigger`,"aria-label":f(`nav.profile`),title:m,children:(0,d.jsx)(`img`,{className:`mkt-nav-avatar`,src:s(e.address,e.avatar),alt:``,"aria-hidden":`true`})}):(0,d.jsx)(`button`,{type:`button`,className:`btn btn-secondary`,onClick:u,children:f(`nav.getStarted`)})]})]})})}export{h as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{a as r}from"./i18n-NjvOSuV6.js";import{n as i,r as a}from"./LanguageToggle-CSQtRZ3A.js";var o=t(e(),1),s=n();function c(){let[e,t]=(0,o.useState)(!1),{t:n}=r();return(0,o.useEffect)(()=>{let e=localStorage.getItem(`theme`),n=window.matchMedia(`(prefers-color-scheme: dark)`).matches;(e===`dark`||!e&&n)&&t(!0)},[]),(0,o.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,e?`dark`:`light`),localStorage.setItem(`theme`,e?`dark`:`light`)},[e]),(0,s.jsx)(`button`,{type:`button`,className:`mkt-theme-toggle`,onClick:()=>t(!e),"aria-label":n(`common.theme.toggle`),title:n(`common.theme.toggle`),children:e?(0,s.jsx)(i,{size:16}):(0,s.jsx)(a,{size:16})})}export{c as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./jsx-runtime-Bt-cYkS5.js";import{C as t}from"./ui-BpDGD3IR.js";import{a as n}from"./i18n-NjvOSuV6.js";import{r}from"./SidebarHomeLink-qMFEGjZt.js";var i=t(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),a=e();function o({label:e,className:t=``,variant:o=`primary`}){let{isSidebarVisible:s,openSidebar:c}=r(),{t:l}=n(),u=o===`primary`?`btn-primary`:``,d=e||l(`appShell.openSidebar`);return s?null:(0,a.jsxs)(`button`,{type:`button`,className:`btn ${u} sidebar-open-hint ${t}`.trim(),onClick:c,children:[(0,a.jsx)(i,{size:16}),d]})}export{o as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{D as r,r as i,s as a}from"./ui-BpDGD3IR.js";import{a as o}from"./i18n-NjvOSuV6.js";import{i as s}from"./index-C-_ZwxuN.js";var c=t(e(),1),l=n();function u({className:e=``}){let t=a(e=>e.identity),n=a(e=>e.openLoginModal),u=a(e=>e.logoutUser),[d,f]=(0,c.useState)(!1),{t:p}=o();return(0,l.jsxs)(`div`,{className:`chat-sidebar-footer sidebar-account ${e}`,children:[(0,l.jsxs)(`div`,{className:`user-info`,children:[t?(0,l.jsx)(r,{to:`/profile/`,className:`user-avatar-link`,"aria-label":p(`nav.profile`),title:p(`nav.profile`),children:(0,l.jsx)(`img`,{className:`user-avatar-img`,src:s(t.address,t.avatar),alt:``,"aria-hidden":`true`})}):(0,l.jsx)(`img`,{className:`user-avatar-img`,src:s(void 0,void 0),alt:``,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`user-name`,title:t?.address,children:(0,l.jsx)(`span`,{translate:t?.displayName?`no`:`yes`,children:t?.displayName||p(`account.notSignedIn`)})})]}),t?(0,l.jsx)(`button`,{type:`button`,className:`btn btn-secondary logout-btn`,onClick:()=>f(!0),children:p(`account.logout`)}):(0,l.jsx)(`button`,{className:`btn btn-primary login-btn`,onClick:n,children:p(`account.signIn`)}),d&&(0,l.jsx)(i,{title:p(`account.logoutTitle`),message:p(`account.logoutConfirm`),confirmText:p(`account.logout`),danger:!0,onConfirm:()=>{u(),f(!1)},onClose:()=>f(!1)})]})}export{u as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t,t as n}from"./jsx-runtime-Bt-cYkS5.js";import{C as r,D as i}from"./ui-BpDGD3IR.js";import{a}from"./i18n-NjvOSuV6.js";import{t as o}from"./LanguageToggle-CSQtRZ3A.js";import{I as s}from"./index-C-_ZwxuN.js";var c=r(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),l=t(e(),1);function u(e,t){return typeof t==`boolean`?t:typeof window<`u`&&`matchMedia`in window?window.matchMedia(e).matches:!1}function d(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){let[r,i]=(0,l.useState)(n?t:u(e));return(0,l.useEffect)(()=>{try{if(`matchMedia`in window){let t=window.matchMedia(e);i(t.matches);let n=e=>i(e.matches);return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}}}catch{return}},[e]),r||!1}function f(e=!1,t={}){let[n,r]=(0,l.useState)(e),i=(0,l.useCallback)(()=>{r(e=>e||(t.onOpen?.(),!0))},[t.onOpen]),a=(0,l.useCallback)(()=>{r(e=>e&&(t.onClose?.(),!1))},[t.onClose]);return[n,{open:i,close:a,toggle:(0,l.useCallback)(()=>{n?a():i()},[a,i,n]),set:r}]}var p=n(),m=(0,l.createContext)(null);function h(){let e=(0,l.useContext)(m);if(!e)throw Error(`useAppShell must be used within AppShell`);return e}function g({sidebar:e,className:t=``,headerTitle:n,headerRight:r,sidebarToggleReplacement:i,defaultHide:s=!1,children:u}){let[h,g]=f(!1),[_,v]=(0,l.useState)(s),y=(0,l.useRef)(s),b=d(`(max-width: 768px)`),{t:x}=a(),S=(0,l.useCallback)((e={})=>{g.close(),e.collapse&&v(!0)},[g]);(0,l.useEffect)(()=>{s!==y.current&&(s?S({collapse:!0}):v(!1),y.current=s)},[s,S]);let C=()=>{b?g.toggle():v(!_)},w=()=>{b?g.open():v(!1)},T=b?h:!_;return(0,p.jsx)(m.Provider,{value:{closeSidebar:S,openSidebar:w,isSidebarVisible:T},children:(0,p.jsxs)(`div`,{className:[`app-layout`,t].filter(Boolean).join(` `),children:[(0,p.jsx)(`div`,{className:`sidebar-overlay ${h?`visible`:``}`,onClick:()=>S()}),(0,p.jsx)(`div`,{className:`sidebar ${h?`open`:``} ${_?`collapsed`:``}`,children:e({closeSidebar:S,openSidebar:w})}),(0,p.jsxs)(`div`,{className:`main-content`,children:[(0,p.jsxs)(`header`,{className:`app-header`,children:[(0,p.jsxs)(`div`,{className:`header-left`,children:[i??(0,p.jsx)(`button`,{onClick:C,className:`btn btn-icon sidebar-toggle-btn`,"aria-label":x(b?`appShell.openMenu`:_?`appShell.expandSidebar`:`appShell.collapseSidebar`),children:(0,p.jsx)(c,{size:16})}),n]}),(0,p.jsxs)(`div`,{className:`header-right`,children:[(0,p.jsx)(o,{className:`btn btn-icon app-language-toggle`}),r]})]}),u]})]})})}function _({onNavigate:e}){let{t}=a(),n=t(`common.brand`);return(0,p.jsxs)(i,{to:`/`,className:`sidebar-header sidebar-header-link`,onClick:e,"aria-label":n,title:n,children:[(0,p.jsx)(s,{size:18}),(0,p.jsx)(`h1`,{children:n})]})}export{f as i,g as n,h as r,_ as t};
@@ -1 +0,0 @@
1
- import{C as e}from"./ui-BpDGD3IR.js";var t=e(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]);export{t};
@@ -1 +0,0 @@
1
- import{C as e}from"./ui-BpDGD3IR.js";var t=e(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]);export{t};
@@ -1 +0,0 @@
1
- import{C as e}from"./ui-BpDGD3IR.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]);export{t};
@@ -1 +0,0 @@
1
- import{C as e}from"./ui-BpDGD3IR.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};
@@ -1 +0,0 @@
1
- import{A as e,h as t,l as n,p as r}from"./index-C-_ZwxuN.js";var i={CID_EMPTY:`cid_empty`,INVALID_CID_FORMAT:`invalid_cid_format`,CID_V1_REQUIRED:`cid_v1_required`,CID_DIGEST_LENGTH:`cid_digest_length`,LINK_EMPTY:`link_empty`,INVALID_URL:`invalid_url`,INVALID_PROTOCOL:`invalid_protocol`,UNSUPPORTED_PATH:`unsupported_path`,UNSUPPORTED_QUERY_PARAM:`unsupported_query_param`};function a(e){return{valid:!1,errorCode:e}}function o(e,t){return{cid:``,errorCode:e,...t?{details:t}:{}}}function s(t){if(!t||typeof t!=`string`)return a(i.CID_EMPTY);let n;try{n=e.parse(t)}catch{return a(i.INVALID_CID_FORMAT)}return n.version===1?n.multihash.digest.length===32?{valid:!0}:a(i.CID_DIGEST_LENGTH):a(i.CID_V1_REQUIRED)}function c(e){if(!e||typeof e!=`string`)return o(i.LINK_EMPTY);let t;try{t=new URL(e)}catch{return o(i.INVALID_URL)}if(t.protocol!==`most:`)return o(i.INVALID_PROTOCOL);if(t.pathname&&t.pathname!==`/`)return o(i.UNSUPPORTED_PATH);let n=t.hostname,r=t.searchParams.get(`filename`),a=[...t.searchParams.keys()].find(e=>e!==`filename`),c=s(n);return c.valid?a?o(i.UNSUPPORTED_QUERY_PARAM,{param:a}):{cid:n,fileName:r?.trim()||n}:o(c.errorCode)}var l={timeout:`检测等待超时,暂时没有等到在线种子响应。请确认分享者或其他下载者仍在线做种,稍后再检测。`,offline:`无法连接本地节点,请确认 MostBox 后端正在运行后再检测。`,missingApi:`当前后端还没有检测接口,请重启 MostBox 后端后再试。`,validation:`链接格式不正确,请粘贴完整的 most://<cid>?filename=... 分享链接。`,nameConflict:`下载目录已有同名文件,请先重命名或移走后再检测。`,noPeer:`暂时没有发现在线种子。请确认分享者或其他下载者仍在线做种,稍后再检测。`,permission:`下载目录不可写,请检查目录权限后再检测。`,starting:`本地节点还没有启动完成,请稍等几秒后重新检测。`,server:`本地节点检测时出错,请稍后重试或查看节点日志。`,fallback:`检测未通过,请确认链接完整、发布者在线且本机网络正常。`};i.INVALID_URL,i.INVALID_PROTOCOL,i.UNSUPPORTED_PATH,i.CID_EMPTY,i.INVALID_CID_FORMAT,i.CID_V1_REQUIRED,i.CID_DIGEST_LENGTH;function u(e={},t=``){if(t===`TimeoutError`)return l.timeout;if(!e.status)return l.offline;if(e.status===404)return l.missingApi;switch(e.code){case`VALIDATION_ERROR`:return l.validation;case`CONFLICT`:return e.error?`${e.error},请先处理同名文件后再下载。`:l.nameConflict;case`PEER_NOT_FOUND`:return l.noPeer;case`PERMISSION_ERROR`:return e.error?`下载目录不可写:${e.error}`:l.permission;case`ENGINE_NOT_INITIALIZED`:return l.starting;default:break}return e.status===503?l.noPeer:e.status>=500?l.server:e.error?`检测未通过:${e.error}`:l.fallback}async function d(e,t){let r=new FormData;r.append(`file`,e,t||e.name);let i=await n.post(`/api/publish`,{body:r});if(!i.ok){let e=await i.json().catch(()=>({error:i.statusText}));throw Error(e.error||`Request failed`)}return i.json()}async function f(e){return u(await r(e),e&&typeof e==`object`&&`name`in e?String(e.name):``)}var p={listPublishedFiles:()=>n.get(`/api/files`).json(),listTrashFiles:()=>n.get(`/api/trash`).json(),deletePublishedFile:e=>n.delete(`/api/files/${e}`).json(),restoreTrashFile:e=>n.post(`/api/trash/${e}/restore`).json(),permanentDeleteTrashFile:e=>n.delete(`/api/trash/${e}`).json(),emptyTrash:()=>n.delete(`/api/trash`).json(),toggleStar:e=>n.post(`/api/files/${e}/star`).json(),getConfig:()=>n.get(`/api/config`).json(),getDataPath:()=>n.get(`/api/config/data-path`).json(),getNetworkAddresses:()=>n.get(`/api/network`).json(),saveConfig:e=>n.post(`/api/config`,{json:e}).json(),publishFile:d,checkDownload:(e,t={})=>{let r=typeof t.timeout==`number`?{link:e,timeout:t.timeout}:{link:e};return n.post(`/api/download/check`,{json:r,timeout:t.requestTimeout??15e3}).json()},downloadFile:e=>n.post(`/api/download`,{json:{link:e}}).json(),cacheFile:e=>n.post(`/api/files/${e}/cache`).json(),cancelDownload:e=>n.post(`/api/download/cancel`,{json:{taskId:e}}).json(),getFileDownloadUrl:e=>t(`/api/files/${e}/download`),moveFile:(e,t)=>n.post(`/api/move`,{json:{cid:e,newFileName:t}}).json(),renameFolder:(e,t)=>n.post(`/api/folder/rename`,{json:{oldPath:e,newPath:t}}).json()},m={[i.LINK_EMPTY]:`app.download.validation.empty`,[i.INVALID_URL]:`app.download.validation.invalidUrl`,[i.INVALID_PROTOCOL]:`app.download.validation.protocol`,[i.UNSUPPORTED_PATH]:`app.download.validation.path`,[i.CID_EMPTY]:`app.download.validation.invalidCid`,[i.INVALID_CID_FORMAT]:`app.download.validation.invalidCid`,[i.CID_V1_REQUIRED]:`app.download.validation.cidV1`,[i.CID_DIGEST_LENGTH]:`app.download.validation.cidDigest`};function h(e){if(!e)return{key:`app.download.validation.empty`};let t=c(e);return t.errorCode?t.errorCode===i.UNSUPPORTED_QUERY_PARAM?{key:`app.download.validation.unsupportedParam`,params:{param:t.details?.param||``}}:{key:m[t.errorCode||``]||`app.download.validation.generic`}:null}function g(e,t){let n=h(e);return n?t(n.key,n.params):null}export{c as i,p as n,f as r,g as t};
@@ -1 +0,0 @@
1
- import{C as e}from"./ui-BpDGD3IR.js";var t=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);export{t};
@@ -1 +0,0 @@
1
- import{C as e}from"./ui-BpDGD3IR.js";var t=e(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]);export{t};
@@ -1 +0,0 @@
1
- import{C as e}from"./ui-BpDGD3IR.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),n=e(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]);export{t as n,n as t};
@@ -1 +0,0 @@
1
- import{C as e}from"./ui-BpDGD3IR.js";var t=e(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]);export{t};