dsh-mnemon-source-documents 0.6.0 → 0.6.2

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/lib/client.js CHANGED
@@ -4,37 +4,15 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
- //#region \0rolldown/runtime.js
8
- var __create = Object.create;
9
- var __defProp = Object.defineProperty;
10
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11
- var __getOwnPropNames = Object.getOwnPropertyNames;
12
- var __getProtoOf = Object.getPrototypeOf;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
16
- key = keys[i];
17
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: ((k) => from[k]).bind(null, key),
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
25
- value: mod,
26
- enumerable: true
27
- }) : target, mod));
28
- //#endregion
29
7
  let react = require("react");
30
- react = __toESM(react, 1);
31
8
  let dsh_mnemon_client = require("dsh-mnemon/client");
9
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
32
10
  let react_jsx_runtime = require("react/jsx-runtime");
33
11
  //#region presentation/locales.json
34
12
  var zh = {
35
13
  "nav.documents": "档案",
36
14
  "documents.title": "项目档案",
37
- "documents.description": "当前工作区的项目文档:先检索,再按需阅读全文;接近容量上限时,最久未用的档案会归档。",
15
+ "documents.description": "按需检索的工作区文档,超限时自动归档。",
38
16
  "documents.capacity": "{used} / {limit}",
39
17
  "documents.summary": "档案存储摘要",
40
18
  "documents.active": "活跃档案",
@@ -44,13 +22,13 @@ window.__ModuleLoader__.load({
44
22
  "documents.activeCapacity": "活跃容量",
45
23
  "documents.capacityHint": "按实际 UTF-8 文件大小计算",
46
24
  "documents.searchAria": "检索项目档案",
47
- "documents.searchPlaceholder": "搜索设计、调查、流程或交接记录…",
25
+ "documents.searchPlaceholder": "搜索档案…",
48
26
  "documents.search": "检索",
49
27
  "documents.scope": "档案范围",
50
- "documents.new": "新建档案",
28
+ "documents.new": "新建",
51
29
  "documents.newTitle": "创建托管档案",
52
30
  "documents.editTitle": "编辑活跃档案",
53
- "documents.editorHint": "控制层会生成 frontmatter、哈希与修订号;原项目文件始终只读。",
31
+ "documents.editorHint": "自动维护元数据与修订号,不修改项目源文件。",
54
32
  "documents.managedCopy": "托管副本",
55
33
  "documents.name": "标题",
56
34
  "documents.routing": "检索说明",
@@ -58,8 +36,8 @@ window.__ModuleLoader__.load({
58
36
  "documents.sourcesPlaceholder": "src/index.ts, docs/architecture.md",
59
37
  "documents.markdown": "Markdown 内容",
60
38
  "documents.saving": "保存中…",
61
- "documents.create": "创建档案",
62
- "documents.save": "保存修订",
39
+ "documents.create": "创建",
40
+ "documents.save": "保存",
63
41
  "documents.created": "已创建活跃档案。",
64
42
  "documents.createdAfterArchive": "已先迁移 {count} 份旧档案,再创建活跃档案。",
65
43
  "documents.updated": "已保存新的档案修订。",
@@ -82,8 +60,8 @@ window.__ModuleLoader__.load({
82
60
  "documents.edit": "编辑",
83
61
  "documents.delete": "删除",
84
62
  "documents.deleteConfirm": "永久删除这份档案?",
85
- "documents.deleteDescription": "将永久移除档案记录和托管副本,无法撤销。不会建立记忆空间冷索引,也不会修改已有记忆空间条目或项目源文件。",
86
- "documents.deleteNow": "永久删除",
63
+ "documents.deleteDescription": "永久移除托管副本,项目源文件与记忆空间不受影响,且无法撤销。",
64
+ "documents.deleteNow": "确认删除",
87
65
  "documents.deleting": "删除中…",
88
66
  "documents.deleted": "档案已永久删除。",
89
67
  "documents.path": "托管路径",
@@ -93,17 +71,16 @@ window.__ModuleLoader__.load({
93
71
  "documents.archiveReceipt": "Mnemon 冷索引回执",
94
72
  "documents.archiveNote": "归档说明",
95
73
  "documents.archiveTitle": "迁入归档",
96
- "documents.archiveDescription": "独立任务 Agent 先拟定摘要和目标空间;Host 校验后写入冷索引,再移动原文。没有已启用且支持精确写入与删除的记忆空间时,原文直接移入本地归档,不建立索引。",
74
+ "documents.archiveDescription": "生成摘要索引并移入归档,释放活跃容量。",
97
75
  "documents.archive": "归档",
98
76
  "documents.archiveConfirm": "确认归档这份档案?",
99
77
  "documents.archiving": "归档中…",
100
- "documents.archiveNow": "确认归档",
101
- "documents.footnote": "`.mnemon/documents/index.json` 是控制面事实源;active 总量固定不超过 10 MB,archived 不计入上限,项目源文件不会被修改。"
78
+ "documents.archiveNow": "确认归档"
102
79
  };
103
80
  var en = {
104
81
  "nav.documents": "Documents",
105
82
  "documents.title": "Project Documents",
106
- "documents.description": "Project documents for this workspace: searched first, read in full when needed; near the limit the least-used ones are archived.",
83
+ "documents.description": "Workspace documents searched on demand and archived when full.",
107
84
  "documents.capacity": "{used} / {limit}",
108
85
  "documents.summary": "Document storage summary",
109
86
  "documents.active": "Active",
@@ -113,13 +90,13 @@ window.__ModuleLoader__.load({
113
90
  "documents.activeCapacity": "Active capacity",
114
91
  "documents.capacityHint": "Measured from actual UTF-8 files",
115
92
  "documents.searchAria": "Search project documents",
116
- "documents.searchPlaceholder": "Search designs, investigations, procedures, or handoffs…",
93
+ "documents.searchPlaceholder": "Search documents…",
117
94
  "documents.search": "Search",
118
95
  "documents.scope": "Document scope",
119
- "documents.new": "New document",
96
+ "documents.new": "New",
120
97
  "documents.newTitle": "Create managed document",
121
98
  "documents.editTitle": "Edit active document",
122
- "documents.editorHint": "The control plane generates frontmatter, hashes, and revisions. Project source files stay read only.",
99
+ "documents.editorHint": "Metadata and revisions are managed automatically; source files stay untouched.",
123
100
  "documents.managedCopy": "Managed copy",
124
101
  "documents.name": "Title",
125
102
  "documents.routing": "Retrieval description",
@@ -127,8 +104,8 @@ window.__ModuleLoader__.load({
127
104
  "documents.sourcesPlaceholder": "src/index.ts, docs/architecture.md",
128
105
  "documents.markdown": "Markdown content",
129
106
  "documents.saving": "Saving…",
130
- "documents.create": "Create document",
131
- "documents.save": "Save revision",
107
+ "documents.create": "Create",
108
+ "documents.save": "Save",
132
109
  "documents.created": "Active document created.",
133
110
  "documents.createdAfterArchive": "Archived {count} older document(s), then created the active document.",
134
111
  "documents.updated": "New document revision saved.",
@@ -151,8 +128,8 @@ window.__ModuleLoader__.load({
151
128
  "documents.edit": "Edit",
152
129
  "documents.delete": "Delete",
153
130
  "documents.deleteConfirm": "Permanently delete this document?",
154
- "documents.deleteDescription": "This permanently removes the document record and managed copy and cannot be undone. No Memory Space index is created. Existing Memory Space entries and original project files remain unchanged.",
155
- "documents.deleteNow": "Delete permanently",
131
+ "documents.deleteDescription": "Permanently removes the managed copy; project files and Memory Space notes stay untouched. This cannot be undone.",
132
+ "documents.deleteNow": "Confirm delete",
156
133
  "documents.deleting": "Deleting…",
157
134
  "documents.deleted": "Document permanently deleted.",
158
135
  "documents.path": "Managed path",
@@ -162,16 +139,15 @@ window.__ModuleLoader__.load({
162
139
  "documents.archiveReceipt": "Mnemon cold-index receipt",
163
140
  "documents.archiveNote": "Archive note",
164
141
  "documents.archiveTitle": "Move to archive",
165
- "documents.archiveDescription": "An independent task Agent proposes a summary and destination. The Host validates and writes the cold index before moving the original. Without an active Memory Space that has exact writes and safe deletion, the original moves to the local archive without an index.",
142
+ "documents.archiveDescription": "Index a summary in Memory Spaces and move the full text to archive.",
166
143
  "documents.archive": "Archive",
167
144
  "documents.archiveConfirm": "Archive this document?",
168
145
  "documents.archiving": "Archiving…",
169
- "documents.archiveNow": "Confirm archive",
170
- "documents.footnote": "`.mnemon/documents/index.json` is the control-plane source of truth. active stays at or below 10 MB, archived is excluded, and project source files are never modified."
146
+ "documents.archiveNow": "Confirm archive"
171
147
  };
172
148
  //#endregion
173
149
  //#region \0source-css:/home/runner/work/dsh-mnemon/dsh-mnemon/plugins/dsh-mnemon-source-documents/presentation/page.module.css.mjs
174
- const css$2 = ".IIa07q_documentSummary{grid-template-columns:.7fr .7fr 1.6fr;gap:12px;margin-bottom:12px;display:grid}.IIa07q_documentSummary article{border:.5px solid var(--mn-card-line);border-radius:var(--dsw-radius-lg);min-width:0;min-height:92px;padding:14px 16px}.IIa07q_documentSummary article>span{color:var(--mn-faint);font-size:12px;line-height:18px;display:block}.IIa07q_documentSummary article>strong{font-variant-numeric:tabular-nums;margin:4px 0 2px;font-size:20px;font-weight:500;line-height:28px;display:block}.IIa07q_documentSummary article>small{color:var(--mn-faint);font-size:12px;line-height:18px}.IIa07q_documentCapacity>div{background:var(--mn-fill);border-radius:999px;height:4px;margin:8px 0 6px;overflow:hidden}.IIa07q_documentCapacity>div i{border-radius:inherit;background:var(--dsw-alias-brand-primary);height:100%;transition:width .3s;display:block}.IIa07q_documentToolbar{border:.5px solid var(--mn-card-line);border-radius:var(--dsw-radius-lg);align-items:center;gap:8px;margin-bottom:12px;padding:8px;display:flex}.IIa07q_documentToolbar form{flex:1;align-items:center;gap:8px;min-width:260px;display:flex}.IIa07q_documentSearch{flex:1}.IIa07q_documentEditor input,.IIa07q_documentEditor textarea{border:.5px solid var(--mn-field-line);border-radius:var(--dsw-radius-md);width:100%;color:var(--mn-text);background:var(--mn-input);outline:0;padding:6px 10px;font-size:13px;line-height:20px}.IIa07q_documentEditor input:focus,.IIa07q_documentEditor textarea:focus{border-color:var(--mn-accent)}.IIa07q_documentToolbar>div{border-radius:var(--dsw-radius-md);background:var(--mn-hover);align-items:center;gap:2px;padding:3px;display:flex}.IIa07q_documentToolbar>div button{border-radius:var(--dsw-radius-sm);min-height:28px;color:var(--mn-muted);cursor:pointer;background:0 0;border:0;padding:0 12px;font-size:13px;font-weight:500;line-height:20px}.IIa07q_documentToolbar>div button:hover{color:var(--mn-text)}.IIa07q_documentToolbar>div button[data-active]{color:var(--mn-text);background:var(--mn-layer-1);box-shadow:var(--dsw-elevation-soft)}.IIa07q_documentToolbar>div b{color:var(--mn-faint);font-variant-numeric:tabular-nums;margin-left:6px;font-size:12px;font-weight:400}.IIa07q_documentWorkspace{grid-template-columns:minmax(250px,310px) minmax(0,1fr);gap:12px;min-height:590px;display:grid}.IIa07q_documentList,.IIa07q_documentReader{border:.5px solid var(--mn-card-line);border-radius:var(--dsw-radius-lg);min-width:0;overflow:hidden}.IIa07q_documentList{align-self:stretch}.IIa07q_documentList>header{border-bottom:.5px solid var(--mn-line);min-height:44px;color:var(--mn-faint);justify-content:space-between;align-items:center;padding:0 14px;font-size:12px;line-height:18px;display:flex}.IIa07q_documentList>header code{color:var(--mn-muted)}.IIa07q_documentList>button{--mn-provider-color:var(--mn-faint);border-radius:var(--dsw-radius-md);width:calc(100% - 12px);color:var(--mn-text);text-align:left;cursor:pointer;background:0 0;border:0;margin:6px 6px 0;padding:10px 12px;transition:background-color .15s;display:block}.IIa07q_documentList>button:hover{background:var(--mn-hover)}.IIa07q_documentList>button[data-selected]{background:var(--mn-fill)}.IIa07q_documentList>button>div{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.IIa07q_documentList>button strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500;line-height:20px;overflow:hidden}.IIa07q_documentList>button time{color:var(--mn-faint);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.IIa07q_documentList>button p{color:var(--mn-faint);-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:4px 0 6px;font-size:12px;line-height:18px;display:-webkit-box;overflow:hidden}.IIa07q_documentList>button footer{color:var(--mn-faint);align-items:center;gap:8px;font-size:11px;line-height:16px;display:flex}.IIa07q_documentList>button footer code{margin-left:auto}.IIa07q_documentList>button footer em{color:var(--mn-danger);font-style:normal}.IIa07q_documentListEmpty{min-height:230px;color:var(--mn-muted);text-align:center;align-content:center;place-items:center;gap:4px;padding:24px;display:grid}.IIa07q_documentListEmpty>span{color:var(--mn-faint);margin-bottom:6px;font-size:24px;line-height:1}.IIa07q_documentListEmpty p{color:var(--mn-faint);margin:0;font-size:12px;line-height:18px}.IIa07q_documentReader{padding:clamp(16px,2vw,24px)}.IIa07q_documentReader>.IIa07q_emptyState{background:0 0;border:0;height:100%}.IIa07q_documentDetail>header{border-bottom:.5px solid var(--mn-line);justify-content:space-between;align-items:flex-start;gap:16px;padding-bottom:14px;display:flex}.IIa07q_documentDetail>header span{color:var(--mn-faint);font-size:12px;line-height:18px}.IIa07q_documentDetail>header h3{margin:2px 0;font-size:16px;font-weight:500;line-height:24px}.IIa07q_documentDetail>header p{color:var(--mn-faint);margin:0;font-size:12px;line-height:18px}.IIa07q_documentActions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.IIa07q_documentDetail>dl{border:.5px solid var(--mn-line);border-radius:var(--dsw-radius-md);grid-template-columns:2fr .45fr .8fr .55fr;margin:12px 0;display:grid;overflow:hidden}.IIa07q_documentDetail>dl>div{min-width:0;padding:8px 10px}.IIa07q_documentDetail>dl>div+div{border-left:.5px solid var(--mn-line)}.IIa07q_documentDetail dt{color:var(--mn-faint);margin-bottom:2px;font-size:11px;line-height:16px}.IIa07q_documentDetail dd{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:12px;line-height:18px;overflow:hidden}.IIa07q_documentSources{flex-wrap:wrap;align-items:center;gap:6px;margin:12px 0;display:flex}.IIa07q_documentSources>span{color:var(--mn-faint);margin-right:4px;font-size:12px}.IIa07q_documentSources code,.IIa07q_documentArchiveReceipt code{color:var(--mn-muted);background:var(--mn-fill);border-radius:999px;padding:1px 8px;font-size:11px;line-height:17px}.IIa07q_markdownBody{overflow-wrap:anywhere;border:.5px solid var(--mn-line);border-radius:var(--dsw-radius-md);min-height:310px;color:var(--mn-text);margin:16px 0 0;padding:clamp(16px,2.5vw,28px);font-size:14px;line-height:1.75}.IIa07q_markdownBody>:first-child{margin-top:0}.IIa07q_markdownBody>:last-child{margin-bottom:0}.IIa07q_markdownBody h1,.IIa07q_markdownBody h2,.IIa07q_markdownBody h3,.IIa07q_markdownBody h4{color:var(--mn-text);margin:1.5em 0 .6em;font-weight:500;line-height:1.35}.IIa07q_markdownBody h1{border-bottom:.5px solid var(--mn-line);padding-bottom:.35em;font-size:1.6em}.IIa07q_markdownBody h2{border-bottom:.5px solid var(--mn-line);padding-bottom:.3em;font-size:1.35em}.IIa07q_markdownBody h3{font-size:1.15em}.IIa07q_markdownBody p,.IIa07q_markdownBody ul,.IIa07q_markdownBody ol,.IIa07q_markdownBody blockquote,.IIa07q_markdownBody table,.IIa07q_markdownBody pre{margin:.85em 0}.IIa07q_markdownBody ul,.IIa07q_markdownBody ol{padding-left:1.6em}.IIa07q_markdownBody li+li{margin-top:.3em}.IIa07q_markdownBody blockquote{border-left:2px solid var(--mn-line-strong);color:var(--mn-muted);margin-inline:0;padding:.1em 1em}.IIa07q_markdownBody code{border-radius:var(--dsw-radius-xs);color:var(--mn-text);background:var(--dsw-alias-markdown-inline-code,var(--mn-fill));font:.88em/1.55 var(--mn-code);padding:.15em .4em}.IIa07q_markdownBody pre{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-markdown-code-block,var(--mn-fill));max-width:100%;padding:12px 16px;overflow:auto}.IIa07q_markdownBody pre code{background:0 0;padding:0;font-size:12px}.IIa07q_markdownBody a{color:var(--dsw-alias-link,var(--mn-accent));text-underline-offset:3px;text-decoration-thickness:1px}.IIa07q_markdownBody hr{border:0;border-top:.5px solid var(--mn-line);margin:1.8em 0}.IIa07q_markdownBody table{border-collapse:collapse;max-width:100%;display:block;overflow-x:auto}.IIa07q_markdownBody th,.IIa07q_markdownBody td{border:.5px solid var(--mn-line);text-align:left;vertical-align:top;padding:8px 10px}.IIa07q_markdownBody th{background:var(--mn-fill);font-weight:500}.IIa07q_markdownBody img{border-radius:var(--dsw-radius-sm);max-width:100%;height:auto}.IIa07q_documentArchiveReceipt{border-radius:var(--dsw-radius-md);background:color-mix(in srgb, var(--mn-success) 8%, transparent);margin:12px 0;padding:10px 12px}.IIa07q_documentArchiveReceipt p{color:var(--mn-muted);margin:2px 0 8px;font-size:12px;line-height:18px}.IIa07q_documentArchiveReceipt div{flex-wrap:wrap;gap:6px;display:flex}.IIa07q_documentDanger{border-top:.5px solid var(--mn-line);justify-content:flex-end;align-items:center;gap:8px;min-height:56px;margin-top:12px;padding-top:12px;display:flex}.IIa07q_documentDanger>div{margin-right:auto}.IIa07q_documentDanger strong{font-size:13px;font-weight:500;line-height:20px;display:block}.IIa07q_documentDanger p{color:var(--mn-faint);margin:2px 0 0;font-size:12px;line-height:18px}.IIa07q_documentDanger>span{color:var(--mn-danger);margin-right:auto;font-size:12px}.IIa07q_documentEditor{border:.5px solid var(--mn-card-line);border-radius:var(--dsw-radius-lg);margin-bottom:12px;padding:16px}.IIa07q_documentReader>.IIa07q_documentEditor{background:0 0;border:0;margin:0;padding:0}.IIa07q_documentEditor>header{justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:12px;display:flex}.IIa07q_documentEditor h3{margin:0;font-size:14px;font-weight:500;line-height:22px}.IIa07q_documentEditor header p{color:var(--mn-faint);margin:2px 0 0;font-size:12px;line-height:18px}.IIa07q_documentEditor header>span,.IIa07q_documentEditor header>code{color:var(--mn-muted);background:var(--mn-fill);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.IIa07q_documentEditor label{color:var(--mn-muted);gap:6px;margin-top:12px;font-size:12px;font-weight:500;line-height:18px;display:grid}.IIa07q_documentEditor textarea{resize:vertical;line-height:1.65}.IIa07q_documentEditorMeta{grid-template-columns:.8fr 1.2fr;gap:12px;display:grid}.IIa07q_documentEditorMeta label{margin:0}.IIa07q_documentEditor footer{justify-content:flex-end;gap:8px;margin-top:12px;display:flex}@media (width<=1000px){.IIa07q_documentWorkspace{grid-template-columns:minmax(220px,270px) minmax(0,1fr)}.IIa07q_documentDetail>dl{grid-template-columns:repeat(2,minmax(0,1fr))}.IIa07q_documentDetail>dl>div+div{border-left:0}.IIa07q_documentDetail>dl>div:nth-child(2n){border-left:.5px solid var(--mn-line)}.IIa07q_documentDetail>dl>div:nth-child(n+3){border-top:.5px solid var(--mn-line)}}@media (width<=760px){.IIa07q_documentSummary{grid-template-columns:repeat(2,minmax(0,1fr))}.IIa07q_documentCapacity{grid-column:1/-1}.IIa07q_documentToolbar{flex-direction:column;align-items:stretch}.IIa07q_documentToolbar form{min-width:0}.IIa07q_documentToolbar>div,.IIa07q_documentToolbar>button{width:100%}.IIa07q_documentToolbar>div button{flex:1}.IIa07q_documentWorkspace{grid-template-columns:1fr;min-height:0}.IIa07q_documentList{-webkit-overflow-scrolling:touch;max-height:330px;overflow:auto}.IIa07q_documentReader{min-height:430px}.IIa07q_documentEditorMeta{grid-template-columns:1fr}}@media (width<=520px){.IIa07q_documentDetail>header,.IIa07q_documentDanger{flex-direction:column;align-items:flex-start}.IIa07q_documentDetail>header>div:last-child,.IIa07q_documentDetail>header button{width:100%}.IIa07q_documentDanger>div,.IIa07q_documentDanger>span{margin-right:0}.IIa07q_documentDanger>button{width:100%}.IIa07q_documentDetail>dl{grid-template-columns:1fr}.IIa07q_documentDetail>dl>div:nth-child(2n){border-left:0}.IIa07q_documentDetail>dl>div+div{border-top:.5px solid var(--mn-line)}.IIa07q_markdownBody{padding:16px;font-size:13px}}";
150
+ const css$2 = ".IIa07q_documentSummary{grid-template-columns:.7fr .7fr 1.6fr;gap:12px;margin-bottom:12px;display:grid}.IIa07q_documentSummary article{border:.5px solid var(--mn-card-line);border-radius:var(--dsw-radius-lg);min-width:0;min-height:92px;padding:14px 16px}.IIa07q_documentSummary article>span{color:var(--mn-faint);font-size:12px;line-height:18px;display:block}.IIa07q_documentSummary article>strong{font-variant-numeric:tabular-nums;margin:4px 0 2px;font-size:20px;font-weight:500;line-height:28px;display:block}.IIa07q_documentSummary article>small{color:var(--mn-faint);font-size:12px;line-height:18px}.IIa07q_documentCapacity>div{background:var(--mn-fill);border-radius:999px;height:4px;margin:8px 0 6px;overflow:hidden}.IIa07q_documentCapacity>div i{border-radius:inherit;background:var(--dsw-alias-brand-primary);height:100%;transition:width .3s;display:block}.IIa07q_documentToolbar{border:.5px solid var(--mn-card-line);border-radius:var(--dsw-radius-lg);align-items:center;gap:8px;margin-bottom:12px;padding:10px 12px;display:flex}.IIa07q_documentToolbar form{flex:1;align-items:center;gap:8px;min-width:260px;display:flex}.IIa07q_documentSearch{flex:1}.IIa07q_documentEditor input,.IIa07q_documentEditor textarea{border:.5px solid var(--mn-field-line);border-radius:var(--dsw-radius-md);width:100%;color:var(--mn-text);background:var(--mn-input);outline:0;padding:6px 10px;font-size:13px;line-height:20px}.IIa07q_documentEditor input:focus,.IIa07q_documentEditor textarea:focus{border-color:var(--mn-accent)}.IIa07q_documentToolbar>div{--dsh-segment-count:2;--dsh-segment-index:0;border-radius:var(--dsw-radius-md);background:var(--mn-hover);grid-auto-columns:1fr;grid-auto-flow:column;align-items:center;gap:2px;padding:4px;display:inline-grid;position:relative}.IIa07q_documentToolbar>div:before{content:\"\";width:calc((100% - 8px - 2px * (var(--dsh-segment-count) - 1)) / var(--dsh-segment-count));border-radius:var(--dsw-radius-sm);background:var(--mn-layer-1);height:calc(100% - 8px);box-shadow:var(--dsw-elevation-soft);transform:translateX(calc(var(--dsh-segment-index) * (100% + 2px)));pointer-events:none;transition:transform .16s cubic-bezier(.22,1,.36,1);position:absolute;top:4px;left:4px}.IIa07q_documentToolbar>div button{z-index:1;border-radius:var(--dsw-radius-sm);height:28px;color:var(--mn-muted);white-space:nowrap;cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;line-height:20px;transition:color .12s;display:inline-flex;position:relative}.IIa07q_documentToolbar>div button:hover,.IIa07q_documentToolbar>div button[data-active]{color:var(--mn-text)}.IIa07q_documentToolbar>div button:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--mn-focus);outline-offset:-2px}.IIa07q_documentToolbar>div b{color:var(--mn-faint);font-variant-numeric:tabular-nums;margin-left:6px;font-size:12px;font-weight:400}.IIa07q_documentWorkspace{grid-template-columns:minmax(250px,310px) minmax(0,1fr);gap:12px;min-height:590px;display:grid}.IIa07q_documentList,.IIa07q_documentReader{border:.5px solid var(--mn-card-line);border-radius:var(--dsw-radius-lg);min-width:0;overflow:hidden}.IIa07q_documentList{align-self:stretch}.IIa07q_documentList>header{border-bottom:.5px solid var(--mn-line);min-height:44px;color:var(--mn-faint);justify-content:space-between;align-items:center;padding:0 14px;font-size:12px;line-height:18px;display:flex}.IIa07q_documentList>header code{color:var(--mn-muted);font-variant-numeric:tabular-nums}.IIa07q_documentList>button{--mn-provider-color:var(--mn-faint);border-radius:var(--dsw-radius-md);width:calc(100% - 12px);color:var(--mn-text);text-align:left;cursor:pointer;background:0 0;border:0;margin:6px 6px 0;padding:10px 12px;transition:background-color .15s;display:block}.IIa07q_documentList>button:hover{background:var(--mn-hover)}.IIa07q_documentList>button[data-selected]{background:var(--mn-fill)}.IIa07q_documentList>button>div{justify-content:space-between;align-items:baseline;gap:12px;display:flex}.IIa07q_documentList>button strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500;line-height:20px;overflow:hidden}.IIa07q_documentList>button time{color:var(--mn-faint);font-variant-numeric:tabular-nums;flex:none;font-size:11px}.IIa07q_documentList>button p{color:var(--mn-faint);-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:4px 0 6px;font-size:12px;line-height:18px;display:-webkit-box;overflow:hidden}.IIa07q_documentList>button footer{color:var(--mn-faint);font-variant-numeric:tabular-nums;align-items:center;gap:8px;font-size:11px;line-height:16px;display:flex}.IIa07q_documentList>button footer code{margin-left:auto}.IIa07q_documentList>button footer em{color:var(--mn-danger);font-style:normal}.IIa07q_documentListEmpty{min-height:230px;color:var(--mn-muted);text-align:center;align-content:center;place-items:center;gap:4px;padding:24px;display:grid}.IIa07q_documentListEmpty>span{color:var(--mn-faint);margin-bottom:6px;font-size:24px;line-height:1}.IIa07q_documentListEmpty p{color:var(--mn-faint);margin:0;font-size:12px;line-height:18px}.IIa07q_documentReader{padding:clamp(16px,2vw,24px)}.IIa07q_documentReader>.IIa07q_emptyState{background:0 0;border:0;height:100%}.IIa07q_documentReader>.IIa07q_loading{justify-content:center;align-items:center;gap:8px;height:100%;min-height:240px;display:flex}.IIa07q_documentReader>.IIa07q_loading [class*=sectionSpinner]{position:static}.IIa07q_documentDetail>header{border-bottom:.5px solid var(--mn-line);justify-content:space-between;align-items:flex-start;gap:16px;padding-bottom:14px;display:flex}.IIa07q_documentDetail>header span{color:var(--mn-faint);font-size:12px;line-height:18px}.IIa07q_documentDetail>header h3{margin:2px 0;font-size:16px;font-weight:500;line-height:24px}.IIa07q_documentDetail>header p{color:var(--mn-faint);margin:0;font-size:12px;line-height:18px}.IIa07q_documentActions{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.IIa07q_documentDetail>dl{border:.5px solid var(--mn-line);border-radius:var(--dsw-radius-md);grid-template-columns:2fr .45fr .8fr .55fr;margin:12px 0;display:grid;overflow:hidden}.IIa07q_documentDetail>dl>div{min-width:0;padding:8px 10px}.IIa07q_documentDetail>dl>div+div{border-left:.5px solid var(--mn-line)}.IIa07q_documentDetail dt{color:var(--mn-faint);margin-bottom:2px;font-size:11px;line-height:16px}.IIa07q_documentDetail dd{text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums;margin:0;font-size:12px;line-height:18px;overflow:hidden}.IIa07q_documentSources{flex-wrap:wrap;align-items:center;gap:6px;margin:12px 0;display:flex}.IIa07q_documentSources>span{color:var(--mn-faint);margin-right:4px;font-size:12px}.IIa07q_documentSources code,.IIa07q_documentArchiveReceipt code{max-width:100%;color:var(--mn-muted);background:var(--mn-fill);border-radius:999px;align-items:center;padding:1px 8px;font-size:11px;line-height:17px;display:inline-flex}.IIa07q_markdownBody{overflow-wrap:anywhere;border:.5px solid var(--mn-line);border-radius:var(--dsw-radius-md);min-height:310px;color:var(--mn-text);margin:16px 0 0;padding:clamp(16px,2.5vw,28px);font-size:14px;line-height:1.75}.IIa07q_markdownBody>:first-child{margin-top:0}.IIa07q_markdownBody>:last-child{margin-bottom:0}.IIa07q_markdownBody h1,.IIa07q_markdownBody h2,.IIa07q_markdownBody h3,.IIa07q_markdownBody h4{color:var(--mn-text);margin:1.5em 0 .6em;font-weight:500;line-height:1.35}.IIa07q_markdownBody h1{border-bottom:.5px solid var(--mn-line);padding-bottom:.35em;font-size:1.6em}.IIa07q_markdownBody h2{border-bottom:.5px solid var(--mn-line);padding-bottom:.3em;font-size:1.35em}.IIa07q_markdownBody h3{font-size:1.15em}.IIa07q_markdownBody p,.IIa07q_markdownBody ul,.IIa07q_markdownBody ol,.IIa07q_markdownBody blockquote,.IIa07q_markdownBody table,.IIa07q_markdownBody pre{margin:.85em 0}.IIa07q_markdownBody ul,.IIa07q_markdownBody ol{padding-left:1.6em}.IIa07q_markdownBody li+li{margin-top:.3em}.IIa07q_markdownBody blockquote{border-left:2px solid var(--mn-line-strong);color:var(--mn-muted);margin-inline:0;padding:.1em 1em}.IIa07q_markdownBody code{border-radius:var(--dsw-radius-xs);color:var(--mn-text);background:var(--dsw-alias-markdown-inline-code,var(--mn-fill));font:.88em/1.55 var(--mn-code);padding:.15em .4em}.IIa07q_markdownBody pre{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-markdown-code-block,var(--mn-fill));max-width:100%;padding:12px 16px;overflow:auto}.IIa07q_markdownBody pre code{background:0 0;padding:0;font-size:12px}.IIa07q_markdownBody a{color:var(--dsw-alias-link,var(--mn-accent));text-underline-offset:3px;text-decoration-thickness:1px}.IIa07q_markdownBody hr{border:0;border-top:.5px solid var(--mn-line);margin:1.8em 0}.IIa07q_markdownBody table{border-collapse:collapse;max-width:100%;display:block;overflow-x:auto}.IIa07q_markdownBody th,.IIa07q_markdownBody td{border:.5px solid var(--mn-line);text-align:left;vertical-align:top;padding:8px 10px}.IIa07q_markdownBody th{background:var(--mn-fill);font-weight:500}.IIa07q_markdownBody img{border-radius:var(--dsw-radius-sm);max-width:100%;height:auto}.IIa07q_documentArchiveReceipt{border-radius:var(--dsw-radius-md);background:color-mix(in srgb, var(--mn-success) 8%, transparent);margin:12px 0;padding:10px 12px}.IIa07q_documentArchiveReceipt p{color:var(--mn-muted);margin:2px 0 8px;font-size:12px;line-height:18px}.IIa07q_documentArchiveReceipt div{flex-wrap:wrap;gap:6px;display:flex}.IIa07q_documentDanger{border-top:.5px solid var(--mn-line);justify-content:flex-end;align-items:center;gap:8px;min-height:56px;margin-top:12px;padding-top:12px;display:flex}.IIa07q_documentDanger>div{margin-right:auto}.IIa07q_documentDanger strong{font-size:13px;font-weight:500;line-height:20px;display:block}.IIa07q_documentDanger p{color:var(--mn-faint);margin:2px 0 0;font-size:12px;line-height:18px}.IIa07q_documentDanger>span{color:var(--mn-danger);margin-right:auto;font-size:12px}.IIa07q_documentEditor{border:.5px solid var(--mn-card-line);border-radius:var(--dsw-radius-lg);margin-bottom:12px;padding:16px}.IIa07q_documentReader>.IIa07q_documentEditor{background:0 0;border:0;margin:0;padding:0}.IIa07q_documentEditor>header{justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:12px;display:flex}.IIa07q_documentEditor h3{margin:0;font-size:14px;font-weight:500;line-height:22px}.IIa07q_documentEditor header p{color:var(--mn-faint);margin:2px 0 0;font-size:12px;line-height:18px}.IIa07q_documentEditor header>span,.IIa07q_documentEditor header>code{color:var(--mn-muted);background:var(--mn-fill);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.IIa07q_documentEditor label{color:var(--mn-muted);gap:6px;margin-top:12px;font-size:12px;font-weight:500;line-height:18px;display:grid}.IIa07q_documentEditor textarea{resize:vertical;line-height:1.65}.IIa07q_documentEditorMeta{grid-template-columns:.8fr 1.2fr;gap:12px;display:grid}.IIa07q_documentEditorMeta label{margin:0}.IIa07q_documentEditor footer{justify-content:flex-end;gap:8px;margin-top:12px;display:flex}@container IIa07q_mnemon-workbench (width<=880px){.IIa07q_documentWorkspace{grid-template-columns:minmax(220px,270px) minmax(0,1fr)}.IIa07q_documentDetail>dl{grid-template-columns:repeat(2,minmax(0,1fr))}.IIa07q_documentDetail>dl>div+div{border-left:0}.IIa07q_documentDetail>dl>div:nth-child(2n){border-left:.5px solid var(--mn-line)}.IIa07q_documentDetail>dl>div:nth-child(n+3){border-top:.5px solid var(--mn-line)}}@container IIa07q_mnemon-workbench (width<=640px){.IIa07q_documentSummary{grid-template-columns:repeat(2,minmax(0,1fr))}.IIa07q_documentCapacity{grid-column:1/-1}.IIa07q_documentToolbar{flex-direction:column;align-items:stretch}.IIa07q_documentToolbar form{min-width:0}.IIa07q_documentToolbar>div,.IIa07q_documentToolbar>button{width:100%}.IIa07q_documentToolbar>div button{flex:1}.IIa07q_documentWorkspace{grid-template-columns:1fr;min-height:0}.IIa07q_documentList{-webkit-overflow-scrolling:touch;max-height:330px;overflow:auto}.IIa07q_documentReader{min-height:430px}.IIa07q_documentEditorMeta{grid-template-columns:1fr}}@media (width<=1000px){.IIa07q_documentWorkspace{grid-template-columns:minmax(220px,270px) minmax(0,1fr)}.IIa07q_documentDetail>dl{grid-template-columns:repeat(2,minmax(0,1fr))}.IIa07q_documentDetail>dl>div+div{border-left:0}.IIa07q_documentDetail>dl>div:nth-child(2n){border-left:.5px solid var(--mn-line)}.IIa07q_documentDetail>dl>div:nth-child(n+3){border-top:.5px solid var(--mn-line)}}@media (width<=760px){.IIa07q_documentSummary{grid-template-columns:repeat(2,minmax(0,1fr))}.IIa07q_documentCapacity{grid-column:1/-1}.IIa07q_documentToolbar{flex-direction:column;align-items:stretch}.IIa07q_documentToolbar form{min-width:0}.IIa07q_documentToolbar>div,.IIa07q_documentToolbar>button{width:100%}.IIa07q_documentToolbar>div button{flex:1}.IIa07q_documentWorkspace{grid-template-columns:1fr;min-height:0}.IIa07q_documentList{-webkit-overflow-scrolling:touch;max-height:330px;overflow:auto}.IIa07q_documentReader{min-height:430px}.IIa07q_documentEditorMeta{grid-template-columns:1fr}}@media (width<=520px){.IIa07q_documentDetail>header,.IIa07q_documentDanger{flex-direction:column;align-items:flex-start}.IIa07q_documentDetail>header>div:last-child,.IIa07q_documentDetail>header button{width:100%}.IIa07q_documentDanger>div,.IIa07q_documentDanger>span{margin-right:0}.IIa07q_documentDanger>button{width:100%}.IIa07q_documentDetail>dl{grid-template-columns:1fr}.IIa07q_documentDetail>dl>div:nth-child(2n){border-left:0}.IIa07q_documentDetail>dl>div+div{border-top:.5px solid var(--mn-line)}.IIa07q_markdownBody{padding:16px;font-size:13px}}@media (prefers-reduced-motion:reduce){.IIa07q_documentCapacity>div i,.IIa07q_documentToolbar>div:before,.IIa07q_documentToolbar>div button,.IIa07q_documentList>button{transition:none}}";
175
151
  const id$1 = "dsh-mnemon-source-documents/presentation/page.module.css";
176
152
  if (typeof document !== "undefined") {
177
153
  let tag = document.querySelector("style[data-plugin-css=" + JSON.stringify(id$1) + "]");
@@ -199,11 +175,13 @@ window.__ModuleLoader__.load({
199
175
  "documentToolbar": "IIa07q_documentToolbar",
200
176
  "documentWorkspace": "IIa07q_documentWorkspace",
201
177
  "emptyState": "IIa07q_emptyState",
202
- "markdownBody": "IIa07q_markdownBody"
178
+ "loading": "IIa07q_loading",
179
+ "markdownBody": "IIa07q_markdownBody",
180
+ "mnemon-workbench": "IIa07q_mnemon-workbench"
203
181
  };
204
182
  //#endregion
205
183
  //#region \0source-css:/home/runner/work/dsh-mnemon/dsh-mnemon/plugins/dsh-mnemon-source-documents/presentation/sidebar.module.css.mjs
206
- const css$1 = "._Bh55G_shell ._Bh55G_modal form[class*=documentEditor]{background:0 0;border:0;border-radius:0;margin:0;padding:0}._Bh55G_shell ._Bh55G_modal form[class*=documentEditor]>header{display:none}._Bh55G_shell [class*=documentWorkspace]{align-items:stretch;height:clamp(520px,100dvh - 220px,760px);min-height:520px}._Bh55G_shell [class*=documentList],._Bh55G_shell [class*=documentReader]{overscroll-behavior:contain;scrollbar-gutter:stable;min-height:0;overflow-y:auto}@media (width<=760px){._Bh55G_shell [class*=documentWorkspace]{height:auto;min-height:0}._Bh55G_shell [class*=documentList]{scrollbar-gutter:auto;overflow-y:auto}._Bh55G_shell [class*=documentReader]{scrollbar-gutter:auto;overflow:visible}}";
184
+ const css$1 = "._Bh55G_shell ._Bh55G_modal{flex-direction:column;max-height:min(86dvh,760px);display:flex;overflow:hidden}._Bh55G_shell ._Bh55G_modal>[class*=modalBody]{overscroll-behavior:contain;flex:auto;min-height:0;overflow-y:auto}._Bh55G_shell ._Bh55G_modal>[class*=modalFooter]{z-index:1;background:var(--dsw-alias-bg-layer-2,var(--mn-surface));flex:none;position:relative}._Bh55G_shell ._Bh55G_modal form[class*=documentEditor]{background:0 0;border:0;border-radius:0;flex-shrink:0;margin:0;padding:0}._Bh55G_shell ._Bh55G_modal form[class*=documentEditor]>header{display:none}._Bh55G_shell [class*=documentWorkspace]{height:clamp(420px, calc(100dvh - var(--dsh-frame-top-clearance,0px) - 344px), 720px);align-items:stretch;min-height:420px}._Bh55G_shell [class*=documentList],._Bh55G_shell [class*=documentReader]{overscroll-behavior:contain;scrollbar-gutter:stable;min-height:0;overflow-y:auto}@container _Bh55G_mnemon-workbench (width<=640px){._Bh55G_shell [class*=documentWorkspace]{height:auto;min-height:0}._Bh55G_shell [class*=documentList]{scrollbar-gutter:auto;overflow-y:auto}._Bh55G_shell [class*=documentReader]{scrollbar-gutter:auto;overflow:visible}}@media (width<=760px){._Bh55G_shell [class*=documentWorkspace]{height:auto;min-height:0}._Bh55G_shell [class*=documentList]{scrollbar-gutter:auto;overflow-y:auto}._Bh55G_shell [class*=documentReader]{scrollbar-gutter:auto;overflow:visible}}";
207
185
  const id = "dsh-mnemon-source-documents/presentation/sidebar.module.css";
208
186
  if (typeof document !== "undefined") {
209
187
  let tag = document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]");
@@ -215,6 +193,7 @@ window.__ModuleLoader__.load({
215
193
  if (tag.textContent !== css$1) tag.textContent = css$1;
216
194
  }
217
195
  var sidebar_module_css_default = {
196
+ "mnemon-workbench": "_Bh55G_mnemon-workbench",
218
197
  "modal": "_Bh55G_modal",
219
198
  "shell": "_Bh55G_shell"
220
199
  };
@@ -232,953 +211,42 @@ window.__ModuleLoader__.load({
232
211
  const fallback = (0, dsh_mnemon_client.useT)();
233
212
  const locale = (0, dsh_mnemon_client.useLocale)();
234
213
  return (0, react.useMemo)(() => (key, params) => {
235
- const dictionary = locale.startsWith("en") ? en : zh;
214
+ const dictionary = locale.toLowerCase().startsWith("zh") ? zh : en;
215
+ if (!/^(en|zh)(-|$)/i.test(locale)) {
216
+ const translated = fallback(key, params);
217
+ if (translated !== key) return translated;
218
+ }
236
219
  if (!Object.hasOwn(dictionary, key)) return fallback(key, params);
237
220
  const text = dictionary[key];
238
221
  return params === void 0 ? text : text.replace(/\{(\w+)\}/g, (match, name) => name in params ? String(params[name]) : match);
239
222
  }, [locale, fallback]);
240
223
  }
241
224
  //#endregion
242
- //#region ../../node_modules/.pnpm/markdown-to-jsx@7.7.17_react@18.3.1/node_modules/markdown-to-jsx/dist/index.module.js
243
- function n() {
244
- return n = Object.assign ? Object.assign.bind() : function(r) {
245
- for (var n = 1; n < arguments.length; n++) {
246
- var e = arguments[n];
247
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = e[t]);
248
- }
249
- return r;
250
- }, n.apply(this, arguments);
251
- }
252
- var e = ["children", "options"];
253
- var u = [
254
- "allowFullScreen",
255
- "allowTransparency",
256
- "autoComplete",
257
- "autoFocus",
258
- "autoPlay",
259
- "cellPadding",
260
- "cellSpacing",
261
- "charSet",
262
- "classId",
263
- "colSpan",
264
- "contentEditable",
265
- "contextMenu",
266
- "crossOrigin",
267
- "encType",
268
- "formAction",
269
- "formEncType",
270
- "formMethod",
271
- "formNoValidate",
272
- "formTarget",
273
- "frameBorder",
274
- "hrefLang",
275
- "inputMode",
276
- "keyParams",
277
- "keyType",
278
- "marginHeight",
279
- "marginWidth",
280
- "maxLength",
281
- "mediaGroup",
282
- "minLength",
283
- "noValidate",
284
- "radioGroup",
285
- "readOnly",
286
- "rowSpan",
287
- "spellCheck",
288
- "srcDoc",
289
- "srcLang",
290
- "srcSet",
291
- "tabIndex",
292
- "useMap"
293
- ].reduce(function(r, n) {
294
- return r[n.toLowerCase()] = n, r;
295
- }, {
296
- class: "className",
297
- for: "htmlFor"
298
- });
299
- var a = {
300
- amp: "&",
301
- apos: "'",
302
- gt: ">",
303
- lt: "<",
304
- nbsp: "\xA0",
305
- quot: "“"
306
- };
307
- var i = [
308
- "style",
309
- "script",
310
- "pre"
311
- ];
312
- var o = [
313
- "src",
314
- "href",
315
- "data",
316
- "formAction",
317
- "srcDoc",
318
- "action"
319
- ];
320
- var c = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi;
321
- var f = /\n{2,}$/;
322
- var l = /^(\s*>[\s\S]*?)(?=\n\n|$)/;
323
- var _ = /^ *> ?/gm;
324
- var d = /^(?:\[!([^\]]*)\]\n)?([\s\S]*)/;
325
- var s = /^ {2,}\n/;
326
- var v = /^(?:([-*_])( *\1){2,}) *(?:\n *)+\n/;
327
- var p = /^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/;
328
- var y = /^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/;
329
- var h = /^(`+)((?:\\`|(?!\1)`|[^`])+)\1/;
330
- var g = /^(?:\n *)*\n/;
331
- var m = /\r\n?/g;
332
- var k = /^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/;
333
- var x = /^\[\^([^\]]+)]/;
334
- var q = /\f/g;
335
- var b = /^---[ \t]*\n(.|\n)*\n---[ \t]*\n/;
336
- var S = /^\s*?\[(x|\s)\]/;
337
- var z = /^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
338
- var $ = /^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
339
- var E = /^([^\n]+)\n *(=|-)\2{2,} *\n/;
340
- var A = /^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i;
341
- var R = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi;
342
- var B = /^<!--[\s\S]*?(?:-->)/;
343
- var L = /^(data|aria|x)-[a-z_][a-z\d_.-]*$/;
344
- var O = /^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i;
345
- var j = /^\{.*\}$/;
346
- var C = /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/;
347
- var I = /^<([^ >]+[:@\/][^ >]+)>/;
348
- var T = /-([a-z])?/gi;
349
- var M = /^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/;
350
- var w = /^[^\n]+(?: \n|\n{2,})/;
351
- var D = /^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/;
352
- var F = /^!\[([^\]]*)\] ?\[([^\]]*)\]/;
353
- var P = /^\[([^\]]*)\] ?\[([^\]]*)\]/;
354
- var Z = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/;
355
- var N = /\t/g;
356
- var G = /(^ *\||\| *$)/g;
357
- var U = /^ *:-+: *$/;
358
- var V = /^ *:-+ *$/;
359
- var H = /^ *-+: *$/;
360
- var Q = function(r) {
361
- return "(?=[\\s\\S]+?\\1" + (r ? "\\1" : "") + ")";
362
- };
363
- var W = "((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)";
364
- var J = RegExp("^([*_])\\1" + Q(1) + W + "\\1\\1(?!\\1)");
365
- var K = RegExp("^([*_])" + Q(0) + W + "\\1(?!\\1)");
366
- var X = RegExp("^(==)" + Q(0) + W + "\\1");
367
- var Y = RegExp("^(~~)" + Q(0) + W + "\\1");
368
- var rr = /^(:[a-zA-Z0-9-_]+:)/;
369
- var nr = /^\\([^0-9A-Za-z\s])/;
370
- var er = /\\([^0-9A-Za-z\s])/g;
371
- var tr = /^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/;
372
- var ur = /^\n+/;
373
- var ar = /^([ \t]*)/;
374
- var ir = /(?:^|\n)( *)$/;
375
- var or = "(?:\\d+\\.)";
376
- var cr = "(?:[*+-])";
377
- function fr(r) {
378
- return "( *)(" + (1 === r ? or : cr) + ") +";
379
- }
380
- var lr = fr(1);
381
- var _r = fr(2);
382
- function dr(r) {
383
- return RegExp("^" + (1 === r ? lr : _r));
384
- }
385
- var sr = dr(1);
386
- var vr = dr(2);
387
- function pr(r) {
388
- return RegExp("^" + (1 === r ? lr : _r) + "[^\\n]*(?:\\n(?!\\1" + (1 === r ? or : cr) + " )[^\\n]*)*(\\n|$)", "gm");
389
- }
390
- var yr = pr(1);
391
- var hr = pr(2);
392
- function gr(r) {
393
- var n = 1 === r ? or : cr;
394
- return RegExp("^( *)(" + n + ") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1" + n + " (?!" + n + " ))\\n*|\\s*\\n*$)");
395
- }
396
- var mr = gr(1);
397
- var kr = gr(2);
398
- function xr(r, n) {
399
- var e = 1 === n, t = e ? mr : kr, u = e ? yr : hr, a = e ? sr : vr;
400
- return {
401
- t: function(r) {
402
- return a.test(r);
403
- },
404
- u: jr(function(r, n) {
405
- var e = ir.exec(n.prevCapture);
406
- return e && (n.list || !n.inline && !n.simple) ? t.exec(r = e[1] + r) : null;
407
- }),
408
- i: 1,
409
- o: function(r, n, t) {
410
- var i = e ? +r[2] : void 0, o = r[0].replace(f, "\n").match(u), c = !1;
411
- return {
412
- items: o.map(function(r, e) {
413
- var u = a.exec(r)[0].length, i = RegExp("^ {1," + u + "}", "gm"), f = r.replace(i, "").replace(a, ""), l = e === o.length - 1, _ = -1 !== f.indexOf("\n\n") || l && c;
414
- c = _;
415
- var d, s = t.inline, v = t.list;
416
- t.list = !0, _ ? (t.inline = !1, d = zr(f) + "\n\n") : (t.inline = !0, d = zr(f));
417
- var p = n(d, t);
418
- return t.inline = s, t.list = v, p;
419
- }),
420
- ordered: e,
421
- start: i
422
- };
423
- },
424
- l: function(n, e, t) {
425
- return r(n.ordered ? "ol" : "ul", {
426
- key: t.key,
427
- start: "20" === n.type ? n.start : void 0
428
- }, n.items.map(function(n, u) {
429
- return r("li", { key: u }, e(n, t));
430
- }));
431
- }
432
- };
433
- }
434
- var qr = RegExp("^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)");
435
- var br = /^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;
436
- function Sr(r) {
437
- return "string" == typeof r;
438
- }
439
- function zr(r) {
440
- for (var n = r.length; n > 0 && r[n - 1] <= " ";) n--;
441
- return r.slice(0, n);
442
- }
443
- function $r(r, n) {
444
- return r.startsWith(n);
445
- }
446
- function Er(r, n, e) {
447
- if (Array.isArray(e)) {
448
- for (var t = 0; t < e.length; t++) if ($r(r, e[t])) return !0;
449
- return !1;
450
- }
451
- return e(r, n);
452
- }
453
- function Ar(r) {
454
- return r.replace(/[ÀÁÂÃÄÅàáâãä忯]/g, "a").replace(/[çÇ]/g, "c").replace(/[ðÐ]/g, "d").replace(/[ÈÉÊËéèêë]/g, "e").replace(/[ÏïÎîÍíÌì]/g, "i").replace(/[Ññ]/g, "n").replace(/[øØœŒÕõÔôÓóÒò]/g, "o").replace(/[ÜüÛûÚúÙù]/g, "u").replace(/[ŸÿÝý]/g, "y").replace(/[^a-z0-9- ]/gi, "").replace(/ /gi, "-").toLowerCase();
455
- }
456
- function Rr(r) {
457
- return H.test(r) ? "right" : U.test(r) ? "center" : V.test(r) ? "left" : null;
458
- }
459
- function Br(r, n, e, t) {
460
- var u = e.inTable;
461
- e.inTable = !0;
462
- var a = [[]], i = "";
463
- function o() {
464
- if (i) {
465
- var r = a[a.length - 1];
466
- r.push.apply(r, n(i, e)), i = "";
467
- }
468
- }
469
- return r.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach(function(r, n, e) {
470
- "|" === r.trim() && (o(), t) ? 0 !== n && n !== e.length - 1 && a.push([]) : i += r;
471
- }), o(), e.inTable = u, a;
472
- }
473
- function Lr(r, n, e) {
474
- e.inline = !0;
475
- var t = r[2] ? r[2].replace(G, "").split("|").map(Rr) : [], u = r[3] ? function(r, n, e) {
476
- return r.trim().split("\n").map(function(r) {
477
- return Br(r, n, e, !0);
478
- });
479
- }(r[3], n, e) : [], a = Br(r[1], n, e, !!u.length);
480
- return e.inline = !1, u.length ? {
481
- align: t,
482
- cells: u,
483
- header: a,
484
- type: "25"
485
- } : {
486
- children: a,
487
- type: "21"
488
- };
489
- }
490
- function Or(r, n) {
491
- return null == r.align[n] ? {} : { textAlign: r.align[n] };
492
- }
493
- function jr(r) {
494
- return r.inline = 1, r;
495
- }
496
- function Cr(r) {
497
- return jr(function(n, e) {
498
- return e.inline ? r.exec(n) : null;
499
- });
500
- }
501
- function Ir(r) {
502
- return jr(function(n, e) {
503
- return e.inline || e.simple ? r.exec(n) : null;
504
- });
505
- }
506
- function Tr(r) {
507
- return function(n, e) {
508
- return e.inline || e.simple ? null : r.exec(n);
509
- };
510
- }
511
- function Mr(r) {
512
- return jr(function(n) {
513
- return r.exec(n);
514
- });
515
- }
516
- var wr = /(javascript|vbscript|data(?!:image)):/i;
517
- function Dr(r) {
518
- try {
519
- var n = decodeURIComponent(r).replace(/[^A-Za-z0-9/:]/g, "");
520
- if (wr.test(n)) return null;
521
- } catch (r) {
522
- return null;
523
- }
524
- return r;
525
- }
526
- function Fr(r) {
527
- return r ? r.replace(er, "$1") : r;
528
- }
529
- function Pr(r, n, e) {
530
- var t = e.inline || !1, u = e.simple || !1;
531
- e.inline = !0, e.simple = !0;
532
- var a = r(n, e);
533
- return e.inline = t, e.simple = u, a;
534
- }
535
- function Zr(r, n, e) {
536
- var t = e.inline || !1, u = e.simple || !1;
537
- e.inline = !1, e.simple = !0;
538
- var a = r(n, e);
539
- return e.inline = t, e.simple = u, a;
540
- }
541
- function Nr(r, n, e) {
542
- var t = e.inline || !1;
543
- e.inline = !1;
544
- var u = r(n, e);
545
- return e.inline = t, u;
546
- }
547
- var Gr = function(r, n, e) {
548
- return { children: Pr(n, r[2], e) };
549
- };
550
- function Ur() {
551
- return {};
552
- }
553
- function Vr() {
554
- return null;
555
- }
556
- function Hr() {
557
- return [].slice.call(arguments).filter(Boolean).join(" ");
558
- }
559
- function Qr(r, n, e) {
560
- for (var t = r, u = n.split("."); u.length && void 0 !== (t = t[u[0]]);) u.shift();
561
- return t || e;
562
- }
563
- function Wr(r, n) {
564
- var e = Qr(n, r);
565
- return e ? "function" == typeof e || "object" == typeof e && "render" in e ? e : Qr(n, r + ".component", r) : r;
566
- }
567
- function Jr(e, t) {
568
- var f;
569
- void 0 === e && (e = ""), void 0 === t && (t = {}), t.overrides = t.overrides || {}, t.namedCodesToUnicode = t.namedCodesToUnicode ? n({}, a, t.namedCodesToUnicode) : a;
570
- var G = t.slugify || Ar, U = t.sanitizer || Dr, V = t.createElement || react.createElement, H = [
571
- l,
572
- p,
573
- y,
574
- t.enforceAtxHeadings ? $ : z,
575
- E,
576
- M,
577
- mr,
578
- kr
579
- ], Q = [].concat(H, [
580
- w,
581
- A,
582
- B,
583
- O
584
- ]);
585
- function W(r, n) {
586
- for (var e = 0; e < r.length; e++) if (r[e].test(n)) return !0;
587
- return !1;
588
- }
589
- function er(r, e) {
590
- var u = Qr(t.overrides, r + ".props", {});
591
- return V.apply(void 0, [Wr(r, t.overrides), n({}, e, u, { className: Hr(null == e ? void 0 : e.className, u.className) || void 0 })].concat([].slice.call(arguments, 2)));
592
- }
593
- function ir(r) {
594
- r = r.replace(b, "");
595
- var n = !1;
596
- t.forceInline ? n = !0 : t.forceBlock || (n = !1 === Z.test(r));
597
- for (var e = dr(_r(n ? r : zr(r).replace(ur, "") + "\n\n", { inline: n })); Sr(e[e.length - 1]) && !e[e.length - 1].trim();) e.pop();
598
- if (null === t.wrapper) return e;
599
- var u, a = t.wrapper || (n ? "span" : "div");
600
- if (e.length > 1 || t.forceWrapper) u = e;
601
- else {
602
- if (1 === e.length) return "string" == typeof (u = e[0]) ? er("span", { key: "outer" }, u) : u;
603
- u = null;
604
- }
605
- return V(a, { key: "outer" }, u);
606
- }
607
- function or(r, n) {
608
- if (!n || !n.trim()) return null;
609
- var e = n.match(c);
610
- return e ? e.reduce(function(n, e) {
611
- var t = e.indexOf("=");
612
- if (-1 !== t) {
613
- var a = function(r) {
614
- return -1 !== r.indexOf("-") && null === r.match(L) && (r = r.replace(T, function(r, n) {
615
- return n.toUpperCase();
616
- })), r;
617
- }(e.slice(0, t)).trim(), i = function(r) {
618
- var n = r[0];
619
- return ("\"" === n || "'" === n) && r.length >= 2 && r[r.length - 1] === n ? r.slice(1, -1) : r;
620
- }(e.slice(t + 1).trim()), c = u[a] || a;
621
- if ("ref" === c) return n;
622
- var f = n[c] = function(r, n, e, t) {
623
- return "style" === n ? function(r) {
624
- var n = [], e = "", t = !1, u = !1, a = "";
625
- if (!r) return n;
626
- for (var i = 0; i < r.length; i++) {
627
- var o = r[i];
628
- if ("\"" !== o && "'" !== o || t || (u ? o === a && (u = !1, a = "") : (u = !0, a = o)), "(" === o && e.endsWith("url") ? t = !0 : ")" === o && t && (t = !1), ";" !== o || u || t) e += o;
629
- else {
630
- var c = e.trim();
631
- if (c) {
632
- var f = c.indexOf(":");
633
- if (f > 0) {
634
- var l = c.slice(0, f).trim(), _ = c.slice(f + 1).trim();
635
- n.push([l, _]);
636
- }
637
- }
638
- e = "";
639
- }
640
- }
641
- var d = e.trim();
642
- if (d) {
643
- var s = d.indexOf(":");
644
- if (s > 0) {
645
- var v = d.slice(0, s).trim(), p = d.slice(s + 1).trim();
646
- n.push([v, p]);
647
- }
648
- }
649
- return n;
650
- }(e).reduce(function(n, e) {
651
- var u = e[0], a = e[1];
652
- return n[u.replace(/(-[a-z])/g, function(r) {
653
- return r[1].toUpperCase();
654
- })] = t(a, r, u), n;
655
- }, {}) : -1 !== o.indexOf(n) ? t(Fr(e), r, n) : (e.match(j) && (e = Fr(e.slice(1, e.length - 1))), "true" === e || "false" !== e && e);
656
- }(r, a, i, U);
657
- "string" == typeof f && (A.test(f) || O.test(f)) && (n[c] = ir(f.trim()));
658
- } else "style" !== e && (n[u[e] || e] = !0);
659
- return n;
660
- }, {}) : null;
661
- }
662
- var cr = [], fr = {}, lr = ((f = {})[0] = {
663
- t: [">"],
664
- u: Tr(l),
665
- i: 1,
666
- o: function(r, n, e) {
667
- var t = r[0].replace(_, "").match(d);
668
- return {
669
- alert: t[1],
670
- children: n(t[2], e)
671
- };
672
- },
673
- l: function(r, n, e) {
674
- var t = { key: e.key };
675
- return r.alert && (t.className = "markdown-alert-" + G(r.alert.toLowerCase(), Ar), r.children.unshift({
676
- attrs: {},
677
- children: [{
678
- type: "27",
679
- text: r.alert
680
- }],
681
- noInnerParse: !0,
682
- type: "11",
683
- tag: "header"
684
- })), er("blockquote", t, n(r.children, e));
685
- }
686
- }, f[1] = {
687
- t: [" "],
688
- u: Mr(s),
689
- i: 1,
690
- o: Ur,
691
- l: function(r, n, e) {
692
- return er("br", { key: e.key });
693
- }
694
- }, f[2] = {
695
- t: [
696
- "--",
697
- "__",
698
- "**",
699
- "- ",
700
- "* ",
701
- "_ "
702
- ],
703
- u: Tr(v),
704
- i: 1,
705
- o: Ur,
706
- l: function(r, n, e) {
707
- return er("hr", { key: e.key });
708
- }
709
- }, f[3] = {
710
- t: [" "],
711
- u: Tr(y),
712
- i: 0,
713
- o: function(r) {
714
- return {
715
- lang: void 0,
716
- text: Fr(zr(r[0].replace(/^ {4}/gm, "")))
717
- };
718
- },
719
- l: function(r, e, t) {
720
- return er("pre", { key: t.key }, er("code", n({}, r.attrs, { className: r.lang ? "lang-" + r.lang : "" }), r.text));
721
- }
722
- }, f[4] = {
723
- t: ["```", "~~~"],
724
- u: Tr(p),
725
- i: 0,
726
- o: function(r) {
727
- return {
728
- attrs: or("code", r[3] || ""),
729
- lang: r[2] || void 0,
730
- text: r[4],
731
- type: "3"
732
- };
733
- }
734
- }, f[5] = {
735
- t: ["`"],
736
- u: Ir(h),
737
- i: 3,
738
- o: function(r) {
739
- return { text: Fr(r[2]) };
740
- },
741
- l: function(r, n, e) {
742
- return er("code", { key: e.key }, r.text);
743
- }
744
- }, f[6] = {
745
- t: ["[^"],
746
- u: Tr(k),
747
- i: 0,
748
- o: function(r) {
749
- return cr.push({
750
- footnote: r[2],
751
- identifier: r[1]
752
- }), {};
753
- },
754
- l: Vr
755
- }, f[7] = {
756
- t: ["[^"],
757
- u: Cr(x),
758
- i: 1,
759
- o: function(r) {
760
- return {
761
- target: "#" + G(r[1], Ar),
762
- text: r[1]
763
- };
764
- },
765
- l: function(r, n, e) {
766
- return er("a", {
767
- key: e.key,
768
- href: U(r.target, "a", "href")
769
- }, er("sup", { key: e.key }, r.text));
770
- }
771
- }, f[8] = {
772
- t: ["[ ]", "[x]"],
773
- u: Cr(S),
774
- i: 1,
775
- o: function(r) {
776
- return { completed: "x" === r[1].toLowerCase() };
777
- },
778
- l: function(r, n, e) {
779
- return er("input", {
780
- checked: r.completed,
781
- key: e.key,
782
- readOnly: !0,
783
- type: "checkbox"
784
- });
785
- }
786
- }, f[9] = {
787
- t: ["#"],
788
- u: Tr(t.enforceAtxHeadings ? $ : z),
789
- i: 1,
790
- o: function(r, n, e) {
791
- return {
792
- children: Pr(n, r[2], e),
793
- id: G(r[2], Ar),
794
- level: r[1].length
795
- };
796
- },
797
- l: function(r, n, e) {
798
- return er("h" + r.level, {
799
- id: r.id,
800
- key: e.key
801
- }, n(r.children, e));
802
- }
803
- }, f[10] = {
804
- t: function(r) {
805
- var n = r.indexOf("\n");
806
- return n > 0 && n < r.length - 1 && ("=" === r[n + 1] || "-" === r[n + 1]);
807
- },
808
- u: Tr(E),
809
- i: 1,
810
- o: function(r, n, e) {
811
- return {
812
- children: Pr(n, r[1], e),
813
- level: "=" === r[2] ? 1 : 2,
814
- type: "9"
815
- };
816
- }
817
- }, f[11] = {
818
- t: ["<"],
819
- u: Mr(A),
820
- i: 1,
821
- o: function(r, n, e) {
822
- var t = r[3].match(ar), u = RegExp("^" + t[1], "gm"), a = r[3].replace(u, ""), o = W(Q, a) ? Nr : Pr, c = r[1].toLowerCase(), f = -1 !== i.indexOf(c), l = (f ? c : r[1]).trim(), _ = {
823
- attrs: or(l, r[2]),
824
- noInnerParse: f,
825
- tag: l
826
- };
827
- if (e.inAnchor = e.inAnchor || "a" === c, f) _.text = r[3];
828
- else {
829
- var d = e.inHTML;
830
- e.inHTML = !0, _.children = o(n, a, e), e.inHTML = d;
831
- }
832
- return e.inAnchor = !1, _;
833
- },
834
- l: function(r, e, t) {
835
- return er(r.tag, n({ key: t.key }, r.attrs), r.text || (r.children ? e(r.children, t) : ""));
836
- }
837
- }, f[13] = {
838
- t: ["<"],
839
- u: Mr(O),
840
- i: 1,
841
- o: function(r) {
842
- var n = r[1].trim();
843
- return {
844
- attrs: or(n, r[2] || ""),
845
- tag: n
846
- };
847
- },
848
- l: function(r, e, t) {
849
- return er(r.tag, n({}, r.attrs, { key: t.key }));
850
- }
851
- }, f[12] = {
852
- t: ["<!--"],
853
- u: Mr(B),
854
- i: 1,
855
- o: function() {
856
- return {};
857
- },
858
- l: Vr
859
- }, f[14] = {
860
- t: ["!["],
861
- u: Ir(br),
862
- i: 1,
863
- o: function(r) {
864
- return {
865
- alt: Fr(r[1]),
866
- target: Fr(r[2]),
867
- title: Fr(r[3])
868
- };
869
- },
870
- l: function(r, n, e) {
871
- return er("img", {
872
- key: e.key,
873
- alt: r.alt || void 0,
874
- title: r.title || void 0,
875
- src: U(r.target, "img", "src")
876
- });
877
- }
878
- }, f[15] = {
879
- t: ["["],
880
- u: Cr(qr),
881
- i: 3,
882
- o: function(r, n, e) {
883
- return {
884
- children: Zr(n, r[1], e),
885
- target: Fr(r[2]),
886
- title: Fr(r[3])
887
- };
888
- },
889
- l: function(r, n, e) {
890
- return er("a", {
891
- key: e.key,
892
- href: U(r.target, "a", "href"),
893
- title: r.title
894
- }, n(r.children, e));
895
- }
896
- }, f[16] = {
897
- t: ["<"],
898
- u: Cr(I),
899
- i: 0,
900
- o: function(r) {
901
- var n = r[1], e = !1;
902
- return -1 !== n.indexOf("@") && -1 === n.indexOf("//") && (e = !0, n = n.replace("mailto:", "")), {
903
- children: [{
904
- text: n,
905
- type: "27"
906
- }],
907
- target: e ? "mailto:" + n : n,
908
- type: "15"
909
- };
910
- }
911
- }, f[17] = {
912
- t: function(r, n) {
913
- return !n.inAnchor && !t.disableAutoLink && ($r(r, "http://") || $r(r, "https://"));
914
- },
915
- u: Cr(C),
916
- i: 0,
917
- o: function(r) {
918
- return {
919
- children: [{
920
- text: r[1],
921
- type: "27"
922
- }],
923
- target: r[1],
924
- title: void 0,
925
- type: "15"
926
- };
927
- }
928
- }, f[20] = xr(er, 1), f[33] = xr(er, 2), f[19] = {
929
- t: ["\n"],
930
- u: Tr(g),
931
- i: 3,
932
- o: Ur,
933
- l: function() {
934
- return "\n";
935
- }
936
- }, f[21] = {
937
- u: jr(function(r, n) {
938
- if (n.inline || n.simple || n.inHTML && -1 === r.indexOf("\n\n") && -1 === n.prevCapture.indexOf("\n\n")) return null;
939
- for (var e = "", t = 0;;) {
940
- var u = r.indexOf("\n", t), a = r.slice(t, -1 === u ? void 0 : u + 1);
941
- if (W(H, a)) break;
942
- if (e += a, -1 === u || !a.trim()) break;
943
- t = u + 1;
944
- }
945
- var i = zr(e);
946
- return "" === i ? null : [
947
- e,
948
- ,
949
- i
950
- ];
951
- }),
952
- i: 3,
953
- o: Gr,
954
- l: function(r, n, e) {
955
- return er("p", { key: e.key }, n(r.children, e));
956
- }
957
- }, f[22] = {
958
- t: ["["],
959
- u: Cr(D),
960
- i: 0,
961
- o: function(r) {
962
- return fr[r[1]] = {
963
- target: r[2],
964
- title: r[4]
965
- }, {};
966
- },
967
- l: Vr
968
- }, f[23] = {
969
- t: ["!["],
970
- u: Ir(F),
971
- i: 0,
972
- o: function(r) {
973
- return {
974
- alt: r[1] ? Fr(r[1]) : void 0,
975
- ref: r[2]
976
- };
977
- },
978
- l: function(r, n, e) {
979
- return fr[r.ref] ? er("img", {
980
- key: e.key,
981
- alt: r.alt,
982
- src: U(fr[r.ref].target, "img", "src"),
983
- title: fr[r.ref].title
984
- }) : null;
985
- }
986
- }, f[24] = {
987
- t: function(r) {
988
- return "[" === r[0] && -1 === r.indexOf("](");
989
- },
990
- u: Cr(P),
991
- i: 0,
992
- o: function(r, n, e) {
993
- return {
994
- children: n(r[1], e),
995
- fallbackChildren: r[0],
996
- ref: r[2]
997
- };
998
- },
999
- l: function(r, n, e) {
1000
- return fr[r.ref] ? er("a", {
1001
- key: e.key,
1002
- href: U(fr[r.ref].target, "a", "href"),
1003
- title: fr[r.ref].title
1004
- }, n(r.children, e)) : er("span", { key: e.key }, r.fallbackChildren);
1005
- }
1006
- }, f[25] = {
1007
- t: ["|"],
1008
- u: Tr(M),
1009
- i: 1,
1010
- o: Lr,
1011
- l: function(r, n, e) {
1012
- var t = r;
1013
- return er("table", { key: e.key }, er("thead", null, er("tr", null, t.header.map(function(r, u) {
1014
- return er("th", {
1015
- key: u,
1016
- style: Or(t, u)
1017
- }, n(r, e));
1018
- }))), er("tbody", null, t.cells.map(function(r, u) {
1019
- return er("tr", { key: u }, r.map(function(r, u) {
1020
- return er("td", {
1021
- key: u,
1022
- style: Or(t, u)
1023
- }, n(r, e));
1024
- }));
1025
- })));
1026
- }
1027
- }, f[27] = {
1028
- u: jr(function(r, n) {
1029
- var e;
1030
- return $r(r, ":") && (e = rr.exec(r)), e || tr.exec(r);
1031
- }),
1032
- i: 4,
1033
- o: function(r) {
1034
- var n = r[0];
1035
- return { text: -1 === n.indexOf("&") ? n : n.replace(R, function(r, n) {
1036
- return t.namedCodesToUnicode[n] || r;
1037
- }) };
1038
- },
1039
- l: function(r) {
1040
- return r.text;
1041
- }
1042
- }, f[28] = {
1043
- t: ["**", "__"],
1044
- u: Ir(J),
1045
- i: 2,
1046
- o: function(r, n, e) {
1047
- return { children: n(r[2], e) };
1048
- },
1049
- l: function(r, n, e) {
1050
- return er("strong", { key: e.key }, n(r.children, e));
1051
- }
1052
- }, f[29] = {
1053
- t: function(r) {
1054
- var n = r[0];
1055
- return ("*" === n || "_" === n) && r[1] !== n;
1056
- },
1057
- u: Ir(K),
1058
- i: 3,
1059
- o: function(r, n, e) {
1060
- return { children: n(r[2], e) };
1061
- },
1062
- l: function(r, n, e) {
1063
- return er("em", { key: e.key }, n(r.children, e));
1064
- }
1065
- }, f[30] = {
1066
- t: ["\\"],
1067
- u: Ir(nr),
1068
- i: 1,
1069
- o: function(r) {
1070
- return {
1071
- text: r[1],
1072
- type: "27"
1073
- };
1074
- }
1075
- }, f[31] = {
1076
- t: ["=="],
1077
- u: Ir(X),
1078
- i: 3,
1079
- o: Gr,
1080
- l: function(r, n, e) {
1081
- return er("mark", { key: e.key }, n(r.children, e));
1082
- }
1083
- }, f[32] = {
1084
- t: ["~~"],
1085
- u: Ir(Y),
1086
- i: 3,
1087
- o: Gr,
1088
- l: function(r, n, e) {
1089
- return er("del", { key: e.key }, n(r.children, e));
1090
- }
1091
- }, f);
1092
- !0 === t.disableParsingRawHTML && (delete lr[11], delete lr[13]);
1093
- var _r = function(r) {
1094
- var n = Object.keys(r);
1095
- function e(t, u) {
1096
- var a = [];
1097
- if (u.prevCapture = u.prevCapture || "", t.trim()) for (; t;) for (var i = 0; i < n.length;) {
1098
- var o = n[i], c = r[o];
1099
- if (!c.t || Er(t, u, c.t)) {
1100
- var f = c.u(t, u);
1101
- if (f && f[0]) {
1102
- t = t.substring(f[0].length);
1103
- var l = c.o(f, e, u);
1104
- u.prevCapture += f[0], l.type || (l.type = o), a.push(l);
1105
- break;
1106
- }
1107
- i++;
1108
- } else i++;
1109
- }
1110
- return u.prevCapture = "", a;
1111
- }
1112
- return n.sort(function(n, e) {
1113
- return r[n].i - r[e].i || (n < e ? -1 : 1);
1114
- }), function(r, n) {
1115
- return e(function(r) {
1116
- return r.replace(m, "\n").replace(q, "").replace(N, " ");
1117
- }(r), n);
1118
- };
1119
- }(lr), dr = function(r, n) {
1120
- return function e(t, u) {
1121
- if (void 0 === u && (u = {}), Array.isArray(t)) {
1122
- for (var a = u.key, i = [], o = !1, c = 0; c < t.length; c++) {
1123
- u.key = c;
1124
- var f = e(t[c], u), l = Sr(f);
1125
- l && o ? i[i.length - 1] += f : null !== f && i.push(f), o = l;
1126
- }
1127
- return u.key = a, i;
1128
- }
1129
- return function(e, t, u) {
1130
- var a = r[e.type].l;
1131
- return n ? n(function() {
1132
- return a(e, t, u);
1133
- }, e, t, u) : a(e, t, u);
1134
- }(t, e, u);
1135
- };
1136
- }(lr, t.renderRule), sr = ir(e);
1137
- return cr.length ? er("div", null, sr, er("footer", { key: "footer" }, cr.map(function(r) {
1138
- return er("div", {
1139
- id: G(r.identifier, Ar),
1140
- key: r.identifier
1141
- }, r.identifier, dr(_r(r.footnote, { inline: !0 })));
1142
- }))) : sr;
1143
- }
1144
- function index_module_default(n) {
1145
- var t = n.children, u = n.options, a = function(r, n) {
1146
- if (null == r) return {};
1147
- var e, t, u = {}, a = Object.keys(r);
1148
- for (t = 0; t < a.length; t++) n.indexOf(e = a[t]) >= 0 || (u[e] = r[e]);
1149
- return u;
1150
- }(n, e);
1151
- return react.cloneElement(Jr(null == t ? "" : t, u), a);
1152
- }
1153
- //#endregion
1154
225
  //#region src/client/pages.tsx
1155
- const SAFE_LINK_PATTERN = /^(?:https?:|mailto:|#|\/)/iu;
1156
- function safeLink(href) {
1157
- if (href == null) return void 0;
1158
- const value = href.trim();
1159
- return SAFE_LINK_PATTERN.test(value) ? value : void 0;
226
+ const canRenderMarkdown = typeof _deepseek_ai_dsh_client_ui_primitives.MarkdownText === "function" || typeof _deepseek_ai_dsh_client_ui_primitives.MarkdownText === "object" && _deepseek_ai_dsh_client_ui_primitives.MarkdownText !== null;
227
+ const canRenderPathLabel = typeof _deepseek_ai_dsh_client_ui_primitives.PathLabel === "function" || typeof _deepseek_ai_dsh_client_ui_primitives.PathLabel === "object" && _deepseek_ai_dsh_client_ui_primitives.PathLabel !== null;
228
+ function PathText(props) {
229
+ return canRenderPathLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.PathLabel, { path: props.path }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: props.path });
1160
230
  }
1161
- /** Render managed Markdown without raw HTML and with a deliberately small link surface. */
231
+ /** Render managed Markdown through the official DSH Markdown pipeline without raw HTML or unsafe links. */
1162
232
  function DocumentMarkdown(props) {
233
+ const locale = (0, dsh_mnemon_client.useLocale)();
234
+ const labels = (0, react.useMemo)(() => {
235
+ const zh = locale.startsWith("zh");
236
+ return {
237
+ code: {
238
+ copyLabel: zh ? "复制" : "Copy",
239
+ copiedLabel: zh ? "已复制" : "Copied"
240
+ },
241
+ footnotes: zh ? "脚注" : "Footnotes"
242
+ };
243
+ }, [locale]);
1163
244
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1164
245
  className: css.markdownBody,
1165
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(index_module_default, {
1166
- options: {
1167
- disableParsingRawHTML: true,
1168
- forceBlock: true,
1169
- overrides: { a: { component: ({ href, children, ...rest }) => {
1170
- const target = safeLink(href);
1171
- return target === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
1172
- ...rest,
1173
- href: target,
1174
- target: target.startsWith("http") ? "_blank" : void 0,
1175
- rel: target.startsWith("http") ? "noreferrer noopener" : void 0,
1176
- children
1177
- });
1178
- } } }
1179
- },
1180
- children: props.content
1181
- })
246
+ children: canRenderMarkdown ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
247
+ text: props.content,
248
+ labels
249
+ }) : props.content
1182
250
  });
1183
251
  }
1184
252
  function DocumentsPage(props) {
@@ -1189,10 +257,12 @@ window.__ModuleLoader__.load({
1189
257
  const pageSize = 8;
1190
258
  const readerRef = (0, react.useRef)(null);
1191
259
  const [snapshot, setSnapshot] = (0, react.useState)(null);
260
+ const [loadedRevision, setLoadedRevision] = (0, react.useState)(props.revision);
1192
261
  const [items, setItems] = (0, react.useState)([]);
1193
262
  const [visibleLimit, setVisibleLimit] = (0, react.useState)(pageSize);
1194
263
  const [selectedId, setSelectedId] = (0, react.useState)(props.documentId ?? null);
1195
264
  const [selected, setSelected] = (0, react.useState)(null);
265
+ const [failedSelectedId, setFailedSelectedId] = (0, react.useState)(null);
1196
266
  const [status, setStatus] = (0, react.useState)("active");
1197
267
  const [query, setQuery] = (0, react.useState)("");
1198
268
  const [loading, setLoading] = (0, react.useState)(true);
@@ -1209,21 +279,83 @@ window.__ModuleLoader__.load({
1209
279
  const [content, setContent] = (0, react.useState)("");
1210
280
  const [sources, setSources] = (0, react.useState)("");
1211
281
  const displayRequests = (0, dsh_mnemon_client.useRequestVersion)();
1212
- const display = (0, react.useCallback)(async (nextQuery, nextStatus) => {
282
+ const snapshotRef = (0, react.useRef)(null);
283
+ snapshotRef.current = snapshot;
284
+ const selectedRef = (0, react.useRef)(null);
285
+ selectedRef.current = selected;
286
+ const revisionRef = (0, react.useRef)(props.revision);
287
+ revisionRef.current = props.revision;
288
+ const fetchedSignatureRef = (0, react.useRef)(null);
289
+ const queryRef = (0, react.useRef)(query);
290
+ queryRef.current = query;
291
+ const statusRef = (0, react.useRef)(status);
292
+ statusRef.current = status;
293
+ const activeSearchRef = (0, react.useRef)(false);
294
+ const adoptMutatedDocument = (0, react.useCallback)((candidate) => {
295
+ if (typeof candidate === "object" && candidate !== null && "content" in candidate && typeof candidate.content === "string") {
296
+ const view = candidate;
297
+ selectedRef.current = view;
298
+ if (view.fileRevision !== void 0 || props.client.deleteDocument === void 0) fetchedSignatureRef.current = `${revisionRef.current}:${view.id}:${view.revision}:${view.contentHash}`;
299
+ setSelected(view);
300
+ }
301
+ }, [props.client.deleteDocument]);
302
+ const display = (0, react.useCallback)(async (nextQuery, nextStatus, preferred, reloadIndex = false) => {
1213
303
  const request = displayRequests.begin();
304
+ activeSearchRef.current = nextQuery.trim() !== "";
1214
305
  setLoading(true);
1215
306
  setError(null);
1216
307
  setVisibleLimit(pageSize);
1217
308
  try {
1218
- const searched = nextQuery.trim() === "" ? void 0 : (await props.client.searchDocuments(nextQuery, nextStatus === "archived")).results;
1219
- const current = await props.client.documents();
1220
- const filtered = (searched ?? current.documents).filter((record) => record.status === nextStatus).sort((left, right) => Date.parse(right.createdAt) - Date.parse(left.createdAt));
309
+ let current;
310
+ let records;
311
+ if (nextQuery.trim() === "") {
312
+ current = await props.client.documents();
313
+ records = current.documents;
314
+ } else if (snapshotRef.current !== null && !reloadIndex) {
315
+ const existing = snapshotRef.current;
316
+ const searchResponse = await props.client.searchDocuments(nextQuery, nextStatus === "archived");
317
+ const byId = new Map(searchResponse.results.map((item) => [item.id, item]));
318
+ const mergedDocuments = existing.documents.map((document) => {
319
+ const hit = byId.get(document.id);
320
+ return hit === void 0 ? document : {
321
+ ...document,
322
+ ...hit,
323
+ healthy: document.healthy
324
+ };
325
+ });
326
+ for (const item of searchResponse.results) if (!existing.documents.some((document) => document.id === item.id)) mergedDocuments.push({
327
+ ...item,
328
+ healthy: true
329
+ });
330
+ current = {
331
+ ...existing,
332
+ ...typeof searchResponse.revision === "string" ? { revision: searchResponse.revision } : {},
333
+ documents: mergedDocuments
334
+ };
335
+ records = searchResponse.results;
336
+ } else {
337
+ const [searchResponse, loadedSnapshot] = await Promise.all([props.client.searchDocuments(nextQuery, nextStatus === "archived"), props.client.documents()]);
338
+ current = typeof searchResponse.revision === "string" ? {
339
+ ...loadedSnapshot,
340
+ revision: searchResponse.revision
341
+ } : loadedSnapshot;
342
+ records = searchResponse.results;
343
+ }
344
+ const filtered = records.filter((record) => record.status === nextStatus).sort((left, right) => Date.parse(right.createdAt) - Date.parse(left.createdAt));
1221
345
  if (!displayRequests.isCurrent(request)) return;
346
+ const refreshStamp = revisionRef.current;
347
+ snapshotRef.current = current;
1222
348
  setSnapshot(current);
349
+ setLoadedRevision(refreshStamp);
1223
350
  setItems(filtered);
1224
- setSelectedId((previous) => previous !== null && filtered.some((record) => record.id === previous) ? previous : filtered[0]?.id ?? null);
351
+ if (preferred?.document !== void 0 && filtered.some((record) => record.id === preferred.id)) adoptMutatedDocument(preferred.document);
352
+ setSelectedId((previous) => {
353
+ const candidate = preferred?.id ?? previous;
354
+ return candidate !== null && filtered.some((record) => record.id === candidate) ? candidate : filtered[0]?.id ?? null;
355
+ });
1225
356
  } catch (reason) {
1226
357
  if (!displayRequests.isCurrent(request)) return;
358
+ snapshotRef.current = null;
1227
359
  setError((0, dsh_mnemon_client.message)(reason));
1228
360
  setSnapshot(null);
1229
361
  setItems([]);
@@ -1232,30 +364,46 @@ window.__ModuleLoader__.load({
1232
364
  if (displayRequests.isCurrent(request)) setLoading(false);
1233
365
  }
1234
366
  }, [
367
+ adoptMutatedDocument,
1235
368
  displayRequests,
1236
369
  pageSize,
1237
370
  props.client
1238
371
  ]);
1239
372
  (0, react.useEffect)(() => {
1240
- display(query, status);
1241
- }, [
1242
- display,
1243
- props.revision,
1244
- status
1245
- ]);
373
+ display(queryRef.current, statusRef.current, void 0, true);
374
+ }, [display, props.revision]);
1246
375
  (0, react.useEffect)(() => {
1247
- setSelected(null);
1248
- if (selectedId === null || !snapshot?.documents.some((document) => document.id === selectedId)) return;
376
+ if (selectedId === null) {
377
+ setSelected(null);
378
+ return;
379
+ }
380
+ if (snapshot === null) return;
381
+ const record = snapshot.documents.find((document) => document.id === selectedId);
382
+ if (record === void 0) {
383
+ setSelected(null);
384
+ return;
385
+ }
386
+ const currentSelected = selectedRef.current;
387
+ const recordSignature = `${loadedRevision}:${record.id}:${record.revision}:${record.contentHash}`;
388
+ if (currentSelected !== null && currentSelected.id === record.id && fetchedSignatureRef.current === recordSignature && currentSelected.revision === record.revision && currentSelected.contentHash === record.contentHash && currentSelected.updatedAt === record.updatedAt && currentSelected.status === record.status && currentSelected.title === record.title && currentSelected.description === record.description) return;
1249
389
  let active = true;
390
+ const requestRevision = loadedRevision;
391
+ setFailedSelectedId(null);
1250
392
  props.client.document(selectedId).then((value) => {
1251
- if (active) setSelected(value);
393
+ if (!active) return;
394
+ fetchedSignatureRef.current = `${requestRevision}:${value.id}:${value.revision}:${value.contentHash}`;
395
+ selectedRef.current = value;
396
+ setSelected(value);
1252
397
  }).catch((reason) => {
1253
- if (active) setError((0, dsh_mnemon_client.message)(reason));
398
+ if (!active) return;
399
+ setFailedSelectedId(selectedId);
400
+ setError((0, dsh_mnemon_client.message)(reason));
1254
401
  });
1255
402
  return () => {
1256
403
  active = false;
1257
404
  };
1258
405
  }, [
406
+ loadedRevision,
1259
407
  props.client,
1260
408
  selectedId,
1261
409
  snapshot
@@ -1289,6 +437,11 @@ window.__ModuleLoader__.load({
1289
437
  setComposing(true);
1290
438
  };
1291
439
  const sourcePaths = (value) => value.split(/\r?\n|,/gu).map((path) => path.trim()).filter(Boolean);
440
+ const changeStatus = (nextStatus) => {
441
+ if (status === nextStatus) return;
442
+ setStatus(nextStatus);
443
+ display(query, nextStatus);
444
+ };
1292
445
  const create = async (event) => {
1293
446
  event.preventDefault();
1294
447
  setSaving(true);
@@ -1306,35 +459,39 @@ window.__ModuleLoader__.load({
1306
459
  setStatus("active");
1307
460
  setQuery("");
1308
461
  resetComposer();
1309
- props.onMutate();
1310
- await display("", "active");
1311
- setSelectedId(result.document.id);
462
+ await display("", "active", {
463
+ id: result.document.id,
464
+ document: result.document
465
+ });
466
+ props.onMutate?.();
1312
467
  } catch (reason) {
1313
468
  setError((0, dsh_mnemon_client.message)(reason));
1314
469
  } finally {
1315
470
  setSaving(false);
1316
471
  }
1317
472
  };
473
+ const activeSelected = selected !== null && selected.id === selectedId ? selected : null;
474
+ const loadingSelected = selectedId !== null && failedSelectedId !== selectedId && (selected === null || selected.id !== selectedId) && items.some((item) => item.id === selectedId);
1318
475
  const beginEdit = () => {
1319
- if (selected === null) return;
1320
- setTitle(selected.title);
1321
- setDescription(selected.description);
1322
- setContent(selected.content);
1323
- setSources(selected.sourcePaths.join("\n"));
476
+ if (activeSelected === null) return;
477
+ setTitle(activeSelected.title);
478
+ setDescription(activeSelected.description);
479
+ setContent(activeSelected.content);
480
+ setSources(activeSelected.sourcePaths.join("\n"));
1324
481
  setEditing(true);
1325
482
  setComposing(false);
1326
483
  setConfirmArchive(false);
1327
484
  };
1328
485
  const update = async (event) => {
1329
486
  event.preventDefault();
1330
- if (selected === null) return;
487
+ if (activeSelected === null) return;
1331
488
  setSaving(true);
1332
489
  setError(null);
1333
490
  setNotice(null);
1334
491
  try {
1335
492
  const result = await props.client.mutateDocument({
1336
493
  action: "update",
1337
- id: selected.id,
494
+ id: activeSelected.id,
1338
495
  title,
1339
496
  description,
1340
497
  content,
@@ -1342,9 +499,11 @@ window.__ModuleLoader__.load({
1342
499
  });
1343
500
  setNotice(result.maintenance === void 0 ? t("documents.updated") : t("documents.updatedAfterArchive", { count: result.maintenance.archivedDocumentIds.length }));
1344
501
  setEditing(false);
1345
- props.onMutate();
1346
- await display(query, status);
1347
- setSelectedId(result.document.id);
502
+ await display(query, status, {
503
+ id: result.document.id,
504
+ document: result.document
505
+ });
506
+ props.onMutate?.();
1348
507
  } catch (reason) {
1349
508
  setError((0, dsh_mnemon_client.message)(reason));
1350
509
  } finally {
@@ -1352,20 +511,22 @@ window.__ModuleLoader__.load({
1352
511
  }
1353
512
  };
1354
513
  const archive = async () => {
1355
- if (selected === null) return;
514
+ if (activeSelected === null) return;
1356
515
  setSaving(true);
1357
516
  setError(null);
1358
517
  setNotice(null);
1359
518
  try {
1360
- const result = await props.client.archiveDocument(selected.id);
519
+ const result = await props.client.archiveDocument(activeSelected.id);
1361
520
  const spaces = result.maintenance?.memoryBodyIds ?? [];
1362
521
  setNotice(spaces.length === 0 ? t("documents.archivedLocally") : t("documents.archived", { spaces: spaces.join(", ") }));
1363
522
  setConfirmArchive(false);
1364
523
  setStatus("archived");
1365
524
  setQuery("");
1366
- props.onMutate();
1367
- await display("", "archived");
1368
- setSelectedId(result.document.id);
525
+ await display("", "archived", {
526
+ id: result.document.id,
527
+ document: result.document
528
+ });
529
+ props.onMutate?.();
1369
530
  } catch (reason) {
1370
531
  setError((0, dsh_mnemon_client.message)(reason));
1371
532
  } finally {
@@ -1384,8 +545,8 @@ window.__ModuleLoader__.load({
1384
545
  setSelected(null);
1385
546
  setSelectedId(null);
1386
547
  setNotice(t("documents.deleted"));
1387
- props.onMutate();
1388
548
  await display(query, status);
549
+ props.onMutate?.();
1389
550
  } catch (reason) {
1390
551
  setDeleteError((0, dsh_mnemon_client.message)(reason));
1391
552
  } finally {
@@ -1395,8 +556,8 @@ window.__ModuleLoader__.load({
1395
556
  const usage = snapshot === null ? 0 : Math.min(100, snapshot.activeBytes / snapshot.limitBytes * 100);
1396
557
  const activeCount = snapshot?.activeCount ?? 0;
1397
558
  const archivedCount = snapshot?.archivedCount ?? 0;
1398
- const selectedRecord = snapshot?.documents.find((document) => document.id === selected?.id);
1399
- const selectedIsCurrent = selected?.fileRevision !== void 0 && selectedRecord?.revision === selected.revision && selectedRecord.contentHash === selected.contentHash && selectedRecord.status === selected.status;
559
+ const selectedRecord = snapshot?.documents.find((document) => document.id === activeSelected?.id);
560
+ const selectedIsCurrent = activeSelected?.fileRevision !== void 0 && selectedRecord?.revision === activeSelected.revision && selectedRecord.contentHash === activeSelected.contentHash && selectedRecord.status === activeSelected.status;
1400
561
  const composer = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1401
562
  id: documentCreateFormId,
1402
563
  className: css.documentEditor,
@@ -1427,12 +588,12 @@ window.__ModuleLoader__.load({
1427
588
  })] })
1428
589
  ]
1429
590
  });
1430
- const editComposer = selected === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
591
+ const editComposer = activeSelected === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
1431
592
  id: documentEditFormId,
1432
593
  className: css.documentEditor,
1433
594
  onSubmit: (event) => void update(event),
1434
595
  children: [
1435
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("documents.editTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("documents.editorHint") })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: selected.id })] }),
596
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("documents.editTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("documents.editorHint") })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: activeSelected.id })] }),
1436
597
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1437
598
  className: css.documentEditorMeta,
1438
599
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", { children: [t("documents.name"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
@@ -1462,6 +623,7 @@ window.__ModuleLoader__.load({
1462
623
  const selectDocument = (documentId) => {
1463
624
  if (selectedId === documentId) return;
1464
625
  setSelected(null);
626
+ setFailedSelectedId(null);
1465
627
  setSelectedId(documentId);
1466
628
  setEditing(false);
1467
629
  setConfirmArchive(false);
@@ -1484,16 +646,16 @@ window.__ModuleLoader__.load({
1484
646
  children: t("documents.new")
1485
647
  }) } : {}
1486
648
  }),
1487
- error !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
649
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.Reveal, { children: error === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1488
650
  className: css.inlineError,
1489
651
  role: "alert",
1490
652
  children: error
1491
- }),
1492
- notice !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
653
+ }) }),
654
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.Reveal, { children: notice === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1493
655
  className: css.runtimeNotice,
1494
656
  role: "status",
1495
657
  children: notice
1496
- }),
658
+ }) }),
1497
659
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1498
660
  className: css.documentSummary,
1499
661
  "aria-label": t("documents.summary"),
@@ -1530,7 +692,12 @@ window.__ModuleLoader__.load({
1530
692
  className: css.documentSearch,
1531
693
  label: t("documents.searchAria"),
1532
694
  value: query,
1533
- onChange: (event) => setQuery(event.target.value),
695
+ onChange: (event) => {
696
+ const next = event.target.value;
697
+ const hadQuery = query.trim() !== "";
698
+ setQuery(next);
699
+ if (hadQuery && next === "" && activeSearchRef.current) display("", status);
700
+ },
1534
701
  placeholder: t("documents.searchPlaceholder")
1535
702
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1536
703
  type: "submit",
@@ -1540,10 +707,14 @@ window.__ModuleLoader__.load({
1540
707
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1541
708
  role: "group",
1542
709
  "aria-label": t("documents.scope"),
710
+ style: {
711
+ "--dsh-segment-count": 2,
712
+ "--dsh-segment-index": status === "active" ? 0 : 1
713
+ },
1543
714
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1544
715
  type: "button",
1545
716
  "data-active": status === "active" || void 0,
1546
- onClick: () => setStatus("active"),
717
+ onClick: () => changeStatus("active"),
1547
718
  children: [
1548
719
  t("documents.active"),
1549
720
  " ",
@@ -1552,7 +723,7 @@ window.__ModuleLoader__.load({
1552
723
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1553
724
  type: "button",
1554
725
  "data-active": status === "archived" || void 0,
1555
- onClick: () => setStatus("archived"),
726
+ onClick: () => changeStatus("archived"),
1556
727
  children: [
1557
728
  t("documents.archivedCount"),
1558
729
  " ",
@@ -1607,20 +778,16 @@ window.__ModuleLoader__.load({
1607
778
  className: css.documentReader,
1608
779
  "aria-label": t("documents.reader"),
1609
780
  "data-scroll-region": "",
1610
- children: selected === null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.EmptyState, {
1611
- glyph: "▤",
1612
- title: t("documents.selectTitle"),
1613
- children: t("documents.selectText")
1614
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
781
+ children: activeSelected !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
1615
782
  className: css.documentDetail,
1616
783
  children: [
1617
784
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
1618
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: selected.status === "active" ? t("documents.active") : t("documents.coldArchive") }),
1619
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: selected.title }),
1620
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: selected.description || t("documents.noDescription") })
785
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: activeSelected.status === "active" ? t("documents.active") : t("documents.coldArchive") }),
786
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: activeSelected.title }),
787
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: activeSelected.description || t("documents.noDescription") })
1621
788
  ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1622
789
  className: css.documentActions,
1623
- children: [props.writeEnabled && selected.status === "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
790
+ children: [props.writeEnabled && activeSelected.status === "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1624
791
  type: "button",
1625
792
  className: documentEditActionClass,
1626
793
  onClick: beginEdit,
@@ -1632,7 +799,7 @@ window.__ModuleLoader__.load({
1632
799
  onClick: () => {
1633
800
  setDeleteError(null);
1634
801
  setDeleteTarget({
1635
- document: selected,
802
+ document: activeSelected,
1636
803
  revision: snapshot.revision
1637
804
  });
1638
805
  },
@@ -1640,25 +807,25 @@ window.__ModuleLoader__.load({
1640
807
  })]
1641
808
  })] }),
1642
809
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", { children: [
1643
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.path") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: selected.relativePath }) })] }),
1644
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.revision") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: selected.revision })] }),
1645
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.hash") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: selected.contentHash.slice(0, 16) }) })] }),
1646
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.size") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: (0, dsh_mnemon_client.humanBytes)(selected.sizeBytes) })] })
810
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.path") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PathText, { path: activeSelected.relativePath }) }) })] }),
811
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.revision") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: activeSelected.revision })] }),
812
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.hash") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: activeSelected.contentHash.slice(0, 16) }) })] }),
813
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: t("documents.size") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: (0, dsh_mnemon_client.humanBytes)(activeSelected.sizeBytes) })] })
1647
814
  ] }),
1648
- selected.sourcePaths.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
815
+ activeSelected.sourcePaths.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1649
816
  className: css.documentSources,
1650
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("documents.sources") }), selected.sourcePaths.map((path) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: path }, path))]
817
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("documents.sources") }), activeSelected.sourcePaths.map((path) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PathText, { path }) }, path))]
1651
818
  }),
1652
- selected.status === "archived" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
819
+ activeSelected.status === "archived" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1653
820
  className: css.documentArchiveReceipt,
1654
821
  children: [
1655
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t(selected.memoryBodyIds.length === 0 ? "documents.archiveNote" : "documents.archiveReceipt") }),
1656
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: selected.archiveSummary }),
1657
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: selected.memoryBodyIds.map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: id }, id)) })
822
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t(activeSelected.memoryBodyIds.length === 0 ? "documents.archiveNote" : "documents.archiveReceipt") }),
823
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: activeSelected.archiveSummary }),
824
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: activeSelected.memoryBodyIds.map((id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: id }, id)) })
1658
825
  ]
1659
826
  }),
1660
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocumentMarkdown, { content: selected.content }),
1661
- props.writeEnabled && selected.status === "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", {
827
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocumentMarkdown, { content: activeSelected.content }),
828
+ props.writeEnabled && activeSelected.status === "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("footer", {
1662
829
  className: css.documentDanger,
1663
830
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("documents.archiveTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("documents.archiveDescription") })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1664
831
  type: "button",
@@ -1668,13 +835,16 @@ window.__ModuleLoader__.load({
1668
835
  })] })
1669
836
  })
1670
837
  ]
838
+ }) : loadingSelected || loading && items.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
839
+ className: css.loading,
840
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.SectionSpinner, { label: t("common.loading") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("common.loading") })]
841
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.EmptyState, {
842
+ glyph: "▤",
843
+ title: t("documents.selectTitle"),
844
+ children: t("documents.selectText")
1671
845
  })
1672
846
  })]
1673
847
  }),
1674
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1675
- className: css.runtimeFootnote,
1676
- children: t("documents.footnote")
1677
- }),
1678
848
  composing && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.SidebarModal, {
1679
849
  title: t("documents.newTitle"),
1680
850
  description: t("documents.editorHint"),
@@ -1699,9 +869,9 @@ window.__ModuleLoader__.load({
1699
869
  }),
1700
870
  children: composer
1701
871
  }),
1702
- editing && selected !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.SidebarModal, {
872
+ editing && activeSelected !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.SidebarModal, {
1703
873
  title: t("documents.editTitle"),
1704
- description: selected.title,
874
+ description: activeSelected.title,
1705
875
  busy: saving,
1706
876
  onClose: () => setEditing(false),
1707
877
  footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -1723,9 +893,9 @@ window.__ModuleLoader__.load({
1723
893
  }),
1724
894
  children: editComposer
1725
895
  }),
1726
- confirmArchive && selected !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.SidebarModal, {
896
+ confirmArchive && activeSelected !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(dsh_mnemon_client.SidebarModal, {
1727
897
  title: t("documents.archiveConfirm"),
1728
- description: selected.title,
898
+ description: activeSelected.title,
1729
899
  busy: saving,
1730
900
  onClose: () => setConfirmArchive(false),
1731
901
  footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -1750,10 +920,10 @@ window.__ModuleLoader__.load({
1750
920
  className: css.bodyDeleteConfirm,
1751
921
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("documents.archiveDescription") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1752
922
  className: css.bodyDeleteSummary,
1753
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: selected.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
1754
- selected.relativePath,
923
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: activeSelected.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
924
+ activeSelected.relativePath,
1755
925
  " · ",
1756
- (0, dsh_mnemon_client.humanBytes)(selected.sizeBytes)
926
+ (0, dsh_mnemon_client.humanBytes)(activeSelected.sizeBytes)
1757
927
  ] })]
1758
928
  })]
1759
929
  })
@@ -1807,15 +977,30 @@ window.__ModuleLoader__.load({
1807
977
  //#endregion
1808
978
  //#region src/client/ui.tsx
1809
979
  function documentsPageClient(management) {
1810
- const client = (0, dsh_mnemon_client.createMemorySourcePageClient)(management);
980
+ let latestRevision = management.revision;
981
+ const tracked = {
982
+ ...management,
983
+ read: async (operation, input, options) => {
984
+ const response = await management.read(operation, input, options);
985
+ if (typeof response.revision === "string") latestRevision = response.revision;
986
+ return response;
987
+ }
988
+ };
989
+ const client = (0, dsh_mnemon_client.createMemorySourcePageClient)(tracked);
1811
990
  return {
1812
991
  documents: () => client.read("snapshot", null, { coalesce: true }),
1813
992
  document: (id) => client.read("document", { id }),
1814
- searchDocuments: (query, includeArchived = false, limit = 50) => client.read("search", {
1815
- query,
1816
- includeArchived,
1817
- limit
1818
- }),
993
+ searchDocuments: async (query, includeArchived = false, limit = 50) => {
994
+ const result = await client.read("search", {
995
+ query,
996
+ includeArchived,
997
+ limit
998
+ });
999
+ return latestRevision === void 0 ? result : {
1000
+ ...result,
1001
+ revision: latestRevision
1002
+ };
1003
+ },
1819
1004
  mutateDocument: (input) => input.action === "delete" ? client.mutate("delete", {
1820
1005
  id: input.id,
1821
1006
  ...input.fileRevision === void 0 ? {} : { fileRevision: input.fileRevision }
@@ -1833,12 +1018,25 @@ window.__ModuleLoader__.load({
1833
1018
  function DocumentsSourceView(props) {
1834
1019
  const client = (0, react.useMemo)(() => props.management === void 0 ? void 0 : documentsPageClient(props.management), [props.management]);
1835
1020
  const [revision, setRevision] = (0, react.useState)(0);
1836
- const refreshKey = (0, react.useRef)(props.refreshKey);
1021
+ const lastRefreshKey = (0, react.useRef)(props.refreshKey);
1022
+ const suppressRefreshEcho = (0, react.useRef)(false);
1837
1023
  (0, react.useEffect)(() => {
1838
- if (refreshKey.current === props.refreshKey) return;
1839
- refreshKey.current = props.refreshKey;
1024
+ if (lastRefreshKey.current === props.refreshKey) return;
1025
+ lastRefreshKey.current = props.refreshKey;
1026
+ if (suppressRefreshEcho.current) {
1027
+ suppressRefreshEcho.current = false;
1028
+ return;
1029
+ }
1840
1030
  setRevision((value) => value + 1);
1841
1031
  }, [props.refreshKey]);
1032
+ const handleMutate = (0, react.useCallback)(() => {
1033
+ if (props.onRefresh === void 0) return;
1034
+ suppressRefreshEcho.current = true;
1035
+ props.onRefresh();
1036
+ setTimeout(() => {
1037
+ suppressRefreshEcho.current = false;
1038
+ }, 0);
1039
+ }, [props.onRefresh]);
1842
1040
  if (client === void 0) return null;
1843
1041
  const navigation = props.navigationInput;
1844
1042
  const focus = typeof navigation === "object" && navigation !== null && !Array.isArray(navigation) && typeof navigation.seed === "string" && navigation.seed !== "" ? navigation : void 0;
@@ -1848,10 +1046,7 @@ window.__ModuleLoader__.load({
1848
1046
  client,
1849
1047
  revision,
1850
1048
  writeEnabled: props.writable === true,
1851
- onMutate: () => {
1852
- setRevision((value) => value + 1);
1853
- props.onRefresh?.();
1854
- }
1049
+ onMutate: handleMutate
1855
1050
  }, typeof focus?.nonce === "number" ? focus.nonce : 0);
1856
1051
  }
1857
1052
  function DocumentsSourcePage(props) {