@fgbg/mdocs 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-skills/changelog/SKILL.md +25 -1
- package/agent-skills/index/SKILL.md +1 -0
- package/agent-skills/index.json +8 -1
- package/agent-skills/usage-html-documents/SKILL.md +40 -0
- package/dist/server/agent/Config/config.js +26 -5
- package/dist/server/agent/Config/config.js.map +1 -1
- package/dist/server/agent/Config/config.test.js +23 -3
- package/dist/server/agent/Config/config.test.js.map +1 -1
- package/dist/server/documents/document.service.js +68 -59
- package/dist/server/documents/document.service.js.map +1 -1
- package/dist/server/documents/graph.integration.test.js +1 -0
- package/dist/server/documents/graph.integration.test.js.map +1 -1
- package/dist/server/documents/graph.service.js +14 -4
- package/dist/server/documents/graph.service.js.map +1 -1
- package/dist/server/documents/tree-and-folders.test.js +16 -0
- package/dist/server/documents/tree-and-folders.test.js.map +1 -1
- package/dist/server/documents/tree.service.js +13 -7
- package/dist/server/documents/tree.service.js.map +1 -1
- package/dist/server/routes/documents.routes.js +7 -1
- package/dist/server/routes/documents.routes.js.map +1 -1
- package/dist/server/routes/graph.routes.js +21 -4
- package/dist/server/routes/graph.routes.js.map +1 -1
- package/dist/server/routes/tree.routes.js +2 -1
- package/dist/server/routes/tree.routes.js.map +1 -1
- package/dist/shared/docPath.js +2 -2
- package/dist/shared/docPath.js.map +1 -1
- package/dist/shared/file-type-policy.js +12 -14
- package/dist/shared/file-type-policy.js.map +1 -1
- package/dist/shared/file-type-policy.test.js +37 -0
- package/dist/shared/file-type-policy.test.js.map +1 -0
- package/dist/shared/file-types.js +3 -4
- package/dist/shared/file-types.js.map +1 -1
- package/dist/shared/storagePath.js +11 -8
- package/dist/shared/storagePath.js.map +1 -1
- package/dist/web/assets/AgentChatPanel-dADh_kOG.js +22 -0
- package/dist/web/assets/AgentSkillFormCard-DEKBKWH-.js +6 -0
- package/dist/web/assets/{AiWriteWorkbench-i9ZoyX3p.js → AiWriteWorkbench-DezZBKI2.js} +1 -1
- package/dist/web/assets/{DiagramEditor-NtNY3sZL-CAQtZY2E.js → DiagramEditor-NtNY3sZL-5TyWJGgH.js} +1 -1
- package/dist/web/assets/{DocumentEditor-oFGmAxnV.js → DocumentEditor-D39RTLYE.js} +1 -1
- package/dist/web/assets/HtmlEditor-Bmpi_p2t.js +1 -0
- package/dist/web/assets/HtmlEditor-Bw2cVxtF.css +1 -0
- package/dist/web/assets/MergeView-WUR136do.js +10 -0
- package/dist/web/assets/{PlaygroundPage-BLEC6-Uf.js → PlaygroundPage-CPzJG_Wk.js} +1 -1
- package/dist/web/assets/SettingsPage-CuwYAiJh.js +1 -0
- package/dist/web/assets/{Toolbar-Dz9Cn_hv.js → Toolbar-JoV5KtuT.js} +1 -1
- package/dist/web/assets/{VisitorPickerModal-eagVdEZA.js → VisitorPickerModal-ImaQvyyf.js} +1 -1
- package/dist/web/assets/{code-xml-CZsyEkCa.js → code-xml-DX89c1sd.js} +1 -1
- package/dist/web/assets/{copy-BUUKT-QO.js → copy-yWKSE1g1.js} +1 -1
- package/dist/web/assets/diagram-Bk84WZto.js +3320 -0
- package/dist/web/assets/index-CwzlBu2W.js +263 -0
- package/dist/web/assets/index-uw_8eaPv.css +1 -0
- package/dist/web/assets/{meta2dEngine-BD2XbzaV-nAmL0RaW.js → meta2dEngine-BD2XbzaV-DUaWTg_P.js} +1 -1
- package/dist/web/assets/{motion-BgtuAqBE.js → motion-DFABYlwt.js} +1 -1
- package/dist/web/assets/{plus-BkiPFt2u.js → plus-B0mmDuSt.js} +1 -1
- package/dist/web/assets/{react--aHzEjEz.js → react-BJcufYxR.js} +3 -3
- package/dist/web/assets/{ui-RahDNce8.js → ui-CvA4pq3d.js} +3 -3
- package/dist/web/index.html +5 -5
- package/package.json +2 -2
- package/dist/web/assets/AgentChatPanel-Dd8Xnyia.js +0 -27
- package/dist/web/assets/AgentSkillFormCard-dsAy12lL.js +0 -6
- package/dist/web/assets/MergeView-DgEbzTVh.js +0 -10
- package/dist/web/assets/SettingsPage-BcCvamXH.js +0 -1
- package/dist/web/assets/diagram-DtU2xxz3.js +0 -5772
- package/dist/web/assets/index-DI_31upJ.js +0 -248
- package/dist/web/assets/index-YRgNGXBI.css +0 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocumentEditor-D39RTLYE.js","assets/react-vendor-BuABiQkA.js","assets/ui-CvA4pq3d.js","assets/motion-DFABYlwt.js","assets/react-BJcufYxR.js","assets/editor-CL03se2B.js","assets/diagram-Bk84WZto.js","assets/plus-B0mmDuSt.js","assets/copy-yWKSE1g1.js","assets/Toolbar-JoV5KtuT.js","assets/code-xml-DX89c1sd.js","assets/VisitorPickerModal-ImaQvyyf.js","assets/HtmlEditor-Bmpi_p2t.js","assets/HtmlEditor-Bw2cVxtF.css","assets/SettingsPage-CuwYAiJh.js","assets/AgentChatPanel-dADh_kOG.js","assets/AgentSkillFormCard-DEKBKWH-.js","assets/AiWriteWorkbench-DezZBKI2.js","assets/MergeView-WUR136do.js","assets/PlaygroundPage-CPzJG_Wk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var ya=Object.defineProperty;var va=(e,n,r)=>n in e?ya(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var Ht=(e,n,r)=>va(e,typeof n!="symbol"?n+"":n,r);import{r as w,j as d,R as si,B as ba,_ as jt,a8 as xa,a9 as _a,aa as wa,ab as Gn,c as ka,ac as Ia}from"./react-vendor-BuABiQkA.js";import{a5 as Ca,a6 as Sa}from"./ui-CvA4pq3d.js";import{d as Da,s as cr,p as Pa,t as Na,a as Aa,q as Ta,o as Ma,b as ja,c as Ea,e as at,f as Oa,g as Ra,y as Fa,m as Zr,h as Qr}from"./diagram-Bk84WZto.js";import{f as La}from"./motion-DFABYlwt.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))o(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function o(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();/**
|
|
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 za=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,o)=>o?o.toUpperCase():r.toLowerCase()),eo=e=>{const n=$a(e);return n.charAt(0).toUpperCase()+n.slice(1)},li=(...e)=>e.filter((n,r,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===r).join(" ").trim(),Ua=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="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 Ba={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 Ha=w.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:i="",children:a,iconNode:s,...l},u)=>w.createElement("svg",{ref:u,...Ba,width:n,height:n,stroke:e,strokeWidth:o?Number(r)*24/Number(n):r,className:li("lucide",i),...!a&&!Ua(l)&&{"aria-hidden":"true"},...l},[...s.map(([c,h])=>w.createElement(c,h)),...Array.isArray(a)?a:[a]]));/**
|
|
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 Pe=(e,n)=>{const r=w.forwardRef(({className:o,...i},a)=>w.createElement(Ha,{ref:a,iconNode:n,className:li(`lucide-${za(eo(e))}`,`lucide-${e}`,o),...i}));return r.displayName=eo(e),r};/**
|
|
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 Va=[["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"}]],Ga=Pe("book-open",Va);/**
|
|
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 Wa=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],qa=Pe("code",Wa);/**
|
|
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 Ka=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ya=Pe("file-text",Ka);/**
|
|
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 Ja=[["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"}]],to=Pe("file",Ja);/**
|
|
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 Xa=[["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"}]],no=Pe("folder",Xa);/**
|
|
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 Za=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Wn=Pe("loader-circle",Za);/**
|
|
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 Qa=[["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"}]],es=Pe("log-out",Qa);/**
|
|
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 ts=[["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"}]],ns=Pe("message-square",ts);/**
|
|
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 rs=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Cr=Pe("network",rs);/**
|
|
68
|
+
* @license lucide-react v0.562.0 - ISC
|
|
69
|
+
*
|
|
70
|
+
* This source code is licensed under the ISC license.
|
|
71
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
+
*/const os=[["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"}]],ro=Pe("panel-left-close",os);/**
|
|
73
|
+
* @license lucide-react v0.562.0 - ISC
|
|
74
|
+
*
|
|
75
|
+
* This source code is licensed under the ISC license.
|
|
76
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
+
*/const is=[["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"}]],oo=Pe("panel-left-open",is);/**
|
|
78
|
+
* @license lucide-react v0.562.0 - ISC
|
|
79
|
+
*
|
|
80
|
+
* This source code is licensed under the ISC license.
|
|
81
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
+
*/const as=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],ss=Pe("play",as);/**
|
|
83
|
+
* @license lucide-react v0.562.0 - ISC
|
|
84
|
+
*
|
|
85
|
+
* This source code is licensed under the ISC license.
|
|
86
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
+
*/const ls=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],io=Pe("settings-2",ls);/**
|
|
88
|
+
* @license lucide-react v0.562.0 - ISC
|
|
89
|
+
*
|
|
90
|
+
* This source code is licensed under the ISC license.
|
|
91
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
+
*/const cs=[["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"}]],ds=Pe("star",cs);/**
|
|
93
|
+
* @license lucide-react v0.562.0 - ISC
|
|
94
|
+
*
|
|
95
|
+
* This source code is licensed under the ISC license.
|
|
96
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
+
*/const us=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Pt=Pe("x",us);/**
|
|
98
|
+
* @license lucide-react v0.562.0 - ISC
|
|
99
|
+
*
|
|
100
|
+
* This source code is licensed under the ISC license.
|
|
101
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
+
*/const fs=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ci=Pe("zap",fs),ms={loading:"loading...",saved:"Saved",saving:"Saving...",unsaved:"Editing...",publish:"Publish",publishing:"Publishing...",published:"Published",preview:"Preview",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
|
|
103
|
+
|
|
104
|
+
`,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",mergeReceive:"Accept",mergeReject:"Reject",mergeUseAllMine:"Use all mine",mergeUseAllTheirs:"Use all theirs",mergeReviewHint:"Red = mine · Green = theirs; Accept takes theirs, Reject keeps mine",mergeEditAfterResolve:"All conflicts resolved — you can edit the document",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.",pullBlockedDraft:"Local draft exists — cannot overwrite with pull. Publish, or use Pull when behind to open merge.",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"},hs={loading:"加载中...",saved:"已保存",saving:"保存中...",unsaved:"编辑中...",publish:"发布",publishing:"发布中...",published:"已发布",preview:"预览",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:`> 您无权限编辑
|
|
105
|
+
|
|
106
|
+
`,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:"手动编辑",mergeReceive:"接收",mergeReject:"拒绝",mergeUseAllMine:"全部用我的",mergeUseAllTheirs:"全部用别人的",mergeReviewHint:"红=我的 · 绿=别人的;接收用别人的,拒绝留我的",mergeEditAfterResolve:"冲突已处理完,可继续修改正文",mergeNoConflicts:"本地与远端正文一致,可直接发布。",mergeResultHint:"由冲突决议自动拼接,也可直接修改",mergeResultInlineHint:"相对祖先有改动的行均需在正文中点选确认",mergeBase:"祖先",mergeBaseMissing:"无法加载公共祖先,已退化为两方比对",pullBlockedConflict:"存在未解决的冲突,请先合并。",pullBlockedDraft:"有未发布的本地草稿,无法覆盖拉取。可点「发布」或在落后时点「拉取更新」进入合并。",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:"退出登录"},di="mdocs.lang",ps={en:ms,zh:hs};function gs(){const e=window.localStorage.getItem(di);return e==="zh"||e==="en"?e:navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}const ui=w.createContext(null);function ys({children:e}){const[n,r]=w.useState(gs);w.useEffect(()=>{document.documentElement.lang=n==="zh"?"zh-CN":"en"},[n]);const o=w.useCallback(a=>{window.localStorage.setItem(di,a),r(a)},[]),i=w.useCallback((a,s)=>{let l=ps[n][a]??a;if(s)for(const[u,c]of Object.entries(s))l=l.replaceAll(`{{${u}}}`,c);return l},[n]);return d.jsx(ui.Provider,{value:{lang:n,setLang:o,t:i},children:e})}function Je(){const e=w.useContext(ui);if(!e)throw new Error("useI18n must be used within I18nProvider");return e}function Yt(e){const{content:n,contentHash:r,...o}=e;return o}function vs(){let e=Promise.resolve();return{execute:r=>{const o=e.then(r);return e=o.then(()=>{},()=>{}),o}}}const ao=new Map;function so(e){let n=ao.get(e);return n||(n=vs(),ao.set(e,n)),n}const Ge={PRIVATE:0,DOMAIN_READ:1,DOMAIN_WRITE:2,PUBLIC_READ:3,PUBLIC_WRITE:4};function lo(e){return e===Ge.PUBLIC_WRITE}function cf(e){return e==="public"?[Ge.PUBLIC_READ,Ge.PUBLIC_WRITE]:e==="restricted"?[Ge.DOMAIN_READ,Ge.DOMAIN_WRITE]:[Ge.PRIVATE,Ge.DOMAIN_READ,Ge.DOMAIN_WRITE,Ge.PUBLIC_READ,Ge.PUBLIC_WRITE]}const co="___desc___.md";function bs(e){const n=e.trim();return n?`${n}/${co}`:co}class bt extends Error{constructor(n){super(n),this.name="DocPathError"}}const xs=120,_s=200;function dr(e){let n=e.trim().replace(/\s+/g,"_");for(n=n.replace(/[^A-Za-z0-9_\-\.\u4e00-\u9fa5]/g,"_"),n=n.replace(/_+/g,"_"),n=n.replace(/^[._]+|[._]+$/g,"");n.includes("..");)n=n.replace(/\.\./g,"_");return n==="."||n===".."||!n?"":n}function ws(e){const n=e.trim();return n?n.includes("/")||n.includes("\\")?{ok:!1,message:"use a single name, not a path"}:n==="."||n===".."?{ok:!1,message:"invalid folder name"}:n.length>xs?{ok:!1,message:"folder name is too long"}:{ok:!0,display:n}:{ok:!1,message:"enter a folder name"}}function uo(e){let n=e.trim();if(!n)return{ok:!1,message:"enter a file name"};if(n.includes("/")||n.includes("\\"))return{ok:!1,message:"use a file name, not a path"};if(n==="."||n==="..")return{ok:!1,message:"invalid file name"};const r=n.toLowerCase();return!r.endsWith(".md")&&!r.endsWith(".html")&&(n+=".md"),n.length>_s?{ok:!1,message:"file name is too long"}:{ok:!0,displayFile:n}}function fo(e){const n=e.trim().replace(/\\/g,"/");if(!n)throw new bt("relative path is required");if(n.startsWith("/"))throw new bt("path must be relative");if(n.includes(".."))throw new bt("path must not contain ..");const r=n.split("/").filter(h=>h.length>0);if(r.length===0)throw new bt("relative path is required");const o=[];for(let h=0;h<r.length-1;h+=1){const m=dr(r[h]);if(!m)throw new bt("invalid path segment");o.push(m)}const i=r[r.length-1],a=i.toLowerCase(),s=a.endsWith(".html")?".html":a.endsWith(".md")?".md":null;if(!s)throw new bt("document path must end with .md or .html");const l=i.slice(0,-s.length),u=i.slice(-s.length),c=dr(l);if(!c)throw new bt("invalid file name");return o.push(c+u),o.join("/")}class He extends Error{constructor(r,o,i,a){super(i);Ht(this,"code");Ht(this,"status");Ht(this,"details");this.status=r,this.code=o,this.details=a}}const ks={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:`// 伪代码:表达「内容即文档」
|
|
107
|
+
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
|
|
108
|
+
A[写 Markdown] --> B[整理知识库]
|
|
109
|
+
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"},Is={root:ks},mo=JSON.stringify(Is),We="demo-visitor-001",df={visitorId:We,visitorName:"Demo User",createdAt:new Date().toISOString(),lastSeenAt:new Date().toISOString(),disabledAt:null,mergedIntoVisitorId:null};function xn(e){let n=0;for(let r=0;r<e.length;r++){const o=e.charCodeAt(r);n=(n<<5)-n+o,n=n&n}return Math.abs(n).toString(16).padStart(64,"0")}const ho=`# Markdown 语法指南
|
|
110
|
+
|
|
111
|
+
## 基础格式
|
|
112
|
+
|
|
113
|
+
**粗体文本**、*斜体文本*、~~删除线~~
|
|
114
|
+
|
|
115
|
+
## 列表
|
|
116
|
+
|
|
117
|
+
### 无序列表
|
|
118
|
+
- 项目一
|
|
119
|
+
- 项目二
|
|
120
|
+
- 嵌套项目
|
|
121
|
+
|
|
122
|
+
### 有序列表
|
|
123
|
+
1. 第一项
|
|
124
|
+
2. 第二项
|
|
125
|
+
3. 第三项
|
|
126
|
+
|
|
127
|
+
## 代码
|
|
128
|
+
|
|
129
|
+
\`\`\`typescript
|
|
130
|
+
function hello(name: string): string {
|
|
131
|
+
return \`Hello, \${name}!\`;
|
|
132
|
+
}
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
## 表格
|
|
136
|
+
|
|
137
|
+
| 功能 | 支持 |
|
|
138
|
+
|------|------|
|
|
139
|
+
| Markdown | ✅ |
|
|
140
|
+
| 图表 | ✅ |
|
|
141
|
+
| 公式 | ✅ |
|
|
142
|
+
|
|
143
|
+
## 引用
|
|
144
|
+
|
|
145
|
+
> 这是一段引用文本
|
|
146
|
+
> 可以有多行
|
|
147
|
+
|
|
148
|
+
## 链接和图片
|
|
149
|
+
|
|
150
|
+
[访问 GitHub](https://github.com)
|
|
151
|
+
|
|
152
|
+
## 数学公式(KaTeX)
|
|
153
|
+
|
|
154
|
+
行内公式:$E = mc^2$
|
|
155
|
+
|
|
156
|
+
块级公式:
|
|
157
|
+
|
|
158
|
+
$$
|
|
159
|
+
\\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi}
|
|
160
|
+
$$
|
|
161
|
+
`,po=`# 图表支持示例
|
|
162
|
+
|
|
163
|
+
mdocs 集成了多种图表类型。
|
|
164
|
+
|
|
165
|
+
## Mermaid 流程图
|
|
166
|
+
|
|
167
|
+
\`\`\`mermaid
|
|
168
|
+
flowchart LR
|
|
169
|
+
A[开始] --> B{判断}
|
|
170
|
+
B -->|是| C[处理]
|
|
171
|
+
B -->|否| D[结束]
|
|
172
|
+
C --> D
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
## Mermaid 序列图
|
|
176
|
+
|
|
177
|
+
\`\`\`mermaid
|
|
178
|
+
sequenceDiagram
|
|
179
|
+
participant 用户
|
|
180
|
+
participant 前端
|
|
181
|
+
participant 后端
|
|
182
|
+
|
|
183
|
+
用户->>前端: 输入内容
|
|
184
|
+
前端->>后端: 提交数据
|
|
185
|
+
后端-->>前端: 返回结果
|
|
186
|
+
前端-->>用户: 显示成功
|
|
187
|
+
\`\`\`
|
|
188
|
+
|
|
189
|
+
## Mermaid 甘特图
|
|
190
|
+
|
|
191
|
+
\`\`\`mermaid
|
|
192
|
+
gantt
|
|
193
|
+
title 项目进度
|
|
194
|
+
dateFormat YYYY-MM-DD
|
|
195
|
+
section 设计
|
|
196
|
+
需求分析 :done, des1, 2024-01-01, 5d
|
|
197
|
+
技术选型 :done, des2, after des1, 3d
|
|
198
|
+
section 开发
|
|
199
|
+
前端开发 :active, dev1, 2024-01-09, 10d
|
|
200
|
+
后端开发 : dev2, 2024-01-09, 10d
|
|
201
|
+
\`\`\`
|
|
202
|
+
`,go=`# 个人笔记
|
|
203
|
+
|
|
204
|
+
这是我的私人域中的笔记,只有我能看到。
|
|
205
|
+
|
|
206
|
+
## 今日待办
|
|
207
|
+
|
|
208
|
+
- [x] 完成 mdocs demo 模式
|
|
209
|
+
- [ ] 测试所有功能
|
|
210
|
+
- [ ] 部署到 GitHub Pages
|
|
211
|
+
|
|
212
|
+
## 想法
|
|
213
|
+
|
|
214
|
+
Demo 模式的核心设计:
|
|
215
|
+
1. API 层透明切换
|
|
216
|
+
2. 数据存储在 IndexedDB
|
|
217
|
+
3. 用户无感知切换
|
|
218
|
+
|
|
219
|
+
`,uf=[{documentId:"doc-welcome",relativePath:"README.md",displayName:"README",content:mo,contentHash:xn(mo),permission:1,ownerVisitorId:We,domainId:"default",updatedBy:We,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-markdown-guide",relativePath:"指南/Markdown 语法.md",displayName:"Markdown 语法",content:ho,contentHash:xn(ho),permission:1,ownerVisitorId:We,domainId:"default",updatedBy:We,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-diagram-guide",relativePath:"指南/图表支持.md",displayName:"图表支持",content:po,contentHash:xn(po),permission:1,ownerVisitorId:We,domainId:"default",updatedBy:We,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-personal-note",relativePath:"个人笔记.md",displayName:"个人笔记",content:go,contentHash:xn(go),permission:0,ownerVisitorId:We,domainId:We,updatedBy:We,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null}];const Sr="mdocs.visitorId",ur="mdocs-api-error";function Cs(e){typeof window>"u"||window.dispatchEvent(new CustomEvent(ur,{detail:{status:e.status,code:e.code,message:e.message}}))}function fi(){return!1}function ff(){return window.localStorage.getItem(Sr)}function Dn(e){window.localStorage.setItem(Sr,e)}function Ss(){window.localStorage.removeItem(Sr)}async function H(e,n={}){try{fi();const r=new Headers(n.headers);!r.has("Content-Type")&&n.body&&r.set("Content-Type","application/json");const o=await fetch(e,{...n,headers:r});if(o.status===204)return;const i=await o.text();let a;try{a=i?JSON.parse(i):null}catch{throw new He(o.status,"BAD_RESPONSE","response is not valid JSON")}if(!o.ok){const s=a==null?void 0:a.error;throw new He(o.status,(s==null?void 0:s.code)??"UNKNOWN",(s==null?void 0:s.message)??"request failed",s==null?void 0:s.details)}return a.data}catch(r){throw r instanceof He&&Cs(r),r}}const Pn="default",mf=["public","restricted","private"];function hf(e){return e===Pn}function pf(e,n){return n!==null&&e.creatorVisitorId===n}function gf(e){return e.docCount>0}function Ds(e,n){return H("/api/visitors/register",{method:"POST",body:JSON.stringify({visitorName:e,password:n})})}function Ps(e){return H("/api/visitors/recover",{method:"POST",body:JSON.stringify({recoveryCode:e})})}function Ns(e,n){return H("/api/visitors/login",{method:"POST",body:JSON.stringify({visitorName:e,password:n})})}function yf(e){return H("/api/visitors/set-password",{method:"POST",body:JSON.stringify({password:e})})}function vf(){return H("/api/visitors/recovery-code",{method:"POST"})}async function yo(){return(await H("/api/visitors/me")).visitor}function bf(){return H("/api/visitors").then(e=>e.visitors)}function As(){return H("/api/domains")}function xf(e){return H("/api/domains",{method:"POST",body:JSON.stringify(e)})}function _f(e,n){return H(`/api/domains/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({domainName:n})})}function wf(e,n){return H(`/api/domains/${encodeURIComponent(e)}/permission`,{method:"PUT",body:JSON.stringify({permission:n})})}function kf(e){return H(`/api/domains/${encodeURIComponent(e)}`,{method:"DELETE"})}function If(e){return H(`/api/domains/${encodeURIComponent(e)}/members`).then(n=>n.members)}function Cf(e,n){return H(`/api/domains/${encodeURIComponent(e)}/members`,{method:"PUT",body:JSON.stringify({visitorIds:n})})}function Sf(){return H("/api/domain-member-templates")}function Df(e){return H("/api/domain-member-templates",{method:"POST",body:JSON.stringify(e)})}function Pf(e,n){return H(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"PUT",body:JSON.stringify(n)})}function Nf(e){return H(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"DELETE"})}function Ts(e){const n=e!=null&&e.trim()?`?domainId=${encodeURIComponent(e.trim())}`:"";return H(`/api/tree${n}`)}function Jt(e){return H(`/api/documents/${encodeURIComponent(e)}`)}function fr(e){return H("/api/documents",{method:"POST",body:JSON.stringify(e)})}function vo(e,n){return H(`/api/documents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(n)})}function Ms(e,n){const r=n?`?localBaseCommitId=${encodeURIComponent(n)}`:"";return H(`/api/documents/${encodeURIComponent(e)}/sync-status${r}`)}function Af(e,n,r){const o=new URLSearchParams({localBaseCommitId:n,remoteCommitId:r});return H(`/api/documents/${encodeURIComponent(e)}/merge-context?${o}`)}function qn(e){return H("/api/documents/convert",{method:"POST",body:JSON.stringify(e)})}function js(e){return H(`/api/documents/${encodeURIComponent(e)}`,{method:"DELETE"})}function Es(e,n){return H(`/api/documents/${encodeURIComponent(e)}/move`,{method:"POST",body:JSON.stringify({parentId:n})})}function Tf(e){return H(`/api/documents/${encodeURIComponent(e)}/invites`)}function Mf(e,n,r){return H(`/api/documents/${encodeURIComponent(e)}/invites`,{method:"POST",body:JSON.stringify({targetVisitorId:n,targetPermission:r})})}function jf(e,n){return H(`/api/documents/${encodeURIComponent(e)}/invites/${encodeURIComponent(n)}`,{method:"DELETE"})}async function Ef(e,n){var c;const r=new FormData;r.append("file[]",e),r.append("documentId",n);const o=new Headers,i=await fetch("/api/assets/upload",{method:"POST",headers:o,body:r}),a=await i.json(),s=a;if(!i.ok||s.code===1){const h=a==null?void 0:a.error;throw new He(i.status,(h==null?void 0:h.code)??"UPLOAD_FAILED",(h==null?void 0:h.message)??s.msg??"upload failed")}const l=((c=s.data)==null?void 0:c.succMap)??{},u=Object.values(l);if(u.length===0)throw new Error("upload succeeded but no URL returned");return u[0]}function Os(e){return H("/api/folders",{method:"POST",body:JSON.stringify(e)})}function Rs(e){return H(`/api/documents/folder/${encodeURIComponent(e)}`,{method:"DELETE"})}function Of(e){return H("/api/cli/tokens",{method:"POST",body:JSON.stringify({})})}function Rf(){return H("/api/cli/tokens")}function Fs(){return H("/api/bookmarks")}function Ff(e){return H(`/api/bookmarks/${encodeURIComponent(e)}`)}function Lf(e){return H(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"POST"})}function Ls(e){return H(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"DELETE"})}function zf(){return H("/api/visitors/me/documents")}function zs(e){return H(`/api/documents/${encodeURIComponent(e)}/comments`)}function $s(e,n){return H(`/api/documents/${encodeURIComponent(e)}/comments`,{method:"POST",body:JSON.stringify(n)})}function Us(e,n){return H(`/api/documents/${encodeURIComponent(e)}/comments/${encodeURIComponent(n)}`,{method:"DELETE"})}function $f(){return H("/api/agent/configs")}function bo(e){return H("/api/agent/config",{method:"PUT",body:JSON.stringify(e)})}function Uf(e){return H(`/api/agent/config/${encodeURIComponent(e)}/default`,{method:"POST"})}function Bf(e){return H(`/api/agent/config/${encodeURIComponent(e)}`,{method:"DELETE"})}function Hf(){return H("/api/agent/skills")}function Vf(e){return H("/api/agent/skills",{method:"POST",body:JSON.stringify(e)})}function Gf(e,n){return H(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)})}function Wf(e){return H(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function qf(){return H("/api/agent/status")}function Kf(){return H("/api/agent/context-usage")}function Yf(e="normal",n){const r=new URLSearchParams;e==="coding"&&(r.set("mode","coding"),n&&r.set("documentId",n));const o=r.toString();return H(`/api/agent/session${o?`?${o}`:""}`)}function Jf(e="normal",n){const r=new URLSearchParams;e==="coding"&&(r.set("mode","coding"),n&&r.set("documentId",n));const o=r.toString();return H(`/api/agent/sessions${o?`?${o}`:""}`)}function Xf(e="normal",n){return H("/api/agent/sessions",{method:"POST",body:JSON.stringify({mode:e,...e==="coding"?{documentId:n??null}:{}})})}function Zf(e,n="normal",r){return H("/api/agent/session/open",{method:"POST",body:JSON.stringify({sessionId:e,mode:n,...n==="coding"?{documentId:r??null}:{}})})}function Qf(e,n){return H("/api/agent/session/bind-document",{method:"POST",body:JSON.stringify({sessionId:e,documentId:n})})}function em(e,n){return H("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,choice:n})})}function tm(e){return H("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function nm(e){return H("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}function rm(e,n){return H("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,...n})})}function om(e){return H("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function im(e){return H("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}async function am(e,n){var c;const r={message:e,mode:n.mode==="coding"?"coding":"normal"},o=n.skillNames&&n.skillNames.length>0?n.skillNames:n.skillIds&&n.skillIds.length>0?n.skillIds:void 0;o&&(r.skillNames=o),n.mode==="coding"?(n.documentId!==void 0&&(r.documentId=n.documentId),typeof n.workingMarkdown=="string"&&(r.workingMarkdown=n.workingMarkdown),typeof n.baseMarkdown=="string"&&(r.baseMarkdown=n.baseMarkdown)):n.references&&(r.references=n.references);const i=await fetch("/api/agent/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r),signal:n.signal});if(!i.ok){let h=`HTTP ${i.status}`;try{const m=await i.json();(c=m.error)!=null&&c.message&&(h=m.error.message)}catch{}throw new Error(h)}if(!i.body)throw new Error("empty response body");const a=i.body.getReader(),s=new TextDecoder;let l="";for(;;){const{done:h,value:m}=await a.read();if(h)break;l+=s.decode(m,{stream:!0});const f=l.split(`
|
|
220
|
+
`);l=f.pop()??"";for(const g of f){const p=g.trim();if(!p.startsWith("data:"))continue;const _=p.slice(5).trim();if(!(!_||_==="[DONE]"))try{n.onEvent(JSON.parse(_))}catch{}}}const u=l.trim();if(u.startsWith("data:")){const h=u.slice(5).trim();if(h&&h!=="[DONE]")try{n.onEvent(JSON.parse(h))}catch{}}}function xo(e){return H(`/api/graph/${e}`,{method:"GET"})}function Bs(e){return H(`/api/graph/${e}/analyze`,{method:"POST"})}function _o(e){return H(`/api/graph/domain/${e}`,{method:"GET"})}function Hs(e){return H(`/api/graph/domain/${e}/analyze`,{method:"POST"})}function Vs(e){return H(`/api/graph/tasks/${encodeURIComponent(e)}`,{method:"GET"})}const Gs={domainId:Pn,domainName:"Default",permission:"public",creatorVisitorId:"",docCount:0};async function mi(){try{return await As()}catch{return[Gs]}}function Ws(e,n){var r,o,i;return((r=e.find(a=>a.domainId===n))==null?void 0:r.domainId)??((o=e.find(a=>a.domainId===Pn))==null?void 0:o.domainId)??((i=e[0])==null?void 0:i.domainId)??Pn}function qs(e){const{t:n}=Je(),[r,o]=w.useState(!1),[i,a]=w.useState(null),[s,l]=w.useState("register"),[u,c]=w.useState(1),[h,m]=w.useState(""),[f,g]=w.useState(""),[p,_]=w.useState("password"),[b,v]=w.useState(""),[I,D]=w.useState(""),[P,x]=w.useState("");function N(F){if(F.preventDefault(),!h.trim()){a(n("nameRequired"));return}a(null),c(2)}async function S(F){F.preventDefault(),o(!0),a(null);try{const B=f.trim();await e.onSubmit(h.trim(),B||void 0)}catch(B){a(B instanceof Error?B.message:String(B)),c(1)}finally{o(!1)}}async function A(F){F.preventDefault();const B=b.trim(),K=I.trim();if(!B||!K){a("请输入用户名和密码");return}o(!0),a(null);try{const J=await Ns(B,K);Dn(J.visitor.visitorId),await e.onRecover(J.visitor.visitorId)}catch(J){a(J instanceof Error?J.message:String(J))}finally{o(!1)}}async function U(F){F.preventDefault();const B=P.trim();if(!B){a("请输入恢复码");return}o(!0),a(null);try{const K=await Ps(B);Dn(K.visitor.visitorId),await e.onRecover(K.visitor.visitorId)}catch(K){a(K instanceof Error?K.message:String(K))}finally{o(!1)}}const M=i??e.error;function z(F){a(null),l(F)}return d.jsx("div",{className:"mdocs-dialog-backdrop",children:d.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:420},children:[d.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--mdocs-border)",marginBottom:16},children:[d.jsx("button",{type:"button",onClick:()=>z("register"),style:{flex:1,padding:"12px",border:"none",background:s==="register"?"var(--mdocs-bg)":"none",color:s==="register"?"var(--mdocs-text)":"var(--mdocs-text-secondary)",cursor:"pointer",fontWeight:s==="register"?600:400,borderBottom:s==="register"?"2px solid var(--mdocs-accent)":"none"},children:"注册"}),d.jsx("button",{type:"button",onClick:()=>z("login"),style:{flex:1,padding:"12px",border:"none",background:s==="login"?"var(--mdocs-bg)":"none",color:s==="login"?"var(--mdocs-text)":"var(--mdocs-text-secondary)",cursor:"pointer",fontWeight:s==="login"?600:400,borderBottom:s==="login"?"2px solid var(--mdocs-accent)":"none"},children:"登录"})]}),s==="register"&&d.jsx(d.Fragment,{children:u===1?d.jsxs(d.Fragment,{children:[d.jsx("h1",{children:n("welcomeTitle")}),d.jsx("p",{children:n("welcomeDesc")}),d.jsxs("form",{onSubmit:N,children:[d.jsx("input",{autoFocus:!0,placeholder:n("visitorNamePlaceholder"),value:h,onChange:F=>m(F.target.value),maxLength:60}),M&&d.jsx("div",{className:"mdocs-dialog-error",children:M}),d.jsx("button",{type:"submit",className:"primary",disabled:r,children:"下一步"})]}),d.jsx("p",{style:{marginTop:16,textAlign:"center"},children:d.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:()=>z("login"),children:"已有账号?点击登录"})})]}):d.jsxs(d.Fragment,{children:[d.jsx("h1",{children:"设置密码(可选)"}),d.jsx("p",{style:{marginBottom:8},children:"设置密码后,你可以在其他浏览器或设备上使用「用户名+密码」登录。"}),d.jsx("p",{style:{color:"var(--mdocs-text-secondary)",fontSize:"0.875rem",marginBottom:16},children:"留空不设置密码也能正常使用,但只能在当前浏览器操作。"}),d.jsxs("form",{onSubmit:S,children:[d.jsx("input",{autoFocus:!0,type:"password",placeholder:"设置密码(至少 4 位)",value:f,onChange:F=>g(F.target.value),minLength:4}),M&&d.jsx("div",{className:"mdocs-dialog-error",children:M}),d.jsx("button",{type:"submit",className:"primary",disabled:r,style:{marginTop:8},children:r?n("creating"):"完成注册"})]}),d.jsx("p",{style:{marginTop:16,textAlign:"center"},children:d.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-text-secondary)",cursor:"pointer",fontSize:"0.875rem",padding:0},onClick:()=>c(1),children:"← 返回上一步"})})]})}),s==="login"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{style:{display:"flex",gap:16,marginBottom:16,fontSize:"0.875rem"},children:[d.jsx("button",{type:"button",onClick:()=>{a(null),_("password")},style:{background:"none",border:"none",color:p==="password"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:p==="password"?"2px solid var(--mdocs-accent)":"none",fontWeight:p==="password"?600:400},children:"用户名+密码"}),d.jsx("button",{type:"button",onClick:()=>{a(null),_("recovery")},style:{background:"none",border:"none",color:p==="recovery"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:p==="recovery"?"2px solid var(--mdocs-accent)":"none",fontWeight:p==="recovery"?600:400},children:"恢复码"})]}),p==="password"?d.jsxs(d.Fragment,{children:[d.jsx("h1",{children:"🔑 使用密码登录"}),d.jsx("p",{children:"输入用户名和密码,在其他设备上找回你的身份。"}),d.jsxs("form",{onSubmit:A,children:[d.jsx("input",{autoFocus:!0,placeholder:"用户名",value:b,onChange:F=>v(F.target.value),maxLength:60,style:{marginBottom:8}}),d.jsx("input",{type:"password",placeholder:"密码",value:I,onChange:F=>D(F.target.value)}),M&&d.jsx("div",{className:"mdocs-dialog-error",children:M}),d.jsx("button",{type:"submit",className:"primary",disabled:r,children:r?"验证中…":"登录"})]}),d.jsx("p",{style:{marginTop:16,textAlign:"center"},children:d.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:()=>z("register"),children:"没有账号?去注册"})})]}):d.jsxs(d.Fragment,{children:[d.jsx("h1",{children:"🔑 使用恢复码找回"}),d.jsx("p",{children:"输入注册时保存的恢复码,系统将为您生成新的身份令牌。"}),d.jsxs("form",{onSubmit:U,children:[d.jsx("input",{autoFocus:!0,placeholder:"ABCD-EFGH-IJKL-MNOP",value:P,onChange:F=>x(F.target.value),style:{fontFamily:"monospace",letterSpacing:"0.1em"},maxLength:30}),M&&d.jsx("div",{className:"mdocs-dialog-error",children:M}),d.jsx("button",{type:"submit",className:"primary",disabled:r,children:r?"验证中…":"找回身份"})]})]})]})]})})}function Ks(e){const{t:n}=Je();return d.jsxs("div",{className:"mdocs-notice card",children:[d.jsx("span",{children:n("visitorIdNotice",{id:e.visitorId})}),d.jsx("button",{type:"button",onClick:e.onDismiss,children:n("gotIt")})]})}const hi="application/x-mdocs-document-id",mr="mdocs-doc:";let Tt=null;function pi(e,n,r=[]){for(const o of e){if(o.type==="document"){if(o.documentId===n)return{forceOpenFolderIds:r,scrollTreeId:o.documentId};continue}if(o.descDocumentId===n)return{forceOpenFolderIds:r,scrollTreeId:o.documentId};const i=pi(o.children,n,[...r,o.documentId]);if(i)return i}return null}function Dr(e){if(Tt)return Tt;try{const n=e.getData(hi);if(n)return n;const r=e.getData("text/plain")||e.getData("Text");if(r.startsWith(mr))return r.slice(mr.length)}catch{}return""}function _t(e){return!!(e&&Tt)}function Ys(e){const{t:n}=Je(),r=w.useRef(null),[o,i]=w.useState(null),[a,s]=w.useState(null),l=w.useMemo(()=>{var v,I;const b=((v=e.graphFocusAnchorId)==null?void 0:v.trim())||((I=e.activeDocumentId)==null?void 0:I.trim());return b?pi(e.nodes,b):null},[e.nodes,e.activeDocumentId,e.graphFocusAnchorId]),u=w.useMemo(()=>new Set((l==null?void 0:l.forceOpenFolderIds)??[]),[l]);w.useEffect(()=>{if(!(l!=null&&l.scrollTreeId))return;const b=l.scrollTreeId,v=()=>{var P;const D=(P=r.current)==null?void 0:P.querySelector(`[data-tree-id="${CSS.escape(b)}"]`);D==null||D.scrollIntoView({block:"nearest",behavior:"smooth"})},I=requestAnimationFrame(()=>{requestAnimationFrame(v)});return()=>cancelAnimationFrame(I)},[l==null?void 0:l.scrollTreeId,u,e.nodes]);function c(){i(null)}function h(){Tt=null,s(null),c()}function m(b){Tt=b,s(b),c()}function f(b){if(!_t(e.onMoveDocument))return;b.preventDefault(),b.dataTransfer.dropEffect="move",b.target.closest(".mdocs-tree-row")||i({kind:"root"})}function g(b){const v=b.relatedTarget;v&&b.currentTarget.contains(v)||i(I=>(I==null?void 0:I.kind)==="root"?null:I)}function p(b){if(!e.onMoveDocument||!_t(e.onMoveDocument))return;b.preventDefault(),b.stopPropagation();const I=b.target.closest(".mdocs-tree-row"),D=Dr(b.dataTransfer);h(),!I&&D&&e.onMoveDocument(D,null)}const _="mdocs-sidebar-list"+((o==null?void 0:o.kind)==="root"?" mdocs-tree-drop-root":"");return e.nodes.length===0?d.jsx("div",{ref:r,className:_,onDragOver:f,onDragLeave:g,onDrop:p,children:d.jsx("div",{className:"muted",style:{padding:"8px 10px",fontSize:12},children:n("noDocumentsYet")})}):d.jsx("div",{ref:r,className:_,onClick:b=>{var I;b.target.closest(".mdocs-tree-row")||(I=e.onDeselect)==null||I.call(e)},onContextMenu:b=>{b.preventDefault(),e.onContextMenu({x:b.clientX,y:b.clientY,node:{type:"folder",name:"",path:"",documentId:"",children:e.nodes},parentPath:""})},onDragOver:f,onDragLeave:g,onDrop:p,children:e.nodes.map(b=>d.jsx(gi,{node:b,depth:0,parentPath:"",parentFolderId:null,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId??null,selectedParentPath:e.selectedParentPath,forceOpenFolderIds:u,dropHighlight:o,setDropHighlight:i,clearDropHighlight:c,beginDragSession:m,endDragSession:h,draggingId:a,onOpen:e.onOpen,onOpenFolder:e.onOpenFolder,onContextMenu:e.onContextMenu,onMoveDocument:e.onMoveDocument,onOpenGraph:e.onOpenGraph,onGenerateGraph:e.onGenerateGraph},b.path))})}function gi(e){const n={paddingLeft:8+e.depth*16};return e.node.type==="folder"?d.jsx(Zs,{folder:e.node,depth:e.depth,indent:n,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId,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,onOpenGraph:e.onOpenGraph,onGenerateGraph:e.onGenerateGraph}):d.jsx(Js,{doc:e.node,indent:n,parentPath:e.parentPath,parentFolderId:e.parentFolderId,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId,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,onOpenGraph:e.onOpenGraph,onGenerateGraph:e.onGenerateGraph})}function Js(e){var m;const n=e.doc,r=n.documentId===e.activeDocumentId,o=n.documentId===e.graphFocusAnchorId,i=!!e.onMoveDocument,a=e.draggingId===n.documentId,[s,l]=w.useState(!1),u=((m=e.dropHighlight)==null?void 0:m.kind)==="doc"&&e.dropHighlight.id===n.documentId,[c,h]=w.useState(!1);return d.jsxs("div",{role:"button",tabIndex:0,className:"mdocs-tree-row mdocs-tree-doc"+(r?" active":"")+(o?" mdocs-tree-row--graph-focus":"")+(a?" mdocs-tree-dragging":"")+(u?" mdocs-tree-drop-target":""),"data-tree-id":n.documentId,style:{...e.indent,cursor:i?"grab":void 0},draggable:i,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onDragStart:f=>{e.onMoveDocument&&(h(!0),e.beginDragSession(n.documentId),f.dataTransfer.setData(hi,n.documentId),f.dataTransfer.setData("text/plain",mr+n.documentId),f.dataTransfer.effectAllowed="move")},onDragEnd:()=>{e.endDragSession(),queueMicrotask(()=>h(!1))},onDragEnter:f=>{!_t(e.onMoveDocument)||Tt===n.documentId||(f.preventDefault(),f.stopPropagation(),e.setDropHighlight({kind:"doc",id:n.documentId}))},onDragOver:f=>{!_t(e.onMoveDocument)||Tt===n.documentId||(f.preventDefault(),f.stopPropagation(),f.dataTransfer.dropEffect="move",e.setDropHighlight({kind:"doc",id:n.documentId}))},onDrop:f=>{if(!e.onMoveDocument||!_t(e.onMoveDocument))return;f.preventDefault(),f.stopPropagation();const g=Dr(f.dataTransfer),p=e.parentFolderId;e.endDragSession(),!(!g||g===n.documentId)&&e.onMoveDocument(g,p)},onClick:()=>{c||e.onOpen(n)},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),e.onOpen(n))},onContextMenu:f=>{f.preventDefault(),f.stopPropagation(),e.onContextMenu({x:f.clientX,y:f.clientY,node:n,parentPath:e.parentPath})},children:[d.jsx("span",{className:"mdocs-tree-caret-spacer","aria-hidden":!0}),d.jsx("span",{className:"mdocs-tree-icon",children:n.fileType==="html"?"H":"md"}),d.jsx("span",{className:"mdocs-tree-label",title:n.displayName||n.name,children:n.displayName||n.name}),(e.onOpenGraph||e.onGenerateGraph)&&d.jsxs("span",{className:"mdocs-tree-hover-actions",onClick:f=>f.stopPropagation(),children:[e.onOpenGraph&&d.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"查看图谱",onClick:f=>{var g;f.stopPropagation(),(g=e.onOpenGraph)==null||g.call(e,e.doc,e.parentFolderId??void 0)},children:d.jsx(Cr,{size:14,strokeWidth:1.75})}),e.onGenerateGraph&&d.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"生成图谱",onClick:f=>{var g;f.stopPropagation(),(g=e.onGenerateGraph)==null||g.call(e,e.doc,e.parentFolderId??void 0)},children:d.jsx(ci,{size:14,strokeWidth:1.75})})]})]})}function Xs(){return d.jsx("span",{className:"mdocs-tree-icon mdocs-tree-icon-dir","aria-hidden":!0,children:d.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("path",{d:"M2 4.5h4.2L7.3 6H14v8.5H2V4.5z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),d.jsx("path",{d:"M2 4.5V3h4l1.1 1.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})})}function Zs(e){var m,f,g;const{t:n}=Je(),r=e.forceOpenFolderIds.has(e.folder.documentId),[o,i]=w.useState(e.depth<1||r),a=o;w.useEffect(()=>{r&&i(!0)},[r,e.activeDocumentId]);const s=!!e.folder.descDocumentId&&e.folder.descDocumentId===e.activeDocumentId,l=e.folder.documentId===e.graphFocusAnchorId,u=e.selectedParentPath===e.folder.path,c=((m=e.dropHighlight)==null?void 0:m.kind)==="folder"&&e.dropHighlight.id===e.folder.documentId;function h(){e.onOpenFolder(e.folder.path,e.folder.descDocumentId)}return d.jsxs("div",{children:[d.jsxs("div",{className:"mdocs-tree-row mdocs-tree-folder mdocs-tree-folder-row"+(s?" active":u?" mdocs-tree-select-target":"")+(l?" mdocs-tree-row--graph-focus":"")+(c?" mdocs-tree-drop-target":""),"data-tree-id":e.folder.documentId,style:e.indent,onClick:h,onContextMenu:p=>{p.preventDefault(),p.stopPropagation(),e.onContextMenu({x:p.clientX,y:p.clientY,node:e.folder,parentPath:e.folder.path})},onDragEnter:p=>{_t(e.onMoveDocument)&&(p.preventDefault(),p.stopPropagation(),e.setDropHighlight({kind:"folder",id:e.folder.documentId}),i(!0))},onDragOver:p=>{_t(e.onMoveDocument)&&(p.preventDefault(),p.stopPropagation(),p.dataTransfer.dropEffect="move",e.setDropHighlight({kind:"folder",id:e.folder.documentId}))},onDrop:p=>{if(!e.onMoveDocument||!_t(e.onMoveDocument))return;p.preventDefault(),p.stopPropagation();const _=Dr(p.dataTransfer),b=e.folder.documentId;e.endDragSession(),_&&e.onMoveDocument(_,b)},children:[d.jsx("span",{className:"mdocs-tree-caret",role:"button",tabIndex:0,"aria-expanded":a,"aria-label":n(a?"collapseFolder":"expandFolder"),onClick:p=>{p.stopPropagation(),i(_=>!_),h()},onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i(_=>!_),h())},children:a?"▾":"▸"}),d.jsx(Xs,{}),d.jsx("span",{className:"mdocs-tree-folder-select",children:d.jsx("span",{className:"mdocs-tree-label",title:((f=e.folder.folderDisplayName)==null?void 0:f.trim())||e.folder.name,children:((g=e.folder.folderDisplayName)==null?void 0:g.trim())||e.folder.name})}),(e.onOpenGraph||e.onGenerateGraph)&&d.jsxs("span",{className:"mdocs-tree-hover-actions",onClick:p=>p.stopPropagation(),children:[e.onOpenGraph&&d.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"查看图谱",onClick:p=>{var _;p.stopPropagation(),(_=e.onOpenGraph)==null||_.call(e,e.folder)},children:d.jsx(Cr,{size:14,strokeWidth:1.75})}),e.onGenerateGraph&&d.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"生成图谱",onClick:p=>{var _;p.stopPropagation(),(_=e.onGenerateGraph)==null||_.call(e,e.folder)},children:d.jsx(ci,{size:14,strokeWidth:1.75})})]})]}),a&&e.folder.children.map(p=>d.jsx(gi,{node:p,depth:e.depth+1,parentPath:e.folder.path,parentFolderId:e.folder.documentId,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId,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,onOpenGraph:e.onOpenGraph,onGenerateGraph:e.onGenerateGraph},p.path))]})}function Qs(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,a,s,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(o=a.call(r)).done)&&(l.push(o.value),l.length!==n);u=!0);}catch(h){c=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return l}}function el(e,n,r){return n=ll(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function wo(e,n){return rl(e)||Qs(e,n)||yi(e,n)||al()}function tl(e){return nl(e)||ol(e)||yi(e)||il()}function nl(e){if(Array.isArray(e))return hr(e)}function rl(e){if(Array.isArray(e))return e}function ol(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function yi(e,n){if(e){if(typeof e=="string")return hr(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hr(e,n)}}function hr(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=new Array(n);r<n;r++)o[r]=e[r];return o}function il(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
221
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function al(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
222
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sl(e,n){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function ll(e){var n=sl(e,"string");return typeof n=="symbol"?n:String(n)}var cl=function(n,r){var o=new Set(r);return Object.assign.apply(Object,[{}].concat(tl(Object.entries(n).filter(function(i){var a=wo(i,1),s=a[0];return!o.has(s)}).map(function(i){var a=wo(i,2),s=a[0],l=a[1];return el({},s,l)}))))};function dl(e,{wrapperElementType:n="div",nodeMapper:r=a=>a,methodNames:o=[],initPropNames:i=[]}={}){return w.forwardRef((a,s)=>{const l=w.useRef(),u=w.useMemo(()=>{const m=Object.fromEntries(i.filter(f=>a.hasOwnProperty(f)).map(f=>[f,a[f]]));return e(m)},[]);ko(()=>{u(r(l.current))},w.useLayoutEffect),ko(()=>u._destructor instanceof Function?u._destructor:void 0);const c=w.useCallback((m,...f)=>u[m]instanceof Function?u[m](...f):void 0,[u]),h=w.useRef({});return Object.keys(cl(a,[...o,...i])).filter(m=>h.current[m]!==a[m]).forEach(m=>c(m,a[m])),h.current=a,w.useImperativeHandle(s,()=>Object.fromEntries(o.map(m=>[m,(...f)=>c(m,...f)])),[c]),si.createElement(n,{ref:l})})}function ko(e,n=w.useEffect){const r=w.useRef(),o=w.useRef(!1),i=w.useRef(!1),[a,s]=w.useState(0);o.current&&(i.current=!0),n(()=>(o.current||(r.current=e(),o.current=!0),s(l=>l+1),()=>{i.current&&(r.current&&r.current(),r.current=void 0,o.current=!1,i.current=!1)}),[])}var At=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-At.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?At.Bounce.In(e*2)*.5:At.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),nn=function(){return performance.now()},vi=function(){function e(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,n)}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];for(var i=0,a=r;i<a.length;i++){var s=a[i];(n=s._group)===null||n===void 0||n.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(n){return!n.isPlaying()})},e.prototype.update=function(n,r){n===void 0&&(n=nn()),r===void 0&&(r=!0);var o=Object.keys(this._tweens);if(o.length!==0)for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<o.length;i++){var a=this._tweens[o[i]],s=!r;a&&a.update(n,s)===!1&&!r&&this.remove(a)}o=Object.keys(this._tweensAddedDuringUpdate)}},e}(),pr={Linear:function(e,n){var r=e.length-1,o=r*n,i=Math.floor(o),a=pr.Utils.Linear;return n<0?a(e[0],e[1],o):n>1?a(e[r],e[r-1],r-o):a(e[i],e[i+1>r?r:i+1],o-i)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},bi=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),gr=new vi,Io=function(){function e(n,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=At.Linear.None,this._interpolationFunction=pr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=bi.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=n,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=gr,gr.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=nn()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var o in this._valuesStartRepeat)this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var a in this._valuesEnd)i[a]=this._valuesEnd[a];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,o,i,a){for(var s in o){var l=n[s],u=Array.isArray(l),c=u?"array":typeof l,h=!u&&Array.isArray(o[s]);if(!(c==="undefined"||c==="function")){if(h){var m=o[s];if(m.length===0)continue;for(var f=[l],g=0,p=m.length;g<p;g+=1){var _=this._handleRelativeValue(l,m[g]);if(isNaN(_)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(_)}h&&(o[s]=f)}if((c==="object"||u)&&l&&!h){r[s]=u?[]:{};var b=l;for(var v in b)r[s][v]=b[v];i[s]=u?[]:{};var m=o[s];if(!this._isDynamic){var I={};for(var v in m)I[v]=m[v];o[s]=m=I}this._setupProperties(b,r[s],m,i[s],a)}else(typeof r[s]>"u"||a)&&(r[s]=l),u||(r[s]*=1),h?i[s]=o[s].slice().reverse():i[s]=r[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(n){return n===void 0&&(n=nn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this)},e.prototype.resume=function(n){return n===void 0&&(n=nn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;n<r;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n?(n.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var n;return(n=this._group)===null||n===void 0||n.remove(this),this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=At.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=pr.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,r){var o=this,i;if(n===void 0&&(n=nn()),r===void 0&&(r=e.autoStartOnUpdate),this._isPaused)return!0;var a;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(n,!0);else return!1;if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var s=n-this._startTime,l=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),u=this._duration+this._repeat*l,c=function(){if(o._duration===0||s>u)return 1;var _=Math.trunc(s/l),b=s-_*l,v=Math.min(b/o._duration,1);return v===0&&s===o._duration?1:v},h=c(),m=this._easingFunction(h);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,m),this._onUpdateCallback&&this._onUpdateCallback(this._object,h),this._duration===0||s>=this._duration)if(this._repeat>0){var f=Math.min(Math.trunc((s-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=f);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*f,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var g=0,p=this._chainedTweens.length;g<p;g++)this._chainedTweens[g].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,r,o,i){for(var a in o)if(r[a]!==void 0){var s=r[a]||0,l=o[a],u=Array.isArray(n[a]),c=Array.isArray(l),h=!u&&c;h?n[a]=this._interpolationFunction(l,i):typeof l=="object"&&l?this._updateProperties(n[a],s,l,i):(l=this._handleRelativeValue(s,l),typeof l=="number"&&(n[a]=s+(l-s)*i))}},e.prototype._handleRelativeValue=function(n,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?n+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(n){var r=this._valuesStartRepeat[n],o=this._valuesEnd[n];typeof o=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(o):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=r},e.autoStartOnUpdate=!1,e}();bi.nextId;var Ye=gr;Ye.getAll.bind(Ye);Ye.removeAll.bind(Ye);Ye.add.bind(Ye);Ye.remove.bind(Ye);Ye.update.bind(Ye);function Co(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function ul(e){if(Array.isArray(e))return e}function fl(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function ml(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function hl(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,a,s,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(o=a.call(r)).done)&&(l.push(o.value),l.length!==n);u=!0);}catch(h){c=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return l}}function pl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
223
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gl(e,n){return ul(e)||hl(e,n)||yl(e,n)||pl()}function yl(e,n){if(e){if(typeof e=="string")return Co(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Co(e,n):void 0}}var vl=ml(function e(n,r){var o=r.default,i=o===void 0?null:o,a=r.triggerUpdate,s=a===void 0?!0:a,l=r.onChange,u=l===void 0?function(c,h){}:l;fl(this,e),this.name=n,this.defaultVal=i,this.triggerUpdate=s,this.onChange=u});function Pr(e){var n=e.stateInit,r=n===void 0?function(){return{}}:n,o=e.props,i=o===void 0?{}:o,a=e.methods,s=a===void 0?{}:a,l=e.aliases,u=l===void 0?{}:l,c=e.init,h=c===void 0?function(){}:c,m=e.update,f=m===void 0?function(){}:m,g=Object.keys(i).map(function(p){return new vl(p,i[p])});return function p(){for(var _=arguments.length,b=new Array(_),v=0;v<_;v++)b[v]=arguments[v];var I=!!(this instanceof p&&this.constructor),D=I?b.shift():void 0,P=b[0],x=P===void 0?{}:P,N=Object.assign({},r instanceof Function?r(x):r,{initialised:!1}),S={};function A(z){return U(z,x),M(),A}var U=function(F,B){h.call(A,F,N,B),N.initialised=!0},M=Da(function(){N.initialised&&(f.call(A,N,S),S={})},1);return g.forEach(function(z){A[z.name]=F(z);function F(B){var K=B.name,J=B.triggerUpdate,ne=J===void 0?!1:J,Y=B.onChange,ye=Y===void 0?function(ie,ae){}:Y,Ne=B.defaultVal,j=Ne===void 0?null:Ne;return function(ie){var ae=N[K];if(!arguments.length)return ae;var re=ie===void 0?j:ie;return N[K]=re,ye.call(A,re,N,ae),!S.hasOwnProperty(K)&&(S[K]=ae),ne&&M(),A}}}),Object.keys(s).forEach(function(z){A[z]=function(){for(var F,B=arguments.length,K=new Array(B),J=0;J<B;J++)K[J]=arguments[J];return(F=s[z]).call.apply(F,[A,N].concat(K))}}),Object.entries(u).forEach(function(z){var F=gl(z,2),B=F[0],K=F[1];return A[B]=A[K]}),A.resetProps=function(){return g.forEach(function(z){A[z.name](z.defaultVal)}),A},A.resetProps(),N._rerender=M,I&&D&&A(D),A}}var oe=function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}};function Nn(e){"@babel/helpers - typeof";return Nn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Nn(e)}var bl=/^\s+/,xl=/\s+$/;function W(e,n){if(e=e||"",n=n||{},e instanceof W)return e;if(!(this instanceof W))return new W(e,n);var r=_l(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||r.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}W.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var n=this.toRgb();return(n.r*299+n.g*587+n.b*114)/1e3},getLuminance:function(){var n=this.toRgb(),r,o,i,a,s,l;return r=n.r/255,o=n.g/255,i=n.b/255,r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),o<=.03928?s=o/12.92:s=Math.pow((o+.055)/1.055,2.4),i<=.03928?l=i/12.92:l=Math.pow((i+.055)/1.055,2.4),.2126*a+.7152*s+.0722*l},setAlpha:function(n){return this._a=xi(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=Do(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=Do(this._r,this._g,this._b),r=Math.round(n.h*360),o=Math.round(n.s*100),i=Math.round(n.v*100);return this._a==1?"hsv("+r+", "+o+"%, "+i+"%)":"hsva("+r+", "+o+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var n=So(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=So(this._r,this._g,this._b),r=Math.round(n.h*360),o=Math.round(n.s*100),i=Math.round(n.l*100);return this._a==1?"hsl("+r+", "+o+"%, "+i+"%)":"hsla("+r+", "+o+"%, "+i+"%, "+this._roundA+")"},toHex:function(n){return Po(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return Cl(this._r,this._g,this._b,this._a,n)},toHex8String:function(n){return"#"+this.toHex8(n)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(me(this._r,255)*100)+"%",g:Math.round(me(this._g,255)*100)+"%",b:Math.round(me(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(me(this._r,255)*100)+"%, "+Math.round(me(this._g,255)*100)+"%, "+Math.round(me(this._b,255)*100)+"%)":"rgba("+Math.round(me(this._r,255)*100)+"%, "+Math.round(me(this._g,255)*100)+"%, "+Math.round(me(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Fl[Po(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+No(this._r,this._g,this._b,this._a),o=r,i=this._gradientType?"GradientType = 1, ":"";if(n){var a=W(n);o="#"+No(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+o+")"},toString:function(n){var r=!!n;n=n||this._format;var o=!1,i=this._a<1&&this._a>=0,a=!r&&i&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return a?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(o=this.toRgbString()),n==="prgb"&&(o=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(o=this.toHexString()),n==="hex3"&&(o=this.toHexString(!0)),n==="hex4"&&(o=this.toHex8String(!0)),n==="hex8"&&(o=this.toHex8String()),n==="name"&&(o=this.toName()),n==="hsl"&&(o=this.toHslString()),n==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},clone:function(){return W(this.toString())},_applyModification:function(n,r){var o=n.apply(null,[this].concat([].slice.call(r)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(Nl,arguments)},brighten:function(){return this._applyModification(Al,arguments)},darken:function(){return this._applyModification(Tl,arguments)},desaturate:function(){return this._applyModification(Sl,arguments)},saturate:function(){return this._applyModification(Dl,arguments)},greyscale:function(){return this._applyModification(Pl,arguments)},spin:function(){return this._applyModification(Ml,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(Ol,arguments)},complement:function(){return this._applyCombination(jl,arguments)},monochromatic:function(){return this._applyCombination(Rl,arguments)},splitcomplement:function(){return this._applyCombination(El,arguments)},triad:function(){return this._applyCombination(Ao,[3])},tetrad:function(){return this._applyCombination(Ao,[4])}};W.fromRatio=function(e,n){if(Nn(e)=="object"){var r={};for(var o in e)e.hasOwnProperty(o)&&(o==="a"?r[o]=e[o]:r[o]=rn(e[o]));e=r}return W(e,n)};function _l(e){var n={r:0,g:0,b:0},r=1,o=null,i=null,a=null,s=!1,l=!1;return typeof e=="string"&&(e=Ul(e)),Nn(e)=="object"&&(rt(e.r)&&rt(e.g)&&rt(e.b)?(n=wl(e.r,e.g,e.b),s=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):rt(e.h)&&rt(e.s)&&rt(e.v)?(o=rn(e.s),i=rn(e.v),n=Il(e.h,o,i),s=!0,l="hsv"):rt(e.h)&&rt(e.s)&&rt(e.l)&&(o=rn(e.s),a=rn(e.l),n=kl(e.h,o,a),s=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=xi(r),{ok:s,format:e.format||l,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function wl(e,n,r){return{r:me(e,255)*255,g:me(n,255)*255,b:me(r,255)*255}}function So(e,n,r){e=me(e,255),n=me(n,255),r=me(r,255);var o=Math.max(e,n,r),i=Math.min(e,n,r),a,s,l=(o+i)/2;if(o==i)a=s=0;else{var u=o-i;switch(s=l>.5?u/(2-o-i):u/(o+i),o){case e:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-e)/u+2;break;case r:a=(e-n)/u+4;break}a/=6}return{h:a,s,l}}function kl(e,n,r){var o,i,a;e=me(e,360),n=me(n,100),r=me(r,100);function s(c,h,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?c+(h-c)*6*m:m<1/2?h:m<2/3?c+(h-c)*(2/3-m)*6:c}if(n===0)o=i=a=r;else{var l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;o=s(u,l,e+1/3),i=s(u,l,e),a=s(u,l,e-1/3)}return{r:o*255,g:i*255,b:a*255}}function Do(e,n,r){e=me(e,255),n=me(n,255),r=me(r,255);var o=Math.max(e,n,r),i=Math.min(e,n,r),a,s,l=o,u=o-i;if(s=o===0?0:u/o,o==i)a=0;else{switch(o){case e:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-e)/u+2;break;case r:a=(e-n)/u+4;break}a/=6}return{h:a,s,v:l}}function Il(e,n,r){e=me(e,360)*6,n=me(n,100),r=me(r,100);var o=Math.floor(e),i=e-o,a=r*(1-n),s=r*(1-i*n),l=r*(1-(1-i)*n),u=o%6,c=[r,s,a,a,l,r][u],h=[l,r,r,s,a,a][u],m=[a,a,l,r,r,s][u];return{r:c*255,g:h*255,b:m*255}}function Po(e,n,r,o){var i=[Be(Math.round(e).toString(16)),Be(Math.round(n).toString(16)),Be(Math.round(r).toString(16))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function Cl(e,n,r,o,i){var a=[Be(Math.round(e).toString(16)),Be(Math.round(n).toString(16)),Be(Math.round(r).toString(16)),Be(_i(o))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function No(e,n,r,o){var i=[Be(_i(o)),Be(Math.round(e).toString(16)),Be(Math.round(n).toString(16)),Be(Math.round(r).toString(16))];return i.join("")}W.equals=function(e,n){return!e||!n?!1:W(e).toRgbString()==W(n).toRgbString()};W.random=function(){return W.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Sl(e,n){n=n===0?0:n||10;var r=W(e).toHsl();return r.s-=n/100,r.s=Rn(r.s),W(r)}function Dl(e,n){n=n===0?0:n||10;var r=W(e).toHsl();return r.s+=n/100,r.s=Rn(r.s),W(r)}function Pl(e){return W(e).desaturate(100)}function Nl(e,n){n=n===0?0:n||10;var r=W(e).toHsl();return r.l+=n/100,r.l=Rn(r.l),W(r)}function Al(e,n){n=n===0?0:n||10;var r=W(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(n/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(n/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(n/100)))),W(r)}function Tl(e,n){n=n===0?0:n||10;var r=W(e).toHsl();return r.l-=n/100,r.l=Rn(r.l),W(r)}function Ml(e,n){var r=W(e).toHsl(),o=(r.h+n)%360;return r.h=o<0?360+o:o,W(r)}function jl(e){var n=W(e).toHsl();return n.h=(n.h+180)%360,W(n)}function Ao(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=W(e).toHsl(),o=[W(e)],i=360/n,a=1;a<n;a++)o.push(W({h:(r.h+a*i)%360,s:r.s,l:r.l}));return o}function El(e){var n=W(e).toHsl(),r=n.h;return[W(e),W({h:(r+72)%360,s:n.s,l:n.l}),W({h:(r+216)%360,s:n.s,l:n.l})]}function Ol(e,n,r){n=n||6,r=r||30;var o=W(e).toHsl(),i=360/r,a=[W(e)];for(o.h=(o.h-(i*n>>1)+720)%360;--n;)o.h=(o.h+i)%360,a.push(W(o));return a}function Rl(e,n){n=n||6;for(var r=W(e).toHsv(),o=r.h,i=r.s,a=r.v,s=[],l=1/n;n--;)s.push(W({h:o,s:i,v:a})),a=(a+l)%1;return s}W.mix=function(e,n,r){r=r===0?0:r||50;var o=W(e).toRgb(),i=W(n).toRgb(),a=r/100,s={r:(i.r-o.r)*a+o.r,g:(i.g-o.g)*a+o.g,b:(i.b-o.b)*a+o.b,a:(i.a-o.a)*a+o.a};return W(s)};W.readability=function(e,n){var r=W(e),o=W(n);return(Math.max(r.getLuminance(),o.getLuminance())+.05)/(Math.min(r.getLuminance(),o.getLuminance())+.05)};W.isReadable=function(e,n,r){var o=W.readability(e,n),i,a;switch(a=!1,i=Bl(r),i.level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7;break}return a};W.mostReadable=function(e,n,r){var o=null,i=0,a,s,l,u;r=r||{},s=r.includeFallbackColors,l=r.level,u=r.size;for(var c=0;c<n.length;c++)a=W.readability(e,n[c]),a>i&&(i=a,o=W(n[c]));return W.isReadable(e,o,{level:l,size:u})||!s?o:(r.includeFallbackColors=!1,W.mostReadable(e,["#fff","#000"],r))};var yr=W.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Fl=W.hexNames=Ll(yr);function Ll(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function xi(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function me(e,n){zl(e)&&(e="100%");var r=$l(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function Rn(e){return Math.min(1,Math.max(0,e))}function Ee(e){return parseInt(e,16)}function zl(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function $l(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Be(e){return e.length==1?"0"+e:""+e}function rn(e){return e<=1&&(e=e*100+"%"),e}function _i(e){return Math.round(parseFloat(e)*255).toString(16)}function To(e){return Ee(e)/255}var Ue=function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+o),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+o),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+o),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function rt(e){return!!Ue.CSS_UNIT.exec(e)}function Ul(e){e=e.replace(bl,"").replace(xl,"").toLowerCase();var n=!1;if(yr[e])e=yr[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Ue.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=Ue.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Ue.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=Ue.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Ue.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=Ue.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Ue.hex8.exec(e))?{r:Ee(r[1]),g:Ee(r[2]),b:Ee(r[3]),a:To(r[4]),format:n?"name":"hex8"}:(r=Ue.hex6.exec(e))?{r:Ee(r[1]),g:Ee(r[2]),b:Ee(r[3]),format:n?"name":"hex"}:(r=Ue.hex4.exec(e))?{r:Ee(r[1]+""+r[1]),g:Ee(r[2]+""+r[2]),b:Ee(r[3]+""+r[3]),a:To(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=Ue.hex3.exec(e))?{r:Ee(r[1]+""+r[1]),g:Ee(r[2]+""+r[2]),b:Ee(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function Bl(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function vr(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function Hl(e){if(Array.isArray(e))return vr(e)}function wi(e,n,r){if(typeof e=="function"?e===n:e.has(n))return arguments.length<3?n:r;throw new TypeError("Private element is not present on this object")}function Vl(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Gl(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function Fe(e,n){return e.get(wi(e,n))}function Mo(e,n,r){Vl(e,n),n.set(e,r)}function jo(e,n,r){return e.set(wi(e,n),r),r}function Wl(e,n){for(var r=0;r<n.length;r++){var o=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,Zl(o.key),o)}}function ql(e,n,r){return n&&Wl(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kl(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Yl(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
224
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jl(e){return Hl(e)||Kl(e)||Ql(e)||Yl()}function Xl(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Zl(e){var n=Xl(e,"string");return typeof n=="symbol"?n:n+""}function Ql(e,n){if(e){if(typeof e=="string")return vr(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vr(e,n):void 0}}var ec=123,tc=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},ki=function(n,r,o){return(n<<16)+(r<<8)+o},nc=function(n){var r=W(n).toRgb(),o=r.r,i=r.g,a=r.b;return ki(o,i,a)},Eo=function(n,r){return n*ec%Math.pow(2,r)},Dt=new WeakMap,ot=new WeakMap,rc=function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;Gl(this,e),Mo(this,Dt,void 0),Mo(this,ot,void 0),jo(ot,this,n),this.reset()}return ql(e,[{key:"reset",value:function(){jo(Dt,this,["__reserved for background__"])}},{key:"register",value:function(r){if(Fe(Dt,this).length>=Math.pow(2,24-Fe(ot,this)))return null;var o=Fe(Dt,this).length,i=Eo(o,Fe(ot,this)),a=tc(o+(i<<24-Fe(ot,this)));return Fe(Dt,this).push(r),a}},{key:"lookup",value:function(r){if(!r)return null;var o=typeof r=="string"?nc(r):ki.apply(void 0,Jl(r));if(!o)return null;var i=o&Math.pow(2,24-Fe(ot,this))-1,a=o>>24-Fe(ot,this)&Math.pow(2,Fe(ot,this))-1;return Eo(i,Fe(ot,this))!==a||i>=Fe(Dt,this).length?null:Fe(Dt,this)[i]}}])}(),un,he,Ii,Ci,xt,Oo,Si,Di,Kn,In,on,Pi,Nr,br,xr,An={},Tn=[],oc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Fn=Array.isArray;function qe(e,n){for(var r in n)e[r]=n[r];return e}function Ar(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ic(e,n,r){var o,i,a,s={};for(a in n)a=="key"?o=n[a]:a=="ref"?i=n[a]:s[a]=n[a];if(arguments.length>2&&(s.children=arguments.length>3?un.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)s[a]===void 0&&(s[a]=e.defaultProps[a]);return an(e,s,o,i,null)}function an(e,n,r,o,i){var a={type:e,props:n,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Ii,__i:-1,__u:0};return i==null&&he.vnode!=null&&he.vnode(a),a}function Ln(e){return e.children}function Cn(e,n){this.props=e,this.context=n}function Mt(e,n){if(n==null)return e.__?Mt(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Mt(e):null}function ac(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],i=[],a=qe({},n);a.__v=n.__v+1,he.vnode&&he.vnode(a),Tr(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,r??Mt(n),!!(32&n.__u),i),a.__v=n.__v,a.__.__k[a.__i]=a,ji(o,a,i),n.__e=n.__=null,a.__e!=r&&Ni(a)}}function Ni(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),Ni(e)}function Ro(e){(!e.__d&&(e.__d=!0)&&xt.push(e)&&!Mn.__r++||Oo!=he.debounceRendering)&&((Oo=he.debounceRendering)||Si)(Mn)}function Mn(){try{for(var e,n=1;xt.length;)xt.length>n&&xt.sort(Di),e=xt.shift(),n=xt.length,ac(e)}finally{xt.length=Mn.__r=0}}function Ai(e,n,r,o,i,a,s,l,u,c,h){var m,f,g,p,_,b,v=o&&o.__k||Tn,I=n.length;for(u=sc(r,n,v,u,I),m=0;m<I;m++)(g=r.__k[m])!=null&&(f=g.__i!=-1&&v[g.__i]||An,g.__i=m,b=Tr(e,g,f,i,a,s,l,u,c,h),p=g.__e,g.ref&&f.ref!=g.ref&&(f.ref&&Mr(f.ref,null,g),h.push(g.ref,g.__c||p,g)),_==null&&p!=null&&(_=p),4&g.__u?(u=Ti(g,u,e),f.__e&&(f.__e=null)):typeof g.type=="function"&&b!==void 0?u=b:p&&(u=p.nextSibling),g.__u&=-7);return r.__e=_,u}function sc(e,n,r,o,i){var a,s,l,u,c,h=r.length,m=h,f=0;for(e.__k=new Array(i),a=0;a<i;a++)(s=n[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[a]=an(null,s,null,null,null):Fn(s)?s=e.__k[a]=an(Ln,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=an(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,u=a+f,s.__=e,s.__b=e.__b+1,l=null,(c=s.__i=lc(s,r,u,m))!=-1&&(m--,(l=r[c])&&(l.__u|=2)),l==null||l.__v==null?(c==-1&&(i>h?f--:i<h&&f++),typeof s.type!="function"&&(s.__u|=4)):c!=u&&(c==u-1?f--:c==u+1?f++:(c>u?f--:f++,s.__u|=4))):e.__k[a]=null;if(m)for(a=0;a<h;a++)(l=r[a])!=null&&!(2&l.__u)&&(l.__e==o&&(o=Mt(l)),Oi(l,l));return o}function Ti(e,n,r){var o,i;if(typeof e.type=="function"){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,n=Ti(o[i],n,r));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=Mt(e)),n=r.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function lc(e,n,r,o){var i,a,s,l=e.key,u=e.type,c=n[r],h=c!=null&&(2&c.__u)==0;if(c===null&&l==null||h&&l==c.key&&u==c.type)return r;if(o>(h?1:0)){for(i=r-1,a=r+1;i>=0||a<n.length;)if((c=n[s=i>=0?i--:a++])!=null&&!(2&c.__u)&&l==c.key&&u==c.type)return s}return-1}function Fo(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||oc.test(n)?r:r+"px"}function _n(e,n,r,o,i){var a,s;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(n in o)r&&n in r||Fo(e.style,n,"");if(r)for(n in r)o&&r[n]==o[n]||Fo(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(Pi,"$1")),s=n.toLowerCase(),n=s in e||n=="onFocusOut"||n=="onFocusIn"?s.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=r,r?o?r[on]=o[on]:(r[on]=Nr,e.addEventListener(n,a?xr:br,a)):e.removeEventListener(n,a?xr:br,a);else{if(i=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function Lo(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[In]==null)n[In]=Nr++;else if(n[In]<r[on])return;return r(he.event?he.event(n):n)}}}function Tr(e,n,r,o,i,a,s,l,u,c){var h,m,f,g,p,_,b,v,I,D,P,x,N,S,A,U,M=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),a=[l=n.__e=r.__e]),(h=he.__b)&&h(n);e:if(typeof M=="function"){m=s.length;try{if(I=n.props,D=M.prototype&&M.prototype.render,P=(h=M.contextType)&&o[h.__c],x=h?P?P.props.value:h.__:o,r.__c?v=(f=n.__c=r.__c).__=f.__E:(D?n.__c=f=new M(I,x):(n.__c=f=new Cn(I,x),f.constructor=M,f.render=dc),P&&P.sub(f),f.state||(f.state={}),f.__n=o,g=f.__d=!0,f.__h=[],f._sb=[]),D&&f.__s==null&&(f.__s=f.state),D&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=qe({},f.__s)),qe(f.__s,M.getDerivedStateFromProps(I,f.__s))),p=f.props,_=f.state,f.__v=n,g)D&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),D&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(D&&M.getDerivedStateFromProps==null&&I!==p&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(I,x),n.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(I,f.__s,x)===!1){n.__v!=r.__v&&(f.props=I,f.state=f.__s,f.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(z){z&&(z.__=n)}),Tn.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f),l=Mt(r);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(I,f.__s,x),D&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(p,_,b)})}if(f.context=x,f.props=I,f.__P=e,f.__e=!1,N=he.__r,S=0,D)f.state=f.__s,f.__d=!1,N&&N(n),h=f.render(f.props,f.state,f.context),Tn.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,N&&N(n),h=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++S<25);f.state=f.__s,f.getChildContext!=null&&(o=qe(qe({},o),f.getChildContext())),D&&!g&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(p,_)),A=h!=null&&h.type===Ln&&h.key==null?Ei(h.props.children):h,l=Ai(e,Fn(A)?A:[A],n,r,o,i,a,s,l,u,c),f.base=n.__e,n.__u&=-161,f.__h.length&&s.push(f),v&&(f.__E=f.__=null)}catch(z){if(s.length=m,n.__v=null,u||a!=null){if(z.then){for(n.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),n.__e=l}else if(a!=null)for(U=a.length;U--;)Ar(a[U])}else n.__e=r.__e;n.__k==null&&(n.__k=r.__k||[]),z.then||Mi(n),he.__e(z,n,r)}}else a==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=cc(r.__e,n,r,o,i,a,s,u,c);return(h=he.diffed)&&h(n),128&n.__u?void 0:l}function Mi(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Mi))}function ji(e,n,r){for(var o=0;o<r.length;o++)Mr(r[o],r[++o],r[++o]);he.__c&&he.__c(n,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){he.__e(a,i.__v)}})}function Ei(e){return typeof e!="object"||e==null||e.__b>0?e:Fn(e)?e.map(Ei):e.constructor!==void 0?null:qe({},e)}function cc(e,n,r,o,i,a,s,l,u){var c,h,m,f,g,p,_,b=r.props||An,v=n.props,I=n.type;if(I=="svg"?i="http://www.w3.org/2000/svg":I=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(c=0;c<a.length;c++)if((g=a[c])&&"setAttribute"in g==!!I&&(I?g.localName==I:g.nodeType==3)){e=g,a[c]=null;break}}if(e==null){if(I==null)return document.createTextNode(v);e=document.createElementNS(i,I,v.is&&v),l&&(he.__m&&he.__m(n,a),l=!1),a=null}if(I==null)b===v||l&&e.data==v||(e.data=v);else{if(a=I=="textarea"&&v.defaultValue!=null?null:a&&un.call(e.childNodes),!l&&a!=null)for(b={},c=0;c<e.attributes.length;c++)b[(g=e.attributes[c]).name]=g.value;for(c in b)g=b[c],c=="dangerouslySetInnerHTML"?m=g:c=="children"||c in v||c=="value"&&"defaultValue"in v||c=="checked"&&"defaultChecked"in v||_n(e,c,null,g,i);for(c in v)g=v[c],c=="children"?f=g:c=="dangerouslySetInnerHTML"?h=g:c=="value"?p=g:c=="checked"?_=g:l&&typeof g!="function"||b[c]===g||_n(e,c,g,b[c],i);if(h)l||m&&(h.__html==m.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(m&&(e.innerHTML=""),Ai(n.type=="template"?e.content:e,Fn(f)?f:[f],n,r,o,I=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:r.__k&&Mt(r,0),l,u),a!=null)for(c=a.length;c--;)Ar(a[c]);l&&I!="textarea"||(c="value",I=="progress"&&p==null?e.removeAttribute("value"):p!=null&&(p!==e[c]||I=="progress"&&!p||I=="option"&&p!=b[c])&&_n(e,c,p,b[c],i),c="checked",_!=null&&_!=e[c]&&_n(e,c,_,b[c],i))}return e}function Mr(e,n,r){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&n==null||(e.__u=e(n))}else e.current=n}catch(i){he.__e(i,r)}}function Oi(e,n,r){var o,i;if(he.unmount&&he.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Mr(o,null,n)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){he.__e(a,n)}o.base=o.__P=o.__n=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&Oi(o[i],n,r||typeof e.type!="function");r||Ar(e.__e),e.__c=e.__=e.__e=void 0}function dc(e,n,r){return this.constructor(e,r)}function uc(e,n,r){var o,i,a,s;n==document&&(n=document.documentElement),he.__&&he.__(e,n),i=(o=!1)?null:n.__k,a=[],s=[],Tr(n,e=n.__k=ic(Ln,null,[e]),i||An,An,n.namespaceURI,i?null:n.firstChild?un.call(n.childNodes):null,a,i?i.__e:n.firstChild,o,s),ji(a,e,s),e.props.children=null}function Ri(e,n,r){var o,i,a,s,l=qe({},e.props);for(a in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),n)a=="key"?o=n[a]:a=="ref"?i=n[a]:l[a]=n[a]===void 0&&s!=null?s[a]:n[a];return arguments.length>2&&(l.children=arguments.length>3?un.call(arguments,2):r),an(e.type,l,o||e.key,i||e.ref,null)}un=Tn.slice,he={__e:function(e,n,r,o){for(var i,a,s;n=n.__;)if((i=n.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),s=i.__d),s)return i.__E=i}catch(l){e=l}throw e}},Ii=0,Ci=function(e){return e!=null&&e.constructor===void 0},Cn.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=qe({},this.state),typeof e=="function"&&(e=e(qe({},r),this.props)),e&&qe(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),Ro(this))},Cn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ro(this))},Cn.prototype.render=Ln,xt=[],Si=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Di=function(e,n){return e.__v.__b-n.__v.__b},Mn.__r=0,Kn=Math.random().toString(8),In="__d"+Kn,on="__a"+Kn,Pi=/(PointerCapture)$|Capture$/i,Nr=0,br=Lo(!1),xr=Lo(!0);function zo(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function fc(e){if(Array.isArray(e))return e}function mc(e,n,r){return(n=bc(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function hc(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,a,s,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(o=a.call(r)).done)&&(l.push(o.value),l.length!==n);u=!0);}catch(h){c=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return l}}function pc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
225
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $o(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,o)}return r}function gc(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?$o(Object(r),!0).forEach(function(o){mc(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$o(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function yc(e,n){return fc(e)||hc(e,n)||xc(e,n)||pc()}function vc(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function bc(e){var n=vc(e,"string");return typeof n=="symbol"?n:n+""}function jn(e){"@babel/helpers - typeof";return jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},jn(e)}function xc(e,n){if(e){if(typeof e=="string")return zo(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zo(e,n):void 0}}var _r=function(n){if(jn(n)!=="object")return n;var r=Ri(n);if(r.props){var o;r.props=gc({},r.props),r!=null&&(o=r.props)!==null&&o!==void 0&&o.children&&(r.props.children=Array.isArray(r.props.children)?r.props.children.map(_r):_r(r.props.children))}return r},_c=function(n){return Ci(Ri(n))},wc=function(n,r){delete r.__k,uc(_r(n),r)};function kc(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",r==="top"&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var Ic=`.float-tooltip-kap {
|
|
226
|
+
position: absolute;
|
|
227
|
+
width: max-content; /* prevent shrinking near right edge */
|
|
228
|
+
max-width: max(50%, 150px);
|
|
229
|
+
padding: 3px 5px;
|
|
230
|
+
border-radius: 3px;
|
|
231
|
+
font: 12px sans-serif;
|
|
232
|
+
color: #eee;
|
|
233
|
+
background: rgba(0,0,0,0.6);
|
|
234
|
+
pointer-events: none;
|
|
235
|
+
}
|
|
236
|
+
`;kc(Ic);var Cc=Pr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.style,a=i===void 0?{}:i,s=!!n&&jn(n)==="object"&&!!n.node&&typeof n.node=="function",l=cr(s?n.node():n);l.style("position")==="static"&&l.style("position","relative"),r.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(a).forEach(function(c){var h=yc(c,2),m=h[0],f=h[1];return r.tooltipEl.style(m,f)}),r.tooltipEl.style("left","-10000px").style("display","none");var u="tooltip-".concat(Math.round(Math.random()*1e12));r.mouseInside=!1,l.on("mousemove.".concat(u),function(c){r.mouseInside=!0;var h=Pa(c),m=l.node(),f=m.offsetWidth,g=m.offsetHeight,p=[r.offsetX===null||r.offsetX===void 0?"-".concat(h[0]/f*100,"%"):typeof r.offsetX=="number"?"calc(-50% + ".concat(r.offsetX,"px)"):r.offsetX,r.offsetY===null||r.offsetY===void 0?g>130&&g-h[1]<100?"calc(-100% - 6px)":"21px":typeof r.offsetY=="number"?r.offsetY<0?"calc(-100% - ".concat(Math.abs(r.offsetY),"px)"):"".concat(r.offsetY,"px"):r.offsetY];r.tooltipEl.style("left",h[0]+"px").style("top",h[1]+"px").style("transform","translate(".concat(p.join(","),")")),r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(u),function(){r.mouseInside=!0,r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(u),function(){r.mouseInside=!1,r.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):_c(n.content)?(n.tooltipEl.text(""),wc(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});function Sc(e,n,r){var o,i=1;e==null&&(e=0),n==null&&(n=0),r==null&&(r=0);function a(){var s,l=o.length,u,c=0,h=0,m=0;for(s=0;s<l;++s)u=o[s],c+=u.x||0,h+=u.y||0,m+=u.z||0;for(c=(c/l-e)*i,h=(h/l-n)*i,m=(m/l-r)*i,s=0;s<l;++s)u=o[s],c&&(u.x-=c),h&&(u.y-=h),m&&(u.z-=m)}return a.initialize=function(s){o=s},a.x=function(s){return arguments.length?(e=+s,a):e},a.y=function(s){return arguments.length?(n=+s,a):n},a.z=function(s){return arguments.length?(r=+s,a):r},a.strength=function(s){return arguments.length?(i=+s,a):i},a}function Dc(e){const n=+this._x.call(null,e);return Fi(this.cover(n),n,e)}function Fi(e,n,r){if(isNaN(n))return e;var o,i=e._root,a={data:r},s=e._x0,l=e._x1,u,c,h,m,f;if(!i)return e._root=a,e;for(;i.length;)if((h=n>=(u=(s+l)/2))?s=u:l=u,o=i,!(i=i[m=+h]))return o[m]=a,e;if(c=+e._x.call(null,i.data),n===c)return a.next=i,o?o[m]=a:e._root=a,e;do o=o?o[m]=new Array(2):e._root=new Array(2),(h=n>=(u=(s+l)/2))?s=u:l=u;while((m=+h)==(f=+(c>=u)));return o[f]=i,o[m]=a,e}function Pc(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n);let o=1/0,i=-1/0;for(let a=0,s;a<n;++a)isNaN(s=+this._x.call(null,e[a]))||(r[a]=s,s<o&&(o=s),s>i&&(i=s));if(o>i)return this;this.cover(o).cover(i);for(let a=0;a<n;++a)Fi(this,r[a],e[a]);return this}function Nc(e){if(isNaN(e=+e))return this;var n=this._x0,r=this._x1;if(isNaN(n))r=(n=Math.floor(e))+1;else{for(var o=r-n||1,i=this._root,a,s;n>e||e>=r;)switch(s=+(e<n),a=new Array(2),a[s]=i,i=a,o*=2,s){case 0:r=n+o;break;case 1:n=r-o;break}this._root&&this._root.length&&(this._root=i)}return this._x0=n,this._x1=r,this}function Ac(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function Tc(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function dt(e,n,r){this.node=e,this.x0=n,this.x1=r}function Mc(e,n){var r,o=this._x0,i,a,s=this._x1,l=[],u=this._root,c,h;for(u&&l.push(new dt(u,o,s)),n==null?n=1/0:(o=e-n,s=e+n);c=l.pop();)if(!(!(u=c.node)||(i=c.x0)>s||(a=c.x1)<o))if(u.length){var m=(i+a)/2;l.push(new dt(u[1],m,a),new dt(u[0],i,m)),(h=+(e>=m))&&(c=l[l.length-1],l[l.length-1]=l[l.length-1-h],l[l.length-1-h]=c)}else{var f=Math.abs(e-+this._x.call(null,u.data));f<n&&(n=f,o=e-f,s=e+f,r=u.data)}return r}function jc(e){if(isNaN(u=+this._x.call(null,e)))return this;var n,r=this._root,o,i,a,s=this._x0,l=this._x1,u,c,h,m,f;if(!r)return this;if(r.length)for(;;){if((h=u>=(c=(s+l)/2))?s=c:l=c,n=r,!(r=r[m=+h]))return this;if(!r.length)break;n[m+1&1]&&(o=n,f=m)}for(;r.data!==e;)if(i=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,i?(a?i.next=a:delete i.next,this):n?(a?n[m]=a:delete n[m],(r=n[0]||n[1])&&r===(n[1]||n[0])&&!r.length&&(o?o[f]=r:this._root=r),this):(this._root=a,this)}function Ec(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function Oc(){return this._root}function Rc(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function Fc(e){var n=[],r,o=this._root,i,a,s;for(o&&n.push(new dt(o,this._x0,this._x1));r=n.pop();)if(!e(o=r.node,a=r.x0,s=r.x1)&&o.length){var l=(a+s)/2;(i=o[1])&&n.push(new dt(i,l,s)),(i=o[0])&&n.push(new dt(i,a,l))}return this}function Lc(e){var n=[],r=[],o;for(this._root&&n.push(new dt(this._root,this._x0,this._x1));o=n.pop();){var i=o.node;if(i.length){var a,s=o.x0,l=o.x1,u=(s+l)/2;(a=i[0])&&n.push(new dt(a,s,u)),(a=i[1])&&n.push(new dt(a,u,l))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.x1);return this}function zc(e){return e[0]}function $c(e){return arguments.length?(this._x=e,this):this._x}function Li(e,n){var r=new jr(n??zc,NaN,NaN);return e==null?r:r.addAll(e)}function jr(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function Uo(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Me=Li.prototype=jr.prototype;Me.copy=function(){var e=new jr(this._x,this._x0,this._x1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=Uo(n),e;for(r=[{source:n,target:e._root=new Array(2)}];n=r.pop();)for(var i=0;i<2;++i)(o=n.source[i])&&(o.length?r.push({source:o,target:n.target[i]=new Array(2)}):n.target[i]=Uo(o));return e};Me.add=Dc;Me.addAll=Pc;Me.cover=Nc;Me.data=Ac;Me.extent=Tc;Me.find=Mc;Me.remove=jc;Me.removeAll=Ec;Me.root=Oc;Me.size=Rc;Me.visit=Fc;Me.visitAfter=Lc;Me.x=$c;function Uc(e){const n=+this._x.call(null,e),r=+this._y.call(null,e),o=+this._z.call(null,e);return zi(this.cover(n,r,o),n,r,o,e)}function zi(e,n,r,o,i){if(isNaN(n)||isNaN(r)||isNaN(o))return e;var a,s=e._root,l={data:i},u=e._x0,c=e._y0,h=e._z0,m=e._x1,f=e._y1,g=e._z1,p,_,b,v,I,D,P,x,N,S,A;if(!s)return e._root=l,e;for(;s.length;)if((P=n>=(p=(u+m)/2))?u=p:m=p,(x=r>=(_=(c+f)/2))?c=_:f=_,(N=o>=(b=(h+g)/2))?h=b:g=b,a=s,!(s=s[S=N<<2|x<<1|P]))return a[S]=l,e;if(v=+e._x.call(null,s.data),I=+e._y.call(null,s.data),D=+e._z.call(null,s.data),n===v&&r===I&&o===D)return l.next=s,a?a[S]=l:e._root=l,e;do a=a?a[S]=new Array(8):e._root=new Array(8),(P=n>=(p=(u+m)/2))?u=p:m=p,(x=r>=(_=(c+f)/2))?c=_:f=_,(N=o>=(b=(h+g)/2))?h=b:g=b;while((S=N<<2|x<<1|P)===(A=(D>=b)<<2|(I>=_)<<1|v>=p));return a[A]=s,a[S]=l,e}function Bc(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n),o=new Float64Array(n),i=new Float64Array(n);let a=1/0,s=1/0,l=1/0,u=-1/0,c=-1/0,h=-1/0;for(let m=0,f,g,p,_;m<n;++m)isNaN(g=+this._x.call(null,f=e[m]))||isNaN(p=+this._y.call(null,f))||isNaN(_=+this._z.call(null,f))||(r[m]=g,o[m]=p,i[m]=_,g<a&&(a=g),g>u&&(u=g),p<s&&(s=p),p>c&&(c=p),_<l&&(l=_),_>h&&(h=_));if(a>u||s>c||l>h)return this;this.cover(a,s,l).cover(u,c,h);for(let m=0;m<n;++m)zi(this,r[m],o[m],i[m],e[m]);return this}function Hc(e,n,r){if(isNaN(e=+e)||isNaN(n=+n)||isNaN(r=+r))return this;var o=this._x0,i=this._y0,a=this._z0,s=this._x1,l=this._y1,u=this._z1;if(isNaN(o))s=(o=Math.floor(e))+1,l=(i=Math.floor(n))+1,u=(a=Math.floor(r))+1;else{for(var c=s-o||1,h=this._root,m,f;o>e||e>=s||i>n||n>=l||a>r||r>=u;)switch(f=(r<a)<<2|(n<i)<<1|e<o,m=new Array(8),m[f]=h,h=m,c*=2,f){case 0:s=o+c,l=i+c,u=a+c;break;case 1:o=s-c,l=i+c,u=a+c;break;case 2:s=o+c,i=l-c,u=a+c;break;case 3:o=s-c,i=l-c,u=a+c;break;case 4:s=o+c,l=i+c,a=u-c;break;case 5:o=s-c,l=i+c,a=u-c;break;case 6:s=o+c,i=l-c,a=u-c;break;case 7:o=s-c,i=l-c,a=u-c;break}this._root&&this._root.length&&(this._root=h)}return this._x0=o,this._y0=i,this._z0=a,this._x1=s,this._y1=l,this._z1=u,this}function Vc(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function Gc(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function se(e,n,r,o,i,a,s){this.node=e,this.x0=n,this.y0=r,this.z0=o,this.x1=i,this.y1=a,this.z1=s}function Wc(e,n,r,o){var i,a=this._x0,s=this._y0,l=this._z0,u,c,h,m,f,g,p=this._x1,_=this._y1,b=this._z1,v=[],I=this._root,D,P;for(I&&v.push(new se(I,a,s,l,p,_,b)),o==null?o=1/0:(a=e-o,s=n-o,l=r-o,p=e+o,_=n+o,b=r+o,o*=o);D=v.pop();)if(!(!(I=D.node)||(u=D.x0)>p||(c=D.y0)>_||(h=D.z0)>b||(m=D.x1)<a||(f=D.y1)<s||(g=D.z1)<l))if(I.length){var x=(u+m)/2,N=(c+f)/2,S=(h+g)/2;v.push(new se(I[7],x,N,S,m,f,g),new se(I[6],u,N,S,x,f,g),new se(I[5],x,c,S,m,N,g),new se(I[4],u,c,S,x,N,g),new se(I[3],x,N,h,m,f,S),new se(I[2],u,N,h,x,f,S),new se(I[1],x,c,h,m,N,S),new se(I[0],u,c,h,x,N,S)),(P=(r>=S)<<2|(n>=N)<<1|e>=x)&&(D=v[v.length-1],v[v.length-1]=v[v.length-1-P],v[v.length-1-P]=D)}else{var A=e-+this._x.call(null,I.data),U=n-+this._y.call(null,I.data),M=r-+this._z.call(null,I.data),z=A*A+U*U+M*M;if(z<o){var F=Math.sqrt(o=z);a=e-F,s=n-F,l=r-F,p=e+F,_=n+F,b=r+F,i=I.data}}return i}const qc=(e,n,r,o,i,a)=>Math.sqrt((e-o)**2+(n-i)**2+(r-a)**2);function Kc(e,n,r,o){const i=[],a=e-o,s=n-o,l=r-o,u=e+o,c=n+o,h=r+o;return this.visit((m,f,g,p,_,b,v)=>{if(!m.length)do{const I=m.data;qc(e,n,r,this._x(I),this._y(I),this._z(I))<=o&&i.push(I)}while(m=m.next);return f>u||g>c||p>h||_<a||b<s||v<l}),i}function Yc(e){if(isNaN(f=+this._x.call(null,e))||isNaN(g=+this._y.call(null,e))||isNaN(p=+this._z.call(null,e)))return this;var n,r=this._root,o,i,a,s=this._x0,l=this._y0,u=this._z0,c=this._x1,h=this._y1,m=this._z1,f,g,p,_,b,v,I,D,P,x,N;if(!r)return this;if(r.length)for(;;){if((I=f>=(_=(s+c)/2))?s=_:c=_,(D=g>=(b=(l+h)/2))?l=b:h=b,(P=p>=(v=(u+m)/2))?u=v:m=v,n=r,!(r=r[x=P<<2|D<<1|I]))return this;if(!r.length)break;(n[x+1&7]||n[x+2&7]||n[x+3&7]||n[x+4&7]||n[x+5&7]||n[x+6&7]||n[x+7&7])&&(o=n,N=x)}for(;r.data!==e;)if(i=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,i?(a?i.next=a:delete i.next,this):n?(a?n[x]=a:delete n[x],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(o?o[N]=r:this._root=r),this):(this._root=a,this)}function Jc(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function Xc(){return this._root}function Zc(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function Qc(e){var n=[],r,o=this._root,i,a,s,l,u,c,h;for(o&&n.push(new se(o,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=n.pop();)if(!e(o=r.node,a=r.x0,s=r.y0,l=r.z0,u=r.x1,c=r.y1,h=r.z1)&&o.length){var m=(a+u)/2,f=(s+c)/2,g=(l+h)/2;(i=o[7])&&n.push(new se(i,m,f,g,u,c,h)),(i=o[6])&&n.push(new se(i,a,f,g,m,c,h)),(i=o[5])&&n.push(new se(i,m,s,g,u,f,h)),(i=o[4])&&n.push(new se(i,a,s,g,m,f,h)),(i=o[3])&&n.push(new se(i,m,f,l,u,c,g)),(i=o[2])&&n.push(new se(i,a,f,l,m,c,g)),(i=o[1])&&n.push(new se(i,m,s,l,u,f,g)),(i=o[0])&&n.push(new se(i,a,s,l,m,f,g))}return this}function ed(e){var n=[],r=[],o;for(this._root&&n.push(new se(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));o=n.pop();){var i=o.node;if(i.length){var a,s=o.x0,l=o.y0,u=o.z0,c=o.x1,h=o.y1,m=o.z1,f=(s+c)/2,g=(l+h)/2,p=(u+m)/2;(a=i[0])&&n.push(new se(a,s,l,u,f,g,p)),(a=i[1])&&n.push(new se(a,f,l,u,c,g,p)),(a=i[2])&&n.push(new se(a,s,g,u,f,h,p)),(a=i[3])&&n.push(new se(a,f,g,u,c,h,p)),(a=i[4])&&n.push(new se(a,s,l,p,f,g,m)),(a=i[5])&&n.push(new se(a,f,l,p,c,g,m)),(a=i[6])&&n.push(new se(a,s,g,p,f,h,m)),(a=i[7])&&n.push(new se(a,f,g,p,c,h,m))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.y0,o.z0,o.x1,o.y1,o.z1);return this}function td(e){return e[0]}function nd(e){return arguments.length?(this._x=e,this):this._x}function rd(e){return e[1]}function od(e){return arguments.length?(this._y=e,this):this._y}function id(e){return e[2]}function ad(e){return arguments.length?(this._z=e,this):this._z}function $i(e,n,r,o){var i=new Er(n??td,r??rd,o??id,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Er(e,n,r,o,i,a,s,l,u){this._x=e,this._y=n,this._z=r,this._x0=o,this._y0=i,this._z0=a,this._x1=s,this._y1=l,this._z1=u,this._root=void 0}function Bo(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Ie=$i.prototype=Er.prototype;Ie.copy=function(){var e=new Er(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=Bo(n),e;for(r=[{source:n,target:e._root=new Array(8)}];n=r.pop();)for(var i=0;i<8;++i)(o=n.source[i])&&(o.length?r.push({source:o,target:n.target[i]=new Array(8)}):n.target[i]=Bo(o));return e};Ie.add=Uc;Ie.addAll=Bc;Ie.cover=Hc;Ie.data=Vc;Ie.extent=Gc;Ie.find=Wc;Ie.findAllWithinRadius=Kc;Ie.remove=Yc;Ie.removeAll=Jc;Ie.root=Xc;Ie.size=Zc;Ie.visit=Qc;Ie.visitAfter=ed;Ie.x=nd;Ie.y=od;Ie.z=ad;function ct(e){return function(){return e}}function st(e){return(e()-.5)*1e-6}function sd(e){return e.index}function Ho(e,n){var r=e.get(n);if(!r)throw new Error("node not found: "+n);return r}function ld(e){var n=sd,r=f,o,i=ct(30),a,s,l,u,c,h,m=1;e==null&&(e=[]);function f(v){return 1/Math.min(u[v.source.index],u[v.target.index])}function g(v){for(var I=0,D=e.length;I<m;++I)for(var P=0,x,N,S,A=0,U=0,M=0,z,F;P<D;++P)x=e[P],N=x.source,S=x.target,A=S.x+S.vx-N.x-N.vx||st(h),l>1&&(U=S.y+S.vy-N.y-N.vy||st(h)),l>2&&(M=S.z+S.vz-N.z-N.vz||st(h)),z=Math.sqrt(A*A+U*U+M*M),z=(z-a[P])/z*v*o[P],A*=z,U*=z,M*=z,S.vx-=A*(F=c[P]),l>1&&(S.vy-=U*F),l>2&&(S.vz-=M*F),N.vx+=A*(F=1-F),l>1&&(N.vy+=U*F),l>2&&(N.vz+=M*F)}function p(){if(s){var v,I=s.length,D=e.length,P=new Map(s.map((N,S)=>[n(N,S,s),N])),x;for(v=0,u=new Array(I);v<D;++v)x=e[v],x.index=v,typeof x.source!="object"&&(x.source=Ho(P,x.source)),typeof x.target!="object"&&(x.target=Ho(P,x.target)),u[x.source.index]=(u[x.source.index]||0)+1,u[x.target.index]=(u[x.target.index]||0)+1;for(v=0,c=new Array(D);v<D;++v)x=e[v],c[v]=u[x.source.index]/(u[x.source.index]+u[x.target.index]);o=new Array(D),_(),a=new Array(D),b()}}function _(){if(s)for(var v=0,I=e.length;v<I;++v)o[v]=+r(e[v],v,e)}function b(){if(s)for(var v=0,I=e.length;v<I;++v)a[v]=+i(e[v],v,e)}return g.initialize=function(v,...I){s=v,h=I.find(D=>typeof D=="function")||Math.random,l=I.find(D=>[1,2,3].includes(D))||2,p()},g.links=function(v){return arguments.length?(e=v,p(),g):e},g.id=function(v){return arguments.length?(n=v,g):n},g.iterations=function(v){return arguments.length?(m=+v,g):m},g.strength=function(v){return arguments.length?(r=typeof v=="function"?v:ct(+v),_(),g):r},g.distance=function(v){return arguments.length?(i=typeof v=="function"?v:ct(+v),b(),g):i},g}const cd=1664525,dd=1013904223,Vo=4294967296;function ud(){let e=1;return()=>(e=(cd*e+dd)%Vo)/Vo}var Go=3;function Yn(e){return e.x}function Wo(e){return e.y}function fd(e){return e.z}var md=10,hd=Math.PI*(3-Math.sqrt(5)),pd=Math.PI*20/(9+Math.sqrt(221));function gd(e,n){n=n||2;var r=Math.min(Go,Math.max(1,Math.round(n))),o,i=1,a=.001,s=1-Math.pow(a,1/300),l=0,u=.6,c=new Map,h=Na(g),m=Aa("tick","end"),f=ud();e==null&&(e=[]);function g(){p(),m.call("tick",o),i<a&&(h.stop(),m.call("end",o))}function p(v){var I,D=e.length,P;v===void 0&&(v=1);for(var x=0;x<v;++x)for(i+=(l-i)*s,c.forEach(function(N){N(i)}),I=0;I<D;++I)P=e[I],P.fx==null?P.x+=P.vx*=u:(P.x=P.fx,P.vx=0),r>1&&(P.fy==null?P.y+=P.vy*=u:(P.y=P.fy,P.vy=0)),r>2&&(P.fz==null?P.z+=P.vz*=u:(P.z=P.fz,P.vz=0));return o}function _(){for(var v=0,I=e.length,D;v<I;++v){if(D=e[v],D.index=v,D.fx!=null&&(D.x=D.fx),D.fy!=null&&(D.y=D.fy),D.fz!=null&&(D.z=D.fz),isNaN(D.x)||r>1&&isNaN(D.y)||r>2&&isNaN(D.z)){var P=md*(r>2?Math.cbrt(.5+v):r>1?Math.sqrt(.5+v):v),x=v*hd,N=v*pd;r===1?D.x=P:r===2?(D.x=P*Math.cos(x),D.y=P*Math.sin(x)):(D.x=P*Math.sin(x)*Math.cos(N),D.y=P*Math.cos(x),D.z=P*Math.sin(x)*Math.sin(N))}(isNaN(D.vx)||r>1&&isNaN(D.vy)||r>2&&isNaN(D.vz))&&(D.vx=0,r>1&&(D.vy=0),r>2&&(D.vz=0))}}function b(v){return v.initialize&&v.initialize(e,f,r),v}return _(),o={tick:p,restart:function(){return h.restart(g),o},stop:function(){return h.stop(),o},numDimensions:function(v){return arguments.length?(r=Math.min(Go,Math.max(1,Math.round(v))),c.forEach(b),o):r},nodes:function(v){return arguments.length?(e=v,_(),c.forEach(b),o):e},alpha:function(v){return arguments.length?(i=+v,o):i},alphaMin:function(v){return arguments.length?(a=+v,o):a},alphaDecay:function(v){return arguments.length?(s=+v,o):+s},alphaTarget:function(v){return arguments.length?(l=+v,o):l},velocityDecay:function(v){return arguments.length?(u=1-v,o):1-u},randomSource:function(v){return arguments.length?(f=v,c.forEach(b),o):f},force:function(v,I){return arguments.length>1?(I==null?c.delete(v):c.set(v,b(I)),o):c.get(v)},find:function(){var v=Array.prototype.slice.call(arguments),I=v.shift()||0,D=(r>1?v.shift():null)||0,P=(r>2?v.shift():null)||0,x=v.shift()||1/0,N=0,S=e.length,A,U,M,z,F,B;for(x*=x,N=0;N<S;++N)F=e[N],A=I-F.x,U=D-(F.y||0),M=P-(F.z||0),z=A*A+U*U+M*M,z<x&&(B=F,x=z);return B},on:function(v,I){return arguments.length>1?(m.on(v,I),o):m.on(v)}}}function yd(){var e,n,r,o,i,a=ct(-30),s,l=1,u=1/0,c=.81;function h(p){var _,b=e.length,v=(n===1?Li(e,Yn):n===2?Ta(e,Yn,Wo):n===3?$i(e,Yn,Wo,fd):null).visitAfter(f);for(i=p,_=0;_<b;++_)r=e[_],v.visit(g)}function m(){if(e){var p,_=e.length,b;for(s=new Array(_),p=0;p<_;++p)b=e[p],s[b.index]=+a(b,p,e)}}function f(p){var _=0,b,v,I=0,D,P,x,N,S=p.length;if(S){for(D=P=x=N=0;N<S;++N)(b=p[N])&&(v=Math.abs(b.value))&&(_+=b.value,I+=v,D+=v*(b.x||0),P+=v*(b.y||0),x+=v*(b.z||0));_*=Math.sqrt(4/S),p.x=D/I,n>1&&(p.y=P/I),n>2&&(p.z=x/I)}else{b=p,b.x=b.data.x,n>1&&(b.y=b.data.y),n>2&&(b.z=b.data.z);do _+=s[b.data.index];while(b=b.next)}p.value=_}function g(p,_,b,v,I){if(!p.value)return!0;var D=[b,v,I][n-1],P=p.x-r.x,x=n>1?p.y-r.y:0,N=n>2?p.z-r.z:0,S=D-_,A=P*P+x*x+N*N;if(S*S/c<A)return A<u&&(P===0&&(P=st(o),A+=P*P),n>1&&x===0&&(x=st(o),A+=x*x),n>2&&N===0&&(N=st(o),A+=N*N),A<l&&(A=Math.sqrt(l*A)),r.vx+=P*p.value*i/A,n>1&&(r.vy+=x*p.value*i/A),n>2&&(r.vz+=N*p.value*i/A)),!0;if(p.length||A>=u)return;(p.data!==r||p.next)&&(P===0&&(P=st(o),A+=P*P),n>1&&x===0&&(x=st(o),A+=x*x),n>2&&N===0&&(N=st(o),A+=N*N),A<l&&(A=Math.sqrt(l*A)));do p.data!==r&&(S=s[p.data.index]*i/A,r.vx+=P*S,n>1&&(r.vy+=x*S),n>2&&(r.vz+=N*S));while(p=p.next)}return h.initialize=function(p,..._){e=p,o=_.find(b=>typeof b=="function")||Math.random,n=_.find(b=>[1,2,3].includes(b))||2,m()},h.strength=function(p){return arguments.length?(a=typeof p=="function"?p:ct(+p),m(),h):a},h.distanceMin=function(p){return arguments.length?(l=p*p,h):Math.sqrt(l)},h.distanceMax=function(p){return arguments.length?(u=p*p,h):Math.sqrt(u)},h.theta=function(p){return arguments.length?(c=p*p,h):Math.sqrt(c)},h}function vd(e,n,r,o){var i,a,s=ct(.1),l,u;typeof e!="function"&&(e=ct(+e)),n==null&&(n=0),r==null&&(r=0),o==null&&(o=0);function c(m){for(var f=0,g=i.length;f<g;++f){var p=i[f],_=p.x-n||1e-6,b=(p.y||0)-r||1e-6,v=(p.z||0)-o||1e-6,I=Math.sqrt(_*_+b*b+v*v),D=(u[f]-I)*l[f]*m/I;p.vx+=_*D,a>1&&(p.vy+=b*D),a>2&&(p.vz+=v*D)}}function h(){if(i){var m,f=i.length;for(l=new Array(f),u=new Array(f),m=0;m<f;++m)u[m]=+e(i[m],m,i),l[m]=isNaN(u[m])?0:+s(i[m],m,i)}}return c.initialize=function(m,...f){i=m,a=f.find(g=>[1,2,3].includes(g))||2,h()},c.strength=function(m){return arguments.length?(s=typeof m=="function"?m:ct(+m),h(),c):s},c.radius=function(m){return arguments.length?(e=typeof m=="function"?m:ct(+m),h(),c):e},c.x=function(m){return arguments.length?(n=+m,c):n},c.y=function(m){return arguments.length?(r=+m,c):r},c.z=function(m){return arguments.length?(o=+m,c):o},c}const{abs:Xt,cos:it,sin:Vt,acos:bd,atan2:Zt,sqrt:yt,pow:Le}=Math;function Qt(e){return e<0?-Le(-e,1/3):Le(e,1/3)}const Ui=Math.PI,wn=2*Ui,vt=Ui/2,xd=1e-6,Jn=Number.MAX_SAFE_INTEGER||9007199254740991,Xn=Number.MIN_SAFE_INTEGER||-9007199254740991,_d={x:0,y:0,z:0},$={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let o=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(o+=r.z*r.z),yt(o)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const o=n.length-1;if(e===1)return n[o].t=1,n[o];const i=1-e;let a=n;if(o===0)return n[0].t=e,n[0];if(o===1){const l={x:i*a[0].x+e*a[1].x,y:i*a[0].y+e*a[1].y,t:e};return r&&(l.z=i*a[0].z+e*a[1].z),l}if(o<4){let l=i*i,u=e*e,c,h,m,f=0;o===2?(a=[a[0],a[1],a[2],_d],c=l,h=i*e*2,m=u):o===3&&(c=l*i,h=l*e*3,m=i*u*3,f=e*u);const g={x:c*a[0].x+h*a[1].x+m*a[2].x+f*a[3].x,y:c*a[0].y+h*a[1].y+m*a[2].y+f*a[3].y,t:e};return r&&(g.z=c*a[0].z+h*a[1].z+m*a[2].z+f*a[3].z),g}const s=JSON.parse(JSON.stringify(n));for(;s.length>1;){for(let l=0;l<s.length-1;l++)s[l]={x:s[l].x+(s[l+1].x-s[l].x)*e,y:s[l].y+(s[l+1].y-s[l].y)*e},typeof s[l].z<"u"&&(s[l].z=s[l].z+(s[l+1].z-s[l].z)*e);s.splice(s.length-1,1)}return s[0].t=e,s[0]},computeWithRatios:function(e,n,r,o){const i=1-e,a=r,s=n;let l=a[0],u=a[1],c=a[2],h=a[3],m;if(l*=i,u*=e,s.length===2)return m=l+u,{x:(l*s[0].x+u*s[1].x)/m,y:(l*s[0].y+u*s[1].y)/m,z:o?(l*s[0].z+u*s[1].z)/m:!1,t:e};if(l*=i,u*=2*i,c*=e*e,s.length===3)return m=l+u+c,{x:(l*s[0].x+u*s[1].x+c*s[2].x)/m,y:(l*s[0].y+u*s[1].y+c*s[2].y)/m,z:o?(l*s[0].z+u*s[1].z+c*s[2].z)/m:!1,t:e};if(l*=i,u*=1.5*i,c*=3*i,h*=e*e*e,s.length===4)return m=l+u+c+h,{x:(l*s[0].x+u*s[1].x+c*s[2].x+h*s[3].x)/m,y:(l*s[0].y+u*s[1].y+c*s[2].y+h*s[3].y)/m,z:o?(l*s[0].z+u*s[1].z+c*s[2].z+h*s[3].z)/m:!1,t:e}},derive:function(e,n){const r=[];for(let o=e,i=o.length,a=i-1;i>1;i--,a--){const s=[];for(let l=0,u;l<a;l++)u={x:a*(o[l+1].x-o[l].x),y:a*(o[l+1].y-o[l].y)},n&&(u.z=a*(o[l+1].z-o[l].z)),s.push(u);r.push(s),o=s}return r},between:function(e,n,r){return n<=e&&e<=r||$.approximately(e,n)||$.approximately(e,r)},approximately:function(e,n,r){return Xt(e-n)<=(r||xd)},length:function(e){const r=$.Tvalues.length;let o=0;for(let i=0,a;i<r;i++)a=.5*$.Tvalues[i]+.5,o+=$.Cvalues[i]*$.arcfn(a,e);return .5*o},map:function(e,n,r,o,i){const a=r-n,s=i-o,l=e-n,u=l/a;return o+s*u},lerp:function(e,n,r){const o={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(o.z=n.z+e*(r.z-n.z)),o},pointToString:function(e){let n=e.x+"/"+e.y;return typeof e.z<"u"&&(n+="/"+e.z),n},pointsToString:function(e){return"["+e.map($.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){const o=n.x-e.x,i=n.y-e.y,a=r.x-e.x,s=r.y-e.y,l=o*s-i*a,u=o*a+i*s;return Zt(l,u)},round:function(e,n){const r=""+e,o=r.indexOf(".");return parseFloat(r.substring(0,o+1+n))},dist:function(e,n){const r=e.x-n.x,o=e.y-n.y;return yt(r*r+o*o)},closest:function(e,n){let r=Le(2,63),o,i;return e.forEach(function(a,s){i=$.dist(n,a),i<r&&(r=i,o=s)}),{mdist:r,mpos:o}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Le(e,n)+Le(1-e,n),o=r-1;return Xt(o/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Le(1-e,n),o=Le(e,n)+r;return r/o},lli8:function(e,n,r,o,i,a,s,l){const u=(e*o-n*r)*(i-s)-(e-r)*(i*l-a*s),c=(e*o-n*r)*(a-l)-(n-o)*(i*l-a*s),h=(e-r)*(a-l)-(n-o)*(i-s);return h==0?!1:{x:u/h,y:c/h}},lli4:function(e,n,r,o){const i=e.x,a=e.y,s=n.x,l=n.y,u=r.x,c=r.y,h=o.x,m=o.y;return $.lli8(i,a,s,l,u,c,h,m)},lli:function(e,n){return $.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new ue(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=Jn,r=Jn,o=Xn,i=Xn;return e.forEach(function(a){const s=a.bbox();n>s.x.min&&(n=s.x.min),r>s.y.min&&(r=s.y.min),o<s.x.max&&(o=s.x.max),i<s.y.max&&(i=s.y.max)}),{x:{min:n,mid:(n+o)/2,max:o,size:o-n},y:{min:r,mid:(r+i)/2,max:i,size:i-r}}},shapeintersections:function(e,n,r,o,i){if(!$.bboxoverlap(n,o))return[];const a=[],s=[e.startcap,e.forward,e.back,e.endcap],l=[r.startcap,r.forward,r.back,r.endcap];return s.forEach(function(u){u.virtual||l.forEach(function(c){if(c.virtual)return;const h=u.intersects(c,i);h.length>0&&(h.c1=u,h.c2=c,h.s1=e,h.s2=r,a.push(h))})}),a},makeshape:function(e,n,r){const o=n.points.length,i=e.points.length,a=$.makeline(n.points[o-1],e.points[0]),s=$.makeline(e.points[i-1],n.points[0]),l={startcap:a,forward:e,back:n,endcap:s,bbox:$.findbbox([a,e,n,s])};return l.intersections=function(u){return $.shapeintersections(l,l.bbox,u,u.bbox,r)},l},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let o=Jn,i=Xn,a,s;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let l=0,u=r.length;l<u;l++)a=r[l],s=e.get(a),s[n]<o&&(o=s[n]),s[n]>i&&(i=s[n]);return{min:o,mid:(o+i)/2,max:i,size:i-o}},align:function(e,n){const r=n.p1.x,o=n.p1.y,i=-Zt(n.p2.y-o,n.p2.x-r),a=function(s){return{x:(s.x-r)*it(i)-(s.y-o)*Vt(i),y:(s.x-r)*Vt(i)+(s.y-o)*it(i)}};return e.map(a)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=e.length-1,o=$.align(e,n),i=function(S){return 0<=S&&S<=1};if(r===2){const S=o[0].y,A=o[1].y,U=o[2].y,M=S-2*A+U;if(M!==0){const z=-yt(A*A-S*U),F=-S+A,B=-(z+F)/M,K=-(-z+F)/M;return[B,K].filter(i)}else if(A!==U&&M===0)return[(2*A-U)/(2*A-2*U)].filter(i);return[]}const a=o[0].y,s=o[1].y,l=o[2].y,u=o[3].y;let c=-a+3*s-3*l+u,h=3*a-6*s+3*l,m=-3*a+3*s,f=a;if($.approximately(c,0)){if($.approximately(h,0))return $.approximately(m,0)?[]:[-f/m].filter(i);const S=yt(m*m-4*h*f),A=2*h;return[(S-m)/A,(-m-S)/A].filter(i)}h/=c,m/=c,f/=c;const g=(3*m-h*h)/3,p=g/3,_=(2*h*h*h-9*h*m+27*f)/27,b=_/2,v=b*b+p*p*p;let I,D,P,x,N;if(v<0){const S=-g/3,A=S*S*S,U=yt(A),M=-_/(2*U),z=M<-1?-1:M>1?1:M,F=bd(z),B=Qt(U),K=2*B;return P=K*it(F/3)-h/3,x=K*it((F+wn)/3)-h/3,N=K*it((F+2*wn)/3)-h/3,[P,x,N].filter(i)}else{if(v===0)return I=b<0?Qt(-b):-Qt(b),P=2*I-h/3,x=-I-h/3,[P,x].filter(i);{const S=yt(v);return I=Qt(-b+S),D=Qt(b+S),[I-D-h/3].filter(i)}}},droots:function(e){if(e.length===3){const n=e[0],r=e[1],o=e[2],i=n-2*r+o;if(i!==0){const a=-yt(r*r-n*o),s=-n+r,l=-(a+s)/i,u=-(-a+s)/i;return[l,u]}else if(r!==o&&i===0)return[(2*r-o)/(2*(r-o))];return[]}if(e.length===2){const n=e[0],r=e[1];return n!==r?[n/(n-r)]:[]}return[]},curvature:function(e,n,r,o,i){let a,s,l,u,c=0,h=0;const m=$.compute(e,n),f=$.compute(e,r),g=m.x*m.x+m.y*m.y;if(o?(a=yt(Le(m.y*f.z-f.y*m.z,2)+Le(m.z*f.x-f.z*m.x,2)+Le(m.x*f.y-f.x*m.y,2)),s=Le(g+m.z*m.z,3/2)):(a=m.x*f.y-m.y*f.x,s=Le(g,3/2)),a===0||s===0)return{k:0,r:0};if(c=a/s,h=s/a,!i){const p=$.curvature(e-.001,n,r,o,!0).k,_=$.curvature(e+.001,n,r,o,!0).k;u=(_-c+(c-p))/2,l=(Xt(_-c)+Xt(c-p))/2}return{k:c,r:h,dk:u,adk:l}},inflections:function(e){if(e.length<4)return[];const n=$.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,o=n[3].x*n[1].y,i=n[1].x*n[2].y,a=n[3].x*n[2].y,s=18*(-3*r+2*o+3*i-a),l=18*(3*r-o-3*i),u=18*(i-r);if($.approximately(s,0)){if(!$.approximately(l,0)){let f=-u/l;if(0<=f&&f<=1)return[f]}return[]}const c=2*s;if($.approximately(c,0))return[];const h=l*l-4*s*u;if(h<0)return[];const m=Math.sqrt(h);return[(m-l)/c,-(l+m)/c].filter(function(f){return 0<=f&&f<=1})},bboxoverlap:function(e,n){const r=["x","y"],o=r.length;for(let i=0,a,s,l,u;i<o;i++)if(a=r[i],s=e[a].mid,l=n[a].mid,u=(e[a].size+n[a].size)/2,Xt(s-l)>=u)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){const o=e.bbox(),i=n.bbox(),a=1e5,s=r||.5;if(o.x.size+o.y.size<s&&i.x.size+i.y.size<s)return[(a*(e._t1+e._t2)/2|0)/a+"/"+(a*(n._t1+n._t2)/2|0)/a];let l=e.split(.5),u=n.split(.5),c=[{left:l.left,right:u.left},{left:l.left,right:u.right},{left:l.right,right:u.right},{left:l.right,right:u.left}];c=c.filter(function(m){return $.bboxoverlap(m.left.bbox(),m.right.bbox())});let h=[];return c.length===0||(c.forEach(function(m){h=h.concat($.pairiteration(m.left,m.right,s))}),h=h.filter(function(m,f){return h.indexOf(m)===f})),h},getccenter:function(e,n,r){const o=n.x-e.x,i=n.y-e.y,a=r.x-n.x,s=r.y-n.y,l=o*it(vt)-i*Vt(vt),u=o*Vt(vt)+i*it(vt),c=a*it(vt)-s*Vt(vt),h=a*Vt(vt)+s*it(vt),m=(e.x+n.x)/2,f=(e.y+n.y)/2,g=(n.x+r.x)/2,p=(n.y+r.y)/2,_=m+l,b=f+u,v=g+c,I=p+h,D=$.lli8(m,f,_,b,g,p,v,I),P=$.dist(D,e);let x=Zt(e.y-D.y,e.x-D.x),N=Zt(n.y-D.y,n.x-D.x),S=Zt(r.y-D.y,r.x-D.x),A;return x<S?((x>N||N>S)&&(x+=wn),x>S&&(A=S,S=x,x=A)):S<N&&N<x?(A=S,S=x,x=A):S+=wn,D.s=x,D.e=S,D.r=P,D},numberSort:function(e,n){return e-n}};class sn{constructor(n){this.curves=[],this._3d=!1,n&&(this.curves=n,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(n){return $.pointsToString(n.points)}).join(", ")+"]"}addCurve(n){this.curves.push(n),this._3d=this._3d||n._3d}length(){return this.curves.map(function(n){return n.length()}).reduce(function(n,r){return n+r})}curve(n){return this.curves[n]}bbox(){const n=this.curves;for(var r=n[0].bbox(),o=1;o<n.length;o++)$.expandbox(r,n[o].bbox());return r}offset(n){const r=[];return this.curves.forEach(function(o){r.push(...o.offset(n))}),new sn(r)}}const{abs:en,min:qo,max:Ko,cos:wd,sin:kd,acos:Id,sqrt:tn}=Math,Cd=Math.PI;class ue{constructor(n){let r=n&&n.forEach?n:Array.from(arguments).slice(),o=!1;if(typeof r[0]=="object"){o=r.length;const g=[];r.forEach(function(p){["x","y","z"].forEach(function(_){typeof p[_]<"u"&&g.push(p[_])})}),r=g}let i=!1;const a=r.length;if(o){if(o>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(a!==6&&a!==8&&a!==9&&a!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const s=this._3d=!i&&(a===9||a===12)||n&&n[0]&&typeof n[0].z<"u",l=this.points=[];for(let g=0,p=s?3:2;g<a;g+=p){var u={x:r[g],y:r[g+1]};s&&(u.z=r[g+2]),l.push(u)}const c=this.order=l.length-1,h=this.dims=["x","y"];s&&h.push("z"),this.dimlen=h.length;const m=$.align(l,{p1:l[0],p2:l[c]}),f=$.dist(l[0],l[c]);this._linear=m.reduce((g,p)=>g+en(p.y),0)<f/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,o,i){if(typeof i>"u"&&(i=.5),i===0)return new ue(r,r,o);if(i===1)return new ue(n,r,r);const a=ue.getABC(2,n,r,o,i);return new ue(n,a.A,o)}static cubicFromPoints(n,r,o,i,a){typeof i>"u"&&(i=.5);const s=ue.getABC(3,n,r,o,i);typeof a>"u"&&(a=$.dist(r,s.C));const l=a*(1-i)/i,u=$.dist(n,o),c=(o.x-n.x)/u,h=(o.y-n.y)/u,m=a*c,f=a*h,g=l*c,p=l*h,_={x:r.x-m,y:r.y-f},b={x:r.x+g,y:r.y+p},v=s.A,I={x:v.x+(_.x-v.x)/(1-i),y:v.y+(_.y-v.y)/(1-i)},D={x:v.x+(b.x-v.x)/i,y:v.y+(b.y-v.y)/i},P={x:n.x+(I.x-n.x)/i,y:n.y+(I.y-n.y)/i},x={x:o.x+(D.x-o.x)/(1-i),y:o.y+(D.y-o.y)/(1-i)};return new ue(n,P,x,o)}static getUtils(){return $}getUtils(){return ue.getUtils()}static get PolyBezier(){return sn}valueOf(){return this.toString()}toString(){return $.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,o=n[0].y,i=["M",r,o,this.order===2?"Q":"C"];for(let a=1,s=n.length;a<s;a++)i.push(n[a].x),i.push(n[a].y);return i.join(" ")}setRatios(n){if(n.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=n,this._lut=[]}verify(){const n=this.coordDigest();n!==this._print&&(this._print=n,this.update())}coordDigest(){return this.points.map(function(n,r){return""+r+n.x+n.y+(n.z?n.z:0)}).join("")}update(){this._lut=[],this.dpoints=$.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,r=$.angle(n[0],n[this.order],n[1]);this.clockwise=r>0}length(){return $.length(this.derivative.bind(this))}static getABC(n=2,r,o,i,a=.5){const s=$.projectionratio(a,n),l=1-s,u={x:s*r.x+l*i.x,y:s*r.y+l*i.y},c=$.abcratio(a,n);return{A:{x:o.x+(o.x-u.x)/c,y:o.y+(o.y-u.y)/c},B:o,C:u,S:r,E:i}}getABC(n,r){r=r||this.get(n);let o=this.points[0],i=this.points[this.order];return ue.getABC(this.order,o,r,i,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,o,i;r<n;r++)i=r/(n-1),o=this.compute(i),o.t=i,this._lut.push(o);return this._lut}on(n,r){r=r||5;const o=this.getLUT(),i=[];for(let a=0,s,l=0;a<o.length;a++)s=o[a],$.dist(s,n)<r&&(i.push(s),l+=a/o.length);return i.length?t/=i.length:!1}project(n){const r=this.getLUT(),o=r.length-1,i=$.closest(r,n),a=i.mpos,s=(a-1)/o,l=(a+1)/o,u=.1/o;let c=i.mdist,h=s,m=h,f;c+=1;for(let g;h<l+u;h+=u)f=this.compute(h),g=$.dist(n,f),g<c&&(c=g,m=h);return m=m<0?0:m>1?1:m,f=this.compute(m),f.t=m,f.d=c,f}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?$.computeWithRatios(n,this.points,this.ratios,this._3d):$.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,r=[n[0]],o=n.length;for(let i=1,a,s;i<o;i++)a=n[i],s=n[i-1],r[i]={x:(o-i)/o*a.x+i/o*s.x,y:(o-i)/o*a.y+i/o*s.y};return r[o]=n[o-1],new ue(r)}derivative(n){return $.compute(n,this.dpoints[0],this._3d)}dderivative(n){return $.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new ue($.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return $.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return $.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const r=this.derivative(n),o=tn(r.x*r.x+r.y*r.y);return{t:n,x:-r.y/o,y:r.x/o}}__normal3(n){const r=this.derivative(n),o=this.derivative(n+.01),i=tn(r.x*r.x+r.y*r.y+r.z*r.z),a=tn(o.x*o.x+o.y*o.y+o.z*o.z);r.x/=i,r.y/=i,r.z/=i,o.x/=a,o.y/=a,o.z/=a;const s={x:o.y*r.z-o.z*r.y,y:o.z*r.x-o.x*r.z,z:o.x*r.y-o.y*r.x},l=tn(s.x*s.x+s.y*s.y+s.z*s.z);s.x/=l,s.y/=l,s.z/=l;const u=[s.x*s.x,s.x*s.y-s.z,s.x*s.z+s.y,s.x*s.y+s.z,s.y*s.y,s.y*s.z-s.x,s.x*s.z-s.y,s.y*s.z+s.x,s.z*s.z];return{t:n,x:u[0]*r.x+u[1]*r.y+u[2]*r.z,y:u[3]*r.x+u[4]*r.y+u[5]*r.z,z:u[6]*r.x+u[7]*r.y+u[8]*r.z}}hull(n){let r=this.points,o=[],i=[],a=0;for(i[a++]=r[0],i[a++]=r[1],i[a++]=r[2],this.order===3&&(i[a++]=r[3]);r.length>1;){o=[];for(let s=0,l,u=r.length-1;s<u;s++)l=$.lerp(n,r[s],r[s+1]),i[a++]=l,o.push(l);r=o}return i}split(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;const o=this.hull(n),i={left:this.order===2?new ue([o[0],o[3],o[5]]):new ue([o[0],o[4],o[7],o[9]]),right:this.order===2?new ue([o[5],o[4],o[2]]):new ue([o[9],o[8],o[6],o[3]]),span:o};return i.left._t1=$.map(0,0,1,this._t1,this._t2),i.left._t2=$.map(n,0,1,this._t1,this._t2),i.right._t1=$.map(n,0,1,this._t1,this._t2),i.right._t2=$.map(1,0,1,this._t1,this._t2),r?(r=$.map(r,n,1,0,1),i.right.split(r).left):i}extrema(){const n={};let r=[];return this.dims.forEach((function(o){let i=function(s){return s[o]},a=this.dpoints[0].map(i);n[o]=$.droots(a),this.order===3&&(a=this.dpoints[1].map(i),n[o]=n[o].concat($.droots(a))),n[o]=n[o].filter(function(s){return s>=0&&s<=1}),r=r.concat(n[o].sort($.numberSort))}).bind(this)),n.values=r.sort($.numberSort).filter(function(o,i){return r.indexOf(o)===i}),n}bbox(){const n=this.extrema(),r={};return this.dims.forEach((function(o){r[o]=$.getminmax(this,o,n[o])}).bind(this)),r}overlaps(n){const r=this.bbox(),o=n.bbox();return $.bboxoverlap(r,o)}offset(n,r){if(typeof r<"u"){const o=this.get(n),i=this.normal(n),a={c:o,n:i,x:o.x+i.x*r,y:o.y+i.y*r};return this._3d&&(a.z=o.z+i.z*r),a}if(this._linear){const o=this.normal(0),i=this.points.map(function(a){const s={x:a.x+n*o.x,y:a.y+n*o.y};return a.z&&o.z&&(s.z=a.z+n*o.z),s});return[new ue(i)]}return this.reduce().map(function(o){return o._linear?o.offset(n)[0]:o.scale(n)})}simple(){if(this.order===3){const i=$.angle(this.points[0],this.points[3],this.points[1]),a=$.angle(this.points[0],this.points[3],this.points[2]);if(i>0&&a<0||i<0&&a>0)return!1}const n=this.normal(0),r=this.normal(1);let o=n.x*r.x+n.y*r.y;return this._3d&&(o+=n.z*r.z),en(Id(o))<Cd/3}reduce(){let n,r=0,o=0,i=.01,a,s=[],l=[],u=this.extrema().values;for(u.indexOf(0)===-1&&(u=[0].concat(u)),u.indexOf(1)===-1&&u.push(1),r=u[0],n=1;n<u.length;n++)o=u[n],a=this.split(r,o),a._t1=r,a._t2=o,s.push(a),r=o;return s.forEach(function(c){for(r=0,o=0;o<=1;)for(o=r+i;o<=1+i;o+=i)if(a=c.split(r,o),!a.simple()){if(o-=i,en(r-o)<i)return[];a=c.split(r,o),a._t1=$.map(r,0,1,c._t1,c._t2),a._t2=$.map(o,0,1,c._t1,c._t2),l.push(a),r=o;break}r<1&&(a=c.split(r,1),a._t1=$.map(r,0,1,c._t1,c._t2),a._t2=c._t2,l.push(a))}),l}translate(n,r,o){o=typeof o=="number"?o:r;const i=this.order;let a=this.points.map((s,l)=>(1-l/i)*r+l/i*o);return new ue(this.points.map((s,l)=>({x:s.x+n.x*a[l],y:s.y+n.y*a[l]})))}scale(n){const r=this.order;let o=!1;if(typeof n=="function"&&(o=n),o&&r===2)return this.raise().scale(o);const i=this.clockwise,a=this.points;if(this._linear)return this.translate(this.normal(0),o?o(0):n,o?o(1):n);const s=o?o(0):n,l=o?o(1):n,u=[this.offset(0,10),this.offset(1,10)],c=[],h=$.lli4(u[0],u[0].c,u[1],u[1].c);if(!h)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(m){const f=c[m*r]=$.copy(a[m*r]);f.x+=(m?l:s)*u[m].n.x,f.y+=(m?l:s)*u[m].n.y}),o?([0,1].forEach(function(m){if(!(r===2&&m)){var f=a[m+1],g={x:f.x-h.x,y:f.y-h.y},p=o?o((m+1)/r):n;o&&!i&&(p=-p);var _=tn(g.x*g.x+g.y*g.y);g.x/=_,g.y/=_,c[m+1]={x:f.x+p*g.x,y:f.y+p*g.y}}}),new ue(c)):([0,1].forEach(m=>{if(r===2&&m)return;const f=c[m*r],g=this.derivative(m),p={x:f.x+g.x,y:f.y+g.y};c[m+1]=$.lli4(f,p,h,a[m+1])}),new ue(c))}outline(n,r,o,i){if(r=r===void 0?n:r,this._linear){const x=this.normal(0),N=this.points[0],S=this.points[this.points.length-1];let A,U,M;o===void 0&&(o=n,i=r),A={x:N.x+x.x*n,y:N.y+x.y*n},M={x:S.x+x.x*o,y:S.y+x.y*o},U={x:(A.x+M.x)/2,y:(A.y+M.y)/2};const z=[A,U,M];A={x:N.x-x.x*r,y:N.y-x.y*r},M={x:S.x-x.x*i,y:S.y-x.y*i},U={x:(A.x+M.x)/2,y:(A.y+M.y)/2};const F=[M,U,A],B=$.makeline(F[2],z[0]),K=$.makeline(z[2],F[0]),J=[B,new ue(z),K,new ue(F)];return new sn(J)}const a=this.reduce(),s=a.length,l=[];let u=[],c,h=0,m=this.length();const f=typeof o<"u"&&typeof i<"u";function g(x,N,S,A,U){return function(M){const z=A/S,F=(A+U)/S,B=N-x;return $.map(M,0,1,x+z*B,x+F*B)}}a.forEach(function(x){const N=x.length();f?(l.push(x.scale(g(n,o,m,h,N))),u.push(x.scale(g(-r,-i,m,h,N)))):(l.push(x.scale(n)),u.push(x.scale(-r))),h+=N}),u=u.map(function(x){return c=x.points,c[3]?x.points=[c[3],c[2],c[1],c[0]]:x.points=[c[2],c[1],c[0]],x}).reverse();const p=l[0].points[0],_=l[s-1].points[l[s-1].points.length-1],b=u[s-1].points[u[s-1].points.length-1],v=u[0].points[0],I=$.makeline(b,p),D=$.makeline(_,v),P=[I].concat(l).concat([D]).concat(u);return new sn(P)}outlineshapes(n,r,o){r=r||n;const i=this.outline(n,r).curves,a=[];for(let s=1,l=i.length;s<l/2;s++){const u=$.makeshape(i[s],i[l-s],o);u.startcap.virtual=s>1,u.endcap.virtual=s<l/2-1,a.push(u)}return a}intersects(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof ue&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(n){const r=qo(n.p1.x,n.p2.x),o=qo(n.p1.y,n.p2.y),i=Ko(n.p1.x,n.p2.x),a=Ko(n.p1.y,n.p2.y);return $.roots(this.points,n).filter(s=>{var l=this.get(s);return $.between(l.x,r,i)&&$.between(l.y,o,a)})}selfintersects(n){const r=this.reduce(),o=r.length-2,i=[];for(let a=0,s,l,u;a<o;a++)l=r.slice(a,a+1),u=r.slice(a+2),s=this.curveintersects(l,u,n),i.push(...s);return i}curveintersects(n,r,o){const i=[];n.forEach(function(s){r.forEach(function(l){s.overlaps(l)&&i.push({left:s,right:l})})});let a=[];return i.forEach(function(s){const l=$.pairiteration(s.left,s.right,o);l.length>0&&(a=a.concat(l))}),a}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,r,o,i){const a=(i-o)/4,s=this.get(o+a),l=this.get(i-a),u=$.dist(n,r),c=$.dist(n,s),h=$.dist(n,l);return en(c-u)+en(h-u)}_iterate(n,r){let o=0,i=1,a;do{a=0,i=1;let s=this.get(o),l,u,c,h,m=!1,f=!1,g,p=i,_=1;do if(f=m,h=c,p=(o+i)/2,l=this.get(p),u=this.get(i),c=$.getccenter(s,l,u),c.interval={start:o,end:i},m=this._error(c,s,o,i)<=n,g=f&&!m,g||(_=i),m){if(i>=1){if(c.interval.end=_=1,h=c,i>1){let v={x:c.x+c.r*wd(c.e),y:c.y+c.r*kd(c.e)};c.e+=$.angle({x:c.x,y:c.y},v,this.get(1))}break}i=i+(i-o)/2}else i=p;while(!g&&a++<100);if(a>=100)break;h=h||c,r.push(h),o=_}while(i<1);return r}}function wr(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function Sd(e){if(Array.isArray(e))return e}function Dd(e){if(Array.isArray(e))return wr(e)}function Pd(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Nd(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,a,s,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(o=a.call(r)).done)&&(l.push(o.value),l.length!==n);u=!0);}catch(h){c=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return l}}function Ad(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
237
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Td(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
238
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Md(e,n){if(e==null)return{};var r,o,i=jd(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],n.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function jd(e,n){if(e==null)return{};var r={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(n.includes(o))continue;r[o]=e[o]}return r}function Ed(e,n){return Sd(e)||Nd(e,n)||Bi(e,n)||Ad()}function Od(e){return Dd(e)||Pd(e)||Bi(e)||Td()}function Rd(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Fd(e){var n=Rd(e,"string");return typeof n=="symbol"?n:n+""}function Bi(e,n){if(e){if(typeof e=="string")return wr(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?wr(e,n):void 0}}var Ld=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=(n instanceof Array?n.length?n:[void 0]:[n]).map(function(l){return{keyAccessor:l,isProp:!(l instanceof Function)}}),a=e.reduce(function(l,u){var c=l,h=u;return i.forEach(function(m,f){var g=m.keyAccessor,p=m.isProp,_;if(p){var b=h,v=b[g],I=Md(b,[g].map(Fd));_=v,h=I}else _=g(h,f);f+1<i.length?(c.hasOwnProperty(_)||(c[_]={}),c=c[_]):r?(c.hasOwnProperty(_)||(c[_]=[]),c[_].push(h)):c[_]=h}),l},{});r instanceof Function&&function l(u){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;c===i.length?Object.keys(u).forEach(function(h){return u[h]=r(u[h])}):Object.values(u).forEach(function(h){return l(h,c+1)})}(a);var s=a;return o&&(s=[],function l(u){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];c.length===i.length?s.push({keys:c,vals:u}):Object.entries(u).forEach(function(h){var m=Ed(h,2),f=m[0],g=m[1];return l(g,[].concat(Od(c),[f]))})}(a),n instanceof Array&&n.length===0&&s.length===1&&(s[0].keys=[])),s};function zd(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",r==="top"&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var $d=`.force-graph-container canvas {
|
|
239
|
+
display: block;
|
|
240
|
+
user-select: none;
|
|
241
|
+
outline: none;
|
|
242
|
+
-webkit-tap-highlight-color: transparent;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.force-graph-container .clickable {
|
|
246
|
+
cursor: pointer;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.force-graph-container .grabbable {
|
|
250
|
+
cursor: move;
|
|
251
|
+
cursor: grab;
|
|
252
|
+
cursor: -moz-grab;
|
|
253
|
+
cursor: -webkit-grab;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.force-graph-container .grabbable:active {
|
|
257
|
+
cursor: grabbing;
|
|
258
|
+
cursor: -moz-grabbing;
|
|
259
|
+
cursor: -webkit-grabbing;
|
|
260
|
+
}
|
|
261
|
+
`;zd($d);function kr(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function Ud(e){if(Array.isArray(e))return e}function Bd(e){if(Array.isArray(e))return kr(e)}function Yo(e,n,r){if(Hi())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,n);var i=new(e.bind.apply(e,o));return i}function cn(e,n,r){return(n=Kd(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Hi(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hi=function(){return!!e})()}function Hd(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Vd(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,a,s,l=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(o=a.call(r)).done)&&(l.push(o.value),l.length!==n);u=!0);}catch(h){c=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return l}}function Gd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
262
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wd(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
263
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jo(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,o)}return r}function Gt(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Jo(Object(r),!0).forEach(function(o){cn(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jo(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function ln(e,n){return Ud(e)||Vd(e,n)||Vi(e,n)||Gd()}function ze(e){return Bd(e)||Hd(e)||Vi(e)||Wd()}function qd(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Kd(e){var n=qd(e,"string");return typeof n=="symbol"?n:n+""}function Ir(e){"@babel/helpers - typeof";return Ir=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ir(e)}function Vi(e,n){if(e){if(typeof e=="string")return kr(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kr(e,n):void 0}}var Yd=Ma(ja);function Xo(e,n,r){!n||typeof r!="string"||e.filter(function(o){return!o[r]}).forEach(function(o){o[r]=Yd(n(o))})}function Jd(e,n){var r=e.nodes,o=e.links,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.nodeFilter,s=a===void 0?function(){return!0}:a,l=i.onLoopError,u=l===void 0?function(g){throw"Invalid DAG structure! Found cycle in node path: ".concat(g.join(" -> "),".")}:l,c={};r.forEach(function(g){return c[n(g)]={data:g,out:[],depth:-1,skip:!s(g)}}),o.forEach(function(g){var p=g.source,_=g.target,b=P(p),v=P(_);if(!c.hasOwnProperty(b))throw"Missing source node with id: ".concat(b);if(!c.hasOwnProperty(v))throw"Missing target node with id: ".concat(v);var I=c[b],D=c[v];I.out.push(D);function P(x){return Ir(x)==="object"?n(x):x}});var h=[];f(Object.values(c));var m=Object.assign.apply(Object,[{}].concat(ze(Object.entries(c).filter(function(g){var p=ln(g,2),_=p[1];return!_.skip}).map(function(g){var p=ln(g,2),_=p[0],b=p[1];return cn({},_,b.depth)}))));return m;function f(g){for(var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,b=function(){var P=g[v];if(p.indexOf(P)!==-1){var x=[].concat(ze(p.slice(p.indexOf(P))),[P]).map(function(N){return n(N.data)});return h.some(function(N){return N.length===x.length&&N.every(function(S,A){return S===x[A]})})||(h.push(x),u(x)),1}_>P.depth&&(P.depth=_,f(P.out,[].concat(ze(p),[P]),_+(P.skip?0:1)))},v=0,I=g.length;v<I;v++)b()}}var Xd=2,Se=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},Zo=function(n,r){if(!r.isShadow){var o=oe(r.linkDirectionalParticles);r.graphData.links.forEach(function(i){var a=Math.round(Math.abs(o(i)));a?i.__photons=ze(Array(a)).map(function(){return{}}):delete i.__photons})}},En=Pr({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,Zo(n,r)}},dagMode:{onChange:function(n,r){!n&&(r.graphData.nodes||[]).forEach(function(o){return o.fx=o.fy=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(n){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4,triggerUpdate:!1,onChange:Se},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:Se},nodeColor:{default:"color",triggerUpdate:!1,onChange:Se},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:Se},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Se},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:Se},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:Se},linkColor:{default:"color",triggerUpdate:!1,onChange:Se},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:Se},linkWidth:{default:1,triggerUpdate:!1,onChange:Se},linkCurvature:{default:0,triggerUpdate:!1,onChange:Se},linkCanvasObject:{triggerUpdate:!1,onChange:Se},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Se},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:Se},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:Se},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:Se},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:Zo},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:4,triggerUpdate:!1},linkDirectionalParticleColor:{triggerUpdate:!1},linkDirectionalParticleCanvasObject:{triggerUpdate:!1},globalScale:{default:1,triggerUpdate:!1},d3AlphaMin:{default:0,triggerUpdate:!1},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaDecay(n)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaTarget(n)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.velocityDecay(n)}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1},onNeedsRedraw:{triggerUpdate:!1},isShadow:{default:!1,triggerUpdate:!1}},methods:{d3Force:function(n,r,o){return o===void 0?n.forceLayout.force(r):(n.forceLayout.force(r,o),this)},d3ReheatSimulation:function(n){return n.forceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(n){return n.cntTicks=0,n.startTickTime=new Date,n.engineRunning=!0,this},isEngineRunning:function(n){return!!n.engineRunning},tickFrame:function(n){return!n.isShadow&&r(),i(),!n.isShadow&&a(),!n.isShadow&&s(),o(),this;function r(){n.engineRunning&&(++n.cntTicks>n.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin?(n.engineRunning=!1,n.onEngineStop()):(n.forceLayout.tick(),n.onEngineTick()))}function o(){var l=oe(n.nodeVisibility),u=oe(n.nodeVal),c=oe(n.nodeColor),h=oe(n.nodeCanvasObjectMode),m=n.ctx,f=n.isShadow/n.globalScale,g=n.graphData.nodes.filter(l);m.save(),g.forEach(function(p){var _=h(p);if(n.nodeCanvasObject&&(_==="before"||_==="replace")&&(n.nodeCanvasObject(p,m,n.globalScale),_==="replace")){m.restore();return}var b=Math.sqrt(Math.max(0,u(p)||1))*n.nodeRelSize+f;m.beginPath(),m.arc(p.x,p.y,b,0,2*Math.PI,!1),m.fillStyle=c(p)||"rgba(31, 120, 180, 0.92)",m.fill(),n.nodeCanvasObject&&_==="after"&&n.nodeCanvasObject(p,n.ctx,n.globalScale)}),m.restore()}function i(){var l=oe(n.linkVisibility),u=oe(n.linkColor),c=oe(n.linkWidth),h=oe(n.linkLineDash),m=oe(n.linkCurvature),f=oe(n.linkCanvasObjectMode),g=n.ctx,p=n.isShadow*2,_=n.graphData.links.filter(l);_.forEach(N);var b=[],v=[],I=_;if(n.linkCanvasObject){var D=[],P=[];_.forEach(function(S){return({before:b,after:v,replace:D}[f(S)]||P).push(S)}),I=[].concat(ze(b),v,P),b=b.concat(D)}g.save(),b.forEach(function(S){return n.linkCanvasObject(S,g,n.globalScale)}),g.restore();var x=Ld(I,[u,c,h]);g.save(),Object.entries(x).forEach(function(S){var A=ln(S,2),U=A[0],M=A[1],z=!U||U==="undefined"?"rgba(0,0,0,0.15)":U;Object.entries(M).forEach(function(F){var B=ln(F,2),K=B[0],J=B[1],ne=(K||1)/n.globalScale+p;Object.entries(J).forEach(function(Y){var ye=ln(Y,2);ye[0];var Ne=ye[1],j=h(Ne[0]);g.beginPath(),Ne.forEach(function(ie){var ae=ie.source,re=ie.target;if(!(!ae||!re||!ae.hasOwnProperty("x")||!re.hasOwnProperty("x"))){g.moveTo(ae.x,ae.y);var q=ie.__controlPoints;q?g[q.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(g,ze(q).concat([re.x,re.y])):g.lineTo(re.x,re.y)}}),g.strokeStyle=z,g.lineWidth=ne,g.setLineDash(j||[]),g.stroke()})})}),g.restore(),g.save(),v.forEach(function(S){return n.linkCanvasObject(S,g,n.globalScale)}),g.restore();function N(S){var A=m(S);if(!A){S.__controlPoints=null;return}var U=S.source,M=S.target;if(!(!U||!M||!U.hasOwnProperty("x")||!M.hasOwnProperty("x"))){var z=Math.sqrt(Math.pow(M.x-U.x,2)+Math.pow(M.y-U.y,2));if(z>0){var F=Math.atan2(M.y-U.y,M.x-U.x),B=z*A,K={x:(U.x+M.x)/2+B*Math.cos(F-Math.PI/2),y:(U.y+M.y)/2+B*Math.sin(F-Math.PI/2)};S.__controlPoints=[K.x,K.y]}else{var J=A*70;S.__controlPoints=[M.x,M.y-J,M.x+J,M.y]}}}}function a(){var l=1.6,u=.2,c=oe(n.linkDirectionalArrowLength),h=oe(n.linkDirectionalArrowRelPos),m=oe(n.linkVisibility),f=oe(n.linkDirectionalArrowColor||n.linkColor),g=oe(n.nodeVal),p=n.ctx;p.save(),n.graphData.links.filter(m).forEach(function(_){var b=c(_);if(!(!b||b<0)){var v=_.source,I=_.target;if(!(!v||!I||!v.hasOwnProperty("x")||!I.hasOwnProperty("x"))){var D=Math.sqrt(Math.max(0,g(v)||1))*n.nodeRelSize,P=Math.sqrt(Math.max(0,g(I)||1))*n.nodeRelSize,x=Math.min(1,Math.max(0,h(_))),N=f(_)||"rgba(0,0,0,0.28)",S=b/l/2,A=_.__controlPoints&&Yo(ue,[v.x,v.y].concat(ze(_.__controlPoints),[I.x,I.y])),U=A?function(ne){return A.get(ne)}:function(ne){return{x:v.x+(I.x-v.x)*ne||0,y:v.y+(I.y-v.y)*ne||0}},M=A?A.length():Math.sqrt(Math.pow(I.x-v.x,2)+Math.pow(I.y-v.y,2)),z=D+b+(M-D-P-b)*x,F=U(z/M),B=U((z-b)/M),K=U((z-b*(1-u))/M),J=Math.atan2(F.y-B.y,F.x-B.x)-Math.PI/2;p.beginPath(),p.moveTo(F.x,F.y),p.lineTo(B.x+S*Math.cos(J),B.y+S*Math.sin(J)),p.lineTo(K.x,K.y),p.lineTo(B.x-S*Math.cos(J),B.y-S*Math.sin(J)),p.fillStyle=N,p.fill()}}}),p.restore()}function s(){var l=oe(n.linkDirectionalParticles),u=oe(n.linkDirectionalParticleSpeed),c=oe(n.linkDirectionalParticleOffset),h=oe(n.linkDirectionalParticleWidth),m=oe(n.linkVisibility),f=oe(n.linkDirectionalParticleColor||n.linkColor),g=n.ctx;g.save(),n.graphData.links.filter(m).forEach(function(p){var _=l(p);if(!(!p.hasOwnProperty("__photons")||!p.__photons.length)){var b=p.source,v=p.target;if(!(!b||!v||!b.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var I=u(p),D=Math.abs(c(p)),P=p.__photons||[],x=Math.max(0,h(p)/2)/Math.sqrt(n.globalScale),N=f(p)||"rgba(0,0,0,0.28)";g.fillStyle=N;var S=p.__controlPoints?Yo(ue,[b.x,b.y].concat(ze(p.__controlPoints),[v.x,v.y])):null,A=0,U=!1;P.forEach(function(M){var z=!!M.__singleHop;if(M.hasOwnProperty("__progressRatio")||(M.__progressRatio=z?I<0?1:0:(A+D)/_),!z&&A++,M.__progressRatio+=I,M.__progressRatio>=1||M.__progressRatio<0)if(!z)M.__progressRatio=M.__progressRatio%1,M.__progressRatio<0&&M.__progressRatio++;else{U=!0;return}var F=M.__progressRatio,B=S?S.get(F):{x:b.x+(v.x-b.x)*F||0,y:b.y+(v.y-b.y)*F||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(B.x,B.y,p,g,n.globalScale):(g.beginPath(),g.arc(B.x,B.y,x,0,2*Math.PI,!1),g.fill())}),U&&(p.__photons=p.__photons.filter(function(M){return!M.__singleHop||M.__progressRatio<=1&&M.__progressRatio>=0}))}}}),g.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:gd().force("link",ld()).force("charge",yd()).force("center",Sc()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Xo(n.graphData.nodes,oe(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Xo(n.graphData.links,oe(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(f){f.source=f[n.linkSource],f.target=f[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var o=n.forceLayout.force("link");o&&o.id(function(f){return f[n.nodeId]}).links(n.graphData.links);var i=n.dagMode&&Jd(n.graphData,function(f){return f[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,ze(Object.values(i||[]))),s=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*Xd*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var l=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(f){return delete f[l]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var u=["rl","bu"].includes(n.dagMode),c=function(g){return(i[g[n.nodeId]]-a/2)*s*(u?-1:1)},h=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(f){return f[h]=c(f)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?vd(function(f){var g=i[f[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-g:g)*s}).strength(function(f){return n.dagNodeFilter(f)?1:0}):null);for(var m=0;m<n.warmupTicks&&!(n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin);m++)n.forceLayout.tick();this.resetCountdown(),n.onFinishUpdate()}});function Gi(e,n){var r=e instanceof Array?e:[e],o=new n;return o._destructor&&o._destructor(),{linkProp:function(a){return{default:o[a](),onChange:function(l,u){r.forEach(function(c){return u[c][a](l)})},triggerUpdate:!1}},linkMethod:function(a){return function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c<l;c++)u[c-1]=arguments[c];var h=[];return r.forEach(function(m){var f=s[m],g=f[a].apply(f,u);g!==f&&h.push(g)}),h.length?h[0]:this}}}}var Zd=800,Qd=4,eu=5,Wi=Gi("forceGraph",En),tu=Gi(["forceGraph","shadowGraph"],En),nu=Object.assign.apply(Object,ze(["nodeColor","nodeAutoColorBy","nodeCanvasObject","nodeCanvasObjectMode","linkColor","linkAutoColorBy","linkLineDash","linkWidth","linkCanvasObject","linkCanvasObjectMode","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleCanvasObject","dagMode","dagLevelDistance","dagNodeFilter","onDagError","d3AlphaMin","d3AlphaDecay","d3VelocityDecay","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].map(function(e){return cn({},e,Wi.linkProp(e))})).concat(ze(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return cn({},e,tu.linkProp(e))})))),ru=Object.assign.apply(Object,ze(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return cn({},e,Wi.linkMethod(e))})));function Zn(e){if(e.canvas){var n=e.canvas.width,r=e.canvas.height;n===300&&r===150&&(n=r=0);var o=window.devicePixelRatio;n/=o,r/=o,[e.canvas,e.shadowCanvas].forEach(function(a){a.style.width="".concat(e.width,"px"),a.style.height="".concat(e.height,"px"),a.width=e.width*o,a.height=e.height*o,!n&&!r&&a.getContext("2d").scale(o,o)});var i=at(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/i,(e.height-r)/2/i),e.needsRedraw=!0}}function qi(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function Qo(e,n,r){e.save(),qi(e),e.clearRect(0,0,n,r),e.restore()}var ou=Pr({props:Gt({width:{default:window.innerWidth,onChange:function(n,r){return Zn(r)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,r){return Zn(r)},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(n,r){[n.nodes,n.links].every(function(i){return(i||[]).every(function(a){return!a.hasOwnProperty("__indexColor")})})&&r.colorTracker.reset(),[{type:"Node",objs:n.nodes},{type:"Link",objs:n.links}].forEach(o),r.forceGraph.graphData(n),r.shadowGraph.graphData(n);function o(i){var a=i.type,s=i.objs;s.filter(function(l){if(!l.hasOwnProperty("__indexColor"))return!0;var u=r.colorTracker.lookup(l.__indexColor);return!u||!u.hasOwnProperty("d")||u.d!==l}).forEach(function(l){l.__indexColor=r.colorTracker.register({type:a,d:l})})}},triggerUpdate:!1},backgroundColor:{onChange:function(n,r){r.canvas&&n&&(r.canvas.style.background=n)},triggerUpdate:!1},nodeLabel:{default:"name",triggerUpdate:!1},nodePointerAreaPaint:{onChange:function(n,r){r.shadowGraph.nodeCanvasObject(n?function(o,i,a){return n(o,o.__indexColor,i,a)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkPointerAreaPaint:{onChange:function(n,r){r.shadowGraph.linkCanvasObject(n?function(o,i,a){return n(o,o.__indexColor,i,a)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:4,triggerUpdate:!1},minZoom:{default:.01,onChange:function(n,r){r.zoom.scaleExtent([n,r.zoom.scaleExtent()[1]])},triggerUpdate:!1},maxZoom:{default:1e3,onChange:function(n,r){r.zoom.scaleExtent([r.zoom.scaleExtent()[0],n])},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},enableZoomInteraction:{default:!0,triggerUpdate:!1},enablePanInteraction:{default:!0,triggerUpdate:!1},enableZoomPanInteraction:{default:!0,triggerUpdate:!1},enablePointerInteraction:{default:!0,onChange:function(n,r){r.hoverObj=null},triggerUpdate:!1},autoPauseRedraw:{default:!0,triggerUpdate:!1},onNodeDrag:{default:function(){},triggerUpdate:!1},onNodeDragEnd:{default:function(){},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},onZoom:{triggerUpdate:!1},onZoomEnd:{triggerUpdate:!1},onRenderFramePre:{triggerUpdate:!1},onRenderFramePost:{triggerUpdate:!1}},nu),aliases:{stopAnimation:"pauseAnimation"},methods:Gt({graph2ScreenCoords:function(n,r,o){var i=at(n.canvas);return{x:r*i.k+i.x,y:o*i.k+i.y}},screen2GraphCoords:function(n,r,o){var i=at(n.canvas);return{x:(r-i.x)/i.k,y:(o-i.y)/i.k}},centerAt:function(n,r,o,i){if(!n.canvas)return null;if(r!==void 0||o!==void 0){var a=Object.assign({},r!==void 0?{x:r}:{},o!==void 0?{y:o}:{});return i?n.tweenGroup.add(new Io(s()).to(a,i).easing(At.Quadratic.Out).onUpdate(l).onComplete(function(){n.tweenGroup.remove(this)}).start()):l(a),this}return s();function s(){var u=at(n.canvas);return{x:(n.width/2-u.x)/u.k,y:(n.height/2-u.y)/u.k}}function l(u){var c=u.x,h=u.y;n.zoom.translateTo(n.zoom.__baseElem,c===void 0?s().x:c,h===void 0?s().y:h),n.needsRedraw=!0}},zoom:function(n,r,o){if(!n.canvas)return null;if(r!==void 0)return o?n.tweenGroup.add(new Io({k:i()}).to({k:r},o).easing(At.Quadratic.Out).onUpdate(function(s){var l=s.k;return a(l)}).onComplete(function(){n.tweenGroup.remove(this)}).start()):a(r),this;return i();function i(){return at(n.canvas).k}function a(s){n.zoom.scaleTo(n.zoom.__baseElem,s),n.needsRedraw=!0}},zoomToFit:function(n){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,i=arguments.length,a=new Array(i>3?i-3:0),s=3;s<i;s++)a[s-3]=arguments[s];var l=this.getGraphBbox.apply(this,a);if(l){var u={x:(l.x[0]+l.x[1])/2,y:(l.y[0]+l.y[1])/2},c=Math.max(1e-12,Math.min(1e12,(n.width-o*2)/(l.x[1]-l.x[0]),(n.height-o*2)/(l.y[1]-l.y[0])));this.centerAt(u.x,u.y,r),this.zoom(c,r)}return this},getGraphBbox:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},o=oe(n.nodeVal),i=function(l){return Math.sqrt(Math.max(0,o(l)||1))*n.nodeRelSize},a=n.graphData.nodes.filter(r).map(function(s){return{x:s.x,y:s.y,r:i(s)}});return a.length?{x:[Zr(a,function(s){return s.x-s.r}),Qr(a,function(s){return s.x+s.r})],y:[Zr(a,function(s){return s.y-s.r}),Qr(a,function(s){return s.y+s.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},ru),stateInit:function(){return{lastSetZoom:1,zoom:Fa(),forceGraph:new En,shadowGraph:new En().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new rc,tweenGroup:new vi}},init:function(n,r){var o=this;n.innerHTML="";var i=document.createElement("div");i.classList.add("force-graph-container"),i.style.position="relative",n.appendChild(i),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),i.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var a=r.canvas.getContext("2d"),s=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),l={x:-1e12,y:-1e12},u=function(){var m=null,f=window.devicePixelRatio,g=l.x>0&&l.y>0?s.getImageData(l.x*f,l.y*f,1,1):null;return g&&(m=r.colorTracker.lookup(g.data)),m};cr(r.canvas).call(Ea().subject(function(){if(!r.enableNodeDrag)return null;var h=u();return h&&h.type==="Node"?h.d:null}).on("start",function(h){var m=h.subject;m.__initialDragPos={x:m.x,y:m.y,fx:m.fx,fy:m.fy},h.active||(m.fx=m.x,m.fy=m.y),r.canvas.classList.add("grabbable")}).on("drag",function(h){var m=h.subject,f=m.__initialDragPos,g=h,p=at(r.canvas).k,_={x:f.x+(g.x-f.x)/p-m.x,y:f.y+(g.y-f.y)/p-m.y};["x","y"].forEach(function(b){return m["f".concat(b)]=m[b]=f[b]+(g[b]-f[b])/p}),!(!m.__dragged&&eu>=Math.sqrt(Oa(["x","y"].map(function(b){return Math.pow(h[b]-f[b],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,m.__dragged=!0,r.onNodeDrag(m,_))}).on("end",function(h){var m=h.subject,f=m.__initialDragPos,g={x:m.x-f.x,y:m.y-f.y};f.fx===void 0&&(m.fx=void 0),f.fy===void 0&&(m.fy=void 0),delete m.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,m.__dragged&&(delete m.__dragged,r.onNodeDragEnd(m,g))})),r.zoom(r.zoom.__baseElem=cr(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(h){return!h.button&&r.enableZoomPanInteraction&&(h.type!=="wheel"||oe(r.enableZoomInteraction)(h))&&(h.type==="wheel"||oe(r.enablePanInteraction)(h))}).on("zoom",function(h){var m=h.transform;[a,s].forEach(function(f){qi(f),f.translate(m.x,m.y),f.scale(m.k,m.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Gt(Gt({},m),o.centerAt())),r.needsRedraw=!0}).on("end",function(h){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Gt(Gt({},h.transform),o.centerAt()))}),Zn(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){at(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=Qd/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new Cc(i),["pointermove","pointerdown"].forEach(function(h){return i.addEventListener(h,function(m){h==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=m),!r.isPointerDragging&&m.type==="pointermove"&&r.onBackgroundClick&&(m.pressure>0||r.isPointerPressed)&&(m.pointerType==="mouse"||m.movementX===void 0||[m.movementX,m.movementY].some(function(p){return Math.abs(p)>1}))&&(r.isPointerDragging=!0);var f=g(i);l.x=m.pageX-f.left,l.y=m.pageY-f.top;function g(p){var _=p.getBoundingClientRect(),b=window.pageXOffset||document.documentElement.scrollLeft,v=window.pageYOffset||document.documentElement.scrollTop;return{top:_.top+v,left:_.left+b}}},{passive:!0})}),i.addEventListener("pointerup",function(h){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var m=[h,r.pointerDownEvent];requestAnimationFrame(function(){if(h.button===0)if(r.hoverObj){var f=r["on".concat(r.hoverObj.type,"Click")];f&&f.apply(void 0,[r.hoverObj.d].concat(m))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,m);if(h.button===2)if(r.hoverObj){var g=r["on".concat(r.hoverObj.type,"RightClick")];g&&g.apply(void 0,[r.hoverObj.d].concat(m))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,m)})}},{passive:!0}),i.addEventListener("contextmenu",function(h){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(h.preventDefault(),!1)}),r.forceGraph(a),r.shadowGraph(s);var c=Ra(function(){Qo(s,r.width,r.height),r.shadowGraph.linkWidth(function(m){return oe(r.linkWidth)(m)+r.linkHoverPrecision});var h=at(r.canvas);r.shadowGraph.globalScale(h.k).tickFrame()},Zd);r.flushShadowCanvas=c.flush,(this._animationCycle=function h(){var m=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(D){return D.__photons&&D.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var f=r.isPointerDragging?null:u();if(f!==r.hoverObj){var g=r.hoverObj,p=g?g.type:null,_=f?f.type:null;if(p&&p!==_){var b=r["on".concat(p,"Hover")];b&&b(null,g.d)}if(_){var v=r["on".concat(_,"Hover")];v&&v(f.d,p===_?g.d:null)}r.tooltip.content(f&&oe(r["".concat(f.type.toLowerCase(),"Label")])(f.d)||null),r.canvas.classList[(f&&r["on".concat(_,"Click")]||!f&&r.onBackgroundClick)&&oe(r.showPointerCursor)(f==null?void 0:f.d)?"add":"remove"]("clickable"),r.hoverObj=f}m&&c()}if(m){Qo(a,r.width,r.height);var I=at(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(a,I),r.forceGraph.globalScale(I).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(a,I)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(h)})()},update:function(n){}}),Ki={exports:{}},iu="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",au=iu,su=au;function Yi(){}function Ji(){}Ji.resetWarningCache=Yi;var lu=function(){function e(o,i,a,s,l,u){if(u!==su){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}e.isRequired=e;function n(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,elementType:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:Ji,resetWarningCache:Yi};return r.PropTypes=r,r};Ki.exports=lu();var cu=Ki.exports;const C=ba(cu),zn={width:C.number,height:C.number,graphData:C.shape({nodes:C.arrayOf(C.object).isRequired,links:C.arrayOf(C.object).isRequired}),backgroundColor:C.string,nodeRelSize:C.number,nodeId:C.string,nodeLabel:C.oneOfType([C.string,C.func]),nodeVal:C.oneOfType([C.number,C.string,C.func]),nodeVisibility:C.oneOfType([C.bool,C.string,C.func]),nodeColor:C.oneOfType([C.string,C.func]),nodeAutoColorBy:C.oneOfType([C.string,C.func]),onNodeHover:C.func,onNodeClick:C.func,linkSource:C.string,linkTarget:C.string,linkLabel:C.oneOfType([C.string,C.func]),linkVisibility:C.oneOfType([C.bool,C.string,C.func]),linkColor:C.oneOfType([C.string,C.func]),linkAutoColorBy:C.oneOfType([C.string,C.func]),linkWidth:C.oneOfType([C.number,C.string,C.func]),linkCurvature:C.oneOfType([C.number,C.string,C.func]),linkDirectionalArrowLength:C.oneOfType([C.number,C.string,C.func]),linkDirectionalArrowColor:C.oneOfType([C.string,C.func]),linkDirectionalArrowRelPos:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticles:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticleSpeed:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticleOffset:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticleWidth:C.oneOfType([C.number,C.string,C.func]),linkDirectionalParticleColor:C.oneOfType([C.string,C.func]),onLinkHover:C.func,onLinkClick:C.func,dagMode:C.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:C.number,dagNodeFilter:C.func,onDagError:C.func,d3AlphaMin:C.number,d3AlphaDecay:C.number,d3VelocityDecay:C.number,warmupTicks:C.number,cooldownTicks:C.number,cooldownTime:C.number,onEngineTick:C.func,onEngineStop:C.func,getGraphBbox:C.func},Xi={zoomToFit:C.func,onNodeRightClick:C.func,onNodeDrag:C.func,onNodeDragEnd:C.func,onLinkRightClick:C.func,linkHoverPrecision:C.number,onBackgroundClick:C.func,onBackgroundRightClick:C.func,showPointerCursor:C.oneOfType([C.bool,C.func]),enablePointerInteraction:C.bool,enableNodeDrag:C.bool},Or={showNavInfo:C.bool,nodeOpacity:C.number,nodeResolution:C.number,nodeThreeObject:C.oneOfType([C.object,C.string,C.func]),nodeThreeObjectExtend:C.oneOfType([C.bool,C.string,C.func]),nodePositionUpdate:C.func,linkOpacity:C.number,linkResolution:C.number,linkCurveRotation:C.oneOfType([C.number,C.string,C.func]),linkMaterial:C.oneOfType([C.object,C.string,C.func]),linkThreeObject:C.oneOfType([C.object,C.string,C.func]),linkThreeObjectExtend:C.oneOfType([C.bool,C.string,C.func]),linkPositionUpdate:C.func,linkDirectionalArrowResolution:C.number,linkDirectionalParticleResolution:C.number,linkDirectionalParticleThreeObject:C.oneOfType([C.object,C.string,C.func]),forceEngine:C.oneOf(["d3","ngraph"]),ngraphPhysics:C.object,numDimensions:C.oneOf([1,2,3])},du=Object.assign({},zn,Xi,{linkLineDash:C.oneOfType([C.arrayOf(C.number),C.string,C.func]),nodeCanvasObjectMode:C.oneOfType([C.string,C.func]),nodeCanvasObject:C.func,nodePointerAreaPaint:C.func,linkCanvasObjectMode:C.oneOfType([C.string,C.func]),linkCanvasObject:C.func,linkPointerAreaPaint:C.func,linkDirectionalParticleCanvasObject:C.func,autoPauseRedraw:C.bool,minZoom:C.number,maxZoom:C.number,enableZoomInteraction:C.oneOfType([C.bool,C.func]),enablePanInteraction:C.oneOfType([C.bool,C.func]),onZoom:C.func,onZoomEnd:C.func,onRenderFramePre:C.func,onRenderFramePost:C.func});Object.assign({},zn,Xi,Or,{enableNavigationControls:C.bool,controlType:C.oneOf(["trackball","orbit","fly"]),rendererConfig:C.object,extraRenderers:C.arrayOf(C.shape({render:C.func.isRequired}))});Object.assign({},zn,Or,{nodeDesc:C.oneOfType([C.string,C.func]),linkDesc:C.oneOfType([C.string,C.func])});Object.assign({},zn,Or,{markerAttrs:C.object,yOffset:C.number,glScale:C.number});const Rr=dl(ou,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});Rr.displayName="ForceGraph2D";Rr.propTypes=du;const uu=[{value:"openai-completions",label:"OpenAI 兼容"},{value:"anthropic-messages",label:"Anthropic 兼容"}];function fu(e){const{t:n}=Je(),[r,o]=w.useState("deepseek"),[i,a]=w.useState(""),[s,l]=w.useState(""),[u,c]=w.useState("openai-completions"),[h,m]=w.useState(""),[f,g]=w.useState(!1),[p,_]=w.useState(!1),[b,v]=w.useState(null),I=w.useRef(!1);function D(S){if(a(S),I.current)return;S.toLowerCase().includes("anthropic")?c("anthropic-messages"):c("openai-completions")}function P(S){I.current=!0,c(S)}async function x(){var A;const S=h.trim();if(!S){v("请输入 API Key");return}_(!0),v(null);try{if(r==="deepseek")await bo({kind:"deepseek",modelId:"deepseek-flash",apiKey:S});else{const U=i.trim();if(!U){v("请输入 API 地址");return}const M=s.trim();if(!M){v("请输入 Model ID");return}await bo({kind:"custom",baseUrl:U,modelId:M,apiType:u,apiKey:S})}m(""),a(""),l(""),await((A=e.onConfigured)==null?void 0:A.call(e))}catch(U){v(U instanceof Error?U.message:String(U))}finally{_(!1)}}const N=h.trim()&&(r==="deepseek"||i.trim()&&s.trim());return d.jsxs("div",{className:"mdocs-agent-apikey-inline",children:[d.jsx("p",{className:"mdocs-agent-apikey-inline-lead",children:"配置 AI 供应商后即可使用(仅本人可见,不会分享给其他访客)"}),d.jsxs("div",{className:"mdocs-agent-kind-tabs mdocs-agent-apikey-inline-tabs",role:"tablist","aria-label":"配置方式",children:[d.jsx("button",{type:"button",role:"tab","aria-selected":r==="deepseek",className:r==="deepseek"?"active":"",onClick:()=>o("deepseek"),disabled:p,children:"Deepseek"}),d.jsx("button",{type:"button",role:"tab","aria-selected":r==="custom",className:r==="custom"?"active":"",onClick:()=>o("custom"),disabled:p,children:"自定义"})]}),r==="custom"?d.jsxs(d.Fragment,{children:[d.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[d.jsx("span",{children:"API 地址"}),d.jsx("input",{type:"url",value:i,onChange:S=>D(S.target.value),placeholder:"https://api.example.com/v1",className:"mdocs-agent-mono",disabled:p,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),x())}})]}),d.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[d.jsx("span",{children:"API 协议"}),d.jsx("div",{className:"mdocs-agent-apikey-inline-protocol",children:uu.map(S=>d.jsx("button",{type:"button",className:u===S.value?"active":"",onClick:()=>P(S.value),disabled:p,children:S.label},S.value))})]}),d.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[d.jsx("span",{children:"Model ID"}),d.jsx("input",{type:"text",value:s,onChange:S=>l(S.target.value),placeholder:"模型名称,如 gpt-4o / claude-3-5-sonnet",className:"mdocs-agent-mono",disabled:p,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),x())}})]})]}):null,d.jsxs("div",{className:"mdocs-agent-config-apikey mdocs-agent-apikey-inline-field",children:[d.jsx("input",{type:f?"text":"password",value:h,onChange:S=>m(S.target.value),placeholder:n("agentConfigApiKeyPlaceholder"),autoComplete:"off",disabled:p,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),x())}}),d.jsx("button",{type:"button",className:"mdocs-agent-config-eye","aria-label":n(f?"agentConfigHideKey":"agentConfigShowKey"),onClick:()=>g(S=>!S),disabled:p,children:f?d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[d.jsx("path",{d:"M3 3l18 18"}),d.jsx("path",{d:"M10.6 10.6a2 2 0 002.8 2.8"}),d.jsx("path",{d:"M9.9 5.1A10.5 0 0121 12c-.6 1.1-1.4 2.1-2.4 2.9"}),d.jsx("path",{d:"M6.1 6.1C4.5 7.4 3.2 9.1 2.5 12c1.5 3.5 5 7 9.5 7 1.4 0 2.7-.3 3.9-.8"})]}):d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[d.jsx("path",{d:"M2.5 12C4 8.5 7.5 5 12 5s8 3.5 9.5 7c-1.5 3.5-5 7-9.5 7s-8-3.5-9.5-7z"}),d.jsx("circle",{cx:"12",cy:"12",r:"3"})]})})]}),b?d.jsx("p",{className:"mdocs-agent-apikey-inline-error",children:b}):null,d.jsx("button",{type:"button",className:"mdocs-agent-apikey-inline-save",onClick:()=>void x(),disabled:p||!N,children:p?n("saving"):"保存并启用"})]})}function ei(e){return e==="contains"}function mu(e){return e==="related_to"||e==="part_of"||e==="depends_on"}function hu(e,n){var h,m;const r=new Set(e),o=new Map,i=new Map,a=new Map;for(const f of e)o.set(f,[]),i.set(f,[]),a.set(f,0);for(const f of n)!r.has(f.from)||!r.has(f.to)||f.from===f.to||(o.get(f.from).push(f.to),i.get(f.to).push(f.from),a.set(f.to,(a.get(f.to)??0)+1));let s=e.filter(f=>(a.get(f)??0)===0);if(s.length===0&&e.length>0){const f=new Map;for(const _ of e)f.set(_,(((h=o.get(_))==null?void 0:h.length)??0)+(((m=i.get(_))==null?void 0:m.length)??0));const g=[...e].sort((_,b)=>(f.get(b)??0)-(f.get(_)??0)),p=f.get(g[0])??0;s=g.filter(_=>(f.get(_)??0)===p).slice(0,12)}const l=new Map,u=[];for(const f of s)l.set(f,0),u.push(f);let c=0;for(;c<u.length;){const f=u[c++],g=l.get(f)??0;for(const p of o.get(f)??[]){const _=g+1;(!l.has(p)||_<(l.get(p)??1/0))&&(l.set(p,_),u.push(p))}}for(const f of e)l.has(f)||l.set(f,0);return{childrenOf:o,parentsOf:i,roots:s,depthMap:l}}function Qn(e,n,r,o,i){return i.has(e)?!1:(r.get(e)??0)<n?!0:o.has(e)}function pu(e,n,r){const o=new Set(e),i=[...e];let a=0;for(;a<i.length;){const s=i[a++];if(r(s))for(const l of n.get(s)??[])o.has(l)||(o.add(l),i.push(l))}return o}function gu(e,n){const r=[],o=new Set,i=[...n.get(e)??[]];for(;i.length>0;){const a=i.pop();if(!o.has(a)){o.add(a),r.push(a);for(const s of n.get(a)??[])i.push(s)}}return r}function yu(e){const{event:n,data:r}=e;switch(n){case"task.started":return`🚀 开始生成,共 ${(r==null?void 0:r.totalDocs)??0} 篇文档`;case"doc.started":return`📄 处理中:${(r==null?void 0:r.docPath)??""}(${(r==null?void 0:r.index)??0}/${(r==null?void 0:r.total)??0})`;case"doc.completed":return`✅ ${(r==null?void 0:r.docPath)??""}(提取 ${(r==null?void 0:r.conceptsExtracted)??0} 个知识块)`;case"doc.failed":return`⚠️ ${(r==null?void 0:r.docPath)??""} 失败:${(r==null?void 0:r.error)??""}`;case"folder.started":return`📁 归纳目录:${(r==null?void 0:r.folderPath)??""}`;case"folder.completed":return`✅ 目录归纳完成:${(r==null?void 0:r.folderPath)??""}`;case"domain.started":return"🌐 开始 domain 级合成";case"domain.completed":return`✅ domain 合成完成(${(r==null?void 0:r.totalNodes)??0} 节点,${(r==null?void 0:r.totalEdges)??0} 边)`;case"task.yielded":return"⏸️ 让出资源,排队等待中...";case"task.progress":return`⏳ ${(r==null?void 0:r.phase)??"progress"} ${(r==null?void 0:r.current)??0}/${(r==null?void 0:r.total)??0}`;case"task.completed":return`🎉 生成完成!${(r==null?void 0:r.nodes)??0} 个节点,${(r==null?void 0:r.edges)??0} 条边`;case"task.failed":return`❌ 生成失败:${(r==null?void 0:r.error)??""}`;default:return`${n}${r?`: ${JSON.stringify(r)}`:""}`}}function ti(e){return e<=1?"排队中,即将开始…":`排队中,前面还有 ${e-1} 个任务`}function er(e,n,r){const o=Math.max(e,.2);return Math.max(r??n*.75,n)/o}function vu({scope:e,resourceId:n,name:r,onOpenDocument:o,onClose:i}){const[a,s]=w.useState(null),[l,u]=w.useState(!0),[c,h]=w.useState(null),[m,f]=w.useState(!1),[g,p]=w.useState(!1),[_,b]=w.useState(0),[v,I]=w.useState(()=>new Set),[D,P]=w.useState(()=>new Set),[x,N]=w.useState(null),[S,A]=w.useState(null),[U,M]=w.useState(null),z=w.useRef(null),F=w.useRef(new Map),[B,K]=w.useState("not_found"),[J,ne]=w.useState([]),[Y,ye]=w.useState(null),[Ne,j]=w.useState(0),ie=`graph:${e==="domain"?"domain":"dir"}:${n}`,ae=w.useRef(ie),re=w.useRef(null),[q,X]=w.useState(!1),[xe,le]=w.useState(!1),_e=B==="running"||B==="pending";w.useEffect(()=>{let k=!1;return u(!0),h(null),N(null),b(0),I(new Set),P(new Set),p(!1),M(null),F.current=new Map,(e==="domain"?_o:xo)(n).then(R=>{k||(s(R),u(!1))}).catch(R=>{k||(h(R.message||"加载失败"),u(!1))}),()=>{k=!0}},[n,e]),w.useEffect(()=>(ae.current=ie,ut(),fn(),()=>ut()),[ie]);async function fn(){try{const k=await Vs(ae.current);K(k.status),ne(k.logs),ye(k.progress??null),j(k.position),k.status==="completed"?(ut(),ft()):k.status==="failed"||k.status==="stale"?(ut(),k.error&&h(k.error)):(k.status==="running"||k.status==="pending")&&Xe()}catch{}}function Xe(){re.current||(re.current=window.setInterval(()=>{fn()},2e3))}function ut(){re.current&&(clearInterval(re.current),re.current=null)}async function ft(){try{const T=await(e==="domain"?_o:xo)(n);s(T)}catch(k){h(k.message||"加载失败")}}const Ze=async()=>{if(!_e){h(null),X(!1);try{const T=await(e==="domain"?Hs:Bs)(n);ae.current=T.taskId,K(T.status),j(T.position),ne([]),ye(null),Xe()}catch(k){if(k instanceof He&&k.code==="AI_NOT_CONFIGURED"){X(!0),h(k.message);return}h((k==null?void 0:k.message)||"生成失败")}}},Qe=async()=>{le(!1),X(!1),h(null),await Ze()},Ve=w.useMemo(()=>a?m?a.nodes:a.nodes.filter(k=>k.type==="concept"):[],[a,m]),et=w.useMemo(()=>{if(!a)return[];const k=new Set(Ve.map(T=>T.id));return a.edges.filter(T=>k.has(T.from)&&k.has(T.to))},[a,Ve]),ve=w.useMemo(()=>{const k=et.filter(T=>ei(String(T.type))).map(T=>({from:T.from,to:T.to}));return hu(Ve.map(T=>T.id),k)},[Ve,et]),mt=w.useMemo(()=>pu(ve.roots,ve.childrenOf,k=>Qn(k,_,ve.depthMap,v,D)),[ve,_,v,D]),{displayNodes:tt,displayEdges:ht}=w.useMemo(()=>{const k=Ve.filter(R=>mt.has(R.id)),T=et.filter(R=>{if(!mt.has(R.from)||!mt.has(R.to))return!1;const L=String(R.type);return!!(ei(L)||g&&mu(L))});return{displayNodes:k,displayEdges:T}},[Ve,et,mt,g]),ge=w.useMemo(()=>{const k=new Map;for(const T of Ve)k.set(T.id,T);return k},[Ve]);function Et(k){b(k),I(new Set),P(new Set)}function Ae(k){if((ve.childrenOf.get(k)??[]).length===0)return;Qn(k,_,ve.depthMap,v,D)?(P(L=>new Set(L).add(k)),I(L=>{const G=new Set(L);return G.delete(k),G})):(P(L=>{const G=new Set(L);return G.delete(k),G}),I(L=>new Set(L).add(k)))}function we(k){const T=gu(k.id,ve.parentsOf);P(R=>{const L=new Set(R);for(const G of T)L.delete(G);return L}),I(R=>{const L=new Set(R);for(const G of T)L.add(G);return L}),N(k)}const wt=w.useMemo(()=>{const k=tt.map(L=>{var Te;const G=((Te=ve.childrenOf.get(L.id))==null?void 0:Te.length)??0,Z=Qn(L.id,_,ve.depthMap,v,D),Q=F.current.get(L.id);let te=Q==null?void 0:Q.x,ce=Q==null?void 0:Q.y;if(te==null||ce==null){const pe=(ve.parentsOf.get(L.id)??[]).map(ke=>F.current.get(ke)).find(ke=>ke!=null);pe?(te=pe.x+(Math.random()-.5)*60,ce=pe.y+50+Math.random()*40):(te=(Math.random()-.5)*240,ce=(Math.random()-.5)*180),F.current.set(L.id,{x:te,y:ce})}return{id:L.id,name:L.label,type:L.type,val:L.type==="concept"?4:2,x:te,y:ce,__raw:L,__childCount:G,__expanded:Z}}),T=new Map,R=ht.map(L=>{const G=`${L.from}->${L.to}`,Z=T.get(G)??0;T.set(G,Z+1);const Q=Z===0?.08:.08+Z*.14;return{source:L.from,target:L.to,type:L.type,curvature:Q,__raw:L}});return{nodes:k,links:R}},[tt,ht,ve,_,v,D]),nt=w.useMemo(()=>{const k=Math.max(1,tt.length);return{linkDistance:Math.min(140,70+Math.sqrt(k)*8),chargeStrength:Math.max(-420,-120-k*6)}},[tt.length]),$e=w.useRef(null),[kt,Re]=w.useState({width:800,height:600});w.useEffect(()=>{if(!$e.current)return;const k=()=>{$e.current&&Re({width:$e.current.clientWidth,height:$e.current.clientHeight})};k();const T=new ResizeObserver(k);return T.observe($e.current),()=>T.disconnect()},[]),w.useEffect(()=>{if(!a||l)return;const k=window.setTimeout(()=>{var T,R;(R=(T=z.current)==null?void 0:T.zoomToFit)==null||R.call(T,400,80)},450);return()=>window.clearTimeout(k)},[a,m,g,l,kt.width,kt.height,_,mt]),w.useEffect(()=>{var L,G,Z,Q;if(!a||l)return;const k=z.current;if(!k)return;const T=k.d3Force("charge");(L=T==null?void 0:T.strength)==null||L.call(T,nt.chargeStrength);const R=k.d3Force("link");(G=R==null?void 0:R.distance)==null||G.call(R,nt.linkDistance),(Z=R==null?void 0:R.strength)==null||Z.call(R,.35),(Q=k.d3ReheatSimulation)==null||Q.call(k)},[nt,a,l,m,wt]);const Ot=k=>(ve.childrenOf.get(k)??[]).map(R=>ge.get(R)??(a==null?void 0:a.nodes.find(L=>L.id===R))).filter(R=>!!R),pt=k=>(ve.parentsOf.get(k)??[]).map(R=>ge.get(R)??(a==null?void 0:a.nodes.find(L=>L.id===R))).filter(R=>!!R),It=k=>{if(!a)return[];const T=new Set,R=[],L=[k];for(;L.length>0;){const G=L.shift();if(T.has(G))continue;T.add(G);const Z=a.nodes.find(te=>te.id===G);(Z==null?void 0:Z.type)==="doc"&&R.push(Z);const Q=a.edges.filter(te=>te.from===G).map(te=>te.to);L.push(...Q)}return R};return d.jsxs("div",{className:"graph-page",children:[d.jsxs("div",{className:"graph-toolbar",children:[d.jsxs("div",{className:"graph-title",children:[d.jsx("span",{className:"graph-icon",children:"🕸️"}),d.jsxs("span",{children:["知识图谱 — ",r]}),i&&d.jsx("button",{className:"graph-btn graph-btn-close",onClick:i,title:"关闭图谱",children:d.jsx(Pt,{size:14})})]}),d.jsxs("div",{className:"graph-actions",children:[d.jsxs("div",{className:"graph-depth-btns",children:[d.jsx("button",{type:"button",className:`graph-btn ${_===1?"graph-btn-active":""}`,onClick:()=>Et(1),title:"展开到深度 1(顶层 + 直接子)",children:"展开一级"}),d.jsx("button",{type:"button",className:`graph-btn ${_===2?"graph-btn-active":""}`,onClick:()=>Et(2),title:"展开到深度 2",children:"展开到二级"}),d.jsx("button",{type:"button",className:`graph-btn ${_===0&&v.size===0?"graph-btn-active":""}`,onClick:()=>Et(0),title:"仅顶层",children:"全部收起"})]}),d.jsxs("label",{className:"graph-toggle",children:[d.jsx("input",{type:"checkbox",checked:g,onChange:k=>p(k.target.checked)}),d.jsx("span",{children:"显示其它关系"})]}),d.jsxs("label",{className:"graph-toggle",children:[d.jsx("input",{type:"checkbox",checked:m,onChange:k=>f(k.target.checked)}),d.jsx("span",{children:"显示 doc 节点"})]}),d.jsxs("button",{className:"graph-btn",onClick:()=>le(!0),title:"配置用于图谱分析的 AI 模型",children:[d.jsx(io,{size:14}),"配置 AI"]}),d.jsx("button",{className:"graph-btn graph-btn-primary",onClick:Ze,disabled:_e,children:_e?d.jsxs(d.Fragment,{children:[d.jsx(Wn,{size:14,className:"spin"}),B==="pending"?ti(Ne):"生成中..."]}):d.jsxs(d.Fragment,{children:[d.jsx(ss,{size:14}),a?"重新生成":"生成图谱"]})})]})]}),d.jsxs("div",{className:"graph-canvas-container",ref:$e,children:[l&&d.jsxs("div",{className:"graph-loading",children:[d.jsx(Wn,{size:32,className:"spin"}),d.jsx("p",{children:"加载图谱中..."})]}),c&&!l&&d.jsx("div",{className:"graph-error",children:q?d.jsxs(d.Fragment,{children:[d.jsx("p",{style:{fontSize:40,margin:0},children:"🔑"}),d.jsx("h3",{children:"还没有配置 AI 模型"}),d.jsx("p",{className:"muted",children:"图谱由 AI 分析生成,需要先配置一个可用的模型"}),d.jsxs("button",{className:"graph-btn graph-btn-primary",onClick:()=>le(!0),style:{marginTop:12},children:[d.jsx(io,{size:14}),"配置 AI"]})]}):d.jsxs(d.Fragment,{children:[d.jsxs("p",{children:["❌ ",c]}),d.jsx("button",{className:"graph-btn",onClick:Ze,children:"重试生成"})]})}),!l&&!c&&!a&&!_e&&d.jsxs("div",{className:"graph-empty",children:[d.jsx("p",{style:{fontSize:48,margin:0},children:"🕸️"}),d.jsx("h3",{children:"还没有知识图谱"}),d.jsx("p",{className:"muted",children:"点击右上角「生成图谱」开始构建"}),d.jsx("button",{className:"graph-btn graph-btn-primary",onClick:Ze,disabled:_e,children:_e?"生成中...":"生成图谱"})]}),_e&&d.jsxs("div",{className:"graph-progress-panel",children:[d.jsxs("div",{className:"graph-progress-header",children:[d.jsx(Wn,{size:16,className:"spin"}),d.jsx("span",{children:B==="pending"?ti(Ne):Y?`正在生成(${Y.current}/${Y.total})`:"正在生成..."})]}),Y&&Y.total>0&&d.jsx("div",{className:"graph-progress-bar",children:d.jsx("div",{className:"graph-progress-bar-fill",style:{width:`${Y.current/Y.total*100}%`}})}),d.jsx("div",{className:"graph-progress-logs",children:J.slice(-10).map((k,T)=>d.jsx("div",{className:`graph-log-item graph-log-${k.level}`,children:d.jsx("span",{className:"graph-log-event",children:yu(k)})},T))})]}),!l&&!c&&a&&a.nodes.length===0&&!_e&&d.jsxs("div",{className:"graph-empty",children:[d.jsx("p",{style:{fontSize:48,margin:0},children:"📄"}),d.jsx("h3",{children:"图谱已生成"}),d.jsx("p",{className:"muted",children:"当前内容暂未提取到可关联的知识概念"}),d.jsx("p",{className:"muted",style:{fontSize:13,marginTop:4},children:"内容较少或结构较简单时可能出现这种情况,补充更多内容后可以重新生成"}),d.jsx("button",{className:"graph-btn graph-btn-primary",onClick:Ze,disabled:_e,style:{marginTop:12},children:"重新生成"})]}),!l&&!c&&a&&a.nodes.length>0&&d.jsx(Rr,{ref:z,width:kt.width,height:kt.height,graphData:wt,nodeId:"id",nodeVal:k=>k.type==="concept"?6:3,nodeColor:k=>k.type==="concept"?"#8b5cf6":"#06b6d4",nodeCanvasObjectMode:()=>"replace",nodeCanvasObject:(k,T,R)=>{const L=String(k.name??""),G=k.type==="concept",Z=k.id===(x==null?void 0:x.id)||k.id===S,Q=(G?9:5)/Math.max(R,.35);if(T.beginPath(),T.arc(k.x,k.y,Q,0,2*Math.PI),T.fillStyle=G?"#8b5cf6":"#06b6d4",T.globalAlpha=Z||!x?1:.35,T.fill(),T.strokeStyle="#ffffff",T.lineWidth=1.5/Math.max(R,.35),T.stroke(),T.globalAlpha=1,k.__childCount>0){const Ft=7/Math.max(R,.4),Lt=k.x+Q+Ft*.9,zt=k.y-Q*.2;T.beginPath(),T.arc(Lt,zt,Ft,0,2*Math.PI),T.fillStyle=k.__expanded?"#475569":"#6366f1",T.fill(),T.fillStyle="#ffffff";const gt=k.__expanded?"−":"+",Ct=Math.max(10/R,9/R);T.font=`700 ${Ct}px -apple-system, BlinkMacSystemFont, sans-serif`,T.textAlign="center",T.textBaseline="middle",T.fillText(gt,Lt,zt+.5/R)}if(!(Z||G&&R>=.55||!G&&R>=1.4))return;const ce=Math.max(10/R,G?11/R:9/R),Te=G?R<.9?8:16:10,pe=L.length>Te?L.slice(0,Te)+"…":L;T.font=`${G?"600":"400"} ${ce}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,T.textAlign="center",T.textBaseline="top";const ke=k.y+Q+3/R,de=T.measureText(pe).width,Ce=4/R,Rt=2/R;T.fillStyle="rgba(255,255,255,0.88)",T.fillRect(k.x-de/2-Ce,ke-Rt,de+Ce*2,ce+Rt*2),T.fillStyle=G?"#1e1b4b":"#0c4a6e",T.fillText(pe,k.x,ke)},linkDirectionalArrowLength:k=>{var L,G,Z,Q,te,ce;const T=((G=(L=z.current)==null?void 0:L.zoom)==null?void 0:G.call(L))??1,R=((Z=k.source)==null?void 0:Z.id)===S||((Q=k.target)==null?void 0:Q.id)===S||((te=k.source)==null?void 0:te.id)===(x==null?void 0:x.id)||((ce=k.target)==null?void 0:ce.id)===(x==null?void 0:x.id);return er(T,R?13:11,9)},linkDirectionalArrowRelPos:.86,linkDirectionalArrowColor:()=>"#475569",linkWidth:k=>{var L,G,Z,Q,te,ce;const T=((G=(L=z.current)==null?void 0:L.zoom)==null?void 0:G.call(L))??1,R=((Z=k.source)==null?void 0:Z.id)===S||((Q=k.target)==null?void 0:Q.id)===S||((te=k.source)==null?void 0:te.id)===(x==null?void 0:x.id)||((ce=k.target)==null?void 0:ce.id)===(x==null?void 0:x.id);return er(T,R?3.5:3,2.25)},linkColor:k=>{var R,L,G,Z;return((R=k.source)==null?void 0:R.id)===S||((L=k.target)==null?void 0:L.id)===S||((G=k.source)==null?void 0:G.id)===(x==null?void 0:x.id)||((Z=k.target)==null?void 0:Z.id)===(x==null?void 0:x.id)?"#334155":"#64748b"},linkCurvature:k=>k.curvature??.12,linkCanvasObjectMode:()=>"after",linkCanvasObject:(k,T,R)=>{if(R<.45)return;const L=k.source,G=k.target;if(L.x==null||L.y==null||G.x==null||G.y==null)return;const Q={contains:"包含",related_to:"相关",part_of:"属于",depends_on:"依赖"}[k.type]||String(k.type??""),te=typeof k.curvature=="number"?k.curvature:.12,ce=(L.x+G.x)/2,Te=(L.y+G.y)/2,pe=ce-(G.y-L.y)*te,ke=Te+(G.x-L.x)*te,de=.5,Ce=1-de,Rt=Ce*Ce*L.x+2*Ce*de*pe+de*de*G.x,Ft=Ce*Ce*L.y+2*Ce*de*ke+de*de*G.y,Lt=2*Ce*(pe-L.x)+2*de*(G.x-pe),zt=2*Ce*(ke-L.y)+2*de*(G.y-ke);let gt=Math.atan2(zt,Lt);(gt>Math.PI/2||gt<-Math.PI/2)&&(gt+=Math.PI);const Ct=er(R,11,9);T.save(),T.translate(Rt,Ft),T.rotate(gt),T.font=`500 ${Ct}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,T.textAlign="center",T.textBaseline="middle";const mn=T.measureText(Q).width,hn=3/R,be=1.5/R;T.fillStyle="rgba(255,255,255,0.92)",T.fillRect(-mn/2-hn,-Ct/2-be,mn+hn*2,Ct+be*2),T.fillStyle="#475569",T.fillText(Q,0,0),T.restore()},onZoom:()=>{var k,T;(T=(k=z.current)==null?void 0:k.refresh)==null||T.call(k)},cooldownTicks:120,cooldownTime:4e3,d3AlphaDecay:.022,d3VelocityDecay:.3,onNodeClick:(k,T)=>{var L,G;const R=k.__childCount??0;if(R>0&&z.current&&$e.current){const Z=$e.current.getBoundingClientRect(),Q=z.current.screen2GraphCoords(T.clientX-Z.left,T.clientY-Z.top),te=((G=(L=z.current).zoom)==null?void 0:G.call(L))??1,ce=(k.type==="concept"?9:5)/Math.max(te,.35),Te=7/Math.max(te,.4),pe=k.x+ce+Te*.9,ke=k.y-ce*.2,de=Q.x-pe,Ce=Q.y-ke;if(de*de+Ce*Ce<=(Te+4/te)**2){Ae(String(k.id)),N(k.__raw);return}}N(k.__raw),R>0&&!k.__expanded&&Ae(String(k.id))},onNodeHover:k=>{var R;if(!k){A(null),M(null);return}A(String(k.id));const T=String(k.name??((R=k.__raw)==null?void 0:R.label)??"");if(z.current&&T){const L=z.current.graph2ScreenCoords(k.x,k.y);M({text:T,x:L.x,y:L.y})}else M({text:T,x:0,y:0})},onBackgroundClick:()=>{N(null),A(null),M(null)},onEngineTick:()=>{var T,R;const k=(R=(T=z.current)==null?void 0:T.graphData)==null?void 0:R.call(T);if(k!=null&&k.nodes)for(const L of k.nodes)L.id!=null&&L.x!=null&&L.y!=null&&F.current.set(String(L.id),{x:L.x,y:L.y})},onEngineStop:()=>{var k,T;(T=(k=z.current)==null?void 0:k.zoomToFit)==null||T.call(k,300,72)},linkHoverPrecision:8,enableNodeDrag:!0,enableZoomInteraction:!0,enablePanInteraction:!0,nodePointerAreaPaint:(k,T,R,L)=>{const G=(k.type==="concept"?14:9)/Math.max(L,.35);if(R.fillStyle=T,R.beginPath(),R.arc(k.x,k.y,G,0,2*Math.PI),R.fill(),k.__childCount>0){const Z=10/Math.max(L,.4),Q=(k.type==="concept"?9:5)/Math.max(L,.35),te=k.x+Q+Z*.7,ce=k.y-Q*.2;R.beginPath(),R.arc(te,ce,Z,0,2*Math.PI),R.fill()}}}),U&&d.jsx("div",{className:"graph-node-tooltip",style:{left:U.x,top:U.y},children:U.text})]}),x&&d.jsxs("div",{className:"graph-detail-panel",children:[d.jsxs("div",{className:"graph-detail-header",children:[d.jsx("span",{className:`graph-node-type-badge ${x.type}`,children:x.type==="concept"?"概念":"知识要点"}),d.jsx("button",{type:"button",className:"graph-close-btn","aria-label":"关闭",onClick:()=>N(null),children:d.jsx(Pt,{size:18,strokeWidth:2.25})})]}),d.jsx("h3",{className:"graph-detail-title",children:x.label}),x.definition&&d.jsxs("div",{className:"graph-detail-section",children:[d.jsx("h4",{children:"定义"}),d.jsx("p",{children:x.definition})]}),d.jsxs("div",{className:"graph-detail-section",children:[d.jsx("h4",{children:"描述"}),d.jsx("p",{children:x.description})]}),d.jsx("div",{className:"graph-detail-meta",children:d.jsxs("span",{children:["置信度: ",(x.confidence*100).toFixed(0),"%"]})}),x.type==="concept"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"graph-detail-section",children:[d.jsxs("h4",{children:["包含的子节点 (",Ot(x.id).length,")"]}),d.jsxs("ul",{className:"graph-node-list",children:[Ot(x.id).slice(0,20).map(k=>d.jsxs("li",{className:`graph-node-item ${k.type}`,onClick:()=>we(k),children:[d.jsx("span",{className:"dot"}),k.label]},k.id)),Ot(x.id).length>20&&d.jsxs("li",{className:"muted",children:["还有 ",Ot(x.id).length-20," 个..."]})]})]}),d.jsxs("div",{className:"graph-detail-section",children:[d.jsxs("h4",{children:["相关文章 (",It(x.id).length,")"]}),d.jsx("ul",{className:"graph-doc-list",children:Array.from(new Set(It(x.id).flatMap(k=>{var T;return((T=k.sources)==null?void 0:T.map(R=>({documentId:R.documentId,title:R.title||R.documentId,heading:R.heading})))||[]}))).slice(0,10).map((k,T)=>d.jsx("li",{className:"graph-doc-item",children:d.jsxs("button",{onClick:()=>o(k.documentId),children:["📄 ",k.title,k.heading&&d.jsxs("span",{className:"muted",children:[" · ",k.heading]})]})},T))})]})]}),x.type==="doc"&&x.sources&&d.jsxs("div",{className:"graph-detail-section",children:[d.jsx("h4",{children:"来源"}),d.jsx("ul",{className:"graph-doc-list",children:x.sources.map((k,T)=>d.jsx("li",{className:"graph-doc-item",children:d.jsxs("button",{onClick:()=>o(k.documentId),children:["📄 ",k.title||k.documentId,k.heading&&d.jsxs("span",{className:"muted",children:[" · ",k.heading]})]})},T))})]}),pt(x.id).length>0&&d.jsxs("div",{className:"graph-detail-section",children:[d.jsxs("h4",{children:["所属概念 (",pt(x.id).length,")"]}),d.jsx("ul",{className:"graph-node-list",children:pt(x.id).map(k=>d.jsxs("li",{className:`graph-node-item ${k.type}`,onClick:()=>we(k),children:[d.jsx("span",{className:"dot"}),k.label]},k.id))})]})]}),xe&&d.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:k=>{k.target===k.currentTarget&&le(!1)},children:d.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true","aria-label":"配置 AI 模型",children:[d.jsx("h2",{children:"配置 AI 模型"}),d.jsx(fu,{onConfigured:Qe}),d.jsx("div",{className:"mdocs-dialog-actions",children:d.jsx("button",{type:"button",onClick:()=>le(!1),children:"取消"})})]})})]})}function bu(e){var l;const{t:n}=Je(),r=w.useRef(null);w.useEffect(()=>{function u(h){r.current&&!r.current.contains(h.target)&&e.onClose()}function c(h){h.key==="Escape"&&e.onClose()}return window.addEventListener("mousedown",u),window.addEventListener("keydown",c),()=>{window.removeEventListener("mousedown",u),window.removeEventListener("keydown",c)}},[e.onClose]);const o=e.node.type==="folder";let i="";if(e.node.type==="folder"){const u=e.node;i=((l=u.folderDisplayName)==null?void 0:l.trim())||u.path||""}const a=o?i?n("newDocIn",{name:i}):n("newDocAtRoot"):n("newDocBeside"),s=o?i?n("newFolderIn",{name:i}):n("newFolderAtRoot"):n("newFolderBeside");return d.jsxs("div",{ref:r,className:"mdocs-context-menu card",style:{left:e.x,top:e.y},children:[d.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const u=o?e.node.path:e.parentPath;e.onCreateChild(u),e.onClose()},children:a}),d.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const u=o?e.node.path:e.parentPath;e.onCreateFolder(u),e.onClose()},children:s}),d.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"?n("deleteFolder",{name:i||e.node.name}):n("deleteItem",{name:e.node.name})})]})}function xu({domains:e,value:n,onChange:r,ariaLabel:o,localizeName:i,onDomainsChange:a}){const[s,l]=w.useState(!1),[u,c]=w.useState(e),h=w.useRef(null),m=w.useRef(null);w.useEffect(()=>{c(e)},[e]);const f=u.find(b=>b.domainId===n),g=(f==null?void 0:f.permission)==="private";w.useEffect(()=>{if(!s)return;const b=v=>{var I,D;!((I=h.current)!=null&&I.contains(v.target))&&!((D=m.current)!=null&&D.contains(v.target))&&l(!1)};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),w.useEffect(()=>{if(!s)return;const b=v=>{var I;v.key==="Escape"&&(l(!1),(I=h.current)==null||I.focus())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);function p(b){r(b),l(!1)}function _(){if(s){l(!1);return}l(!0),mi().then(b=>{c(b),a==null||a(b)})}return d.jsxs("div",{className:"mdocs-domain-select-wrapper",children:[d.jsxs("button",{ref:h,type:"button",className:"mdocs-domain-select-trigger","aria-label":o,"aria-expanded":s,"aria-haspopup":"listbox",onClick:_,children:[d.jsx("span",{className:"mdocs-domain-select-text",children:f?i(f.domainName):""}),g&&d.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:[d.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),d.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),d.jsx("svg",{className:"mdocs-domain-select-chevron"+(s?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"1.5",children:d.jsx("path",{d:"M1 1l4 4 4-4"})})]}),s&&d.jsx("div",{ref:m,className:"mdocs-domain-select-menu card",role:"listbox","aria-label":o,children:u.map(b=>d.jsxs("button",{type:"button",className:"mdocs-domain-select-option"+(b.domainId===n?" active":""),role:"option","aria-selected":b.domainId===n,onClick:()=>p(b.domainId),children:[d.jsx("span",{children:i(b.domainName)}),b.permission==="private"&&d.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"2",children:[d.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),d.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]},b.domainId))})]})}const Zi="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",Ke={left:12,bottom:64},Fr="mdocs.agentFabPosition",On=36,ni=3;function Lr(e){const r=Math.max(8,window.innerWidth-On-8),o=Math.max(8,window.innerHeight-On-8);return{left:Math.min(r,Math.max(8,e.left)),bottom:Math.min(o,Math.max(8,e.bottom))}}function _u(e,n,r,o){const i=e-r,a=n-o,s=window.innerHeight-a-On;return Lr({left:i,bottom:s})}function wu(){try{const e=localStorage.getItem(Fr);if(!e)return Ke;const n=JSON.parse(e);return typeof n.left!="number"||typeof n.bottom!="number"?Ke:Lr({left:n.left,bottom:n.bottom})}catch{return Ke}}function ri(e){localStorage.setItem(Fr,JSON.stringify(e))}function ku(e){return e.left===Ke.left&&e.bottom===Ke.bottom}function Iu(e){const r=Math.min(480,window.innerWidth-72);let o=e.left+On+8;o+r>window.innerWidth-8&&(o=e.left-8-r),o=Math.max(8,o);const i=Math.max(8,e.bottom-8);return{left:o,bottom:i}}function Cu(e){const{t:n}=Je(),r=!!e.disableDrag,[o,i]=w.useState(!1),[a,s]=w.useState(e.position),l=w.useRef(null),u=w.useRef(null),c=w.useRef(a),h=w.useRef(e.onPositionChange),m=w.useRef(e.onToggle);c.current=a,h.current=e.onPositionChange,m.current=e.onToggle;const f=w.useRef(null),g=w.useRef(0),p=w.useRef(null);w.useEffect(()=>{f.current||(s(e.position),c.current=e.position)},[e.position]),w.useEffect(()=>{function D(){const P=Lr(c.current);P.left===c.current.left&&P.bottom===c.current.bottom||(c.current=P,s(P),h.current(P),ri(P))}return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]),w.useEffect(()=>{function D(){g.current=0;const N=p.current;if(!N)return;p.current=null,c.current=N,s(N);const S=u.current;S&&(S.style.left=`${N.left}px`,S.style.bottom=`${N.bottom}px`),h.current(N)}function P(N){const S=f.current;if(!S||N.pointerId!==S.pointerId)return;N.preventDefault();const A=N.clientX-S.startX,U=N.clientY-S.startY;!S.didMove&&A*A+U*U>=ni*ni&&(S.didMove=!0,i(!0)),S.didMove&&(p.current=_u(N.clientX,N.clientY,S.offsetX,S.offsetY),g.current||(g.current=requestAnimationFrame(D)))}function x(N){var A;const S=f.current;if(!(!S||N.pointerId!==S.pointerId)){f.current=null,i(!1),g.current&&(cancelAnimationFrame(g.current),g.current=0),p.current&&(c.current=p.current,s(p.current),p.current=null);try{(A=l.current)==null||A.releasePointerCapture(N.pointerId)}catch{}if(S.didMove){const U=c.current;h.current(U),ri(U);return}m.current()}}return window.addEventListener("pointermove",P,{passive:!1}),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x),()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x),g.current&&cancelAnimationFrame(g.current)}},[]);function _(D){if(D.button!==0)return;if(r){D.preventDefault(),e.onToggle();return}D.preventDefault();const P=D.currentTarget.getBoundingClientRect();f.current={pointerId:D.pointerId,offsetX:D.clientX-P.left,offsetY:D.clientY-P.top,startX:D.clientX,startY:D.clientY,didMove:!1},D.currentTarget.setPointerCapture(D.pointerId)}function b(){c.current=Ke,s(Ke),e.onPositionChange(Ke),localStorage.removeItem(Fr)}const v=r?Ke:a,I=!r&&!ku(a);return d.jsxs("div",{ref:u,className:"mdocs-agent-fab-wrap"+(o?" dragging":""),style:{left:v.left,bottom:v.bottom},children:[d.jsx("button",{ref:l,type:"button",className:"mdocs-agent-fab"+(e.open?" open":"")+(o?" dragging":"")+(r?" mdocs-agent-fab--nodrag":""),"aria-label":n("agentFabOpen"),"aria-expanded":e.open,onPointerDown:_,children:d.jsx("img",{src:Zi,alt:"",draggable:!1})}),I&&d.jsx("button",{type:"button",className:"mdocs-agent-fab-reset",onClick:b,"aria-label":n("agentFabReset"),children:n("agentFabReset")})]})}function Su(){const[e,n]=w.useState(()=>typeof window>"u"?Ke:wu());return[e,n]}function Du({title:e,message:n,onClose:r}){const{t:o}=Je();return d.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:i=>{i.target===i.currentTarget&&r()},children:d.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&d.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),d.jsx("p",{className:"mdocs-message-dialog-body",children:n}),d.jsx("div",{className:"mdocs-message-dialog-actions",children:d.jsx("button",{type:"button",className:"primary",onClick:r,children:o("gotIt")})})]})})}function Qi({title:e,message:n,confirmLabel:r="确定",cancelLabel:o="取消",onConfirm:i,onCancel:a,busy:s=!1,danger:l=!1}){return d.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:u=>{u.target===u.currentTarget&&!s&&a()},children:d.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&d.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),d.jsx("p",{className:"mdocs-message-dialog-body",children:n}),d.jsxs("div",{className:"mdocs-message-dialog-actions",style:{gap:8},children:[d.jsx("button",{type:"button",onClick:a,disabled:s,children:o}),d.jsx("button",{type:"button",className:l?"danger":"primary",onClick:i,disabled:s,children:s?"…":r})]})]})})}const oi={"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"},ea={"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 lt(e,n){if(n instanceof He)return n.message;if(n instanceof bt){const r=oi[n.message];return r?e(r):n.message}if(n instanceof Error){const r=oi[n.message]??ea[n.message];return r?e(r):n.message}return String(n)}function Pu(e,n,r){if(e==="Default")return r("defaultDomain");const o="个人域";return e.endsWith(o)?e.slice(0,-o.length)+r("personalDomainSuffix"):e}function sm(e,n){return e==="public"?n("domainPublic"):e==="restricted"?n("domainRestricted"):e==="private"?n("domainPrivate"):e}function kn(e){const n=e.lastIndexOf("/");return n===-1?"":e.slice(0,n)}function Nu(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 tr(e,n){const r=e.trim(),o=n.trim();return o?r?`${r}/${o}`:o:r}function ta(e,n=new Set){for(const r of e)r.type==="document"?n.add(r.path):(r.descDocumentId&&n.add(bs(r.path)),ta(r.children,n));return n}function Sn(e,n){for(const r of e){if(r.type==="folder"&&r.path===n)return r.documentId;if(r.type==="folder"){const o=Sn(r.children,n);if(o)return o}}return null}function nr(e,n){const r=ea[n];return r?e(r):n}function Au(e){const{tree:n,currentDomainId:r,selectedCreateParentPath:o,t:i,onDocCreated:a,refreshTree:s}=e,[l,u]=w.useState(null),[c,h]=w.useState(null),[m,f]=w.useState(!1),g=w.useRef(null);w.useEffect(()=>{if(!l)return;const v=window.setTimeout(()=>{var I;return(I=g.current)==null?void 0:I.focus()},0);return()=>window.clearTimeout(v)},[l]);function p(v,I="md"){const D=v!==void 0;h(null),u({kind:"document",parentMode:D?"fixed":"selection",parentPath:D?v:"",draft:I==="html"?"untitled.html":"untitled.md",fileType:I})}function _(v){const I=v!==void 0;h(null),u({kind:"folder",parentMode:I?"fixed":"selection",parentPath:I?v:"",draft:""})}async function b(v){if(v.preventDefault(),!l)return;f(!0),h(null);const I=ta(n),D=l.parentMode==="selection"?o:l.parentPath;try{if(l.kind==="document"){if(l.fileType==="html"){const J=uo(l.draft);if(!J.ok){h(nr(i,J.message));return}const ne=J.displayFile,Y=ne.replace(/\.html$/i,"").replace(/\.md$/i,"");let ye;try{ye=fo(tr(D,ne))}catch(ie){h(lt(i,ie));return}if(I.has(ye)){h(i("pathExists"));return}const Ne=D?Sn(n,D)??void 0:void 0,j=await fr({fileName:ne,displayName:Y,content:"",domainId:r,parentId:Ne,fileType:"html"});await s(),a(j),u(null);return}const U=uo(l.draft);if(!U.ok){h(nr(i,U.message));return}const M=U.displayFile,z=M.replace(/\.md$/i,"");let F;try{F=fo(tr(D,M))}catch(J){h(lt(i,J));return}if(I.has(F)){h(i("pathExists"));return}const B=D?Sn(n,D)??void 0:void 0,K=await fr({fileName:M,displayName:z,content:Nu(z),domainId:r,parentId:B});await s(),a(K),u(null);return}const P=ws(l.draft);if(!P.ok){h(nr(i,P.message));return}const x=dr(P.display);if(!x){h(i("invalidFolderName"));return}const N=tr(D,x);if(I.has(N)){h(i("folderExists"));return}const S=D?Sn(n,D)??void 0:void 0;await Os({name:x,parentId:S,domainId:r}),await s(),u(null)}catch(P){h(lt(i,P))}finally{f(!1)}}return{createModal:l,setCreateModal:u,createModalError:c,createModalBusy:m,createModalInputRef:g,openNewDocumentModal:p,openNewFolderModal:_,submitCreateModal:b}}const ii="(max-width: 768px)";function Tu(){const[e,n]=w.useState(()=>typeof window<"u"?window.matchMedia(ii).matches:!1);return w.useEffect(()=>{const r=window.matchMedia(ii),o=()=>n(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),e}function Mu({open:e,onClose:n,onResolve:r}){const{t:o}=Je();return e?d.jsx("div",{className:"mdocs-conflict-modal-root",role:"alertdialog","aria-modal":"true",children:d.jsxs("div",{className:"mdocs-conflict-modal-panel",children:[d.jsx("h2",{className:"mdocs-conflict-modal-title",children:o("conflictTitle")}),d.jsx("p",{className:"mdocs-conflict-modal-body",children:o("conflictBody")}),d.jsxs("div",{className:"mdocs-conflict-modal-actions",children:[d.jsx("button",{type:"button",className:"primary",onClick:r,children:o("conflictResolve")}),d.jsx("button",{type:"button",className:"secondary",onClick:n,children:o("conflictClose")})]})]})}):null}function ju({documentId:e,visitorId:n,visitorName:r,documentOwnerId:o,onClose:i}){const[a,s]=w.useState([]),[l,u]=w.useState(""),[c,h]=w.useState(null),[m,f]=w.useState(!0),[g,p]=w.useState(!1),[_,b]=w.useState(null),[v,I]=w.useState(null),[D,P]=w.useState(360),[x,N]=w.useState(80),S=w.useRef(!1),A=w.useRef(!1),U=300,M=80,z=w.useRef(null);function F(){const q=z.current;if(!q)return;q.style.height="auto";const X=q.scrollHeight,xe=Math.min(Math.max(X,M),U);q.style.height=`${xe}px`,N(xe)}w.useEffect(()=>{setTimeout(()=>F(),0)},[c]);function B(q){return n?q.visitorId===n||o===n:!1}const{rootComments:K,repliesByParentId:J,totalCount:ne}=w.useMemo(()=>{const q=[],X=new Map;let xe=0;for(const le of a)le.isDeleted||(xe++,le.parentId?(X.has(le.parentId)||X.set(le.parentId,[]),X.get(le.parentId).push(le)):q.push(le));return{rootComments:q,repliesByParentId:X,totalCount:xe}},[a]),Y=w.useRef(e);w.useEffect(()=>{Y.current=e,u(""),h(null),I(null),ye()},[e]);async function ye(){const q=Y.current;f(!0);try{const X=await zs(e);if(Y.current!==q)return;s(X.comments)}catch(X){if(Y.current!==q)return;I("加载评论失败"),console.error("Failed to load comments:",X)}finally{Y.current===q&&f(!1)}}async function Ne(){var q;if(!(!l.trim()||!n)){p(!0),I(null);try{await $s(e,{content:l,parentId:(c==null?void 0:c.commentId)||null,replyToVisitorId:c?((q=a.find(X=>X.commentId===c.commentId))==null?void 0:q.visitorId)??null:null,replyToVisitorName:(c==null?void 0:c.visitorName)||null}),u(""),h(null),setTimeout(()=>F(),0),await ye()}catch(X){I(X.message||"发表失败,请重试")}finally{p(!1)}}}async function j(q){I(null);try{await Us(e,q),await ye()}catch(X){I(X.message||"删除失败,请重试")}finally{b(null)}}function ie(q){const X=Date.now()-new Date(q).getTime(),xe=Math.floor(X/6e4),le=Math.floor(X/36e5),_e=Math.floor(X/864e5);return xe<1?"刚刚":xe<60?`${xe}分钟前`:le<24?`${le}小时前`:`${_e}天前`}function ae(q){S.current=!0,q.preventDefault()}function re(q){A.current=!0,q.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="row-resize"}return w.useEffect(()=>{function q(xe){if(S.current){const le=Math.max(280,Math.min(600,window.innerWidth-xe.clientX));P(le)}if(A.current){const le=-xe.movementY;N(_e=>Math.max(60,Math.min(600,_e+le)))}}function X(){S.current=!1,A.current=!1,document.body.style.userSelect="",document.body.style.cursor=""}return window.addEventListener("mousemove",q),window.addEventListener("mouseup",X),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",X)}},[]),d.jsxs("div",{className:"mdocs-comments-panel",style:{width:D},children:[d.jsx("div",{className:"mdocs-comments-resize-handle",onMouseDown:ae}),d.jsxs("div",{className:"mdocs-comments-header",children:[d.jsxs("h3",{style:{margin:0,fontSize:"1rem",display:"flex",alignItems:"center",gap:6},children:[d.jsx(ns,{size:18}),"评论 (",ne,")"]}),d.jsx("button",{type:"button",onClick:i,className:"mdocs-comments-close-btn",children:d.jsx(Pt,{size:18})})]}),v&&d.jsxs("div",{className:"mdocs-comments-error",children:[v,d.jsx("button",{type:"button",onClick:()=>I(null),children:d.jsx(Pt,{size:14})})]}),d.jsx("div",{className:"mdocs-comments-list",children:m?d.jsx("div",{className:"mdocs-comments-empty",children:"加载中..."}):K.length===0?d.jsx("div",{className:"mdocs-comments-empty",children:"暂无评论,来发表第一条吧~"}):K.map(q=>d.jsxs("div",{className:"mdocs-comment-root",children:[d.jsxs("div",{className:"mdocs-comment-header",children:[d.jsx("span",{className:"mdocs-comment-avatar",children:q.visitorName.charAt(0).toUpperCase()}),d.jsx("span",{className:"mdocs-comment-author",children:q.visitorName}),d.jsx("span",{className:"mdocs-comment-time",children:ie(q.createdAt)}),B(q)&&d.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>b(q.commentId),title:"删除",children:d.jsx(Pt,{size:14})})]}),d.jsx("div",{className:"mdocs-comment-content",children:q.content}),n&&d.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>h({commentId:q.commentId,visitorName:q.visitorName}),children:"回复"}),(J.get(q.commentId)??[]).length>0&&d.jsx("div",{className:"mdocs-comment-replies",children:(J.get(q.commentId)??[]).map(X=>d.jsxs("div",{className:"mdocs-comment-reply",children:[d.jsxs("div",{className:"mdocs-comment-header",children:[d.jsx("span",{className:"mdocs-comment-avatar mdocs-comment-avatar-small",children:X.visitorName.charAt(0).toUpperCase()}),d.jsx("span",{className:"mdocs-comment-author",children:X.visitorName}),X.replyToVisitorName&&d.jsxs("span",{className:"mdocs-comment-reply-to",children:["回复 ",X.replyToVisitorName]}),d.jsx("span",{className:"mdocs-comment-time",children:ie(X.createdAt)}),B(X)&&d.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>b(X.commentId),title:"删除",children:d.jsx(Pt,{size:12})})]}),d.jsx("div",{className:"mdocs-comment-content",children:X.content}),n&&d.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>h({commentId:q.commentId,visitorName:X.visitorName}),children:"回复"})]},X.commentId))})]},q.commentId))}),n?d.jsxs("div",{className:"mdocs-comments-input-wrapper",children:[d.jsx("div",{className:"mdocs-comments-input-drag-handle",onMouseDown:re}),c&&d.jsxs("div",{className:"mdocs-comment-reply-notice",children:[d.jsxs("span",{children:["回复 ",d.jsx("span",{className:"mdocs-comment-reply-to-name",children:c.visitorName})]}),d.jsxs("button",{type:"button",onClick:()=>h(null),children:[d.jsx(Pt,{size:14})," 取消"]})]}),d.jsx("textarea",{ref:z,value:l,onChange:q=>{u(q.target.value.slice(0,512)),setTimeout(()=>F(),0)},placeholder:c?`回复 ${c.visitorName}...`:"发表评论...",className:"mdocs-comments-input",style:{height:x},maxLength:512,onKeyDown:q=>{q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&Ne()}}),d.jsxs("div",{className:`mdocs-comments-char-count${l.length>=460?" mdocs-char-count--warn":""}`,children:[l.length,"/512"]}),d.jsx("div",{className:"mdocs-comments-input-actions",children:d.jsx("button",{type:"button",className:"mdocs-btn-primary",onClick:Ne,disabled:g||!l.trim(),children:g?"发表中...":"发表"})})]}):d.jsx("div",{className:"mdocs-comments-input-wrapper",style:{textAlign:"center"},children:d.jsx("div",{style:{color:"#666",fontSize:"0.9rem"},children:"请先创建访客身份以发表评论"})}),_&&d.jsx(Qi,{title:"删除评论",message:"确定要删除这条评论吗?",confirmLabel:"删除",danger:!0,onConfirm:()=>j(_),onCancel:()=>b(null)})]})}const Eu="mdocs-drafts",Ou=5,De="drafts",Wt={DOC_NOT_FOUND:"DOC_NOT_FOUND",SYNC_HEAD_MISSING:"SYNC_HEAD_MISSING"};let rr=null;function qt(){return rr||(rr=new Promise((e,n)=>{const r=indexedDB.open(Eu,Ou);r.onupgradeneeded=o=>{const i=r.result;i.objectStoreNames.contains(De)||i.createObjectStore(De,{keyPath:"documentId"});const a=o.oldVersion;if(a>0&&a<4){const u=r.transaction.objectStore(De).openCursor();u.onsuccess=()=>{const c=u.result;if(!c)return;const h=c.value;typeof h.baseCommitId=="string"&&!h.localBaseCommitId&&(h.localBaseCommitId=h.baseCommitId,delete h.baseCommitId);const m=h.conflict;m&&(typeof m.baseCommitId=="string"&&!m.localBaseCommitId&&(m.localBaseCommitId=m.baseCommitId,delete m.baseCommitId),typeof m.expectedHeadCommitId=="string"&&!m.remoteCommitId&&(m.remoteCommitId=m.expectedHeadCommitId,delete m.expectedHeadCommitId)),c.update(h),c.continue()}}if(a>0&&a<5){const u=r.transaction.objectStore(De).openCursor();u.onsuccess=()=>{const c=u.result;if(!c)return;const h=c.value;h.contentKind==null&&(h.contentKind="lexical",c.update(h)),c.continue()}}},r.onsuccess=()=>e(r.result),r.onerror=()=>n(r.error)})),rr}async function Ru(e){var o;const n=await Oe(e.documentId),r={documentId:e.documentId,content:e.content,contentKind:e.contentKind??(n==null?void 0:n.contentKind)??"lexical",displayName:e.displayName,updatedAt:Date.now(),published:!1};if(n!=null&&n.localBaseCommitId)r.localBaseCommitId=n.localBaseCommitId;else{const i=(o=e.localBaseCommitIdAtEditStart)==null?void 0:o.trim();i&&(r.localBaseCommitId=i)}(n==null?void 0:n.permission)!=null?r.permission=n.permission:e.snapshotMeta&&(r.permission=e.snapshotMeta.permission),n!=null&&n.ownerVisitorId?r.ownerVisitorId=n.ownerVisitorId:e.snapshotMeta&&(r.ownerVisitorId=e.snapshotMeta.ownerVisitorId),n!=null&&n.domainId?r.domainId=n.domainId:e.snapshotMeta&&(r.domainId=e.snapshotMeta.domainId),n!=null&&n.publishError&&(r.publishError=n.publishError,r.publishErrorAt=n.publishErrorAt),n!=null&&n.conflictStatus&&(r.conflictStatus=n.conflictStatus),n!=null&&n.conflict&&(r.conflict=n.conflict),await Nt(r)}function zr(e){const n={documentId:e.documentId,content:e.content,displayName:e.displayName,updatedAt:e.updatedAt,published:e.published};return e.permission!=null&&(n.permission=e.permission),e.ownerVisitorId&&(n.ownerVisitorId=e.ownerVisitorId),e.domainId&&(n.domainId=e.domainId),e.publishError!=null&&(n.publishError=e.publishError),e.publishErrorAt!=null&&(n.publishErrorAt=e.publishErrorAt),e.localBaseCommitId&&(n.localBaseCommitId=e.localBaseCommitId),e.conflictStatus!=null&&(n.conflictStatus=e.conflictStatus),e.conflict!=null&&(n.conflict=e.conflict),n}async function Nt(e){const n=await qt(),r=zr(e);return new Promise((o,i)=>{const a=n.transaction(De,"readwrite");a.objectStore(De).put(r),a.oncomplete=()=>o(),a.onerror=()=>i(a.error)})}async function Oe(e){const n=await qt();return new Promise((r,o)=>{const a=n.transaction(De,"readonly").objectStore(De).get(e);a.onsuccess=()=>r(a.result),a.onerror=()=>o(a.error)})}async function or(e){const n=await qt();return new Promise((r,o)=>{const i=n.transaction(De,"readwrite");i.objectStore(De).delete(e),i.oncomplete=()=>r(),i.onerror=()=>o(i.error)})}async function Fu(e){const n=await qt();return new Promise((r,o)=>{const a=n.transaction(De,"readonly").objectStore(De).getAll();a.onsuccess=()=>{let s=a.result;e!=null&&e.skipFailed&&(s=s.filter(l=>!l.publishError)),r(s)},a.onerror=()=>o(a.error)})}async function Lu(e,n){const r=await qt();return new Promise((o,i)=>{const s=r.transaction(De,"readwrite").objectStore(De),l=s.get(e);l.onsuccess=()=>{const u=l.result;u&&s.put(zr({...u,publishError:n,publishErrorAt:Date.now()})),o()},l.onerror=()=>i(l.error)})}async function ir(e){const n=await qt();return new Promise((r,o)=>{const a=n.transaction(De,"readwrite").objectStore(De),s=a.get(e);s.onsuccess=()=>{const l=s.result;l&&a.put(zr({...l,publishError:void 0,publishErrorAt:void 0})),r()},s.onerror=()=>o(s.error)})}async function ar(e,n){const r=await Oe(e);r&&await Nt({...r,localBaseCommitId:n.localBaseCommitId,conflictStatus:n.conflictStatus,conflict:n.conflict})}async function sr(e){const n=await Oe(e);n&&await Nt({...n,conflict:void 0,conflictStatus:"none"})}class dn extends Error{constructor(r,o){super(r);Ht(this,"code");Ht(this,"cause");this.name="DraftPublishAborted",this.code=r,this.cause=o==null?void 0:o.cause}}function zu(e){return e instanceof dn?e.code:e instanceof He?e.status===404?Wt.DOC_NOT_FOUND:e.code||`HTTP_${e.status}`:e instanceof Error&&e.message.trim()?e.message.trim().slice(0,120):"UNKNOWN"}function $u(e,n,r,o){const i=(n==null?void 0:n.displayName)||e("unknownTitle");if(r===Wt.SYNC_HEAD_MISSING)return e("draftPublishFailedSyncHead",{name:i});if(r===Wt.DOC_NOT_FOUND)return e("draftPublishFailedNotice",{name:i});const a=o instanceof He||o instanceof Error&&o.message?o.message:r;return e("draftPublishFailedGeneric",{name:i,reason:a})}async function Uu(e,n,r){const o=zu(n);throw await Lu(e,o),n instanceof dn?n:new dn(o,{cause:n})}function Bu(e,n){const r=w.useRef(n);r.current=n,w.useEffect(()=>{if(!e)return;const o=3e4,i=1e4,a=async()=>{const l=await Fu({skipFailed:!0}),u=Date.now();for(const c of l)if(!c.published&&!(u-c.updatedAt<o))try{await r.current(c.documentId)}catch(h){console.log("[autoPublish] scan publish failed:",h)}};a();const s=setInterval(a,i);return()=>clearInterval(s)},[e])}const Hu=1e4;function Vu(e,n){const[r,o]=w.useState(null),[i,a]=w.useState("up_to_date");return w.useEffect(()=>{if(!e){o(null),a("up_to_date");return}let l=!1;const u=e;async function c(){try{const m=await Ms(u,n??void 0);if(l)return;o(m.headCommitId),a(m.status)}catch{}}c();const h=window.setInterval(()=>void c(),Hu);return()=>{l=!0,window.clearInterval(h)}},[e,n]),{remoteCommitId:r,syncStatus:i,syncBehind:!!(n&&r&&n!==r)||i==="behind"}}const Gu="/assets/mdocs-logo-Dsv_2t6v.svg",Wu=w.lazy(()=>jt(()=>import("./DocumentEditor-D39RTLYE.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(e=>({default:e.DocumentEditor}))),qu=w.lazy(()=>jt(()=>import("./HtmlEditor-Bmpi_p2t.js"),__vite__mapDeps([12,1,2,3,6,13])).then(e=>({default:e.HtmlEditor}))),Ku=w.lazy(()=>jt(()=>import("./SettingsPage-CuwYAiJh.js"),__vite__mapDeps([14,1,11,2,3,6])).then(e=>({default:e.SettingsPage}))),Yu=w.lazy(()=>jt(()=>import("./AgentChatPanel-dADh_kOG.js"),__vite__mapDeps([15,1,16,10,8,7,2,3,6])).then(e=>({default:e.AgentChatPanel}))),Ju=w.lazy(()=>jt(()=>import("./AiWriteWorkbench-DezZBKI2.js"),__vite__mapDeps([17,1,16,7,2,3,6])).then(e=>({default:e.AiWriteWorkbench}))),Xu=w.lazy(()=>jt(()=>import("./MergeView-WUR136do.js"),__vite__mapDeps([18,1,4,5,2,3,6,7,8])).then(e=>({default:e.MergeView})));function Zu(e,n){try{const r=new Intl.RelativeTimeFormat(n,{numeric:"auto"}),o=Date.now()-new Date(e).getTime(),i=Math.floor(o/6e4),a=Math.floor(i/60),s=Math.floor(a/24);return s>30?r.format(-Math.floor(s/30),"month"):s>0?r.format(-s,"day"):a>0?r.format(-a,"hour"):i>0?r.format(-i,"minute"):r.format(-Math.floor(o/1e3),"second")}catch{return e.slice(0,10)}}async function lr(e,n,r,o){const i=await mi();n(i);const a=localStorage.getItem("mdocs.currentDomainId"),l=a&&i.some(u=>u.domainId===a)?a:Ws(i,e);r(l),await o(l)}function ai(){const{t:e,lang:n,setLang:r}=Je(),[o,i]=w.useState("loading"),[a,s]=w.useState(()=>localStorage.getItem("mdocs.sidebarCollapsed")==="true"),l=Tu(),[u,c]=w.useState(!1),h=()=>{if(l){c(O=>!O);return}const y=!a;s(y),localStorage.setItem("mdocs.sidebarCollapsed",String(y))};w.useEffect(()=>{l||c(!1)},[l]);const[m,f]=w.useState(!1),[g,p]=w.useState(0),_=w.useRef(null),[b,v]=w.useState(null),[I,D]=w.useState(null),[P,x]=w.useState(null),[N,S]=w.useState([]),[A,U]=w.useState([]),[M,z]=w.useState("default"),[F,B]=w.useState(!1),K=w.useRef(null),{documentId:J}=xa(),ne=_a(),[Y,ye]=w.useState(null),Ne=(Y==null?void 0:Y.kind)==="document"?Y.documentId:null,[j,ie]=w.useState(null),[ae,re]=w.useState(null),q=w.useRef(ae);q.current=ae;const[X,xe]=w.useState(0),[le,_e]=w.useState(null),[fn,Xe]=w.useState(!1),[ut,ft]=w.useState(!1),[Ze,Qe]=w.useState(!1),Ve=(j==null?void 0:j.documentId)??null,{syncBehind:et,remoteCommitId:ve}=Vu(Ve,le),[mt,tt]=w.useState(null);w.useEffect(()=>{if(!ut||!j){tt(null);return}(async()=>{const y=await Oe(j.documentId);if(y!=null&&y.conflict){tt(y.conflict);return}if(y&&le&&ve){const O=y.localBaseCommitId??le;if(!O)return;const E={localBaseCommitId:O,remoteCommitId:ve,localSnapshotContent:y.content};await ar(j.documentId,{localBaseCommitId:E.localBaseCommitId,conflictStatus:"diverged",conflict:E}),tt(E)}})()},[ut,j,le,ve]),w.useEffect(()=>{!j||!et||!Ze||Oe(j.documentId).then(async y=>{!y||y.conflict||y.conflictStatus==="publish_conflict"||y.conflictStatus!=="diverged"&&await Nt({...y,conflictStatus:"diverged"})})},[j==null?void 0:j.documentId,et,Ze]),w.useEffect(()=>{if(!j){_e(null);return}let y=!1;return Oe(j.documentId).then(O=>{y||(O&&!O.published&&O.localBaseCommitId?_e(O.localBaseCommitId):_e(j.headCommitId??null))}),()=>{y=!0}},[j==null?void 0:j.documentId,j==null?void 0:j.headCommitId,Ze]);const[ht,ge]=w.useState(null),[Et,Ae]=w.useState(null),[we,wt]=w.useState(null),[nt,$e]=w.useState(null),[kt,Re]=w.useState(""),[Ot,pt]=w.useState("docs"),[It,k]=w.useState(!1),[T,R]=w.useState(!1),[L,G]=Su(),Z=w.useRef(null),[Q,te]=w.useState(!1),[ce,Te]=w.useState(null),pe=w.useRef(void 0),ke=w.useRef(void 0);Bu(localStorage.getItem("mdocs.autoPublish")==="true",Yr);async function de(y){var O;await((O=pe.current)==null?void 0:O.call(pe)),y()}function Ce(y){const E=(y.trim()||"untitled").replace(/[\\/:*?"<>|]/g,"-").slice(0,80);return E.endsWith(".md")?E:`${E}.md`}async function Rt(){var O,E;if(!j||!ae)return;await((O=pe.current)==null?void 0:O.call(pe));let y=((E=ke.current)==null?void 0:E.call(ke))??"";if(!y.trim())try{y=(await qn({content:ae.content,from:"lexical",to:"markdown"})).content}catch{y=""}Te({markdown:y,documentId:j.documentId,displayName:ae.displayName||j.displayName||"未命名"}),te(!0),k(!1)}function Ft(){Te({markdown:"",documentId:null,displayName:"未命名"}),te(!0),k(!1)}async function Lt(y){var ee,fe;const O=y.documentId.trim();if(!O)return;await((ee=pe.current)==null?void 0:ee.call(pe));let E="",V=y.displayName.trim()||"未命名";try{const je=await Jt(O);V=((fe=je.displayName)==null?void 0:fe.trim())||V;try{E=(await qn({content:je.content,from:"lexical",to:"markdown"})).content}catch{E=""}}catch{}Te({markdown:E,documentId:O,displayName:V}),te(!0),k(!1),pt("docs"),de(()=>ne(`/doc/${O}`))}async function zt(y){(j==null?void 0:j.documentId)===y.documentId&&await Kr()}async function gt(y){if(y.documentId){if(!window.confirm("将把帮写结果写入当前文档的本地草稿(不会自动发布)。继续?")){const fe=new Error("cancelled");throw fe.silent=!0,fe}const V=await qn({content:y.markdown,from:"markdown",to:"lexical"}),ee=(j==null?void 0:j.documentId)===y.documentId?j:null;return await Ru({documentId:y.documentId,content:V.content,displayName:y.displayName,localBaseCommitIdAtEditStart:(ee==null?void 0:ee.headCommitId)??null,snapshotMeta:ee?{permission:ee.permission,ownerVisitorId:ee.ownerVisitorId,domainId:ee.domainId}:void 0}),(j==null?void 0:j.documentId)===y.documentId?(re({documentId:y.documentId,content:V.content,displayName:y.displayName}),xe(fe=>fe+1),Qe(!0)):await $t(y.documentId),ge("帮写已写入草稿,可在编辑器中继续修改后发布"),{documentId:y.documentId}}const O=await fr({fileName:Ce(y.displayName),displayName:y.displayName,content:y.markdown,contentFormat:"markdown",domainId:M||void 0,parentId:void 0});return await be(),await $t(O.documentId),ge("已创建文档"),{documentId:O.documentId}}w.useEffect(()=>{Ct()},[]),w.useEffect(()=>{if(!ht)return;const y=()=>{ge(null)};return window.addEventListener("pointerdown",y,!0),()=>window.removeEventListener("pointerdown",y,!0)},[ht]),w.useEffect(()=>{const y=O=>{var ee,fe,je;const E=O;if(((ee=E.detail)==null?void 0:ee.status)===409||((fe=E.detail)==null?void 0:fe.code)==="AI_NOT_CONFIGURED")return;const V=(je=E.detail)==null?void 0:je.message;V&&Ae(V)};return window.addEventListener(ur,y),()=>window.removeEventListener(ur,y)},[]);async function Ct(){try{const y=await yo();v(y),Dn(y.visitorId),await lr(y.visitorId,U,z,be),i("ready")}catch(y){if(y instanceof He&&y.status===401){i("needsRegister");return}Ae(lt(e,y)),i("needsRegister")}}async function mn(y,O){const E=await Ds(y,O);v(E.visitor),D(E.visitor.visitorId),x(E.recoveryCode),Dn(E.visitor.visitorId),await lr(E.visitor.visitorId,U,z,be),i("ready")}async function hn(y){const O=await yo();v(O),await lr(O.visitorId,U,z,be),i("ready")}async function be(y){const E=await Ts(y??M);S(E)}function pn(y){re({documentId:y.documentId,content:y.content,displayName:y.displayName}),xe(O=>O+1),Qe(!1)}function ra(y,O){re({documentId:y,content:O.content,displayName:O.displayName}),xe(E=>E+1),Qe(!0)}async function $r(y,O){await or(y);const E=await Jt(y);if((j==null?void 0:j.documentId)===y&&_.current===y){ie(Yt(E)),Qe(!1);const V=q.current,ee=O!==void 0&&E.content===O,fe=(V==null?void 0:V.documentId)===y&&V.content===E.content;ee||fe?(V==null?void 0:V.documentId)===y&&V.displayName!==E.displayName&&re({...V,displayName:E.displayName}):pn(E)}return E}function gn(y,O,E="folder"){console.log("[openGraph]",E,y,O),ie(null),re(null),ye({kind:"graph",scope:E,resourceId:y,name:O})}function $n(){ye(null)}w.useEffect(()=>{function y(O){K.current&&!K.current.contains(O.target)&&B(!1)}if(F)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[F]);async function $t(y){_.current=y,ye({kind:"document",documentId:y});try{const O=await Oe(y);if(_.current!==y)return;const E=await Jt(y);if(_.current!==y||(E.domainId!==M&&(localStorage.setItem("mdocs.currentDomainId",E.domainId),z(E.domainId),be(E.domainId)),Re(kn(E.relativePath)),E.headCommitId&&O&&!O.published&&(O.publishError===Wt.SYNC_HEAD_MISSING&&await ir(y),O.localBaseCommitId||await Nt({...O,localBaseCommitId:E.headCommitId})),ie(Yt(E)),_.current!==y))return;O&&!O.published?ra(y,O):pn(E)}catch(O){if(_.current!==y)return;Ae(lt(e,O))}}w.useEffect(()=>{o==="ready"&&(J?$t(J):(ye(null),ie(null),re(null),_e(null)))},[o,J]);const{createModal:Ut,setCreateModal:Un,createModalError:Ur,createModalBusy:Bt,createModalInputRef:oa,openNewDocumentModal:yn,openNewFolderModal:Bn,submitCreateModal:ia}=Au({tree:N,currentDomainId:M,selectedCreateParentPath:kt,t:e,onDocCreated:y=>{ie(Yt(y)),pn(y),Re(kn(y.relativePath)),ne(`/doc/${y.documentId}`)},refreshTree:be}),[aa,vn]=w.useState(!1),[sa,Kt]=w.useState(!1),[St,Br]=w.useState([]),[Hn,Hr]=w.useState(""),[bn,Vr]=w.useState(""),[la,Gr]=w.useState(new Set);async function ca(){try{const y=await Fs();Br(y)}catch(y){Ae(lt(e,y))}}const Vn=w.useMemo(()=>{const y={};for(const O of A)y[O.domainId]=O.domainName;return y},[A]),Wr=w.useMemo(()=>{let y=St;const O=Hn.trim().toLowerCase();return O&&(y=y.filter(E=>{var V;return(V=E.displayName)==null?void 0:V.toLowerCase().includes(O)})),bn&&(y=y.filter(E=>E.domainId===bn)),y},[St,Hn,bn]),da=w.useMemo(()=>{const y=new Set,O=[];for(const E of St){const V=E.domainId;V&&!y.has(V)&&(y.add(V),O.push({id:V,name:Vn[V]??V}))}return O},[St,Vn]);async function ua(y,O,E,V,ee){let fe=await Oe(y);!fe&&(j==null?void 0:j.documentId)===y&&(fe={documentId:y,content:O,displayName:E,updatedAt:Date.now(),published:!1,localBaseCommitId:V,permission:j.permission,ownerVisitorId:j.ownerVisitorId,domainId:j.domainId},await Nt(fe)),fe&&await ar(y,{localBaseCommitId:V,conflictStatus:"publish_conflict",conflict:{localBaseCommitId:V,remoteCommitId:ee.headCommitId,localSnapshotContent:O}}),Xe(!0)}async function qr(y,O,E,V){return so(E).execute(async()=>{const ee=await Oe(E),fe=(ee==null?void 0:ee.localBaseCommitId)??(j==null?void 0:j.headCommitId);if(!fe)throw Ae(e("syncHeadMissing")),new Error("missing localBaseCommitId");try{await vo(E,{content:y,displayName:O,permission:V,version:{localBaseCommitId:fe}}),await sr(E),await $r(E,y),await be(),Xe(!1),ge(e("published")),window.setTimeout(()=>ge(null),1200)}catch(je){throw je instanceof He&&je.status===409&&je.code==="VERSION_CONFLICT"&&je.details&&typeof je.details=="object"&&await ua(E,y,O,fe,je.details),je}})}async function fa(){if(!j)return;const y=await Jt(j.documentId);y.domainId!==M&&(localStorage.setItem("mdocs.currentDomainId",y.domainId),z(y.domainId),be(y.domainId)),Re(kn(y.relativePath)),ie(Yt(y)),pn(y),ge(e("syncPullDone")),window.setTimeout(()=>ge(null),1200)}async function Kr(){if(!j)return;const y=await Oe(j.documentId),O=!!(y&&!y.published);if((y==null?void 0:y.conflictStatus)==="publish_conflict"||(y==null?void 0:y.conflictStatus)==="diverged"||!!(y!=null&&y.conflict)){ft(!0);return}if(O&&y){if(et&&ve){const V=y.localBaseCommitId??le;if(V){const ee={localBaseCommitId:V,remoteCommitId:ve,localSnapshotContent:y.content};await ar(j.documentId,{localBaseCommitId:V,conflictStatus:"diverged",conflict:ee}),tt(ee)}ft(!0);return}ge(e("pullBlockedDraft")),window.setTimeout(()=>ge(null),3e3);return}await fa()}async function ma(y){await sr(y.documentId),await or(y.documentId),Qe(!1),ft(!1),Xe(!1),await $t(y.documentId),be(y.domainId),ge(e("published")),window.setTimeout(()=>ge(null),1200)}async function ha(y,O,E){try{await Uu(y,O,E)}catch(V){if(!(V instanceof dn))throw V;const ee=E??await Oe(y);throw ge($u(e,ee,V.code,V.cause??O)),window.setTimeout(()=>ge(null),4e3),V}}async function Yr(y){let O;try{await so(y).execute(async()=>{const E=await Oe(y);if(!E)return;O=E;let V=E.localBaseCommitId;if(V||(V=(await Jt(y)).headCommitId??void 0,V&&(await Nt({...E,localBaseCommitId:V}),E.publishError===Wt.SYNC_HEAD_MISSING&&await ir(y))),!V)throw new dn(Wt.SYNC_HEAD_MISSING);const ee=await Oe(y);ee&&(await vo(y,{content:ee.content,displayName:ee.displayName,version:{localBaseCommitId:V}}),await sr(y),await ir(y),(j==null?void 0:j.documentId)===y?await $r(y,ee.content):await or(y),await be(),ge(e("published")),window.setTimeout(()=>ge(null),1200))})}catch(E){await ha(y,E,O)}}function Jr(y,O){wt({type:"document",id:y,name:O})}function Xr(y,O){wt({type:"folder",id:y,name:O})}async function pa(y,O){try{const E=await Es(y,O);await be(E.domainId),(j==null?void 0:j.documentId)===y&&(ie(Yt(E)),Re(kn(E.relativePath)))}catch(E){E instanceof He?E.status===409&&Ae(E.message):Ae(lt(e,E))}}async function ga(){if(we)try{we.type==="document"?(await js(we.id),(j==null?void 0:j.documentId)===we.id&&(ie(null),re(null),Re(""),ne("/"))):we.type==="folder"&&(await Rs(we.id),j&&(ie(null),re(null),Re(""),ne("/"))),await be(),ge(we.type==="folder"?`已删除「${we.name}」及其下所有内容`:`已删除「${we.name}」`),window.setTimeout(()=>ge(null),2e3)}catch(y){Ae(lt(e,y))}finally{wt(null)}}return o==="loading"?d.jsx("div",{className:"mdocs-loading muted",children:e("loading")}):o==="needsRegister"?d.jsx(qs,{onSubmit:mn,onRecover:hn,error:ht}):d.jsxs("div",{className:"mdocs-app-root",children:[fi(),d.jsx("div",{className:"mdocs-shell",children:Ot==="settings"?d.jsx(w.Suspense,{fallback:d.jsx("div",{className:"mdocs-main muted",style:{padding:24},children:"加载设置…"}),children:d.jsx(Ku,{onBack:()=>pt("docs"),onPublishDraft:Yr,onOpenDocument:$t,onRecoverDraft:()=>void be()})}):d.jsxs("div",{className:"mdocs-layout"+(l?" mdocs-layout--reader":""),children:[l&&u?d.jsx("button",{type:"button",className:"mdocs-mobile-nav-scrim","aria-label":e("collapseSidebar"),onClick:()=>c(!1)}):null,d.jsxs("aside",{className:"mdocs-sidebar"+(l?u?" mdocs-sidebar--drawer-open":" mdocs-sidebar--drawer":a?" mdocs-sidebar-collapsed":""),children:[d.jsxs("header",{className:"mdocs-sidebar-header",children:[d.jsxs("div",{className:"mdocs-brand",children:[d.jsx("img",{src:Gu,alt:e("brand"),className:"mdocs-brand-logo"}),d.jsx("span",{children:e("brand")})]}),d.jsx("button",{type:"button",className:"mdocs-sidebar-toggle",onClick:h,"aria-label":e(l?u?"collapseSidebar":"expandSidebar":a?"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:y=>{y.currentTarget.style.background="var(--mdocs-hover-bg, #f0f0f0)"},onMouseLeave:y=>{y.currentTarget.style.background="none"},children:l?d.jsx(ro,{size:18}):a?d.jsx(oo,{size:18}):d.jsx(ro,{size:18})})]}),d.jsxs("div",{className:"mdocs-sidebar-actions",ref:K,style:{position:"relative"},children:[d.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":e("newDocument"),onClick:()=>B(y=>!y),style:{color:"var(--mdocs-accent)"},children:d.jsx(to,{size:20})}),F&&d.jsxs("div",{className:"mdocs-create-dropdown",children:[d.jsxs("button",{type:"button",className:"mdocs-create-dropdown-item",onClick:()=>{B(!1),yn()},children:[d.jsx(Ya,{size:14,strokeWidth:1.5}),"Markdown"]}),d.jsxs("button",{type:"button",className:"mdocs-create-dropdown-item",onClick:()=>{B(!1),yn(void 0,"html")},children:[d.jsx(qa,{size:14,strokeWidth:1.5}),"HTML"]})]}),d.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":e("newFolder"),onClick:()=>Bn(),children:d.jsx(no,{size:20})}),d.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":"知识图谱",onClick:()=>gn(M,"知识图谱","domain"),style:{marginLeft:8},children:d.jsx(Cr,{size:20,strokeWidth:1.75})})]}),d.jsx(Ys,{nodes:N,activeDocumentId:Ne,graphFocusAnchorId:(Y==null?void 0:Y.kind)==="graph"?Y.resourceId:null,selectedParentPath:kt,onOpen:y=>{l&&c(!1),de(()=>ne(`/doc/${y.documentId}`))},onOpenFolder:(y,O)=>{de(()=>{Re(y),O&&($n(),l&&c(!1),ne(`/doc/${O}`))})},onContextMenu:$e,onMoveDocument:pa,onDeselect:()=>{$n(),de(()=>{Re(""),ne("/")})},onOpenGraph:(y,O)=>{if(y.type==="folder")gn(y.documentId,y.name);else if(O){const E=N.find(V=>V.documentId===O);gn(O,(E==null?void 0:E.name)??"图谱")}},onGenerateGraph:async(y,O)=>{var ee;const E=y.type==="folder"?y.documentId:O;if(!E)return;const V=y.type==="folder"?y.name:((ee=N.find(fe=>fe.documentId===O))==null?void 0:ee.name)??"图谱";gn(E,V)}}),d.jsxs("footer",{className:"mdocs-sidebar-footer",children:[d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,cursor:"pointer"},onClick:()=>de(()=>pt("settings")),children:[d.jsx("span",{className:"mdocs-visitor-avatar",children:b?b.visitorName.charAt(0).toUpperCase():"?"}),d.jsx("span",{className:"mdocs-visitor-footer-name",children:b?b.visitorName:""})]}),d.jsx("button",{type:"button",className:"mdocs-sidebar-bookmark mdocs-tooltip","data-tooltip":e("bookmark"),onClick:()=>{Kt(!0),Hr(""),Vr(""),ca()},style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",fontSize:"1rem",lineHeight:1,borderRadius:4},children:d.jsx(ds,{size:16,strokeWidth:1.5})}),d.jsx("button",{type:"button",className:"mdocs-sidebar-logout mdocs-tooltip","data-tooltip":e("logout"),onClick:()=>vn(!0),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4},children:d.jsx(es,{size:16,strokeWidth:1.5})})]})]}),d.jsxs("main",{className:"mdocs-main",children:[(Y==null?void 0:Y.kind)==="graph"?d.jsx(vu,{scope:Y.scope,resourceId:Y.resourceId,name:Y.name,onClose:$n,onOpenDocument:y=>{$t(y)}},`${Y.scope}-${Y.resourceId}`):j&&ae&&ae.documentId===j.documentId?j.fileType==="html"?d.jsx(w.Suspense,{fallback:d.jsx("div",{className:"muted",style:{padding:24},children:"加载编辑器…"}),children:d.jsx(qu,{documentId:j.documentId,initialContent:ae.content,displayName:ae.displayName,contentRevision:X,canEdit:!!(b&&(j.ownerVisitorId===b.visitorId||lo(j.permission)||j.invitedEdit===!0)),localBaseCommitIdAtEditStart:j.headCommitId,snapshotMeta:{permission:j.permission,ownerVisitorId:j.ownerVisitorId,domainId:j.domainId},onContentChange:y=>{re(O=>O&&{...O,content:y})},onDraftExistsChange:Qe,onPublish:y=>{qr(y,j.displayName,j.documentId,j.permission)},readerChrome:l,onOpenMobileNav:()=>c(!0)},j.documentId)}):d.jsxs("div",{className:"mdocs-editor-with-comments",children:[d.jsx("div",{className:"mdocs-editor-container",children:d.jsx(w.Suspense,{fallback:d.jsx("div",{className:"muted",style:{padding:24},children:"加载编辑器…"}),children:d.jsx(Wu,{meta:j,initialContent:ae.content,initialDisplayName:ae.displayName,contentRevision:X,canEdit:!!(b&&(j.ownerVisitorId===b.visitorId||lo(j.permission)||j.invitedEdit===!0)),domains:A,currentDomainId:M,onDomainChange:y=>{de(()=>{localStorage.setItem("mdocs.currentDomainId",y),z(y),ie(null),re(null),Re(""),ne("/"),be(y)})},onDomainsChange:U,onPublish:qr,syncBehind:et,onSyncClick:()=>void Kr(),onDraftExistsChange:Qe,onConflictModalRequest:()=>Xe(!0),onMergeRequest:()=>ft(!0),canManageInvites:!!(b&&b.visitorId===j.ownerVisitorId),onDelete:async()=>{if(j.relativePath.endsWith("/___desc___.md")){const y=j.relativePath.replace(/\/___desc___\.md$/,"");Xr(j.documentId,y)}else Jr(j.documentId,j.relativePath)},saveBeforeNavRef:pe,exportMarkdownRef:ke,onShowToast:ge,onShowError:Ae,onToggleComments:()=>f(!m),commentPanelOpen:m,commentCount:g,onAiWrite:()=>void Rt(),readerChrome:l,onOpenMobileNav:()=>c(!0)},j.documentId)})}),m&&d.jsx(ju,{documentId:j.documentId,visitorId:b==null?void 0:b.visitorId,visitorName:b==null?void 0:b.visitorName,documentOwnerId:j.ownerVisitorId,onClose:()=>f(!1)})]}):d.jsxs("div",{className:"mdocs-welcome",children:[l?d.jsxs("button",{type:"button",className:"mdocs-reader-float-pill",onClick:()=>c(!0),"aria-label":e("expandSidebar"),children:[d.jsx(oo,{size:18,strokeWidth:1.75}),d.jsx("span",{children:e("brand")})]}):null,d.jsx("h1",{children:e("brand")}),d.jsx("p",{className:"muted mdocs-welcome-lead",children:N.length===0?e("noDocsInDomain"):e("createDocToStart")}),d.jsxs("div",{className:"mdocs-welcome-domain",children:[d.jsx("label",{className:"muted mdocs-welcome-domain-label",children:e("domainLabel")}),d.jsx(xu,{domains:A.length?A:[{domainId:"default",domainName:e("defaultDomain"),permission:"",creatorVisitorId:"",docCount:0}],value:M,onChange:y=>{de(()=>{localStorage.setItem("mdocs.currentDomainId",y),z(y),ie(null),re(null),Re(""),ne("/"),be(y)})},onDomainsChange:U,ariaLabel:e("domainLabel"),localizeName:y=>Pu(y,n,e)})]}),d.jsxs("div",{className:"mdocs-welcome-actions",children:[d.jsxs("button",{type:"button",className:"primary",onClick:()=>yn(),style:{display:"flex",alignItems:"center",gap:6},children:[d.jsx(to,{size:16,strokeWidth:1.5}),e("newDocument")]}),d.jsxs("button",{type:"button",className:"secondary",onClick:()=>Bn(),style:{display:"flex",alignItems:"center",gap:6},children:[d.jsx(no,{size:16,strokeWidth:1.5}),e("newFolder")]}),d.jsxs("button",{type:"button",className:"secondary",onClick:()=>Ft(),style:{display:"flex",alignItems:"center",gap:6},children:[d.jsx("img",{src:Zi,alt:"",width:16,height:16,style:{display:"block"}}),"AI 帮写"]})]})]}),d.jsx(Mu,{open:fn,onClose:()=>Xe(!1),onResolve:()=>{Xe(!1),ft(!0)}}),ut&&j&&mt&&d.jsx(w.Suspense,{fallback:d.jsx("div",{className:"merge-view-loading",children:e("mergeLoadingRemote")}),children:d.jsx(Xu,{documentId:j.documentId,displayName:j.displayName,conflict:mt,fileType:j.fileType,onClose:()=>ft(!1),onSuccess:ma,onError:y=>Ae(y)})}),ht&&d.jsx("div",{className:"mdocs-toast",role:"status",children:ht}),Et&&d.jsx(Du,{title:e("error"),message:Et,onClose:()=>Ae(null)})]}),aa&&d.jsx("div",{className:"mdocs-dialog-backdrop",onClick:y=>{y.target===y.currentTarget&&vn(!1)},children:d.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:440},children:[d.jsx("h1",{style:{fontSize:"1.125rem",marginBottom:8},children:"退出当前登录身份?"}),d.jsx("p",{style:{lineHeight:1.6,color:"var(--mdocs-text-secondary, #666)",marginBottom:20},children:"这将会导致您无法修改以前的文章。如果想找回账号,需要恢复码或联系管理员执行合并用户脚本。"}),d.jsxs("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end"},children:[d.jsx("button",{type:"button",onClick:()=>vn(!1),children:"取消"}),d.jsx("button",{type:"button",className:"primary",style:{background:"#d32f2f"},onClick:()=>{Ss(),ie(null),re(null),v(null),S([]),vn(!1),i("needsRegister")},children:"确认退出"})]})]})}),sa&&d.jsx("div",{className:"mdocs-dialog-backdrop",onClick:y=>{y.target===y.currentTarget&&Kt(!1)},children:d.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:640,width:"min(640px, 100%)",maxHeight:"70vh",display:"flex",flexDirection:"column"},children:[d.jsxs("h1",{style:{fontSize:"1.125rem",marginBottom:16},children:[e("bookmarkTitle"),"(",St.length,")"]}),St.length>0&&d.jsxs("div",{className:"mdocs-bookmark-filterbar",children:[d.jsx("input",{type:"text",placeholder:e("bookmarkSearch"),value:Hn,onChange:y=>Hr(y.target.value)}),d.jsxs("select",{value:bn,onChange:y=>Vr(y.target.value),children:[d.jsx("option",{value:"",children:e("bookmarkFilterAll")}),da.map(y=>d.jsx("option",{value:y.id,children:y.name},y.id))]})]}),St.length===0?d.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkEmpty")}):Wr.length===0?d.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkNoMatch")}):d.jsx("div",{style:{overflowY:"auto",flex:1,margin:"0 -1rem",padding:"0 1rem"},children:d.jsxs("table",{className:"mdocs-bookmark-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:e("bookmarkColTitle")}),d.jsx("th",{children:e("bookmarkColDomain")}),d.jsx("th",{children:e("bookmarkColAuthor")}),d.jsx("th",{children:e("bookmarkColTime")}),d.jsx("th",{className:"mdocs-bookmark-col-action"})]})}),d.jsx("tbody",{children:Wr.map(y=>{const O=la.has(y.documentId);return d.jsxs("tr",{className:`${O?"mdocs-bookmark-removing":""}`,style:{opacity:y.isDeleted?.6:1},children:[d.jsx("td",{className:"mdocs-bookmark-col-title",children:d.jsxs("div",{style:{cursor:y.isDeleted?"default":"pointer",display:"flex",alignItems:"center",gap:6,overflow:"hidden"},onClick:()=>{y.isDeleted||de(()=>{Kt(!1),ne(`/doc/${y.documentId}`)})},children:[d.jsx("span",{ref:E=>{if(E){const V=E.scrollWidth>E.clientWidth;E.title=V?y.displayName??"":""}},style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:y.displayName??"(无标题)"}),y.isDeleted&&d.jsx("span",{style:{fontSize:"0.7rem",color:"#d32f2f",background:"#ffebee",padding:"1px 6px",borderRadius:4,flexShrink:0},children:"已删除"})]})}),d.jsx("td",{children:y.isDeleted?"":Vn[y.domainId??""]??y.domainId??""}),d.jsx("td",{children:y.isDeleted?"":y.ownerVisitorName??"-"}),d.jsx("td",{children:y.isDeleted?"":Zu(y.bookmarkedAt,n)}),d.jsx("td",{className:"mdocs-bookmark-col-action",children:d.jsxs("div",{style:{display:"flex",gap:2,alignItems:"center",justifyContent:"flex-end"},children:[d.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkOpen"),onClick:()=>{y.isDeleted||de(()=>{Kt(!1),ne(`/doc/${y.documentId}`)})},style:{background:"none",border:"none",cursor:y.isDeleted?"default":"pointer",padding:"4px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4,display:"inline-flex",alignItems:"center"},children:d.jsx(Ga,{size:14,strokeWidth:1.5})}),d.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkRemove"),onClick:async()=>{try{await Ls(y.documentId),Gr(E=>new Set(E).add(y.documentId)),setTimeout(()=>{Br(E=>E.filter(V=>V.documentId!==y.documentId)),Gr(E=>{const V=new Set(E);return V.delete(y.documentId),V})},300)}catch(E){Ae(lt(e,E))}},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:E=>{E.currentTarget.style.color="#d32f2f"},onMouseLeave:E=>{E.currentTarget.style.color="var(--mdocs-text-muted, #999)"},children:"✕"})]})})]},y.documentId)})})]})}),d.jsx("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end",marginTop:16,paddingTop:16,borderTop:"1px solid var(--mdocs-border, #eee)"},children:d.jsx("button",{type:"button",onClick:()=>Kt(!1),children:e("close")})})]})}),nt&&d.jsx(bu,{x:nt.x,y:nt.y,node:nt.node,parentPath:nt.parentPath,onClose:()=>$e(null),onCreateChild:y=>yn(y),onCreateFolder:y=>Bn(y),onDeleteDocument:y=>Jr(y.documentId,y.path),onDeleteFolder:y=>Xr(y.documentId,y.folderDisplayName||y.name)}),we&&d.jsx(Qi,{title:we.type==="folder"?"删除文件夹":"删除文档",message:we.type==="folder"?`确定要删除「${we.name}」及其下的所有文档和子文件夹吗?此操作不可撤销。`:`确定要删除「${we.name}」吗?`,confirmLabel:"删除",cancelLabel:"取消",onConfirm:ga,onCancel:()=>wt(null),danger:!0}),Ut&&d.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&!Bt&&Un(null)},children:d.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[d.jsx("h1",{children:Ut.kind==="document"?e("newDocumentTitle"):e("newFolderTitle")}),d.jsx("p",{className:"muted",children:Ut.kind==="document"?e("fileNameHint"):e("folderNameHint")}),d.jsxs("form",{onSubmit:ia,className:"mdocs-dialog-form",children:[d.jsxs("label",{className:"mdocs-dialog-label",children:[Ut.kind==="document"?e("fileNameLabel"):e("folderNameLabel"),d.jsx("input",{ref:oa,value:Ut.draft,onChange:y=>Un(O=>O&&{...O,draft:y.target.value}),placeholder:Ut.kind==="document"?e("untitledPlaceholder"):e("folderExamplePlaceholder"),maxLength:200,disabled:Bt})]}),Ur&&d.jsx("div",{className:"mdocs-dialog-error",children:Ur}),d.jsxs("div",{className:"mdocs-dialog-actions",children:[d.jsx("button",{type:"button",onClick:()=>!Bt&&Un(null),disabled:Bt,children:e("cancel")}),d.jsx("button",{type:"submit",className:"primary",disabled:Bt,children:e(Bt?"creating":"create")})]})]})]})})]})}),I&&b&&d.jsx(Ks,{visitorId:I,onDismiss:()=>D(null)}),P&&d.jsx("div",{className:"mdocs-dialog-backdrop",style:{position:"fixed",zIndex:9999},onClick:y=>{y.target===y.currentTarget&&x(null)},children:d.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:480,textAlign:"center"},children:[d.jsx("h1",{style:{fontSize:"1.25rem",marginBottom:8},children:"🔑 保存你的恢复码"}),d.jsxs("p",{className:"muted",style:{marginBottom:16,lineHeight:1.5},children:["恢复码是你的唯一凭证,当 Token 丢失时可用它找回身份。",d.jsx("br",{}),d.jsx("strong",{children:"请立即复制保存,此弹窗关闭后不可再查看。"})]}),d.jsx("div",{style:{background:"#f5f5f5",borderRadius:8,padding:"12px 16px",fontFamily:"monospace",fontSize:"1.25rem",letterSpacing:"0.1em",marginBottom:20,userSelect:"all"},children:P}),d.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:[d.jsx("button",{type:"button",className:"primary",onClick:()=>{navigator.clipboard.writeText(P)},children:"复制恢复码"}),d.jsx("button",{type:"button",onClick:()=>x(null),children:"已保存,关闭"})]})]})}),d.jsxs(d.Fragment,{children:[d.jsx(Cu,{open:It,onToggle:()=>{var y;It?(y=Z.current)==null||y.requestClose():k(!0)},position:L,onPositionChange:G,disableDrag:l}),It?d.jsx(w.Suspense,{fallback:null,children:d.jsx(Yu,{ref:Z,open:It,onClose:()=>{k(!1),R(!1)},visitorName:b==null?void 0:b.visitorName,fullscreen:l||T,onToggleFullscreen:l?void 0:()=>R(y=>!y),domainId:M||null,documentId:(j==null?void 0:j.documentId)??null,documentTitle:(j==null?void 0:j.displayName)??null,documentPath:(j==null?void 0:j.relativePath)??null,graphFileId:(Y==null?void 0:Y.kind)==="graph"?`${Y.resourceId}.graph-file`:null,graphLabel:(Y==null?void 0:Y.kind)==="graph"?Y.name:null,anchorStyle:l||T?void 0:Iu(L),onOpenDocument:y=>{pt("docs"),de(()=>ne(`/doc/${y}`)),k(!1),R(!1)},onTreeChanged:()=>void be(),onDocumentOverwritten:y=>void zt(y),onOpenCoding:y=>void Lt(y)})}):null]}),ce?d.jsx(w.Suspense,{fallback:null,children:d.jsx(Ju,{open:Q,initialMarkdown:ce.markdown,documentId:ce.documentId,displayName:ce.displayName,onClose:()=>{te(!1),Te(null)},onComplete:gt})}):null]})}const Qu=w.lazy(()=>jt(()=>import("./PlaygroundPage-CPzJG_Wk.js"),__vite__mapDeps([19,1,4,5,2,3,6,7,8,9,10])).then(e=>({default:e.PlaygroundPage})));function ef(){return d.jsxs(wa,{children:[d.jsx(Gn,{path:"/",element:d.jsx(ai,{})}),d.jsx(Gn,{path:"/doc/:documentId",element:d.jsx(ai,{})}),d.jsx(Gn,{path:"/playground",element:d.jsx(w.Suspense,{fallback:d.jsx("div",{style:{padding:24},children:"Loading playground…"}),children:d.jsx(Qu,{})})})]})}function tf(){const{pathname:e,hash:n,search:r,origin:o}=window.location,i="/",a=i.endsWith("/")?i.slice(0,-1):i;let s=e;a&&s.startsWith(a)&&(s=s.slice(a.length)||"/");const l=s.match(/^\/doc\/([^/]+)\/?$/);if(!l)return;const u=n.match(/^#\/doc\/([^/?#]+)/),c=(u==null?void 0:u[1])??l[1];if(!c)return;const h=i.endsWith("/")?i:`${i}/`;window.location.replace(`${o}${h}${r}#/doc/${c}`)}tf();const na=document.getElementById("root");if(!na)throw new Error("root element missing");ka.createRoot(na).render(d.jsx(si.StrictMode,{children:d.jsx(Ca,{motion:La,children:d.jsx(Sa,{children:d.jsx(ys,{children:d.jsx(Ia,{children:d.jsx(ef,{})})})})})}));export{Uf as $,dn as A,ff as B,As as C,xu as D,sm as E,Gs as F,kf as G,wf as H,_f as I,xf as J,Sf as K,mf as L,ns as M,Cr as N,pf as O,oo as P,hf as Q,gf as R,ds as S,Cf as T,If as U,Df as V,Pf as W,Nf as X,$f as Y,yo as Z,Qi as _,Oe as a,bo as a0,Bf as a1,Hf as a2,Vf as a3,Gf as a4,Wf as a5,Tu as a6,Rf as a7,Fs as a8,zf as a9,vo as aA,Wn as aB,Gu as aa,ro as ab,fi as ac,vf as ad,yf as ae,Of as af,Pt as ag,qf as ah,Yf as ai,fu as aj,Ya as ak,Kf as al,Jf as am,Xf as an,Zf as ao,am as ap,nm as aq,im as ar,tm as as,em as at,Qf as au,om as av,rm as aw,Jt as ax,Af as ay,qn as az,Je as b,Pe as c,or as d,Ff as e,bf as f,so as g,cf as h,Zi as i,Lf as j,Tf as k,Pu as l,Ge as m,jf as n,Mf as o,Ef as p,mi as q,Ls as r,Ts as s,Ys as t,Ru as u,fr as v,lt as w,Fu as x,$u as y,ir as z};
|