texlite 0.15.0 → 0.17.0
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/DESIGN.md +98 -5
- package/OPERATIONS.md +27 -0
- package/README.md +6 -0
- package/README.zh-CN.md +6 -0
- package/dist/client/assets/AdminUsers-5cAOkdRO.js +1 -0
- package/dist/client/assets/CitationLibraryDialog-G2kKkA2f.js +1 -0
- package/dist/client/assets/Dashboard-BJDFbzQa.js +5 -0
- package/dist/client/assets/GitDialog-BEtLh2S_.js +3 -0
- package/dist/client/assets/GitHubAccountDialog-D2kdCzOs.js +1 -0
- package/dist/client/assets/{HistoryDialog-IurkSJuU.js → HistoryDialog-BwxDdj-j.js} +3 -3
- package/dist/client/assets/LatexEditor-sMjmvA6V.js +141 -0
- package/dist/client/assets/{PdfPreview-BTmvQDCV.js → PdfPreview-z5KnowpL.js} +1 -1
- package/dist/client/assets/ProjectIconPickerDialog-DNV7M7vH.js +1 -0
- package/dist/client/assets/ProjectSettings-Mf8zDGRu.js +1 -0
- package/dist/client/assets/ProjectWorkspace-BJFxjMCn.js +32 -0
- package/dist/client/assets/QuickOpenDialog-C758pouQ.js +1 -0
- package/dist/client/assets/{SelectionHistoryDialog-DiRKiMEt.js → SelectionHistoryDialog-p8L2n4RS.js} +2 -2
- package/dist/client/assets/SystemMetricsDialog-DDiSuglF.js +1 -0
- package/dist/client/assets/TagManagementDialog-BTVERmQS.js +1 -0
- package/dist/client/assets/WordCountDialog-B6RvAI6V.js +1 -0
- package/dist/client/assets/check-Hlb-tLSh.js +1 -0
- package/dist/client/assets/chevron-up-D0psXvTv.js +1 -0
- package/dist/client/assets/{chktex-CZIYuMLb.js → chktex-ZnIx425m.js} +1 -1
- package/dist/client/assets/{citationLibrary-ZeQPCv5O.js → citationLibrary-C9WnXB-1.js} +2 -2
- package/dist/client/assets/clock-3-C71NmJZI.js +1 -0
- package/dist/client/assets/{editor-CLY5CgkY.js → editor-_i6aPXT4.js} +1 -1
- package/dist/client/assets/eye-swovgNYS.js +1 -0
- package/dist/client/assets/github-y6i0qxSV.js +1 -0
- package/dist/client/assets/{hard-drive-B9h-a7KY.js → hard-drive-BqcHPdoY.js} +1 -1
- package/dist/client/assets/index-7WrjzKvC.js +5 -0
- package/dist/client/assets/index-C5T8_lAl.js +1 -0
- package/dist/client/assets/index-DF5cor0N.js +10 -0
- package/dist/client/assets/index-Do5FsFqg.js +1 -0
- package/dist/client/assets/index-Y-wXUwwe.css +1 -0
- package/dist/client/assets/{minimize-2-Crq_SyYM.js → minimize-2-CK7jUy7-.js} +1 -1
- package/dist/client/assets/{minus-Dn3USloe.js → minus-B2sswwWT.js} +1 -1
- package/dist/client/assets/{plus-BwKRQJHI.js → plus-Co7iyp5m.js} +1 -1
- package/dist/client/assets/{refresh-cw-C5yVKb1r.js → refresh-cw-BHVcjInn.js} +1 -1
- package/dist/client/assets/{search-CDyQWr9H.js → search-Tpi6WAga.js} +1 -1
- package/dist/client/assets/{sigma-9fiQHdlo.js → sigma-DoHJQYf7.js} +1 -1
- package/dist/client/assets/spellCheck-BSbFJY9f.js +1 -0
- package/dist/client/assets/{tags-C_3BvsxV.js → tags-BHDlIcSb.js} +1 -1
- package/dist/client/assets/{type-CnT0mBxu.js → type-C-6Jq_0r.js} +1 -1
- package/dist/client/index.html +16 -4
- package/dist/client/texlite-icon.svg +8 -0
- package/dist/server/app.js +6 -1
- package/dist/server/auth.js +0 -3
- package/dist/server/cgroups.js +35 -0
- package/dist/server/chktex.js +3 -4
- package/dist/server/compilerVersions.js +46 -0
- package/dist/server/config.js +8 -0
- package/dist/server/cpuMetrics.js +122 -0
- package/dist/server/db.js +13 -0
- package/dist/server/environment.js +11 -0
- package/dist/server/i18n.js +4 -2
- package/dist/server/latexCompletion.js +11 -88
- package/dist/server/projectOutline.js +4 -39
- package/dist/server/resourceMetrics.js +214 -0
- package/dist/server/routes/citations.js +22 -0
- package/dist/server/routes/projectFiles.js +1 -59
- package/dist/server/routes/system.js +32 -1
- package/dist/server/routes/users.js +21 -3
- package/dist/server/systemMemory.js +51 -0
- package/dist/server/updates.js +116 -0
- package/dist/shared/bibtexReferences.js +5 -1
- package/dist/shared/compilerVersions.js +11 -0
- package/dist/shared/latexCompletion.js +1 -0
- package/dist/shared/latexReferences.js +13 -3
- package/dist/shared/latexSymbols.js +77 -0
- package/dist/shared/resourceMetrics.js +1 -0
- package/dist/shared/updates.js +5 -0
- package/package.json +3 -1
- package/texlite.config.example.json +3 -0
- package/dist/client/assets/AdminUsers-Cau9nlv9.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-Cf_bbSq3.js +0 -1
- package/dist/client/assets/Dashboard-JQ8pJe2d.js +0 -2
- package/dist/client/assets/GitDialog-BcqqWKr-.js +0 -3
- package/dist/client/assets/GitHubAccountDialog-Cqcezf6G.js +0 -1
- package/dist/client/assets/LatexEditor-msdbtTyG.js +0 -141
- package/dist/client/assets/ProjectIconPickerDialog-Cbm-0YQW.js +0 -1
- package/dist/client/assets/ProjectNavigationDialogs-CozcEa2v.js +0 -1
- package/dist/client/assets/ProjectSettings-BlthcpdA.js +0 -1
- package/dist/client/assets/ProjectWorkspace-DUPLJCQ3.js +0 -32
- package/dist/client/assets/SystemMetricsDialog-DJJZueSr.js +0 -1
- package/dist/client/assets/TagManagementDialog-3c-WAWQd.js +0 -1
- package/dist/client/assets/WordCountDialog-BqlX2s36.js +0 -1
- package/dist/client/assets/check-EZ2H-iDj.js +0 -1
- package/dist/client/assets/external-link-DGfNJFKy.js +0 -1
- package/dist/client/assets/github-DJezB5ef.js +0 -1
- package/dist/client/assets/index-BgeOKYIx.js +0 -10
- package/dist/client/assets/index-CMBalIBd.css +0 -1
- package/dist/client/assets/index-DmBKxZf9.js +0 -5
- package/dist/client/assets/spellCheck-BCpcq-VN.js +0 -1
- package/dist/client/assets/user-plus-pxz36w4w.js +0 -1
- package/dist/client/assets/x-DN0Ol4Ya.js +0 -1
- package/dist/server/projectSearch.js +0 -117
package/DESIGN.md
CHANGED
|
@@ -84,6 +84,21 @@ application processes sharing one data directory are not supported.
|
|
|
84
84
|
|
|
85
85
|
## Configuration and startup
|
|
86
86
|
|
|
87
|
+
Update reminders use a single server-side npm `latest` check, with a 24-hour
|
|
88
|
+
success interval, one-hour failure backoff, five-second timeout and shared
|
|
89
|
+
in-flight request. Listening starts the background checker; authenticated
|
|
90
|
+
administrator dashboard requests can also refresh a stale result. The SQLite
|
|
91
|
+
cache survives restarts. Per-administrator dismissals suppress that release and
|
|
92
|
+
older releases, and cascade on account deletion. Both tables are introduced by
|
|
93
|
+
schema migration 5. `updates.enabled: false` disables checks and reminders.
|
|
94
|
+
The dashboard polls the local cached endpoint every 30 minutes and when made
|
|
95
|
+
visible, without adding requests to the writing workspace. The browser never
|
|
96
|
+
contacts the registry. Only the version response is consumed; no project data
|
|
97
|
+
or credentials are sent. Installation detection selects npm or Docker help,
|
|
98
|
+
and administrators can switch the displayed method. Docker help updates the
|
|
99
|
+
launcher with `git pull --ff-only` before image pull/container recreation;
|
|
100
|
+
it explicitly notes that images can lag behind npm. Updates remain manual.
|
|
101
|
+
|
|
87
102
|
The npm package keeps configuration outside the package installation. The
|
|
88
103
|
effective configuration is selected in this order:
|
|
89
104
|
|
|
@@ -150,6 +165,45 @@ Administrators can open the System status view (or authenticated
|
|
|
150
165
|
event-loop, and recent latency summaries. These metrics intentionally exclude
|
|
151
166
|
source text, passwords, tokens, and comment content.
|
|
152
167
|
|
|
168
|
+
Memory uses a storage-style segmented bar: total used memory, service and TeX
|
|
169
|
+
process shares, other usage, and available capacity. Process shares are RSS
|
|
170
|
+
estimates, not exclusive allocations. If they exceed measured usage because of
|
|
171
|
+
shared pages or sampling skew, their visual proportions are fitted inside the
|
|
172
|
+
used region; raw values are preserved and other usage is never negative.
|
|
173
|
+
Unavailable readings remain unavailable rather than being interpreted as zero;
|
|
174
|
+
without a container limit, only the used-memory breakdown is drawn.
|
|
175
|
+
Collection uses only Node.js and OS facilities: Linux `/proc`, macOS
|
|
176
|
+
`ps`, and Windows PowerShell/CIM. Linux containers use cgroup v1/v2 usage and
|
|
177
|
+
visible ancestor limits; an unset/unreadable limit is not replaced with host
|
|
178
|
+
capacity. Container usage includes page cache and other cgroup-accounted memory;
|
|
179
|
+
host usage uses Linux `MemAvailable` where available, otherwise OS free memory.
|
|
180
|
+
The TeX sample matches a fixed set of common engine and auxiliary-tool names,
|
|
181
|
+
including Perl-hosted latexmk and native Harper CLI writing checks, rather than
|
|
182
|
+
tracking only TexLite's own jobs. The existing UI labels remain unchanged.
|
|
183
|
+
It is limited to processes visible to the service, normally the current
|
|
184
|
+
container in Docker. It does not inspect the Docker socket or other containers.
|
|
185
|
+
These are current estimates, not peaks or exclusive allocations; shared pages
|
|
186
|
+
may be counted in multiple RSS values; host usage and process totals are not additive.
|
|
187
|
+
Resource probes run only on authenticated administrator metrics requests, share
|
|
188
|
+
in-flight work and a two-second cache, and never run inside the compile path.
|
|
189
|
+
External probes have time/output limits; unsupported or failed sampling is
|
|
190
|
+
reported as unavailable rather than zero. No additional npm dependency is used.
|
|
191
|
+
|
|
192
|
+
CPU uses the same segmented presentation, with **TexLite + TeX**, other work,
|
|
193
|
+
and idle capacity adding up to 100%. It compares cumulative OS and process CPU
|
|
194
|
+
timers between requests, not load averages or lifetime-average `ps %cpu`.
|
|
195
|
+
The first request (or a gap longer than 15 seconds) primes a fresh window.
|
|
196
|
+
Host percentages cover all logical CPUs; Linux container percentages use cgroup
|
|
197
|
+
CPU usage and the smaller of visible affinity and ancestor quota capacities,
|
|
198
|
+
including fractional CPU quotas. Unavailable container accounting never falls
|
|
199
|
+
back to host-wide busy percentages. TeX CPU timers are gathered in the same
|
|
200
|
+
process scan as memory, with start identities guarding against PID reuse. Native
|
|
201
|
+
counter units are preserved: Linux process ticks are compared to aggregate
|
|
202
|
+
ticks, and macOS/Windows process times are converted to microseconds.
|
|
203
|
+
There is no background sampler. These interval estimates can miss short-lived
|
|
204
|
+
TeX processes that exit between requests; such work can appear under other CPU
|
|
205
|
+
usage. This is a lightweight status indicator, not per-process accounting.
|
|
206
|
+
|
|
153
207
|
## Collaboration and source persistence
|
|
154
208
|
|
|
155
209
|
Each open project has one Yjs room. Awareness data provides active-session
|
|
@@ -367,9 +421,9 @@ text objects.
|
|
|
367
421
|
|
|
368
422
|
| Operation class | Examples | Coordination behavior |
|
|
369
423
|
| --- | --- | --- |
|
|
370
|
-
| Serialized source operation | File writes, settings, Git metadata
|
|
424
|
+
| Serialized source operation | File writes, settings, Git metadata | Waits for queued operations, waits for a ready room, flushes the room, then runs while holding the per-project queue. |
|
|
371
425
|
| Exclusive source replacement | Git checkout/restore, history restore, project deletion, path move | Waits for active compilation, flushes successfully, enters maintenance, performs the replacement, and resets the collaboration epoch. |
|
|
372
|
-
| Consistent source read | Archive/download, raw source, history comparison,
|
|
426
|
+
| Consistent source read | Archive/download, raw source, history comparison, outline, completion index, Git diff/history | Uses the queue and a short snapshot barrier. The barrier blocks disk autosaves while an asynchronous scan/copy runs, then validates the deferred flush before returning. |
|
|
373
427
|
| Background compilation | `latexmk` on an immutable snapshot | Holds a compile reservation but not the ordinary source queue, so editing, source reads, and the retained PDF can continue. |
|
|
374
428
|
| Compile-state cleanup | Cache/artifact recovery | Waits for active compiles and serializes output removal without disconnecting collaborators. |
|
|
375
429
|
| Published PDF read | PDF.js/range requests | Reads an immutable published bundle directly and does not wait for cold Yjs-room initialization; a concurrent cleanup may produce a normal 404. |
|
|
@@ -389,6 +443,17 @@ explicitly enabled, and completion items from built-in LaTeX plus project
|
|
|
389
443
|
outlines are metadata-keyed and coalesced; a source-tree change invalidates the
|
|
390
444
|
corresponding cache.
|
|
391
445
|
|
|
446
|
+
The live editor and server project index share the pure symbol extractor in
|
|
447
|
+
`src/shared/latexSymbols.ts` and the completion data types in
|
|
448
|
+
`src/shared/latexCompletion.ts`. It extracts command argument snippets,
|
|
449
|
+
environments and theorems, packages, classes, source-file references, labels,
|
|
450
|
+
and in-file `\bibitem` definitions using the same comment/literal masking and
|
|
451
|
+
reference rules. The editor owns its document-identity cache and gives current
|
|
452
|
+
unsaved definitions precedence over server candidates. The server owns file
|
|
453
|
+
I/O, metadata caches, built-in candidates, source attribution, and root-scoped
|
|
454
|
+
BibTeX selection; it does not promote in-file `\bibitem` entries to project-wide
|
|
455
|
+
citations. This extractor does not expand TeX macros or load the editor parser.
|
|
456
|
+
|
|
392
457
|
Opening `.tex`, `.bib`, `.sty`, or `.cls` files in editor tabs is an optional
|
|
393
458
|
per-user/per-project preference and is off by default. The active tab is
|
|
394
459
|
highlighted and keyboard accessible. PDF/SyncTeX synchronization is available
|
|
@@ -401,7 +466,33 @@ legacy `stex` stream mode. Grammar sources, local compatibility changes, and
|
|
|
401
466
|
build instructions live in `src/client/latex/README.md`; attribution is recorded
|
|
402
467
|
in `THIRD_PARTY_NOTICES.md`. The parser recognizes command arguments, math,
|
|
403
468
|
sections, and environments, with incremental tree reuse during editing.
|
|
404
|
-
|
|
469
|
+
Editor colors are centralized in `src/client/editorThemes.ts`. Light is the
|
|
470
|
+
default and retains the existing LaTeX and generic BibTeX/BST syntax colors;
|
|
471
|
+
the optional dark palette draws on One Dark's blue-gray surfaces with clear
|
|
472
|
+
prose, subdued cool-gray comments and quieter line numbers. One browser-local
|
|
473
|
+
light/dark/system preference controls the whole application and editor. The
|
|
474
|
+
dashboard user popover groups identity, GitHub integration, language, theme and
|
|
475
|
+
sign-out controls. Explicit light/dark selections remain unchanged; system mode
|
|
476
|
+
follows OS color-scheme changes while the page is open. The default remains light.
|
|
477
|
+
It is stored in localStorage
|
|
478
|
+
(scoped to the deployment base path), never in the database or tied to a
|
|
479
|
+
user/project. Other tabs follow
|
|
480
|
+
storage changes, and the HTML bootstrap applies the preference before the first
|
|
481
|
+
paint. Root-level semantic variables cover the dashboard, workspace and portaled
|
|
482
|
+
dialogs, while PDF paper, images and existing dark diff/log views retain their
|
|
483
|
+
original content colors. CodeMirror's
|
|
484
|
+
dark facet changes through the existing appearance compartment, without
|
|
485
|
+
recreating the editor, document, selection, undo history or Yjs binding.
|
|
486
|
+
Generic BibTeX/BST highlighting adapts CodeMirror's shipped tag rules to the
|
|
487
|
+
same palette variables. Editor popups, completion, search, Vim status,
|
|
488
|
+
diagnostics, source comments and gutter actions use those variables too.
|
|
489
|
+
Comments and brackets have independent color roles. In dark mode, comments on
|
|
490
|
+
the active line, inside a selection or under a search highlight are brighter
|
|
491
|
+
to remain readable. Selection marks use the existing language tree's comment
|
|
492
|
+
tags, restricted to the intersection of the selection and visible ranges;
|
|
493
|
+
they do not introduce another source scanner or force parsing.
|
|
494
|
+
|
|
495
|
+
LaTeX has a semantic palette distinct from generic BibTeX/BST syntax:
|
|
405
496
|
bright blue ordinary commands, teal structure commands and environment names,
|
|
406
497
|
ochre reference keys, rose
|
|
407
498
|
special characters, gray comments and brackets, and purple math delimiters
|
|
@@ -419,10 +510,12 @@ a neutral background.
|
|
|
419
510
|
Cursor-local, real matching environment pairs use the same pale teal accent as
|
|
420
511
|
matching brackets. The white editor uses ink-colored prose, quiet line numbers,
|
|
421
512
|
a pale blue active line and selection, and pale yellow search matches.
|
|
422
|
-
|
|
513
|
+
LaTeX text-color contrast on both editor backgrounds is checked by regression
|
|
423
514
|
tests against the WCAG relative-luminance formula (at least 4.5:1); line numbers
|
|
424
515
|
are intentionally quieter, non-content decoration.
|
|
425
|
-
Pairing accents use a
|
|
516
|
+
Pairing accents use a theme-specific green foreground, also checked against
|
|
517
|
+
their tint. Dark syntax also retains contrast on selection and search accents;
|
|
518
|
+
auxiliary controls and popup text have contrast coverage for both themes.
|
|
426
519
|
Reference keys are colored without a standing diagnostic-like underline; only
|
|
427
520
|
the pointed-at key gains an underline while Ctrl/Cmd is held. Modifier release,
|
|
428
521
|
mouse exit, document/viewport updates and unmount clear this temporary affordance.
|
package/OPERATIONS.md
CHANGED
|
@@ -100,6 +100,32 @@ Uninstalling the package does not remove configuration or data:
|
|
|
100
100
|
npm uninstall --global texlite
|
|
101
101
|
~~~
|
|
102
102
|
|
|
103
|
+
### Update reminders
|
|
104
|
+
|
|
105
|
+
TexLite checks the official npm registry's `latest` release in the background
|
|
106
|
+
once every 24 hours. Only administrators see a dismissible reminder on the
|
|
107
|
+
dashboard, with instructions for npm or Docker. Closing it hides that release
|
|
108
|
+
for that administrator, across browsers and restarts, until a newer version is
|
|
109
|
+
published. Checks time out after five seconds; offline failures keep the cached
|
|
110
|
+
result and retry after one hour. No project data or credentials are sent.
|
|
111
|
+
|
|
112
|
+
Set `"updates": { "enabled": false }` in `texlite.config.json` and restart to
|
|
113
|
+
disable both outbound checks and reminders. Existing configurations enable the
|
|
114
|
+
feature by default without requiring a new entry.
|
|
115
|
+
|
|
116
|
+
For Docker, run these commands from the TexLite-Docker checkout:
|
|
117
|
+
|
|
118
|
+
~~~bash
|
|
119
|
+
git pull --ff-only
|
|
120
|
+
./scripts/compose.sh pull
|
|
121
|
+
./scripts/compose.sh up -d
|
|
122
|
+
~~~
|
|
123
|
+
|
|
124
|
+
The first command updates the launcher. The next two download the image and
|
|
125
|
+
recreate the container as needed, preserving mounted data. There is no need to
|
|
126
|
+
stop it before pulling. Docker images may be published after the npm release;
|
|
127
|
+
the reminder reports the npm version, not a verified Docker image version.
|
|
128
|
+
|
|
103
129
|
### Source installation
|
|
104
130
|
|
|
105
131
|
~~~bash
|
|
@@ -202,6 +228,7 @@ preferred.
|
|
|
202
228
|
| `editHistory.maxStorageMB` | `32` MB | Independent per-project cap for author-attributed selection-edit deltas; retains the newest records and never consumes snapshot storage. |
|
|
203
229
|
| `latex.latexmk` | `latexmk` | Host command. |
|
|
204
230
|
| `latex.defaultEngine` | `xelatex` | Must appear in the allowed list. |
|
|
231
|
+
| `updates.enabled` | `true` | Background release checks and administrator dashboard reminders. Set to `false` for offline deployments. |
|
|
205
232
|
| `latex.allowedEngines` | `pdflatex`, `xelatex`, `lualatex` | Engines available in the UI. |
|
|
206
233
|
| `latex.extraArgs` | `[]` | Additional configured compiler arguments. |
|
|
207
234
|
| `latex.compileTimeoutSeconds` | `600` | Per-job time limit. |
|
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/SWUFE-DB-Group/TexLite/main/src/client/public/texlite-icon.svg" width="72" height="72" alt="TexLite logo" />
|
|
4
|
+
|
|
1
5
|
# TexLite
|
|
2
6
|
|
|
3
7
|
A lightweight self-hosted alternative to Overleaf for _small, trusted_ research
|
|
@@ -11,6 +15,8 @@ teams. Use your existing LaTeX distribution, with no heavyweight service stack.
|
|
|
11
15
|
|
|
12
16
|
**Website:** [TexLite GitHub Pages](https://swufe-db-group.github.io/TexLite/)
|
|
13
17
|
|
|
18
|
+
</div>
|
|
19
|
+
|
|
14
20
|

|
|
15
21
|

|
|
16
22
|
|
package/README.zh-CN.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/SWUFE-DB-Group/TexLite/main/src/client/public/texlite-icon.svg" width="72" height="72" alt="TexLite 标志" />
|
|
4
|
+
|
|
1
5
|
# TexLite
|
|
2
6
|
|
|
3
7
|
面向*小型、可信*研究团队的轻量自托管 Overleaf 替代方案。直接使用现有的 LaTeX
|
|
@@ -11,6 +15,8 @@
|
|
|
11
15
|
|
|
12
16
|
**网站:** [TexLite GitHub Pages](https://swufe-db-group.github.io/TexLite/)
|
|
13
17
|
|
|
18
|
+
</div>
|
|
19
|
+
|
|
14
20
|

|
|
15
21
|

|
|
16
22
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as Ce,r,j as e}from"./react-CltQJflK.js";import{U as se,D as Ne,a as we,b as Se,c as ve,d as Pe}from"./index-Do5FsFqg.js";import{c as q,a as N,e as w,L as ae,M as K,C as ke}from"./index-DF5cor0N.js";import{U as ze,n as re,X as B,E as Me,T as te,m as Te}from"./index-C5T8_lAl.js";import{S as De}from"./search-Tpi6WAga.js";const ne=q("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);const ie=q("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const oe=q("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);function le($=10){const n="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%",L=crypto.getRandomValues(new Uint8Array($));return Array.from(L,s=>n[s%n.length]).join("")}function Ae({currentUser:$,minPasswordLength:n,onBack:L}){const{t:s}=Ce(),[H,ce]=r.useState([]),[V,I]=r.useState(""),[Q,j]=r.useState(1),[o,de]=r.useState({page:1,pageSize:20,total:0,totalPages:0}),[x,X]=r.useState(!0),[S,G]=r.useState(!1),[ue,me]=r.useState(0),[W,Y]=r.useState(""),[v,P]=r.useState(""),[i,k]=r.useState(!1),[z,d]=r.useState("");r.useEffect(()=>{if(!v)return;const a=window.setTimeout(()=>P(""),3e3);return()=>window.clearTimeout(a)},[v]);const[he,M]=r.useState(!1),[t,h]=r.useState({username:"",displayName:"",password:"",role:"user",canCreateProjects:!1}),[T,D]=r.useState(null),[g,E]=r.useState(""),[b,F]=r.useState(null),[J,O]=r.useState(!1),[u,Z]=r.useState(!1),[_,f]=r.useState(""),[l,R]=r.useState(null),[U,ee]=r.useState(!1),[pe,y]=r.useState(""),C=V.trim(),A=()=>me(a=>a+1);r.useEffect(()=>{const a=new AbortController;X(!0),G(!1),Y("");const m=window.setTimeout(()=>{const c=new URLSearchParams({page:String(Q)});C&&c.set("q",C),N(`/api/admin/users?${c}`,{signal:a.signal}).then(p=>{a.signal.aborted||(ce(p.users),de(p.pagination),j(p.pagination.page))}).catch(p=>{a.signal.aborted||(Y(w(p)),G(!0))}).finally(()=>{a.signal.aborted||X(!1)})},C?200:0);return()=>{window.clearTimeout(m),a.abort()}},[C,Q,ue]);const je=async()=>{if(!i){if(t.password.length<n)return d(s("auth.passwordMinimum",{count:n}));k(!0),d("");try{await N("/api/admin/users",{method:"POST",body:JSON.stringify({username:t.username,displayName:t.displayName||t.username,password:t.password,role:t.role,canCreateProjects:t.canCreateProjects})}),M(!1),h({username:"",displayName:"",password:"",role:"user",canCreateProjects:!1}),A(),P(s("users.saved"))}catch(a){d(w(a))}finally{k(!1)}}},xe=async a=>{R({target:a,setting:a.role==="admin"?"demote":"promote"}),y("")},ge=async a=>{R({target:a,setting:a.canCreateProjects?"denyProjectCreation":"allowProjectCreation"}),y("")},be=async()=>{if(!l||U)return;const{target:a,setting:m}=l,c=m==="demote"?{role:"user"}:m==="promote"?{role:"admin"}:{canCreateProjects:m==="allowProjectCreation"};ee(!0),y("");try{await N(`/api/admin/users/${a.id}`,{method:"PATCH",body:JSON.stringify(c)}),A(),R(null),P(s("users.saved"))}catch(p){y(w(p))}finally{ee(!1)}},fe=async()=>{if(!(!T||!g||i)){if(g.length<n)return d(s("auth.passwordMinimum",{count:n}));k(!0),d("");try{await N(`/api/admin/users/${T.id}`,{method:"PATCH",body:JSON.stringify({password:g})}),D(null),E(""),P(s("users.saved"))}catch(a){d(w(a))}finally{k(!1)}}},ye=async()=>{if(!(!b||u)){Z(!0),f("");try{await N(`/api/admin/users/${b.id}`,{method:"DELETE",body:JSON.stringify({deleteProjects:J})}),F(null),O(!1),A()}catch(a){f(w(a))}finally{Z(!1)}}};return e.jsxs("section",{className:"admin-users-page",children:[e.jsxs("div",{className:"section-title",children:[e.jsxs("div",{children:[e.jsxs("h1",{children:[e.jsx(ze,{"aria-hidden":!0,size:25}),s("users.manage")]}),e.jsx("p",{className:"muted",children:s("users.onlyAdmin")})]}),e.jsxs("button",{type:"button",className:"dashboard-back-button",onClick:L,children:[e.jsx(re,{size:15}),s("projects.title")]})]}),e.jsxs("div",{className:"admin-user-toolbar",children:[e.jsxs("div",{className:"admin-user-filters",children:[e.jsxs("div",{className:"admin-user-search",role:"search",children:[e.jsx(De,{"aria-hidden":!0,size:16}),e.jsx("input",{role:"searchbox","aria-label":s("users.searchPlaceholder"),placeholder:s("users.searchPlaceholder"),value:V,onChange:a=>{I(a.target.value),j(1)}}),V&&e.jsx("button",{type:"button","aria-label":s("users.clearSearch"),title:s("users.clearSearch"),onClick:()=>{I(""),j(1)},children:e.jsx(B,{"aria-hidden":!0,size:14})})]}),!x&&!S&&e.jsx("span",{className:"admin-user-count",role:"status",children:s("users.total",{count:o.total})})]}),e.jsxs("button",{className:"primary icon-button admin-user-add",onClick:()=>{d(""),M(!0)},children:[e.jsx(se,{"aria-hidden":!0,size:15}),s("users.add")]})]}),v&&e.jsx("p",{className:"admin-user-notice",role:"status",children:v}),W&&e.jsx("p",{className:"error",role:"alert",children:W}),e.jsx("div",{className:"table-card admin-user-table","aria-busy":x,children:e.jsxs("table",{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:s("common.user")}),e.jsx("th",{children:s("users.role")}),e.jsx("th",{children:s("users.createProjects")}),e.jsx("th",{children:s("users.ownedProjects")}),e.jsx("th",{children:s("users.actions")})]})}),e.jsx("tbody",{children:x?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"admin-user-list-state",children:e.jsxs("span",{role:"status",children:[e.jsx(ae,{className:"spin",size:16}),s("common.loading")]})})}):S?e.jsx("tr",{children:e.jsxs("td",{colSpan:5,className:"admin-user-list-state",children:[e.jsx("span",{children:s("users.loadFailed")}),e.jsx("button",{type:"button",onClick:A,children:s("common.retry")})]})}):H.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"admin-user-list-state",children:s(C?"users.noMatches":"users.empty")})}):H.map(a=>{const m=a.id===$.id,c=i||U;return e.jsxs("tr",{children:[e.jsxs("td",{className:"admin-user-identity",children:[e.jsx("strong",{children:a.displayName}),e.jsxs("small",{children:["@",a.username]})]}),e.jsx("td",{children:m?e.jsxs("span",{className:"admin-user-badge",title:s("users.selfProtected"),children:[e.jsx(oe,{size:12,"aria-hidden":!0}),s("common.admin")]}):e.jsxs("select",{className:"admin-user-role","aria-label":s("users.roleFor",{username:a.username}),value:a.role,disabled:c,onChange:()=>{xe(a)},children:[e.jsx("option",{value:"user",children:s("common.user")}),e.jsx("option",{value:"admin",children:s("common.admin")})]})}),e.jsx("td",{children:a.role==="admin"?e.jsxs("span",{className:"admin-user-locked",title:s("users.adminCreation"),children:[e.jsx(oe,{size:12,"aria-hidden":!0}),s("users.allow")]}):e.jsx("button",{type:"button",className:"admin-user-switch",role:"switch","aria-checked":a.canCreateProjects,"aria-label":s("users.creationFor",{username:a.username}),disabled:c,onClick:()=>{ge(a)},children:e.jsx("span",{})})}),e.jsx("td",{children:a.ownedProjects??0}),e.jsx("td",{children:e.jsxs("div",{className:"admin-user-actions",children:[e.jsxs("button",{className:"icon-button",disabled:c,onClick:()=>{D(a),E(""),d("")},children:[e.jsx(ie,{"aria-hidden":!0,size:13}),s("users.resetPassword")]}),!m&&e.jsxs(Ne,{modal:!1,children:[e.jsx(we,{asChild:!0,children:e.jsx("button",{className:"icon-button",disabled:c,"aria-label":s("users.actionsFor",{username:a.username}),children:e.jsx(Me,{size:17,"aria-hidden":!0})})}),e.jsx(Se,{children:e.jsx(ve,{className:"comment-actions-menu-content",align:"end",sideOffset:5,children:e.jsxs(Pe,{className:"danger-text",onSelect:()=>{F(a),O(!1),f("")},children:[e.jsx(te,{size:14,"aria-hidden":!0}),s("users.deleteTitle")]})})})]})]})})]},a.id)})})]})}),o.totalPages>1&&e.jsxs("nav",{className:"project-pagination admin-user-pagination","aria-label":s("users.pagination"),children:[e.jsxs("button",{type:"button",disabled:x||S||o.page<=1,onClick:()=>j(o.page-1),children:[e.jsx(re,{size:15}),s("users.previousPage")]}),e.jsx("span",{children:s("users.pageOf",{page:o.page,totalPages:o.totalPages})}),e.jsxs("button",{type:"button",disabled:x||S||o.page>=o.totalPages,onClick:()=>j(o.page+1),children:[s("users.nextPage"),e.jsx(Te,{size:15})]})]}),e.jsxs(K,{open:he,title:s("users.add"),description:s("users.addDescription"),onOpenChange:a=>{i||M(a)},footer:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"icon-button",disabled:i,onClick:()=>M(!1),children:[e.jsx(B,{"aria-hidden":!0,size:14}),s("common.cancel")]}),e.jsxs("button",{className:"primary icon-button",disabled:i||!t.username.trim()||t.password.length<n,onClick:()=>{je()},children:[e.jsx(se,{"aria-hidden":!0,size:14}),s("users.createUser")]})]}),children:[z&&e.jsx("p",{className:"error",role:"alert",children:z}),e.jsxs("fieldset",{className:"admin-user-form form-stack",disabled:i,children:[e.jsxs("label",{className:"form-field",children:[s("auth.username"),e.jsx("input",{value:t.username,onChange:a=>h({...t,username:a.target.value})})]}),e.jsxs("label",{className:"form-field",children:[s("users.displayName"),e.jsx("input",{value:t.displayName,onChange:a=>h({...t,displayName:a.target.value})})]}),e.jsxs("label",{className:"form-field",children:[s("users.initialPassword"),e.jsxs("span",{className:"password-generator",children:[e.jsx("input",{minLength:n,autoComplete:"new-password",value:t.password,onChange:a=>h({...t,password:a.target.value})}),e.jsxs("button",{type:"button",title:s("users.generatePassword"),onClick:()=>h({...t,password:le()}),children:[e.jsx(ne,{size:15}),s("users.randomPassword")]})]}),e.jsx("small",{className:"field-hint",children:s("auth.passwordMinimum",{count:n})})]}),e.jsxs("label",{className:"form-field",children:[s("users.role"),e.jsxs("select",{value:t.role,onChange:a=>h({...t,role:a.target.value}),children:[e.jsx("option",{value:"user",children:s("common.user")}),e.jsx("option",{value:"admin",children:s("common.admin")})]})]}),e.jsxs("label",{className:"checkbox-field",children:[e.jsx("input",{type:"checkbox",checked:t.canCreateProjects||t.role==="admin",disabled:t.role==="admin",onChange:a=>h({...t,canCreateProjects:a.target.checked})})," ",s("users.allowCreate")]})]})]}),e.jsxs(K,{open:!!T,title:s("users.resetPassword"),description:s("users.resetDescription",{username:T?.username??""}),onOpenChange:a=>{!a&&!i&&D(null)},footer:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"icon-button",disabled:i,onClick:()=>D(null),children:[e.jsx(B,{"aria-hidden":!0,size:14}),s("common.cancel")]}),e.jsxs("button",{className:"primary icon-button",disabled:i||g.length<n,onClick:()=>{fe()},children:[e.jsx(ie,{"aria-hidden":!0,size:14}),s("users.reset")]})]}),children:[z&&e.jsx("p",{className:"error",role:"alert",children:z}),e.jsxs("label",{className:"form-field",children:[s("auth.newPassword"),e.jsxs("span",{className:"password-generator",children:[e.jsx("input",{disabled:i,autoFocus:!0,minLength:n,autoComplete:"new-password",value:g,onChange:a=>E(a.target.value)}),e.jsxs("button",{type:"button",disabled:i,onClick:()=>E(le()),children:[e.jsx(ne,{size:15}),s("users.randomPassword")]})]}),e.jsx("small",{className:"field-hint",children:s("auth.passwordMinimum",{count:n})})]})]}),e.jsx(K,{open:!!b,title:s("users.deleteTitle"),description:s("users.deleteDescription",{username:b?.username??""}),onOpenChange:a=>{!a&&!u&&(F(null),f(""))},footer:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"icon-button",disabled:u,onClick:()=>{F(null),f("")},children:[e.jsx(B,{"aria-hidden":!0,size:14}),s("common.cancel")]}),e.jsxs("button",{className:"danger icon-button",disabled:u,"aria-busy":u,onClick:()=>{ye()},children:[u?e.jsx(ae,{className:"spin","aria-hidden":!0,size:14}):e.jsx(te,{"aria-hidden":!0,size:14}),s(u?"common.loading":"users.deleteTitle")]})]}),children:e.jsxs(e.Fragment,{children:[_&&e.jsx("p",{className:"error dialog-error",children:_}),e.jsxs("fieldset",{className:"choice-group",disabled:u,children:[e.jsx("legend",{children:s("users.ownedChoice",{count:b?.ownedProjects??0})}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:!J,onChange:()=>O(!1)})," ",s("users.transferProjects")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:J,onChange:()=>O(!0)})," ",s("users.deleteProjects")]})]})]})}),e.jsx(ke,{open:!!l,title:s(`userConfirmations.${l?.setting??"demote"}Title`),description:s(`userConfirmations.${l?.setting??"demote"}Description`,{username:l?.target.username??""}),confirmLabel:s(`userConfirmations.${l?.setting??"demote"}Confirm`),danger:l?.setting!=="promote"&&l?.setting!=="allowProjectCreation",busy:U,error:pe,onCancel:()=>{U||(R(null),y(""))},onConfirm:()=>{be()}})]})}export{Ae as AdminUsers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as fe,r as s,j as e}from"./react-CltQJflK.js";import{c as De,M as re,L as q,C as Fe,a as A,e as D}from"./index-DF5cor0N.js";import{C as Ge}from"./chevron-up-D0psXvTv.js";import{C as Ze,X as Z,i as et,T as Re,B as oe,n as xe,m as tt,p as Ke}from"./index-C5T8_lAl.js";import{T as Oe}from"./tags-BHDlIcSb.js";import{C as I}from"./check-Hlb-tLSh.js";import{P as le}from"./plus-Co7iyp5m.js";import{parseBibEntriesResult as it,citationBibtexLimitLabel as at,parseSingleBibEntry as Me,citationVenue as nt}from"./citationLibrary-C9WnXB-1.js";import{S as st}from"./search-Tpi6WAga.js";const ot=De("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);const rt=De("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);function lt({tags:l,selectedId:y,onSelect:b,onManage:C}){const{t:c}=fe(),[x,k]=s.useState(!1),[N,j]=s.useState(Number.POSITIVE_INFINITY),[T,a]=s.useState(),w=s.useRef(null),K=y?[...l.filter(d=>d.id===y),...l.filter(d=>d.id!==y)]:l;s.useLayoutEffect(()=>{const d=w.current;if(!d)return;const g=()=>{const z=Array.from(d.querySelectorAll("button")),M=[...new Set(z.map(u=>u.offsetTop))][2],h=M===void 0?z:z.filter(u=>u.offsetTop<M);j(h.length),a(h.length?Math.max(...h.map(u=>u.offsetTop+u.offsetHeight)):void 0)};g();const L=new ResizeObserver(g);return L.observe(d),()=>L.disconnect()},[l,y]);const m=N<l.length+1;return e.jsxs("div",{className:"citation-tag-bar",children:[e.jsxs("div",{className:"citation-tag-filter-catalog",children:[e.jsx("div",{className:"citation-tag-filter-clip",style:!x&&m?{maxHeight:T}:void 0,children:e.jsxs("div",{className:"citation-tag-filters",ref:w,children:[e.jsx("button",{type:"button",className:y?"":"active","aria-pressed":!y,onClick:()=>b(""),children:c("citationLibrary.allTags")}),K.map((d,g)=>{const L=!x&&g+1>=N;return e.jsxs("button",{type:"button",className:y===d.id?"active":"","aria-pressed":y===d.id,"aria-hidden":L||void 0,tabIndex:L?-1:0,title:d.name,onClick:()=>b(y===d.id?"":d.id),children:[e.jsx("span",{className:`citation-tag-dot tag-${d.color}`}),e.jsx("span",{className:"citation-tag-name",children:d.name})]},d.id)})]})}),l.length===0&&e.jsx("span",{className:"muted",children:c("citationLibrary.noTags")}),m&&e.jsxs("button",{type:"button",className:"citation-tag-expand","aria-expanded":x,onClick:()=>k(d=>!d),children:[x?e.jsx(Ge,{size:13}):e.jsx(Ze,{size:13}),c(x?"citationTagManagement.collapse":"citationTagManagement.expand")]})]}),e.jsxs("button",{type:"button",className:"citation-tag-manage",onClick:C,children:[e.jsx(Oe,{size:14}),c("citationTagManagement.title")]})]})}const ct=["red","orange","yellow","green","blue","purple","gray"];function dt({tags:l,onClose:y,onUpdated:b,onDeleted:C}){const{t:c}=fe(),[x,k]=s.useState(""),[N,j]=s.useState("green"),[T,a]=s.useState(null),[w,K]=s.useState(""),[m,d]=s.useState("green"),[g,L]=s.useState(!1),[z,E]=s.useState(""),[M,h]=s.useState(""),[u,V]=s.useState(null),[ce,F]=s.useState("");s.useEffect(()=>{if(!M)return;const r=window.setTimeout(()=>h(""),2e3);return()=>window.clearTimeout(r)},[M]);const O=async r=>{const p=(r?w:x).trim();if(!(g||!p)){L(!0),E(""),h("");try{const f=await A(r?`/api/citations/tags/${encodeURIComponent(r.id)}`:"/api/citations/tags",{method:r?"PATCH":"POST",body:JSON.stringify({name:p,color:r?m:N})});b(f.tag),r?a(null):k(""),h(c(r?"citationLibrary.tagsUpdated":f.created===!1?"citationTagManagement.exists":"citationLibrary.tagCreated"))}catch(f){E(D(f))}finally{L(!1)}}},Q=async()=>{if(!(!u||g)){L(!0),F(""),h("");try{await A(`/api/citations/tags/${encodeURIComponent(u.id)}`,{method:"DELETE"}),C(u.id),T?.id===u.id&&a(null),V(null),h(c("citationTagManagement.deleted"))}catch(r){F(D(r))}finally{L(!1)}}},ee=ct.map(r=>e.jsx("option",{value:r,children:c(`tags.${r}`)},r));return e.jsxs(e.Fragment,{children:[e.jsx(re,{open:!0,wide:!0,className:"tag-management-modal",title:c("citationTagManagement.title"),description:c("citationTagManagement.description"),onOpenChange:r=>{!r&&!g&&y()},footer:e.jsx("button",{disabled:g,onClick:y,children:c("common.close")}),children:e.jsxs("div",{className:"tag-management",children:[z&&e.jsx("p",{className:"error dialog-error",role:"alert",children:z}),M&&e.jsxs("p",{className:"citation-library-notice",role:"status",children:[e.jsx(I,{size:14}),M,e.jsx("button",{"aria-label":c("common.close"),onClick:()=>h(""),children:e.jsx(Z,{size:13})})]}),e.jsxs("fieldset",{disabled:g,className:"citation-tag-management-fields",children:[e.jsxs("form",{className:"tag-management-create",onSubmit:r=>{r.preventDefault(),O()},children:[e.jsxs("label",{className:"tag-management-field",children:[e.jsx("span",{children:c("tags.name")}),e.jsx("input",{autoFocus:!0,maxLength:32,value:x,placeholder:c("citationLibrary.newTagPlaceholder"),onChange:r=>k(r.target.value)})]}),e.jsxs("label",{className:"tag-management-field tag-management-color",children:[e.jsx("span",{children:c("tags.color")}),e.jsx("select",{value:N,onChange:r=>j(r.target.value),children:ee})]}),e.jsxs("button",{type:"submit",className:"primary",disabled:!x.trim(),children:[g?e.jsx(q,{className:"spin",size:14}):e.jsx(le,{size:14}),c("citationLibrary.createTag")]})]}),l.length===0?e.jsx("p",{className:"tag-management-empty",children:c("citationLibrary.noTags")}):e.jsx("div",{className:"tag-management-list",children:l.map(r=>e.jsxs("article",{className:`tag-management-item${T?.id===r.id?" editing":""}`,children:[e.jsxs("div",{className:"tag-management-item-main",children:[e.jsx("span",{className:`tag-dot tag-${r.color}`,"aria-hidden":!0}),e.jsx("strong",{title:r.name,children:r.name})]}),e.jsxs("div",{className:"tag-management-item-actions",children:[e.jsx("button",{type:"button","aria-label":c("citationTagManagement.edit",{tag:r.name}),onClick:()=>{a(r),K(r.name),d(r.color),E("")},children:e.jsx(et,{size:14})}),e.jsx("button",{type:"button",className:"danger-text","aria-label":c("citationTagManagement.delete",{tag:r.name}),onClick:()=>{V(r),F("")},children:e.jsx(Re,{size:14})})]}),T?.id===r.id&&e.jsxs("form",{className:"tag-management-edit",onSubmit:p=>{p.preventDefault(),O(r)},children:[e.jsxs("label",{className:"tag-management-field",children:[e.jsx("span",{children:c("tags.rename")}),e.jsx("input",{maxLength:32,value:w,onChange:p=>K(p.target.value)})]}),e.jsxs("label",{className:"tag-management-field tag-management-color",children:[e.jsx("span",{children:c("tags.color")}),e.jsx("select",{value:m,onChange:p=>d(p.target.value),children:ee})]}),e.jsxs("div",{className:"tag-management-edit-actions",children:[e.jsx("button",{type:"button",onClick:()=>{a(null),E("")},children:c("common.cancel")}),e.jsxs("button",{type:"submit",className:"primary",disabled:!w.trim(),children:[e.jsx(I,{size:14}),c("common.save")]})]})]})]},r.id))})]})]})}),e.jsx(Fe,{open:!!u,title:c("tags.deleteTitle"),description:c("citationTagManagement.deleteDescription",{tag:u?.name??""}),confirmLabel:c("common.delete"),danger:!0,busy:g,error:ce,onCancel:()=>{g||V(null)},onConfirm:()=>{Q()}})]})}const mt=[],ut={status:"empty",entries:mt};function Nt({open:l,onOpenChange:y,page:b=!1,onBack:C,currentFile:c="",currentSource:x="",readOnly:k=!1,currentUserId:N,maxBibtexBytes:j,onInsert:T}){const{t:a}=fe(),[w,K]=s.useState("library"),[m,d]=s.useState(""),[g,L]=s.useState(""),[z,E]=s.useState([]),[M,h]=s.useState(1),[u,V]=s.useState({page:1,pageSize:60,total:0,totalPages:0}),[ce,F]=s.useState(0),[O,Q]=s.useState([]),[ee,r]=s.useState(!1),[p,f]=s.useState(null),[te,_]=s.useState([]),[de,ve]=s.useState(!1),[_e,Ne]=s.useState(!1),[X,B]=s.useState(null),[S,P]=s.useState(null),[me,ue]=s.useState(""),[$e,H]=s.useState(!1),[ie,ye]=s.useState(""),[Le,ge]=s.useState(null),[he,ae]=s.useState(null),[Ie,G]=s.useState(""),[W,v]=s.useState(""),[ne,$]=s.useState("");s.useEffect(()=>{if(!ne)return;const t=window.setTimeout(()=>$(""),2e3);return()=>window.clearTimeout(t)},[ne]),s.useEffect(()=>{l||r(!1)},[l]);const[Ce,R]=s.useState(new Map),[He,se]=s.useState(!1),[Ue,Je]=s.useState(0),U=!!(/\.bib$/i.test(c)&&T),pe=s.useMemo(()=>l&&U?it(x,j):ut,[l,x,U,j]),Te=pe.status==="too-large",we=pe.status==="invalid",J=pe.entries,qe=s.useMemo(()=>new Set(J.map(t=>t.citationKey.toLowerCase())),[J]);s.useEffect(()=>{if(!l)return;const t=new AbortController,n=window.setTimeout(()=>{Ne(!0),v("");const i=new URLSearchParams;m.trim()&&i.set("q",m.trim()),g&&i.set("tag",g),i.set("page",String(M)),i.set("pageSize","60"),A(`/api/citations?${i.toString()}`,{signal:t.signal}).then(o=>{E(o.entries),V(o.pagination),o.pagination.page!==M&&h(o.pagination.page)}).catch(o=>{o instanceof Error&&o.name==="AbortError"||v(D(o))}).finally(()=>{t.signal.aborted||Ne(!1)})},m.trim()?180:0);return()=>{window.clearTimeout(n),t.abort()}},[l,m,g,M,ce]),s.useEffect(()=>{if(!l)return;const t=new AbortController;return A("/api/citations/tags",{signal:t.signal}).then(n=>Q(n.tags)).catch(n=>{n instanceof Error&&n.name==="AbortError"||v(D(n))}),()=>t.abort()},[l]),s.useEffect(()=>{if(!l||!U){R(new Map),se(!1);return}const t=new AbortController,n=[...new Set(J.map(i=>i.citationKey))];return n.length?(se(!0),A("/api/citations/lookup",{method:"POST",body:JSON.stringify({keys:n}),signal:t.signal}).then(i=>{R(new Map(i.matches.map(o=>[o.citationKey.toLowerCase(),o])))}).catch(i=>{i instanceof Error&&i.name==="AbortError"||v(D(i))}).finally(()=>{t.signal.aborted||se(!1)}),()=>t.abort()):(R(new Map),se(!1),()=>t.abort())},[l,U,J,Ue]),s.useEffect(()=>{l&&(K("library"),d(""),L(""),h(1),V({page:1,pageSize:60,total:0,totalPages:0}),P(null),H(!1),ye(""),f(null),ge(null),ae(null),G(""),v(""),$(""),R(new Map))},[l,U]);const Ve=async t=>{B(t.citationKey),v("");try{const n=Ce.get(t.citationKey.toLowerCase()),i=await A("/api/citations",{method:"POST",body:JSON.stringify({bibtex:t.bibtex,citationKey:t.citationKey,entryType:t.entryType,title:t.title,authors:t.authors,year:t.year,overwrite:!!n,expectedRevision:n?.revision})});E(o=>[i.entry,...o.filter(Y=>Y.id!==i.entry.id&&Y.citationKey.toLowerCase()!==i.entry.citationKey.toLowerCase())]),R(o=>new Map(o).set(i.entry.citationKey.toLowerCase(),{id:i.entry.id,citationKey:i.entry.citationKey,revision:i.entry.revision})),f(i.entry),_(i.entry.tags.map(o=>o.id)),$(i.updated?a("citationLibrary.updated"):a("citationLibrary.saved")),h(1),F(o=>o+1)}catch(n){v(D(n)),Je(i=>i+1)}finally{B(null)}},Se=async()=>{if(S){B(S.citationKey),v("");try{const t=Me(me,j);if(!t){v(a("citationErrors.invalid"));return}const n=await A(`/api/citations/${encodeURIComponent(S.id)}`,{method:"PATCH",body:JSON.stringify({bibtex:t.bibtex,citationKey:t.citationKey,entryType:t.entryType,title:t.title,authors:t.authors,year:t.year,expectedRevision:S.revision})});E(i=>[n.entry,...i.filter(o=>o.id!==n.entry.id)]),R(i=>{const o=new Map(i);return o.delete(S.citationKey.toLowerCase()),o.set(n.entry.citationKey.toLowerCase(),{id:n.entry.id,citationKey:n.entry.citationKey,revision:n.entry.revision}),o}),P(null),$(a("citationLibrary.updated")),h(1),F(i=>i+1)}catch(t){v(D(t))}finally{B(null)}}},Be=async()=>{if(ie.trim()){B("__new__"),v("");try{const t=Me(ie,j);if(!t){v(a("citationErrors.invalid"));return}const n=await A("/api/citations",{method:"POST",body:JSON.stringify({bibtex:t.bibtex,citationKey:t.citationKey,entryType:t.entryType,title:t.title,authors:t.authors,year:t.year})});E(i=>[n.entry,...i.filter(o=>o.id!==n.entry.id&&o.citationKey.toLowerCase()!==n.entry.citationKey.toLowerCase())]),R(i=>new Map(i).set(n.entry.citationKey.toLowerCase(),{id:n.entry.id,citationKey:n.entry.citationKey,revision:n.entry.revision})),H(!1),ye(""),$(n.updated?a("citationLibrary.updated"):a("citationLibraryActions.added")),f(n.entry),_(n.entry.tags.map(i=>i.id)),h(1),F(i=>i+1)}catch(t){v(D(t))}finally{B(null)}}},We=t=>{Q(i=>[...i.filter(o=>o.id!==t.id),t].sort((o,Y)=>o.name.localeCompare(Y.name)));const n=i=>({...i,tags:i.tags.map(o=>o.id===t.id?t:o)});E(i=>i.map(n)),f(i=>i?n(i):null),P(i=>i?n(i):null)},Ye=t=>{Q(i=>i.filter(o=>o.id!==t));const n=i=>({...i,tags:i.tags.filter(o=>o.id!==t)});E(i=>i.map(n)),f(i=>i?n(i):null),P(i=>i?n(i):null),_(i=>i.filter(o=>o!==t)),g===t&&(L(""),h(1))},Qe=t=>{P(null),H(!1),f(t),_(t.tags.map(n=>n.id))},be=async()=>{if(p){ve(!0),v("");try{const t=await A(`/api/citations/${encodeURIComponent(p.id)}/tags`,{method:"PATCH",body:JSON.stringify({tagIds:te,expectedRevision:p.revision})});E(n=>n.map(i=>i.id===t.entry.id?t.entry:i)),R(n=>new Map(n).set(t.entry.citationKey.toLowerCase(),{id:t.entry.id,citationKey:t.entry.citationKey,revision:t.entry.revision})),f(t.entry),_(t.entry.tags.map(n=>n.id)),$(a("citationLibrary.tagsUpdated")),F(n=>n+1)}catch(t){v(D(t))}finally{ve(!1)}}},Xe=async t=>{ge(t.id),G("");try{await A(`/api/citations/${encodeURIComponent(t.id)}`,{method:"DELETE"}),E(n=>n.filter(i=>i.id!==t.id)),R(n=>{const i=new Map(n);return i.delete(t.citationKey.toLowerCase()),i}),S?.id===t.id&&P(null),p?.id===t.id&&f(null),$(a("citationLibrary.deleted")),h(1),F(n=>n+1),ae(null)}catch(n){G(D(n))}finally{ge(null)}},Ee=e.jsxs("div",{className:"citation-library-dialog",children:[e.jsxs("div",{className:"citation-library-tabs",role:"tablist","aria-label":a("citationLibrary.title"),children:[e.jsxs("button",{type:"button",role:"tab","aria-selected":w==="library",className:w==="library"?"active":"",onClick:()=>K("library"),children:[e.jsx(oe,{size:15}),a("citationLibrary.myLibrary"),e.jsx("span",{children:u.total})]}),U&&e.jsxs("button",{type:"button",role:"tab","aria-selected":w==="current",className:w==="current"?"active":"",onClick:()=>K("current"),children:[e.jsx(le,{size:15}),a("citationLibrary.currentFile"),e.jsx("span",{children:J.length})]})]}),W&&!(b&&(p||S))&&e.jsx("p",{className:"error dialog-error",children:W}),ne&&e.jsxs("p",{className:"citation-library-notice",role:"status",children:[e.jsx(I,{size:14}),ne,e.jsx("button",{type:"button","aria-label":a("common.close"),onClick:()=>$(""),children:e.jsx(Z,{size:13})})]}),w==="library"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"citation-library-search-row",children:[e.jsxs("label",{className:"citation-library-search",children:[e.jsx(st,{size:15}),e.jsx("input",{autoFocus:!0,placeholder:a("citationLibrary.searchPlaceholder"),value:m,onChange:t=>{d(t.target.value),h(1)}}),e.jsx("span",{children:a("citationLibrary.searchHint")})]}),e.jsxs("button",{type:"button",className:"citation-add-entry-button",onClick:()=>{H(!0),P(null),f(null)},children:[e.jsx(le,{size:14}),a("citationLibraryActions.addEntry")]})]}),e.jsx(lt,{tags:O,selectedId:g,onSelect:t=>{L(t),h(1)},onManage:()=>r(!0)}),$e&&e.jsxs("div",{className:"citation-edit-panel",children:[e.jsxs("div",{className:"citation-edit-header",children:[e.jsxs("div",{children:[e.jsx("strong",{children:a("citationLibraryActions.addEntryTitle")}),e.jsx("small",{children:a("citationLibraryActions.addEntryDescription")})]}),e.jsx("button",{type:"button","aria-label":a("common.close"),onClick:()=>H(!1),children:e.jsx(Z,{size:15})})]}),e.jsx("textarea",{autoFocus:!0,value:ie,onChange:t=>ye(t.target.value),placeholder:a("citationLibraryActions.addEntryPlaceholder"),spellCheck:!1,rows:9}),e.jsxs("div",{className:"citation-edit-actions",children:[e.jsx("button",{type:"button",onClick:()=>H(!1),children:a("common.cancel")}),e.jsxs("button",{type:"button",className:"primary",disabled:!ie.trim()||X==="__new__",onClick:()=>{Be()},children:[X==="__new__"?e.jsx(q,{className:"spin",size:14}):e.jsx(I,{size:14}),a("citationLibraryActions.addEntry")]})]})]}),_e?e.jsxs("div",{className:"citation-library-empty",children:[e.jsx(q,{className:"spin",size:22}),e.jsx("span",{children:a("common.loading")})]}):z.length===0?e.jsxs("div",{className:"citation-library-empty",children:[e.jsx(oe,{size:28}),e.jsx("strong",{children:a("citationLibrary.emptyTitle")}),e.jsx("span",{children:a(g?"citationLibrary.noTagMatches":"citationLibrary.emptyDescription")})]}):e.jsx("div",{className:"citation-entry-list",children:z.map(t=>e.jsxs("div",{className:"citation-entry-item",children:[e.jsx(Pe,{entry:t,selected:p?.id===t.id||S?.id===t.id,alreadyInFile:!b&&qe.has(t.citationKey.toLowerCase()),importDisabled:k,deleting:Le===t.id,onImport:T?async()=>{await T(t)&&y(!1)}:void 0,onEdit:t.ownerId===N?()=>{f(null),H(!1),P(t),ue(t.bibtex)}:void 0,onTags:t.ownerId===N?()=>Qe(t):void 0,onDelete:t.ownerId===N?()=>{ae(t),G("")}:void 0,t:a}),!b&&p?.id===t.id&&e.jsx(je,{entry:p,tags:O,selectedIds:te,saving:de,onClose:()=>f(null),onToggle:n=>_(i=>i.includes(n)?i.filter(o=>o!==n):[...i,n]),onSave:()=>{be()},t:a}),!b&&S?.id===t.id&&e.jsx(Ae,{title:a("citationLibrary.editTitle",{key:S.citationKey}),value:me,saving:X===S.citationKey,onChange:ue,onClose:()=>P(null),onSave:()=>{Se()},t:a})]},t.id))}),u.totalPages>1&&e.jsxs("nav",{className:"citation-library-pagination","aria-label":a("citationLibraryPagination.pageOf",{page:u.page,totalPages:u.totalPages,count:u.total}),children:[e.jsxs("button",{type:"button",disabled:u.page<=1,onClick:()=>h(t=>Math.max(1,t-1)),children:[e.jsx(xe,{size:14}),a("citationLibraryPagination.previous")]}),e.jsx("span",{children:a("citationLibraryPagination.pageOf",{page:u.page,totalPages:u.totalPages,count:u.total})}),e.jsxs("button",{type:"button",disabled:u.page>=u.totalPages,onClick:()=>h(t=>Math.min(u.totalPages,t+1)),children:[a("citationLibraryPagination.next"),e.jsx(tt,{size:14})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"citation-current-heading",children:[e.jsxs("div",{children:[e.jsx("strong",{children:a("citationLibrary.currentFileTitle")}),e.jsx("span",{children:a("citationLibrary.currentFileDescription")})]}),e.jsxs("button",{type:"button",onClick:()=>K("library"),children:[e.jsx(xe,{size:14}),a("citationLibrary.backToLibrary")]})]}),Te&&e.jsxs("p",{className:"warning citation-library-warning",children:[e.jsx(Ke,{size:15}),a("citationLibrary.fileTooLarge",{size:at(j)})]}),we&&e.jsxs("p",{className:"warning citation-library-warning",children:[e.jsx(Ke,{size:15}),a("citationLibrary.fileInvalid")]}),J.length===0?e.jsxs("div",{className:"citation-library-empty",children:[e.jsx(oe,{size:28}),e.jsx("strong",{children:a("citationLibrary.noEntries")}),e.jsx("span",{children:a(Te?"citationLibrary.fileTooLargeHint":we?"citationLibrary.fileInvalidHint":"citationLibrary.noEntriesDescription")})]}):e.jsx("div",{className:"citation-entry-list",children:J.map((t,n)=>e.jsxs("div",{className:"citation-entry-item",children:[e.jsx(Pe,{entry:t,saved:Ce.has(t.citationKey.toLowerCase()),saving:X===t.citationKey,saveDisabled:He,onSave:()=>{Ve(t)},t:a}),!b&&p?.citationKey.toLowerCase()===t.citationKey.toLowerCase()&&e.jsx(je,{entry:p,tags:O,selectedIds:te,saving:de,onClose:()=>f(null),onToggle:i=>_(o=>o.includes(i)?o.filter(Y=>Y!==i):[...o,i]),onSave:()=>{be()},t:a})]},`${t.citationKey}-${n}`))})]})]}),ke=e.jsx(Fe,{open:!!he,title:a("citationLibrary.deleteTitle"),description:a("citationLibrary.deleteDescription",{key:he?.citationKey??""}),confirmLabel:a("common.delete"),danger:!0,error:Ie,busy:!!Le,onCancel:()=>{ae(null),G("")},onConfirm:()=>{const t=he;t&&Xe(t)}}),ze=l&&ee&&e.jsx(dt,{tags:O,onClose:()=>r(!1),onUpdated:We,onDeleted:Ye});return b?e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"citation-library-page",children:[e.jsxs("header",{className:"section-title citation-library-page-header",children:[e.jsxs("div",{children:[e.jsxs("h1",{children:[e.jsx(oe,{"aria-hidden":!0,size:25}),a("citationLibrary.title")]}),e.jsx("p",{children:a("citationLibraryHomeDescription")})]}),C&&e.jsxs("button",{type:"button",className:"dashboard-back-button",onClick:C,children:[e.jsx(xe,{size:15}),a("projects.title")]})]}),Ee]}),p&&e.jsx(re,{open:!0,title:a("citationLibrary.tagsTitle",{key:p.citationKey}),description:a("citationLibrary.tags"),onOpenChange:t=>{t||(f(null),v(""))},children:e.jsxs(e.Fragment,{children:[W&&e.jsx("p",{className:"error dialog-error",children:W}),e.jsx(je,{entry:p,tags:O,selectedIds:te,saving:de,modal:!0,onClose:()=>{f(null),v("")},onToggle:t=>_(n=>n.includes(t)?n.filter(i=>i!==t):[...n,t]),onSave:()=>{be()},t:a})]})}),S&&e.jsx(re,{open:!0,extraWide:!0,title:a("citationLibrary.editTitle",{key:S.citationKey}),description:a("citationLibrary.title"),onOpenChange:t=>{t||(P(null),v(""))},children:e.jsxs(e.Fragment,{children:[W&&e.jsx("p",{className:"error dialog-error",children:W}),e.jsx(Ae,{title:a("citationLibrary.editTitle",{key:S.citationKey}),value:me,saving:X===S.citationKey,modal:!0,onChange:ue,onClose:()=>{P(null),v("")},onSave:()=>{Se()},t:a})]})}),ke,ze]}):e.jsxs(e.Fragment,{children:[e.jsx(re,{open:l,extraWide:!0,className:"citation-library-modal",title:a("citationLibrary.title"),description:a(U?"citationLibrary.description":"citationLibraryHomeDescription",{file:c}),onOpenChange:y,footer:e.jsx("button",{onClick:()=>y(!1),children:a("common.close")}),children:Ee}),ke,ze]})}function Pe({entry:l,selected:y,alreadyInFile:b,saved:C,saving:c,saveDisabled:x,importDisabled:k,deleting:N,onSave:j,onImport:T,onEdit:a,onTags:w,onDelete:K,t:m}){const d="id"in l,g=d?l:null,L=nt(l);return e.jsxs("article",{className:`citation-entry-card${y?" selected":""}${b?" already-in-file":""}`,title:b?m("citationErrors.alreadyInFile",{key:l.citationKey}):void 0,children:[e.jsxs("div",{className:"citation-entry-main",children:[e.jsxs("div",{className:"citation-entry-heading",children:[e.jsx("code",{children:l.citationKey}),e.jsxs("span",{children:["@",l.entryType]}),L&&e.jsx("span",{className:"citation-entry-venue",title:L,children:L}),C&&e.jsxs("em",{children:[e.jsx(I,{size:11}),m("citationLibrary.savedLabel")]})]}),e.jsx("strong",{children:l.title||m("citationLibrary.untitled")}),e.jsxs("p",{children:[l.authors||m("citationLibrary.authorUnknown"),l.year&&e.jsxs("span",{children:[" · ",l.year]})]}),g&&g.tags.length>0&&e.jsx("div",{className:"citation-entry-tags",children:g.tags.map(z=>e.jsxs("span",{className:`citation-tag-pill tag-${z.color}`,children:[e.jsx("span",{className:"citation-tag-dot"}),z.name]},z.id))})]}),e.jsxs("div",{className:"citation-entry-actions",children:[j&&e.jsxs("button",{type:"button",className:C?"saved":"primary",disabled:c||x,onClick:j,children:[c||x?e.jsx(q,{className:"spin",size:13}):C?e.jsx(I,{size:13}):e.jsx(le,{size:13}),m(c?"citationLibrary.saving":C?"citationLibrary.update":"citationLibrary.save")]}),T&&e.jsxs("button",{type:"button",disabled:k||b,title:b?m("citationErrors.alreadyInFile",{key:l.citationKey}):m(k?"citationLibrary.importRequiresWrite":"citationLibrary.importToFile"),onClick:()=>{T()},children:[e.jsx(ot,{size:13}),m("citationLibrary.import")]}),g&&w&&e.jsxs("button",{type:"button",onClick:w,children:[e.jsx(Oe,{size:13}),m("citationLibrary.tags")]}),d&&a&&e.jsxs("button",{type:"button",onClick:a,children:[e.jsx(rt,{size:13}),m("common.edit")]}),d&&K&&e.jsxs("button",{type:"button",className:"danger-text",disabled:N,onClick:K,children:[N?e.jsx(q,{className:"spin",size:13}):e.jsx(Re,{size:13}),m("common.delete")]})]})]})}function je({entry:l,tags:y,selectedIds:b,saving:C,modal:c=!1,onClose:x,onToggle:k,onSave:N,t:j}){const T=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"citation-tag-choice-list",children:y.length===0?e.jsx("span",{className:"muted",children:j("citationLibrary.noTagsToAssign")}):y.map(a=>e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:b.includes(a.id),onChange:()=>k(a.id)}),e.jsx("span",{className:`citation-tag-dot tag-${a.color}`}),a.name]},a.id))}),e.jsxs("div",{className:"citation-edit-actions",children:[e.jsx("button",{type:"button",onClick:x,children:j("common.cancel")}),e.jsxs("button",{type:"button",className:"primary",disabled:C||y.length===0,onClick:N,children:[C?e.jsx(q,{className:"spin",size:14}):e.jsx(I,{size:14}),j("citationLibrary.saveTags")]})]})]});return c?e.jsx("div",{className:"citation-modal-form",children:T}):e.jsxs("div",{className:"citation-tag-editor",children:[e.jsxs("div",{className:"citation-edit-header",children:[e.jsx("strong",{children:j("citationLibrary.tagsTitle",{key:l.citationKey})}),e.jsx("button",{type:"button","aria-label":j("common.close"),onClick:x,children:e.jsx(Z,{size:15})})]}),T]})}function Ae({title:l,value:y,saving:b,modal:C=!1,onChange:c,onClose:x,onSave:k,t:N}){const j=e.jsxs(e.Fragment,{children:[e.jsx("textarea",{autoFocus:!C,value:y,onChange:T=>c(T.target.value),spellCheck:!1,rows:12}),e.jsxs("div",{className:"citation-edit-actions",children:[e.jsx("button",{type:"button",onClick:x,children:N("common.cancel")}),e.jsxs("button",{type:"button",className:"primary",disabled:!y.trim()||b,onClick:k,children:[b?e.jsx(q,{className:"spin",size:14}):e.jsx(I,{size:14}),N("common.save")]})]})]});return C?e.jsx("div",{className:"citation-modal-form citation-edit-panel",children:j}):e.jsxs("div",{className:"citation-edit-panel",children:[e.jsxs("div",{className:"citation-edit-header",children:[e.jsx("strong",{children:l}),e.jsx("button",{type:"button","aria-label":N("common.close"),onClick:x,children:e.jsx(Z,{size:15})})]}),j]})}export{Nt as CitationLibraryDialog};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SystemMetricsDialog-DDiSuglF.js","./react-CltQJflK.js","./index-DF5cor0N.js","./index-Y-wXUwwe.css","./clock-3-C71NmJZI.js","./index-C5T8_lAl.js","./refresh-cw-BHVcjInn.js","./github-y6i0qxSV.js","./hard-drive-BqcHPdoY.js","./sigma-DoHJQYf7.js","./tags-BHDlIcSb.js","./CitationLibraryDialog-G2kKkA2f.js","./chevron-up-D0psXvTv.js","./check-Hlb-tLSh.js","./plus-Co7iyp5m.js","./citationLibrary-C9WnXB-1.js","./search-Tpi6WAga.js","./AdminUsers-5cAOkdRO.js","./index-Do5FsFqg.js","./TagManagementDialog-BTVERmQS.js","./ProjectIconPickerDialog-DNV7M7vH.js","./GitHubAccountDialog-D2kdCzOs.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as i,u as ba,s as Ma,L as xe,e as F,M as ee,a as P,b as it,d as Ue,S as Ca,f as Ot,g as $e,C as Na,h as wa,_ as oe,i as at,j as za}from"./index-DF5cor0N.js";import{u as He,j as e,r}from"./react-CltQJflK.js";import{P as Sa,a as Ta,C as Vt,b as Pa,c as Aa,X as Bt,G as Da,F as La,L as Ea,N as Ia,d as Fa,e as Oa,f as Va,S as qa,B as Ht,g as Ua,h as $a,i as Ba,D as Ha,T as Ra,E as _a,M as Rt,A as _t,j as st,U as Za,k as qt,l as Ga,m as Ut,n as Ka,o as Wa,p as Ja}from"./index-C5T8_lAl.js";import{G as Qa,E as Xa,F as Ya}from"./github-y6i0qxSV.js";import{H as es}from"./hard-drive-BqcHPdoY.js";import{S as ts}from"./sigma-DoHJQYf7.js";import{T as nt}from"./tags-BHDlIcSb.js";const as=i("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);const ss=i("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);const Be=i("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const ns=i("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);const Zt=i("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);const rs=i("Atom",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]]);const is=i("Beaker",[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]]);const os=i("BellOff",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);const cs=i("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const ls=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"}]]);const ds=i("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const ps=i("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);const hs=i("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);const us=i("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);const Gt=i("CalendarDays",[["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"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);const ms=i("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);const ys=i("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);const gs=i("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]);const js=i("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);const xs=i("ChartScatter",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);const ks=i("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);const fs=i("CircuitBoard",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]]);const vs=i("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);const bs=i("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);const Ms=i("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"}]]);const Cs=i("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);const Ns=i("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);const ws=i("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);const Kt=i("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const zs=i("FileChartColumnIncreasing",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);const Ss=i("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);const Ts=i("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);const Ps=i("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);const As=i("FolderArchive",[["circle",{cx:"15",cy:"19",r:"2",key:"u2pros"}],["path",{d:"M20.9 19.8A2 2 0 0 0 22 18V8a2 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 2h5.1",key:"1jj40k"}],["path",{d:"M15 11v-1",key:"cntcp"}],["path",{d:"M15 17v-2",key:"1279jj"}]]);const Ds=i("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);const rt=i("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);const Ls=i("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);const Es=i("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const Is=i("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"}]]);const Fs=i("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"}]]);const Os=i("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);const Vs=i("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);const qs=i("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);const Us=i("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);const $s=i("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);const Bs=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"}]]);const Hs=i("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);const Rs=i("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);const _s=i("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);const Zs=i("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);const Gs=i("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);const Ks=i("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);const Ws=i("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);const Js=i("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const Qs=i("Regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]);const Xs=i("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);const Ys=i("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);const en=i("ShieldCheck",[["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:"m9 12 2 2 4-4",key:"dzmm74"}]]);const Wt=i("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const tn=i("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);const an=i("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"}]]);const sn=i("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);const nn=i("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);const rn=i("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);const on=i("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);const cn=i("TestTubes",[["path",{d:"M9 2v17.5A2.5 2.5 0 0 1 6.5 22A2.5 2.5 0 0 1 4 19.5V2",key:"1hjrqt"}],["path",{d:"M20 2v17.5a2.5 2.5 0 0 1-2.5 2.5a2.5 2.5 0 0 1-2.5-2.5V2",key:"16lc8n"}],["path",{d:"M3 2h7",key:"7s29d5"}],["path",{d:"M14 2h7",key:"7sicin"}],["path",{d:"M9 16H4",key:"1bfye3"}],["path",{d:"M20 16h-5",key:"ddnjpe"}]]);const ln=i("University",[["circle",{cx:"12",cy:"10",r:"1",key:"1gnqs8"}],["path",{d:"M22 20V8h-4l-6-4-6 4H2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"1qj5sn"}],["path",{d:"M6 17v.01",key:"roodi6"}],["path",{d:"M6 13v.01",key:"67c122"}],["path",{d:"M18 17v.01",key:"12ktxm"}],["path",{d:"M18 13v.01",key:"tn1rt1"}],["path",{d:"M14 22v-5a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"11g7fi"}]]);const dn=i("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);const pn=i("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),hn=[{value:"light",icon:an},{value:"dark",icon:Hs},{value:"system",icon:Bs}];function un(){const{t:s}=He(),c=ba();return e.jsx("div",{className:"theme-switcher",role:"group","aria-label":s("theme.title"),children:hn.map(({value:h,icon:y})=>e.jsxs("button",{type:"button","aria-pressed":c===h,onClick:()=>Ma(h),children:[e.jsx(y,{"aria-hidden":!0,size:14}),e.jsx("span",{children:s(`theme.${h}`)})]},h))})}function mn({user:s,onGitHub:c,onSignOut:h}){const{t:y,i18n:k}=He(),[l,a]=r.useState(!1),[j,u]=r.useState(!1),[x,C]=r.useState(""),d=r.useRef(!1),N=r.useRef(!1),A=r.useRef(null),z=r.useId(),p=s.displayName||s.username,w=Array.from(p.trim())[0]?.toLocaleUpperCase()??"?",S=async()=>{if(!d.current){d.current=!0,u(!0),C("");try{await h()}catch(b){C(F(b))}finally{d.current=!1,u(!1)}}};return e.jsxs(Sa,{open:l,onOpenChange:b=>{a(b),b&&C("")},children:[e.jsx(Ta,{asChild:!0,children:e.jsxs("button",{type:"button",className:"user-menu-trigger","aria-label":y("account.menu",{name:p}),children:[e.jsx("span",{className:"user-menu-avatar","aria-hidden":"true",children:w}),e.jsx("span",{className:"user-menu-name",children:p}),e.jsx(Vt,{size:14,"aria-hidden":"true"})]})}),e.jsx(Pa,{children:e.jsxs(Aa,{ref:A,tabIndex:-1,className:"user-menu-content",align:"end",sideOffset:10,collisionPadding:12,"aria-label":y("account.menu",{name:p}),onOpenAutoFocus:b=>{b.preventDefault(),A.current?.focus()},onCloseAutoFocus:b=>{N.current&&b.preventDefault(),N.current=!1},children:[e.jsxs("div",{className:"user-menu-profile",children:[e.jsx("span",{className:"user-menu-avatar","aria-hidden":"true",children:w}),e.jsxs("div",{children:[e.jsx("strong",{children:p}),e.jsxs("span",{children:["@",s.username]})]}),e.jsx("button",{type:"button",className:"user-menu-github","aria-label":y("account.openGithubSettings"),"data-tooltip":y("account.githubTitle"),onClick:()=>{N.current=!0,a(!1),c()},children:e.jsx(Qa,{size:19,"aria-hidden":"true"})})]}),e.jsxs("div",{className:"user-menu-settings",children:[e.jsxs("div",{className:"user-menu-language",children:[e.jsxs("label",{htmlFor:z,children:[e.jsx(Kt,{size:16,"aria-hidden":"true"}),y("common.language")]}),e.jsxs("div",{className:"user-menu-language-select",children:[e.jsxs("select",{id:z,value:k.resolvedLanguage?.startsWith("zh")?"zh":"en",onChange:b=>{k.changeLanguage(b.target.value)},children:[e.jsx("option",{value:"en",children:y("common.languageEnglish")}),e.jsx("option",{value:"zh",children:y("common.languageChinese")})]}),e.jsx(Vt,{size:13,"aria-hidden":"true"})]})]}),e.jsxs("div",{className:"user-menu-theme",children:[e.jsxs("span",{className:"user-menu-setting-label",children:[e.jsx(Gs,{size:16,"aria-hidden":"true"}),y("theme.title")]}),e.jsx(un,{})]})]}),x&&e.jsx("p",{className:"user-menu-error",role:"alert",children:x}),e.jsxs("button",{type:"button",className:"user-menu-signout",disabled:j,"aria-busy":j,onClick:()=>{S()},children:[j?e.jsx(xe,{size:16,className:"spin","aria-hidden":"true"}):e.jsx(qs,{size:16,"aria-hidden":"true"}),y("auth.logout")]})]})})]})}const yn={npm:`npm install --global texlite@latest
|
|
3
|
+
texlite restart`,docker:`git pull --ff-only
|
|
4
|
+
./scripts/compose.sh pull
|
|
5
|
+
./scripts/compose.sh up -d`};function gn({userId:s}){const{t:c}=He(),[h,y]=r.useState(null),[k,l]=r.useState(!1),[a,j]=r.useState("npm"),[u,x]=r.useState(!1),[C,d]=r.useState(""),N=r.useRef(!1),A=r.useRef(null);r.useEffect(()=>{const p=new AbortController;let w=!1;const S=async()=>{if(!(document.visibilityState==="hidden"||w)){w=!0;try{const D=await P("/api/admin/updates",{signal:p.signal});if(p.signal.aborted||D.update?.latestVersion===A.current)return;y(D.update)}catch{}finally{w=!1}}};S();const b=window.setInterval(()=>{S()},30*6e4),O=()=>{document.visibilityState==="visible"&&S()};return document.addEventListener("visibilitychange",O),()=>{p.abort(),window.clearInterval(b),document.removeEventListener("visibilitychange",O)}},[s]);const z=async()=>{if(!(!h||N.current)){N.current=!0,x(!0),d("");try{await P("/api/admin/updates/dismiss",{method:"POST",body:JSON.stringify({version:h.latestVersion})}),A.current=h.latestVersion,y(p=>p?.latestVersion===h.latestVersion?null:p),l(!1)}catch(p){d(F(p))}finally{N.current=!1,x(!1)}}};return h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"update-notice",role:"status",children:[e.jsx(ks,{"aria-hidden":!0,size:17}),e.jsx("span",{children:c("updates.available",{version:h.latestVersion})}),e.jsx("button",{type:"button",className:"update-notice-details",onClick:()=>{j(h.method),l(!0)},children:c("updates.howToUpdate")}),e.jsx("button",{type:"button",className:"update-notice-dismiss",disabled:u,onClick:()=>{z()},"aria-label":c("updates.dismiss"),title:c("updates.dismiss"),children:e.jsx(Bt,{"aria-hidden":!0,size:16})})]}),C&&!k&&e.jsx("p",{className:"error",role:"alert",children:C}),e.jsxs(ee,{open:k,onOpenChange:l,title:c("updates.title"),description:c("updates.versions",{current:h.currentVersion,latest:h.latestVersion}),footer:e.jsxs("button",{type:"button",className:"update-dismiss-action",disabled:u,onClick:()=>{z()},children:[e.jsx(os,{"aria-hidden":!0,size:15}),c("updates.dismiss")]}),children:[e.jsx("div",{className:"update-methods",role:"group","aria-label":c("updates.method"),children:["npm","docker"].map(p=>e.jsx("button",{type:"button","aria-pressed":a===p,"aria-controls":"update-instructions",onClick:()=>j(p),children:p==="npm"?"npm":"Docker"},p))}),e.jsxs("div",{id:"update-instructions",children:[e.jsx("p",{className:"update-command-hint",children:c(a==="npm"?"updates.npmHint":"updates.dockerHint")}),e.jsx("pre",{className:"update-commands",children:e.jsx("code",{children:yn[a]})}),e.jsx("p",{className:"muted update-command-hint",children:c(a==="npm"?"updates.restartHint":"updates.imageHint")})]}),e.jsx("div",{className:"update-links",children:e.jsxs("a",{href:"https://github.com/SWUFE-DB-Group/TexLite/releases",target:"_blank",rel:"noreferrer",children:[c("updates.releaseNotes"),e.jsx(Xa,{"aria-hidden":!0,size:12})]})}),C&&e.jsx("p",{className:"error",role:"alert",children:C})]})]}):null}const Jt=["file-text","book-open","notebook-pen","book-marked","scroll-text","library","graduation-cap","presentation","image","folder-kanban","microscope","flask-conical","test-tube-diagonal","atom","dna","telescope","earth","map","languages","university","code-2","file-code-2","database","server","network","circuit-board","brain","brain-circuit","bot","shield-check","workflow","sigma","calculator","chart-no-axes-combined","line-chart","bar-chart-3","pie-chart","chart-scatter","file-spreadsheet","file-chart-column-increasing","lightbulb","rocket","target","sparkles","file-pen-line","file-stack","folder","folder-open","folder-archive","archive","bookmark","newspaper","notepad-text","sticky-note","pen-tool","quote","list-tree","file-search","beaker","test-tubes","folder-git-2","git-branch","terminal","braces","regex","cpu","hard-drive","cloud","users-round","calendar-days"],jn=new Set(Jt);function xn(s){return typeof s=="string"&&jn.has(s)}function kn(s){if(typeof s!="string")return null;const c=s.trim().replace(/^lucide:/i,"");return!c||c.length>96?null:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(c)?c:null}const fn={"file-text":$a,"book-open":Ua,"notebook-pen":Zs,"book-marked":Ht,"scroll-text":qa,library:Os,"graduation-cap":Ls,presentation:Ws,image:Is,"folder-kanban":Ds,microscope:$s,"flask-conical":Ps,"test-tube-diagonal":on,atom:rs,dna:ws,telescope:nn,earth:Kt,map:Us,languages:Fs,university:ln,"code-2":bs,"file-code-2":Va,database:Ns,server:Ys,network:Rs,"circuit-board":fs,brain:hs,"brain-circuit":ps,bot:ls,"shield-check":en,workflow:pn,sigma:ts,calculator:us,"chart-no-axes-combined":gs,"line-chart":ys,"bar-chart-3":ms,"pie-chart":js,"chart-scatter":xs,"file-spreadsheet":Oa,"file-chart-column-increasing":zs,lightbulb:Vs,rocket:Xs,target:sn,sparkles:Wt,"file-pen-line":Ss,"file-stack":Ts,folder:Fa,"folder-open":rt,"folder-archive":As,archive:Be,bookmark:cs,newspaper:_s,"notepad-text":Ia,"sticky-note":tn,"pen-tool":Ks,quote:Js,"list-tree":Ea,"file-search":La,beaker:is,"test-tubes":cn,"folder-git-2":Ya,"git-branch":Da,terminal:rn,braces:ds,regex:Qs,cpu:Cs,"hard-drive":es,cloud:vs,"users-round":dn,"calendar-days":Gt},$n=Jt.map(s=>({name:s}));function vn(s){const c=Array.from(s.trim())[0];return c?c.toLocaleUpperCase():"?"}function bn({icon:s,fallback:c,size:h=18}){const y=xn(s)?fn[s]:null;if(y)return e.jsx(y,{"aria-hidden":"true",size:h,strokeWidth:1.9});const k=kn(s);if(k){const a=`url(${it(`/api/project-icons/${encodeURIComponent(k)}`)})`,j={maskImage:a,WebkitMaskImage:a};return e.jsx("span",{"aria-hidden":"true",className:"project-icon-external-glyph",style:j})}return e.jsx("span",{"aria-hidden":"true",children:c})}function Qt({icon:s,projectName:c,editable:h=!1,onEdit:y,editLabel:k,title:l,className:a=""}){const j=e.jsx(bn,{icon:s,fallback:vn(c)}),u=`project-icon-avatar${h?" editable":""}${a?` ${a}`:""}`;return h&&y?e.jsx("button",{type:"button",className:u,title:k,"aria-label":k,onClick:y,children:j}):e.jsx("span",{className:u,title:l,"aria-hidden":"true",children:j})}function Xt({project:s,currentUser:c,showArchived:h,archiveBusy:y,menuOpen:k,t:l,variant:a,onToggleMenu:j,onCloseMenu:u,onAssignTags:x,onRename:C,onDuplicate:d,onArchive:N,onTransfer:A,onDelete:z}){const p=r.useRef(null),w=s.permission==="owner",S=c.role==="admin"||c.canCreateProjects,b=s.ownerId===c.id,O=s.permission==="owner";r.useEffect(()=>{if(!k)return;const m=q=>{q.target instanceof Node&&!p.current?.contains(q.target)&&u()},V=q=>{q.key==="Escape"&&u()};return document.addEventListener("pointerdown",m),document.addEventListener("keydown",V),()=>{document.removeEventListener("pointerdown",m),document.removeEventListener("keydown",V)}},[k,u]);const D=[{id:"tags",label:l("tags.assign"),icon:e.jsx(nt,{"aria-hidden":!0,size:15}),section:"main",onSelect:x},...w?[{id:"rename",label:l("projects.rename"),icon:e.jsx(Ba,{"aria-hidden":!0,size:15}),section:"main",onSelect:C}]:[],...S?[{id:"duplicate",label:l("projects.duplicate"),icon:e.jsx(Ms,{"aria-hidden":!0,size:15}),section:"main",onSelect:d}]:[],{id:"download",label:l("projects.download"),icon:e.jsx(Ha,{"aria-hidden":!0,size:15}),section:"main",href:it(`/api/projects/${s.id}/download`)},{id:"archive",label:l(h?"projects.unarchive":"projects.archive"),icon:h?e.jsx(ss,{"aria-hidden":!0,size:15}):e.jsx(Be,{"aria-hidden":!0,size:15}),section:"main",disabled:y,onSelect:N},...b?[{id:"transfer",label:l("projects.transfer"),icon:e.jsx(Zt,{"aria-hidden":!0,size:15}),section:"main",onSelect:A}]:[],...O?[{id:"delete",label:l("common.delete"),icon:e.jsx(Ra,{"aria-hidden":!0,size:15}),section:"danger",onSelect:z}]:[]],te=D.filter(m=>m.section==="main"),L=D.filter(m=>m.section==="danger"),ce=m=>{m.disabled||(u(),m.onSelect?.())};return e.jsxs("div",{ref:p,className:`project-action-menu-root project-action-menu-${a}`,onClick:m=>m.stopPropagation(),children:[e.jsx("button",{type:"button",className:"project-action-menu-trigger","aria-label":l("projects.projectActions",{project:s.name}),"aria-expanded":k,"aria-controls":`project-actions-${s.id}`,onClick:m=>{m.stopPropagation(),j()},children:e.jsx(_a,{"aria-hidden":!0,size:19})}),k&&e.jsxs("div",{id:`project-actions-${s.id}`,className:"project-action-menu",role:"group","aria-label":l("projects.projectActions",{project:s.name}),children:[te.map(m=>m.href?e.jsxs("a",{href:m.href,download:!0,onClick:V=>{V.stopPropagation(),u()},children:[m.icon,m.label]},m.id):e.jsxs("button",{type:"button",disabled:m.disabled,onClick:V=>{V.stopPropagation(),ce(m)},children:[m.icon,m.label]},m.id)),L.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"project-action-menu-separator","aria-hidden":"true"}),L.map(m=>e.jsxs("button",{type:"button",className:"danger",onClick:V=>{V.stopPropagation(),ce(m)},children:[m.icon,m.label]},m.id))]})]})]})}function Mn({project:s,currentUser:c,showArchived:h,archiveBusy:y,menuOpen:k,t:l,formatCreatedDate:a,formatUpdatedTime:j,formatExactTime:u,onOpenProject:x,onOpenMention:C,onToggleMenu:d,onCloseMenu:N,onAssignTags:A,onRename:z,onDuplicate:p,onArchive:w,onTransfer:S,onDelete:b,onChooseIcon:O}){const D=s.ownerDisplayName??s.ownerUsername??l("projects.deletedUser"),te=s.lastModifiedDisplayName??s.lastModifiedUsername??l("projects.deletedUser");return e.jsxs("article",{className:`project-card project-list-row${s.ownerId===c.id?" owned-project":""}${k?" project-list-menu-open":""}`,onClick:L=>{L.target===L.currentTarget&&x()},children:[e.jsx(Qt,{icon:s.icon,projectName:s.name,title:s.name,editable:s.permission==="owner",editLabel:l("projectIcons.change"),onEdit:O,className:"project-list-avatar"}),e.jsx("span",{className:"project-list-summary",children:e.jsx("button",{type:"button",className:"project-list-cell-open project-list-summary-open",onClick:x,"aria-label":l("projects.openProject",{project:s.name}),children:e.jsxs("span",{className:"project-list-title-line",children:[e.jsx("strong",{className:"project-list-title",title:s.name,children:s.name}),!!(s.unresolvedCommentCount&&s.unresolvedCommentCount>0)&&e.jsxs("span",{className:"project-comments-badge unresolved",title:l("projects.unresolvedCommentsTooltip",{unresolved:s.unresolvedCommentCount,total:s.commentCount??s.unresolvedCommentCount}),children:[e.jsx(Rt,{"aria-hidden":!0,size:10}),e.jsx("span",{children:l("projects.unresolvedCount",{count:s.unresolvedCommentCount})})]}),s.tags?.length>0&&e.jsx("span",{className:"project-list-tags",children:s.tags.map(L=>e.jsx("span",{className:`tag tag-${L.color} project-list-tag`,title:L.name,children:L.name},L.id))})]})})}),e.jsxs("button",{type:"button",className:"project-list-cell-open project-list-owner",onClick:x,title:D,"aria-label":l("projects.openProject",{project:s.name}),children:[e.jsxs("span",{className:"sr-only",children:[l("projects.owner"),": "]}),D]}),e.jsxs("button",{type:"button",className:"project-list-cell-open project-list-created",onClick:x,title:u(s.createdAt),"aria-label":l("projects.openProject",{project:s.name}),children:[e.jsxs("span",{className:"sr-only",children:[l("projects.created"),": "]}),e.jsx("time",{dateTime:s.createdAt,children:a(s.createdAt)})]}),e.jsxs("button",{type:"button",className:"project-list-cell-open project-list-modified",onClick:x,title:l("projects.modifiedByUser",{time:u(s.updatedAt),user:te}),"aria-label":l("projects.openProject",{project:s.name}),children:[e.jsxs("span",{className:"sr-only",children:[l("projects.modified"),": "]}),e.jsx("time",{dateTime:s.updatedAt,children:j(s.updatedAt)}),e.jsx("small",{children:l("projects.byUser",{user:te})})]}),s.unreadMentionCount&&s.unreadMentionCount>0?e.jsxs("button",{className:"project-mentions-badge project-list-mentions",type:"button",title:l("projects.unreadMentionsTooltip",{count:s.unreadMentionCount}),onClick:C,children:[e.jsx(_t,{"aria-hidden":!0,size:10}),e.jsx("span",{children:s.unreadMentionCount})]}):e.jsx("span",{className:"project-list-mentions"}),e.jsx(Xt,{variant:"list",project:s,currentUser:c,showArchived:h,archiveBusy:y,menuOpen:k,t:l,onToggleMenu:d,onCloseMenu:N,onAssignTags:A,onRename:z,onDuplicate:p,onArchive:w,onTransfer:S,onDelete:b})]})}const Cn=r.lazy(()=>oe(()=>import("./SystemMetricsDialog-DDiSuglF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url).then(s=>({default:s.SystemMetricsDialog}))),Nn=r.lazy(()=>oe(()=>import("./CitationLibraryDialog-G2kKkA2f.js"),__vite__mapDeps([11,1,2,3,12,5,10,13,14,15,16]),import.meta.url).then(s=>({default:s.CitationLibraryDialog}))),wn=r.lazy(()=>oe(()=>import("./AdminUsers-5cAOkdRO.js"),__vite__mapDeps([17,1,18,2,3,5,16]),import.meta.url).then(s=>({default:s.AdminUsers}))),zn=r.lazy(()=>oe(()=>import("./TagManagementDialog-BTVERmQS.js"),__vite__mapDeps([19,1,2,3,14,5,13]),import.meta.url).then(s=>({default:s.TagManagementDialog}))),Sn=r.lazy(()=>oe(()=>import("./ProjectIconPickerDialog-DNV7M7vH.js"),__vite__mapDeps([20,1,2,3,16,5,7,8,9,10]),import.meta.url).then(s=>({default:s.ProjectIconPickerDialog}))),Tn=r.lazy(()=>oe(()=>import("./GitHubAccountDialog-D2kdCzOs.js"),__vite__mapDeps([21,1,2,3,7,5]),import.meta.url).then(s=>({default:s.GitHubAccountDialog})));function Pn(s){return s instanceof Error&&s.name==="AbortError"}function An(s,c,h,y){const k=new Date(s).getTime();if(!Number.isFinite(k))return s;const l=k-h,a=Math.abs(l),j=60*1e3,u=60*j,x=24*u,C=3*x;if(a>C){const z=Math.floor(a/x),p=l<0?"Past":"Future";return y(`projects.relativeDays${p}`,{days:z,hours:0,minutes:0})}if(a>=x){const z=Math.floor(a/x),p=Math.floor(a%x/u),w=l<0?"Past":"Future",S=p>0?"DaysHours":"Days";return y(`projects.relative${S}${w}`,{days:z,hours:p,minutes:0})}if(a>=u){const z=Math.floor(a/u),p=Math.floor(a%u/j),w=l<0?"Past":"Future",S=p>0?"HoursMinutes":"Hours";return y(`projects.relative${S}${w}`,{days:0,hours:z,minutes:p})}const d="minute",N=j,A=Math.sign(l)*Math.max(1,Math.floor(a/N));return new Intl.RelativeTimeFormat(c,{numeric:"always"}).format(A,d)}function Dn(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(1)} MB`}function Ln({site:s,user:c,initialData:h,onDataChange:y,onUser:k,onOpenProject:l}){const{t:a}=He(),[j,u]=r.useState(()=>h?.projects??[]),[x,C]=r.useState(()=>h?.tags??[]),[d,N]=r.useState(()=>h?.pagination??{page:1,pageSize:20,total:h?.projects.length??0,totalPages:h?.projects.length?1:0}),[A,z]=r.useState(!!h),[p,w]=r.useState(!1),[S,b]=r.useState(!1),[O,D]=r.useState(!1),[te,L]=r.useState(!1),[ce,m]=r.useState(""),[V,q]=r.useState(""),[ot,ae]=r.useState(""),[ct,G]=r.useState(""),[lt,K]=r.useState(""),[Yt,le]=r.useState(""),[ea,ke]=r.useState(!1),[fe,dt]=r.useState(""),[W,pt]=r.useState(!1),[ta,ve]=r.useState(!1),[Re,_e]=r.useState(""),[H,ht]=r.useState(null),[ut,R]=r.useState(""),[de,Ze]=r.useState(null),[Ge,be]=r.useState(null),Me=r.useRef(null),mt=r.useRef(null),[T,yt]=r.useState(!1),[_,aa]=r.useState(""),[E,gt]=r.useState(""),[Ce,Ke]=r.useState(!1),[sa,We]=r.useState(!1),[J,Q]=r.useState(null),[jt,Ne]=r.useState(null),[Je,pe]=r.useState(null),[we,ze]=r.useState(""),[X,xt]=r.useState(!1),[Se,he]=r.useState(null),[Te,se]=r.useState(""),[Pe,kt]=r.useState(!1),[ue,Ae]=r.useState(null),[De,ft]=r.useState(!1),[Le,Ee]=r.useState(null),[Qe,vt]=r.useState([]),[Ie,me]=r.useState(""),[ne,Fe]=r.useState(!1),[bt,re]=r.useState(""),[ye,na]=r.useState(()=>localStorage.getItem(Ue("texlite-project-view"))==="list"?"list":"grid"),[U,ra]=r.useState(()=>localStorage.getItem(Ue("texlite-project-sort"))==="created"?"created":"updated"),[f,ia]=r.useState(!1),[Mt,Ct]=r.useState(""),[Oe,Z]=r.useState(null),[I,$]=r.useState(1),[oa,ca]=r.useState(()=>Date.now()),[Nt,la]=r.useState(""),Xe=r.useRef(0),ge=r.useRef(null),wt=(t,n,o,g,M)=>`${t?"archived":"active"}|${n}|${o}|${g}|${M}`,zt=wt(f,I,_,E,U),je=(t,n,o,g,M)=>{const v=new URLSearchParams({page:String(n),pageSize:"20",sort:M});t&&v.set("archived","1"),o.trim()&&v.set("search",o.trim()),g&&v.set("tag",g);const B=wt(t,n,o,g,M),Y=++Xe.current;ge.current?.abort();const qe=new AbortController;return ge.current=qe,Promise.all([P(`/api/projects?${v.toString()}`,{signal:qe.signal}),P("/api/tags",{signal:qe.signal})]).then(([ie,va])=>{Y===Xe.current&&(u(ie.projects),C(va.tags),N(ie.pagination),$(ie.pagination.page),z(!0),la(B))}).catch(ie=>{!Pn(ie)&&Y===Xe.current&&m(F(ie))}).finally(()=>{ge.current===qe&&(ge.current=null)})};r.useEffect(()=>(je(f,I,_,E,U),()=>ge.current?.abort()),[f,I,_,E,U]),r.useEffect(()=>{A&&!f&&Nt===zt&&y(j,x,d)},[j,x,d,A,Nt,zt,f]),r.useEffect(()=>{const t=window.setInterval(()=>ca(Date.now()),6e4);return()=>window.clearInterval(t)},[]),r.useEffect(()=>{if(!Ce)return;const t=o=>{o.target instanceof Node&&!mt.current?.contains(o.target)&&Ke(!1)},n=o=>{o.key==="Escape"&&Ke(!1)};return document.addEventListener("pointerdown",t),document.addEventListener("keydown",n),()=>{document.removeEventListener("pointerdown",t),document.removeEventListener("keydown",n)}},[Ce]);const St=t=>{Z(null),na(t),localStorage.setItem(Ue("texlite-project-view"),t)},da=t=>{ra(t),$(1),localStorage.setItem(Ue("texlite-project-sort"),t)},Ye=t=>{ia(t),$(1)},Tt=t=>{gt(t),$(1)},Pt=async()=>{if(!(!fe.trim()||W)){pt(!0),q("");try{const{project:t}=await P("/api/projects",{method:"POST",body:JSON.stringify({name:fe})});ke(!1),dt("");const n=f||I!==1?j:[t,...j].slice(0,d.pageSize),o=f?d:{...d,total:d.total+1,totalPages:Math.ceil((d.total+1)/d.pageSize)};u(n),N(o),f||y(n,x,o),l(t.id)}catch(t){q(F(t))}finally{pt(!1)}}},pa=async()=>{if(!H)return;const t=H,n=s.maxUploadSizeMB;if(t.size>n*1024*1024)return R(a("errors.fileTooLarge",{size:n}));yt(!0),R(""),Ze("uploading"),be(0);const o=new FormData;o.append("file",t);try{const{project:g}=await za(`/api/projects/import?name=${encodeURIComponent(Re.trim())}`,o,{onProgress:(B,Y)=>{be(Y?Math.min(99,Math.floor(B/Y*100)):null)},onUploadComplete:()=>{be(null),Ze("processing")}}),M=f||I!==1?j:[g,...j].slice(0,d.pageSize),v=f?d:{...d,total:d.total+1,totalPages:Math.ceil((d.total+1)/d.pageSize)};u(M),N(v),f||y(M,x,v),ve(!1),ht(null),_e(""),l(g.id)}catch(g){R(F(g))}finally{yt(!1),Ze(null),be(null)}},et=t=>{if(!T){if(t&&!t.name.toLocaleLowerCase().endsWith(".zip")){R(a("errors.zipOnly"));return}R(""),ht(t),t&&!Re&&_e(t.name.replace(/\.zip$/i,""))}},ha=async()=>{await P("/api/auth/logout",{method:"POST"}),k(null)},ua=async t=>{if(!J)return;const n=J.tags.some(o=>o.id===t.id);ae("");try{const g=(await P(n?`/api/projects/${J.id}/tags/${t.id}`:`/api/projects/${J.id}/tags`,n?{method:"DELETE"}:{method:"POST",body:JSON.stringify({tagId:t.id})})).project;Q(g),u(M=>M.map(v=>v.id===g.id?g:v))}catch(o){ae(F(o))}},ma=t=>{C(n=>[...n,t].sort((o,g)=>o.name.localeCompare(g.name)))},ya=t=>{const n=o=>o.map(g=>g.id===t.id?t:g);C(o=>n(o).sort((g,M)=>g.name.localeCompare(M.name))),u(o=>o.map(g=>({...g,tags:n(g.tags)}))),Q(o=>o?{...o,tags:n(o.tags)}:null)},ga=t=>{C(n=>n.filter(o=>o.id!==t)),u(n=>n.map(o=>({...o,tags:o.tags.filter(g=>g.id!==t)}))),Q(n=>n?{...n,tags:n.tags.filter(o=>o.id!==t)}:null),gt(n=>n===t?"":n)},ja=async(t,n)=>{const o=await P(`/api/projects/${t}/icon`,{method:"PATCH",body:JSON.stringify({icon:n})});u(g=>{const M=g.map(v=>v.id===o.project.id?o.project:v);return U==="updated"?M.sort((v,B)=>B.updatedAt.localeCompare(v.updatedAt)||v.name.localeCompare(B.name)):M})},At=async()=>{if(!(!Je||!we.trim()||X)){xt(!0),G("");try{const t=await P(`/api/projects/${Je.id}`,{method:"PATCH",body:JSON.stringify({name:we})});u(n=>n.map(o=>o.id===t.project.id?t.project:o)),pe(null),ze("")}catch(t){G(F(t))}finally{xt(!1)}}},Dt=async()=>{if(!(!Se||!Te.trim())){kt(!0),K("");try{await P(`/api/projects/${Se.id}/duplicate`,{method:"POST",body:JSON.stringify({name:Te})}),he(null),se(""),je(f,I,_,E,U)}catch(t){K(F(t))}finally{kt(!1)}}},xa=async()=>{if(!(!ue||De)){ft(!0),le("");try{await P(`/api/projects/${ue.id}`,{method:"DELETE"}),u(M=>M.filter(v=>v.id!==ue.id));const t=Math.max(0,d.total-1),n=Math.ceil(t/d.pageSize),o=n===0?1:Math.min(I,n),g={...d,page:o,total:t,totalPages:n};N(g),Ae(null),o!==I?$(o):je(f,I,_,E,U)}catch(t){le(F(t))}finally{ft(!1)}}},Lt=async t=>{Ee(t),me(""),vt([]),re(""),Fe(!0);try{const n=await P("/api/users");vt(n.users.filter(o=>o.id!==t.ownerId))}catch(n){re(F(n))}finally{Fe(!1)}},ka=async()=>{if(!(!Le||!Ie)){Fe(!0),re("");try{await P(`/api/projects/${Le.id}/owner`,{method:"PUT",body:JSON.stringify({userId:Ie})}),Ee(null),me(""),je(f,I,_,E,U)}catch(t){re(F(t))}finally{Fe(!1)}}},Et=async t=>{const n=!f;Ct(t.id),m("");try{await P(`/api/projects/${t.id}/archive`,{method:n?"PUT":"DELETE"});const o=j.filter(Y=>Y.id!==t.id);u(o);const g=Math.max(0,d.total-1),M=Math.ceil(g/d.pageSize),v=M===0?1:Math.min(I,M),B={...d,page:v,total:g,totalPages:M};N(B),f||y(o,x,B),v!==I?$(v):je(f,I,_,E,U)}catch(o){m(F(o))}finally{Ct("")}},It=async t=>{try{const o=(await P(`/api/projects/${t.id}/mentions?unread=1&limit=1`)).mentions[0];l(t.id,o?.id)}catch(n){m(F(n))}},Ve=j,tt=t=>new Date(t).toLocaleString(at.resolvedLanguage),fa=t=>{const n=new Date(t);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(at.resolvedLanguage??"en",{year:"numeric",month:"2-digit",day:"2-digit"}).format(n):t},Ft=t=>An(t,at.resolvedLanguage??"en",oa,(n,o)=>a(n,o));return e.jsxs("div",{className:"page",children:[e.jsxs("header",{className:"topbar",children:[e.jsxs("a",{className:"brand-link",href:it("/"),"aria-label":s.siteName,children:[e.jsx(Ca,{siteName:s.siteName}),e.jsx("span",{className:"site-title",children:s.siteName})]}),e.jsxs("div",{className:"top-actions",children:[c.role==="admin"&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"ghost",onClick:()=>b(!0),children:[e.jsx(as,{"aria-hidden":!0,size:14}),a("metrics.title")]}),e.jsxs("button",{className:`ghost${p?" top-return-action":""}`,onClick:()=>{w(t=>!t),D(!1)},children:[p?e.jsx(st,{"aria-hidden":!0,size:14}):e.jsx(Za,{"aria-hidden":!0,size:14}),a(p?"users.back":"users.manage")]})]}),e.jsxs("button",{className:`ghost${O?" top-return-action":""}`,onClick:()=>{w(!1),D(t=>!t)},children:[O?e.jsx(st,{"aria-hidden":!0,size:14}):e.jsx(Ht,{"aria-hidden":!0,size:14}),a(O?"users.back":"citationLibrary.title")]}),e.jsx(mn,{user:c,onGitHub:()=>L(!0),onSignOut:ha})]})]}),c.role==="admin"&&e.jsx("div",{className:"dashboard-update",children:e.jsx(gn,{userId:c.id},c.id)}),p?e.jsx("main",{className:"dashboard",children:e.jsx(Ot,{onClose:()=>w(!1),children:e.jsx(wn,{currentUser:c,minPasswordLength:s.minPasswordLength,onBack:()=>w(!1)})})}):O?e.jsx("main",{className:"dashboard",children:e.jsx(Ot,{onClose:()=>D(!1),children:e.jsx(Nn,{page:!0,open:!0,onOpenChange:D,onBack:()=>D(!1),currentUserId:c.id,maxBibtexBytes:s.maxCitationBibtexBytes})})}):e.jsxs("main",{className:"dashboard",children:[e.jsxs("div",{className:"section-title",children:[e.jsxs("div",{children:[e.jsxs("h1",{children:[e.jsx(rt,{"aria-hidden":!0,size:25}),a("projects.title")]}),e.jsx("p",{className:"muted",children:c.canCreateProjects?a("projects.subtitle"):a("projects.restricted")})]}),e.jsxs("div",{className:"section-actions",children:[e.jsxs("button",{onClick:()=>We(!0),children:[e.jsx(nt,{"aria-hidden":!0,size:15}),a("tags.manage")]}),c.canCreateProjects&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{R(""),ve(!0)},children:[e.jsx(qt,{"aria-hidden":!0,size:15}),a("projects.upload")]}),e.jsxs("button",{className:"primary",onClick:()=>{q(""),ke(!0)},children:[e.jsx(Ga,{"aria-hidden":!0,size:15}),a("projects.new")]})]})]})]}),ce&&e.jsx("p",{className:"error",children:ce}),e.jsxs("div",{className:"project-catalog-layout",children:[e.jsxs("aside",{ref:mt,className:`project-tag-sidebar${E?" has-active-filter":""}`,children:[e.jsxs("button",{type:"button",className:"project-tag-toggle",title:a("projects.filterTags"),"aria-label":a("projects.filterTags"),"aria-expanded":Ce,"aria-controls":"dashboard-tag-filters",onClick:()=>Ke(t=>!t),children:[e.jsxs("span",{className:"project-tag-toggle-copy",children:[e.jsx(nt,{"aria-hidden":!0,size:15}),e.jsx("span",{children:a("projects.filterTags")})]}),e.jsx(Ut,{className:"project-tag-toggle-chevron","aria-hidden":!0,size:15})]}),Ce&&e.jsxs("div",{id:"dashboard-tag-filters",className:"project-tag-filters",role:"group","aria-label":a("projects.filterTags"),children:[e.jsx("button",{type:"button",className:E?"":"active","aria-pressed":!E,onClick:()=>Tt(""),children:a("projects.allTags")}),x.length>0?x.map(t=>e.jsxs("button",{type:"button",className:E===t.id?"active":"",title:t.name,"aria-pressed":E===t.id,onClick:()=>Tt(E===t.id?"":t.id),children:[e.jsx($t,{color:t.color}),e.jsx("span",{children:t.name})]},t.id)):e.jsx("p",{className:"project-tag-empty",children:a("tags.none")})]})]}),e.jsxs("div",{className:"project-catalog-content",children:[e.jsxs("div",{className:"project-toolbar",children:[e.jsx("input",{type:"search",placeholder:a("projects.search"),value:_,onChange:t=>{aa(t.target.value),$(1)}}),e.jsxs("div",{className:"project-scope",role:"tablist","aria-label":a("projects.scope"),children:[e.jsxs("button",{className:f?"":"active",onClick:()=>Ye(!1),role:"tab","aria-selected":!f,children:[e.jsx(rt,{size:14}),a("projects.active")]}),e.jsxs("button",{className:f?"active":"",onClick:()=>Ye(!0),role:"tab","aria-selected":f,children:[e.jsx(Be,{size:14}),a("projects.archived")]})]}),e.jsxs("label",{className:"project-sort",children:[e.jsx(ns,{size:14}),e.jsx("span",{children:a("projects.sortBy")}),e.jsxs("select",{value:U,onChange:t=>da(t.target.value),children:[e.jsx("option",{value:"updated",children:a("projects.sortModified")}),e.jsx("option",{value:"created",children:a("projects.sortCreated")})]})]}),e.jsxs("div",{className:"view-toggle",children:[e.jsx("button",{className:ye==="grid"?"active":"",onClick:()=>St("grid"),title:a("projects.grid"),children:"▦"}),e.jsx("button",{className:ye==="list"?"active":"",onClick:()=>St("list"),title:a("projects.list"),children:"☷"})]})]}),e.jsxs("div",{className:`project-grid ${ye==="list"?"list-view":""}${Oe?" project-list-menu-active":""}`,children:[ye==="list"&&Ve.length>0&&e.jsxs("div",{className:"project-list-header","aria-hidden":"true",children:[e.jsx("span",{className:"project-list-header-avatar"}),e.jsx("span",{children:a("projects.title")}),e.jsx("span",{children:a("projects.owner")}),e.jsx("span",{className:"project-list-header-created",children:a("projects.created")}),e.jsx("span",{children:a("projects.modified")}),e.jsx("span",{className:"project-list-header-mentions",children:a("projects.mentionsColumn")}),e.jsx("span",{className:"project-list-header-actions",children:a("projects.actions")})]}),ye==="list"?Ve.map(t=>e.jsx(Mn,{project:t,currentUser:c,showArchived:f,archiveBusy:Mt===t.id,menuOpen:Oe===t.id,t:a,formatCreatedDate:fa,formatUpdatedTime:Ft,formatExactTime:tt,onOpenProject:()=>{Z(null),l(t.id)},onOpenMention:()=>{It(t)},onToggleMenu:()=>Z(n=>n===t.id?null:t.id),onCloseMenu:()=>Z(n=>n===t.id?null:n),onAssignTags:()=>{ae(""),Q(t)},onRename:()=>{G(""),pe(t),ze(t.name)},onDuplicate:()=>{K(""),he(t),se(`${t.name} (1)`)},onArchive:()=>{Et(t)},onTransfer:()=>{Lt(t)},onDelete:()=>{Ae(t),le("")},onChooseIcon:()=>Ne(t)},t.id)):Ve.map(t=>e.jsxs("article",{className:`project-card project-grid-card${t.ownerId===c.id?" owned-project":""}${Oe===t.id?" project-card-menu-open":""}`,role:"button",tabIndex:0,"aria-label":a("projects.openProject",{project:t.name}),onClick:()=>{Z(null),l(t.id)},onKeyDown:n=>{n.target!==n.currentTarget||n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),Z(null),l(t.id))},children:[e.jsxs("div",{className:"project-card-meta-row",children:[e.jsxs("div",{className:"project-card-badges",children:[e.jsx("span",{className:"owner-badge",title:t.ownerDisplayName??t.ownerUsername??a("projects.deletedUser"),children:t.ownerDisplayName??t.ownerUsername??a("projects.deletedUser")}),!!(t.unreadMentionCount&&t.unreadMentionCount>0)&&e.jsxs("button",{className:"project-mentions-badge",type:"button",title:a("projects.unreadMentionsTooltip",{count:t.unreadMentionCount}),"aria-label":a("projects.unreadMentionsTooltip",{count:t.unreadMentionCount}),onClick:n=>{n.stopPropagation(),It(t)},children:[e.jsx(_t,{"aria-hidden":!0,size:11}),e.jsx("span",{children:t.unreadMentionCount})]})]}),e.jsx(Xt,{variant:"grid",project:t,currentUser:c,showArchived:f,archiveBusy:Mt===t.id,menuOpen:Oe===t.id,t:a,onToggleMenu:()=>Z(n=>n===t.id?null:t.id),onCloseMenu:()=>Z(n=>n===t.id?null:n),onAssignTags:()=>{ae(""),Q(t)},onRename:()=>{G(""),pe(t),ze(t.name)},onDuplicate:()=>{K(""),he(t),se(`${t.name} (1)`)},onArchive:()=>{Et(t)},onTransfer:()=>{Lt(t)},onDelete:()=>{Ae(t),le("")}})]}),e.jsxs("div",{className:"project-card-title-row",children:[e.jsx("span",{className:"project-card-icon-control",onClick:t.permission==="owner"?n=>n.stopPropagation():void 0,children:e.jsx(Qt,{icon:t.icon,projectName:t.name,title:t.name,editable:t.permission==="owner",editLabel:a("projectIcons.change"),onEdit:()=>Ne(t),className:"project-card-icon"})}),e.jsx("strong",{className:"project-card-title",title:t.name,children:t.name})]}),e.jsx("div",{className:"project-card-tags","aria-label":a("tags.assignTitle",{project:t.name}),title:t.tags?.map(n=>n.name).join(", ")||void 0,children:t.tags?.map(n=>e.jsx("span",{className:`tag tag-${n.color}`,title:n.name,children:n.name},n.id))}),e.jsxs("dl",{className:"project-meta",children:[e.jsxs("div",{children:[e.jsxs("dt",{className:"project-meta-created-label",children:[e.jsxs("span",{children:[e.jsx(Gt,{"aria-hidden":!0,size:13}),a("projects.created")]}),!!(t.unresolvedCommentCount&&t.unresolvedCommentCount>0)&&e.jsxs("span",{className:"project-comments-badge unresolved",title:a("projects.unresolvedCommentsTooltip",{unresolved:t.unresolvedCommentCount,total:t.commentCount??t.unresolvedCommentCount}),children:[e.jsx(Rt,{"aria-hidden":!0,size:11}),e.jsx("span",{children:a("projects.unresolvedCount",{count:t.unresolvedCommentCount})})]})]}),e.jsx("dd",{children:e.jsx("time",{dateTime:t.createdAt,children:tt(t.createdAt)})})]}),e.jsxs("div",{children:[e.jsxs("dt",{children:[e.jsx(Es,{"aria-hidden":!0,size:13}),a("projects.modified")]}),e.jsxs("dd",{title:a("projects.modifiedByUser",{time:tt(t.updatedAt),user:t.lastModifiedDisplayName??t.lastModifiedUsername??a("projects.deletedUser")}),children:[e.jsx("time",{dateTime:t.updatedAt,children:Ft(t.updatedAt)}),e.jsxs("span",{className:"project-modified-by",children:[" · ",a("projects.byUser",{user:t.lastModifiedDisplayName??t.lastModifiedUsername??a("projects.deletedUser")})]})]})]})]})]},t.id)),Ve.length===0&&(j.length===0?f?e.jsxs("div",{className:"project-empty project-empty-archived",children:[e.jsx("span",{className:"project-empty-icon",children:e.jsx(Be,{"aria-hidden":"true",size:25,strokeWidth:1.5})}),e.jsx("h2",{children:a("projects.noArchived")}),e.jsx("p",{children:a("projects.noArchivedDescription")}),e.jsxs("button",{type:"button",className:"project-empty-action",onClick:()=>Ye(!1),children:[e.jsx(st,{"aria-hidden":"true",size:14}),a("projects.backToActive")]})]}):e.jsxs("div",{className:"project-empty",children:[e.jsx("span",{className:"project-empty-icon",children:e.jsx(Wt,{size:28})}),e.jsx("h2",{children:a("projects.emptyTitle")}),e.jsx("p",{children:c.canCreateProjects?a("projects.emptyDescription"):a("projects.emptyRestricted")})]}):e.jsx("div",{className:"empty",children:a("projects.noMatches")}))]}),d.totalPages>1&&e.jsxs("nav",{className:"project-pagination","aria-label":a("projects.pagination"),children:[e.jsxs("button",{disabled:d.page<=1,onClick:()=>$(t=>Math.max(1,t-1)),title:a("projects.previousPage"),children:[e.jsx(Ka,{size:15}),a("projects.previousPage")]}),e.jsx("span",{children:a("projects.pageOf",{page:d.page,totalPages:d.totalPages,count:d.total})}),e.jsxs("button",{disabled:d.page>=d.totalPages,onClick:()=>$(t=>Math.min(d.totalPages,t+1)),title:a("projects.nextPage"),children:[e.jsx(Ut,{size:15}),a("projects.nextPage")]})]})]})]}),e.jsx(ee,{open:ea,title:a("projects.new"),description:a("projects.newDescription"),onOpenChange:t=>{!t&&W||(ke(t),t||q(""))},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:W,onClick:()=>ke(!1),children:a("common.cancel")}),e.jsxs("button",{className:"primary",disabled:W||!fe.trim(),"aria-busy":W,onClick:()=>{Pt()},children:[W&&e.jsx(xe,{className:"spin",size:14}),a(W?"common.loading":"common.create")]})]}),children:e.jsxs(e.Fragment,{children:[V&&e.jsx("p",{className:"error dialog-error",children:V}),e.jsxs("label",{className:"form-field",children:[a("projects.name"),e.jsx("input",{autoFocus:!0,value:fe,onChange:t=>{dt(t.target.value),q("")},onKeyDown:t=>{t.key==="Enter"&&Pt()}})]})]})}),e.jsx(ee,{open:ta,title:a("projects.upload"),description:a("projects.uploadDescription",{size:s.maxUploadSizeMB}),onOpenChange:t=>{!t&&T||(ve(t),t||R(""))},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:T,onClick:()=>{ve(!1),R("")},children:a("common.cancel")}),e.jsxs("button",{className:"primary",disabled:!H||T,"aria-busy":T,onClick:()=>{pa()},children:[T&&e.jsx(xe,{className:"spin",size:14}),a(T?de==="processing"?"projects.processing":"projects.uploading":"projects.import")]})]}),children:e.jsxs("div",{className:"form-stack",children:[ut&&e.jsx("p",{className:"error import-error",children:ut}),e.jsxs("div",{className:`upload-picker${H?" has-file":""}${T?" is-disabled":""}`,onDragOver:t=>{t.preventDefault(),T||(t.dataTransfer.dropEffect="copy")},onDrop:t=>{t.preventDefault(),T||et(t.dataTransfer.files[0]??null)},children:[e.jsx("input",{ref:Me,className:"sr-only",type:"file",accept:".zip,application/zip",disabled:T,onChange:t=>et(t.target.files?.[0]??null)}),e.jsx(Wa,{size:34}),e.jsxs("div",{className:"upload-picker-copy",children:[e.jsx("strong",{children:H?.name??a("projects.chooseZip")}),e.jsx("span",{children:H?a("projects.selectedFileSize",{size:Dn(H.size)}):a("projects.dropZip")})]}),e.jsxs("button",{type:"button",disabled:T,onClick:()=>Me.current?.click(),children:[e.jsx(qt,{size:15}),a("projects.browse")]}),H&&e.jsx("button",{className:"upload-clear",type:"button",disabled:T,title:a("projects.clearFile"),"aria-label":a("projects.clearFile"),onClick:()=>{et(null),Me.current&&(Me.current.value="")},children:e.jsx(Bt,{size:14})})]}),e.jsxs("label",{className:"form-field",children:[a("projects.name"),e.jsx("input",{disabled:T,value:Re,onChange:t=>_e(t.target.value)})]}),T&&e.jsxs("div",{className:"project-import-progress",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"project-import-progress-label",children:[e.jsx("span",{children:a(de==="processing"?"projects.processing":"projects.uploading")}),de==="uploading"&&Ge!==null&&e.jsxs("small",{"aria-hidden":"true",children:[Ge,"%"]})]}),e.jsx("progress",{"aria-label":a("projects.uploadProgress"),max:100,value:de==="uploading"?Ge??void 0:void 0}),de==="processing"&&e.jsx("small",{className:"import-progress-hint",children:a("projects.processingHint")})]})]})}),sa&&e.jsx($e,{title:a("tags.manage"),onClose:()=>We(!1),children:e.jsx(zn,{open:!0,onOpenChange:We,onTagCreated:ma,onTagUpdated:ya,onTagDeleted:ga})}),jt&&e.jsx($e,{title:a("projectIcons.title"),onClose:()=>Ne(null),children:e.jsx(Sn,{project:jt,open:!0,onOpenChange:t=>{t||Ne(null)},onSave:ja})}),e.jsx(ee,{open:!!J,title:a("tags.assignTitle",{project:J?.name??""}),description:a("tags.assignDescription"),onOpenChange:t=>{t||(Q(null),ae(""))},footer:e.jsx("button",{onClick:()=>{Q(null),ae("")},children:a("common.close")}),children:e.jsxs("div",{className:"tag-assignment-list",children:[ot&&e.jsx("p",{className:"error dialog-error",children:ot}),x.map(t=>e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:!!J?.tags.some(n=>n.id===t.id),onChange:()=>{ua(t)}}),e.jsx($t,{color:t.color}),e.jsx("span",{children:t.name})]},t.id)),x.length===0&&e.jsx("p",{className:"muted",children:a("tags.empty")})]})}),e.jsx(ee,{open:!!Je,title:a("projects.renameTitle"),onOpenChange:t=>{!t&&X||t||(pe(null),G(""))},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:X,onClick:()=>{pe(null),G("")},children:a("common.cancel")}),e.jsxs("button",{className:"primary",disabled:X||!we.trim(),"aria-busy":X,onClick:()=>{At()},children:[X&&e.jsx(xe,{className:"spin",size:14}),a(X?"common.loading":"projects.rename")]})]}),children:e.jsxs(e.Fragment,{children:[ct&&e.jsx("p",{className:"error dialog-error",children:ct}),e.jsxs("label",{className:"form-field",children:[a("projects.name"),e.jsx("input",{autoFocus:!0,value:we,onChange:t=>{ze(t.target.value),G("")},onKeyDown:t=>{t.key==="Enter"&&At()}})]})]})}),e.jsx(ee,{open:!!Se,title:a("projects.duplicateTitle"),description:a("projects.duplicateDescription",{project:Se?.name??""}),onOpenChange:t=>{!t&&!Pe&&(he(null),se(""),K(""))},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:Pe,onClick:()=>{he(null),se(""),K("")},children:a("common.cancel")}),e.jsx("button",{className:"primary",disabled:Pe||!Te.trim(),onClick:()=>{Dt()},children:a(Pe?"projects.duplicating":"projects.duplicate")})]}),children:e.jsxs(e.Fragment,{children:[lt&&e.jsx("p",{className:"error dialog-error",children:lt}),e.jsxs("label",{className:"form-field",children:[a("projects.name"),e.jsx("input",{autoFocus:!0,value:Te,onChange:t=>{se(t.target.value),K("")},onKeyDown:t=>{t.key==="Enter"&&Dt()}})]})]})}),e.jsx(ee,{open:!!Le,title:a("projects.transferOwnership"),description:a("projects.transferDescription",{project:Le?.name??""}),onOpenChange:t=>{!t&&!ne&&(Ee(null),me(""),re(""))},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:ne,onClick:()=>{Ee(null),me(""),re("")},children:a("common.cancel")}),e.jsxs("button",{className:"primary",disabled:ne||!Ie,onClick:()=>{ka()},children:[ne?e.jsx(xe,{className:"spin",size:14}):e.jsx(Zt,{size:14}),a("projects.transfer")]})]}),children:e.jsxs("div",{className:"form-stack",children:[bt&&e.jsx("p",{className:"error dialog-error",children:bt}),e.jsxs("label",{className:"form-field",children:[a("projects.newOwner"),e.jsxs("select",{disabled:ne||Qe.length===0,value:Ie,onChange:t=>me(t.target.value),children:[e.jsx("option",{value:"",children:ne?a("common.loading"):Qe.length>0?a("projects.chooseNewOwner"):a("projects.noTransferUsers")}),Qe.map(t=>e.jsxs("option",{value:t.id,children:[t.displayName??t.username," (@",t.username,")"]},t.id))]})]}),e.jsxs("p",{className:"warning",children:[e.jsx(Ja,{size:15}),a("projects.transferWarning")]})]})}),e.jsx(Na,{open:!!ue,title:a("projects.deleteTitle"),description:a("projects.deleteDescription",{project:ue?.name??""}),confirmLabel:a(De?"common.loading":"common.delete"),danger:!0,busy:De,error:Yt,onCancel:()=>{De||(Ae(null),le(""))},onConfirm:()=>{xa()}})]}),S&&e.jsx($e,{title:a("metrics.title"),onClose:()=>b(!1),children:e.jsx(Cn,{open:!0,onOpenChange:b})}),te&&e.jsx($e,{title:a("account.githubTitle"),onClose:()=>L(!1),children:e.jsx(Tn,{open:!0,onOpenChange:L})}),e.jsx(wa,{})]})}function $t({color:s}){return e.jsx("span",{className:`tag-dot tag-${s}`})}const Bn=Object.freeze(Object.defineProperty({__proto__:null,Dashboard:Ln},Symbol.toStringTag,{value:"Module"}));export{as as A,Cs as C,Bn as D,bn as P,vn as a,xn as i,kn as n,$n as p};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{u as fe,r as a,j as e}from"./react-CltQJflK.js";import{c as z,M as P,L as j,a as g}from"./index-DF5cor0N.js";import{G,C as I,m as ee}from"./index-C5T8_lAl.js";import{G as te,F as xe,E as pe}from"./github-y6i0qxSV.js";import{E as H}from"./eye-swovgNYS.js";import{R as je}from"./ProjectWorkspace-BJFxjMCn.js";import{M as ye,a as be}from"./minus-B2sswwWT.js";import{P as Ce}from"./plus-Co7iyp5m.js";import{M as ke}from"./minimize-2-CK7jUy7-.js";import"./check-Hlb-tLSh.js";import"./index-Do5FsFqg.js";import"./chevron-up-D0psXvTv.js";import"./refresh-cw-BHVcjInn.js";const ve=z("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);const Ne=z("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const se=z("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);const we=z("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function He({open:l,project:o,onOpenChange:y,onBeforeMutation:r}){const{t,i18n:S}=fe(),[i,b]=a.useState(null),[B,E]=a.useState([]),[F,A]=a.useState(()=>ie(o.name)),[W,ae]=a.useState(!0),[D,q]=a.useState(""),[u,C]=a.useState(null),[f,p]=a.useState(null),[U,T]=a.useState(!1),[ne,k]=a.useState(!1),[$,J]=a.useState(!0),[M,O]=a.useState(!0),[c,v]=a.useState(""),[V,N]=a.useState(""),[_,R]=a.useState(""),[d,m]=a.useState(!1),[w,K]=a.useState(10),L=a.useRef(null),oe=async(s=!1)=>{const n=await g(`/api/projects/${o.id}/git`);if(b(n.status),s&&(J(!n.status.tokenConfigured),O(!n.status.remoteUrl)),n.status.initialized&&n.status.latestCommit){const h=await g(`/api/projects/${o.id}/git/history`);E(h.commits)}else E([])};a.useEffect(()=>{if(!l){document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),m(!1);return}N(""),R(""),C(null),m(!1),A(ie(o.name)),v("load"),r().then(()=>oe(!0)).catch(s=>N(s instanceof Error?s.message:t("errors.generic"))).finally(()=>v(""))},[l,o.id]),a.useEffect(()=>{const s=()=>m(document.fullscreenElement===L.current);return document.addEventListener("fullscreenchange",s),()=>document.removeEventListener("fullscreenchange",s)},[]),a.useEffect(()=>{if(!d)return;const s=n=>{n.key==="Escape"&&!document.fullscreenElement&&m(!1)};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[d]);const x=async(s,n,h,Q)=>{v(s),N(""),R("");try{await n(),h&&R(h)}catch(X){const Y=X instanceof Error?X.message:t("errors.generic");N(Q?`${Q}: ${Y}`:Y)}finally{v("")}},re=()=>x("repository",async()=>{const s=await g(`/api/projects/${o.id}/git/repository`,{method:"POST",body:JSON.stringify({name:F,private:W})});b(s.status),O(!1)},t("git.repositoryCreated")),ce=()=>x("commit",async()=>{if(!await r())throw new Error(t("errors.collaborationUnavailable"));const s=await g(`/api/projects/${o.id}/git/commit`,{method:"POST",body:JSON.stringify({message:D})});b(s.status),E(n=>[s.commit,...n.filter(h=>h.sha!==s.commit.sha)].slice(0,100)),q(""),C(null)},t("git.committed"),t("git.commitFailed")),le=()=>x("push",async()=>{if(!await r())throw new Error(t("errors.collaborationUnavailable"));const s=await g(`/api/projects/${o.id}/git/push`,{method:"POST"});b(s.status)},t("git.pushed"),t("git.pushFailed")),Z=s=>x("diff",async()=>{if(!await r())throw new Error(t("errors.collaborationUnavailable"));const n=s?`?revision=${encodeURIComponent(s)}`:"",h=await g(`/api/projects/${o.id}/git/diff${n}`);C({...h,revision:s})}),de=s=>{if(u?.revision===s){C(null),m(!1),document.fullscreenElement&&document.exitFullscreen().catch(()=>{});return}Z(s)},he=async()=>{if(d){document.fullscreenElement&&await document.exitFullscreen().catch(()=>{}),m(!1);return}const s=L.current;if(s?.requestFullscreen)try{await s.requestFullscreen()}catch{}m(!0)},ge=()=>{const s=f;s&&(p(null),x("checkout",async()=>{if(!await r())throw new Error(t("errors.collaborationUnavailable"));await g(`/api/projects/${o.id}/git/checkout`,{method:"POST",body:JSON.stringify({revision:s==="branch"?null:s.sha,force:U})}),window.location.reload()}))},me=()=>{k(!1),x("discard",async()=>{if(!await r())throw new Error(t("errors.collaborationUnavailable"));await g(`/api/projects/${o.id}/git/discard`,{method:"POST"}),window.location.reload()})},ue=c==="load"&&!i;return e.jsxs(e.Fragment,{children:[e.jsx(P,{open:l,extraWide:!0,className:d?"git-dialog-modal-fullscreen":void 0,title:t("git.title"),description:t("git.description"),onOpenChange:y,footer:e.jsx("button",{onClick:()=>y(!1),children:t("common.close")}),children:e.jsxs("div",{className:"git-dialog",children:[ue&&e.jsxs("div",{className:"git-loading",children:[e.jsx(j,{className:"spin",size:22}),t("common.loading")]}),V&&e.jsx("p",{className:"git-message error",role:"alert",children:V}),_&&e.jsxs("p",{className:"git-message success",role:"status",children:[e.jsx(G,{size:14}),_]}),i&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":$,onClick:()=>J(s=>!s),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(te,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:t("git.authentication")}),e.jsx("small",{children:i.tokenConfigured?t("git.connectedAs",{login:i.githubLogin}):t("git.authenticationHint")})]})]}),$?e.jsx(I,{size:16}):e.jsx(ee,{size:16})]}),$&&e.jsx("div",{className:"git-section-content",children:e.jsx("p",{className:"git-account-guidance",children:i.tokenConfigured?t("git.accountTokenManaged",{login:i.githubLogin}):t("git.accountTokenMissing")})})]}),e.jsxs("section",{className:"git-section",children:[e.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":M,onClick:()=>O(s=>!s),children:[e.jsxs("span",{className:"git-section-heading",children:[e.jsx(xe,{size:16}),e.jsxs("span",{children:[e.jsx("strong",{children:t("git.repository")}),e.jsx("small",{children:i.remoteUrl?i.repositoryName??i.remoteUrl:i.initialized?t("git.localReady"):t("git.localPending")})]})]}),M?e.jsx(I,{size:16}):e.jsx(ee,{size:16})]}),M&&e.jsx("div",{className:"git-section-content",children:i.remoteUrl?e.jsxs("div",{className:"git-repository-card",children:[e.jsxs("div",{children:[e.jsx("strong",{children:i.repositoryName??t("git.origin")}),e.jsxs("small",{children:[i.branch??t("git.detachedAt",{revision:i.latestCommit?.shortSha??"HEAD"})," · ",i.dirty?t("git.changedFiles",{count:i.changedFiles}):t("git.clean")]})]}),i.repositoryHtmlUrl&&e.jsxs("a",{href:i.repositoryHtmlUrl,target:"_blank",rel:"noreferrer",children:[e.jsx(pe,{size:14}),t("git.openGitHub")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"form-field",children:[t("git.repositoryName"),e.jsx("input",{value:F,onChange:s=>A(s.target.value)})]}),e.jsxs("label",{className:"checkbox-field",children:[e.jsx("input",{type:"checkbox",checked:W,onChange:s=>ae(s.target.checked)}),t("git.privateRepository")]}),e.jsxs("button",{className:"git-primary-action",disabled:!!c||!i.tokenConfigured||!F.trim(),onClick:re,children:[c==="repository"?e.jsx(j,{className:"spin",size:14}):e.jsx(te,{size:14}),t("git.createRepository")]})]})})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(se,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:t("git.commitAndPush")}),e.jsx("small",{children:i.branch?t("git.identity",{username:o.ownerUsername}):t("git.detachedHead")})]})]}),e.jsxs("label",{className:"form-field",children:[t("git.commitMessage"),e.jsx("textarea",{rows:3,value:D,placeholder:t("git.commitPlaceholder"),onChange:s=>q(s.target.value)})]}),e.jsxs("div",{className:"git-action-row",children:[e.jsxs("button",{title:i.dirty?void 0:t("git.noChangesToCommit"),disabled:!!c||!i.branch||!i.dirty||!D.trim(),onClick:ce,children:[c==="commit"?e.jsx(j,{className:"spin",size:14}):e.jsx(se,{size:14}),t("git.commit")]}),e.jsxs("button",{title:i.ahead===0&&i.branch&&i.remoteUrl&&i.tokenConfigured&&i.latestCommit?t("git.noUnpushedCommits"):void 0,disabled:!!c||!i.branch||!i.tokenConfigured||!i.remoteUrl||!i.latestCommit||i.ahead===0,onClick:le,children:[c==="push"?e.jsx(j,{className:"spin",size:14}):e.jsx(ve,{size:14}),t("git.push"),i.ahead>0&&e.jsx("span",{className:"git-count",children:i.ahead})]}),e.jsxs("button",{disabled:!!c||!i.latestCommit,onClick:()=>{Z()},children:[c==="diff"?e.jsx(j,{className:"spin",size:14}):e.jsx(H,{size:14}),t("git.workingDiff")]}),e.jsxs("button",{className:"git-discard-button",title:i.restorable?t("git.discardChanges"):t("git.noChangesToDiscard"),disabled:!!c||!i.latestCommit||!i.restorable,onClick:()=>k(!0),children:[e.jsx(je,{size:14}),t("git.discardChanges")]}),!i.branch&&e.jsxs("button",{disabled:!!c,onClick:()=>{T(!1),p("branch")},children:[e.jsx(G,{size:14}),t("git.returnToBranch",{branch:i.defaultBranch})]})]})]}),u&&e.jsxs("section",{ref:L,className:`git-section git-diff-section${d?" is-fullscreen":""}`,children:[e.jsxs("div",{className:"git-diff-heading",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(H,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:t("git.diffTitle")}),e.jsxs("small",{children:[u.title,u.truncated?` · ${t("git.diffTruncated")}`:""]})]})]}),e.jsxs("div",{className:"git-diff-controls",children:[e.jsxs("div",{className:"git-diff-font-controls",role:"group","aria-label":t("git.diffFontSize"),children:[e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w<=8,title:t("git.diffFontDecrease"),"aria-label":t("git.diffFontDecrease"),onClick:()=>K(s=>Math.max(8,s-1)),children:e.jsx(ye,{size:14})}),e.jsxs("span",{className:"git-diff-font-value","aria-live":"polite",children:[w,"px"]}),e.jsx("button",{type:"button",className:"git-diff-font-button",disabled:w>=24,title:t("git.diffFontIncrease"),"aria-label":t("git.diffFontIncrease"),onClick:()=>K(s=>Math.min(24,s+1)),children:e.jsx(Ce,{size:14})})]}),e.jsx("button",{type:"button",className:"git-diff-fullscreen",title:t(d?"git.exitFullscreenDiff":"git.fullscreenDiff"),"aria-label":t(d?"git.exitFullscreenDiff":"git.fullscreenDiff"),onClick:()=>{he()},children:d?e.jsx(ke,{size:15}):e.jsx(be,{size:15})})]})]}),e.jsx(ze,{content:u.diff,empty:t("git.noChanges"),fontSize:w})]}),i.initialized&&e.jsxs("section",{className:"git-section",children:[e.jsxs("div",{className:"git-section-heading",children:[e.jsx(G,{size:16}),e.jsxs("div",{children:[e.jsx("strong",{children:t("git.history")}),e.jsx("small",{children:t("git.historyHint")})]})]}),e.jsxs("div",{className:"git-history",children:[B.map(s=>{const n=u?.revision===s.sha;return e.jsxs("article",{children:[e.jsx("code",{children:s.shortSha}),e.jsxs("div",{children:[e.jsx("strong",{children:s.message}),e.jsxs("small",{children:[s.authorName," · ",new Date(s.authoredAt).toLocaleString(S.resolvedLanguage)]})]}),e.jsxs("span",{"data-texlite-tooltip-always":!0,children:[e.jsx("button",{type:"button",className:n?"is-active":void 0,title:t(n?"git.hideCommitDiff":"git.viewCommitDiff"),"aria-label":t(n?"git.hideCommitDiff":"git.viewCommitDiff"),"aria-pressed":n,disabled:!!c,onClick:()=>de(s.sha),children:n?e.jsx(Ne,{size:14}):e.jsx(H,{size:14})}),e.jsx("button",{type:"button",title:t("git.checkoutVersion"),disabled:!!c,onClick:()=>{T(!1),p(s)},children:e.jsx(we,{size:14})})]})]},s.sha)}),B.length===0&&e.jsx("p",{className:"muted",children:t("git.noCommits")})]})]})]})]})}),e.jsx(P,{open:!!f,title:t(f==="branch"?"git.returnTitle":"git.checkoutTitle"),description:f==="branch"?t("git.returnDescription",{branch:i?.defaultBranch??"main"}):t("git.checkoutDescription",{revision:f?.shortSha??"",message:f?.message??""}),onOpenChange:s=>{s||p(null)},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>p(null),children:t("common.cancel")}),e.jsx("button",{className:U?"danger":"primary",onClick:ge,children:t("git.checkout")})]}),children:e.jsxs("label",{className:"git-force-checkout",children:[e.jsx("input",{type:"checkbox",checked:U,onChange:s=>T(s.target.checked)}),e.jsxs("span",{children:[e.jsx("strong",{children:t("git.forceCheckout")}),e.jsx("small",{children:t("git.forceCheckoutDescription")})]})]})}),e.jsx(P,{open:ne,title:t("git.discardTitle"),description:t("git.discardDescription"),onOpenChange:k,footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>k(!1),children:t("common.cancel")}),e.jsx("button",{className:"danger",onClick:me,children:t("git.discardConfirm")})]}),children:e.jsx(e.Fragment,{})})]})}function ze({content:l,empty:o,fontSize:y}){return l.trim()?e.jsx("pre",{className:"git-diff",style:{fontSize:`${y}px`},children:l.split(`
|
|
2
|
+
`).map((r,t)=>{const S=r.startsWith("+")&&!r.startsWith("+++")?"addition":r.startsWith("-")&&!r.startsWith("---")?"deletion":r.startsWith("@@")?"hunk":r.startsWith("diff ")?"header":"";return e.jsxs("span",{className:S,children:[r,`
|
|
3
|
+
`]},t)})}):e.jsx("div",{className:"git-diff-empty",children:o})}function ie(l){return l.trim().replace(/\s+/g,"-").replace(/[^A-Za-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^[.-]+|[.-]+$/g,"").slice(0,100)||"texlite-project"}export{He as GitDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as k,j as e,r as c}from"./react-CltQJflK.js";import{a as u,e as h,M as y,L as x}from"./index-DF5cor0N.js";import{G as b,E as T}from"./github-y6i0qxSV.js";import{T as A}from"./index-C5T8_lAl.js";function C(){const{t:i}=k();return e.jsxs("div",{className:"git-token-guidance",children:[e.jsx("strong",{children:i("git.recommendedAccessTitle")}),e.jsxs("span",{children:[i("git.recommendedAccessBeforeAll"),e.jsx("em",{className:"git-token-highlight",children:"All repositories"}),i("git.recommendedAccessBeforeAdministration"),e.jsx("em",{className:"git-token-highlight",children:"Administration"}),i("git.recommendedAccessBetweenPermissions"),e.jsx("em",{className:"git-token-highlight",children:"Contents"}),i("git.recommendedAccessAfterPermissions")]})]})}function B({open:i,onOpenChange:p}){const{t}=k(),[r,g]=c.useState(null),[m,d]=c.useState(""),[a,n]=c.useState(""),[j,o]=c.useState(""),[f,l]=c.useState("");c.useEffect(()=>{i&&(n("load"),o(""),l(""),d(""),u("/api/account/github").then(s=>g(s.status)).catch(s=>o(h(s))).finally(()=>n(s=>s==="load"?"":s)))},[i]);const v=async()=>{n("save"),o(""),l("");try{const s=await u("/api/account/github",{method:"PUT",body:JSON.stringify({token:m})});g(s.status),d(""),l(t("account.githubSaved"))}catch(s){o(h(s))}finally{n("")}},N=async()=>{n("remove"),o(""),l("");try{const s=await u("/api/account/github",{method:"DELETE"});g(s.status),d(""),l(t("account.githubRemoved"))}catch(s){o(h(s))}finally{n("")}};return e.jsx(y,{open:i,title:t("account.githubTitle"),description:t("account.githubDescription"),onOpenChange:s=>{a||p(s)},footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:!!a,onClick:()=>p(!1),children:t("common.close")}),e.jsxs("button",{className:"primary",disabled:!!a||m.trim().length<20,onClick:()=>{v()},children:[a==="save"&&e.jsx(x,{className:"spin",size:14}),t("git.saveToken")]})]}),children:e.jsxs("div",{className:"git-dialog account-github-dialog",children:[a==="load"&&!r&&e.jsxs("div",{className:"git-loading",children:[e.jsx(x,{className:"spin",size:20}),t("common.loading")]}),j&&e.jsx("p",{className:"git-message error dialog-error",children:j}),f&&e.jsxs("p",{className:"git-message success",children:[e.jsx(b,{size:14}),f]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(C,{}),r.tokenConfigured&&e.jsxs("div",{className:"git-account",children:[e.jsx(b,{size:17}),e.jsx("span",{children:t("git.connectedAs",{login:r.githubLogin})}),e.jsxs("button",{className:"danger-text",disabled:!!a,onClick:()=>{N()},children:[a==="remove"?e.jsx(x,{className:"spin",size:14}):e.jsx(A,{size:14}),t("git.removeToken")]})]}),e.jsxs("label",{className:"form-field",children:[r.tokenConfigured?t("git.replaceToken"):t("git.token"),e.jsx("input",{type:"password",autoComplete:"new-password",spellCheck:!1,autoCapitalize:"none",autoCorrect:"off",value:m,placeholder:t("git.tokenPlaceholder"),onChange:s=>d(s.target.value)})]}),e.jsx("div",{className:"git-inline-actions",children:e.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noreferrer",children:[t("git.createToken"),e.jsx(T,{size:12})]})}),e.jsx("p",{className:"muted account-github-encryption-note",children:t("account.githubEncryption")})]})]})})}export{B as GitHubAccountDialog};
|