@fgbg/mdocs 0.8.21 → 0.8.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/agent-skills/changelog/SKILL.md +17 -1
- package/agent-skills/index.json +1 -1
- package/bin/mdocs.js +1 -1
- package/dist/server/cli/main.js +22 -1
- package/dist/server/cli/main.js.map +1 -1
- package/dist/server/cli/self-update.js +4 -0
- package/dist/server/cli/self-update.js.map +1 -1
- package/dist/server/documents/tree-and-folders.test.js +54 -3
- package/dist/server/documents/tree-and-folders.test.js.map +1 -1
- package/dist/server/documents/tree.service.js +66 -5
- package/dist/server/documents/tree.service.js.map +1 -1
- package/dist/server/routes/documents.routes.js +16 -0
- package/dist/server/routes/documents.routes.js.map +1 -1
- package/dist/web/assets/{AgentChatPanel-D95hI02c.js → AgentChatPanel-CtdLYtSw.js} +1 -1
- package/dist/web/assets/{AgentSkillFormCard-BtJ0QjLG.js → AgentSkillFormCard-DeZnOTQg.js} +2 -2
- package/dist/web/assets/AiWriteWorkbench-hUYjin2m.js +7 -0
- package/dist/web/assets/DiagramEditor-NtNY3sZL-C9hL71kf.js +2 -0
- package/dist/web/assets/DocumentEditor-BmmnuieO.js +21 -0
- package/dist/web/assets/{MergeView-DgFQHD5_.js → MergeView-CjhCBNPa.js} +1 -1
- package/dist/web/assets/{PlaygroundPage-Dg57Xxpl.js → PlaygroundPage-CgaNgQEp.js} +1 -1
- package/dist/web/assets/SettingsPage-Fl5Tu7u3.js +1 -0
- package/dist/web/assets/{Toolbar-0Y2wmGwe.js → Toolbar-BaKuyXey.js} +1 -1
- package/dist/web/assets/{VisitorPickerModal-COxtOvc4.js → VisitorPickerModal-DPyg6mIt.js} +1 -1
- package/dist/web/assets/{copy-nOl0d3Th.js → copy-UkvgEfIg.js} +1 -1
- package/dist/web/assets/diagram-BLCqfrbF.js +6257 -0
- package/dist/web/assets/index-Ct5Vt4tz.js +185 -0
- package/dist/web/assets/index-Dt_PAYaR.css +1 -0
- package/dist/web/assets/meta2d-D3b5RRN8.js +110 -0
- package/dist/web/assets/{meta2dEngine-BD2XbzaV-e28q005B.js → meta2dEngine-BD2XbzaV-2ovN6JHu.js} +1 -1
- package/dist/web/assets/{motion-D-I76zAi.js → motion-Bz_inm1R.js} +1 -1
- package/dist/web/assets/{plus-DvBbg6jL.js → plus-B-uEAM2g.js} +1 -1
- package/dist/web/assets/react-6CQL39Gs.js +2382 -0
- package/dist/web/assets/react-vendor-BJFXgntS.js +242 -0
- package/dist/web/assets/{ui-C3xtW1w8.js → ui-TwLH91RV.js} +133 -133
- package/dist/web/index.html +5 -5
- package/package.json +2 -2
- package/dist/web/assets/AiWriteWorkbench-Qam8cfY6.js +0 -6
- package/dist/web/assets/DiagramEditor-BTRe45TX-Did98cnP.js +0 -2
- package/dist/web/assets/DocumentEditor-DtSzkl6A.js +0 -21
- package/dist/web/assets/SettingsPage-CkYpe5v7.js +0 -1
- package/dist/web/assets/diagram-BJFhx-27.js +0 -3016
- package/dist/web/assets/index-B-XJ-ScV.js +0 -185
- package/dist/web/assets/index-CGvsjO9f.css +0 -1
- package/dist/web/assets/meta2d-C8Z4cn-d.js +0 -110
- package/dist/web/assets/react-BsVOIHR8.js +0 -2126
- package/dist/web/assets/react-vendor-BNpqFP9B.js +0 -242
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocumentEditor-BmmnuieO.js","assets/react-vendor-BJFXgntS.js","assets/ui-TwLH91RV.js","assets/motion-Bz_inm1R.js","assets/react-6CQL39Gs.js","assets/editor-ONzd_YnO.js","assets/diagram-BLCqfrbF.js","assets/plus-B-uEAM2g.js","assets/copy-UkvgEfIg.js","assets/Toolbar-BaKuyXey.js","assets/VisitorPickerModal-DPyg6mIt.js","assets/SettingsPage-Fl5Tu7u3.js","assets/AgentChatPanel-CtdLYtSw.js","assets/AgentSkillFormCard-DeZnOTQg.js","assets/AiWriteWorkbench-hUYjin2m.js","assets/MergeView-CjhCBNPa.js","assets/PlaygroundPage-CgaNgQEp.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Kn=Object.defineProperty;var Xn=(e,t,i)=>t in e?Kn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Ie=(e,t,i)=>Xn(e,typeof t!="symbol"?t+"":t,i);import{r as a,j as n,_ as Ce,a9 as Qn,aa as Zn,ab as eo,ac as at,c as to,R as no,ad as oo}from"./react-vendor-BJFXgntS.js";import{t as io,T as ro}from"./ui-TwLH91RV.js";import{f as ao}from"./motion-Bz_inm1R.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const d of s)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function i(s){const d={};return s.integrity&&(d.integrity=s.integrity),s.referrerPolicy&&(d.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?d.credentials="include":s.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(s){if(s.ep)return;s.ep=!0;const d=i(s);fetch(s.href,d)}})();/**
|
|
3
|
+
* @license lucide-react v0.562.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const so=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),co=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,i,r)=>r?r.toUpperCase():i.toLowerCase()),Bt=e=>{const t=co(e);return t.charAt(0).toUpperCase()+t.slice(1)},dn=(...e)=>e.filter((t,i,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===i).join(" ").trim(),lo=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
8
|
+
* @license lucide-react v0.562.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/var mo={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
13
|
+
* @license lucide-react v0.562.0 - ISC
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the ISC license.
|
|
16
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/const uo=a.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:i=2,absoluteStrokeWidth:r,className:s="",children:d,iconNode:u,...c},g)=>a.createElement("svg",{ref:g,...mo,width:t,height:t,stroke:e,strokeWidth:r?Number(i)*24/Number(t):i,className:dn("lucide",s),...!d&&!lo(c)&&{"aria-hidden":"true"},...c},[...u.map(([m,y])=>a.createElement(m,y)),...Array.isArray(d)?d:[d]]));/**
|
|
18
|
+
* @license lucide-react v0.562.0 - ISC
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the ISC license.
|
|
21
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/const de=(e,t)=>{const i=a.forwardRef(({className:r,...s},d)=>a.createElement(uo,{ref:d,iconNode:t,className:dn(`lucide-${so(Bt(e))}`,`lucide-${e}`,r),...s}));return i.displayName=Bt(e),i};/**
|
|
23
|
+
* @license lucide-react v0.562.0 - ISC
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the ISC license.
|
|
26
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/const fo=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],po=de("book-open",fo);/**
|
|
28
|
+
* @license lucide-react v0.562.0 - ISC
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the ISC license.
|
|
31
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
+
*/const ho=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],$t=de("file",ho);/**
|
|
33
|
+
* @license lucide-react v0.562.0 - ISC
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the ISC license.
|
|
36
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/const go=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ht=de("folder",go);/**
|
|
38
|
+
* @license lucide-react v0.562.0 - ISC
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the ISC license.
|
|
41
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/const yo=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],vo=de("log-out",yo);/**
|
|
43
|
+
* @license lucide-react v0.562.0 - ISC
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the ISC license.
|
|
46
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
+
*/const bo=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],wo=de("message-square",bo);/**
|
|
48
|
+
* @license lucide-react v0.562.0 - ISC
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the ISC license.
|
|
51
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/const xo=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Ut=de("panel-left-close",xo);/**
|
|
53
|
+
* @license lucide-react v0.562.0 - ISC
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the ISC license.
|
|
56
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/const Io=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Vt=de("panel-left-open",Io);/**
|
|
58
|
+
* @license lucide-react v0.562.0 - ISC
|
|
59
|
+
*
|
|
60
|
+
* This source code is licensed under the ISC license.
|
|
61
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
+
*/const Do=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Co=de("star",Do);/**
|
|
63
|
+
* @license lucide-react v0.562.0 - ISC
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the ISC license.
|
|
66
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
+
*/const So=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ee=de("x",So),ko={loading:"loading...",saved:"Saved",saving:"Saving...",unsaved:"Editing...",publish:"Publish",publishing:"Publishing...",published:"Published",cancel:"Cancel",create:"Create",creating:"Creating...",close:"Close",delete:"Delete",save:"Save",gotIt:"got it",error:"error",brand:"mdocs",welcomeTitle:"Welcome to mdocs",welcomeDesc:"Enter a display name to create a visitor identity. A secure token will be stored in this browser to identify you on future visits.",visitorNamePlaceholder:"Your name",createVisitor:"Create visitor",nameRequired:"please enter a name",visitorIdNotice:"your visitor id is {{id}}, save it for recovery",newDocument:"New document",newFolder:"New folder",noDocumentsYet:"no documents yet",collapseFolder:"Collapse folder",expandFolder:"Expand folder",noDocsInDomain:"No documents in this domain yet. Switch domain below or create a document.",createDocToStart:"Create or select a document to start writing.",domainLabel:"Domain",defaultDomain:"Default",displayNamePlaceholder:"Display name",currentDomainAria:"Current domain",insertDiagram:"Insert diagram",outlineHide:"Hide outline",outlineShow:"Show outline",readOnlyNotice:`> You don't have permission to edit
|
|
68
|
+
|
|
69
|
+
`,newDocumentTitle:"New document",newFolderTitle:"New folder",fileNameLabel:"File name",folderNameLabel:"Folder name",fileNameHint:"Names are shown as you type; stored paths are normalised (e.g. spaces → underscores). Use a .md file name.",folderNameHint:"Names are shown as you type; stored paths are normalised (e.g. folder 1 → folder_1).",untitledPlaceholder:"untitled.md",folderExamplePlaceholder:"e.g. research",pathExists:"this path already exists; pick another name",folderExists:"a folder with this name already exists",deleteConfirm:"delete {{name}}?",newDocIn:"New document in {{name}}",newDocAtRoot:"New document at root",newDocBeside:"New document beside this",newFolderIn:"New folder in {{name}}",newFolderAtRoot:"New folder at root",newFolderBeside:"New folder beside this",deleteItem:"Delete {{name}}",deleteFolder:"Delete {{name}}",editDiagram:"Edit diagram",newDiagram:"New diagram",saveAndInsert:"Save and insert",deleteDiagram:"Delete diagram",openFailed:"open failed: {{message}}",components:"Components",dragToCanvas:"drag to canvas",shapeRectangle:"Rectangle",shapeRounded:"Rounded",shapeCircle:"Circle",shapeDiamond:"Diamond",shapeTriangle:"Triangle",shapePentagon:"Pentagon",shapeText:"Text",shapeLine:"Line",shapeData:"Data",shapeDatabase:"Database",shapeDocument:"Document",shapeDisplay:"Display",shapeManual:"Manual",shapeParallel:"Parallel",shapeComment:"Comment",shapeSubprocess:"Subprocess",shapeQueue:"Queue",shapeIntStorage:"Int. Storage",shapeExtStorage:"Ext. Storage",errUnauthenticated:"Please register first",errBadRequest:"Invalid request",errInvalidVisitorName:"Invalid visitor name",errDocExists:"Document already exists",errDocNotFound:"Document not found",errForbidden:"You don't have permission",errInternal:"Internal error",errInvalidPath:"Invalid path",errUnknown:"Unknown error",errUnknownVisitorIds:"Some visitor IDs are invalid or disabled.",errTemplateNotFound:"Member template not found.",errDomainNotRestricted:"Member import only applies to restricted domains.",pathRequired:"relative path is required",pathMustBeRelative:"path must be relative",useForwardSlashes:"use forward slashes",pathNoDotDot:"path must not contain ..",pathMustEndWithMd:"document path must end with .md",pathUnsupportedChars:"path contains unsupported characters",pathEscapesRoot:"path escapes docs root",enterFolderName:"enter a folder name",singleNameNotPath:"use a single name, not a path",invalidFolderName:"invalid folder name",folderNameTooLong:"folder name is too long",enterFileName:"enter a file name",singleFileNameNotPath:"use a file name, not a path",invalidFileName:"invalid file name",fileNameTooLong:"file name is too long",permissionLabel:"Permission",permissionPrivate:"Private",permissionInvite:"Invite",permissionDomainWrite:"Domain write",permissionPublicRead:"Public read",permissionPublicEdit:"Public edit",invitePermissionRead:"Read only",invitePermissionEdit:"Can edit",personalDomainSuffix:"'s workspace",settings:"Settings",general:"General",language:"Language",backToDocs:"Back to documents",saveAndPublish:"Save & Publish",domainManagement:"Domain Management",createDomain:"New domain",domainName:"Domain Name",domainPermission:"Permission",domainPublic:"Public",domainRestricted:"Restricted",domainPrivate:"Private",docCount:"{{count}} documents",rename:"Rename",deleteDomain:"Delete Domain",deleteDomainConfirm:"Delete domain {{name}}?",domainLocked:"Has documents, locked",noDomains:"No domains",domainNameRequired:"Enter a domain name",domainBuiltIn:"Built-in",domainNotCreator:"Only the creator can modify this domain",domainSearchPlaceholder:"Search domain name…",domainFilterAll:"All",domainColName:"Name",domainColType:"Type",domainColDocCount:"Documents",domainColActions:"Actions",domainTypeBuiltinSuffix:"(built-in)",domainChangeType:"Change type",domainNotModifiable:"—",domainTooltipTypeLocked:"This domain has {{count}} document(s); type cannot be changed.",deleteDomainConfirmDetail:"Delete domain «{{name}}»? All {{count}} document(s) in it will be permanently removed.",domainNoMatch:"No matching domains.",memberTemplates:"Member templates",memberTemplateFormNew:"New template",memberTemplateSavedList:"Saved templates",memberTemplateIntro:"Save reusable member lists for restricted domains. Use Choose members… to pick people (left list = everyone, right = selected). You can also apply a template inside that dialog. Then save the template here.",memberTemplateStepName:"1. Name your template",memberTemplateStepMembers:"2. Choose members",memberTemplateStepSave:"3. Save",memberTemplateStep2Hint:"Select at least 1 member to continue",memberTemplateNameLabel:"Template name",memberTemplateNamePlaceholder:"e.g. Core team",memberTemplateIdsLabel:"Members",memberTemplateIdsHint:"Use Choose members… to pick people in the list; you can also apply a template inside that dialog.",memberTemplateCreate:"Save template",memberTemplateUpdate:"Update template",memberTemplateCancelEdit:"Cancel edit",memberTemplateDelete:"Delete",memberTemplateDeleteConfirm:"Delete template «{{name}}»?",memberTemplateConfirmDeleteCancel:"Cancel",memberTemplateConfirmDeleteDesc:"Delete template «{{name}}»? This cannot be undone.",memberTemplateConfirmDeleteSubmit:"Delete",memberTemplateEmpty:"No templates yet. Create one here, then use Members… on a restricted domain in Domain management.",memberTemplateEmptyAction:"Create first template",memberTemplateCount:"{{count}} visitors",memberTemplatePickerTitle:"Choose visitors for this template",memberTemplatePickMembersButton:"Choose members…",memberTemplateSelectedSummary:"{{count}} selected",memberTemplateWizardBack:"Back",memberTemplateWizardNext:"Next",domainMembersManageButton:"Members…",domainMembersPickerTitle:"Restricted domain members",domainMembersSaved:"Saved {{count}} member(s).",visitorPickerSearchPlaceholder:"Search by name or visitor id…",visitorPickerColumnAll:"Everyone",visitorPickerColumnSelected:"Selected",visitorPickerApplyTemplate:"Apply template",visitorPickerPickTemplate:"Pick a template…",visitorPickerConfirm:"Done",visitorPickerLoadError:"Could not load visitor list.",visitorPickerEmptyDirectory:"No visitors yet.",visitorPickerNoSelection:"No one selected yet.",visitorPickerColIdShort:"ID (6)",visitorPickerColName:"Name",visitorPickerColPick:"Pick",visitorPickerColIdFull:"Visitor ID",visitorPickerRemove:"Remove from selection",visitorPickerLockedHint:"This member cannot be removed (domain owner).",visitorPickerUnknownVisitor:"Unknown ID (not in directory)",visitorPickerMemberMissing:"Removed visitor (no longer in database)",visitorPickerDisabledTag:"inactive account",visitorPickerSelfMarker:"(you)",domainMemberImportPickTemplate:"Choose template…",domainMemberImportSection:"Members (from saved template)",domainMgmtRestrictedMemberHint:"For restricted domains you own: click Members… in the Actions column, then pick people in the dialog (or apply a saved template). The domain owner always stays in the list.",domainMemberImportApply:"Import members",domainMemberImportDone:"Added {{count}} member(s).",domainMemberImportHint:"Add templates under “Member templates” first.",shared:"Shared",autoSave:"Auto Save (Local Snapshot)",autoSaveDesc:"When enabled, your content is protected from network outages, crashes, or accidental refreshes. Disabling this feature puts your data at high risk of loss.",autoSaveAlwaysOnDesc:"Always enabled — your content is continuously saved to a local snapshot, so you never lose work.",autoSaveBadge:"Recommended",autoSaveTurnOffTitle:"High Risk Operation",autoSaveTurnOffBody:"Without auto-save, content is only stored when you manually save or publish. If the browser crashes, closes unexpectedly, or refreshes, all unsaved content will be permanently lost.",autoSaveTurnOffConfirm:"Confirm Disable",autoSaveTurnOffCancel:"Keep Enabled",autoPublish:"Auto Sync to Cloud",autoPublishDesc:"Push changes to the server in real time. When network is unstable or multi-device editing conflicts occur, sync will pause to protect data integrity.",viewDrafts:"View Unpublished Drafts",unpublishedDrafts:"Unpublished Drafts",noDrafts:"No unpublished drafts",draftCount:"{{count}} unpublished",publishAll:"Publish all",conflictTitle:"Publish conflict",conflictBody:"Local version conflicts with remote. Please resolve the merge manually and re-publish.",conflictResolve:"Resolve conflict",conflictClose:"Close",syncPull:"Pull update",syncBehindHint:"New version on server",pullConfirmTitle:"Pull remote version",pullConfirmBody:"Updates the editor from the server when there is no local draft.",mergeTitle:"Merge conflict",mergeLocal:"Local",mergeRemote:"Remote",mergeResult:"Merged",mergeSource:"Source",mergePreview:"Preview",mergeComplete:"Merge and publish",mergeLoadRemoteFailed:"Failed to load remote content",mergeLoadLocalFailed:"Failed to load local snapshot",mergeLoadingRemote:"Loading…",mergeConflictsUnresolved:"{{count}} unresolved conflict(s). Resolve all conflicts before publishing.",mergeConflictsPending:"Conflicts pending {{unresolved}} / {{total}}",mergeConflictsResolved:"All conflicts resolved ({{total}})",mergeConflictsPanel:"Conflicts",mergeConflictItem:"Conflict {{index}} / {{total}}",mergeConflictUnresolved:"Pending",mergeConflictResolved:"Resolved",mergeAcceptLocal:"Accept local",mergeAcceptRemote:"Accept remote",mergeAcceptBoth:"Keep both",mergeAcceptManual:"Edit manually",mergeNoConflicts:"Local and remote match — you can publish directly.",mergeResultHint:"Assembled from your choices; you may still edit below",mergeResultInlineHint:"Confirm every change from the merge base inline",mergeBase:"Base",mergeBaseMissing:"Could not load merge base — using two-way diff",pullBlockedConflict:"Unresolved conflict — merge first.",syncHeadMissing:"Cannot publish: reopen the document to refresh version info.",syncPullDone:"Pulled latest from server",unsavedChanges:"You have unsaved changes.",edit:"Edit",autoEdit:"Auto Edit",autoEditDesc:"Automatically enter edit mode when opening a document",saveDraft:"Save Draft",continue:"Continue",draftDeleted:"Draft deleted",confirmDeleteDraft:"Permanently delete this draft? This action cannot be undone.",draftsEmptyState:"All drafts synced — no unpublished content.",localSnapshot:"Local snapshot",unknownTitle:"Untitled document",draftPublishFailedNotice:'Draft "{{name}}" publish failed: document not found',draftPublishFailedSyncHead:'Draft "{{name}}" publish failed: missing version baseline — reopen the document or fix on server',draftPublishFailedGeneric:'Draft "{{name}}" publish failed: {{reason}}',publishFailed:"Publish failed",recoverDraft:"Save As New Document",recoverDraftDesc:'Save the draft of "{{name}}" as a brand new document',recoverTargetFolder:"Target Folder",cliToken:"CLI Token",cliTokenDesc:"Identity token for CLI and Agent tools, inherits all your permissions",cliTokenCreate:"Create",cliTokenReset:"Reset",cliTokenGenerated:"New CLI Token generated",cliTokenCopy:"Copy",cliTokenCopied:"Copied",cliTokenCopyFailed:"Copy failed — select the token above and copy manually",cliTokenResetConfirm:"Resetting will revoke all existing tokens and generate a new one. Confirm?",cliTokenActive:"Active",cliTokenRevoked:"Revoked",docInfo:"Document info",docInfoCreator:"Creator",docInfoCreatedAt:"Created",docInfoSize:"Size",docInfoUpdatedAt:"Last edited",docInfoChangePermission:"Change permission",docInfoInviteMember:"Invite members",docInfoInviteSuccess:"Invited {{count}} member(s)",docInfoPermissionUpdated:"Permission updated",expandSidebar:"Expand sidebar",collapseSidebar:"Collapse sidebar",bookmark:"Bookmarks",bookmarkAdd:"Add to bookmarks",bookmarkRemove:"Remove from bookmarks",bookmarkTitle:"My Bookmarks",bookmarkEmpty:"No bookmarks yet",bookmarkOpen:"Open",bookmarkAdded:"Bookmark added",bookmarkRemoved:"Bookmark removed",bookmarkColTitle:"Title",bookmarkColDomain:"Domain",bookmarkColAuthor:"Author",bookmarkColTime:"Bookmarked",bookmarkSearch:"Search bookmarks",bookmarkFilterAll:"All domains",bookmarkNoMatch:"No matching bookmarks",myDocuments:"My Documents",myDocumentsEmpty:"No documents yet",myDocumentsColTitle:"Title",myDocumentsColDomain:"Domain",myDocumentsColUpdated:"Updated",myDocumentsColCreated:"Created",myDocumentsNoMatch:"No matching documents",agentConfig:"AI",agentConfigDesc:"Configure DeepSeek for mdocs 智能助手. Only you can use this key.",agentConfigName:"Config name",agentConfigNameDefault:"Default: {{name}}'s ds config",agentConfigModel:"Model",agentConfigContextWindow:"Context window",agentConfigContextWindowDesc:"Token budget for the assistant (default 128000). Used for the usage ring.",agentConfigApiKey:"API Key",agentConfigApiKeyPlaceholder:"Paste DeepSeek API Key",agentConfigApiKeyConfigured:"Configured {{masked}}; leave blank to keep",agentConfigId:"Config ID",agentConfigShowKey:"Show API Key",agentConfigHideKey:"Hide API Key",agentFabOpen:"Open mdocs 智能助手",agentFabReset:"Reset position",logout:"Sign out"},No={loading:"加载中...",saved:"已保存",saving:"保存中...",unsaved:"编辑中...",publish:"发布",publishing:"发布中...",published:"已发布",cancel:"取消",create:"创建",creating:"创建中...",close:"关闭",delete:"删除",save:"保存",gotIt:"知道了",error:"错误",brand:"mdocs",welcomeTitle:"欢迎使用 mdocs",welcomeDesc:"输入一个显示名称以创建访客身份。一个安全令牌将存储在此浏览器中,以便在后续访问时识别您。",visitorNamePlaceholder:"您的名字",createVisitor:"创建访客",nameRequired:"请输入名称",visitorIdNotice:"您的访客 ID 是 {{id}},请保存以便恢复",newDocument:"新建文档",newFolder:"新建文件夹",noDocumentsYet:"暂无文档",collapseFolder:"收起文件夹",expandFolder:"展开文件夹",noDocsInDomain:"此域尚无文档。请在下方切换域或创建文档。",createDocToStart:"创建一个文档或选择一个文档开始写作。",domainLabel:"域",defaultDomain:"默认",displayNamePlaceholder:"显示名称",currentDomainAria:"当前域",insertDiagram:"插入图表",outlineHide:"隐藏大纲",outlineShow:"显示大纲",readOnlyNotice:`> 您无权限编辑
|
|
70
|
+
|
|
71
|
+
`,newDocumentTitle:"新建文档",newFolderTitle:"新建文件夹",fileNameLabel:"文件名",folderNameLabel:"文件夹名",fileNameHint:"名称按您输入的方式显示;存储路径会被规范化(例如空格 → 下划线)。请使用 .md 文件名。",folderNameHint:"名称按您输入的方式显示;存储路径会被规范化(例如 folder 1 → folder_1)。",untitledPlaceholder:"未命名.md",folderExamplePlaceholder:"例如 research",pathExists:"此路径已存在,请选择其他名称",folderExists:"此名称的文件夹已存在",deleteConfirm:"删除 {{name}}?",newDocIn:"在 {{name}} 中新建文档",newDocAtRoot:"在根目录新建文档",newDocBeside:"在同级新建文档",newFolderIn:"在 {{name}} 中新建文件夹",newFolderAtRoot:"在根目录新建文件夹",newFolderBeside:"在同级新建文件夹",deleteItem:"删除 {{name}}",deleteFolder:"删除「{{name}}」",editDiagram:"编辑图表",newDiagram:"新建图表",saveAndInsert:"保存并插入",deleteDiagram:"删除图表",openFailed:"打开失败:{{message}}",components:"组件",dragToCanvas:"拖拽到画布",shapeRectangle:"矩形",shapeRounded:"圆角矩形",shapeCircle:"圆形",shapeDiamond:"菱形",shapeTriangle:"三角形",shapePentagon:"五边形",shapeText:"文本",shapeLine:"线条",shapeData:"数据",shapeDatabase:"数据库",shapeDocument:"文档",shapeDisplay:"显示",shapeManual:"手动",shapeParallel:"并行",shapeComment:"注释",shapeSubprocess:"子流程",shapeQueue:"队列",shapeIntStorage:"内部存储",shapeExtStorage:"外部存储",errUnauthenticated:"请先注册",errBadRequest:"请求无效",errInvalidVisitorName:"访客名称无效",errDocExists:"文档已存在",errDocNotFound:"文档不存在",errForbidden:"您没有权限",errInternal:"内部错误",errInvalidPath:"路径无效",errUnknown:"未知错误",errUnknownVisitorIds:"部分访客 ID 无效或已停用。",errTemplateNotFound:"找不到该成员模板。",errDomainNotRestricted:"仅受限域可从模板导入成员。",pathRequired:"需要提供相对路径",pathMustBeRelative:"路径必须是相对路径",useForwardSlashes:"请使用正斜杠",pathNoDotDot:"路径不能包含 ..",pathMustEndWithMd:"文档路径必须以 .md 结尾",pathUnsupportedChars:"路径包含不支持的字符",pathEscapesRoot:"路径超出了文档根目录",enterFolderName:"请输入文件夹名称",singleNameNotPath:"请使用单个名称,而非路径",invalidFolderName:"文件夹名称无效",folderNameTooLong:"文件夹名称过长",enterFileName:"请输入文件名",singleFileNameNotPath:"请使用文件名,而非路径",invalidFileName:"文件名无效",fileNameTooLong:"文件名过长",permissionLabel:"权限",permissionPrivate:"私有",permissionInvite:"邀请",permissionDomainWrite:"域内可编辑",permissionPublicRead:"公开可读",permissionPublicEdit:"公开可编辑",invitePermissionRead:"只读",invitePermissionEdit:"可编辑",personalDomainSuffix:"个人域",settings:"设置",general:"通用",language:"语言",backToDocs:"返回文档",saveAndPublish:"保存与发布",domainManagement:"域管理",createDomain:"创建新域",domainName:"域名称",domainPermission:"权限",domainPublic:"公开",domainRestricted:"受限",domainPrivate:"私有",docCount:"{{count}} 篇文档",rename:"重命名",deleteDomain:"删除域",deleteDomainConfirm:"确定删除域 {{name}}?",domainLocked:"有文档,不可修改",noDomains:"暂无域",domainNameRequired:"请输入域名称",domainBuiltIn:"系统内置",domainNotCreator:"您不是创建者,无权修改域设置",domainSearchPlaceholder:"搜索域名…",domainFilterAll:"全部",domainColName:"域名",domainColType:"类型",domainColDocCount:"文档数",domainColActions:"操作",domainTypeBuiltinSuffix:"(内置)",domainChangeType:"改类型",domainNotModifiable:"—",domainTooltipTypeLocked:"已有 {{count}} 篇文档,不可修改类型",deleteDomainConfirmDetail:"确定删除域「{{name}}」吗?域内 {{count}} 篇文档将被永久删除。",domainNoMatch:"没有匹配的域",memberTemplates:"域成员模板",memberTemplateFormNew:"新建模板",memberTemplateSavedList:"已保存的模板",memberTemplateIntro:"把常用成员存成模板,供受限域复用。点「选择成员…」在弹窗里左侧勾选、右侧为已选,也可在弹窗内应用模板。选好后在此保存模板。",memberTemplateStepName:"1. 填写名称",memberTemplateStepMembers:"2. 选择成员",memberTemplateStepSave:"3. 保存",memberTemplateStep2Hint:"至少选择 1 名成员才能继续",memberTemplateNameLabel:"模板名称",memberTemplateNamePlaceholder:"例如:核心开发组",memberTemplateIdsLabel:"成员",memberTemplateIdsHint:"通过下方「选择成员…」在列表中勾选;支持在弹窗内从模板自动勾选。",memberTemplateCreate:"保存模板",memberTemplateUpdate:"更新模板",memberTemplateCancelEdit:"取消编辑",memberTemplateDelete:"删除",memberTemplateDeleteConfirm:"删除模板「{{name}}」?",memberTemplateConfirmDeleteCancel:"取消",memberTemplateConfirmDeleteDesc:"确定删除模板「{{name}}」?此操作不可恢复。",memberTemplateConfirmDeleteSubmit:"确认删除",memberTemplateEmpty:"尚无模板。先在此创建,再在「域管理」里对受限域管理成员。",memberTemplateEmptyAction:"创建第一个模板",memberTemplateCount:"{{count}} 人",memberTemplatePickerTitle:"本模板包含的成员",memberTemplatePickMembersButton:"选择成员…",memberTemplateSelectedSummary:"已选 {{count}} 人",memberTemplateWizardBack:"上一步",memberTemplateWizardNext:"下一步",domainMembersManageButton:"成员…",domainMembersPickerTitle:"受限域成员",domainMembersSaved:"已保存 {{count}} 名成员。",visitorPickerSearchPlaceholder:"按昵称或 visitor id 搜索…",visitorPickerColumnAll:"全部访客",visitorPickerColumnSelected:"已选成员",visitorPickerApplyTemplate:"套用模板",visitorPickerPickTemplate:"选择模板…",visitorPickerConfirm:"完成",visitorPickerLoadError:"无法加载访客列表。",visitorPickerEmptyDirectory:"暂无访客。",visitorPickerNoSelection:"尚未选择任何人。",visitorPickerColIdShort:"ID 前 6 位",visitorPickerColName:"昵称",visitorPickerColPick:"勾选",visitorPickerColIdFull:"Visitor ID(完整)",visitorPickerRemove:"从已选中移除",visitorPickerLockedHint:"域创建者不可移除。",visitorPickerUnknownVisitor:"未知 ID(不在当前访客列表)",visitorPickerMemberMissing:"已删除的访客(库中无记录)",visitorPickerDisabledTag:"已停用",visitorPickerSelfMarker:"(你)",domainMemberImportPickTemplate:"选择模板…",domainMemberImportSection:"域成员(从模板导入)",domainMgmtRestrictedMemberHint:"对你创建的受限域:在「操作」列点「成员…」,在弹窗中勾选成员或套用模板;创建者会始终保留在已选列表中。",domainMemberImportApply:"导入成员",domainMemberImportDone:"新加入 {{count}} 名成员。",domainMemberImportHint:"请先在「域成员模板」中创建模板。",shared:"共享",autoSave:"自动保存 (本地快照)",autoSaveDesc:"开启后,即使断网、崩溃或误刷新,内容也不会丢失。关闭此功能将面临极高的数据丢失风险。",autoSaveAlwaysOnDesc:"始终开启 — 内容会持续保存到本地快照,永不会丢失。",autoSaveBadge:"强烈推荐",autoSaveTurnOffTitle:"高风险操作",autoSaveTurnOffBody:"关闭自动保存后,编辑内容仅在手动保存或发布时才会被存储。一旦浏览器崩溃、误关闭或刷新页面,所有未保存的内容将永久丢失。",autoSaveTurnOffConfirm:"确认关闭",autoSaveTurnOffCancel:"保持开启",autoPublish:"自动同步至云端",autoPublishDesc:"实时推送到服务器。当网络不稳定或多端编辑冲突时,系统将暂停同步以保护数据完整性。",viewDrafts:"查看未发布草稿",unpublishedDrafts:"未发布草稿",noDrafts:"暂无未发布草稿",draftCount:"{{count}} 篇未发布",publishAll:"全部发布",conflictTitle:"发布冲突",conflictBody:"云端版本与本地版本冲突,请手动处理合并后重新发布。",conflictResolve:"解决冲突",conflictClose:"关闭",syncPull:"拉取更新",syncBehindHint:"云端有新版本",pullConfirmTitle:"拉取远端版本",pullConfirmBody:"无本地草稿时,用云端内容更新编辑区。",mergeTitle:"合并冲突",mergeLocal:"本地",mergeRemote:"远端",mergeResult:"合并结果",mergeSource:"源码",mergePreview:"预览",mergeComplete:"完成合并并发布",mergeLoadRemoteFailed:"加载远端内容失败",mergeLoadLocalFailed:"加载本地快照失败",mergeLoadingRemote:"加载中…",mergeConflictsUnresolved:"仍有 {{count}} 处冲突未解决,请处理后再发布",mergeConflictsPending:"冲突待处理 {{unresolved}} / {{total}}",mergeConflictsResolved:"冲突已全部处理({{total}})",mergeConflictsPanel:"冲突块",mergeConflictItem:"冲突 {{index}} / {{total}}",mergeConflictUnresolved:"待处理",mergeConflictResolved:"已处理",mergeAcceptLocal:"采用本地",mergeAcceptRemote:"采用远端",mergeAcceptBoth:"保留双方",mergeAcceptManual:"手动编辑",mergeNoConflicts:"本地与远端正文一致,可直接发布。",mergeResultHint:"由冲突决议自动拼接,也可直接修改",mergeResultInlineHint:"相对祖先有改动的行均需在正文中点选确认",mergeBase:"祖先",mergeBaseMissing:"无法加载公共祖先,已退化为两方比对",pullBlockedConflict:"存在未解决的冲突,请先合并。",syncHeadMissing:"无法发布:缺少版本基准,请重新打开文档。",syncPullDone:"已拉取云端最新版本",unsavedChanges:"您有未保存的内容。",edit:"编辑",autoEdit:"自动编辑",autoEditDesc:"打开文档时自动进入编辑模式",saveDraft:"保存草稿",continue:"继续",draftDeleted:"草稿已删除",confirmDeleteDraft:"确定要永久删除这篇草稿吗?此操作不可恢复。",draftsEmptyState:"所有草稿已同步,当前无未发布内容。",localSnapshot:"本地快照",unknownTitle:"未命名文档",draftPublishFailedNotice:"草稿「{{name}}」发布失败:文档不存在",draftPublishFailedSyncHead:"草稿「{{name}}」发布失败:缺少版本基准,请重新打开文档",draftPublishFailedGeneric:"草稿「{{name}}」发布失败:{{reason}}",publishFailed:"发布失败",recoverDraft:"另存为新文档",recoverDraftDesc:"将「{{name}}」的草稿内容保存为一篇全新文档",recoverTargetFolder:"目标目录",cliToken:"CLI Token",cliTokenDesc:"用于命令行工具和 Agent 的身份令牌,继承你的所有权限",cliTokenCreate:"创建",cliTokenReset:"重置",cliTokenGenerated:"已生成新的 CLI Token",cliTokenCopy:"复制",cliTokenCopied:"已复制",cliTokenCopyFailed:"复制失败,请手动选中上方内容复制",cliTokenResetConfirm:"重置将吊销当前所有已有 Token,并生成新的 Token。确认重置?",cliTokenActive:"活跃",cliTokenRevoked:"已吊销",docInfo:"文档信息",docInfoCreator:"创建者",docInfoCreatedAt:"创建时间",docInfoSize:"大小",docInfoUpdatedAt:"上次编辑",docInfoChangePermission:"修改文章权限",docInfoInviteMember:"邀请成员",docInfoInviteSuccess:"已邀请 {{count}} 人",docInfoPermissionUpdated:"权限已更新",expandSidebar:"展开侧边栏",collapseSidebar:"收起侧边栏",bookmark:"收藏",bookmarkAdd:"添加收藏",bookmarkRemove:"取消收藏",bookmarkTitle:"我的收藏",bookmarkEmpty:"暂无收藏",bookmarkOpen:"打开",bookmarkAdded:"已添加收藏",bookmarkRemoved:"已取消收藏",bookmarkColTitle:"标题",bookmarkColDomain:"域",bookmarkColAuthor:"作者",bookmarkColTime:"收藏时间",bookmarkSearch:"搜索收藏",bookmarkFilterAll:"全部域",bookmarkNoMatch:"暂无匹配的收藏",myDocuments:"我的文章",myDocumentsEmpty:"暂无文章",myDocumentsColTitle:"标题",myDocumentsColDomain:"域",myDocumentsColUpdated:"更新时间",myDocumentsColCreated:"创建时间",myDocumentsNoMatch:"暂无匹配的文章",agentConfig:"AI",agentConfigDesc:"配置 DeepSeek 用于 mdocs 智能助手。仅本人可用,不会分享给其他访客。",agentConfigName:"配置名称",agentConfigNameDefault:"不填则:{{name}}的 ds 配置",agentConfigModel:"模型",agentConfigContextWindow:"上下文窗口",agentConfigContextWindowDesc:"助手可用的 token 上限(默认 128000),用于占用圆环显示。",agentConfigApiKey:"API Key",agentConfigApiKeyPlaceholder:"粘贴 DeepSeek API Key",agentConfigApiKeyConfigured:"已配置 {{masked}},留空不修改",agentConfigId:"配置 ID",agentConfigShowKey:"显示 API Key",agentConfigHideKey:"隐藏 API Key",agentFabOpen:"打开 mdocs 智能助手",agentFabReset:"重置位置",logout:"退出登录"},cn="mdocs.lang",Po={en:ko,zh:No};function To(){const e=window.localStorage.getItem(cn);return e==="zh"||e==="en"?e:navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}const ln=a.createContext(null);function Ao({children:e}){const[t,i]=a.useState(To);a.useEffect(()=>{document.documentElement.lang=t==="zh"?"zh-CN":"en"},[t]);const r=a.useCallback(d=>{window.localStorage.setItem(cn,d),i(d)},[]),s=a.useCallback((d,u)=>{let c=Po[t][d]??d;if(u)for(const[g,m]of Object.entries(u))c=c.replaceAll(`{{${g}}}`,m);return c},[t]);return n.jsx(ln.Provider,{value:{lang:t,setLang:r,t:s},children:e})}function ce(){const e=a.useContext(ln);if(!e)throw new Error("useI18n must be used within I18nProvider");return e}function je(e){const{content:t,contentHash:i,...r}=e;return r}function Eo(){let e=Promise.resolve();return{execute:i=>{const r=e.then(i);return e=r.then(()=>{},()=>{}),r}}}const Wt=new Map;function zt(e){let t=Wt.get(e);return t||(t=Eo(),Wt.set(e,t)),t}const ie={PRIVATE:0,DOMAIN_READ:1,DOMAIN_WRITE:2,PUBLIC_READ:3,PUBLIC_WRITE:4};function jo(e){return e===ie.PUBLIC_WRITE}function Qi(e){return e==="public"?[ie.PUBLIC_READ,ie.PUBLIC_WRITE]:e==="restricted"?[ie.DOMAIN_READ,ie.DOMAIN_WRITE]:[ie.PRIVATE,ie.DOMAIN_READ,ie.DOMAIN_WRITE,ie.PUBLIC_READ,ie.PUBLIC_WRITE]}const qt="___desc___.md";function Mo(e){const t=e.trim();return t?`${t}/${qt}`:qt}class le extends Error{constructor(t){super(t),this.name="DocPathError"}}const Ro=120,Oo=200;function ft(e){let t=e.trim().replace(/\s+/g,"_");for(t=t.replace(/[^A-Za-z0-9_\-\.\u4e00-\u9fa5]/g,"_"),t=t.replace(/_+/g,"_"),t=t.replace(/^[._]+|[._]+$/g,"");t.includes("..");)t=t.replace(/\.\./g,"_");return t==="."||t===".."||!t?"":t}function Lo(e){const t=e.trim();return t?t.includes("/")||t.includes("\\")?{ok:!1,message:"use a single name, not a path"}:t==="."||t===".."?{ok:!1,message:"invalid folder name"}:t.length>Ro?{ok:!1,message:"folder name is too long"}:{ok:!0,display:t}:{ok:!1,message:"enter a folder name"}}function Fo(e){let t=e.trim();return t?t.includes("/")||t.includes("\\")?{ok:!1,message:"use a file name, not a path"}:t==="."||t===".."?{ok:!1,message:"invalid file name"}:(t.toLowerCase().endsWith(".md")||(t+=".md"),t.length>Oo?{ok:!1,message:"file name is too long"}:{ok:!0,displayFile:t}):{ok:!1,message:"enter a file name"}}function _o(e){const t=e.trim().replace(/\\/g,"/");if(!t)throw new le("relative path is required");if(t.startsWith("/"))throw new le("path must be relative");if(t.includes(".."))throw new le("path must not contain ..");const i=t.split("/").filter(g=>g.length>0);if(i.length===0)throw new le("relative path is required");const r=[];for(let g=0;g<i.length-1;g+=1){const m=ft(i[g]);if(!m)throw new le("invalid path segment");r.push(m)}const s=i[i.length-1];if(!s.toLowerCase().endsWith(".md"))throw new le("document path must end with .md");const d=s.slice(0,-3),u=s.slice(-3),c=ft(d);if(!c)throw new le("invalid file name");return r.push(c+u),r.join("/")}class ae extends Error{constructor(i,r,s,d){super(s);Ie(this,"code");Ie(this,"status");Ie(this,"details");this.status=i,this.code=r,this.details=d}}const Bo={children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"README",type:"text",version:1,id:"148"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h1",id:"147"},{children:[{detail:0,format:2,mode:"normal",style:"",text:"Hi",type:"text",version:1,id:"149"},{detail:0,format:0,mode:"normal",style:"",text:",",type:"text",version:1,id:"150"},{detail:0,format:1,mode:"normal",style:"",text:"你好",type:"text",version:1,id:"151"},{detail:0,format:0,mode:"normal",style:"",text:",欢迎使用 mdocs 文本。下面是一段用来",type:"text",version:1,id:"152"},{detail:0,format:1,mode:"normal",style:"",text:"展示 mdocs 特性",type:"text",version:1,id:"153"},{detail:0,format:0,mode:"normal",style:"",text:"的示例文档,你可以按需删改。",type:"text",version:1,id:"154"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:2,textStyle:"",id:"255"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"文本与排版",type:"text",version:1,id:"156"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"155"},{children:[{detail:0,format:1,mode:"normal",style:"",text:"粗体",type:"text",version:1,id:"157"},{detail:0,format:0,mode:"normal",style:"",text:"、",type:"text",version:1,id:"158"},{detail:0,format:2,mode:"normal",style:"",text:"斜体",type:"text",version:1,id:"159"},{detail:0,format:0,mode:"normal",style:"",text:"、",type:"text",version:1,id:"160"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"162"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"163"},{detail:0,format:0,mode:"normal",style:"",text:"行内代码",type:"text",version:1,id:"164"}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1,id:"161"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"165"},{detail:0,format:0,mode:"normal",style:"",text:"、",type:"text",version:1,id:"166"},{detail:0,format:4,mode:"normal",style:"",text:"删除线",type:"text",version:1,id:"167"},{detail:0,format:0,mode:"normal",style:"",text:"。",type:"text",version:1,id:"168"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:1,textStyle:"",id:"256"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"引用块:适合写结论、提示或引用原文。",type:"text",version:1,id:"170"}],direction:"ltr",format:"",indent:0,type:"quote",version:1,id:"169"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"有序列表:",type:"text",version:1,id:"171"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"257"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"用 Markdown 记笔记",type:"text",version:1,id:"173"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:1,id:"174"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"用侧边栏管文档树",type:"text",version:1,id:"175"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:2,id:"176"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"需要时再发布或同步",type:"text",version:1,id:"177"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:3,id:"178"}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"number",start:1,tag:"ol",id:"172"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"无序列表:",type:"text",version:1,id:"179"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"258"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"访客身份,无需单独注册账号(自建部署时由服务端配置)",type:"text",version:1,id:"181"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:1,id:"182"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"文档以 ",type:"text",version:1,id:"183"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:2,id:"184"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"186"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"187"},{detail:0,format:0,mode:"normal",style:"",text:".md",type:"text",version:1,id:"188"}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1,id:"185"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:3,id:"189"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"190"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:4,id:"191"},{children:[{detail:0,format:0,mode:"normal",style:"",text:" 为主存储,结构清晰",type:"text",version:1,id:"192"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:5,id:"193"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"支持个人域与协作域等能力(视部署与权限而定)",type:"text",version:1,id:"194"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:6,id:"195"}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"bullet",start:1,tag:"ul",id:"180"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"代码",type:"text",version:1,id:"197"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"196"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"行内常量如 ",type:"text",version:1,id:"198"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"200"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"201"},{detail:0,format:0,mode:"normal",style:"",text:"VITE_DEMO_MODE",type:"text",version:1,id:"202"}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1,id:"199"},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1,id:"203"},{detail:0,format:0,mode:"normal",style:"",text:",或小段示例:",type:"text",version:1,id:"204"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"259"},{type:"code",version:1,code:`// 伪代码:表达「内容即文档」
|
|
72
|
+
const doc = { path: "notes/demo.md", content: "# Hello" };`,codeTheme:"default",language:"typescript",options:{indentWithTabs:!1,lineNumbers:!1,tabSize:2},id:"205"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"表格",type:"text",version:1,id:"207"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"206"},{children:[{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"能力",type:"text",version:1,id:"211"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"210"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"说明",type:"text",version:1,id:"213"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"212"}],direction:"ltr",format:"",indent:0,type:"tablerow",version:1,height:33,id:"209"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"编辑",type:"text",version:1,id:"216"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"215"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Markdown / 富文本流程按你们集成",type:"text",version:1,id:"218"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"217"}],direction:"ltr",format:"",indent:0,type:"tablerow",version:1,height:33,id:"214"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"图表",type:"text",version:1,id:"221"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"220"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"可按项目支持 Mermaid、meta2 等",type:"text",version:1,id:"223"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"222"}],direction:"ltr",format:"",indent:0,type:"tablerow",version:1,height:33,id:"219"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"草稿与发布",type:"text",version:1,id:"226"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"225"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"视前端与自建实例配置而定",type:"text",version:1,id:"228"}],direction:"ltr",format:"",indent:0,type:"tablecell",version:1,backgroundColor:null,colSpan:1,headerState:0,rowSpan:1,id:"227"}],direction:"ltr",format:"",indent:0,type:"tablerow",version:1,height:33,id:"224"}],direction:null,format:"",indent:0,type:"table",version:1,colWidths:[375,375],id:"208"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"链接与任务",type:"text",version:1,id:"230"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"229"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"仓库示例:",type:"text",version:1,id:"232"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:1,id:"233"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"https://github.com/xuhuafeifei/mdocs",type:"text",version:1,id:"235"}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:null,url:"https://github.com/xuhuafeifei/mdocs",id:"234"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:2,id:"236"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"站外链接用 Markdown 标注清楚即可,避免裸 URL 不易读。",type:"text",version:1,id:"237"}],direction:null,format:"",indent:0,type:"listitem",version:1,value:3,id:"238"}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"bullet",start:1,tag:"ul",id:"231"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"任务清单:",type:"text",version:1,id:"239"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"260"},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"写好这段 README Demo",type:"text",version:1,id:"241"}],direction:null,format:"",indent:0,type:"listitem",version:1,checked:!1,value:1,id:"242"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"按团队习惯补一页「目录规范」",type:"text",version:1,id:"243"}],direction:null,format:"",indent:0,type:"listitem",version:1,checked:!1,value:2,id:"244"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"需要时再加架构图或流程图",type:"text",version:1,id:"245"}],direction:null,format:"",indent:0,type:"listitem",version:1,checked:!1,value:3,id:"246"}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"check",start:1,tag:"ul",id:"240"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"示意图(若编辑器支持 Mermaid)",type:"text",version:1,id:"248"}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h2",id:"247"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"若当前实例的编辑器打开了 Mermaid,可解开下面代码块使用:",type:"text",version:1,id:"249"}],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"261"},{type:"code",version:1,code:`flowchart LR
|
|
73
|
+
A[写 Markdown] --> B[整理知识库]
|
|
74
|
+
B --> C[团队共享 / 自建部署]`,codeTheme:"default",language:"mermaid",options:{indentWithTabs:!1,lineNumbers:!1,tabSize:2},id:"250"},{type:"horizontalrule",version:1,id:"251"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"你以为这就完了?还有呢!",type:"text",version:1,id:"266"}],direction:null,format:"",indent:0,type:"heading",version:1,tag:"h2",id:"264"},{type:"meta2d",version:1,diagram:'{"x":0,"y":0,"scale":1,"pens":[{"background":"#fff","color":"#1f1f1f","height":100,"lineWidth":1,"textColor":"#1f1f1f","width":100,"name":"square","text":"我是一个流程图demo","id":"50d7f95","children":[],"x":279,"y":125,"fontSize":12,"lineHeight":1.5,"anchors":[{"x":0.5,"y":0,"id":"0","penId":"50d7f95"},{"x":1,"y":0.5,"id":"1","penId":"50d7f95"},{"x":0.5,"y":1,"id":"2","penId":"50d7f95"},{"x":0,"y":0.5,"id":"3","penId":"50d7f95"}],"rotate":0,"lineAnimateImages":[],"globalAlpha":1,"connectedLines":[{"lineId":"1a57bb5","lineAnchor":"a9246ca","anchor":"3"}]},{"background":"#fff","color":"#1f1f1f","height":80,"lineWidth":1,"textColor":"#1f1f1f","width":80,"name":"circle","text":"Circle","id":"7fd209d8","children":[],"x":161,"y":244,"fontSize":12,"lineHeight":1.5,"anchors":[{"x":0.5,"y":0,"id":"0","penId":"7fd209d8"},{"x":1,"y":0.5,"id":"1","penId":"7fd209d8"},{"x":0.5,"y":1,"id":"2","penId":"7fd209d8"},{"x":0,"y":0.5,"id":"3","penId":"7fd209d8"}],"rotate":0,"lineAnimateImages":[],"globalAlpha":1,"connectedLines":[{"lineId":"1a57bb5","lineAnchor":"72da2094","anchor":"0"}]},{"id":"1a57bb5","name":"line","lineName":"curve","x":201,"y":175,"type":1,"lineWidth":1,"length":119.98519897460938,"ex":279,"ey":244,"width":78,"height":69,"fontSize":12,"lineHeight":1.5,"anchors":[{"id":"a9246ca","x":1,"y":0,"penId":"1a57bb5","connectTo":"50d7f95","anchorId":"3","next":{"penId":"1a57bb5","connectTo":"50d7f95","x":0.358974358974359,"y":0},"start":true,"lineLength":119.98519897460938,"curvePoints":[{"x":273.46745803928,"y":175.08080907361838,"step":0.037504625891000655},{"x":268.1224860178494,"y":175.325768481332,"step":0.07500925178200131},{"x":262.9669830758521,"y":175.73867650342868,"step":0.11251387767300197},{"x":258.002848353432,"y":176.32333142019604,"step":0.15001850356400262},{"x":253.23198099073284,"y":177.0835315119218,"step":0.18752312945500327},{"x":248.65628012789855,"y":178.0230750588937,"step":0.22502775534600392},{"x":244.277644905073,"y":179.14576034139955,"step":0.26253238123700456},{"x":240.0979744624002,"y":180.45538563972715,"step":0.30003700712800524},{"x":236.11916794002371,"y":181.9557492341639,"step":0.3375416330190059},{"x":232.34312447808767,"y":183.65064940499792,"step":0.3750462589100066},{"x":228.77174321673573,"y":185.54388443251662,"step":0.41255088480100727},{"x":225.40692329611198,"y":187.639252597008,"step":0.45005551069200794},{"x":222.25056385636003,"y":189.94055217875956,"step":0.4875601365830086},{"x":219.304564037624,"y":192.4515814580592,"step":0.5250647624740092},{"x":216.57082298004758,"y":195.17613871519453,"step":0.5625693883650099},{"x":214.05123982377472,"y":198.11802223045333,"step":0.6000740142560106},{"x":211.74771370894916,"y":201.28103028412335,"step":0.6375786401470113},{"x":209.66214377571495,"y":204.6689611564923,"step":0.6750832660380119},{"x":207.79642916421585,"y":208.28561312784788,"step":0.7125878919290126},{"x":206.1524690145957,"y":212.13478447847785,"step":0.7500925178200133},{"x":204.73216246699843,"y":216.22027348866996,"step":0.787597143711014},{"x":203.53740866156784,"y":220.5458784387119,"step":0.8251017696020146},{"x":202.57010673844786,"y":225.11539760889139,"step":0.8626063954930153},{"x":201.83215583778232,"y":229.9326292794962,"step":0.900111021384016},{"x":201.3254550997151,"y":235.00137173081404,"step":0.9376156472750167},{"x":201.05190366439007,"y":240.32542324313266,"step":0.9751202731660173}]},{"x":0,"y":1,"id":"72da2094","penId":"1a57bb5","connectTo":"7fd209d8","prev":{"penId":"1a57bb5","connectTo":"7fd209d8","x":0,"y":0.2753623188405797},"anchorId":"0"}],"globalAlpha":1,"rotate":0,"lineAnimateImages":[]}],"origin":{"x":0,"y":0},"center":{"x":0,"y":0},"paths":{},"template":"a77b626","lineAnimateDraws":{},"iot":{},"version":"1.1.19","dataPoints":[]}',svg:'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="238" height="219"><defs/><g><g transform="translate(-151,-115)"><path fill="none" stroke="none"/><g><path fill="#fff" stroke="none" paint-order="stroke fill markers" d=" M 279 125 L 379 125 L 379 225 L 279 225 L 279 125 Z"/></g><path fill="none" stroke="#1f1f1f" paint-order="fill stroke markers" d=" M 279 125 L 379 125 L 379 225 L 279 225 L 279 125 Z" stroke-linecap="square" stroke-miterlimit="10"/><g><text fill="#1f1f1f" stroke="none" font-family=""Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="287" y="166.9" text-anchor="start" dominant-baseline="central">我是一个流程图</text><text fill="#1f1f1f" stroke="none" font-family=""Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial" font-size="12px" font-style="normal" font-weight="normal" text-decoration="normal" x="312.26000213623047" y="184.9" text-anchor="start" dominant-baseline="central">demo</text></g></g><g transform="translate(-151,-115)"><path fill="none" stroke="none"/><g><g transform="translate(-151,-115)"><path fill="none" stroke="none"/><g><path fill="none" stroke="none"/></g><path fill="none" stroke="#222222" paint-order="fill stroke markers" d=" M 279 175 C 229 175 201 194 201 244" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10"/></g></g></g></g></svg>',id:"269"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"270"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"271"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:"",id:"272"}],direction:"ltr",format:"",type:"root",version:1,id:"root"},$o={root:Bo},Gt=JSON.stringify($o),re="demo-visitor-001",Zi={visitorId:re,visitorName:"Demo User",createdAt:new Date().toISOString(),lastSeenAt:new Date().toISOString(),disabledAt:null,mergedIntoVisitorId:null};function qe(e){let t=0;for(let i=0;i<e.length;i++){const r=e.charCodeAt(i);t=(t<<5)-t+r,t=t&t}return Math.abs(t).toString(16).padStart(64,"0")}const Jt=`# Markdown 语法指南
|
|
75
|
+
|
|
76
|
+
## 基础格式
|
|
77
|
+
|
|
78
|
+
**粗体文本**、*斜体文本*、~~删除线~~
|
|
79
|
+
|
|
80
|
+
## 列表
|
|
81
|
+
|
|
82
|
+
### 无序列表
|
|
83
|
+
- 项目一
|
|
84
|
+
- 项目二
|
|
85
|
+
- 嵌套项目
|
|
86
|
+
|
|
87
|
+
### 有序列表
|
|
88
|
+
1. 第一项
|
|
89
|
+
2. 第二项
|
|
90
|
+
3. 第三项
|
|
91
|
+
|
|
92
|
+
## 代码
|
|
93
|
+
|
|
94
|
+
\`\`\`typescript
|
|
95
|
+
function hello(name: string): string {
|
|
96
|
+
return \`Hello, \${name}!\`;
|
|
97
|
+
}
|
|
98
|
+
\`\`\`
|
|
99
|
+
|
|
100
|
+
## 表格
|
|
101
|
+
|
|
102
|
+
| 功能 | 支持 |
|
|
103
|
+
|------|------|
|
|
104
|
+
| Markdown | ✅ |
|
|
105
|
+
| 图表 | ✅ |
|
|
106
|
+
| 公式 | ✅ |
|
|
107
|
+
|
|
108
|
+
## 引用
|
|
109
|
+
|
|
110
|
+
> 这是一段引用文本
|
|
111
|
+
> 可以有多行
|
|
112
|
+
|
|
113
|
+
## 链接和图片
|
|
114
|
+
|
|
115
|
+
[访问 GitHub](https://github.com)
|
|
116
|
+
|
|
117
|
+
## 数学公式(KaTeX)
|
|
118
|
+
|
|
119
|
+
行内公式:$E = mc^2$
|
|
120
|
+
|
|
121
|
+
块级公式:
|
|
122
|
+
|
|
123
|
+
$$
|
|
124
|
+
\\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi}
|
|
125
|
+
$$
|
|
126
|
+
`,Yt=`# 图表支持示例
|
|
127
|
+
|
|
128
|
+
mdocs 集成了多种图表类型。
|
|
129
|
+
|
|
130
|
+
## Mermaid 流程图
|
|
131
|
+
|
|
132
|
+
\`\`\`mermaid
|
|
133
|
+
flowchart LR
|
|
134
|
+
A[开始] --> B{判断}
|
|
135
|
+
B -->|是| C[处理]
|
|
136
|
+
B -->|否| D[结束]
|
|
137
|
+
C --> D
|
|
138
|
+
\`\`\`
|
|
139
|
+
|
|
140
|
+
## Mermaid 序列图
|
|
141
|
+
|
|
142
|
+
\`\`\`mermaid
|
|
143
|
+
sequenceDiagram
|
|
144
|
+
participant 用户
|
|
145
|
+
participant 前端
|
|
146
|
+
participant 后端
|
|
147
|
+
|
|
148
|
+
用户->>前端: 输入内容
|
|
149
|
+
前端->>后端: 提交数据
|
|
150
|
+
后端-->>前端: 返回结果
|
|
151
|
+
前端-->>用户: 显示成功
|
|
152
|
+
\`\`\`
|
|
153
|
+
|
|
154
|
+
## Mermaid 甘特图
|
|
155
|
+
|
|
156
|
+
\`\`\`mermaid
|
|
157
|
+
gantt
|
|
158
|
+
title 项目进度
|
|
159
|
+
dateFormat YYYY-MM-DD
|
|
160
|
+
section 设计
|
|
161
|
+
需求分析 :done, des1, 2024-01-01, 5d
|
|
162
|
+
技术选型 :done, des2, after des1, 3d
|
|
163
|
+
section 开发
|
|
164
|
+
前端开发 :active, dev1, 2024-01-09, 10d
|
|
165
|
+
后端开发 : dev2, 2024-01-09, 10d
|
|
166
|
+
\`\`\`
|
|
167
|
+
`,Kt=`# 个人笔记
|
|
168
|
+
|
|
169
|
+
这是我的私人域中的笔记,只有我能看到。
|
|
170
|
+
|
|
171
|
+
## 今日待办
|
|
172
|
+
|
|
173
|
+
- [x] 完成 mdocs demo 模式
|
|
174
|
+
- [ ] 测试所有功能
|
|
175
|
+
- [ ] 部署到 GitHub Pages
|
|
176
|
+
|
|
177
|
+
## 想法
|
|
178
|
+
|
|
179
|
+
Demo 模式的核心设计:
|
|
180
|
+
1. API 层透明切换
|
|
181
|
+
2. 数据存储在 IndexedDB
|
|
182
|
+
3. 用户无感知切换
|
|
183
|
+
|
|
184
|
+
`,er=[{documentId:"doc-welcome",relativePath:"README.md",displayName:"README",content:Gt,contentHash:qe(Gt),permission:1,ownerVisitorId:re,domainId:"default",updatedBy:re,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-markdown-guide",relativePath:"指南/Markdown 语法.md",displayName:"Markdown 语法",content:Jt,contentHash:qe(Jt),permission:1,ownerVisitorId:re,domainId:"default",updatedBy:re,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-diagram-guide",relativePath:"指南/图表支持.md",displayName:"图表支持",content:Yt,contentHash:qe(Yt),permission:1,ownerVisitorId:re,domainId:"default",updatedBy:re,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-personal-note",relativePath:"个人笔记.md",displayName:"个人笔记",content:Kt,contentHash:qe(Kt),permission:0,ownerVisitorId:re,domainId:re,updatedBy:re,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null}];const yt="mdocs.visitorId",pt="mdocs-api-error";function Ho(e){typeof window>"u"||window.dispatchEvent(new CustomEvent(pt,{detail:{status:e.status,code:e.code,message:e.message}}))}function mn(){return!1}function tr(){return window.localStorage.getItem(yt)}function Je(e){window.localStorage.setItem(yt,e)}function Uo(){window.localStorage.removeItem(yt)}async function v(e,t={}){try{mn();const i=new Headers(t.headers);!i.has("Content-Type")&&t.body&&i.set("Content-Type","application/json");const r=await fetch(e,{...t,headers:i});if(r.status===204)return;const s=await r.text();let d;try{d=s?JSON.parse(s):null}catch{throw new ae(r.status,"BAD_RESPONSE","response is not valid JSON")}if(!r.ok){const u=d==null?void 0:d.error;throw new ae(r.status,(u==null?void 0:u.code)??"UNKNOWN",(u==null?void 0:u.message)??"request failed",u==null?void 0:u.details)}return d.data}catch(i){throw i instanceof ae&&Ho(i),i}}const Ye="default",nr=["public","restricted","private"];function or(e){return e===Ye}function ir(e,t){return t!==null&&e.creatorVisitorId===t}function rr(e){return e.docCount>0}function Vo(e,t){return v("/api/visitors/register",{method:"POST",body:JSON.stringify({visitorName:e,password:t})})}function Wo(e){return v("/api/visitors/recover",{method:"POST",body:JSON.stringify({recoveryCode:e})})}function zo(e,t){return v("/api/visitors/login",{method:"POST",body:JSON.stringify({visitorName:e,password:t})})}function ar(e){return v("/api/visitors/set-password",{method:"POST",body:JSON.stringify({password:e})})}function sr(){return v("/api/visitors/recovery-code",{method:"POST"})}async function Xt(){return(await v("/api/visitors/me")).visitor}function dr(){return v("/api/visitors").then(e=>e.visitors)}function qo(){return v("/api/domains")}function cr(e){return v("/api/domains",{method:"POST",body:JSON.stringify(e)})}function lr(e,t){return v(`/api/domains/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({domainName:t})})}function mr(e,t){return v(`/api/domains/${encodeURIComponent(e)}/permission`,{method:"PUT",body:JSON.stringify({permission:t})})}function ur(e){return v(`/api/domains/${encodeURIComponent(e)}`,{method:"DELETE"})}function fr(e){return v(`/api/domains/${encodeURIComponent(e)}/members`).then(t=>t.members)}function pr(e,t){return v(`/api/domains/${encodeURIComponent(e)}/members`,{method:"PUT",body:JSON.stringify({visitorIds:t})})}function hr(){return v("/api/domain-member-templates")}function gr(e){return v("/api/domain-member-templates",{method:"POST",body:JSON.stringify(e)})}function yr(e,t){return v(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"PUT",body:JSON.stringify(t)})}function vr(e){return v(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"DELETE"})}function Go(e){const t=e!=null&&e.trim()?`?domainId=${encodeURIComponent(e.trim())}`:"";return v(`/api/tree${t}`)}function Me(e){return v(`/api/documents/${encodeURIComponent(e)}`)}function un(e){return v("/api/documents",{method:"POST",body:JSON.stringify(e)})}function Qt(e,t){return v(`/api/documents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function Jo(e,t){const i=t?`?localBaseCommitId=${encodeURIComponent(t)}`:"";return v(`/api/documents/${encodeURIComponent(e)}/sync-status${i}`)}function br(e,t,i){const r=new URLSearchParams({localBaseCommitId:t,remoteCommitId:i});return v(`/api/documents/${encodeURIComponent(e)}/merge-context?${r}`)}function st(e){return v("/api/documents/convert",{method:"POST",body:JSON.stringify(e)})}function Yo(e){return v(`/api/documents/${encodeURIComponent(e)}`,{method:"DELETE"})}function Ko(e,t){return v(`/api/documents/${encodeURIComponent(e)}/move`,{method:"POST",body:JSON.stringify({parentId:t})})}function wr(e){return v(`/api/documents/${encodeURIComponent(e)}/invites`)}function xr(e,t,i){return v(`/api/documents/${encodeURIComponent(e)}/invites`,{method:"POST",body:JSON.stringify({targetVisitorId:t,targetPermission:i})})}function Ir(e,t){return v(`/api/documents/${encodeURIComponent(e)}/invites/${encodeURIComponent(t)}`,{method:"DELETE"})}async function Dr(e,t){var m;const i=new FormData;i.append("file[]",e),i.append("documentId",t);const r=new Headers,s=await fetch("/api/assets/upload",{method:"POST",headers:r,body:i}),d=await s.json(),u=d;if(!s.ok||u.code===1){const y=d==null?void 0:d.error;throw new ae(s.status,(y==null?void 0:y.code)??"UPLOAD_FAILED",(y==null?void 0:y.message)??u.msg??"upload failed")}const c=((m=u.data)==null?void 0:m.succMap)??{},g=Object.values(c);if(g.length===0)throw new Error("upload succeeded but no URL returned");return g[0]}function Xo(e){return v("/api/folders",{method:"POST",body:JSON.stringify(e)})}function Qo(e){return v(`/api/documents/folder/${encodeURIComponent(e)}`,{method:"DELETE"})}function Cr(e){return v("/api/cli/tokens",{method:"POST",body:JSON.stringify({})})}function Sr(){return v("/api/cli/tokens")}function Zo(){return v("/api/bookmarks")}function kr(e){return v(`/api/bookmarks/${encodeURIComponent(e)}`)}function Nr(e){return v(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"POST"})}function ei(e){return v(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"DELETE"})}function Pr(){return v("/api/visitors/me/documents")}function ti(e){return v(`/api/documents/${encodeURIComponent(e)}/comments`)}function ni(e,t){return v(`/api/documents/${encodeURIComponent(e)}/comments`,{method:"POST",body:JSON.stringify(t)})}function oi(e,t){return v(`/api/documents/${encodeURIComponent(e)}/comments/${encodeURIComponent(t)}`,{method:"DELETE"})}function Tr(){return v("/api/agent/config")}function Ar(e){return v("/api/agent/config",{method:"PUT",body:JSON.stringify(e)})}function Er(){return v("/api/agent/skills")}function jr(e){return v("/api/agent/skills",{method:"POST",body:JSON.stringify(e)})}function Mr(e,t){return v(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}function Rr(e){return v(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function Or(){return v("/api/agent/status")}function Lr(){return v("/api/agent/context-usage")}function Fr(e="normal",t){const i=new URLSearchParams;e==="coding"&&(i.set("mode","coding"),t&&i.set("documentId",t));const r=i.toString();return v(`/api/agent/session${r?`?${r}`:""}`)}function _r(e="normal",t){const i=new URLSearchParams;e==="coding"&&(i.set("mode","coding"),t&&i.set("documentId",t));const r=i.toString();return v(`/api/agent/sessions${r?`?${r}`:""}`)}function Br(e="normal",t){return v("/api/agent/sessions",{method:"POST",body:JSON.stringify({mode:e,...e==="coding"?{documentId:t??null}:{}})})}function $r(e,t="normal",i){return v("/api/agent/session/open",{method:"POST",body:JSON.stringify({sessionId:e,mode:t,...t==="coding"?{documentId:i??null}:{}})})}function Hr(e,t){return v("/api/agent/session/bind-document",{method:"POST",body:JSON.stringify({sessionId:e,documentId:t})})}function Ur(e,t){return v("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,choice:t})})}function Vr(e){return v("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function Wr(e){return v("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}function zr(e,t){return v("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,...t})})}function qr(e){return v("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function Gr(e){return v("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}async function Jr(e,t){var m;const i={message:e,mode:t.mode==="coding"?"coding":"normal"},r=t.skillNames&&t.skillNames.length>0?t.skillNames:t.skillIds&&t.skillIds.length>0?t.skillIds:void 0;r&&(i.skillNames=r),t.mode==="coding"&&(t.documentId!==void 0&&(i.documentId=t.documentId),typeof t.workingMarkdown=="string"&&(i.workingMarkdown=t.workingMarkdown),typeof t.baseMarkdown=="string"&&(i.baseMarkdown=t.baseMarkdown));const s=await fetch("/api/agent/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:t.signal});if(!s.ok){let y=`HTTP ${s.status}`;try{const C=await s.json();(m=C.error)!=null&&m.message&&(y=C.error.message)}catch{}throw new Error(y)}if(!s.body)throw new Error("empty response body");const d=s.body.getReader(),u=new TextDecoder;let c="";for(;;){const{done:y,value:C}=await d.read();if(y)break;c+=u.decode(C,{stream:!0});const b=c.split(`
|
|
185
|
+
`);c=b.pop()??"";for(const N of b){const M=N.trim();if(!M.startsWith("data:"))continue;const R=M.slice(5).trim();if(!(!R||R==="[DONE]"))try{t.onEvent(JSON.parse(R))}catch{}}}const g=c.trim();if(g.startsWith("data:")){const y=g.slice(5).trim();if(y&&y!=="[DONE]")try{t.onEvent(JSON.parse(y))}catch{}}}const ii={domainId:Ye,domainName:"Default",permission:"public",creatorVisitorId:"",docCount:0};async function fn(){try{return await qo()}catch{return[ii]}}function ri(e,t){var i,r,s;return((i=e.find(d=>d.domainId===t))==null?void 0:i.domainId)??((r=e.find(d=>d.domainId===Ye))==null?void 0:r.domainId)??((s=e[0])==null?void 0:s.domainId)??Ye}function ai(e){const{t}=ce(),[i,r]=a.useState(!1),[s,d]=a.useState(null),[u,c]=a.useState("register"),[g,m]=a.useState(1),[y,C]=a.useState(""),[b,N]=a.useState(""),[M,R]=a.useState("password"),[h,D]=a.useState(""),[w,E]=a.useState(""),[k,A]=a.useState("");function H(P){if(P.preventDefault(),!y.trim()){d(t("nameRequired"));return}d(null),m(2)}async function U(P){P.preventDefault(),r(!0),d(null);try{const T=b.trim();await e.onSubmit(y.trim(),T||void 0)}catch(T){d(T instanceof Error?T.message:String(T)),m(1)}finally{r(!1)}}async function q(P){P.preventDefault();const T=h.trim(),f=w.trim();if(!T||!f){d("请输入用户名和密码");return}r(!0),d(null);try{const F=await zo(T,f);Je(F.visitor.visitorId),await e.onRecover(F.visitor.visitorId)}catch(F){d(F instanceof Error?F.message:String(F))}finally{r(!1)}}async function Y(P){P.preventDefault();const T=k.trim();if(!T){d("请输入恢复码");return}r(!0),d(null);try{const f=await Wo(T);Je(f.visitor.visitorId),await e.onRecover(f.visitor.visitorId)}catch(f){d(f instanceof Error?f.message:String(f))}finally{r(!1)}}const L=s??e.error;function _(P){d(null),c(P)}return n.jsx("div",{className:"mdocs-dialog-backdrop",children:n.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:420},children:[n.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--mdocs-border)",marginBottom:16},children:[n.jsx("button",{type:"button",onClick:()=>_("register"),style:{flex:1,padding:"12px",border:"none",background:u==="register"?"var(--mdocs-bg)":"none",color:u==="register"?"var(--mdocs-text)":"var(--mdocs-text-secondary)",cursor:"pointer",fontWeight:u==="register"?600:400,borderBottom:u==="register"?"2px solid var(--mdocs-accent)":"none"},children:"注册"}),n.jsx("button",{type:"button",onClick:()=>_("login"),style:{flex:1,padding:"12px",border:"none",background:u==="login"?"var(--mdocs-bg)":"none",color:u==="login"?"var(--mdocs-text)":"var(--mdocs-text-secondary)",cursor:"pointer",fontWeight:u==="login"?600:400,borderBottom:u==="login"?"2px solid var(--mdocs-accent)":"none"},children:"登录"})]}),u==="register"&&n.jsx(n.Fragment,{children:g===1?n.jsxs(n.Fragment,{children:[n.jsx("h1",{children:t("welcomeTitle")}),n.jsx("p",{children:t("welcomeDesc")}),n.jsxs("form",{onSubmit:H,children:[n.jsx("input",{autoFocus:!0,placeholder:t("visitorNamePlaceholder"),value:y,onChange:P=>C(P.target.value),maxLength:60}),L&&n.jsx("div",{className:"mdocs-dialog-error",children:L}),n.jsx("button",{type:"submit",className:"primary",disabled:i,children:"下一步"})]}),n.jsx("p",{style:{marginTop:16,textAlign:"center"},children:n.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:()=>_("login"),children:"已有账号?点击登录"})})]}):n.jsxs(n.Fragment,{children:[n.jsx("h1",{children:"设置密码(可选)"}),n.jsx("p",{style:{marginBottom:8},children:"设置密码后,你可以在其他浏览器或设备上使用「用户名+密码」登录。"}),n.jsx("p",{style:{color:"var(--mdocs-text-secondary)",fontSize:"0.875rem",marginBottom:16},children:"留空不设置密码也能正常使用,但只能在当前浏览器操作。"}),n.jsxs("form",{onSubmit:U,children:[n.jsx("input",{autoFocus:!0,type:"password",placeholder:"设置密码(至少 4 位)",value:b,onChange:P=>N(P.target.value),minLength:4}),L&&n.jsx("div",{className:"mdocs-dialog-error",children:L}),n.jsx("button",{type:"submit",className:"primary",disabled:i,style:{marginTop:8},children:i?t("creating"):"完成注册"})]}),n.jsx("p",{style:{marginTop:16,textAlign:"center"},children:n.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-text-secondary)",cursor:"pointer",fontSize:"0.875rem",padding:0},onClick:()=>m(1),children:"← 返回上一步"})})]})}),u==="login"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{style:{display:"flex",gap:16,marginBottom:16,fontSize:"0.875rem"},children:[n.jsx("button",{type:"button",onClick:()=>{d(null),R("password")},style:{background:"none",border:"none",color:M==="password"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:M==="password"?"2px solid var(--mdocs-accent)":"none",fontWeight:M==="password"?600:400},children:"用户名+密码"}),n.jsx("button",{type:"button",onClick:()=>{d(null),R("recovery")},style:{background:"none",border:"none",color:M==="recovery"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:M==="recovery"?"2px solid var(--mdocs-accent)":"none",fontWeight:M==="recovery"?600:400},children:"恢复码"})]}),M==="password"?n.jsxs(n.Fragment,{children:[n.jsx("h1",{children:"🔑 使用密码登录"}),n.jsx("p",{children:"输入用户名和密码,在其他设备上找回你的身份。"}),n.jsxs("form",{onSubmit:q,children:[n.jsx("input",{autoFocus:!0,placeholder:"用户名",value:h,onChange:P=>D(P.target.value),maxLength:60,style:{marginBottom:8}}),n.jsx("input",{type:"password",placeholder:"密码",value:w,onChange:P=>E(P.target.value)}),L&&n.jsx("div",{className:"mdocs-dialog-error",children:L}),n.jsx("button",{type:"submit",className:"primary",disabled:i,children:i?"验证中…":"登录"})]}),n.jsx("p",{style:{marginTop:16,textAlign:"center"},children:n.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:()=>_("register"),children:"没有账号?去注册"})})]}):n.jsxs(n.Fragment,{children:[n.jsx("h1",{children:"🔑 使用恢复码找回"}),n.jsx("p",{children:"输入注册时保存的恢复码,系统将为您生成新的身份令牌。"}),n.jsxs("form",{onSubmit:Y,children:[n.jsx("input",{autoFocus:!0,placeholder:"ABCD-EFGH-IJKL-MNOP",value:k,onChange:P=>A(P.target.value),style:{fontFamily:"monospace",letterSpacing:"0.1em"},maxLength:30}),L&&n.jsx("div",{className:"mdocs-dialog-error",children:L}),n.jsx("button",{type:"submit",className:"primary",disabled:i,children:i?"验证中…":"找回身份"})]})]})]})]})})}function si(e){const{t}=ce();return n.jsxs("div",{className:"mdocs-notice card",children:[n.jsx("span",{children:t("visitorIdNotice",{id:e.visitorId})}),n.jsx("button",{type:"button",onClick:e.onDismiss,children:t("gotIt")})]})}const pn="application/x-mdocs-document-id",ht="mdocs-doc:";let ge=null;function hn(e,t,i=[]){for(const r of e){if(r.type==="document"){if(r.documentId===t)return{forceOpenFolderIds:i,scrollTreeId:r.documentId};continue}if(r.descDocumentId===t)return{forceOpenFolderIds:i,scrollTreeId:r.documentId};const s=hn(r.children,t,[...i,r.documentId]);if(s)return s}return null}function vt(e){if(ge)return ge;try{const t=e.getData(pn);if(t)return t;const i=e.getData("text/plain")||e.getData("Text");if(i.startsWith(ht))return i.slice(ht.length)}catch{}return""}function ue(e){return!!(e&&ge)}function di(e){const{t}=ce(),i=a.useRef(null),[r,s]=a.useState(null),[d,u]=a.useState(null),c=a.useMemo(()=>{var D;const h=(D=e.activeDocumentId)==null?void 0:D.trim();return h?hn(e.nodes,h):null},[e.nodes,e.activeDocumentId]),g=a.useMemo(()=>new Set((c==null?void 0:c.forceOpenFolderIds)??[]),[c]);a.useEffect(()=>{if(!(c!=null&&c.scrollTreeId))return;const h=c.scrollTreeId,D=()=>{var k;const E=(k=i.current)==null?void 0:k.querySelector(`[data-tree-id="${CSS.escape(h)}"]`);E==null||E.scrollIntoView({block:"nearest",behavior:"smooth"})},w=requestAnimationFrame(()=>{requestAnimationFrame(D)});return()=>cancelAnimationFrame(w)},[c==null?void 0:c.scrollTreeId,g,e.nodes]);function m(){s(null)}function y(){ge=null,u(null),m()}function C(h){ge=h,u(h),m()}function b(h){if(!ue(e.onMoveDocument))return;h.preventDefault(),h.dataTransfer.dropEffect="move",h.target.closest(".mdocs-tree-row")||s({kind:"root"})}function N(h){const D=h.relatedTarget;D&&h.currentTarget.contains(D)||s(w=>(w==null?void 0:w.kind)==="root"?null:w)}function M(h){if(!e.onMoveDocument||!ue(e.onMoveDocument))return;h.preventDefault(),h.stopPropagation();const w=h.target.closest(".mdocs-tree-row"),E=vt(h.dataTransfer);y(),!w&&E&&e.onMoveDocument(E,null)}const R="mdocs-sidebar-list"+((r==null?void 0:r.kind)==="root"?" mdocs-tree-drop-root":"");return e.nodes.length===0?n.jsx("div",{ref:i,className:R,onDragOver:b,onDragLeave:N,onDrop:M,children:n.jsx("div",{className:"muted",style:{padding:"8px 10px",fontSize:12},children:t("noDocumentsYet")})}):n.jsx("div",{ref:i,className:R,onClick:h=>{var w;h.target.closest(".mdocs-tree-row")||(w=e.onDeselect)==null||w.call(e)},onContextMenu:h=>{h.preventDefault(),e.onContextMenu({x:h.clientX,y:h.clientY,node:{type:"folder",name:"",path:"",documentId:"",children:e.nodes},parentPath:""})},onDragOver:b,onDragLeave:N,onDrop:M,children:e.nodes.map(h=>n.jsx(gn,{node:h,depth:0,parentPath:"",parentFolderId:null,activeDocumentId:e.activeDocumentId,selectedParentPath:e.selectedParentPath,forceOpenFolderIds:g,dropHighlight:r,setDropHighlight:s,clearDropHighlight:m,beginDragSession:C,endDragSession:y,draggingId:d,onOpen:e.onOpen,onOpenFolder:e.onOpenFolder,onContextMenu:e.onContextMenu,onMoveDocument:e.onMoveDocument},h.path))})}function gn(e){const t={paddingLeft:8+e.depth*16};return e.node.type==="folder"?n.jsx(mi,{folder:e.node,depth:e.depth,indent:t,activeDocumentId:e.activeDocumentId,selectedParentPath:e.selectedParentPath,forceOpenFolderIds:e.forceOpenFolderIds,dropHighlight:e.dropHighlight,setDropHighlight:e.setDropHighlight,clearDropHighlight:e.clearDropHighlight,beginDragSession:e.beginDragSession,endDragSession:e.endDragSession,draggingId:e.draggingId,onOpen:e.onOpen,onOpenFolder:e.onOpenFolder,onContextMenu:e.onContextMenu,onMoveDocument:e.onMoveDocument}):n.jsx(ci,{doc:e.node,indent:t,parentPath:e.parentPath,parentFolderId:e.parentFolderId,activeDocumentId:e.activeDocumentId,dropHighlight:e.dropHighlight,setDropHighlight:e.setDropHighlight,clearDropHighlight:e.clearDropHighlight,beginDragSession:e.beginDragSession,endDragSession:e.endDragSession,draggingId:e.draggingId,onOpen:e.onOpen,onContextMenu:e.onContextMenu,onMoveDocument:e.onMoveDocument})}function ci(e){var g;const t=e.doc,i=t.documentId===e.activeDocumentId,r=!!e.onMoveDocument,s=e.draggingId===t.documentId,d=((g=e.dropHighlight)==null?void 0:g.kind)==="doc"&&e.dropHighlight.id===t.documentId,[u,c]=a.useState(!1);return n.jsxs("div",{role:"button",tabIndex:0,className:"mdocs-tree-row mdocs-tree-doc"+(i?" active":"")+(s?" mdocs-tree-dragging":"")+(d?" mdocs-tree-drop-target":""),"data-tree-id":t.documentId,style:{...e.indent,cursor:r?"grab":void 0},draggable:r,onDragStart:m=>{e.onMoveDocument&&(c(!0),e.beginDragSession(t.documentId),m.dataTransfer.setData(pn,t.documentId),m.dataTransfer.setData("text/plain",ht+t.documentId),m.dataTransfer.effectAllowed="move")},onDragEnd:()=>{e.endDragSession(),queueMicrotask(()=>c(!1))},onDragEnter:m=>{!ue(e.onMoveDocument)||ge===t.documentId||(m.preventDefault(),m.stopPropagation(),e.setDropHighlight({kind:"doc",id:t.documentId}))},onDragOver:m=>{!ue(e.onMoveDocument)||ge===t.documentId||(m.preventDefault(),m.stopPropagation(),m.dataTransfer.dropEffect="move",e.setDropHighlight({kind:"doc",id:t.documentId}))},onDrop:m=>{if(!e.onMoveDocument||!ue(e.onMoveDocument))return;m.preventDefault(),m.stopPropagation();const y=vt(m.dataTransfer),C=e.parentFolderId;e.endDragSession(),!(!y||y===t.documentId)&&e.onMoveDocument(y,C)},onClick:()=>{u||e.onOpen(t)},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),e.onOpen(t))},onContextMenu:m=>{m.preventDefault(),m.stopPropagation(),e.onContextMenu({x:m.clientX,y:m.clientY,node:t,parentPath:e.parentPath})},children:[n.jsx("span",{className:"mdocs-tree-caret-spacer","aria-hidden":!0}),n.jsx("span",{className:"mdocs-tree-icon",children:"md"}),n.jsx("span",{className:"mdocs-tree-label",children:t.displayName||t.name})]})}function li(){return n.jsx("span",{className:"mdocs-tree-icon mdocs-tree-icon-dir","aria-hidden":!0,children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M2 4.5h4.2L7.3 6H14v8.5H2V4.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),n.jsx("path",{d:"M2 4.5V3h4l1.1 1.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})})}function mi(e){var y,C;const{t}=ce(),i=e.forceOpenFolderIds.has(e.folder.documentId),[r,s]=a.useState(e.depth<1||i),d=r;a.useEffect(()=>{i&&s(!0)},[i,e.activeDocumentId]);const u=!!e.folder.descDocumentId&&e.folder.descDocumentId===e.activeDocumentId,c=e.selectedParentPath===e.folder.path,g=((y=e.dropHighlight)==null?void 0:y.kind)==="folder"&&e.dropHighlight.id===e.folder.documentId;function m(){e.onOpenFolder(e.folder.path,e.folder.descDocumentId)}return n.jsxs("div",{children:[n.jsxs("div",{className:"mdocs-tree-row mdocs-tree-folder mdocs-tree-folder-row"+(u?" active":c?" mdocs-tree-select-target":"")+(g?" mdocs-tree-drop-target":""),"data-tree-id":e.folder.documentId,style:e.indent,onClick:m,onContextMenu:b=>{b.preventDefault(),b.stopPropagation(),e.onContextMenu({x:b.clientX,y:b.clientY,node:e.folder,parentPath:e.folder.path})},onDragEnter:b=>{ue(e.onMoveDocument)&&(b.preventDefault(),b.stopPropagation(),e.setDropHighlight({kind:"folder",id:e.folder.documentId}),s(!0))},onDragOver:b=>{ue(e.onMoveDocument)&&(b.preventDefault(),b.stopPropagation(),b.dataTransfer.dropEffect="move",e.setDropHighlight({kind:"folder",id:e.folder.documentId}))},onDrop:b=>{if(!e.onMoveDocument||!ue(e.onMoveDocument))return;b.preventDefault(),b.stopPropagation();const N=vt(b.dataTransfer),M=e.folder.documentId;e.endDragSession(),N&&e.onMoveDocument(N,M)},children:[n.jsx("span",{className:"mdocs-tree-caret",role:"button",tabIndex:0,"aria-expanded":d,"aria-label":t(d?"collapseFolder":"expandFolder"),onClick:b=>{b.stopPropagation(),s(N=>!N),m()},onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),s(N=>!N),m())},children:d?"▾":"▸"}),n.jsx(li,{}),n.jsx("span",{className:"mdocs-tree-folder-select",children:n.jsx("span",{className:"mdocs-tree-label",children:((C=e.folder.folderDisplayName)==null?void 0:C.trim())||e.folder.name})})]}),d&&e.folder.children.map(b=>n.jsx(gn,{node:b,depth:e.depth+1,parentPath:e.folder.path,parentFolderId:e.folder.documentId,activeDocumentId:e.activeDocumentId,selectedParentPath:e.selectedParentPath,forceOpenFolderIds:e.forceOpenFolderIds,dropHighlight:e.dropHighlight,setDropHighlight:e.setDropHighlight,clearDropHighlight:e.clearDropHighlight,beginDragSession:e.beginDragSession,endDragSession:e.endDragSession,draggingId:e.draggingId,onOpen:e.onOpen,onOpenFolder:e.onOpenFolder,onContextMenu:e.onContextMenu,onMoveDocument:e.onMoveDocument},b.path))]})}function ui(e){var c;const{t}=ce(),i=a.useRef(null);a.useEffect(()=>{function g(y){i.current&&!i.current.contains(y.target)&&e.onClose()}function m(y){y.key==="Escape"&&e.onClose()}return window.addEventListener("mousedown",g),window.addEventListener("keydown",m),()=>{window.removeEventListener("mousedown",g),window.removeEventListener("keydown",m)}},[e.onClose]);const r=e.node.type==="folder";let s="";if(e.node.type==="folder"){const g=e.node;s=((c=g.folderDisplayName)==null?void 0:c.trim())||g.path||""}const d=r?s?t("newDocIn",{name:s}):t("newDocAtRoot"):t("newDocBeside"),u=r?s?t("newFolderIn",{name:s}):t("newFolderAtRoot"):t("newFolderBeside");return n.jsxs("div",{ref:i,className:"mdocs-context-menu card",style:{left:e.x,top:e.y},children:[n.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const g=r?e.node.path:e.parentPath;e.onCreateChild(g),e.onClose()},children:d}),n.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const g=r?e.node.path:e.parentPath;e.onCreateFolder(g),e.onClose()},children:u}),n.jsx("button",{type:"button",className:"mdocs-context-item danger",onClick:()=>{e.node.type==="document"?e.onDeleteDocument(e.node):e.onDeleteFolder(e.node),e.onClose()},children:e.node.type==="folder"?t("deleteFolder",{name:s||e.node.name}):t("deleteItem",{name:e.node.name})})]})}function fi({domains:e,value:t,onChange:i,ariaLabel:r,localizeName:s,onDomainsChange:d}){const[u,c]=a.useState(!1),[g,m]=a.useState(e),y=a.useRef(null),C=a.useRef(null);a.useEffect(()=>{m(e)},[e]);const b=g.find(h=>h.domainId===t),N=(b==null?void 0:b.permission)==="private";a.useEffect(()=>{if(!u)return;const h=D=>{var w,E;!((w=y.current)!=null&&w.contains(D.target))&&!((E=C.current)!=null&&E.contains(D.target))&&c(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[u]),a.useEffect(()=>{if(!u)return;const h=D=>{var w;D.key==="Escape"&&(c(!1),(w=y.current)==null||w.focus())};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[u]);function M(h){i(h),c(!1)}function R(){if(u){c(!1);return}c(!0),fn().then(h=>{m(h),d==null||d(h)})}return n.jsxs("div",{className:"mdocs-domain-select-wrapper",children:[n.jsxs("button",{ref:y,type:"button",className:"mdocs-domain-select-trigger","aria-label":r,"aria-expanded":u,"aria-haspopup":"listbox",onClick:R,children:[n.jsx("span",{className:"mdocs-domain-select-text",children:b?s(b.domainName):""}),N&&n.jsxs("svg",{className:"mdocs-domain-lock",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),n.jsx("svg",{className:"mdocs-domain-select-chevron"+(u?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"1.5",children:n.jsx("path",{d:"M1 1l4 4 4-4"})})]}),u&&n.jsx("div",{ref:C,className:"mdocs-domain-select-menu card",role:"listbox","aria-label":r,children:g.map(h=>n.jsxs("button",{type:"button",className:"mdocs-domain-select-option"+(h.domainId===t?" active":""),role:"option","aria-selected":h.domainId===t,onClick:()=>M(h.domainId),children:[n.jsx("span",{children:s(h.domainName)}),h.permission==="private"&&n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]},h.domainId))})]})}const yn="data:image/svg+xml,%3csvg%20fill='%234D6BFE'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDeepSeek%3c/title%3e%3cpath%20d='M23.748%204.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434%201.202-.422%201.84.027%201.436.633%202.58%201.838%203.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526%205.526%200%2001-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365%2011.365%200%2000-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055%203.055%200%2001-.465.137%209.597%209.597%200%2000-2.883-.102c-1.885.21-3.39%201.102-4.497%202.623C.082%208.606-.231%2010.684.152%2012.85c.403%202.284%201.569%204.175%203.36%205.653%201.858%201.533%203.997%202.284%206.438%202.14%201.482-.085%203.133-.284%204.994-1.86.47.234.962.327%201.78.397.63.059%201.236-.03%201.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926%201.096-1.296%202.746-2.642%203.392-7.003.05-.347.007-.565%200-.845-.004-.17.035-.237.23-.256a4.173%204.173%200%20001.545-.475c1.396-.763%201.96-2.015%202.093-3.517.02-.23-.004-.467-.247-.588zM11.581%2018c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696%204.696%200%20011.529-.039c2.132.312%203.946%201.265%205.468%202.774.868.86%201.525%201.887%202.202%202.891.72%201.066%201.494%202.082%202.48%202.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306%200%2001.415-.287.302.302%200%2001.2.288.306.306%200%2001-.31.307.303.303%200%2001-.304-.308zm3.11%201.596c-.2.081-.399.151-.59.16a1.245%201.245%200%2001-.798-.254c-.274-.23-.47-.358-.552-.758a1.73%201.73%200%2001.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559%200%2001-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136%201.146.016.352.144.618.408%201.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z'%3e%3c/path%3e%3c/svg%3e",se={left:12,bottom:64},bt="mdocs.agentFabPosition",Ke=36,Zt=3;function wt(e){const i=Math.max(8,window.innerWidth-Ke-8),r=Math.max(8,window.innerHeight-Ke-8);return{left:Math.min(i,Math.max(8,e.left)),bottom:Math.min(r,Math.max(8,e.bottom))}}function pi(e,t,i,r){const s=e-i,d=t-r,u=window.innerHeight-d-Ke;return wt({left:s,bottom:u})}function hi(){try{const e=localStorage.getItem(bt);if(!e)return se;const t=JSON.parse(e);return typeof t.left!="number"||typeof t.bottom!="number"?se:wt({left:t.left,bottom:t.bottom})}catch{return se}}function en(e){localStorage.setItem(bt,JSON.stringify(e))}function gi(e){return e.left===se.left&&e.bottom===se.bottom}function yi(e){const i=Math.min(480,window.innerWidth-72);let r=e.left+Ke+8;r+i>window.innerWidth-8&&(r=e.left-8-i),r=Math.max(8,r);const s=Math.max(8,e.bottom-8);return{left:r,bottom:s}}function vi(e){const{t}=ce(),[i,r]=a.useState(!1),[s,d]=a.useState(e.position),u=a.useRef(null),c=a.useRef(null),g=a.useRef(s),m=a.useRef(e.onPositionChange),y=a.useRef(e.onToggle);g.current=s,m.current=e.onPositionChange,y.current=e.onToggle;const C=a.useRef(null),b=a.useRef(0),N=a.useRef(null);a.useEffect(()=>{C.current||(d(e.position),g.current=e.position)},[e.position]),a.useEffect(()=>{function D(){const w=wt(g.current);w.left===g.current.left&&w.bottom===g.current.bottom||(g.current=w,d(w),m.current(w),en(w))}return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]),a.useEffect(()=>{function D(){b.current=0;const k=N.current;if(!k)return;N.current=null,g.current=k,d(k);const A=c.current;A&&(A.style.left=`${k.left}px`,A.style.bottom=`${k.bottom}px`),m.current(k)}function w(k){const A=C.current;if(!A||k.pointerId!==A.pointerId)return;k.preventDefault();const H=k.clientX-A.startX,U=k.clientY-A.startY;!A.didMove&&H*H+U*U>=Zt*Zt&&(A.didMove=!0,r(!0)),A.didMove&&(N.current=pi(k.clientX,k.clientY,A.offsetX,A.offsetY),b.current||(b.current=requestAnimationFrame(D)))}function E(k){var H;const A=C.current;if(!(!A||k.pointerId!==A.pointerId)){C.current=null,r(!1),b.current&&(cancelAnimationFrame(b.current),b.current=0),N.current&&(g.current=N.current,d(N.current),N.current=null);try{(H=u.current)==null||H.releasePointerCapture(k.pointerId)}catch{}if(A.didMove){const U=g.current;m.current(U),en(U);return}y.current()}}return window.addEventListener("pointermove",w,{passive:!1}),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),()=>{window.removeEventListener("pointermove",w),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E),b.current&&cancelAnimationFrame(b.current)}},[]);function M(D){if(D.button!==0)return;D.preventDefault();const w=D.currentTarget.getBoundingClientRect();C.current={pointerId:D.pointerId,offsetX:D.clientX-w.left,offsetY:D.clientY-w.top,startX:D.clientX,startY:D.clientY,didMove:!1},D.currentTarget.setPointerCapture(D.pointerId)}function R(){g.current=se,d(se),e.onPositionChange(se),localStorage.removeItem(bt)}const h=!gi(s);return n.jsxs("div",{ref:c,className:"mdocs-agent-fab-wrap"+(i?" dragging":""),style:{left:s.left,bottom:s.bottom},children:[n.jsx("button",{ref:u,type:"button",className:"mdocs-agent-fab"+(e.open?" open":"")+(i?" dragging":""),"aria-label":t("agentFabOpen"),"aria-expanded":e.open,onPointerDown:M,children:n.jsx("img",{src:yn,alt:"",draggable:!1})}),h&&n.jsx("button",{type:"button",className:"mdocs-agent-fab-reset",onClick:R,"aria-label":t("agentFabReset"),children:t("agentFabReset")})]})}function bi(){const[e,t]=a.useState(()=>typeof window>"u"?se:hi());return[e,t]}function wi({title:e,message:t,onClose:i}){const{t:r}=ce();return n.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:s=>{s.target===s.currentTarget&&i()},children:n.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&n.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),n.jsx("p",{className:"mdocs-message-dialog-body",children:t}),n.jsx("div",{className:"mdocs-message-dialog-actions",children:n.jsx("button",{type:"button",className:"primary",onClick:i,children:r("gotIt")})})]})})}function vn({title:e,message:t,confirmLabel:i="确定",cancelLabel:r="取消",onConfirm:s,onCancel:d,busy:u=!1,danger:c=!1}){return n.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&!u&&d()},children:n.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&n.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),n.jsx("p",{className:"mdocs-message-dialog-body",children:t}),n.jsxs("div",{className:"mdocs-message-dialog-actions",style:{gap:8},children:[n.jsx("button",{type:"button",onClick:d,disabled:u,children:r}),n.jsx("button",{type:"button",className:c?"danger":"primary",onClick:s,disabled:u,children:u?"…":i})]})]})})}const tn={"relative path is required":"pathRequired","path must be relative":"pathMustBeRelative","use forward slashes":"useForwardSlashes","path must not contain ..":"pathNoDotDot","document path must end with .md":"pathMustEndWithMd","path contains unsupported characters":"pathUnsupportedChars","path escapes docs root":"pathEscapesRoot"},bn={"enter a folder name":"enterFolderName","use a single name, not a path":"singleNameNotPath","invalid folder name":"invalidFolderName","folder name is too long":"folderNameTooLong","enter a file name":"enterFileName","use a file name, not a path":"singleFileNameNotPath","invalid file name":"invalidFileName","file name is too long":"fileNameTooLong"};function me(e,t){if(t instanceof ae)return t.message;if(t instanceof le){const i=tn[t.message];return i?e(i):t.message}if(t instanceof Error){const i=tn[t.message]??bn[t.message];return i?e(i):t.message}return String(t)}function xi(e,t,i){if(e==="Default")return i("defaultDomain");const r="个人域";return e.endsWith(r)?e.slice(0,-r.length)+i("personalDomainSuffix"):e}function Yr(e,t){return e==="public"?t("domainPublic"):e==="restricted"?t("domainRestricted"):e==="private"?t("domainPrivate"):e}function Ge(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function Ii(e){return JSON.stringify({root:{children:[{children:[{detail:0,format:0,mode:"normal",text:e,type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"heading",tag:"h1",version:1}],direction:"ltr",type:"root",version:1}})}function nn(e,t){const i=e.trim(),r=t.trim();return r?i?`${i}/${r}`:r:i}function wn(e,t=new Set){for(const i of e)i.type==="document"?t.add(i.path):(i.descDocumentId&&t.add(Mo(i.path)),wn(i.children,t));return t}function gt(e,t){for(const i of e){if(i.type==="folder"&&i.path===t)return i.documentId;if(i.type==="folder"){const r=gt(i.children,t);if(r)return r}}return null}function on(e,t){const i=bn[t];return i?e(i):t}function Di(e){const{tree:t,currentDomainId:i,selectedCreateParentPath:r,t:s,onDocCreated:d,refreshTree:u}=e,[c,g]=a.useState(null),[m,y]=a.useState(null),[C,b]=a.useState(!1),N=a.useRef(null);a.useEffect(()=>{if(!c)return;const D=window.setTimeout(()=>{var w;return(w=N.current)==null?void 0:w.focus()},0);return()=>window.clearTimeout(D)},[c]);function M(D){const w=D!==void 0;y(null),g({kind:"document",parentMode:w?"fixed":"selection",parentPath:w?D:"",draft:"untitled.md"})}function R(D){const w=D!==void 0;y(null),g({kind:"folder",parentMode:w?"fixed":"selection",parentPath:w?D:"",draft:""})}async function h(D){if(D.preventDefault(),!c)return;b(!0),y(null);const w=wn(t),E=c.parentMode==="selection"?r:c.parentPath;try{if(c.kind==="document"){const q=Fo(c.draft);if(!q.ok){y(on(s,q.message));return}const Y=q.displayFile,L=Y.replace(/\.md$/i,"");let _;try{_=_o(nn(E,Y))}catch(f){y(me(s,f));return}if(w.has(_)){y(s("pathExists"));return}const P=E?gt(t,E)??void 0:void 0,T=await un({fileName:Y,displayName:L,content:Ii(L),domainId:i,parentId:P});await u(),d(T),g(null);return}const k=Lo(c.draft);if(!k.ok){y(on(s,k.message));return}const A=ft(k.display);if(!A){y(s("invalidFolderName"));return}const H=nn(E,A);if(w.has(H)){y(s("folderExists"));return}const U=E?gt(t,E)??void 0:void 0;await Xo({name:A,parentId:U,domainId:i}),await u(),g(null)}catch(k){y(me(s,k))}finally{b(!1)}}return{createModal:c,setCreateModal:g,createModalError:m,createModalBusy:C,createModalInputRef:N,openNewDocumentModal:M,openNewFolderModal:R,submitCreateModal:h}}const rn="(max-width: 768px)";function Ci(){const[e,t]=a.useState(()=>typeof window<"u"?window.matchMedia(rn).matches:!1);return a.useEffect(()=>{const i=window.matchMedia(rn),r=()=>t(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),e}function Si({open:e,onClose:t,onResolve:i}){const{t:r}=ce();return e?n.jsx("div",{className:"mdocs-conflict-modal-root",role:"alertdialog","aria-modal":"true",children:n.jsxs("div",{className:"mdocs-conflict-modal-panel",children:[n.jsx("h2",{className:"mdocs-conflict-modal-title",children:r("conflictTitle")}),n.jsx("p",{className:"mdocs-conflict-modal-body",children:r("conflictBody")}),n.jsxs("div",{className:"mdocs-conflict-modal-actions",children:[n.jsx("button",{type:"button",className:"primary",onClick:i,children:r("conflictResolve")}),n.jsx("button",{type:"button",className:"secondary",onClick:t,children:r("conflictClose")})]})]})}):null}function ki({documentId:e,visitorId:t,visitorName:i,documentOwnerId:r,onClose:s}){const[d,u]=a.useState([]),[c,g]=a.useState(""),[m,y]=a.useState(null),[C,b]=a.useState(!0),[N,M]=a.useState(!1),[R,h]=a.useState(null),[D,w]=a.useState(null),[E,k]=a.useState(360),[A,H]=a.useState(80),U=a.useRef(!1),q=a.useRef(!1),Y=300,L=80,_=a.useRef(null);function P(){const I=_.current;if(!I)return;I.style.height="auto";const S=I.scrollHeight,B=Math.min(Math.max(S,L),Y);I.style.height=`${B}px`,H(B)}a.useEffect(()=>{setTimeout(()=>P(),0)},[m]);function T(I){return t?I.visitorId===t||r===t:!1}const{rootComments:f,repliesByParentId:F,totalCount:Q}=a.useMemo(()=>{const I=[],S=new Map;let B=0;for(const $ of d)$.isDeleted||(B++,$.parentId?(S.has($.parentId)||S.set($.parentId,[]),S.get($.parentId).push($)):I.push($));return{rootComments:I,repliesByParentId:S,totalCount:B}},[d]),V=a.useRef(e);a.useEffect(()=>{V.current=e,g(""),y(null),w(null),ye()},[e]);async function ye(){const I=V.current;b(!0);try{const S=await ti(e);if(V.current!==I)return;u(S.comments)}catch(S){if(V.current!==I)return;w("加载评论失败"),console.error("Failed to load comments:",S)}finally{V.current===I&&b(!1)}}async function Oe(){var I;if(!(!c.trim()||!t)){M(!0),w(null);try{await ni(e,{content:c,parentId:(m==null?void 0:m.commentId)||null,replyToVisitorId:m?((I=d.find(S=>S.commentId===m.commentId))==null?void 0:I.visitorId)??null:null,replyToVisitorName:(m==null?void 0:m.visitorName)||null}),g(""),y(null),setTimeout(()=>P(),0),await ye()}catch(S){w(S.message||"发表失败,请重试")}finally{M(!1)}}}async function ke(I){w(null);try{await oi(e,I),await ye()}catch(S){w(S.message||"删除失败,请重试")}finally{h(null)}}function fe(I){const S=Date.now()-new Date(I).getTime(),B=Math.floor(S/6e4),$=Math.floor(S/36e5),Z=Math.floor(S/864e5);return B<1?"刚刚":B<60?`${B}分钟前`:$<24?`${$}小时前`:`${Z}天前`}function ve(I){U.current=!0,I.preventDefault()}function Xe(I){q.current=!0,I.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="row-resize"}return a.useEffect(()=>{function I(B){if(U.current){const $=Math.max(280,Math.min(600,window.innerWidth-B.clientX));k($)}if(q.current){const $=-B.movementY;H(Z=>Math.max(60,Math.min(600,Z+$)))}}function S(){U.current=!1,q.current=!1,document.body.style.userSelect="",document.body.style.cursor=""}return window.addEventListener("mousemove",I),window.addEventListener("mouseup",S),()=>{window.removeEventListener("mousemove",I),window.removeEventListener("mouseup",S)}},[]),n.jsxs("div",{className:"mdocs-comments-panel",style:{width:E},children:[n.jsx("div",{className:"mdocs-comments-resize-handle",onMouseDown:ve}),n.jsxs("div",{className:"mdocs-comments-header",children:[n.jsxs("h3",{style:{margin:0,fontSize:"1rem",display:"flex",alignItems:"center",gap:6},children:[n.jsx(wo,{size:18}),"评论 (",Q,")"]}),n.jsx("button",{type:"button",onClick:s,className:"mdocs-comments-close-btn",children:n.jsx(Ee,{size:18})})]}),D&&n.jsxs("div",{className:"mdocs-comments-error",children:[D,n.jsx("button",{type:"button",onClick:()=>w(null),children:n.jsx(Ee,{size:14})})]}),n.jsx("div",{className:"mdocs-comments-list",children:C?n.jsx("div",{className:"mdocs-comments-empty",children:"加载中..."}):f.length===0?n.jsx("div",{className:"mdocs-comments-empty",children:"暂无评论,来发表第一条吧~"}):f.map(I=>n.jsxs("div",{className:"mdocs-comment-root",children:[n.jsxs("div",{className:"mdocs-comment-header",children:[n.jsx("span",{className:"mdocs-comment-avatar",children:I.visitorName.charAt(0).toUpperCase()}),n.jsx("span",{className:"mdocs-comment-author",children:I.visitorName}),n.jsx("span",{className:"mdocs-comment-time",children:fe(I.createdAt)}),T(I)&&n.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>h(I.commentId),title:"删除",children:n.jsx(Ee,{size:14})})]}),n.jsx("div",{className:"mdocs-comment-content",children:I.content}),t&&n.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>y({commentId:I.commentId,visitorName:I.visitorName}),children:"回复"}),(F.get(I.commentId)??[]).length>0&&n.jsx("div",{className:"mdocs-comment-replies",children:(F.get(I.commentId)??[]).map(S=>n.jsxs("div",{className:"mdocs-comment-reply",children:[n.jsxs("div",{className:"mdocs-comment-header",children:[n.jsx("span",{className:"mdocs-comment-avatar mdocs-comment-avatar-small",children:S.visitorName.charAt(0).toUpperCase()}),n.jsx("span",{className:"mdocs-comment-author",children:S.visitorName}),S.replyToVisitorName&&n.jsxs("span",{className:"mdocs-comment-reply-to",children:["回复 ",S.replyToVisitorName]}),n.jsx("span",{className:"mdocs-comment-time",children:fe(S.createdAt)}),T(S)&&n.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>h(S.commentId),title:"删除",children:n.jsx(Ee,{size:12})})]}),n.jsx("div",{className:"mdocs-comment-content",children:S.content}),t&&n.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>y({commentId:I.commentId,visitorName:S.visitorName}),children:"回复"})]},S.commentId))})]},I.commentId))}),t?n.jsxs("div",{className:"mdocs-comments-input-wrapper",children:[n.jsx("div",{className:"mdocs-comments-input-drag-handle",onMouseDown:Xe}),m&&n.jsxs("div",{className:"mdocs-comment-reply-notice",children:[n.jsxs("span",{children:["回复 ",n.jsx("span",{className:"mdocs-comment-reply-to-name",children:m.visitorName})]}),n.jsxs("button",{type:"button",onClick:()=>y(null),children:[n.jsx(Ee,{size:14})," 取消"]})]}),n.jsx("textarea",{ref:_,value:c,onChange:I=>{g(I.target.value.slice(0,512)),setTimeout(()=>P(),0)},placeholder:m?`回复 ${m.visitorName}...`:"发表评论...",className:"mdocs-comments-input",style:{height:A},maxLength:512,onKeyDown:I=>{I.key==="Enter"&&(I.metaKey||I.ctrlKey)&&Oe()}}),n.jsxs("div",{className:`mdocs-comments-char-count${c.length>=460?" mdocs-char-count--warn":""}`,children:[c.length,"/512"]}),n.jsx("div",{className:"mdocs-comments-input-actions",children:n.jsx("button",{type:"button",className:"mdocs-btn-primary",onClick:Oe,disabled:N||!c.trim(),children:N?"发表中...":"发表"})})]}):n.jsx("div",{className:"mdocs-comments-input-wrapper",style:{textAlign:"center"},children:n.jsx("div",{style:{color:"#666",fontSize:"0.9rem"},children:"请先创建访客身份以发表评论"})}),R&&n.jsx(vn,{title:"删除评论",message:"确定要删除这条评论吗?",confirmLabel:"删除",danger:!0,onConfirm:()=>ke(R),onCancel:()=>h(null)})]})}const Ni="mdocs-drafts",Pi=4,G="drafts",De={DOC_NOT_FOUND:"DOC_NOT_FOUND",SYNC_HEAD_MISSING:"SYNC_HEAD_MISSING"};let dt=null;function Se(){return dt||(dt=new Promise((e,t)=>{const i=indexedDB.open(Ni,Pi);i.onupgradeneeded=r=>{const s=i.result;s.objectStoreNames.contains(G)||s.createObjectStore(G,{keyPath:"documentId"});const d=r.oldVersion;if(d>0&&d<4){const g=i.transaction.objectStore(G).openCursor();g.onsuccess=()=>{const m=g.result;if(!m)return;const y=m.value;typeof y.baseCommitId=="string"&&!y.localBaseCommitId&&(y.localBaseCommitId=y.baseCommitId,delete y.baseCommitId);const C=y.conflict;C&&(typeof C.baseCommitId=="string"&&!C.localBaseCommitId&&(C.localBaseCommitId=C.baseCommitId,delete C.baseCommitId),typeof C.expectedHeadCommitId=="string"&&!C.remoteCommitId&&(C.remoteCommitId=C.expectedHeadCommitId,delete C.expectedHeadCommitId)),m.update(y),m.continue()}}},i.onsuccess=()=>e(i.result),i.onerror=()=>t(i.error)})),dt}async function Ti(e){var r;const t=await K(e.documentId),i={documentId:e.documentId,content:e.content,displayName:e.displayName,updatedAt:Date.now(),published:!1};if(t!=null&&t.localBaseCommitId)i.localBaseCommitId=t.localBaseCommitId;else{const s=(r=e.localBaseCommitIdAtEditStart)==null?void 0:r.trim();s&&(i.localBaseCommitId=s)}(t==null?void 0:t.permission)!=null?i.permission=t.permission:e.snapshotMeta&&(i.permission=e.snapshotMeta.permission),t!=null&&t.ownerVisitorId?i.ownerVisitorId=t.ownerVisitorId:e.snapshotMeta&&(i.ownerVisitorId=e.snapshotMeta.ownerVisitorId),t!=null&&t.domainId?i.domainId=t.domainId:e.snapshotMeta&&(i.domainId=e.snapshotMeta.domainId),t!=null&&t.publishError&&(i.publishError=t.publishError,i.publishErrorAt=t.publishErrorAt),t!=null&&t.conflictStatus&&(i.conflictStatus=t.conflictStatus),t!=null&&t.conflict&&(i.conflict=t.conflict),await he(i)}function xt(e){const t={documentId:e.documentId,content:e.content,displayName:e.displayName,updatedAt:e.updatedAt,published:e.published};return e.permission!=null&&(t.permission=e.permission),e.ownerVisitorId&&(t.ownerVisitorId=e.ownerVisitorId),e.domainId&&(t.domainId=e.domainId),e.publishError!=null&&(t.publishError=e.publishError),e.publishErrorAt!=null&&(t.publishErrorAt=e.publishErrorAt),e.localBaseCommitId&&(t.localBaseCommitId=e.localBaseCommitId),e.conflictStatus!=null&&(t.conflictStatus=e.conflictStatus),e.conflict!=null&&(t.conflict=e.conflict),t}async function he(e){const t=await Se(),i=xt(e);return new Promise((r,s)=>{const d=t.transaction(G,"readwrite");d.objectStore(G).put(i),d.oncomplete=()=>r(),d.onerror=()=>s(d.error)})}async function K(e){const t=await Se();return new Promise((i,r)=>{const d=t.transaction(G,"readonly").objectStore(G).get(e);d.onsuccess=()=>i(d.result),d.onerror=()=>r(d.error)})}async function ct(e){const t=await Se();return new Promise((i,r)=>{const s=t.transaction(G,"readwrite");s.objectStore(G).delete(e),s.oncomplete=()=>i(),s.onerror=()=>r(s.error)})}async function Ai(e){const t=await Se();return new Promise((i,r)=>{const d=t.transaction(G,"readonly").objectStore(G).getAll();d.onsuccess=()=>{let u=d.result;e!=null&&e.skipFailed&&(u=u.filter(c=>!c.publishError)),i(u)},d.onerror=()=>r(d.error)})}async function Ei(e,t){const i=await Se();return new Promise((r,s)=>{const u=i.transaction(G,"readwrite").objectStore(G),c=u.get(e);c.onsuccess=()=>{const g=c.result;g&&u.put(xt({...g,publishError:t,publishErrorAt:Date.now()})),r()},c.onerror=()=>s(c.error)})}async function lt(e){const t=await Se();return new Promise((i,r)=>{const d=t.transaction(G,"readwrite").objectStore(G),u=d.get(e);u.onsuccess=()=>{const c=u.result;c&&d.put(xt({...c,publishError:void 0,publishErrorAt:void 0})),i()},u.onerror=()=>r(u.error)})}async function an(e,t){const i=await K(e);i&&await he({...i,localBaseCommitId:t.localBaseCommitId,conflictStatus:t.conflictStatus,conflict:t.conflict})}async function mt(e){const t=await K(e);t&&await he({...t,conflict:void 0,conflictStatus:"none"})}class Re extends Error{constructor(i,r){super(i);Ie(this,"code");Ie(this,"cause");this.name="DraftPublishAborted",this.code=i,this.cause=r==null?void 0:r.cause}}function ji(e){return e instanceof Re?e.code:e instanceof ae?e.status===404?De.DOC_NOT_FOUND:e.code||`HTTP_${e.status}`:e instanceof Error&&e.message.trim()?e.message.trim().slice(0,120):"UNKNOWN"}function Mi(e,t,i,r){const s=(t==null?void 0:t.displayName)||e("unknownTitle");if(i===De.SYNC_HEAD_MISSING)return e("draftPublishFailedSyncHead",{name:s});if(i===De.DOC_NOT_FOUND)return e("draftPublishFailedNotice",{name:s});const d=r instanceof ae||r instanceof Error&&r.message?r.message:i;return e("draftPublishFailedGeneric",{name:s,reason:d})}async function Ri(e,t,i){const r=ji(t);throw await Ei(e,r),t instanceof Re?t:new Re(r,{cause:t})}function Oi(e,t){const i=a.useRef(t);i.current=t,a.useEffect(()=>{if(!e)return;const r=3e4,s=1e4,d=async()=>{const c=await Ai({skipFailed:!0}),g=Date.now();for(const m of c)if(!m.published&&!(g-m.updatedAt<r))try{await i.current(m.documentId)}catch(y){console.log("[autoPublish] scan publish failed:",y)}};d();const u=setInterval(d,s);return()=>clearInterval(u)},[e])}const Li=1e4;function Fi(e,t){const[i,r]=a.useState(null),[s,d]=a.useState("up_to_date");return a.useEffect(()=>{if(!e){r(null),d("up_to_date");return}let c=!1;const g=e;async function m(){try{const C=await Jo(g,t??void 0);if(c)return;r(C.headCommitId),d(C.status)}catch{}}m();const y=window.setInterval(()=>void m(),Li);return()=>{c=!0,window.clearInterval(y)}},[e,t]),{remoteCommitId:i,syncStatus:s,syncBehind:!!(t&&i&&t!==i)||s==="behind"}}const _i="/assets/mdocs-logo-Dsv_2t6v.svg",Bi=a.lazy(()=>Ce(()=>import("./DocumentEditor-BmmnuieO.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(e=>({default:e.DocumentEditor}))),$i=a.lazy(()=>Ce(()=>import("./SettingsPage-Fl5Tu7u3.js"),__vite__mapDeps([11,1,10,2,3])).then(e=>({default:e.SettingsPage}))),Hi=a.lazy(()=>Ce(()=>import("./AgentChatPanel-CtdLYtSw.js"),__vite__mapDeps([12,1,13,7,2,3,8])).then(e=>({default:e.AgentChatPanel}))),Ui=a.lazy(()=>Ce(()=>import("./AiWriteWorkbench-hUYjin2m.js"),__vite__mapDeps([14,1,13,7,2,3])).then(e=>({default:e.AiWriteWorkbench}))),Vi=a.lazy(()=>Ce(()=>import("./MergeView-CjhCBNPa.js"),__vite__mapDeps([15,1,4,5,2,3,6,7,8])).then(e=>({default:e.MergeView})));function Wi(e,t){try{const i=new Intl.RelativeTimeFormat(t,{numeric:"auto"}),r=Date.now()-new Date(e).getTime(),s=Math.floor(r/6e4),d=Math.floor(s/60),u=Math.floor(d/24);return u>30?i.format(-Math.floor(u/30),"month"):u>0?i.format(-u,"day"):d>0?i.format(-d,"hour"):s>0?i.format(-s,"minute"):i.format(-Math.floor(r/1e3),"second")}catch{return e.slice(0,10)}}async function ut(e,t,i,r){const s=await fn();t(s);const d=localStorage.getItem("mdocs.currentDomainId"),c=d&&s.some(g=>g.domainId===d)?d:ri(s,e);i(c),await r(c)}function sn(){const{t:e,lang:t,setLang:i}=ce(),[r,s]=a.useState("loading"),[d,u]=a.useState(()=>localStorage.getItem("mdocs.sidebarCollapsed")==="true"),c=Ci(),[g,m]=a.useState(!1),y=()=>{if(c){m(p=>!p);return}const o=!d;u(o),localStorage.setItem("mdocs.sidebarCollapsed",String(o))};a.useEffect(()=>{c||m(!1)},[c]);const[C,b]=a.useState(!1),[N,M]=a.useState(0),R=a.useRef(null),[h,D]=a.useState(null),[w,E]=a.useState(null),[k,A]=a.useState(null),[H,U]=a.useState([]),[q,Y]=a.useState([]),[L,_]=a.useState("default"),{documentId:P}=Qn(),T=Zn(),[f,F]=a.useState(null),[Q,V]=a.useState(null),ye=a.useRef(Q);ye.current=Q;const[Oe,ke]=a.useState(0),[fe,ve]=a.useState(null),[Xe,I]=a.useState(!1),[S,B]=a.useState(!1),[$,Z]=a.useState(!1),In=(f==null?void 0:f.documentId)??null,{syncBehind:Qe,remoteCommitId:Ze}=Fi(In,fe),[It,et]=a.useState(null);a.useEffect(()=>{if(!S||!f){et(null);return}(async()=>{const o=await K(f.documentId);if(o!=null&&o.conflict){et(o.conflict);return}if(o&&fe&&Ze){const p=o.localBaseCommitId??fe;if(!p)return;const l={localBaseCommitId:p,remoteCommitId:Ze,localSnapshotContent:o.content};await an(f.documentId,{localBaseCommitId:l.localBaseCommitId,conflictStatus:"diverged",conflict:l}),et(l)}})()},[S,f,fe,Ze]),a.useEffect(()=>{!f||!Qe||!$||K(f.documentId).then(async o=>{!o||o.conflict||o.conflictStatus==="publish_conflict"||o.conflictStatus!=="diverged"&&await he({...o,conflictStatus:"diverged"})})},[f==null?void 0:f.documentId,Qe,$]),a.useEffect(()=>{if(!f){ve(null);return}let o=!1;return K(f.documentId).then(p=>{o||(p&&!p.published&&p.localBaseCommitId?ve(p.localBaseCommitId):ve(f.headCommitId??null))}),()=>{o=!0}},[f==null?void 0:f.documentId,f==null?void 0:f.headCommitId,$]);const[Ne,W]=a.useState(null),[Dt,X]=a.useState(null),[J,Le]=a.useState(null),[Pe,Ct]=a.useState(null),[St,ee]=a.useState(""),[Dn,Fe]=a.useState("docs"),[_e,be]=a.useState(!1),[kt,Cn]=bi(),Nt=a.useRef(null),[Sn,Be]=a.useState(!1),[$e,He]=a.useState(null),te=a.useRef(void 0),Ue=a.useRef(void 0);Oi(localStorage.getItem("mdocs.autoPublish")==="true",Lt);async function ne(o){var p;await((p=te.current)==null?void 0:p.call(te)),o()}function kn(o){const l=(o.trim()||"untitled").replace(/[\\/:*?"<>|]/g,"-").slice(0,80);return l.endsWith(".md")?l:`${l}.md`}async function Nn(){var p,l;if(!f||!Q)return;await((p=te.current)==null?void 0:p.call(te));let o=((l=Ue.current)==null?void 0:l.call(Ue))??"";if(!o.trim())try{o=(await st({content:Q.content,from:"lexical",to:"markdown"})).content}catch{o=""}He({markdown:o,documentId:f.documentId,displayName:Q.displayName||f.displayName||"未命名"}),Be(!0),be(!1)}function Pn(){He({markdown:"",documentId:null,displayName:"未命名"}),Be(!0),be(!1)}async function Tn(o){var j,O;const p=o.documentId.trim();if(!p)return;await((j=te.current)==null?void 0:j.call(te));let l="",x=o.displayName.trim()||"未命名";try{const oe=await Me(p);x=((O=oe.displayName)==null?void 0:O.trim())||x;try{l=(await st({content:oe.content,from:"lexical",to:"markdown"})).content}catch{l=""}}catch{}He({markdown:l,documentId:p,displayName:x}),Be(!0),be(!1),Fe("docs"),ne(()=>T(`/doc/${p}`))}async function An(o){(f==null?void 0:f.documentId)===o.documentId&&await Ot()}async function En(o){if(o.documentId){if(!window.confirm("将把帮写结果写入当前文档的本地草稿(不会自动发布)。继续?")){const O=new Error("cancelled");throw O.silent=!0,O}const x=await st({content:o.markdown,from:"markdown",to:"lexical"}),j=(f==null?void 0:f.documentId)===o.documentId?f:null;return await Ti({documentId:o.documentId,content:x.content,displayName:o.displayName,localBaseCommitIdAtEditStart:(j==null?void 0:j.headCommitId)??null,snapshotMeta:j?{permission:j.permission,ownerVisitorId:j.ownerVisitorId,domainId:j.domainId}:void 0}),(f==null?void 0:f.documentId)===o.documentId?(V({documentId:o.documentId,content:x.content,displayName:o.displayName}),ke(O=>O+1),Z(!0)):await Te(o.documentId),W("帮写已写入草稿,可在编辑器中继续修改后发布"),{documentId:o.documentId}}const p=await un({fileName:kn(o.displayName),displayName:o.displayName,content:o.markdown,contentFormat:"markdown",domainId:L||void 0,parentId:void 0});return await z(),await Te(p.documentId),W("已创建文档"),{documentId:p.documentId}}a.useEffect(()=>{jn()},[]),a.useEffect(()=>{if(!Ne)return;const o=()=>{W(null)};return window.addEventListener("pointerdown",o,!0),()=>window.removeEventListener("pointerdown",o,!0)},[Ne]),a.useEffect(()=>{const o=p=>{var j,O;const l=p;if(((j=l.detail)==null?void 0:j.status)===409)return;const x=(O=l.detail)==null?void 0:O.message;x&&X(x)};return window.addEventListener(pt,o),()=>window.removeEventListener(pt,o)},[]);async function jn(){try{const o=await Xt();D(o),Je(o.visitorId),await ut(o.visitorId,Y,_,z),s("ready")}catch(o){if(o instanceof ae&&o.status===401){s("needsRegister");return}X(me(e,o)),s("needsRegister")}}async function Mn(o,p){const l=await Vo(o,p);D(l.visitor),E(l.visitor.visitorId),A(l.recoveryCode),Je(l.visitor.visitorId),await ut(l.visitor.visitorId,Y,_,z),s("ready")}async function Rn(o){const p=await Xt();D(p),await ut(p.visitorId,Y,_,z),s("ready")}async function z(o){const l=await Go(o??L);U(l)}function Ve(o){V({documentId:o.documentId,content:o.content,displayName:o.displayName}),ke(p=>p+1),Z(!1)}function On(o,p){V({documentId:o,content:p.content,displayName:p.displayName}),ke(l=>l+1),Z(!0)}async function Pt(o,p){await ct(o);const l=await Me(o);if((f==null?void 0:f.documentId)===o&&R.current===o){F(je(l)),Z(!1);const x=ye.current,j=p!==void 0&&l.content===p,O=(x==null?void 0:x.documentId)===o&&x.content===l.content;j||O?(x==null?void 0:x.documentId)===o&&x.displayName!==l.displayName&&V({...x,displayName:l.displayName}):Ve(l)}return l}async function Te(o){R.current=o;try{const p=await K(o);if(R.current!==o)return;const l=await Me(o);if(R.current!==o||(l.domainId!==L&&(localStorage.setItem("mdocs.currentDomainId",l.domainId),_(l.domainId),z(l.domainId)),ee(Ge(l.relativePath)),l.headCommitId&&p&&!p.published&&(p.publishError===De.SYNC_HEAD_MISSING&&await lt(o),p.localBaseCommitId||await he({...p,localBaseCommitId:l.headCommitId})),F(je(l)),R.current!==o))return;p&&!p.published?On(o,p):Ve(l)}catch(p){if(R.current!==o)return;X(me(e,p))}}a.useEffect(()=>{r==="ready"&&(P?Te(P):(F(null),V(null),ve(null)))},[r,P]);const{createModal:we,setCreateModal:tt,createModalError:Tt,createModalBusy:xe,createModalInputRef:Ln,openNewDocumentModal:nt,openNewFolderModal:ot,submitCreateModal:Fn}=Di({tree:H,currentDomainId:L,selectedCreateParentPath:St,t:e,onDocCreated:o=>{F(je(o)),Ve(o),ee(Ge(o.relativePath)),T(`/doc/${o.documentId}`)},refreshTree:z}),[_n,We]=a.useState(!1),[Bn,Ae]=a.useState(!1),[pe,At]=a.useState([]),[it,Et]=a.useState(""),[ze,jt]=a.useState(""),[$n,Mt]=a.useState(new Set);async function Hn(){try{const o=await Zo();At(o)}catch(o){X(me(e,o))}}const rt=a.useMemo(()=>{const o={};for(const p of q)o[p.domainId]=p.domainName;return o},[q]),Rt=a.useMemo(()=>{let o=pe;const p=it.trim().toLowerCase();return p&&(o=o.filter(l=>{var x;return(x=l.displayName)==null?void 0:x.toLowerCase().includes(p)})),ze&&(o=o.filter(l=>l.domainId===ze)),o},[pe,it,ze]),Un=a.useMemo(()=>{const o=new Set,p=[];for(const l of pe){const x=l.domainId;x&&!o.has(x)&&(o.add(x),p.push({id:x,name:rt[x]??x}))}return p},[pe,rt]);async function Vn(o,p,l,x,j){let O=await K(o);!O&&(f==null?void 0:f.documentId)===o&&(O={documentId:o,content:p,displayName:l,updatedAt:Date.now(),published:!1,localBaseCommitId:x,permission:f.permission,ownerVisitorId:f.ownerVisitorId,domainId:f.domainId},await he(O)),O&&await an(o,{localBaseCommitId:x,conflictStatus:"publish_conflict",conflict:{localBaseCommitId:x,remoteCommitId:j.headCommitId,localSnapshotContent:p}}),I(!0)}async function Wn(o,p,l,x){return zt(l).execute(async()=>{const j=await K(l),O=(j==null?void 0:j.localBaseCommitId)??(f==null?void 0:f.headCommitId);if(!O)throw X(e("syncHeadMissing")),new Error("missing localBaseCommitId");try{await Qt(l,{content:o,displayName:p,permission:x,version:{localBaseCommitId:O}}),await mt(l),await Pt(l,o),await z(),I(!1),W(e("published")),window.setTimeout(()=>W(null),1200)}catch(oe){throw oe instanceof ae&&oe.status===409&&oe.code==="VERSION_CONFLICT"&&oe.details&&typeof oe.details=="object"&&await Vn(l,o,p,O,oe.details),oe}})}async function zn(){if(!f)return;const o=await Me(f.documentId);o.domainId!==L&&(localStorage.setItem("mdocs.currentDomainId",o.domainId),_(o.domainId),z(o.domainId)),ee(Ge(o.relativePath)),F(je(o)),Ve(o),W(e("syncPullDone")),window.setTimeout(()=>W(null),1200)}async function Ot(){if(!f)return;const o=await K(f.documentId);if(o&&!o.published)return;if((o==null?void 0:o.conflictStatus)==="publish_conflict"||(o==null?void 0:o.conflictStatus)==="diverged"||!!(o!=null&&o.conflict)){B(!0);return}await zn()}async function qn(o){await mt(o.documentId),await ct(o.documentId),Z(!1),B(!1),I(!1),await Te(o.documentId),z(o.domainId),W(e("published")),window.setTimeout(()=>W(null),1200)}async function Gn(o,p,l){try{await Ri(o,p,l)}catch(x){if(!(x instanceof Re))throw x;const j=l??await K(o);throw W(Mi(e,j,x.code,x.cause??p)),window.setTimeout(()=>W(null),4e3),x}}async function Lt(o){let p;try{await zt(o).execute(async()=>{const l=await K(o);if(!l)return;p=l;let x=l.localBaseCommitId;if(x||(x=(await Me(o)).headCommitId??void 0,x&&(await he({...l,localBaseCommitId:x}),l.publishError===De.SYNC_HEAD_MISSING&&await lt(o))),!x)throw new Re(De.SYNC_HEAD_MISSING);const j=await K(o);j&&(await Qt(o,{content:j.content,displayName:j.displayName,version:{localBaseCommitId:x}}),await mt(o),await lt(o),(f==null?void 0:f.documentId)===o?await Pt(o,j.content):await ct(o),await z(),W(e("published")),window.setTimeout(()=>W(null),1200))})}catch(l){await Gn(o,l,p)}}function Ft(o,p){Le({type:"document",id:o,name:p})}function _t(o,p){Le({type:"folder",id:o,name:p})}async function Jn(o,p){try{const l=await Ko(o,p);await z(l.domainId),(f==null?void 0:f.documentId)===o&&(F(je(l)),ee(Ge(l.relativePath)))}catch(l){l instanceof ae?l.status===409&&X(l.message):X(me(e,l))}}async function Yn(){if(J)try{J.type==="document"?(await Yo(J.id),(f==null?void 0:f.documentId)===J.id&&(F(null),V(null),ee(""),T("/"))):J.type==="folder"&&(await Qo(J.id),f&&(F(null),V(null),ee(""),T("/"))),await z(),W(J.type==="folder"?`已删除「${J.name}」及其下所有内容`:`已删除「${J.name}」`),window.setTimeout(()=>W(null),2e3)}catch(o){X(me(e,o))}finally{Le(null)}}return r==="loading"?n.jsx("div",{className:"mdocs-loading muted",children:e("loading")}):r==="needsRegister"?n.jsx(ai,{onSubmit:Mn,onRecover:Rn,error:Ne}):n.jsxs("div",{className:"mdocs-app-root",children:[mn(),n.jsxs("div",{className:"mdocs-shell",children:[w&&h&&n.jsx(si,{visitorId:w,onDismiss:()=>E(null)}),k&&n.jsx("div",{className:"mdocs-dialog-backdrop",style:{position:"fixed",zIndex:9999},onClick:o=>{o.target===o.currentTarget&&A(null)},children:n.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:480,textAlign:"center"},children:[n.jsx("h1",{style:{fontSize:"1.25rem",marginBottom:8},children:"🔑 保存你的恢复码"}),n.jsxs("p",{className:"muted",style:{marginBottom:16,lineHeight:1.5},children:["恢复码是你的唯一凭证,当 Token 丢失时可用它找回身份。",n.jsx("br",{}),n.jsx("strong",{children:"请立即复制保存,此弹窗关闭后不可再查看。"})]}),n.jsx("div",{style:{background:"#f5f5f5",borderRadius:8,padding:"12px 16px",fontFamily:"monospace",fontSize:"1.25rem",letterSpacing:"0.1em",marginBottom:20,userSelect:"all"},children:k}),n.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:[n.jsx("button",{type:"button",className:"primary",onClick:()=>{navigator.clipboard.writeText(k)},children:"复制恢复码"}),n.jsx("button",{type:"button",onClick:()=>A(null),children:"已保存,关闭"})]})]})}),n.jsxs(n.Fragment,{children:[n.jsx(vi,{open:_e,onToggle:()=>{var o;_e?(o=Nt.current)==null||o.requestClose():be(!0)},position:kt,onPositionChange:Cn}),_e?n.jsx(a.Suspense,{fallback:null,children:n.jsx(Hi,{ref:Nt,open:_e,onClose:()=>be(!1),visitorName:h==null?void 0:h.visitorName,anchorStyle:yi(kt),onOpenDocument:o=>{Fe("docs"),ne(()=>T(`/doc/${o}`)),be(!1)},onTreeChanged:()=>void z(),onDocumentOverwritten:o=>void An(o),onOpenCoding:o=>void Tn(o)})}):null]}),$e?n.jsx(a.Suspense,{fallback:null,children:n.jsx(Ui,{open:Sn,initialMarkdown:$e.markdown,documentId:$e.documentId,displayName:$e.displayName,onClose:()=>{Be(!1),He(null)},onComplete:En})}):null,Dn==="settings"?n.jsx(a.Suspense,{fallback:n.jsx("div",{className:"mdocs-main muted",style:{padding:24},children:"加载设置…"}),children:n.jsx($i,{onBack:()=>Fe("docs"),onPublishDraft:Lt,onOpenDocument:Te,onRecoverDraft:()=>void z()})}):n.jsxs("div",{className:"mdocs-layout"+(c?" mdocs-layout--reader":""),children:[c&&g?n.jsx("button",{type:"button",className:"mdocs-mobile-nav-scrim","aria-label":e("collapseSidebar"),onClick:()=>m(!1)}):null,n.jsxs("aside",{className:"mdocs-sidebar"+(c?g?" mdocs-sidebar--drawer-open":" mdocs-sidebar--drawer":d?" mdocs-sidebar-collapsed":""),children:[n.jsxs("header",{className:"mdocs-sidebar-header",children:[n.jsxs("div",{className:"mdocs-brand",children:[n.jsx("img",{src:_i,alt:e("brand"),className:"mdocs-brand-logo"}),n.jsx("span",{children:e("brand")})]}),n.jsx("button",{type:"button",className:"mdocs-sidebar-toggle",onClick:y,"aria-label":e(c?g?"collapseSidebar":"expandSidebar":d?"expandSidebar":"collapseSidebar"),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:o=>{o.currentTarget.style.background="var(--mdocs-hover-bg, #f0f0f0)"},onMouseLeave:o=>{o.currentTarget.style.background="none"},children:c?n.jsx(Ut,{size:18}):d?n.jsx(Vt,{size:18}):n.jsx(Ut,{size:18})})]}),n.jsxs("div",{className:"mdocs-sidebar-actions",children:[n.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":e("newDocument"),onClick:()=>nt(),style:{color:"var(--mdocs-accent)"},children:n.jsx($t,{size:20})}),n.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":e("newFolder"),onClick:()=>ot(),children:n.jsx(Ht,{size:20})})]}),n.jsx(di,{nodes:H,activeDocumentId:P??null,selectedParentPath:St,onOpen:o=>{c&&m(!1),ne(()=>T(`/doc/${o.documentId}`))},onOpenFolder:(o,p)=>{ne(()=>{ee(o),p&&(c&&m(!1),T(`/doc/${p}`))})},onContextMenu:Ct,onMoveDocument:Jn,onDeselect:()=>{ne(()=>{ee(""),T("/")})}}),n.jsxs("footer",{className:"mdocs-sidebar-footer",children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,cursor:"pointer"},onClick:()=>ne(()=>Fe("settings")),children:[n.jsx("span",{className:"mdocs-visitor-avatar",children:h?h.visitorName.charAt(0).toUpperCase():"?"}),n.jsx("span",{className:"mdocs-visitor-footer-name",children:h?h.visitorName:""})]}),n.jsx("button",{type:"button",className:"mdocs-sidebar-bookmark mdocs-tooltip","data-tooltip":e("bookmark"),onClick:()=>{Ae(!0),Et(""),jt(""),Hn()},style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",fontSize:"1rem",lineHeight:1,borderRadius:4},children:n.jsx(Co,{size:16,strokeWidth:1.5})}),n.jsx("button",{type:"button",className:"mdocs-sidebar-logout mdocs-tooltip","data-tooltip":e("logout"),onClick:()=>We(!0),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4},children:n.jsx(vo,{size:16,strokeWidth:1.5})})]})]}),n.jsxs("main",{className:"mdocs-main",children:[f&&Q&&Q.documentId===f.documentId?n.jsxs("div",{className:"mdocs-editor-with-comments",children:[n.jsx("div",{className:"mdocs-editor-container",children:n.jsx(a.Suspense,{fallback:n.jsx("div",{className:"muted",style:{padding:24},children:"加载编辑器…"}),children:n.jsx(Bi,{meta:f,initialContent:Q.content,initialDisplayName:Q.displayName,contentRevision:Oe,canEdit:!!(h&&(f.ownerVisitorId===h.visitorId||jo(f.permission)||f.invitedEdit===!0)),domains:q,currentDomainId:L,onDomainChange:o=>{ne(()=>{localStorage.setItem("mdocs.currentDomainId",o),_(o),F(null),V(null),ee(""),T("/"),z(o)})},onDomainsChange:Y,onPublish:Wn,syncBehind:Qe,onSyncClick:()=>void Ot(),onDraftExistsChange:Z,onConflictModalRequest:()=>I(!0),onMergeRequest:()=>B(!0),canManageInvites:!!(h&&h.visitorId===f.ownerVisitorId),onDelete:async()=>{if(f.relativePath.endsWith("/___desc___.md")){const o=f.relativePath.replace(/\/___desc___\.md$/,"");_t(f.documentId,o)}else Ft(f.documentId,f.relativePath)},saveBeforeNavRef:te,exportMarkdownRef:Ue,onShowToast:W,onShowError:X,onToggleComments:()=>b(!C),commentPanelOpen:C,commentCount:N,onAiWrite:()=>void Nn(),readerChrome:c,onOpenMobileNav:()=>m(!0)},f.documentId)})}),C&&n.jsx(ki,{documentId:f.documentId,visitorId:h==null?void 0:h.visitorId,visitorName:h==null?void 0:h.visitorName,documentOwnerId:f.ownerVisitorId,onClose:()=>b(!1)})]}):n.jsxs("div",{className:"mdocs-welcome",children:[c?n.jsxs("button",{type:"button",className:"mdocs-reader-float-pill",onClick:()=>m(!0),"aria-label":e("expandSidebar"),children:[n.jsx(Vt,{size:18,strokeWidth:1.75}),n.jsx("span",{children:e("brand")})]}):null,n.jsx("h1",{children:e("brand")}),n.jsx("p",{className:"muted mdocs-welcome-lead",children:H.length===0?e("noDocsInDomain"):e("createDocToStart")}),n.jsxs("div",{className:"mdocs-welcome-domain",children:[n.jsx("label",{className:"muted mdocs-welcome-domain-label",children:e("domainLabel")}),n.jsx(fi,{domains:q.length?q:[{domainId:"default",domainName:e("defaultDomain"),permission:"",creatorVisitorId:"",docCount:0}],value:L,onChange:o=>{ne(()=>{localStorage.setItem("mdocs.currentDomainId",o),_(o),F(null),V(null),ee(""),T("/"),z(o)})},onDomainsChange:Y,ariaLabel:e("domainLabel"),localizeName:o=>xi(o,t,e)})]}),n.jsxs("div",{className:"mdocs-welcome-actions",children:[n.jsxs("button",{type:"button",className:"primary",onClick:()=>nt(),style:{display:"flex",alignItems:"center",gap:6},children:[n.jsx($t,{size:16,strokeWidth:1.5}),e("newDocument")]}),n.jsxs("button",{type:"button",className:"secondary",onClick:()=>ot(),style:{display:"flex",alignItems:"center",gap:6},children:[n.jsx(Ht,{size:16,strokeWidth:1.5}),e("newFolder")]}),n.jsxs("button",{type:"button",className:"secondary",onClick:()=>Pn(),style:{display:"flex",alignItems:"center",gap:6},children:[n.jsx("img",{src:yn,alt:"",width:16,height:16,style:{display:"block"}}),"AI 帮写"]})]})]}),n.jsx(Si,{open:Xe,onClose:()=>I(!1),onResolve:()=>{I(!1),B(!0)}}),S&&f&&It&&n.jsx(a.Suspense,{fallback:n.jsx("div",{className:"merge-view-loading",children:e("mergeLoadingRemote")}),children:n.jsx(Vi,{documentId:f.documentId,displayName:f.displayName,conflict:It,onClose:()=>B(!1),onSuccess:qn,onError:o=>X(o)})}),Ne&&n.jsx("div",{className:"mdocs-toast",role:"status",children:Ne}),Dt&&n.jsx(wi,{title:e("error"),message:Dt,onClose:()=>X(null)})]}),_n&&n.jsx("div",{className:"mdocs-dialog-backdrop",onClick:o=>{o.target===o.currentTarget&&We(!1)},children:n.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:440},children:[n.jsx("h1",{style:{fontSize:"1.125rem",marginBottom:8},children:"退出当前登录身份?"}),n.jsx("p",{style:{lineHeight:1.6,color:"var(--mdocs-text-secondary, #666)",marginBottom:20},children:"这将会导致您无法修改以前的文章。如果想找回账号,需要恢复码或联系管理员执行合并用户脚本。"}),n.jsxs("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:()=>We(!1),children:"取消"}),n.jsx("button",{type:"button",className:"primary",style:{background:"#d32f2f"},onClick:()=>{Uo(),F(null),V(null),D(null),U([]),We(!1),s("needsRegister")},children:"确认退出"})]})]})}),Bn&&n.jsx("div",{className:"mdocs-dialog-backdrop",onClick:o=>{o.target===o.currentTarget&&Ae(!1)},children:n.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:640,width:"min(640px, 100%)",maxHeight:"70vh",display:"flex",flexDirection:"column"},children:[n.jsxs("h1",{style:{fontSize:"1.125rem",marginBottom:16},children:[e("bookmarkTitle"),"(",pe.length,")"]}),pe.length>0&&n.jsxs("div",{className:"mdocs-bookmark-filterbar",children:[n.jsx("input",{type:"text",placeholder:e("bookmarkSearch"),value:it,onChange:o=>Et(o.target.value)}),n.jsxs("select",{value:ze,onChange:o=>jt(o.target.value),children:[n.jsx("option",{value:"",children:e("bookmarkFilterAll")}),Un.map(o=>n.jsx("option",{value:o.id,children:o.name},o.id))]})]}),pe.length===0?n.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkEmpty")}):Rt.length===0?n.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkNoMatch")}):n.jsx("div",{style:{overflowY:"auto",flex:1,margin:"0 -1rem",padding:"0 1rem"},children:n.jsxs("table",{className:"mdocs-bookmark-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{children:e("bookmarkColTitle")}),n.jsx("th",{children:e("bookmarkColDomain")}),n.jsx("th",{children:e("bookmarkColAuthor")}),n.jsx("th",{children:e("bookmarkColTime")}),n.jsx("th",{className:"mdocs-bookmark-col-action"})]})}),n.jsx("tbody",{children:Rt.map(o=>{const p=$n.has(o.documentId);return n.jsxs("tr",{className:`${p?"mdocs-bookmark-removing":""}`,style:{opacity:o.isDeleted?.6:1},children:[n.jsx("td",{className:"mdocs-bookmark-col-title",children:n.jsxs("div",{style:{cursor:o.isDeleted?"default":"pointer",display:"flex",alignItems:"center",gap:6,overflow:"hidden"},onClick:()=>{o.isDeleted||ne(()=>{Ae(!1),T(`/doc/${o.documentId}`)})},children:[n.jsx("span",{ref:l=>{if(l){const x=l.scrollWidth>l.clientWidth;l.title=x?o.displayName??"":""}},style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:o.displayName??"(无标题)"}),o.isDeleted&&n.jsx("span",{style:{fontSize:"0.7rem",color:"#d32f2f",background:"#ffebee",padding:"1px 6px",borderRadius:4,flexShrink:0},children:"已删除"})]})}),n.jsx("td",{children:o.isDeleted?"":rt[o.domainId??""]??o.domainId??""}),n.jsx("td",{children:o.isDeleted?"":o.ownerVisitorName??"-"}),n.jsx("td",{children:o.isDeleted?"":Wi(o.bookmarkedAt,t)}),n.jsx("td",{className:"mdocs-bookmark-col-action",children:n.jsxs("div",{style:{display:"flex",gap:2,alignItems:"center",justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkOpen"),onClick:()=>{o.isDeleted||ne(()=>{Ae(!1),T(`/doc/${o.documentId}`)})},style:{background:"none",border:"none",cursor:o.isDeleted?"default":"pointer",padding:"4px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4,display:"inline-flex",alignItems:"center"},children:n.jsx(po,{size:14,strokeWidth:1.5})}),n.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkRemove"),onClick:async()=>{try{await ei(o.documentId),Mt(l=>new Set(l).add(o.documentId)),setTimeout(()=>{At(l=>l.filter(x=>x.documentId!==o.documentId)),Mt(l=>{const x=new Set(l);return x.delete(o.documentId),x})},300)}catch(l){X(me(e,l))}},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--mdocs-text-muted, #999)",fontSize:"1rem",lineHeight:1,borderRadius:4,display:"inline-flex",alignItems:"center"},onMouseEnter:l=>{l.currentTarget.style.color="#d32f2f"},onMouseLeave:l=>{l.currentTarget.style.color="var(--mdocs-text-muted, #999)"},children:"✕"})]})})]},o.documentId)})})]})}),n.jsx("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end",marginTop:16,paddingTop:16,borderTop:"1px solid var(--mdocs-border, #eee)"},children:n.jsx("button",{type:"button",onClick:()=>Ae(!1),children:e("close")})})]})}),Pe&&n.jsx(ui,{x:Pe.x,y:Pe.y,node:Pe.node,parentPath:Pe.parentPath,onClose:()=>Ct(null),onCreateChild:o=>nt(o),onCreateFolder:o=>ot(o),onDeleteDocument:o=>Ft(o.documentId,o.path),onDeleteFolder:o=>_t(o.documentId,o.folderDisplayName||o.name)}),J&&n.jsx(vn,{title:J.type==="folder"?"删除文件夹":"删除文档",message:J.type==="folder"?`确定要删除「${J.name}」及其下的所有文档和子文件夹吗?此操作不可撤销。`:`确定要删除「${J.name}」吗?`,confirmLabel:"删除",cancelLabel:"取消",onConfirm:Yn,onCancel:()=>Le(null),danger:!0}),we&&n.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:o=>{o.target===o.currentTarget&&!xe&&tt(null)},children:n.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[n.jsx("h1",{children:we.kind==="document"?e("newDocumentTitle"):e("newFolderTitle")}),n.jsx("p",{className:"muted",children:we.kind==="document"?e("fileNameHint"):e("folderNameHint")}),n.jsxs("form",{onSubmit:Fn,className:"mdocs-dialog-form",children:[n.jsxs("label",{className:"mdocs-dialog-label",children:[we.kind==="document"?e("fileNameLabel"):e("folderNameLabel"),n.jsx("input",{ref:Ln,value:we.draft,onChange:o=>tt(p=>p&&{...p,draft:o.target.value}),placeholder:we.kind==="document"?e("untitledPlaceholder"):e("folderExamplePlaceholder"),maxLength:200,disabled:xe})]}),Tt&&n.jsx("div",{className:"mdocs-dialog-error",children:Tt}),n.jsxs("div",{className:"mdocs-dialog-actions",children:[n.jsx("button",{type:"button",onClick:()=>!xe&&tt(null),disabled:xe,children:e("cancel")}),n.jsx("button",{type:"submit",className:"primary",disabled:xe,children:e(xe?"creating":"create")})]})]})]})})]})]})]})}const zi=a.lazy(()=>Ce(()=>import("./PlaygroundPage-CgaNgQEp.js"),__vite__mapDeps([16,1,4,5,2,3,6,7,8,9])).then(e=>({default:e.PlaygroundPage})));function qi(){return n.jsxs(eo,{children:[n.jsx(at,{path:"/",element:n.jsx(sn,{})}),n.jsx(at,{path:"/doc/:documentId",element:n.jsx(sn,{})}),n.jsx(at,{path:"/playground",element:n.jsx(a.Suspense,{fallback:n.jsx("div",{style:{padding:24},children:"Loading playground…"}),children:n.jsx(zi,{})})})]})}const xn=document.getElementById("root");if(!xn)throw new Error("root element missing");to.createRoot(xn).render(n.jsx(no.StrictMode,{children:n.jsx(io,{motion:ao,children:n.jsx(ro,{children:n.jsx(Ao,{children:n.jsx(oo,{children:n.jsx(qi,{})})})})})}));export{jr as $,Re as A,tr as B,qo as C,fi as D,Yr as E,ii as F,ur as G,mr as H,lr as I,cr as J,hr as K,nr as L,wo as M,ir as N,or as O,Vt as P,rr as Q,pr as R,Co as S,fr as T,gr as U,yr as V,vr as W,Xt as X,Tr as Y,Ar as Z,Er as _,K as a,Mr as a0,Rr as a1,Ci as a2,Sr as a3,Zo as a4,Pr as a5,_i as a6,Ut as a7,mn as a8,vn as a9,sr as aa,ar as ab,Cr as ac,Or as ad,Fr as ae,Ee as af,Lr as ag,_r as ah,Br as ai,$r as aj,Jr as ak,Wr as al,Gr as am,Vr as an,Ur as ao,Hr as ap,qr as aq,zr as ar,Me as as,br as at,st as au,Qt as av,ce as b,de as c,ct as d,kr as e,dr as f,zt as g,Qi as h,yn as i,wr as j,Nr as k,xi as l,ie as m,Ir as n,xr as o,Dr as p,fn as q,ei as r,Go as s,di as t,Ti as u,un as v,me as w,Ai as x,Mi as y,lt as z};
|