@fgbg/mdocs 1.3.17 → 1.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/agent-skills/changelog/SKILL.md +14 -0
  3. package/agent-skills/index.json +1 -1
  4. package/agent-skills/usage-search/SKILL.md +14 -11
  5. package/dist/server/agent/Agent/tool-ui-effects.js +7 -1
  6. package/dist/server/agent/Agent/tool-ui-effects.js.map +1 -1
  7. package/dist/server/db/schema.js +30 -0
  8. package/dist/server/db/schema.js.map +1 -1
  9. package/dist/server/search/document-index-manager.js +33 -40
  10. package/dist/server/search/document-index-manager.js.map +1 -1
  11. package/dist/server/search/document-index-manager.test.js +194 -14
  12. package/dist/server/search/document-index-manager.test.js.map +1 -1
  13. package/dist/server/search/search.service.js +150 -42
  14. package/dist/server/search/search.service.js.map +1 -1
  15. package/dist/web/assets/{AgentChatPanel-C3c14Bo_.js → AgentChatPanel-DTj8Nz0Z.js} +2 -2
  16. package/dist/web/assets/{AgentSkillFormCard-BYUjSFe1.js → AgentSkillFormCard-DTgxybJh.js} +3 -3
  17. package/dist/web/assets/{AiWriteWorkbench-ze827qk7.js → AiWriteWorkbench-D2RzXzty.js} +3 -3
  18. package/dist/web/assets/{DiagramEditor-NtNY3sZL-Cie6NhLx.js → DiagramEditor-NtNY3sZL-B2Aeu79R.js} +1 -1
  19. package/dist/web/assets/{DocChrome-ixaNyUG9.js → DocChrome-4qmjr6wa.js} +1 -1
  20. package/dist/web/assets/{DocumentEditor-ByqPHijF.js → DocumentEditor-KEURMFDp.js} +1 -1
  21. package/dist/web/assets/{HtmlEditor-CpqCAPAr.js → HtmlEditor-jCKtKOCT.js} +1 -1
  22. package/dist/web/assets/{MergeView-D93ZHlTG.js → MergeView-eRcs-x1s.js} +2 -2
  23. package/dist/web/assets/{PlaygroundPage-CodSaeWS.js → PlaygroundPage-M7fqYn4Z.js} +1 -1
  24. package/dist/web/assets/SettingsPage-mS3g_vBq.js +1 -0
  25. package/dist/web/assets/{Toolbar-CSKpV4ua.js → Toolbar-F3tR5o7R.js} +1 -1
  26. package/dist/web/assets/{VisitorPickerModal-CqDA1S9F.js → VisitorPickerModal-CPjKg8ox.js} +1 -1
  27. package/dist/web/assets/{check-CN9m0reb.js → check-CQSGOkW1.js} +1 -1
  28. package/dist/web/assets/{copy-DFs3qk19.js → copy-BMAJ--_Y.js} +1 -1
  29. package/dist/web/assets/index-C8iEyMxp.css +1 -0
  30. package/dist/web/assets/{index-CUdIA5aE.js → index-DUu4Is5p.js} +50 -45
  31. package/dist/web/assets/{meta2dEngine-BD2XbzaV-SYn2XtSh.js → meta2dEngine-BD2XbzaV-BAZUiXoN.js} +1 -1
  32. package/dist/web/assets/{plus-QDhBbIRF.js → plus-C3uXIATM.js} +1 -1
  33. package/dist/web/assets/{react-Bf45libg.js → react-BXGUMaBS.js} +3 -3
  34. package/dist/web/index.html +2 -2
  35. package/package.json +1 -1
  36. package/dist/web/assets/SettingsPage-C8doYEbb.js +0 -6
  37. package/dist/web/assets/index-C0ujN3sT.css +0 -1
@@ -1,137 +1,142 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocumentEditor-ByqPHijF.js","assets/react-vendor-BuABiQkA.js","assets/ui-CvA4pq3d.js","assets/motion-DFABYlwt.js","assets/react-Bf45libg.js","assets/editor-CL03se2B.js","assets/diagram-Bk84WZto.js","assets/plus-QDhBbIRF.js","assets/check-CN9m0reb.js","assets/copy-DFs3qk19.js","assets/Toolbar-CSKpV4ua.js","assets/DocChrome-ixaNyUG9.js","assets/file-type-policy-GUk904tm.js","assets/VisitorPickerModal-CqDA1S9F.js","assets/HtmlEditor-CpqCAPAr.js","assets/HtmlEditor-iolk903a.css","assets/SettingsPage-C8doYEbb.js","assets/AgentChatPanel-C3c14Bo_.js","assets/AgentSkillFormCard-BYUjSFe1.js","assets/AiWriteWorkbench-ze827qk7.js","assets/MergeView-D93ZHlTG.js","assets/PlaygroundPage-CodSaeWS.js"])))=>i.map(i=>d[i]);
2
- var Ea=Object.defineProperty;var Oa=(e,n,r)=>n in e?Ea(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var qt=(e,n,r)=>Oa(e,typeof n!="symbol"?n+"":n,r);import{r as x,j as c,R as ki,B as Ra,_ as Ot,a8 as Fa,a9 as La,aa as za,ab as er,c as $a,ac as Ua}from"./react-vendor-BuABiQkA.js";import{a5 as Ba,a6 as Ha}from"./ui-CvA4pq3d.js";import{d as Va,s as wr,p as Ga,t as Wa,a as qa,q as Ka,o as Ya,b as Ja,c as Xa,e as ut,f as Za,g as Qa,y as es,m as po,h as go}from"./diagram-Bk84WZto.js";import{f as ts}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)}})();/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocumentEditor-KEURMFDp.js","assets/react-vendor-BuABiQkA.js","assets/ui-CvA4pq3d.js","assets/motion-DFABYlwt.js","assets/react-BXGUMaBS.js","assets/editor-CL03se2B.js","assets/diagram-Bk84WZto.js","assets/plus-C3uXIATM.js","assets/check-CQSGOkW1.js","assets/copy-BMAJ--_Y.js","assets/Toolbar-F3tR5o7R.js","assets/DocChrome-4qmjr6wa.js","assets/file-type-policy-GUk904tm.js","assets/VisitorPickerModal-CPjKg8ox.js","assets/HtmlEditor-jCKtKOCT.js","assets/HtmlEditor-iolk903a.css","assets/SettingsPage-mS3g_vBq.js","assets/AgentChatPanel-DTj8Nz0Z.js","assets/AgentSkillFormCard-DTgxybJh.js","assets/AiWriteWorkbench-D2RzXzty.js","assets/MergeView-eRcs-x1s.js","assets/PlaygroundPage-M7fqYn4Z.js"])))=>i.map(i=>d[i]);
2
+ var Fa=Object.defineProperty;var La=(e,n,r)=>n in e?Fa(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var qt=(e,n,r)=>La(e,typeof n!="symbol"?n+"":n,r);import{r as x,j as c,R as Ii,B as za,_ as zt,a8 as $a,a9 as Ua,aa as Ba,ab as tr,c as Ha,ac as Va}from"./react-vendor-BuABiQkA.js";import{a5 as Ga,a6 as Wa}from"./ui-CvA4pq3d.js";import{d as qa,s as _r,p as Ka,t as Ya,a as Ja,q as Xa,o as Za,b as Qa,c as es,e as ft,f as ts,g as ns,y as rs,m as go,h as yo}from"./diagram-Bk84WZto.js";import{f as os}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
3
  * @license lucide-react v0.562.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const ns=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,o)=>o?o.toUpperCase():r.toLowerCase()),yo=e=>{const n=rs(e);return n.charAt(0).toUpperCase()+n.slice(1)},Ii=(...e)=>e.filter((n,r,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===r).join(" ").trim(),os=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};/**
7
+ */const is=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),as=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,o)=>o?o.toUpperCase():r.toLowerCase()),vo=e=>{const n=as(e);return n.charAt(0).toUpperCase()+n.slice(1)},Ci=(...e)=>e.filter((n,r,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===r).join(" ").trim(),ss=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};/**
8
8
  * @license lucide-react v0.562.0 - ISC
9
9
  *
10
10
  * This source code is licensed under the ISC license.
11
11
  * See the LICENSE file in the root directory of this source tree.
12
- */var is={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"};/**
12
+ */var ls={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
13
  * @license lucide-react v0.562.0 - ISC
14
14
  *
15
15
  * This source code is licensed under the ISC license.
16
16
  * See the LICENSE file in the root directory of this source tree.
17
- */const as=x.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:i="",children:a,iconNode:s,...l},u)=>x.createElement("svg",{ref:u,...is,width:n,height:n,stroke:e,strokeWidth:o?Number(r)*24/Number(n):r,className:Ii("lucide",i),...!a&&!os(l)&&{"aria-hidden":"true"},...l},[...s.map(([d,h])=>x.createElement(d,h)),...Array.isArray(a)?a:[a]]));/**
17
+ */const cs=x.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:i="",children:a,iconNode:s,...l},u)=>x.createElement("svg",{ref:u,...ls,width:n,height:n,stroke:e,strokeWidth:o?Number(r)*24/Number(n):r,className:Ci("lucide",i),...!a&&!ss(l)&&{"aria-hidden":"true"},...l},[...s.map(([d,h])=>x.createElement(d,h)),...Array.isArray(a)?a:[a]]));/**
18
18
  * @license lucide-react v0.562.0 - ISC
19
19
  *
20
20
  * This source code is licensed under the ISC license.
21
21
  * See the LICENSE file in the root directory of this source tree.
22
- */const ge=(e,n)=>{const r=x.forwardRef(({className:o,...i},a)=>x.createElement(as,{ref:a,iconNode:n,className:Ii(`lucide-${ns(yo(e))}`,`lucide-${e}`,o),...i}));return r.displayName=yo(e),r};/**
22
+ */const ge=(e,n)=>{const r=x.forwardRef(({className:o,...i},a)=>x.createElement(cs,{ref:a,iconNode:n,className:Ci(`lucide-${is(vo(e))}`,`lucide-${e}`,o),...i}));return r.displayName=vo(e),r};/**
23
23
  * @license lucide-react v0.562.0 - ISC
24
24
  *
25
25
  * This source code is licensed under the ISC license.
26
26
  * See the LICENSE file in the root directory of this source tree.
27
- */const ss=[["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"}]],ls=ge("book-open",ss);/**
27
+ */const ds=[["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"}]],us=ge("book-open",ds);/**
28
28
  * @license lucide-react v0.562.0 - ISC
29
29
  *
30
30
  * This source code is licensed under the ISC license.
31
31
  * See the LICENSE file in the root directory of this source tree.
32
- */const cs=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vo=ge("chevron-down",cs);/**
32
+ */const fs=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],bo=ge("chevron-down",fs);/**
33
33
  * @license lucide-react v0.562.0 - ISC
34
34
  *
35
35
  * This source code is licensed under the ISC license.
36
36
  * See the LICENSE file in the root directory of this source tree.
37
- */const ds=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],us=ge("code-xml",ds);/**
37
+ */const ms=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],hs=ge("code-xml",ms);/**
38
38
  * @license lucide-react v0.562.0 - ISC
39
39
  *
40
40
  * This source code is licensed under the ISC license.
41
41
  * See the LICENSE file in the root directory of this source tree.
42
- */const fs=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],ms=ge("code",fs);/**
42
+ */const ps=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],gs=ge("code",ps);/**
43
43
  * @license lucide-react v0.562.0 - ISC
44
44
  *
45
45
  * This source code is licensed under the ISC license.
46
46
  * See the LICENSE file in the root directory of this source tree.
47
- */const hs=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],ps=ge("ellipsis-vertical",hs);/**
47
+ */const ys=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],vs=ge("ellipsis-vertical",ys);/**
48
48
  * @license lucide-react v0.562.0 - ISC
49
49
  *
50
50
  * This source code is licensed under the ISC license.
51
51
  * See the LICENSE file in the root directory of this source tree.
52
- */const gs=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ys=ge("eye",gs);/**
52
+ */const bs=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],xs=ge("eye",bs);/**
53
53
  * @license lucide-react v0.562.0 - ISC
54
54
  *
55
55
  * This source code is licensed under the ISC license.
56
56
  * See the LICENSE file in the root directory of this source tree.
57
- */const vs=[["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"}]],bo=ge("file-text",vs);/**
57
+ */const ws=[["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"}]],xo=ge("file-text",ws);/**
58
58
  * @license lucide-react v0.562.0 - ISC
59
59
  *
60
60
  * This source code is licensed under the ISC license.
61
61
  * See the LICENSE file in the root directory of this source tree.
62
- */const bs=[["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"}]],xs=ge("file",bs);/**
62
+ */const _s=[["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"}]],ks=ge("file",_s);/**
63
63
  * @license lucide-react v0.562.0 - ISC
64
64
  *
65
65
  * This source code is licensed under the ISC license.
66
66
  * See the LICENSE file in the root directory of this source tree.
67
- */const ws=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]],_s=ge("folder-plus",ws);/**
67
+ */const Is=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["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"}]],Cs=ge("folder-plus",Is);/**
68
68
  * @license lucide-react v0.562.0 - ISC
69
69
  *
70
70
  * This source code is licensed under the ISC license.
71
71
  * See the LICENSE file in the root directory of this source tree.
72
- */const ks=[["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"}]],Is=ge("folder",ks);/**
72
+ */const Ss=[["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"}]],Ds=ge("folder",Ss);/**
73
73
  * @license lucide-react v0.562.0 - ISC
74
74
  *
75
75
  * This source code is licensed under the ISC license.
76
76
  * See the LICENSE file in the root directory of this source tree.
77
- */const Cs=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Dn=ge("loader-circle",Cs);/**
77
+ */const Ns=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Dn=ge("loader-circle",Ns);/**
78
78
  * @license lucide-react v0.562.0 - ISC
79
79
  *
80
80
  * This source code is licensed under the ISC license.
81
81
  * See the LICENSE file in the root directory of this source tree.
82
- */const Ss=[["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"}]],Ds=ge("log-out",Ss);/**
82
+ */const Ps=[["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"}]],Ts=ge("log-out",Ps);/**
83
83
  * @license lucide-react v0.562.0 - ISC
84
84
  *
85
85
  * This source code is licensed under the ISC license.
86
86
  * See the LICENSE file in the root directory of this source tree.
87
- */const Ps=[["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=ge("message-square",Ps);/**
87
+ */const As=[["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"}]],js=ge("message-square",As);/**
88
88
  * @license lucide-react v0.562.0 - ISC
89
89
  *
90
90
  * This source code is licensed under the ISC license.
91
91
  * See the LICENSE file in the root directory of this source tree.
92
- */const Ts=[["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"}]],Lr=ge("network",Ts);/**
92
+ */const Ms=[["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"}]],zr=ge("network",Ms);/**
93
93
  * @license lucide-react v0.562.0 - ISC
94
94
  *
95
95
  * This source code is licensed under the ISC license.
96
96
  * See the LICENSE file in the root directory of this source tree.
97
- */const As=[["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"}]],xo=ge("panel-left-close",As);/**
97
+ */const Es=[["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"}]],wo=ge("panel-left-close",Es);/**
98
98
  * @license lucide-react v0.562.0 - ISC
99
99
  *
100
100
  * This source code is licensed under the ISC license.
101
101
  * See the LICENSE file in the root directory of this source tree.
102
- */const js=[["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"}]],wo=ge("panel-left-open",js);/**
102
+ */const Os=[["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"}]],_o=ge("panel-left-open",Os);/**
103
103
  * @license lucide-react v0.562.0 - ISC
104
104
  *
105
105
  * This source code is licensed under the ISC license.
106
106
  * See the LICENSE file in the root directory of this source tree.
107
- */const Ms=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],_o=ge("refresh-cw",Ms);/**
107
+ */const Rs=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ko=ge("refresh-cw",Rs);/**
108
108
  * @license lucide-react v0.562.0 - ISC
109
109
  *
110
110
  * This source code is licensed under the ISC license.
111
111
  * See the LICENSE file in the root directory of this source tree.
112
- */const Es=[["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"}]],tr=ge("settings-2",Es);/**
112
+ */const Fs=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Si=ge("search",Fs);/**
113
113
  * @license lucide-react v0.562.0 - ISC
114
114
  *
115
115
  * This source code is licensed under the ISC license.
116
116
  * See the LICENSE file in the root directory of this source tree.
117
- */const Os=[["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"}]],Rs=ge("star",Os);/**
117
+ */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"}]],nr=ge("settings-2",Ls);/**
118
118
  * @license lucide-react v0.562.0 - ISC
119
119
  *
120
120
  * This source code is licensed under the ISC license.
121
121
  * See the LICENSE file in the root directory of this source tree.
122
- */const Fs=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xt=ge("x",Fs);/**
122
+ */const zs=[["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"}]],$s=ge("star",zs);/**
123
123
  * @license lucide-react v0.562.0 - ISC
124
124
  *
125
125
  * This source code is licensed under the ISC license.
126
126
  * See the LICENSE file in the root directory of this source tree.
127
- */const Ls=[["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=ge("zap",Ls),zs={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:"Start writing",startWriting:"Start writing",newArticle:"New article",newDirectory:"New folder",newFolder:"New folder",noDocumentsYet:"no documents yet",collapseFolder:"Collapse folder",expandFolder:"Expand folder",noDocsInDomain:"No documents in this workspace yet. Switch workspace below or create a document.",createDocToStart:"Click Start writing, or open a document from the sidebar.",domainLabel:"Workspace",defaultDomain:"Default",displayNamePlaceholder:"Display name",currentDomainAria:"Current workspace",insertDiagram:"Insert diagram",outlineHide:"Hide outline",outlineShow:"Show outline",readOnlyNotice:`> You don't have permission to edit
127
+ */const Us=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Et=ge("x",Us);/**
128
+ * @license lucide-react v0.562.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const Bs=[["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"}]],Di=ge("zap",Bs),Hs={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:"Start writing",startWriting:"Start writing",newArticle:"New article",newDirectory:"New folder",newFolder:"New folder",noDocumentsYet:"no documents yet",collapseFolder:"Collapse folder",expandFolder:"Expand folder",noDocsInDomain:"No documents in this workspace yet. Switch workspace below or create a document.",createDocToStart:"Click Start writing, or open a document from the sidebar.",domainLabel:"Workspace",defaultDomain:"Default",displayNamePlaceholder:"Display name",currentDomainAria:"Current workspace",insertDiagram:"Insert diagram",outlineHide:"Hide outline",outlineShow:"Show outline",readOnlyNotice:`> You don't have permission to edit
128
133
 
129
- `,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}}",copyDocumentId:"Copy document ID",copyDocumentUrl:"Copy URL",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 workspaces.",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:"Editable in workspace",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:"Workspaces",createDomain:"New workspace",domainName:"Name",domainPermission:"Permission",domainPublic:"Public",domainRestricted:"Restricted",domainPrivate:"Private",docCount:"{{count}} documents",rename:"Rename",deleteDomain:"Delete workspace",deleteDomainConfirm:"Delete workspace {{name}}?",domainLocked:"Has documents, locked",noDomains:"No workspaces",domainNameRequired:"Enter a name",domainBuiltIn:"Built-in",domainNotCreator:"Only the creator can modify this workspace",domainSearchPlaceholder:"Search name…",domainFilterAll:"All",domainColName:"Name",domainColType:"Type",domainColDocCount:"Documents",domainColActions:"Actions",domainTypeBuiltinSuffix:"(built-in)",domainChangeType:"Change type",domainPermissionNoDowngrade:"Permission cannot be made more private.",domainPermissionAlreadyTop:"Already the most open permission.",domainNotModifiable:"System preset, cannot be changed",domainTooltipTypeLocked:"With documents, permission can only become more open.",deleteDomainConfirmDetail:"Delete workspace «{{name}}»? All {{count}} document(s) in it will be permanently removed.",domainNoMatch:"No matching workspaces.",memberTemplates:"Member templates",memberTemplateFormNew:"New template",memberTemplateSavedList:"Saved templates",memberTemplateIntro:"Save reusable member lists for restricted workspaces. 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 workspace in Workspaces.",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 workspace 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 (workspace 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 workspaces you own: click Members… in the Actions column, then pick people in the dialog (or apply a saved template). The workspace 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",conflictForce:"Force overwrite",conflictForceHint:"Document owner only. Cloud content will be replaced with your local draft; others' published edits will not appear in the body (still in commit history).",conflictForceConfirm:"Overwrite the cloud copy with your local draft and discard others' published body changes. This cannot be undone automatically. Continue?",conflictForceBusy:"Overwriting…",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:"Workspace",bookmarkColAuthor:"Author",bookmarkColTime:"Bookmarked",bookmarkSearch:"Search bookmarks",bookmarkFilterAll:"All workspaces",bookmarkNoMatch:"No matching bookmarks",myDocuments:"My Documents",myDocumentsEmpty:"No documents yet",myDocumentsColTitle:"Title",myDocumentsColDomain:"Workspace",myDocumentsColCreator:"Creator",myDocumentsColUpdated:"Updated",myDocumentsColCreated:"Created",myDocumentsFilterDomain:"Filter by workspace",myDocumentsFilterAllDomains:"All workspaces",myDocumentsFilterCreator:"Filter by creator",myDocumentsFilterAllCreators:"All creators",myDocumentsGroupBy:"Group",myDocumentsGroupNone:"No grouping",myDocumentsGroupDomain:"Group by workspace",myDocumentsGroupCreator:"Group by creator",myDocumentsNoMatch:"No matching documents",myDocumentsPrev:"Previous",myDocumentsNext:"Next",myDocumentsJumpTo:"Go to",myDocumentsJump:"Go",myDocumentsPageInfo:"Page {{current}}/{{total}}, {{count}} total",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"},$s={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:"开始写作",startWriting:"开始写作",newArticle:"新建文章",newDirectory:"新建目录",newFolder:"新建文件夹",noDocumentsYet:"暂无文档",collapseFolder:"收起文件夹",expandFolder:"展开文件夹",noDocsInDomain:"此工作空间尚无文档。请在下方切换工作空间或创建文档。",createDocToStart:"点「开始写作」,或从左侧打开一篇文档。",domainLabel:"工作空间",defaultDomain:"默认",displayNamePlaceholder:"显示名称",currentDomainAria:"当前工作空间",insertDiagram:"插入图表",outlineHide:"隐藏大纲",outlineShow:"显示大纲",readOnlyNotice:`> 您无权限编辑
134
+ `,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}}",copyDocumentId:"Copy document ID",copyDocumentUrl:"Copy URL",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 workspaces.",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:"Editable in workspace",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:"Workspaces",createDomain:"New workspace",domainName:"Name",domainPermission:"Permission",domainPublic:"Public",domainRestricted:"Restricted",domainPrivate:"Private",docCount:"{{count}} documents",rename:"Rename",deleteDomain:"Delete workspace",deleteDomainConfirm:"Delete workspace {{name}}?",domainLocked:"Has documents, locked",noDomains:"No workspaces",domainNameRequired:"Enter a name",domainBuiltIn:"Built-in",domainNotCreator:"Only the creator can modify this workspace",domainSearchPlaceholder:"Search name…",domainFilterAll:"All",domainColName:"Name",domainColType:"Type",domainColDocCount:"Documents",domainColActions:"Actions",domainTypeBuiltinSuffix:"(built-in)",domainChangeType:"Change type",domainPermissionNoDowngrade:"Permission cannot be made more private.",domainPermissionAlreadyTop:"Already the most open permission.",domainNotModifiable:"System preset, cannot be changed",domainTooltipTypeLocked:"With documents, permission can only become more open.",deleteDomainConfirmDetail:"Delete workspace «{{name}}»? All {{count}} document(s) in it will be permanently removed.",domainNoMatch:"No matching workspaces.",memberTemplates:"Member templates",memberTemplateFormNew:"New template",memberTemplateSavedList:"Saved templates",memberTemplateIntro:"Save reusable member lists for restricted workspaces. 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 workspace in Workspaces.",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 workspace 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 (workspace 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 workspaces you own: click Members… in the Actions column, then pick people in the dialog (or apply a saved template). The workspace 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",conflictForce:"Force overwrite",conflictForceHint:"Document owner only. Cloud content will be replaced with your local draft; others' published edits will not appear in the body (still in commit history).",conflictForceConfirm:"Overwrite the cloud copy with your local draft and discard others' published body changes. This cannot be undone automatically. Continue?",conflictForceBusy:"Overwriting…",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:"Workspace",bookmarkColAuthor:"Author",bookmarkColTime:"Bookmarked",bookmarkSearch:"Search bookmarks",bookmarkFilterAll:"All workspaces",bookmarkNoMatch:"No matching bookmarks",myDocuments:"My Documents",myDocumentsEmpty:"No documents yet",myDocumentsColTitle:"Title",myDocumentsColDomain:"Workspace",myDocumentsColCreator:"Creator",myDocumentsColUpdated:"Updated",myDocumentsColCreated:"Created",myDocumentsFilterDomain:"Filter by workspace",myDocumentsFilterAllDomains:"All workspaces",myDocumentsFilterCreator:"Filter by creator",myDocumentsFilterAllCreators:"All creators",myDocumentsGroupBy:"Group",myDocumentsGroupNone:"No grouping",myDocumentsGroupDomain:"Group by workspace",myDocumentsGroupCreator:"Group by creator",myDocumentsNoMatch:"No matching documents",myDocumentsPrev:"Previous",myDocumentsNext:"Next",myDocumentsJumpTo:"Go to",myDocumentsJump:"Go",myDocumentsPageInfo:"Page {{current}}/{{total}}, {{count}} total",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",docSearch:"Search documents",docSearchTitle:"Search this workspace",docSearchPlaceholder:"Search titles or body…",docSearchEmptyHint:"Type to search the current workspace",docSearchNoResults:"No matching documents",docSearchNoDomain:"Select a workspace first",docSearchFailed:"Search failed",logout:"Sign out"},Vs={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:"开始写作",startWriting:"开始写作",newArticle:"新建文章",newDirectory:"新建目录",newFolder:"新建文件夹",noDocumentsYet:"暂无文档",collapseFolder:"收起文件夹",expandFolder:"展开文件夹",noDocsInDomain:"此工作空间尚无文档。请在下方切换工作空间或创建文档。",createDocToStart:"点「开始写作」,或从左侧打开一篇文档。",domainLabel:"工作空间",defaultDomain:"默认",displayNamePlaceholder:"显示名称",currentDomainAria:"当前工作空间",insertDiagram:"插入图表",outlineHide:"隐藏大纲",outlineShow:"显示大纲",readOnlyNotice:`> 您无权限编辑
130
135
 
131
- `,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}}」",copyDocumentId:"复制 documentId",copyDocumentUrl:"复制 URL",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:"改类型",domainPermissionNoDowngrade:"不能把权限改得更封闭。",domainPermissionAlreadyTop:"已经是最开放的权限。",domainNotModifiable:"系统预设,不可修改",domainTooltipTypeLocked:"已有文档时只能把权限改得更开放,不能收回。",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:"解决冲突",conflictForce:"强制覆盖",conflictForceHint:"仅文档所有者可用。覆盖后云端以你的本地正文为准,他人已发布的改动不会进入正文(仍可在提交历史中查看)。",conflictForceConfirm:"将用本地正文覆盖云端,丢弃他人已发布的正文变更。此操作不可自动撤销。继续?",conflictForceBusy:"覆盖中…",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:"工作空间",myDocumentsColCreator:"创建者",myDocumentsColUpdated:"更新时间",myDocumentsColCreated:"创建时间",myDocumentsFilterDomain:"按工作空间筛选",myDocumentsFilterAllDomains:"全部工作空间",myDocumentsFilterCreator:"按创建者筛选",myDocumentsFilterAllCreators:"全部创建者",myDocumentsGroupBy:"分组",myDocumentsGroupNone:"不分组",myDocumentsGroupDomain:"按工作空间分组",myDocumentsGroupCreator:"按创建者分组",myDocumentsNoMatch:"暂无匹配的文章",myDocumentsPrev:"上一页",myDocumentsNext:"下一页",myDocumentsJumpTo:"跳至",myDocumentsJump:"跳转",myDocumentsPageInfo:"第 {{current}}/{{total}} 页,共 {{count}} 篇",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:"退出登录"},Si="mdocs.lang",Us={en:zs,zh:$s};function Bs(){const e=window.localStorage.getItem(Si);return e==="zh"||e==="en"?e:navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}const Di=x.createContext(null);function Hs({children:e}){const[n,r]=x.useState(Bs);x.useEffect(()=>{document.documentElement.lang=n==="zh"?"zh-CN":"en"},[n]);const o=x.useCallback(a=>{window.localStorage.setItem(Si,a),r(a)},[]),i=x.useCallback((a,s)=>{let l=Us[n][a]??a;if(s)for(const[u,d]of Object.entries(s))l=l.replaceAll(`{{${u}}}`,d);return l},[n]);return c.jsx(Di.Provider,{value:{lang:n,setLang:o,t:i},children:e})}function it(){const e=x.useContext(Di);if(!e)throw new Error("useI18n must be used within I18nProvider");return e}function on(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 ko=new Map;function nr(e){let n=ko.get(e);return n||(n=Vs(),ko.set(e,n)),n}const Qe={PRIVATE:0,DOMAIN_READ:1,DOMAIN_WRITE:2,PUBLIC_READ:3,PUBLIC_WRITE:4};function Io(e){return e===Qe.PUBLIC_WRITE}function Lf(e){return e==="public"?[Qe.PUBLIC_READ,Qe.PUBLIC_WRITE]:e==="restricted"?[Qe.DOMAIN_READ,Qe.DOMAIN_WRITE]:[Qe.PRIVATE,Qe.DOMAIN_READ,Qe.DOMAIN_WRITE,Qe.PUBLIC_READ,Qe.PUBLIC_WRITE]}const Co="___desc___.md";function Gs(e){const n=e.trim();return n?`${n}/${Co}`:Co}class xt extends Error{constructor(n){super(n),this.name="DocPathError"}}const Ws=120,qs=200;function _r(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 Ks(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>Ws?{ok:!1,message:"folder name is too long"}:{ok:!0,display:n}:{ok:!1,message:"enter a folder name"}}function So(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>qs?{ok:!1,message:"file name is too long"}:{ok:!0,displayFile:n}}function Do(e){const n=e.trim().replace(/\\/g,"/");if(!n)throw new xt("relative path is required");if(n.startsWith("/"))throw new xt("path must be relative");if(n.includes(".."))throw new xt("path must not contain ..");const r=n.split("/").filter(h=>h.length>0);if(r.length===0)throw new xt("relative path is required");const o=[];for(let h=0;h<r.length-1;h+=1){const m=_r(r[h]);if(!m)throw new xt("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 xt("document path must end with .md or .html");const l=i.slice(0,-s.length),u=i.slice(-s.length),d=_r(l);if(!d)throw new xt("invalid file name");return o.push(d+u),o.join("/")}class Ke extends Error{constructor(r,o,i,a){super(i);qt(this,"code");qt(this,"status");qt(this,"details");this.status=r,this.code=o,this.details=a}}const Ys={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:`// 伪代码:表达「内容即文档」
136
+ `,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}}」",copyDocumentId:"复制 documentId",copyDocumentUrl:"复制 URL",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:"改类型",domainPermissionNoDowngrade:"不能把权限改得更封闭。",domainPermissionAlreadyTop:"已经是最开放的权限。",domainNotModifiable:"系统预设,不可修改",domainTooltipTypeLocked:"已有文档时只能把权限改得更开放,不能收回。",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:"解决冲突",conflictForce:"强制覆盖",conflictForceHint:"仅文档所有者可用。覆盖后云端以你的本地正文为准,他人已发布的改动不会进入正文(仍可在提交历史中查看)。",conflictForceConfirm:"将用本地正文覆盖云端,丢弃他人已发布的正文变更。此操作不可自动撤销。继续?",conflictForceBusy:"覆盖中…",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:"工作空间",myDocumentsColCreator:"创建者",myDocumentsColUpdated:"更新时间",myDocumentsColCreated:"创建时间",myDocumentsFilterDomain:"按工作空间筛选",myDocumentsFilterAllDomains:"全部工作空间",myDocumentsFilterCreator:"按创建者筛选",myDocumentsFilterAllCreators:"全部创建者",myDocumentsGroupBy:"分组",myDocumentsGroupNone:"不分组",myDocumentsGroupDomain:"按工作空间分组",myDocumentsGroupCreator:"按创建者分组",myDocumentsNoMatch:"暂无匹配的文章",myDocumentsPrev:"上一页",myDocumentsNext:"下一页",myDocumentsJumpTo:"跳至",myDocumentsJump:"跳转",myDocumentsPageInfo:"第 {{current}}/{{total}} 页,共 {{count}} 篇",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:"重置位置",docSearch:"搜索文档",docSearchTitle:"搜索当前工作空间",docSearchPlaceholder:"搜索标题或正文…",docSearchEmptyHint:"输入关键词搜索当前工作空间",docSearchNoResults:"没有匹配的文档",docSearchNoDomain:"请先选择工作空间",docSearchFailed:"搜索失败",logout:"退出登录"},Ni="mdocs.lang",Gs={en:Hs,zh:Vs};function Ws(){const e=window.localStorage.getItem(Ni);return e==="zh"||e==="en"?e:navigator.language.toLowerCase().startsWith("zh")?"zh":"en"}const Pi=x.createContext(null);function qs({children:e}){const[n,r]=x.useState(Ws);x.useEffect(()=>{document.documentElement.lang=n==="zh"?"zh-CN":"en"},[n]);const o=x.useCallback(a=>{window.localStorage.setItem(Ni,a),r(a)},[]),i=x.useCallback((a,s)=>{let l=Gs[n][a]??a;if(s)for(const[u,d]of Object.entries(s))l=l.replaceAll(`{{${u}}}`,d);return l},[n]);return c.jsx(Pi.Provider,{value:{lang:n,setLang:o,t:i},children:e})}function Ye(){const e=x.useContext(Pi);if(!e)throw new Error("useI18n must be used within I18nProvider");return e}function on(e){const{content:n,contentHash:r,...o}=e;return o}function Ks(){let e=Promise.resolve();return{execute:r=>{const o=e.then(r);return e=o.then(()=>{},()=>{}),o}}}const Io=new Map;function rr(e){let n=Io.get(e);return n||(n=Ks(),Io.set(e,n)),n}const tt={PRIVATE:0,DOMAIN_READ:1,DOMAIN_WRITE:2,PUBLIC_READ:3,PUBLIC_WRITE:4};function Co(e){return e===tt.PUBLIC_WRITE}function Wf(e){return e==="public"?[tt.PUBLIC_READ,tt.PUBLIC_WRITE]:e==="restricted"?[tt.DOMAIN_READ,tt.DOMAIN_WRITE]:[tt.PRIVATE,tt.DOMAIN_READ,tt.DOMAIN_WRITE,tt.PUBLIC_READ,tt.PUBLIC_WRITE]}const So="___desc___.md";function Ys(e){const n=e.trim();return n?`${n}/${So}`:So}class kt extends Error{constructor(n){super(n),this.name="DocPathError"}}const Js=120,Xs=200;function kr(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 Zs(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>Js?{ok:!1,message:"folder name is too long"}:{ok:!0,display:n}:{ok:!1,message:"enter a folder name"}}function Do(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>Xs?{ok:!1,message:"file name is too long"}:{ok:!0,displayFile:n}}function No(e){const n=e.trim().replace(/\\/g,"/");if(!n)throw new kt("relative path is required");if(n.startsWith("/"))throw new kt("path must be relative");if(n.includes(".."))throw new kt("path must not contain ..");const r=n.split("/").filter(h=>h.length>0);if(r.length===0)throw new kt("relative path is required");const o=[];for(let h=0;h<r.length-1;h+=1){const m=kr(r[h]);if(!m)throw new kt("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 kt("document path must end with .md or .html");const l=i.slice(0,-s.length),u=i.slice(-s.length),d=kr(l);if(!d)throw new kt("invalid file name");return o.push(d+u),o.join("/")}class Ke extends Error{constructor(r,o,i,a){super(i);qt(this,"code");qt(this,"status");qt(this,"details");this.status=r,this.code=o,this.details=a}}const Qs={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:`// 伪代码:表达「内容即文档」
132
137
  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
133
138
  A[写 Markdown] --> B[整理知识库]
134
- 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="&quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, 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="&quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, 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"},Js={root:Ys},Po=JSON.stringify(Js),et="demo-visitor-001",zf={visitorId:et,visitorName:"Demo User",createdAt:new Date().toISOString(),lastSeenAt:new Date().toISOString(),disabledAt:null,mergedIntoVisitorId:null};function Pn(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 No=`# Markdown 语法指南
139
+ 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="&quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, 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="&quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, 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"},el={root:Qs},Po=JSON.stringify(el),nt="demo-visitor-001",qf={visitorId:nt,visitorName:"Demo User",createdAt:new Date().toISOString(),lastSeenAt:new Date().toISOString(),disabledAt:null,mergedIntoVisitorId:null};function Nn(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 To=`# Markdown 语法指南
135
140
 
136
141
  ## 基础格式
137
142
 
@@ -183,7 +188,7 @@ function hello(name: string): string {
183
188
  $$
184
189
  \\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi}
185
190
  $$
186
- `,To=`# 图表支持示例
191
+ `,Ao=`# 图表支持示例
187
192
 
188
193
  mdocs 集成了多种图表类型。
189
194
 
@@ -224,7 +229,7 @@ gantt
224
229
  前端开发 :active, dev1, 2024-01-09, 10d
225
230
  后端开发 : dev2, 2024-01-09, 10d
226
231
  \`\`\`
227
- `,Ao=`# 个人笔记
232
+ `,jo=`# 个人笔记
228
233
 
229
234
  这是我的私人域中的笔记,只有我能看到。
230
235
 
@@ -241,13 +246,13 @@ Demo 模式的核心设计:
241
246
  2. 数据存储在 IndexedDB
242
247
  3. 用户无感知切换
243
248
 
244
- `,$f=[{documentId:"doc-welcome",relativePath:"README.md",displayName:"README",content:Po,contentHash:Pn(Po),permission:1,ownerVisitorId:et,domainId:"default",updatedBy:et,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-markdown-guide",relativePath:"指南/Markdown 语法.md",displayName:"Markdown 语法",content:No,contentHash:Pn(No),permission:1,ownerVisitorId:et,domainId:"default",updatedBy:et,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-diagram-guide",relativePath:"指南/图表支持.md",displayName:"图表支持",content:To,contentHash:Pn(To),permission:1,ownerVisitorId:et,domainId:"default",updatedBy:et,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-personal-note",relativePath:"个人笔记.md",displayName:"个人笔记",content:Ao,contentHash:Pn(Ao),permission:0,ownerVisitorId:et,domainId:et,updatedBy:et,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null}];const zr="mdocs.visitorId",kr="mdocs-api-error";function Xs(e){typeof window>"u"||window.dispatchEvent(new CustomEvent(kr,{detail:{status:e.status,code:e.code,message:e.message}}))}function Pi(){return!1}function Uf(){return window.localStorage.getItem(zr)}function On(e){window.localStorage.setItem(zr,e)}function Zs(){window.localStorage.removeItem(zr)}async function V(e,n={}){try{Pi();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 Ke(o.status,"BAD_RESPONSE","response is not valid JSON")}if(!o.ok){const s=a==null?void 0:a.error;throw new Ke(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 Ke&&!n.silent&&Xs(r),r}}const Rn="default",Bf=["public","restricted","private"];function Hf(e){return e===Rn}function Vf(e,n){return n!==null&&e.creatorVisitorId===n}function Gf(e){return e.docCount>0}function Qs(e,n){return V("/api/visitors/register",{method:"POST",body:JSON.stringify({visitorName:e,password:n})})}function el(e){return V("/api/visitors/recover",{method:"POST",body:JSON.stringify({recoveryCode:e})})}function tl(e,n){return V("/api/visitors/login",{method:"POST",body:JSON.stringify({visitorName:e,password:n})})}function Wf(e){return V("/api/visitors/set-password",{method:"POST",body:JSON.stringify({password:e})})}function qf(){return V("/api/visitors/recovery-code",{method:"POST"})}async function jo(){return(await V("/api/visitors/me")).visitor}function Kf(){return V("/api/visitors").then(e=>e.visitors)}function nl(){return V("/api/domains")}function Yf(e){return V("/api/domains",{method:"POST",body:JSON.stringify(e)})}function Jf(e,n){return V(`/api/domains/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({domainName:n})})}function Xf(e,n){return V(`/api/domains/${encodeURIComponent(e)}/permission`,{method:"PUT",body:JSON.stringify({permission:n})})}function Zf(e){return V(`/api/domains/${encodeURIComponent(e)}`,{method:"DELETE"})}function Qf(e){return V(`/api/domains/${encodeURIComponent(e)}/members`).then(n=>n.members)}function em(e,n){return V(`/api/domains/${encodeURIComponent(e)}/members`,{method:"PUT",body:JSON.stringify({visitorIds:n})})}function tm(){return V("/api/domain-member-templates")}function nm(e){return V("/api/domain-member-templates",{method:"POST",body:JSON.stringify(e)})}function rm(e,n){return V(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"PUT",body:JSON.stringify(n)})}function om(e){return V(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"DELETE"})}function rl(e){const n=e!=null&&e.trim()?`?domainId=${encodeURIComponent(e.trim())}`:"";return V(`/api/tree${n}`)}function Kt(e){return V(`/api/documents/${encodeURIComponent(e)}`)}function Ir(e){return V("/api/documents",{method:"POST",body:JSON.stringify(e)})}function rr(e,n){return V(`/api/documents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(n)})}function ol(e,n){const r=n?`?localBaseCommitId=${encodeURIComponent(n)}`:"";return V(`/api/documents/${encodeURIComponent(e)}/sync-status${r}`,{silent:!0})}function im(e,n,r){const o=new URLSearchParams({localBaseCommitId:n,remoteCommitId:r});return V(`/api/documents/${encodeURIComponent(e)}/merge-context?${o}`)}function or(e){return V("/api/documents/convert",{method:"POST",body:JSON.stringify(e)})}function il(e){return V(`/api/documents/${encodeURIComponent(e)}`,{method:"DELETE"})}function al(e,n){return V(`/api/documents/${encodeURIComponent(e)}/move`,{method:"POST",body:JSON.stringify({parentId:n})})}function am(e){return V(`/api/documents/${encodeURIComponent(e)}/invites`)}function sm(e,n,r){return V(`/api/documents/${encodeURIComponent(e)}/invites`,{method:"POST",body:JSON.stringify({targetVisitorId:n,targetPermission:r})})}function lm(e,n){return V(`/api/documents/${encodeURIComponent(e)}/invites/${encodeURIComponent(n)}`,{method:"DELETE"})}async function cm(e,n){var d;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 Ke(i.status,(h==null?void 0:h.code)??"UPLOAD_FAILED",(h==null?void 0:h.message)??s.msg??"upload failed")}const l=((d=s.data)==null?void 0:d.succMap)??{},u=Object.values(l);if(u.length===0)throw new Error("upload succeeded but no URL returned");return u[0]}function sl(e){return V("/api/folders",{method:"POST",body:JSON.stringify(e)})}function ll(e){return V(`/api/documents/folder/${encodeURIComponent(e)}`,{method:"DELETE"})}function dm(e){return V("/api/cli/tokens",{method:"POST",body:JSON.stringify({})})}function um(){return V("/api/cli/tokens")}function cl(){return V("/api/bookmarks")}function fm(e){return V(`/api/bookmarks/${encodeURIComponent(e)}`)}function mm(e){return V(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"POST"})}function dl(e){return V(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"DELETE"})}function hm(e={}){const n=new URLSearchParams({offset:String(e.offset??0),limit:String(e.limit??20)});return e.domainId&&n.set("domainId",e.domainId),e.creatorVisitorId&&n.set("creatorVisitorId",e.creatorVisitorId),e.groupBy&&n.set("groupBy",e.groupBy),V(`/api/visitors/me/documents?${n}`)}function ul(e){return V(`/api/documents/${encodeURIComponent(e)}/comments`)}function fl(e,n){return V(`/api/documents/${encodeURIComponent(e)}/comments`,{method:"POST",body:JSON.stringify(n)})}function ml(e,n){return V(`/api/documents/${encodeURIComponent(e)}/comments/${encodeURIComponent(n)}`,{method:"DELETE"})}function pm(){return V("/api/agent/configs")}function Mo(e){return V("/api/agent/config",{method:"PUT",body:JSON.stringify(e)})}function gm(e){return V(`/api/agent/config/${encodeURIComponent(e)}/default`,{method:"POST"})}function ym(e){return V(`/api/agent/config/${encodeURIComponent(e)}`,{method:"DELETE"})}function vm(){return V("/api/agent/skills")}function bm(e){return V("/api/agent/skills",{method:"POST",body:JSON.stringify(e)})}function xm(e,n){return V(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)})}function wm(e){return V(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function _m(){return V("/api/agent/status")}function km(){return V("/api/agent/context-usage")}function Im(e="normal",n){const r=new URLSearchParams;e==="coding"&&(r.set("mode","coding"),n&&r.set("documentId",n));const o=r.toString();return V(`/api/agent/session${o?`?${o}`:""}`)}function Cm(e="normal",n){const r=new URLSearchParams;e==="coding"&&(r.set("mode","coding"),n&&r.set("documentId",n));const o=r.toString();return V(`/api/agent/sessions${o?`?${o}`:""}`)}function Sm(e="normal",n){return V("/api/agent/sessions",{method:"POST",body:JSON.stringify({mode:e,...e==="coding"?{documentId:n??null}:{}})})}function Dm(e,n="normal",r){return V("/api/agent/session/open",{method:"POST",body:JSON.stringify({sessionId:e,mode:n,...n==="coding"?{documentId:r??null}:{}})})}function Pm(e,n){return V("/api/agent/session/bind-document",{method:"POST",body:JSON.stringify({sessionId:e,documentId:n})})}function Nm(e,n){return V("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,choice:n})})}function Tm(e){return V("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function Am(e){return V("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}function jm(e,n){return V("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,...n})})}function Mm(e){return V("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function Em(e){return V("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}async function Om(e,n){var d;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();(d=m.error)!=null&&d.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(`
245
- `);l=f.pop()??"";for(const p of f){const g=p.trim();if(!g.startsWith("data:"))continue;const w=g.slice(5).trim();if(!(!w||w==="[DONE]"))try{n.onEvent(JSON.parse(w))}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 Eo(e){return V(`/api/graph/${e}`,{method:"GET"})}function hl(e){return V(`/api/graph/${e}/analyze`,{method:"POST"})}function Oo(e){return V(`/api/graph/domain/${e}`,{method:"GET"})}function pl(e){return V(`/api/graph/domain/${e}/analyze`,{method:"POST"})}function gl(e){return V(`/api/graph/tasks/${encodeURIComponent(e)}`,{method:"GET"})}const yl={domainId:Rn,domainName:"Default",permission:"public",creatorVisitorId:"",docCount:0};async function Ni(){try{return await nl()}catch{return[yl]}}function vl(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===Rn))==null?void 0:o.domainId)??((i=e[0])==null?void 0:i.domainId)??Rn}function bl(e){const{t:n}=it(),[r,o]=x.useState(!1),[i,a]=x.useState(null),[s,l]=x.useState("login"),[u,d]=x.useState(""),[h,m]=x.useState(""),[f,p]=x.useState("password"),[g,w]=x.useState(""),[b,v]=x.useState(""),[I,D]=x.useState("");function P(R){if(R.preventDefault(),!u.trim()){a(n("nameRequired"));return}a(null),l("register-password")}async function _(R){R.preventDefault(),o(!0),a(null);try{const U=h.trim();await e.onSubmit(u.trim(),U||void 0),d(""),m(""),l("login"),p("password"),w(u.trim()),v(U||"")}catch(U){a(U instanceof Error?U.message:String(U)),l("register")}finally{o(!1)}}async function N(R){R.preventDefault();const U=g.trim(),H=b.trim();if(!U||!H){a("请输入用户名和密码");return}o(!0),a(null);try{const Y=await tl(U,H);On(Y.visitor.visitorId),await e.onRecover(Y.visitor.visitorId)}catch(Y){a(Y instanceof Error?Y.message:String(Y))}finally{o(!1)}}async function S(R){R.preventDefault();const U=I.trim();if(!U){a("请输入恢复码");return}o(!0),a(null);try{const H=await el(U);On(H.visitor.visitorId),await e.onRecover(H.visitor.visitorId)}catch(H){a(H instanceof Error?H.message:String(H))}finally{o(!1)}}const T=i??e.error;function $(){a(null),d(""),m(""),l("register")}function E(){a(null),l("login")}return c.jsx("div",{className:"mdocs-dialog-backdrop",children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:420},children:[s==="login"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",gap:16,marginBottom:16,fontSize:"0.875rem"},children:[c.jsx("button",{type:"button",onClick:()=>{a(null),p("password")},style:{background:"none",border:"none",color:f==="password"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:f==="password"?"2px solid var(--mdocs-accent)":"none",fontWeight:f==="password"?600:400},children:"用户名+密码"}),c.jsx("button",{type:"button",onClick:()=>{a(null),p("recovery")},style:{background:"none",border:"none",color:f==="recovery"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:f==="recovery"?"2px solid var(--mdocs-accent)":"none",fontWeight:f==="recovery"?600:400},children:"恢复码"})]}),f==="password"?c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:"🔑 使用密码登录"}),c.jsx("p",{children:"输入用户名和密码,在其他设备上找回你的身份。"}),c.jsxs("form",{onSubmit:N,children:[c.jsx("input",{autoFocus:!0,placeholder:"用户名",value:g,onChange:R=>w(R.target.value),maxLength:60,style:{marginBottom:8}}),c.jsx("input",{type:"password",placeholder:"密码",value:b,onChange:R=>v(R.target.value)}),T&&c.jsx("div",{className:"mdocs-dialog-error",children:T}),c.jsx("button",{type:"submit",className:"primary",disabled:r,children:r?"验证中…":"登录"})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:"🔑 使用恢复码找回"}),c.jsx("p",{children:"输入注册时保存的恢复码,系统将为您生成新的身份令牌。"}),c.jsxs("form",{onSubmit:S,children:[c.jsx("input",{autoFocus:!0,placeholder:"ABCD-EFGH-IJKL-MNOP",value:I,onChange:R=>D(R.target.value),style:{fontFamily:"monospace",letterSpacing:"0.1em"},maxLength:30}),T&&c.jsx("div",{className:"mdocs-dialog-error",children:T}),c.jsx("button",{type:"submit",className:"primary",disabled:r,children:r?"验证中…":"找回身份"})]})]}),c.jsx("p",{style:{marginTop:16,textAlign:"center"},children:c.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:$,children:"没有账号?点击注册"})})]}),s==="register"&&c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:n("welcomeTitle")}),c.jsx("p",{children:n("welcomeDesc")}),c.jsxs("form",{onSubmit:P,children:[c.jsx("input",{autoFocus:!0,placeholder:n("visitorNamePlaceholder"),value:u,onChange:R=>d(R.target.value),maxLength:60}),T&&c.jsx("div",{className:"mdocs-dialog-error",children:T}),c.jsx("button",{type:"submit",className:"primary",disabled:r,children:"下一步"})]}),c.jsx("p",{style:{marginTop:16,textAlign:"center"},children:c.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:E,children:"已有账号?点击登录"})})]}),s==="register-password"&&c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:"设置密码(可选)"}),c.jsx("p",{style:{marginBottom:8},children:"设置密码后,你可以在其他浏览器或设备上使用「用户名+密码」登录。"}),c.jsx("p",{style:{color:"var(--mdocs-text-secondary)",fontSize:"0.875rem",marginBottom:16},children:"留空不设置密码也能正常使用,但只能在当前浏览器操作。"}),c.jsxs("form",{onSubmit:_,children:[c.jsx("input",{autoFocus:!0,type:"password",placeholder:"设置密码(至少 4 位)",value:h,onChange:R=>m(R.target.value),minLength:4}),T&&c.jsx("div",{className:"mdocs-dialog-error",children:T}),c.jsx("button",{type:"submit",className:"primary",disabled:r,style:{marginTop:8},children:r?n("creating"):"完成注册"})]}),c.jsx("p",{style:{marginTop:16,textAlign:"center"},children:c.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-text-secondary)",cursor:"pointer",fontSize:"0.875rem",padding:0},onClick:()=>l("register"),children:"← 返回上一步"})})]})]})})}function xl(e){const{t:n}=it();return c.jsxs("div",{className:"mdocs-notice card",children:[c.jsx("span",{children:n("visitorIdNotice",{id:e.visitorId})}),c.jsx("button",{type:"button",onClick:e.onDismiss,children:n("gotIt")})]})}const Ti="application/x-mdocs-document-id",Cr="mdocs-doc:";let Mt=null;function Ai(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=Ai(o.children,n,[...r,o.documentId]);if(i)return i}return null}function $r(e){if(Mt)return Mt;try{const n=e.getData(Ti);if(n)return n;const r=e.getData("text/plain")||e.getData("Text");if(r.startsWith(Cr))return r.slice(Cr.length)}catch{}return""}function _t(e){return!!(e&&Mt)}function wl(e){const{t:n}=it(),r=x.useRef(null),[o,i]=x.useState(null),[a,s]=x.useState(null),l=x.useMemo(()=>{var v,I;const b=((v=e.graphFocusAnchorId)==null?void 0:v.trim())||((I=e.activeDocumentId)==null?void 0:I.trim());return b?Ai(e.nodes,b):null},[e.nodes,e.activeDocumentId,e.graphFocusAnchorId]),u=x.useMemo(()=>new Set((l==null?void 0:l.forceOpenFolderIds)??[]),[l]);x.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 d(){i(null)}function h(){Mt=null,s(null),d()}function m(b){Mt=b,s(b),d()}function f(b){if(!_t(e.onMoveDocument))return;b.preventDefault(),b.dataTransfer.dropEffect="move",b.target.closest(".mdocs-tree-row")||i({kind:"root"})}function p(b){const v=b.relatedTarget;v&&b.currentTarget.contains(v)||i(I=>(I==null?void 0:I.kind)==="root"?null:I)}function g(b){if(!e.onMoveDocument||!_t(e.onMoveDocument))return;b.preventDefault(),b.stopPropagation();const I=b.target.closest(".mdocs-tree-row"),D=$r(b.dataTransfer);h(),!I&&D&&e.onMoveDocument(D,null)}const w="mdocs-sidebar-list"+((o==null?void 0:o.kind)==="root"?" mdocs-tree-drop-root":"");return e.nodes.length===0?c.jsx("div",{ref:r,className:w,onDragOver:f,onDragLeave:p,onDrop:g,children:c.jsx("div",{className:"muted",style:{padding:"8px 10px",fontSize:12},children:n("noDocumentsYet")})}):c.jsx("div",{ref:r,className:w,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:p,onDrop:g,children:e.nodes.map(b=>c.jsx(ji,{node:b,depth:0,parentPath:"",parentFolderId:null,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId??null,selectedParentPath:e.selectedParentPath,forceOpenFolderIds:u,dropHighlight:o,setDropHighlight:i,clearDropHighlight:d,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 ji(e){const n={paddingLeft:8+e.depth*16};return e.node.type==="folder"?c.jsx(Il,{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}):c.jsx(_l,{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 _l(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]=x.useState(!1),u=((m=e.dropHighlight)==null?void 0:m.kind)==="doc"&&e.dropHighlight.id===n.documentId,[d,h]=x.useState(!1);return c.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(Ti,n.documentId),f.dataTransfer.setData("text/plain",Cr+n.documentId),f.dataTransfer.effectAllowed="move")},onDragEnd:()=>{e.endDragSession(),queueMicrotask(()=>h(!1))},onDragEnter:f=>{!_t(e.onMoveDocument)||Mt===n.documentId||(f.preventDefault(),f.stopPropagation(),e.setDropHighlight({kind:"doc",id:n.documentId}))},onDragOver:f=>{!_t(e.onMoveDocument)||Mt===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 p=$r(f.dataTransfer),g=e.parentFolderId;e.endDragSession(),!(!p||p===n.documentId)&&e.onMoveDocument(p,g)},onClick:()=>{d||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:[c.jsx("span",{className:"mdocs-tree-caret-spacer","aria-hidden":!0}),c.jsx("span",{className:`mdocs-tree-icon${n.fileType==="html"?" mdocs-tree-icon-html":""}`,children:n.fileType==="html"?c.jsx("span",{className:"mdocs-tree-html-bracket",children:"</>"}):"md"}),c.jsx("span",{className:"mdocs-tree-label",title:n.displayName||n.name,children:n.displayName||n.name}),(e.onOpenGraph||e.onGenerateGraph)&&c.jsxs("span",{className:"mdocs-tree-hover-actions",onClick:f=>f.stopPropagation(),children:[e.onOpenGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"查看图谱",onClick:f=>{var p;f.stopPropagation(),(p=e.onOpenGraph)==null||p.call(e,e.doc,e.parentFolderId??void 0)},children:c.jsx(Lr,{size:14,strokeWidth:1.75})}),e.onGenerateGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"生成图谱",onClick:f=>{var p;f.stopPropagation(),(p=e.onGenerateGraph)==null||p.call(e,e.doc,e.parentFolderId??void 0)},children:c.jsx(Ci,{size:14,strokeWidth:1.75})})]})]})}function kl(){return c.jsx("span",{className:"mdocs-tree-icon mdocs-tree-icon-dir","aria-hidden":!0,children:c.jsx(Is,{size:16})})}function Il(e){var m,f,p;const{t:n}=it(),r=e.forceOpenFolderIds.has(e.folder.documentId),[o,i]=x.useState(e.depth<1||r),a=o;x.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,d=((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 c.jsxs("div",{children:[c.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":"")+(d?" mdocs-tree-drop-target":""),"data-tree-id":e.folder.documentId,style:e.indent,onClick:h,onContextMenu:g=>{g.preventDefault(),g.stopPropagation(),e.onContextMenu({x:g.clientX,y:g.clientY,node:e.folder,parentPath:e.folder.path})},onDragEnter:g=>{_t(e.onMoveDocument)&&(g.preventDefault(),g.stopPropagation(),e.setDropHighlight({kind:"folder",id:e.folder.documentId}),i(!0))},onDragOver:g=>{_t(e.onMoveDocument)&&(g.preventDefault(),g.stopPropagation(),g.dataTransfer.dropEffect="move",e.setDropHighlight({kind:"folder",id:e.folder.documentId}))},onDrop:g=>{if(!e.onMoveDocument||!_t(e.onMoveDocument))return;g.preventDefault(),g.stopPropagation();const w=$r(g.dataTransfer),b=e.folder.documentId;e.endDragSession(),w&&e.onMoveDocument(w,b)},children:[c.jsx("span",{className:"mdocs-tree-caret",role:"button",tabIndex:0,"aria-expanded":a,"aria-label":n(a?"collapseFolder":"expandFolder"),onClick:g=>{g.stopPropagation(),i(w=>!w)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),i(w=>!w))},children:a?"▾":"▸"}),c.jsx(kl,{}),c.jsx("span",{className:"mdocs-tree-folder-select",children:c.jsx("span",{className:"mdocs-tree-label",title:((f=e.folder.folderDisplayName)==null?void 0:f.trim())||e.folder.name,children:((p=e.folder.folderDisplayName)==null?void 0:p.trim())||e.folder.name})}),(e.onOpenGraph||e.onGenerateGraph)&&c.jsxs("span",{className:"mdocs-tree-hover-actions",onClick:g=>g.stopPropagation(),children:[e.onOpenGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"查看图谱",onClick:g=>{var w;g.stopPropagation(),(w=e.onOpenGraph)==null||w.call(e,e.folder)},children:c.jsx(Lr,{size:14,strokeWidth:1.75})}),e.onGenerateGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"生成图谱",onClick:g=>{var w;g.stopPropagation(),(w=e.onGenerateGraph)==null||w.call(e,e.folder)},children:c.jsx(Ci,{size:14,strokeWidth:1.75})})]})]}),a&&e.folder.children.map(g=>c.jsx(ji,{node:g,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},g.path))]})}function Cl(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function Sl(e,n,r){return n=El(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Ro(e,n){return Nl(e)||Cl(e,n)||Mi(e,n)||jl()}function Dl(e){return Pl(e)||Tl(e)||Mi(e)||Al()}function Pl(e){if(Array.isArray(e))return Sr(e)}function Nl(e){if(Array.isArray(e))return e}function Tl(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Mi(e,n){if(e){if(typeof e=="string")return Sr(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 Sr(e,n)}}function Sr(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 Al(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
246
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
247
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ml(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 El(e){var n=Ml(e,"string");return typeof n=="symbol"?n:String(n)}var Ol=function(n,r){var o=new Set(r);return Object.assign.apply(Object,[{}].concat(Dl(Object.entries(n).filter(function(i){var a=Ro(i,1),s=a[0];return!o.has(s)}).map(function(i){var a=Ro(i,2),s=a[0],l=a[1];return Sl({},s,l)}))))};function Rl(e,{wrapperElementType:n="div",nodeMapper:r=a=>a,methodNames:o=[],initPropNames:i=[]}={}){return x.forwardRef((a,s)=>{const l=x.useRef(),u=x.useMemo(()=>{const m=Object.fromEntries(i.filter(f=>a.hasOwnProperty(f)).map(f=>[f,a[f]]));return e(m)},[]);Fo(()=>{u(r(l.current))},x.useLayoutEffect),Fo(()=>u._destructor instanceof Function?u._destructor:void 0);const d=x.useCallback((m,...f)=>u[m]instanceof Function?u[m](...f):void 0,[u]),h=x.useRef({});return Object.keys(Ol(a,[...o,...i])).filter(m=>h.current[m]!==a[m]).forEach(m=>d(m,a[m])),h.current=a,x.useImperativeHandle(s,()=>Object.fromEntries(o.map(m=>[m,(...f)=>d(m,...f)])),[d]),ki.createElement(n,{ref:l})})}function Fo(e,n=x.useEffect){const r=x.useRef(),o=x.useRef(!1),i=x.useRef(!1),[a,s]=x.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 jt=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-jt.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?jt.Bounce.In(e*2)*.5:jt.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}}}}),un=function(){return performance.now()},Ei=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=un()),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}(),Dr={Linear:function(e,n){var r=e.length-1,o=r*n,i=Math.floor(o),a=Dr.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}}},Oi=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Pr=new Ei,Lo=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=jt.Linear.None,this._interpolationFunction=Dr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Oi.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=Pr,Pr.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=un()),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),d=u?"array":typeof l,h=!u&&Array.isArray(o[s]);if(!(d==="undefined"||d==="function")){if(h){var m=o[s];if(m.length===0)continue;for(var f=[l],p=0,g=m.length;p<g;p+=1){var w=this._handleRelativeValue(l,m[p]);if(isNaN(w)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(w)}h&&(o[s]=f)}if((d==="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=un()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this)},e.prototype.resume=function(n){return n===void 0&&(n=un()),!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=jt.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=Dr.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=un()),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,d=function(){if(o._duration===0||s>u)return 1;var w=Math.trunc(s/l),b=s-w*l,v=Math.min(b/o._duration,1);return v===0&&s===o._duration?1:v},h=d(),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 p=0,g=this._chainedTweens.length;p<g;p++)this._chainedTweens[p].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]),d=Array.isArray(l),h=!u&&d;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}();Oi.nextId;var ot=Pr;ot.getAll.bind(ot);ot.removeAll.bind(ot);ot.add.bind(ot);ot.remove.bind(ot);ot.update.bind(ot);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 Fl(e){if(Array.isArray(e))return e}function Ll(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function zl(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function $l(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function Ul(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
248
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bl(e,n){return Fl(e)||$l(e,n)||Hl(e,n)||Ul()}function Hl(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 Vl=zl(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(d,h){}:l;Ll(this,e),this.name=n,this.defaultVal=i,this.triggerUpdate=s,this.onChange=u});function Ur(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,d=e.init,h=d===void 0?function(){}:d,m=e.update,f=m===void 0?function(){}:m,p=Object.keys(i).map(function(g){return new Vl(g,i[g])});return function g(){for(var w=arguments.length,b=new Array(w),v=0;v<w;v++)b[v]=arguments[v];var I=!!(this instanceof g&&this.constructor),D=I?b.shift():void 0,P=b[0],_=P===void 0?{}:P,N=Object.assign({},r instanceof Function?r(_):r,{initialised:!1}),S={};function T(R){return $(R,_),E(),T}var $=function(U,H){h.call(T,U,N,H),N.initialised=!0},E=Va(function(){N.initialised&&(f.call(T,N,S),S={})},1);return p.forEach(function(R){T[R.name]=U(R);function U(H){var Y=H.name,te=H.triggerUpdate,ne=te===void 0?!1:te,K=H.onChange,ve=K===void 0?function(oe,ae){}:K,Ce=H.defaultVal,M=Ce===void 0?null:Ce;return function(oe){var ae=N[Y];if(!arguments.length)return ae;var re=oe===void 0?M:oe;return N[Y]=re,ve.call(T,re,N,ae),!S.hasOwnProperty(Y)&&(S[Y]=ae),ne&&E(),T}}}),Object.keys(s).forEach(function(R){T[R]=function(){for(var U,H=arguments.length,Y=new Array(H),te=0;te<H;te++)Y[te]=arguments[te];return(U=s[R]).call.apply(U,[T,N].concat(Y))}}),Object.entries(u).forEach(function(R){var U=Bl(R,2),H=U[0],Y=U[1];return T[H]=T[Y]}),T.resetProps=function(){return p.forEach(function(R){T[R.name](R.defaultVal)}),T},T.resetProps(),N._rerender=E,I&&D&&T(D),T}}var ie=function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}};function Fn(e){"@babel/helpers - typeof";return Fn=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},Fn(e)}var Gl=/^\s+/,Wl=/\s+$/;function q(e,n){if(e=e||"",n=n||{},e instanceof q)return e;if(!(this instanceof q))return new q(e,n);var r=ql(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}q.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=Ri(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=Uo(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=Uo(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=$o(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=$o(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 Bo(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return Xl(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(fe(this._r,255)*100)+"%",g:Math.round(fe(this._g,255)*100)+"%",b:Math.round(fe(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(fe(this._r,255)*100)+"%, "+Math.round(fe(this._g,255)*100)+"%, "+Math.round(fe(this._b,255)*100)+"%)":"rgba("+Math.round(fe(this._r,255)*100)+"%, "+Math.round(fe(this._g,255)*100)+"%, "+Math.round(fe(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:cc[Bo(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+Ho(this._r,this._g,this._b,this._a),o=r,i=this._gradientType?"GradientType = 1, ":"";if(n){var a=q(n);o="#"+Ho(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 q(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(tc,arguments)},brighten:function(){return this._applyModification(nc,arguments)},darken:function(){return this._applyModification(rc,arguments)},desaturate:function(){return this._applyModification(Zl,arguments)},saturate:function(){return this._applyModification(Ql,arguments)},greyscale:function(){return this._applyModification(ec,arguments)},spin:function(){return this._applyModification(oc,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(sc,arguments)},complement:function(){return this._applyCombination(ic,arguments)},monochromatic:function(){return this._applyCombination(lc,arguments)},splitcomplement:function(){return this._applyCombination(ac,arguments)},triad:function(){return this._applyCombination(Vo,[3])},tetrad:function(){return this._applyCombination(Vo,[4])}};q.fromRatio=function(e,n){if(Fn(e)=="object"){var r={};for(var o in e)e.hasOwnProperty(o)&&(o==="a"?r[o]=e[o]:r[o]=fn(e[o]));e=r}return q(e,n)};function ql(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=mc(e)),Fn(e)=="object"&&(lt(e.r)&&lt(e.g)&&lt(e.b)?(n=Kl(e.r,e.g,e.b),s=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):lt(e.h)&&lt(e.s)&&lt(e.v)?(o=fn(e.s),i=fn(e.v),n=Jl(e.h,o,i),s=!0,l="hsv"):lt(e.h)&&lt(e.s)&&lt(e.l)&&(o=fn(e.s),a=fn(e.l),n=Yl(e.h,o,a),s=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=Ri(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 Kl(e,n,r){return{r:fe(e,255)*255,g:fe(n,255)*255,b:fe(r,255)*255}}function $o(e,n,r){e=fe(e,255),n=fe(n,255),r=fe(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 Yl(e,n,r){var o,i,a;e=fe(e,360),n=fe(n,100),r=fe(r,100);function s(d,h,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?d+(h-d)*6*m:m<1/2?h:m<2/3?d+(h-d)*(2/3-m)*6:d}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 Uo(e,n,r){e=fe(e,255),n=fe(n,255),r=fe(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 Jl(e,n,r){e=fe(e,360)*6,n=fe(n,100),r=fe(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,d=[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:d*255,g:h*255,b:m*255}}function Bo(e,n,r,o){var i=[qe(Math.round(e).toString(16)),qe(Math.round(n).toString(16)),qe(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 Xl(e,n,r,o,i){var a=[qe(Math.round(e).toString(16)),qe(Math.round(n).toString(16)),qe(Math.round(r).toString(16)),qe(Fi(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 Ho(e,n,r,o){var i=[qe(Fi(o)),qe(Math.round(e).toString(16)),qe(Math.round(n).toString(16)),qe(Math.round(r).toString(16))];return i.join("")}q.equals=function(e,n){return!e||!n?!1:q(e).toRgbString()==q(n).toRgbString()};q.random=function(){return q.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Zl(e,n){n=n===0?0:n||10;var r=q(e).toHsl();return r.s-=n/100,r.s=Vn(r.s),q(r)}function Ql(e,n){n=n===0?0:n||10;var r=q(e).toHsl();return r.s+=n/100,r.s=Vn(r.s),q(r)}function ec(e){return q(e).desaturate(100)}function tc(e,n){n=n===0?0:n||10;var r=q(e).toHsl();return r.l+=n/100,r.l=Vn(r.l),q(r)}function nc(e,n){n=n===0?0:n||10;var r=q(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)))),q(r)}function rc(e,n){n=n===0?0:n||10;var r=q(e).toHsl();return r.l-=n/100,r.l=Vn(r.l),q(r)}function oc(e,n){var r=q(e).toHsl(),o=(r.h+n)%360;return r.h=o<0?360+o:o,q(r)}function ic(e){var n=q(e).toHsl();return n.h=(n.h+180)%360,q(n)}function Vo(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=q(e).toHsl(),o=[q(e)],i=360/n,a=1;a<n;a++)o.push(q({h:(r.h+a*i)%360,s:r.s,l:r.l}));return o}function ac(e){var n=q(e).toHsl(),r=n.h;return[q(e),q({h:(r+72)%360,s:n.s,l:n.l}),q({h:(r+216)%360,s:n.s,l:n.l})]}function sc(e,n,r){n=n||6,r=r||30;var o=q(e).toHsl(),i=360/r,a=[q(e)];for(o.h=(o.h-(i*n>>1)+720)%360;--n;)o.h=(o.h+i)%360,a.push(q(o));return a}function lc(e,n){n=n||6;for(var r=q(e).toHsv(),o=r.h,i=r.s,a=r.v,s=[],l=1/n;n--;)s.push(q({h:o,s:i,v:a})),a=(a+l)%1;return s}q.mix=function(e,n,r){r=r===0?0:r||50;var o=q(e).toRgb(),i=q(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 q(s)};q.readability=function(e,n){var r=q(e),o=q(n);return(Math.max(r.getLuminance(),o.getLuminance())+.05)/(Math.min(r.getLuminance(),o.getLuminance())+.05)};q.isReadable=function(e,n,r){var o=q.readability(e,n),i,a;switch(a=!1,i=hc(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};q.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 d=0;d<n.length;d++)a=q.readability(e,n[d]),a>i&&(i=a,o=q(n[d]));return q.isReadable(e,o,{level:l,size:u})||!s?o:(r.includeFallbackColors=!1,q.mostReadable(e,["#fff","#000"],r))};var Nr=q.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"},cc=q.hexNames=dc(Nr);function dc(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function Ri(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function fe(e,n){uc(e)&&(e="100%");var r=fc(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 Vn(e){return Math.min(1,Math.max(0,e))}function Le(e){return parseInt(e,16)}function uc(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function fc(e){return typeof e=="string"&&e.indexOf("%")!=-1}function qe(e){return e.length==1?"0"+e:""+e}function fn(e){return e<=1&&(e=e*100+"%"),e}function Fi(e){return Math.round(parseFloat(e)*255).toString(16)}function Go(e){return Le(e)/255}var We=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 lt(e){return!!We.CSS_UNIT.exec(e)}function mc(e){e=e.replace(Gl,"").replace(Wl,"").toLowerCase();var n=!1;if(Nr[e])e=Nr[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=We.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=We.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=We.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=We.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=We.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=We.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=We.hex8.exec(e))?{r:Le(r[1]),g:Le(r[2]),b:Le(r[3]),a:Go(r[4]),format:n?"name":"hex8"}:(r=We.hex6.exec(e))?{r:Le(r[1]),g:Le(r[2]),b:Le(r[3]),format:n?"name":"hex"}:(r=We.hex4.exec(e))?{r:Le(r[1]+""+r[1]),g:Le(r[2]+""+r[2]),b:Le(r[3]+""+r[3]),a:Go(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=We.hex3.exec(e))?{r:Le(r[1]+""+r[1]),g:Le(r[2]+""+r[2]),b:Le(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function hc(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 Tr(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 pc(e){if(Array.isArray(e))return Tr(e)}function Li(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 gc(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function yc(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function $e(e,n){return e.get(Li(e,n))}function Wo(e,n,r){gc(e,n),n.set(e,r)}function qo(e,n,r){return e.set(Li(e,n),r),r}function vc(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,Ic(o.key),o)}}function bc(e,n,r){return n&&vc(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function xc(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wc(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
249
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _c(e){return pc(e)||xc(e)||Cc(e)||wc()}function kc(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 Ic(e){var n=kc(e,"string");return typeof n=="symbol"?n:n+""}function Cc(e,n){if(e){if(typeof e=="string")return Tr(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)?Tr(e,n):void 0}}var Sc=123,Dc=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},zi=function(n,r,o){return(n<<16)+(r<<8)+o},Pc=function(n){var r=q(n).toRgb(),o=r.r,i=r.g,a=r.b;return zi(o,i,a)},Ko=function(n,r){return n*Sc%Math.pow(2,r)},Tt=new WeakMap,ct=new WeakMap,Nc=function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;yc(this,e),Wo(this,Tt,void 0),Wo(this,ct,void 0),qo(ct,this,n),this.reset()}return bc(e,[{key:"reset",value:function(){qo(Tt,this,["__reserved for background__"])}},{key:"register",value:function(r){if($e(Tt,this).length>=Math.pow(2,24-$e(ct,this)))return null;var o=$e(Tt,this).length,i=Ko(o,$e(ct,this)),a=Dc(o+(i<<24-$e(ct,this)));return $e(Tt,this).push(r),a}},{key:"lookup",value:function(r){if(!r)return null;var o=typeof r=="string"?Pc(r):zi.apply(void 0,_c(r));if(!o)return null;var i=o&Math.pow(2,24-$e(ct,this))-1,a=o>>24-$e(ct,this)&Math.pow(2,$e(ct,this))-1;return Ko(i,$e(ct,this))!==a||i>=$e(Tt,this).length?null:$e(Tt,this)[i]}}])}(),bn,me,$i,Ui,wt,Yo,Bi,Hi,ir,jn,mn,Vi,Br,Ar,jr,Ln={},zn=[],Tc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Gn=Array.isArray;function nt(e,n){for(var r in n)e[r]=n[r];return e}function Hr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ac(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?bn.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 hn(e,s,o,i,null)}function hn(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??++$i,__i:-1,__u:0};return i==null&&me.vnode!=null&&me.vnode(a),a}function Wn(e){return e.children}function Mn(e,n){this.props=e,this.context=n}function Et(e,n){if(n==null)return e.__?Et(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"?Et(e):null}function jc(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],i=[],a=nt({},n);a.__v=n.__v+1,me.vnode&&me.vnode(a),Vr(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,r??Et(n),!!(32&n.__u),i),a.__v=n.__v,a.__.__k[a.__i]=a,Yi(o,a,i),n.__e=n.__=null,a.__e!=r&&Gi(a)}}function Gi(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}),Gi(e)}function Jo(e){(!e.__d&&(e.__d=!0)&&wt.push(e)&&!$n.__r++||Yo!=me.debounceRendering)&&((Yo=me.debounceRendering)||Bi)($n)}function $n(){try{for(var e,n=1;wt.length;)wt.length>n&&wt.sort(Hi),e=wt.shift(),n=wt.length,jc(e)}finally{wt.length=$n.__r=0}}function Wi(e,n,r,o,i,a,s,l,u,d,h){var m,f,p,g,w,b,v=o&&o.__k||zn,I=n.length;for(u=Mc(r,n,v,u,I),m=0;m<I;m++)(p=r.__k[m])!=null&&(f=p.__i!=-1&&v[p.__i]||Ln,p.__i=m,b=Vr(e,p,f,i,a,s,l,u,d,h),g=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Gr(f.ref,null,p),h.push(p.ref,p.__c||g,p)),w==null&&g!=null&&(w=g),4&p.__u?(u=qi(p,u,e),f.__e&&(f.__e=null)):typeof p.type=="function"&&b!==void 0?u=b:g&&(u=g.nextSibling),p.__u&=-7);return r.__e=w,u}function Mc(e,n,r,o,i){var a,s,l,u,d,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]=hn(null,s,null,null,null):Gn(s)?s=e.__k[a]=hn(Wn,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=hn(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,(d=s.__i=Ec(s,r,u,m))!=-1&&(m--,(l=r[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(i>h?f--:i<h&&f++),typeof s.type!="function"&&(s.__u|=4)):d!=u&&(d==u-1?f--:d==u+1?f++:(d>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=Et(l)),Xi(l,l));return o}function qi(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=qi(o[i],n,r));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=Et(e)),n=r.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function Ec(e,n,r,o){var i,a,s,l=e.key,u=e.type,d=n[r],h=d!=null&&(2&d.__u)==0;if(d===null&&l==null||h&&l==d.key&&u==d.type)return r;if(o>(h?1:0)){for(i=r-1,a=r+1;i>=0||a<n.length;)if((d=n[s=i>=0?i--:a++])!=null&&!(2&d.__u)&&l==d.key&&u==d.type)return s}return-1}function Xo(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||Tc.test(n)?r:r+"px"}function Nn(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||Xo(e.style,n,"");if(r)for(n in r)o&&r[n]==o[n]||Xo(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(Vi,"$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[mn]=o[mn]:(r[mn]=Br,e.addEventListener(n,a?jr:Ar,a)):e.removeEventListener(n,a?jr:Ar,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 Zo(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[jn]==null)n[jn]=Br++;else if(n[jn]<r[mn])return;return r(me.event?me.event(n):n)}}}function Vr(e,n,r,o,i,a,s,l,u,d){var h,m,f,p,g,w,b,v,I,D,P,_,N,S,T,$,E=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),a=[l=n.__e=r.__e]),(h=me.__b)&&h(n);e:if(typeof E=="function"){m=s.length;try{if(I=n.props,D=E.prototype&&E.prototype.render,P=(h=E.contextType)&&o[h.__c],_=h?P?P.props.value:h.__:o,r.__c?v=(f=n.__c=r.__c).__=f.__E:(D?n.__c=f=new E(I,_):(n.__c=f=new Mn(I,_),f.constructor=E,f.render=Rc),P&&P.sub(f),f.state||(f.state={}),f.__n=o,p=f.__d=!0,f.__h=[],f._sb=[]),D&&f.__s==null&&(f.__s=f.state),D&&E.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=nt({},f.__s)),nt(f.__s,E.getDerivedStateFromProps(I,f.__s))),g=f.props,w=f.state,f.__v=n,p)D&&E.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),D&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(D&&E.getDerivedStateFromProps==null&&I!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(I,_),n.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(I,f.__s,_)===!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(R){R&&(R.__=n)}),zn.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f),l=Et(r);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(I,f.__s,_),D&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,w,b)})}if(f.context=_,f.props=I,f.__P=e,f.__e=!1,N=me.__r,S=0,D)f.state=f.__s,f.__d=!1,N&&N(n),h=f.render(f.props,f.state,f.context),zn.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=nt(nt({},o),f.getChildContext())),D&&!p&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(g,w)),T=h!=null&&h.type===Wn&&h.key==null?Ji(h.props.children):h,l=Wi(e,Gn(T)?T:[T],n,r,o,i,a,s,l,u,d),f.base=n.__e,n.__u&=-161,f.__h.length&&s.push(f),v&&(f.__E=f.__=null)}catch(R){if(s.length=m,n.__v=null,u||a!=null){if(R.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($=a.length;$--;)Hr(a[$])}else n.__e=r.__e;n.__k==null&&(n.__k=r.__k||[]),R.then||Ki(n),me.__e(R,n,r)}}else a==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=Oc(r.__e,n,r,o,i,a,s,u,d);return(h=me.diffed)&&h(n),128&n.__u?void 0:l}function Ki(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ki))}function Yi(e,n,r){for(var o=0;o<r.length;o++)Gr(r[o],r[++o],r[++o]);me.__c&&me.__c(n,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(a){a.call(i)})}catch(a){me.__e(a,i.__v)}})}function Ji(e){return typeof e!="object"||e==null||e.__b>0?e:Gn(e)?e.map(Ji):e.constructor!==void 0?null:nt({},e)}function Oc(e,n,r,o,i,a,s,l,u){var d,h,m,f,p,g,w,b=r.props||Ln,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(d=0;d<a.length;d++)if((p=a[d])&&"setAttribute"in p==!!I&&(I?p.localName==I:p.nodeType==3)){e=p,a[d]=null;break}}if(e==null){if(I==null)return document.createTextNode(v);e=document.createElementNS(i,I,v.is&&v),l&&(me.__m&&me.__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&&bn.call(e.childNodes),!l&&a!=null)for(b={},d=0;d<e.attributes.length;d++)b[(p=e.attributes[d]).name]=p.value;for(d in b)p=b[d],d=="dangerouslySetInnerHTML"?m=p:d=="children"||d in v||d=="value"&&"defaultValue"in v||d=="checked"&&"defaultChecked"in v||Nn(e,d,null,p,i);for(d in v)p=v[d],d=="children"?f=p:d=="dangerouslySetInnerHTML"?h=p:d=="value"?g=p:d=="checked"?w=p:l&&typeof p!="function"||b[d]===p||Nn(e,d,p,b[d],i);if(h)l||m&&(h.__html==m.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(m&&(e.innerHTML=""),Wi(n.type=="template"?e.content:e,Gn(f)?f:[f],n,r,o,I=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:r.__k&&Et(r,0),l,u),a!=null)for(d=a.length;d--;)Hr(a[d]);l&&I!="textarea"||(d="value",I=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[d]||I=="progress"&&!g||I=="option"&&g!=b[d])&&Nn(e,d,g,b[d],i),d="checked",w!=null&&w!=e[d]&&Nn(e,d,w,b[d],i))}return e}function Gr(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){me.__e(i,r)}}function Xi(e,n,r){var o,i;if(me.unmount&&me.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Gr(o,null,n)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){me.__e(a,n)}o.base=o.__P=o.__n=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&Xi(o[i],n,r||typeof e.type!="function");r||Hr(e.__e),e.__c=e.__=e.__e=void 0}function Rc(e,n,r){return this.constructor(e,r)}function Fc(e,n,r){var o,i,a,s;n==document&&(n=document.documentElement),me.__&&me.__(e,n),i=(o=!1)?null:n.__k,a=[],s=[],Vr(n,e=n.__k=Ac(Wn,null,[e]),i||Ln,Ln,n.namespaceURI,i?null:n.firstChild?bn.call(n.childNodes):null,a,i?i.__e:n.firstChild,o,s),Yi(a,e,s),e.props.children=null}function Zi(e,n,r){var o,i,a,s,l=nt({},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?bn.call(arguments,2):r),hn(e.type,l,o||e.key,i||e.ref,null)}bn=zn.slice,me={__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}},$i=0,Ui=function(e){return e!=null&&e.constructor===void 0},Mn.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=nt({},this.state),typeof e=="function"&&(e=e(nt({},r),this.props)),e&&nt(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),Jo(this))},Mn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Jo(this))},Mn.prototype.render=Wn,wt=[],Bi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Hi=function(e,n){return e.__v.__b-n.__v.__b},$n.__r=0,ir=Math.random().toString(8),jn="__d"+ir,mn="__a"+ir,Vi=/(PointerCapture)$|Capture$/i,Br=0,Ar=Zo(!1),jr=Zo(!0);function Qo(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 Lc(e){if(Array.isArray(e))return e}function zc(e,n,r){return(n=Gc(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function $c(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function Uc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
250
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ei(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 Bc(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?ei(Object(r),!0).forEach(function(o){zc(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ei(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function Hc(e,n){return Lc(e)||$c(e,n)||Wc(e,n)||Uc()}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 Gc(e){var n=Vc(e,"string");return typeof n=="symbol"?n:n+""}function Un(e){"@babel/helpers - typeof";return Un=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},Un(e)}function Wc(e,n){if(e){if(typeof e=="string")return Qo(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)?Qo(e,n):void 0}}var Mr=function(n){if(Un(n)!=="object")return n;var r=Zi(n);if(r.props){var o;r.props=Bc({},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(Mr):Mr(r.props.children))}return r},qc=function(n){return Ui(Zi(n))},Kc=function(n,r){delete r.__k,Fc(Mr(n),r)};function Yc(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 Jc=`.float-tooltip-kap {
249
+ `,Kf=[{documentId:"doc-welcome",relativePath:"README.md",displayName:"README",content:Po,contentHash:Nn(Po),permission:1,ownerVisitorId:nt,domainId:"default",updatedBy:nt,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-markdown-guide",relativePath:"指南/Markdown 语法.md",displayName:"Markdown 语法",content:To,contentHash:Nn(To),permission:1,ownerVisitorId:nt,domainId:"default",updatedBy:nt,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-diagram-guide",relativePath:"指南/图表支持.md",displayName:"图表支持",content:Ao,contentHash:Nn(Ao),permission:1,ownerVisitorId:nt,domainId:"default",updatedBy:nt,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null},{documentId:"doc-personal-note",relativePath:"个人笔记.md",displayName:"个人笔记",content:jo,contentHash:Nn(jo),permission:0,ownerVisitorId:nt,domainId:nt,updatedBy:nt,updatedAt:new Date().toISOString(),createdAt:new Date().toISOString(),fileType:"md",parentId:null}];const $r="mdocs.visitorId",Ir="mdocs-api-error";function tl(e){typeof window>"u"||window.dispatchEvent(new CustomEvent(Ir,{detail:{status:e.status,code:e.code,message:e.message}}))}function Ti(){return!1}function Yf(){return window.localStorage.getItem($r)}function On(e){window.localStorage.setItem($r,e)}function nl(){window.localStorage.removeItem($r)}async function H(e,n={}){try{Ti();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 Ke(o.status,"BAD_RESPONSE","response is not valid JSON")}if(!o.ok){const s=a==null?void 0:a.error;throw new Ke(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 Ke&&!n.silent&&tl(r),r}}const Rn="default",Jf=["public","restricted","private"];function Xf(e){return e===Rn}function Zf(e,n){return n!==null&&e.creatorVisitorId===n}function Qf(e){return e.docCount>0}function rl(e,n){return H("/api/visitors/register",{method:"POST",body:JSON.stringify({visitorName:e,password:n})})}function ol(e){return H("/api/visitors/recover",{method:"POST",body:JSON.stringify({recoveryCode:e})})}function il(e,n){return H("/api/visitors/login",{method:"POST",body:JSON.stringify({visitorName:e,password:n})})}function em(e){return H("/api/visitors/set-password",{method:"POST",body:JSON.stringify({password:e})})}function tm(){return H("/api/visitors/recovery-code",{method:"POST"})}async function Mo(){return(await H("/api/visitors/me")).visitor}function nm(){return H("/api/visitors").then(e=>e.visitors)}function al(){return H("/api/domains")}function rm(e){return H("/api/domains",{method:"POST",body:JSON.stringify(e)})}function om(e,n){return H(`/api/domains/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({domainName:n})})}function im(e,n){return H(`/api/domains/${encodeURIComponent(e)}/permission`,{method:"PUT",body:JSON.stringify({permission:n})})}function am(e){return H(`/api/domains/${encodeURIComponent(e)}`,{method:"DELETE"})}function sm(e){return H(`/api/domains/${encodeURIComponent(e)}/members`).then(n=>n.members)}function lm(e,n){return H(`/api/domains/${encodeURIComponent(e)}/members`,{method:"PUT",body:JSON.stringify({visitorIds:n})})}function cm(){return H("/api/domain-member-templates")}function dm(e){return H("/api/domain-member-templates",{method:"POST",body:JSON.stringify(e)})}function um(e,n){return H(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"PUT",body:JSON.stringify(n)})}function fm(e){return H(`/api/domain-member-templates/${encodeURIComponent(String(e))}`,{method:"DELETE"})}function sl(e){const n=e!=null&&e.trim()?`?domainId=${encodeURIComponent(e.trim())}`:"";return H(`/api/tree${n}`)}function Kt(e){return H(`/api/documents/${encodeURIComponent(e)}`)}function Cr(e){return H("/api/documents",{method:"POST",body:JSON.stringify(e)})}function or(e,n){return H(`/api/documents/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(n)})}function ll(e,n){const r=n?`?localBaseCommitId=${encodeURIComponent(n)}`:"";return H(`/api/documents/${encodeURIComponent(e)}/sync-status${r}`,{silent:!0})}function mm(e,n,r){const o=new URLSearchParams({localBaseCommitId:n,remoteCommitId:r});return H(`/api/documents/${encodeURIComponent(e)}/merge-context?${o}`)}function ir(e){return H("/api/documents/convert",{method:"POST",body:JSON.stringify(e)})}function cl(e){return H(`/api/documents/${encodeURIComponent(e)}`,{method:"DELETE"})}function dl(e,n){return H(`/api/documents/${encodeURIComponent(e)}/move`,{method:"POST",body:JSON.stringify({parentId:n})})}function hm(e){return H(`/api/documents/${encodeURIComponent(e)}/invites`)}function pm(e,n,r){return H(`/api/documents/${encodeURIComponent(e)}/invites`,{method:"POST",body:JSON.stringify({targetVisitorId:n,targetPermission:r})})}function gm(e,n){return H(`/api/documents/${encodeURIComponent(e)}/invites/${encodeURIComponent(n)}`,{method:"DELETE"})}async function ym(e,n){var d;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 Ke(i.status,(h==null?void 0:h.code)??"UPLOAD_FAILED",(h==null?void 0:h.message)??s.msg??"upload failed")}const l=((d=s.data)==null?void 0:d.succMap)??{},u=Object.values(l);if(u.length===0)throw new Error("upload succeeded but no URL returned");return u[0]}function ul(e){return H("/api/folders",{method:"POST",body:JSON.stringify(e)})}function fl(e){return H(`/api/documents/folder/${encodeURIComponent(e)}`,{method:"DELETE"})}function vm(e){return H("/api/cli/tokens",{method:"POST",body:JSON.stringify({})})}function bm(){return H("/api/cli/tokens")}function ml(e){return H("/api/documents/search",{method:"POST",body:JSON.stringify(e)})}function hl(){return H("/api/bookmarks")}function xm(e){return H(`/api/bookmarks/${encodeURIComponent(e)}`)}function wm(e){return H(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"POST"})}function pl(e){return H(`/api/bookmarks/${encodeURIComponent(e)}`,{method:"DELETE"})}function _m(e={}){const n=new URLSearchParams({offset:String(e.offset??0),limit:String(e.limit??20)});return e.domainId&&n.set("domainId",e.domainId),e.creatorVisitorId&&n.set("creatorVisitorId",e.creatorVisitorId),e.groupBy&&n.set("groupBy",e.groupBy),H(`/api/visitors/me/documents?${n}`)}function gl(e){return H(`/api/documents/${encodeURIComponent(e)}/comments`)}function yl(e,n){return H(`/api/documents/${encodeURIComponent(e)}/comments`,{method:"POST",body:JSON.stringify(n)})}function vl(e,n){return H(`/api/documents/${encodeURIComponent(e)}/comments/${encodeURIComponent(n)}`,{method:"DELETE"})}function km(){return H("/api/agent/configs")}function Eo(e){return H("/api/agent/config",{method:"PUT",body:JSON.stringify(e)})}function Im(e){return H(`/api/agent/config/${encodeURIComponent(e)}/default`,{method:"POST"})}function Cm(e){return H(`/api/agent/config/${encodeURIComponent(e)}`,{method:"DELETE"})}function Sm(){return H("/api/agent/skills")}function Dm(e){return H("/api/agent/skills",{method:"POST",body:JSON.stringify(e)})}function Nm(e,n){return H(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)})}function Pm(e){return H(`/api/agent/skills/${encodeURIComponent(e)}`,{method:"DELETE"})}function Tm(){return H("/api/agent/status")}function Am(){return H("/api/agent/context-usage")}function jm(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 Mm(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 Em(e="normal",n){return H("/api/agent/sessions",{method:"POST",body:JSON.stringify({mode:e,...e==="coding"?{documentId:n??null}:{}})})}function Om(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 Rm(e,n){return H("/api/agent/session/bind-document",{method:"POST",body:JSON.stringify({sessionId:e,documentId:n})})}function Fm(e,n){return H("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,choice:n})})}function Lm(e){return H("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function zm(e){return H("/api/agent/choice",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}function $m(e,n){return H("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,...n})})}function Um(e){return H("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,expire:!0})})}function Bm(e){return H("/api/agent/skill-form",{method:"POST",body:JSON.stringify({requestId:e,cancel:!0})})}async function Hm(e,n){var d;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();(d=m.error)!=null&&d.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(`
250
+ `);l=f.pop()??"";for(const p of f){const g=p.trim();if(!g.startsWith("data:"))continue;const w=g.slice(5).trim();if(!(!w||w==="[DONE]"))try{n.onEvent(JSON.parse(w))}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 Oo(e){return H(`/api/graph/${e}`,{method:"GET"})}function bl(e){return H(`/api/graph/${e}/analyze`,{method:"POST"})}function Ro(e){return H(`/api/graph/domain/${e}`,{method:"GET"})}function xl(e){return H(`/api/graph/domain/${e}/analyze`,{method:"POST"})}function wl(e){return H(`/api/graph/tasks/${encodeURIComponent(e)}`,{method:"GET"})}const _l={domainId:Rn,domainName:"Default",permission:"public",creatorVisitorId:"",docCount:0};async function Ai(){try{return await al()}catch{return[_l]}}function kl(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===Rn))==null?void 0:o.domainId)??((i=e[0])==null?void 0:i.domainId)??Rn}function Il(e){const{t:n}=Ye(),[r,o]=x.useState(!1),[i,a]=x.useState(null),[s,l]=x.useState("login"),[u,d]=x.useState(""),[h,m]=x.useState(""),[f,p]=x.useState("password"),[g,w]=x.useState(""),[b,v]=x.useState(""),[I,D]=x.useState("");function N(R){if(R.preventDefault(),!u.trim()){a(n("nameRequired"));return}a(null),l("register-password")}async function _(R){R.preventDefault(),o(!0),a(null);try{const U=h.trim();await e.onSubmit(u.trim(),U||void 0),d(""),m(""),l("login"),p("password"),w(u.trim()),v(U||"")}catch(U){a(U instanceof Error?U.message:String(U)),l("register")}finally{o(!1)}}async function P(R){R.preventDefault();const U=g.trim(),V=b.trim();if(!U||!V){a("请输入用户名和密码");return}o(!0),a(null);try{const Y=await il(U,V);On(Y.visitor.visitorId),await e.onRecover(Y.visitor.visitorId)}catch(Y){a(Y instanceof Error?Y.message:String(Y))}finally{o(!1)}}async function S(R){R.preventDefault();const U=I.trim();if(!U){a("请输入恢复码");return}o(!0),a(null);try{const V=await ol(U);On(V.visitor.visitorId),await e.onRecover(V.visitor.visitorId)}catch(V){a(V instanceof Error?V.message:String(V))}finally{o(!1)}}const T=i??e.error;function $(){a(null),d(""),m(""),l("register")}function O(){a(null),l("login")}return c.jsx("div",{className:"mdocs-dialog-backdrop",children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:420},children:[s==="login"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{display:"flex",gap:16,marginBottom:16,fontSize:"0.875rem"},children:[c.jsx("button",{type:"button",onClick:()=>{a(null),p("password")},style:{background:"none",border:"none",color:f==="password"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:f==="password"?"2px solid var(--mdocs-accent)":"none",fontWeight:f==="password"?600:400},children:"用户名+密码"}),c.jsx("button",{type:"button",onClick:()=>{a(null),p("recovery")},style:{background:"none",border:"none",color:f==="recovery"?"var(--mdocs-accent)":"var(--mdocs-text-secondary)",cursor:"pointer",padding:"4px 0",borderBottom:f==="recovery"?"2px solid var(--mdocs-accent)":"none",fontWeight:f==="recovery"?600:400},children:"恢复码"})]}),f==="password"?c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:"🔑 使用密码登录"}),c.jsx("p",{children:"输入用户名和密码,在其他设备上找回你的身份。"}),c.jsxs("form",{onSubmit:P,children:[c.jsx("input",{autoFocus:!0,placeholder:"用户名",value:g,onChange:R=>w(R.target.value),maxLength:60,style:{marginBottom:8}}),c.jsx("input",{type:"password",placeholder:"密码",value:b,onChange:R=>v(R.target.value)}),T&&c.jsx("div",{className:"mdocs-dialog-error",children:T}),c.jsx("button",{type:"submit",className:"primary",disabled:r,children:r?"验证中…":"登录"})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:"🔑 使用恢复码找回"}),c.jsx("p",{children:"输入注册时保存的恢复码,系统将为您生成新的身份令牌。"}),c.jsxs("form",{onSubmit:S,children:[c.jsx("input",{autoFocus:!0,placeholder:"ABCD-EFGH-IJKL-MNOP",value:I,onChange:R=>D(R.target.value),style:{fontFamily:"monospace",letterSpacing:"0.1em"},maxLength:30}),T&&c.jsx("div",{className:"mdocs-dialog-error",children:T}),c.jsx("button",{type:"submit",className:"primary",disabled:r,children:r?"验证中…":"找回身份"})]})]}),c.jsx("p",{style:{marginTop:16,textAlign:"center"},children:c.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:$,children:"没有账号?点击注册"})})]}),s==="register"&&c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:n("welcomeTitle")}),c.jsx("p",{children:n("welcomeDesc")}),c.jsxs("form",{onSubmit:N,children:[c.jsx("input",{autoFocus:!0,placeholder:n("visitorNamePlaceholder"),value:u,onChange:R=>d(R.target.value),maxLength:60}),T&&c.jsx("div",{className:"mdocs-dialog-error",children:T}),c.jsx("button",{type:"submit",className:"primary",disabled:r,children:"下一步"})]}),c.jsx("p",{style:{marginTop:16,textAlign:"center"},children:c.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-accent)",cursor:"pointer",fontSize:"0.875rem",textDecoration:"underline",padding:0},onClick:O,children:"已有账号?点击登录"})})]}),s==="register-password"&&c.jsxs(c.Fragment,{children:[c.jsx("h1",{children:"设置密码(可选)"}),c.jsx("p",{style:{marginBottom:8},children:"设置密码后,你可以在其他浏览器或设备上使用「用户名+密码」登录。"}),c.jsx("p",{style:{color:"var(--mdocs-text-secondary)",fontSize:"0.875rem",marginBottom:16},children:"留空不设置密码也能正常使用,但只能在当前浏览器操作。"}),c.jsxs("form",{onSubmit:_,children:[c.jsx("input",{autoFocus:!0,type:"password",placeholder:"设置密码(至少 4 位)",value:h,onChange:R=>m(R.target.value),minLength:4}),T&&c.jsx("div",{className:"mdocs-dialog-error",children:T}),c.jsx("button",{type:"submit",className:"primary",disabled:r,style:{marginTop:8},children:r?n("creating"):"完成注册"})]}),c.jsx("p",{style:{marginTop:16,textAlign:"center"},children:c.jsx("button",{type:"button",style:{background:"none",border:"none",color:"var(--mdocs-text-secondary)",cursor:"pointer",fontSize:"0.875rem",padding:0},onClick:()=>l("register"),children:"← 返回上一步"})})]})]})})}function Cl(e){const{t:n}=Ye();return c.jsxs("div",{className:"mdocs-notice card",children:[c.jsx("span",{children:n("visitorIdNotice",{id:e.visitorId})}),c.jsx("button",{type:"button",onClick:e.onDismiss,children:n("gotIt")})]})}const ji="application/x-mdocs-document-id",Sr="mdocs-doc:";let Ft=null;function Mi(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=Mi(o.children,n,[...r,o.documentId]);if(i)return i}return null}function Ur(e){if(Ft)return Ft;try{const n=e.getData(ji);if(n)return n;const r=e.getData("text/plain")||e.getData("Text");if(r.startsWith(Sr))return r.slice(Sr.length)}catch{}return""}function Ct(e){return!!(e&&Ft)}function Sl(e){const{t:n}=Ye(),r=x.useRef(null),[o,i]=x.useState(null),[a,s]=x.useState(null),l=x.useMemo(()=>{var v,I;const b=((v=e.graphFocusAnchorId)==null?void 0:v.trim())||((I=e.activeDocumentId)==null?void 0:I.trim());return b?Mi(e.nodes,b):null},[e.nodes,e.activeDocumentId,e.graphFocusAnchorId]),u=x.useMemo(()=>new Set((l==null?void 0:l.forceOpenFolderIds)??[]),[l]);x.useEffect(()=>{if(!(l!=null&&l.scrollTreeId))return;const b=l.scrollTreeId,v=()=>{var N;const D=(N=r.current)==null?void 0:N.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 d(){i(null)}function h(){Ft=null,s(null),d()}function m(b){Ft=b,s(b),d()}function f(b){if(!Ct(e.onMoveDocument))return;b.preventDefault(),b.dataTransfer.dropEffect="move",b.target.closest(".mdocs-tree-row")||i({kind:"root"})}function p(b){const v=b.relatedTarget;v&&b.currentTarget.contains(v)||i(I=>(I==null?void 0:I.kind)==="root"?null:I)}function g(b){if(!e.onMoveDocument||!Ct(e.onMoveDocument))return;b.preventDefault(),b.stopPropagation();const I=b.target.closest(".mdocs-tree-row"),D=Ur(b.dataTransfer);h(),!I&&D&&e.onMoveDocument(D,null)}const w="mdocs-sidebar-list"+((o==null?void 0:o.kind)==="root"?" mdocs-tree-drop-root":"");return e.nodes.length===0?c.jsx("div",{ref:r,className:w,onDragOver:f,onDragLeave:p,onDrop:g,children:c.jsx("div",{className:"muted",style:{padding:"8px 10px",fontSize:12},children:n("noDocumentsYet")})}):c.jsx("div",{ref:r,className:w,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:p,onDrop:g,children:e.nodes.map(b=>c.jsx(Ei,{node:b,depth:0,parentPath:"",parentFolderId:null,activeDocumentId:e.activeDocumentId,graphFocusAnchorId:e.graphFocusAnchorId??null,selectedParentPath:e.selectedParentPath,forceOpenFolderIds:u,dropHighlight:o,setDropHighlight:i,clearDropHighlight:d,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 Ei(e){const n={paddingLeft:8+e.depth*16};return e.node.type==="folder"?c.jsx(Pl,{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}):c.jsx(Dl,{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 Dl(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]=x.useState(!1),u=((m=e.dropHighlight)==null?void 0:m.kind)==="doc"&&e.dropHighlight.id===n.documentId,[d,h]=x.useState(!1);return c.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(ji,n.documentId),f.dataTransfer.setData("text/plain",Sr+n.documentId),f.dataTransfer.effectAllowed="move")},onDragEnd:()=>{e.endDragSession(),queueMicrotask(()=>h(!1))},onDragEnter:f=>{!Ct(e.onMoveDocument)||Ft===n.documentId||(f.preventDefault(),f.stopPropagation(),e.setDropHighlight({kind:"doc",id:n.documentId}))},onDragOver:f=>{!Ct(e.onMoveDocument)||Ft===n.documentId||(f.preventDefault(),f.stopPropagation(),f.dataTransfer.dropEffect="move",e.setDropHighlight({kind:"doc",id:n.documentId}))},onDrop:f=>{if(!e.onMoveDocument||!Ct(e.onMoveDocument))return;f.preventDefault(),f.stopPropagation();const p=Ur(f.dataTransfer),g=e.parentFolderId;e.endDragSession(),!(!p||p===n.documentId)&&e.onMoveDocument(p,g)},onClick:()=>{d||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:[c.jsx("span",{className:"mdocs-tree-caret-spacer","aria-hidden":!0}),c.jsx("span",{className:`mdocs-tree-icon${n.fileType==="html"?" mdocs-tree-icon-html":""}`,children:n.fileType==="html"?c.jsx("span",{className:"mdocs-tree-html-bracket",children:"</>"}):"md"}),c.jsx("span",{className:"mdocs-tree-label",title:n.displayName||n.name,children:n.displayName||n.name}),(e.onOpenGraph||e.onGenerateGraph)&&c.jsxs("span",{className:"mdocs-tree-hover-actions",onClick:f=>f.stopPropagation(),children:[e.onOpenGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"查看图谱",onClick:f=>{var p;f.stopPropagation(),(p=e.onOpenGraph)==null||p.call(e,e.doc,e.parentFolderId??void 0)},children:c.jsx(zr,{size:14,strokeWidth:1.75})}),e.onGenerateGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"生成图谱",onClick:f=>{var p;f.stopPropagation(),(p=e.onGenerateGraph)==null||p.call(e,e.doc,e.parentFolderId??void 0)},children:c.jsx(Di,{size:14,strokeWidth:1.75})})]})]})}function Nl(){return c.jsx("span",{className:"mdocs-tree-icon mdocs-tree-icon-dir","aria-hidden":!0,children:c.jsx(Ds,{size:16})})}function Pl(e){var m,f,p;const{t:n}=Ye(),r=e.forceOpenFolderIds.has(e.folder.documentId),[o,i]=x.useState(e.depth<1||r),a=o;x.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,d=((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 c.jsxs("div",{children:[c.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":"")+(d?" mdocs-tree-drop-target":""),"data-tree-id":e.folder.documentId,style:e.indent,onClick:h,onContextMenu:g=>{g.preventDefault(),g.stopPropagation(),e.onContextMenu({x:g.clientX,y:g.clientY,node:e.folder,parentPath:e.folder.path})},onDragEnter:g=>{Ct(e.onMoveDocument)&&(g.preventDefault(),g.stopPropagation(),e.setDropHighlight({kind:"folder",id:e.folder.documentId}),i(!0))},onDragOver:g=>{Ct(e.onMoveDocument)&&(g.preventDefault(),g.stopPropagation(),g.dataTransfer.dropEffect="move",e.setDropHighlight({kind:"folder",id:e.folder.documentId}))},onDrop:g=>{if(!e.onMoveDocument||!Ct(e.onMoveDocument))return;g.preventDefault(),g.stopPropagation();const w=Ur(g.dataTransfer),b=e.folder.documentId;e.endDragSession(),w&&e.onMoveDocument(w,b)},children:[c.jsx("span",{className:"mdocs-tree-caret",role:"button",tabIndex:0,"aria-expanded":a,"aria-label":n(a?"collapseFolder":"expandFolder"),onClick:g=>{g.stopPropagation(),i(w=>!w)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),i(w=>!w))},children:a?"▾":"▸"}),c.jsx(Nl,{}),c.jsx("span",{className:"mdocs-tree-folder-select",children:c.jsx("span",{className:"mdocs-tree-label",title:((f=e.folder.folderDisplayName)==null?void 0:f.trim())||e.folder.name,children:((p=e.folder.folderDisplayName)==null?void 0:p.trim())||e.folder.name})}),(e.onOpenGraph||e.onGenerateGraph)&&c.jsxs("span",{className:"mdocs-tree-hover-actions",onClick:g=>g.stopPropagation(),children:[e.onOpenGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"查看图谱",onClick:g=>{var w;g.stopPropagation(),(w=e.onOpenGraph)==null||w.call(e,e.folder)},children:c.jsx(zr,{size:14,strokeWidth:1.75})}),e.onGenerateGraph&&c.jsx("button",{type:"button",className:"mdocs-tree-icon-btn",title:"生成图谱",onClick:g=>{var w;g.stopPropagation(),(w=e.onGenerateGraph)==null||w.call(e,e.folder)},children:c.jsx(Di,{size:14,strokeWidth:1.75})})]})]}),a&&e.folder.children.map(g=>c.jsx(Ei,{node:g,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},g.path))]})}function Tl(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function Al(e,n,r){return n=zl(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Fo(e,n){return El(e)||Tl(e,n)||Oi(e,n)||Fl()}function jl(e){return Ml(e)||Ol(e)||Oi(e)||Rl()}function Ml(e){if(Array.isArray(e))return Dr(e)}function El(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 Oi(e,n){if(e){if(typeof e=="string")return Dr(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 Dr(e,n)}}function Dr(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 Rl(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
251
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
252
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ll(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 zl(e){var n=Ll(e,"string");return typeof n=="symbol"?n:String(n)}var $l=function(n,r){var o=new Set(r);return Object.assign.apply(Object,[{}].concat(jl(Object.entries(n).filter(function(i){var a=Fo(i,1),s=a[0];return!o.has(s)}).map(function(i){var a=Fo(i,2),s=a[0],l=a[1];return Al({},s,l)}))))};function Ul(e,{wrapperElementType:n="div",nodeMapper:r=a=>a,methodNames:o=[],initPropNames:i=[]}={}){return x.forwardRef((a,s)=>{const l=x.useRef(),u=x.useMemo(()=>{const m=Object.fromEntries(i.filter(f=>a.hasOwnProperty(f)).map(f=>[f,a[f]]));return e(m)},[]);Lo(()=>{u(r(l.current))},x.useLayoutEffect),Lo(()=>u._destructor instanceof Function?u._destructor:void 0);const d=x.useCallback((m,...f)=>u[m]instanceof Function?u[m](...f):void 0,[u]),h=x.useRef({});return Object.keys($l(a,[...o,...i])).filter(m=>h.current[m]!==a[m]).forEach(m=>d(m,a[m])),h.current=a,x.useImperativeHandle(s,()=>Object.fromEntries(o.map(m=>[m,(...f)=>d(m,...f)])),[d]),Ii.createElement(n,{ref:l})})}function Lo(e,n=x.useEffect){const r=x.useRef(),o=x.useRef(!1),i=x.useRef(!1),[a,s]=x.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 Rt=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-Rt.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?Rt.Bounce.In(e*2)*.5:Rt.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}}}}),un=function(){return performance.now()},Ri=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=un()),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}(),Nr={Linear:function(e,n){var r=e.length-1,o=r*n,i=Math.floor(o),a=Nr.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}}},Fi=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Pr=new Ri,zo=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=Rt.Linear.None,this._interpolationFunction=Nr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Fi.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=Pr,Pr.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=un()),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),d=u?"array":typeof l,h=!u&&Array.isArray(o[s]);if(!(d==="undefined"||d==="function")){if(h){var m=o[s];if(m.length===0)continue;for(var f=[l],p=0,g=m.length;p<g;p+=1){var w=this._handleRelativeValue(l,m[p]);if(isNaN(w)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}f.push(w)}h&&(o[s]=f)}if((d==="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=un()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this)},e.prototype.resume=function(n){return n===void 0&&(n=un()),!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=Rt.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=Nr.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=un()),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,d=function(){if(o._duration===0||s>u)return 1;var w=Math.trunc(s/l),b=s-w*l,v=Math.min(b/o._duration,1);return v===0&&s===o._duration?1:v},h=d(),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 p=0,g=this._chainedTweens.length;p<g;p++)this._chainedTweens[p].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]),d=Array.isArray(l),h=!u&&d;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}();Fi.nextId;var at=Pr;at.getAll.bind(at);at.removeAll.bind(at);at.add.bind(at);at.remove.bind(at);at.update.bind(at);function $o(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 Bl(e){if(Array.isArray(e))return e}function Hl(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function Vl(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function Gl(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function Wl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
253
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ql(e,n){return Bl(e)||Gl(e,n)||Kl(e,n)||Wl()}function Kl(e,n){if(e){if(typeof e=="string")return $o(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)?$o(e,n):void 0}}var Yl=Vl(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(d,h){}:l;Hl(this,e),this.name=n,this.defaultVal=i,this.triggerUpdate=s,this.onChange=u});function Br(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,d=e.init,h=d===void 0?function(){}:d,m=e.update,f=m===void 0?function(){}:m,p=Object.keys(i).map(function(g){return new Yl(g,i[g])});return function g(){for(var w=arguments.length,b=new Array(w),v=0;v<w;v++)b[v]=arguments[v];var I=!!(this instanceof g&&this.constructor),D=I?b.shift():void 0,N=b[0],_=N===void 0?{}:N,P=Object.assign({},r instanceof Function?r(_):r,{initialised:!1}),S={};function T(R){return $(R,_),O(),T}var $=function(U,V){h.call(T,U,P,V),P.initialised=!0},O=qa(function(){P.initialised&&(f.call(T,P,S),S={})},1);return p.forEach(function(R){T[R.name]=U(R);function U(V){var Y=V.name,te=V.triggerUpdate,ne=te===void 0?!1:te,K=V.onChange,ve=K===void 0?function(oe,ae){}:K,Ce=V.defaultVal,M=Ce===void 0?null:Ce;return function(oe){var ae=P[Y];if(!arguments.length)return ae;var re=oe===void 0?M:oe;return P[Y]=re,ve.call(T,re,P,ae),!S.hasOwnProperty(Y)&&(S[Y]=ae),ne&&O(),T}}}),Object.keys(s).forEach(function(R){T[R]=function(){for(var U,V=arguments.length,Y=new Array(V),te=0;te<V;te++)Y[te]=arguments[te];return(U=s[R]).call.apply(U,[T,P].concat(Y))}}),Object.entries(u).forEach(function(R){var U=ql(R,2),V=U[0],Y=U[1];return T[V]=T[Y]}),T.resetProps=function(){return p.forEach(function(R){T[R.name](R.defaultVal)}),T},T.resetProps(),P._rerender=O,I&&D&&T(D),T}}var ie=function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}};function Fn(e){"@babel/helpers - typeof";return Fn=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},Fn(e)}var Jl=/^\s+/,Xl=/\s+$/;function q(e,n){if(e=e||"",n=n||{},e instanceof q)return e;if(!(this instanceof q))return new q(e,n);var r=Zl(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}q.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=Li(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=Bo(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=Bo(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=Uo(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=Uo(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 Ho(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return nc(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:hc[Ho(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+Vo(this._r,this._g,this._b,this._a),o=r,i=this._gradientType?"GradientType = 1, ":"";if(n){var a=q(n);o="#"+Vo(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 q(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(ac,arguments)},brighten:function(){return this._applyModification(sc,arguments)},darken:function(){return this._applyModification(lc,arguments)},desaturate:function(){return this._applyModification(rc,arguments)},saturate:function(){return this._applyModification(oc,arguments)},greyscale:function(){return this._applyModification(ic,arguments)},spin:function(){return this._applyModification(cc,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(fc,arguments)},complement:function(){return this._applyCombination(dc,arguments)},monochromatic:function(){return this._applyCombination(mc,arguments)},splitcomplement:function(){return this._applyCombination(uc,arguments)},triad:function(){return this._applyCombination(Go,[3])},tetrad:function(){return this._applyCombination(Go,[4])}};q.fromRatio=function(e,n){if(Fn(e)=="object"){var r={};for(var o in e)e.hasOwnProperty(o)&&(o==="a"?r[o]=e[o]:r[o]=fn(e[o]));e=r}return q(e,n)};function Zl(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=vc(e)),Fn(e)=="object"&&(ct(e.r)&&ct(e.g)&&ct(e.b)?(n=Ql(e.r,e.g,e.b),s=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):ct(e.h)&&ct(e.s)&&ct(e.v)?(o=fn(e.s),i=fn(e.v),n=tc(e.h,o,i),s=!0,l="hsv"):ct(e.h)&&ct(e.s)&&ct(e.l)&&(o=fn(e.s),a=fn(e.l),n=ec(e.h,o,a),s=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=Li(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 Ql(e,n,r){return{r:me(e,255)*255,g:me(n,255)*255,b:me(r,255)*255}}function Uo(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 ec(e,n,r){var o,i,a;e=me(e,360),n=me(n,100),r=me(r,100);function s(d,h,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?d+(h-d)*6*m:m<1/2?h:m<2/3?d+(h-d)*(2/3-m)*6:d}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 Bo(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 tc(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,d=[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:d*255,g:h*255,b:m*255}}function Ho(e,n,r,o){var i=[qe(Math.round(e).toString(16)),qe(Math.round(n).toString(16)),qe(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 nc(e,n,r,o,i){var a=[qe(Math.round(e).toString(16)),qe(Math.round(n).toString(16)),qe(Math.round(r).toString(16)),qe(zi(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 Vo(e,n,r,o){var i=[qe(zi(o)),qe(Math.round(e).toString(16)),qe(Math.round(n).toString(16)),qe(Math.round(r).toString(16))];return i.join("")}q.equals=function(e,n){return!e||!n?!1:q(e).toRgbString()==q(n).toRgbString()};q.random=function(){return q.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function rc(e,n){n=n===0?0:n||10;var r=q(e).toHsl();return r.s-=n/100,r.s=Vn(r.s),q(r)}function oc(e,n){n=n===0?0:n||10;var r=q(e).toHsl();return r.s+=n/100,r.s=Vn(r.s),q(r)}function ic(e){return q(e).desaturate(100)}function ac(e,n){n=n===0?0:n||10;var r=q(e).toHsl();return r.l+=n/100,r.l=Vn(r.l),q(r)}function sc(e,n){n=n===0?0:n||10;var r=q(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)))),q(r)}function lc(e,n){n=n===0?0:n||10;var r=q(e).toHsl();return r.l-=n/100,r.l=Vn(r.l),q(r)}function cc(e,n){var r=q(e).toHsl(),o=(r.h+n)%360;return r.h=o<0?360+o:o,q(r)}function dc(e){var n=q(e).toHsl();return n.h=(n.h+180)%360,q(n)}function Go(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=q(e).toHsl(),o=[q(e)],i=360/n,a=1;a<n;a++)o.push(q({h:(r.h+a*i)%360,s:r.s,l:r.l}));return o}function uc(e){var n=q(e).toHsl(),r=n.h;return[q(e),q({h:(r+72)%360,s:n.s,l:n.l}),q({h:(r+216)%360,s:n.s,l:n.l})]}function fc(e,n,r){n=n||6,r=r||30;var o=q(e).toHsl(),i=360/r,a=[q(e)];for(o.h=(o.h-(i*n>>1)+720)%360;--n;)o.h=(o.h+i)%360,a.push(q(o));return a}function mc(e,n){n=n||6;for(var r=q(e).toHsv(),o=r.h,i=r.s,a=r.v,s=[],l=1/n;n--;)s.push(q({h:o,s:i,v:a})),a=(a+l)%1;return s}q.mix=function(e,n,r){r=r===0?0:r||50;var o=q(e).toRgb(),i=q(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 q(s)};q.readability=function(e,n){var r=q(e),o=q(n);return(Math.max(r.getLuminance(),o.getLuminance())+.05)/(Math.min(r.getLuminance(),o.getLuminance())+.05)};q.isReadable=function(e,n,r){var o=q.readability(e,n),i,a;switch(a=!1,i=bc(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};q.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 d=0;d<n.length;d++)a=q.readability(e,n[d]),a>i&&(i=a,o=q(n[d]));return q.isReadable(e,o,{level:l,size:u})||!s?o:(r.includeFallbackColors=!1,q.mostReadable(e,["#fff","#000"],r))};var Tr=q.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"},hc=q.hexNames=pc(Tr);function pc(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function Li(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function me(e,n){gc(e)&&(e="100%");var r=yc(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 Vn(e){return Math.min(1,Math.max(0,e))}function Le(e){return parseInt(e,16)}function gc(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function yc(e){return typeof e=="string"&&e.indexOf("%")!=-1}function qe(e){return e.length==1?"0"+e:""+e}function fn(e){return e<=1&&(e=e*100+"%"),e}function zi(e){return Math.round(parseFloat(e)*255).toString(16)}function Wo(e){return Le(e)/255}var We=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 ct(e){return!!We.CSS_UNIT.exec(e)}function vc(e){e=e.replace(Jl,"").replace(Xl,"").toLowerCase();var n=!1;if(Tr[e])e=Tr[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=We.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=We.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=We.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=We.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=We.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=We.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=We.hex8.exec(e))?{r:Le(r[1]),g:Le(r[2]),b:Le(r[3]),a:Wo(r[4]),format:n?"name":"hex8"}:(r=We.hex6.exec(e))?{r:Le(r[1]),g:Le(r[2]),b:Le(r[3]),format:n?"name":"hex"}:(r=We.hex4.exec(e))?{r:Le(r[1]+""+r[1]),g:Le(r[2]+""+r[2]),b:Le(r[3]+""+r[3]),a:Wo(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=We.hex3.exec(e))?{r:Le(r[1]+""+r[1]),g:Le(r[2]+""+r[2]),b:Le(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function bc(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 Ar(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 xc(e){if(Array.isArray(e))return Ar(e)}function $i(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 wc(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _c(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function $e(e,n){return e.get($i(e,n))}function qo(e,n,r){wc(e,n),n.set(e,r)}function Ko(e,n,r){return e.set($i(e,n),r),r}function kc(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,Pc(o.key),o)}}function Ic(e,n,r){return n&&kc(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Cc(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Sc(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
254
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dc(e){return xc(e)||Cc(e)||Tc(e)||Sc()}function Nc(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 Pc(e){var n=Nc(e,"string");return typeof n=="symbol"?n:n+""}function Tc(e,n){if(e){if(typeof e=="string")return Ar(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)?Ar(e,n):void 0}}var Ac=123,jc=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},Ui=function(n,r,o){return(n<<16)+(r<<8)+o},Mc=function(n){var r=q(n).toRgb(),o=r.r,i=r.g,a=r.b;return Ui(o,i,a)},Yo=function(n,r){return n*Ac%Math.pow(2,r)},Mt=new WeakMap,dt=new WeakMap,Ec=function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;_c(this,e),qo(this,Mt,void 0),qo(this,dt,void 0),Ko(dt,this,n),this.reset()}return Ic(e,[{key:"reset",value:function(){Ko(Mt,this,["__reserved for background__"])}},{key:"register",value:function(r){if($e(Mt,this).length>=Math.pow(2,24-$e(dt,this)))return null;var o=$e(Mt,this).length,i=Yo(o,$e(dt,this)),a=jc(o+(i<<24-$e(dt,this)));return $e(Mt,this).push(r),a}},{key:"lookup",value:function(r){if(!r)return null;var o=typeof r=="string"?Mc(r):Ui.apply(void 0,Dc(r));if(!o)return null;var i=o&Math.pow(2,24-$e(dt,this))-1,a=o>>24-$e(dt,this)&Math.pow(2,$e(dt,this))-1;return Yo(i,$e(dt,this))!==a||i>=$e(Mt,this).length?null:$e(Mt,this)[i]}}])}(),bn,he,Bi,Hi,It,Jo,Vi,Gi,ar,jn,mn,Wi,Hr,jr,Mr,Ln={},zn=[],Oc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Gn=Array.isArray;function ot(e,n){for(var r in n)e[r]=n[r];return e}function Vr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Rc(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?bn.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 hn(e,s,o,i,null)}function hn(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??++Bi,__i:-1,__u:0};return i==null&&he.vnode!=null&&he.vnode(a),a}function Wn(e){return e.children}function Mn(e,n){this.props=e,this.context=n}function Lt(e,n){if(n==null)return e.__?Lt(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"?Lt(e):null}function Fc(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],i=[],a=ot({},n);a.__v=n.__v+1,he.vnode&&he.vnode(a),Gr(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,r??Lt(n),!!(32&n.__u),i),a.__v=n.__v,a.__.__k[a.__i]=a,Xi(o,a,i),n.__e=n.__=null,a.__e!=r&&qi(a)}}function qi(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}),qi(e)}function Xo(e){(!e.__d&&(e.__d=!0)&&It.push(e)&&!$n.__r++||Jo!=he.debounceRendering)&&((Jo=he.debounceRendering)||Vi)($n)}function $n(){try{for(var e,n=1;It.length;)It.length>n&&It.sort(Gi),e=It.shift(),n=It.length,Fc(e)}finally{It.length=$n.__r=0}}function Ki(e,n,r,o,i,a,s,l,u,d,h){var m,f,p,g,w,b,v=o&&o.__k||zn,I=n.length;for(u=Lc(r,n,v,u,I),m=0;m<I;m++)(p=r.__k[m])!=null&&(f=p.__i!=-1&&v[p.__i]||Ln,p.__i=m,b=Gr(e,p,f,i,a,s,l,u,d,h),g=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Wr(f.ref,null,p),h.push(p.ref,p.__c||g,p)),w==null&&g!=null&&(w=g),4&p.__u?(u=Yi(p,u,e),f.__e&&(f.__e=null)):typeof p.type=="function"&&b!==void 0?u=b:g&&(u=g.nextSibling),p.__u&=-7);return r.__e=w,u}function Lc(e,n,r,o,i){var a,s,l,u,d,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]=hn(null,s,null,null,null):Gn(s)?s=e.__k[a]=hn(Wn,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=hn(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,(d=s.__i=zc(s,r,u,m))!=-1&&(m--,(l=r[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(i>h?f--:i<h&&f++),typeof s.type!="function"&&(s.__u|=4)):d!=u&&(d==u-1?f--:d==u+1?f++:(d>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=Lt(l)),Qi(l,l));return o}function Yi(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=Yi(o[i],n,r));return n}e.__e!=n&&(n&&e.type&&!n.parentNode&&(n=Lt(e)),n=r.insertBefore(e.__e,n||null));do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function zc(e,n,r,o){var i,a,s,l=e.key,u=e.type,d=n[r],h=d!=null&&(2&d.__u)==0;if(d===null&&l==null||h&&l==d.key&&u==d.type)return r;if(o>(h?1:0)){for(i=r-1,a=r+1;i>=0||a<n.length;)if((d=n[s=i>=0?i--:a++])!=null&&!(2&d.__u)&&l==d.key&&u==d.type)return s}return-1}function Zo(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||Oc.test(n)?r:r+"px"}function Pn(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||Zo(e.style,n,"");if(r)for(n in r)o&&r[n]==o[n]||Zo(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(Wi,"$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[mn]=o[mn]:(r[mn]=Hr,e.addEventListener(n,a?Mr:jr,a)):e.removeEventListener(n,a?Mr:jr,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 Qo(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[jn]==null)n[jn]=Hr++;else if(n[jn]<r[mn])return;return r(he.event?he.event(n):n)}}}function Gr(e,n,r,o,i,a,s,l,u,d){var h,m,f,p,g,w,b,v,I,D,N,_,P,S,T,$,O=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 O=="function"){m=s.length;try{if(I=n.props,D=O.prototype&&O.prototype.render,N=(h=O.contextType)&&o[h.__c],_=h?N?N.props.value:h.__:o,r.__c?v=(f=n.__c=r.__c).__=f.__E:(D?n.__c=f=new O(I,_):(n.__c=f=new Mn(I,_),f.constructor=O,f.render=Uc),N&&N.sub(f),f.state||(f.state={}),f.__n=o,p=f.__d=!0,f.__h=[],f._sb=[]),D&&f.__s==null&&(f.__s=f.state),D&&O.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ot({},f.__s)),ot(f.__s,O.getDerivedStateFromProps(I,f.__s))),g=f.props,w=f.state,f.__v=n,p)D&&O.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),D&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(D&&O.getDerivedStateFromProps==null&&I!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(I,_),n.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(I,f.__s,_)===!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(R){R&&(R.__=n)}),zn.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f),l=Lt(r);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(I,f.__s,_),D&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,w,b)})}if(f.context=_,f.props=I,f.__P=e,f.__e=!1,P=he.__r,S=0,D)f.state=f.__s,f.__d=!1,P&&P(n),h=f.render(f.props,f.state,f.context),zn.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,P&&P(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=ot(ot({},o),f.getChildContext())),D&&!p&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(g,w)),T=h!=null&&h.type===Wn&&h.key==null?Zi(h.props.children):h,l=Ki(e,Gn(T)?T:[T],n,r,o,i,a,s,l,u,d),f.base=n.__e,n.__u&=-161,f.__h.length&&s.push(f),v&&(f.__E=f.__=null)}catch(R){if(s.length=m,n.__v=null,u||a!=null){if(R.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($=a.length;$--;)Vr(a[$])}else n.__e=r.__e;n.__k==null&&(n.__k=r.__k||[]),R.then||Ji(n),he.__e(R,n,r)}}else a==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=$c(r.__e,n,r,o,i,a,s,u,d);return(h=he.diffed)&&h(n),128&n.__u?void 0:l}function Ji(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ji))}function Xi(e,n,r){for(var o=0;o<r.length;o++)Wr(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 Zi(e){return typeof e!="object"||e==null||e.__b>0?e:Gn(e)?e.map(Zi):e.constructor!==void 0?null:ot({},e)}function $c(e,n,r,o,i,a,s,l,u){var d,h,m,f,p,g,w,b=r.props||Ln,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(d=0;d<a.length;d++)if((p=a[d])&&"setAttribute"in p==!!I&&(I?p.localName==I:p.nodeType==3)){e=p,a[d]=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&&bn.call(e.childNodes),!l&&a!=null)for(b={},d=0;d<e.attributes.length;d++)b[(p=e.attributes[d]).name]=p.value;for(d in b)p=b[d],d=="dangerouslySetInnerHTML"?m=p:d=="children"||d in v||d=="value"&&"defaultValue"in v||d=="checked"&&"defaultChecked"in v||Pn(e,d,null,p,i);for(d in v)p=v[d],d=="children"?f=p:d=="dangerouslySetInnerHTML"?h=p:d=="value"?g=p:d=="checked"?w=p:l&&typeof p!="function"||b[d]===p||Pn(e,d,p,b[d],i);if(h)l||m&&(h.__html==m.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),n.__k=[];else if(m&&(e.innerHTML=""),Ki(n.type=="template"?e.content:e,Gn(f)?f:[f],n,r,o,I=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:r.__k&&Lt(r,0),l,u),a!=null)for(d=a.length;d--;)Vr(a[d]);l&&I!="textarea"||(d="value",I=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[d]||I=="progress"&&!g||I=="option"&&g!=b[d])&&Pn(e,d,g,b[d],i),d="checked",w!=null&&w!=e[d]&&Pn(e,d,w,b[d],i))}return e}function Wr(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 Qi(e,n,r){var o,i;if(he.unmount&&he.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Wr(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]&&Qi(o[i],n,r||typeof e.type!="function");r||Vr(e.__e),e.__c=e.__=e.__e=void 0}function Uc(e,n,r){return this.constructor(e,r)}function Bc(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=[],Gr(n,e=n.__k=Rc(Wn,null,[e]),i||Ln,Ln,n.namespaceURI,i?null:n.firstChild?bn.call(n.childNodes):null,a,i?i.__e:n.firstChild,o,s),Xi(a,e,s),e.props.children=null}function ea(e,n,r){var o,i,a,s,l=ot({},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?bn.call(arguments,2):r),hn(e.type,l,o||e.key,i||e.ref,null)}bn=zn.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}},Bi=0,Hi=function(e){return e!=null&&e.constructor===void 0},Mn.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ot({},this.state),typeof e=="function"&&(e=e(ot({},r),this.props)),e&&ot(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),Xo(this))},Mn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Xo(this))},Mn.prototype.render=Wn,It=[],Vi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Gi=function(e,n){return e.__v.__b-n.__v.__b},$n.__r=0,ar=Math.random().toString(8),jn="__d"+ar,mn="__a"+ar,Wi=/(PointerCapture)$|Capture$/i,Hr=0,jr=Qo(!1),Mr=Qo(!0);function ei(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 Hc(e){if(Array.isArray(e))return e}function Vc(e,n,r){return(n=Jc(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Gc(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function Wc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
255
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ti(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 qc(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?ti(Object(r),!0).forEach(function(o){Vc(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ti(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function Kc(e,n){return Hc(e)||Gc(e,n)||Xc(e,n)||Wc()}function Yc(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 Jc(e){var n=Yc(e,"string");return typeof n=="symbol"?n:n+""}function Un(e){"@babel/helpers - typeof";return Un=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},Un(e)}function Xc(e,n){if(e){if(typeof e=="string")return ei(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)?ei(e,n):void 0}}var Er=function(n){if(Un(n)!=="object")return n;var r=ea(n);if(r.props){var o;r.props=qc({},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(Er):Er(r.props.children))}return r},Zc=function(n){return Hi(ea(n))},Qc=function(n,r){delete r.__k,Bc(Er(n),r)};function ed(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 td=`.float-tooltip-kap {
251
256
  position: absolute;
252
257
  width: max-content; /* prevent shrinking near right edge */
253
258
  max-width: max(50%, 150px);
@@ -258,9 +263,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
258
263
  background: rgba(0,0,0,0.6);
259
264
  pointer-events: none;
260
265
  }
261
- `;Yc(Jc);var Xc=Ur({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&&Un(n)==="object"&&!!n.node&&typeof n.node=="function",l=wr(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(d){var h=Hc(d,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(d){r.mouseInside=!0;var h=Ga(d),m=l.node(),f=m.offsetWidth,p=m.offsetHeight,g=[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?p>130&&p-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(g.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):qc(n.content)?(n.tooltipEl.text(""),Kc(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 Zc(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,d=0,h=0,m=0;for(s=0;s<l;++s)u=o[s],d+=u.x||0,h+=u.y||0,m+=u.z||0;for(d=(d/l-e)*i,h=(h/l-n)*i,m=(m/l-r)*i,s=0;s<l;++s)u=o[s],d&&(u.x-=d),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 Qc(e){const n=+this._x.call(null,e);return Qi(this.cover(n),n,e)}function Qi(e,n,r){if(isNaN(n))return e;var o,i=e._root,a={data:r},s=e._x0,l=e._x1,u,d,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(d=+e._x.call(null,i.data),n===d)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=+(d>=u)));return o[f]=i,o[m]=a,e}function ed(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)Qi(this,r[a],e[a]);return this}function td(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 nd(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function rd(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function ht(e,n,r){this.node=e,this.x0=n,this.x1=r}function od(e,n){var r,o=this._x0,i,a,s=this._x1,l=[],u=this._root,d,h;for(u&&l.push(new ht(u,o,s)),n==null?n=1/0:(o=e-n,s=e+n);d=l.pop();)if(!(!(u=d.node)||(i=d.x0)>s||(a=d.x1)<o))if(u.length){var m=(i+a)/2;l.push(new ht(u[1],m,a),new ht(u[0],i,m)),(h=+(e>=m))&&(d=l[l.length-1],l[l.length-1]=l[l.length-1-h],l[l.length-1-h]=d)}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 id(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,d,h,m,f;if(!r)return this;if(r.length)for(;;){if((h=u>=(d=(s+l)/2))?s=d:l=d,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 ad(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function sd(){return this._root}function ld(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function cd(e){var n=[],r,o=this._root,i,a,s;for(o&&n.push(new ht(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 ht(i,l,s)),(i=o[0])&&n.push(new ht(i,a,l))}return this}function dd(e){var n=[],r=[],o;for(this._root&&n.push(new ht(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 ht(a,s,u)),(a=i[1])&&n.push(new ht(a,u,l))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.x1);return this}function ud(e){return e[0]}function fd(e){return arguments.length?(this._x=e,this):this._x}function ea(e,n){var r=new Wr(n??ud,NaN,NaN);return e==null?r:r.addAll(e)}function Wr(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function ti(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Oe=ea.prototype=Wr.prototype;Oe.copy=function(){var e=new Wr(this._x,this._x0,this._x1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=ti(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]=ti(o));return e};Oe.add=Qc;Oe.addAll=ed;Oe.cover=td;Oe.data=nd;Oe.extent=rd;Oe.find=od;Oe.remove=id;Oe.removeAll=ad;Oe.root=sd;Oe.size=ld;Oe.visit=cd;Oe.visitAfter=dd;Oe.x=fd;function md(e){const n=+this._x.call(null,e),r=+this._y.call(null,e),o=+this._z.call(null,e);return ta(this.cover(n,r,o),n,r,o,e)}function ta(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,d=e._y0,h=e._z0,m=e._x1,f=e._y1,p=e._z1,g,w,b,v,I,D,P,_,N,S,T;if(!s)return e._root=l,e;for(;s.length;)if((P=n>=(g=(u+m)/2))?u=g:m=g,(_=r>=(w=(d+f)/2))?d=w:f=w,(N=o>=(b=(h+p)/2))?h=b:p=b,a=s,!(s=s[S=N<<2|_<<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>=(g=(u+m)/2))?u=g:m=g,(_=r>=(w=(d+f)/2))?d=w:f=w,(N=o>=(b=(h+p)/2))?h=b:p=b;while((S=N<<2|_<<1|P)===(T=(D>=b)<<2|(I>=w)<<1|v>=g));return a[T]=s,a[S]=l,e}function hd(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,d=-1/0,h=-1/0;for(let m=0,f,p,g,w;m<n;++m)isNaN(p=+this._x.call(null,f=e[m]))||isNaN(g=+this._y.call(null,f))||isNaN(w=+this._z.call(null,f))||(r[m]=p,o[m]=g,i[m]=w,p<a&&(a=p),p>u&&(u=p),g<s&&(s=g),g>d&&(d=g),w<l&&(l=w),w>h&&(h=w));if(a>u||s>d||l>h)return this;this.cover(a,s,l).cover(u,d,h);for(let m=0;m<n;++m)ta(this,r[m],o[m],i[m],e[m]);return this}function pd(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 d=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,d*=2,f){case 0:s=o+d,l=i+d,u=a+d;break;case 1:o=s-d,l=i+d,u=a+d;break;case 2:s=o+d,i=l-d,u=a+d;break;case 3:o=s-d,i=l-d,u=a+d;break;case 4:s=o+d,l=i+d,a=u-d;break;case 5:o=s-d,l=i+d,a=u-d;break;case 6:s=o+d,i=l-d,a=u-d;break;case 7:o=s-d,i=l-d,a=u-d;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 gd(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function yd(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 ce(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 vd(e,n,r,o){var i,a=this._x0,s=this._y0,l=this._z0,u,d,h,m,f,p,g=this._x1,w=this._y1,b=this._z1,v=[],I=this._root,D,P;for(I&&v.push(new ce(I,a,s,l,g,w,b)),o==null?o=1/0:(a=e-o,s=n-o,l=r-o,g=e+o,w=n+o,b=r+o,o*=o);D=v.pop();)if(!(!(I=D.node)||(u=D.x0)>g||(d=D.y0)>w||(h=D.z0)>b||(m=D.x1)<a||(f=D.y1)<s||(p=D.z1)<l))if(I.length){var _=(u+m)/2,N=(d+f)/2,S=(h+p)/2;v.push(new ce(I[7],_,N,S,m,f,p),new ce(I[6],u,N,S,_,f,p),new ce(I[5],_,d,S,m,N,p),new ce(I[4],u,d,S,_,N,p),new ce(I[3],_,N,h,m,f,S),new ce(I[2],u,N,h,_,f,S),new ce(I[1],_,d,h,m,N,S),new ce(I[0],u,d,h,_,N,S)),(P=(r>=S)<<2|(n>=N)<<1|e>=_)&&(D=v[v.length-1],v[v.length-1]=v[v.length-1-P],v[v.length-1-P]=D)}else{var T=e-+this._x.call(null,I.data),$=n-+this._y.call(null,I.data),E=r-+this._z.call(null,I.data),R=T*T+$*$+E*E;if(R<o){var U=Math.sqrt(o=R);a=e-U,s=n-U,l=r-U,g=e+U,w=n+U,b=r+U,i=I.data}}return i}const bd=(e,n,r,o,i,a)=>Math.sqrt((e-o)**2+(n-i)**2+(r-a)**2);function xd(e,n,r,o){const i=[],a=e-o,s=n-o,l=r-o,u=e+o,d=n+o,h=r+o;return this.visit((m,f,p,g,w,b,v)=>{if(!m.length)do{const I=m.data;bd(e,n,r,this._x(I),this._y(I),this._z(I))<=o&&i.push(I)}while(m=m.next);return f>u||p>d||g>h||w<a||b<s||v<l}),i}function wd(e){if(isNaN(f=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e))||isNaN(g=+this._z.call(null,e)))return this;var n,r=this._root,o,i,a,s=this._x0,l=this._y0,u=this._z0,d=this._x1,h=this._y1,m=this._z1,f,p,g,w,b,v,I,D,P,_,N;if(!r)return this;if(r.length)for(;;){if((I=f>=(w=(s+d)/2))?s=w:d=w,(D=p>=(b=(l+h)/2))?l=b:h=b,(P=g>=(v=(u+m)/2))?u=v:m=v,n=r,!(r=r[_=P<<2|D<<1|I]))return this;if(!r.length)break;(n[_+1&7]||n[_+2&7]||n[_+3&7]||n[_+4&7]||n[_+5&7]||n[_+6&7]||n[_+7&7])&&(o=n,N=_)}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[_]=a:delete n[_],(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 _d(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function kd(){return this._root}function Id(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function Cd(e){var n=[],r,o=this._root,i,a,s,l,u,d,h;for(o&&n.push(new ce(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,d=r.y1,h=r.z1)&&o.length){var m=(a+u)/2,f=(s+d)/2,p=(l+h)/2;(i=o[7])&&n.push(new ce(i,m,f,p,u,d,h)),(i=o[6])&&n.push(new ce(i,a,f,p,m,d,h)),(i=o[5])&&n.push(new ce(i,m,s,p,u,f,h)),(i=o[4])&&n.push(new ce(i,a,s,p,m,f,h)),(i=o[3])&&n.push(new ce(i,m,f,l,u,d,p)),(i=o[2])&&n.push(new ce(i,a,f,l,m,d,p)),(i=o[1])&&n.push(new ce(i,m,s,l,u,f,p)),(i=o[0])&&n.push(new ce(i,a,s,l,m,f,p))}return this}function Sd(e){var n=[],r=[],o;for(this._root&&n.push(new ce(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,d=o.x1,h=o.y1,m=o.z1,f=(s+d)/2,p=(l+h)/2,g=(u+m)/2;(a=i[0])&&n.push(new ce(a,s,l,u,f,p,g)),(a=i[1])&&n.push(new ce(a,f,l,u,d,p,g)),(a=i[2])&&n.push(new ce(a,s,p,u,f,h,g)),(a=i[3])&&n.push(new ce(a,f,p,u,d,h,g)),(a=i[4])&&n.push(new ce(a,s,l,g,f,p,m)),(a=i[5])&&n.push(new ce(a,f,l,g,d,p,m)),(a=i[6])&&n.push(new ce(a,s,p,g,f,h,m)),(a=i[7])&&n.push(new ce(a,f,p,g,d,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 Dd(e){return e[0]}function Pd(e){return arguments.length?(this._x=e,this):this._x}function Nd(e){return e[1]}function Td(e){return arguments.length?(this._y=e,this):this._y}function Ad(e){return e[2]}function jd(e){return arguments.length?(this._z=e,this):this._z}function na(e,n,r,o){var i=new qr(n??Dd,r??Nd,o??Ad,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function qr(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 ni(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Ie=na.prototype=qr.prototype;Ie.copy=function(){var e=new qr(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=ni(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]=ni(o));return e};Ie.add=md;Ie.addAll=hd;Ie.cover=pd;Ie.data=gd;Ie.extent=yd;Ie.find=vd;Ie.findAllWithinRadius=xd;Ie.remove=wd;Ie.removeAll=_d;Ie.root=kd;Ie.size=Id;Ie.visit=Cd;Ie.visitAfter=Sd;Ie.x=Pd;Ie.y=Td;Ie.z=jd;function mt(e){return function(){return e}}function ft(e){return(e()-.5)*1e-6}function Md(e){return e.index}function ri(e,n){var r=e.get(n);if(!r)throw new Error("node not found: "+n);return r}function Ed(e){var n=Md,r=f,o,i=mt(30),a,s,l,u,d,h,m=1;e==null&&(e=[]);function f(v){return 1/Math.min(u[v.source.index],u[v.target.index])}function p(v){for(var I=0,D=e.length;I<m;++I)for(var P=0,_,N,S,T=0,$=0,E=0,R,U;P<D;++P)_=e[P],N=_.source,S=_.target,T=S.x+S.vx-N.x-N.vx||ft(h),l>1&&($=S.y+S.vy-N.y-N.vy||ft(h)),l>2&&(E=S.z+S.vz-N.z-N.vz||ft(h)),R=Math.sqrt(T*T+$*$+E*E),R=(R-a[P])/R*v*o[P],T*=R,$*=R,E*=R,S.vx-=T*(U=d[P]),l>1&&(S.vy-=$*U),l>2&&(S.vz-=E*U),N.vx+=T*(U=1-U),l>1&&(N.vy+=$*U),l>2&&(N.vz+=E*U)}function g(){if(s){var v,I=s.length,D=e.length,P=new Map(s.map((N,S)=>[n(N,S,s),N])),_;for(v=0,u=new Array(I);v<D;++v)_=e[v],_.index=v,typeof _.source!="object"&&(_.source=ri(P,_.source)),typeof _.target!="object"&&(_.target=ri(P,_.target)),u[_.source.index]=(u[_.source.index]||0)+1,u[_.target.index]=(u[_.target.index]||0)+1;for(v=0,d=new Array(D);v<D;++v)_=e[v],d[v]=u[_.source.index]/(u[_.source.index]+u[_.target.index]);o=new Array(D),w(),a=new Array(D),b()}}function w(){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 p.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,g()},p.links=function(v){return arguments.length?(e=v,g(),p):e},p.id=function(v){return arguments.length?(n=v,p):n},p.iterations=function(v){return arguments.length?(m=+v,p):m},p.strength=function(v){return arguments.length?(r=typeof v=="function"?v:mt(+v),w(),p):r},p.distance=function(v){return arguments.length?(i=typeof v=="function"?v:mt(+v),b(),p):i},p}const Od=1664525,Rd=1013904223,oi=4294967296;function Fd(){let e=1;return()=>(e=(Od*e+Rd)%oi)/oi}var ii=3;function ar(e){return e.x}function ai(e){return e.y}function Ld(e){return e.z}var zd=10,$d=Math.PI*(3-Math.sqrt(5)),Ud=Math.PI*20/(9+Math.sqrt(221));function Bd(e,n){n=n||2;var r=Math.min(ii,Math.max(1,Math.round(n))),o,i=1,a=.001,s=1-Math.pow(a,1/300),l=0,u=.6,d=new Map,h=Wa(p),m=qa("tick","end"),f=Fd();e==null&&(e=[]);function p(){g(),m.call("tick",o),i<a&&(h.stop(),m.call("end",o))}function g(v){var I,D=e.length,P;v===void 0&&(v=1);for(var _=0;_<v;++_)for(i+=(l-i)*s,d.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 w(){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=zd*(r>2?Math.cbrt(.5+v):r>1?Math.sqrt(.5+v):v),_=v*$d,N=v*Ud;r===1?D.x=P:r===2?(D.x=P*Math.cos(_),D.y=P*Math.sin(_)):(D.x=P*Math.sin(_)*Math.cos(N),D.y=P*Math.cos(_),D.z=P*Math.sin(_)*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 w(),o={tick:g,restart:function(){return h.restart(p),o},stop:function(){return h.stop(),o},numDimensions:function(v){return arguments.length?(r=Math.min(ii,Math.max(1,Math.round(v))),d.forEach(b),o):r},nodes:function(v){return arguments.length?(e=v,w(),d.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,d.forEach(b),o):f},force:function(v,I){return arguments.length>1?(I==null?d.delete(v):d.set(v,b(I)),o):d.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,_=v.shift()||1/0,N=0,S=e.length,T,$,E,R,U,H;for(_*=_,N=0;N<S;++N)U=e[N],T=I-U.x,$=D-(U.y||0),E=P-(U.z||0),R=T*T+$*$+E*E,R<_&&(H=U,_=R);return H},on:function(v,I){return arguments.length>1?(m.on(v,I),o):m.on(v)}}}function Hd(){var e,n,r,o,i,a=mt(-30),s,l=1,u=1/0,d=.81;function h(g){var w,b=e.length,v=(n===1?ea(e,ar):n===2?Ka(e,ar,ai):n===3?na(e,ar,ai,Ld):null).visitAfter(f);for(i=g,w=0;w<b;++w)r=e[w],v.visit(p)}function m(){if(e){var g,w=e.length,b;for(s=new Array(w),g=0;g<w;++g)b=e[g],s[b.index]=+a(b,g,e)}}function f(g){var w=0,b,v,I=0,D,P,_,N,S=g.length;if(S){for(D=P=_=N=0;N<S;++N)(b=g[N])&&(v=Math.abs(b.value))&&(w+=b.value,I+=v,D+=v*(b.x||0),P+=v*(b.y||0),_+=v*(b.z||0));w*=Math.sqrt(4/S),g.x=D/I,n>1&&(g.y=P/I),n>2&&(g.z=_/I)}else{b=g,b.x=b.data.x,n>1&&(b.y=b.data.y),n>2&&(b.z=b.data.z);do w+=s[b.data.index];while(b=b.next)}g.value=w}function p(g,w,b,v,I){if(!g.value)return!0;var D=[b,v,I][n-1],P=g.x-r.x,_=n>1?g.y-r.y:0,N=n>2?g.z-r.z:0,S=D-w,T=P*P+_*_+N*N;if(S*S/d<T)return T<u&&(P===0&&(P=ft(o),T+=P*P),n>1&&_===0&&(_=ft(o),T+=_*_),n>2&&N===0&&(N=ft(o),T+=N*N),T<l&&(T=Math.sqrt(l*T)),r.vx+=P*g.value*i/T,n>1&&(r.vy+=_*g.value*i/T),n>2&&(r.vz+=N*g.value*i/T)),!0;if(g.length||T>=u)return;(g.data!==r||g.next)&&(P===0&&(P=ft(o),T+=P*P),n>1&&_===0&&(_=ft(o),T+=_*_),n>2&&N===0&&(N=ft(o),T+=N*N),T<l&&(T=Math.sqrt(l*T)));do g.data!==r&&(S=s[g.data.index]*i/T,r.vx+=P*S,n>1&&(r.vy+=_*S),n>2&&(r.vz+=N*S));while(g=g.next)}return h.initialize=function(g,...w){e=g,o=w.find(b=>typeof b=="function")||Math.random,n=w.find(b=>[1,2,3].includes(b))||2,m()},h.strength=function(g){return arguments.length?(a=typeof g=="function"?g:mt(+g),m(),h):a},h.distanceMin=function(g){return arguments.length?(l=g*g,h):Math.sqrt(l)},h.distanceMax=function(g){return arguments.length?(u=g*g,h):Math.sqrt(u)},h.theta=function(g){return arguments.length?(d=g*g,h):Math.sqrt(d)},h}function Vd(e,n,r,o){var i,a,s=mt(.1),l,u;typeof e!="function"&&(e=mt(+e)),n==null&&(n=0),r==null&&(r=0),o==null&&(o=0);function d(m){for(var f=0,p=i.length;f<p;++f){var g=i[f],w=g.x-n||1e-6,b=(g.y||0)-r||1e-6,v=(g.z||0)-o||1e-6,I=Math.sqrt(w*w+b*b+v*v),D=(u[f]-I)*l[f]*m/I;g.vx+=w*D,a>1&&(g.vy+=b*D),a>2&&(g.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 d.initialize=function(m,...f){i=m,a=f.find(p=>[1,2,3].includes(p))||2,h()},d.strength=function(m){return arguments.length?(s=typeof m=="function"?m:mt(+m),h(),d):s},d.radius=function(m){return arguments.length?(e=typeof m=="function"?m:mt(+m),h(),d):e},d.x=function(m){return arguments.length?(n=+m,d):n},d.y=function(m){return arguments.length?(r=+m,d):r},d.z=function(m){return arguments.length?(o=+m,d):o},d}const{abs:an,cos:dt,sin:Yt,acos:Gd,atan2:sn,sqrt:vt,pow:Ue}=Math;function ln(e){return e<0?-Ue(-e,1/3):Ue(e,1/3)}const ra=Math.PI,Tn=2*ra,bt=ra/2,Wd=1e-6,sr=Number.MAX_SAFE_INTEGER||9007199254740991,lr=Number.MIN_SAFE_INTEGER||-9007199254740991,qd={x:0,y:0,z:0},z={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),vt(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,d,h,m,f=0;o===2?(a=[a[0],a[1],a[2],qd],d=l,h=i*e*2,m=u):o===3&&(d=l*i,h=l*e*3,m=i*u*3,f=e*u);const p={x:d*a[0].x+h*a[1].x+m*a[2].x+f*a[3].x,y:d*a[0].y+h*a[1].y+m*a[2].y+f*a[3].y,t:e};return r&&(p.z=d*a[0].z+h*a[1].z+m*a[2].z+f*a[3].z),p}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],d=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,d*=e*e,s.length===3)return m=l+u+d,{x:(l*s[0].x+u*s[1].x+d*s[2].x)/m,y:(l*s[0].y+u*s[1].y+d*s[2].y)/m,z:o?(l*s[0].z+u*s[1].z+d*s[2].z)/m:!1,t:e};if(l*=i,u*=1.5*i,d*=3*i,h*=e*e*e,s.length===4)return m=l+u+d+h,{x:(l*s[0].x+u*s[1].x+d*s[2].x+h*s[3].x)/m,y:(l*s[0].y+u*s[1].y+d*s[2].y+h*s[3].y)/m,z:o?(l*s[0].z+u*s[1].z+d*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||z.approximately(e,n)||z.approximately(e,r)},approximately:function(e,n,r){return an(e-n)<=(r||Wd)},length:function(e){const r=z.Tvalues.length;let o=0;for(let i=0,a;i<r;i++)a=.5*z.Tvalues[i]+.5,o+=z.Cvalues[i]*z.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(z.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 sn(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 vt(r*r+o*o)},closest:function(e,n){let r=Ue(2,63),o,i;return e.forEach(function(a,s){i=z.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=Ue(e,n)+Ue(1-e,n),o=r-1;return an(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=Ue(1-e,n),o=Ue(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),d=(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:d/h}},lli4:function(e,n,r,o){const i=e.x,a=e.y,s=n.x,l=n.y,u=r.x,d=r.y,h=o.x,m=o.y;return z.lli8(i,a,s,l,u,d,h,m)},lli:function(e,n){return z.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new de(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=sr,r=sr,o=lr,i=lr;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(!z.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(d){if(d.virtual)return;const h=u.intersects(d,i);h.length>0&&(h.c1=u,h.c2=d,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=z.makeline(n.points[o-1],e.points[0]),s=z.makeline(e.points[i-1],n.points[0]),l={startcap:a,forward:e,back:n,endcap:s,bbox:z.findbbox([a,e,n,s])};return l.intersections=function(u){return z.shapeintersections(l,l.bbox,u,u.bbox,r)},l},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let o=sr,i=lr,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=-sn(n.p2.y-o,n.p2.x-r),a=function(s){return{x:(s.x-r)*dt(i)-(s.y-o)*Yt(i),y:(s.x-r)*Yt(i)+(s.y-o)*dt(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=z.align(e,n),i=function(S){return 0<=S&&S<=1};if(r===2){const S=o[0].y,T=o[1].y,$=o[2].y,E=S-2*T+$;if(E!==0){const R=-vt(T*T-S*$),U=-S+T,H=-(R+U)/E,Y=-(-R+U)/E;return[H,Y].filter(i)}else if(T!==$&&E===0)return[(2*T-$)/(2*T-2*$)].filter(i);return[]}const a=o[0].y,s=o[1].y,l=o[2].y,u=o[3].y;let d=-a+3*s-3*l+u,h=3*a-6*s+3*l,m=-3*a+3*s,f=a;if(z.approximately(d,0)){if(z.approximately(h,0))return z.approximately(m,0)?[]:[-f/m].filter(i);const S=vt(m*m-4*h*f),T=2*h;return[(S-m)/T,(-m-S)/T].filter(i)}h/=d,m/=d,f/=d;const p=(3*m-h*h)/3,g=p/3,w=(2*h*h*h-9*h*m+27*f)/27,b=w/2,v=b*b+g*g*g;let I,D,P,_,N;if(v<0){const S=-p/3,T=S*S*S,$=vt(T),E=-w/(2*$),R=E<-1?-1:E>1?1:E,U=Gd(R),H=ln($),Y=2*H;return P=Y*dt(U/3)-h/3,_=Y*dt((U+Tn)/3)-h/3,N=Y*dt((U+2*Tn)/3)-h/3,[P,_,N].filter(i)}else{if(v===0)return I=b<0?ln(-b):-ln(b),P=2*I-h/3,_=-I-h/3,[P,_].filter(i);{const S=vt(v);return I=ln(-b+S),D=ln(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=-vt(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,d=0,h=0;const m=z.compute(e,n),f=z.compute(e,r),p=m.x*m.x+m.y*m.y;if(o?(a=vt(Ue(m.y*f.z-f.y*m.z,2)+Ue(m.z*f.x-f.z*m.x,2)+Ue(m.x*f.y-f.x*m.y,2)),s=Ue(p+m.z*m.z,3/2)):(a=m.x*f.y-m.y*f.x,s=Ue(p,3/2)),a===0||s===0)return{k:0,r:0};if(d=a/s,h=s/a,!i){const g=z.curvature(e-.001,n,r,o,!0).k,w=z.curvature(e+.001,n,r,o,!0).k;u=(w-d+(d-g))/2,l=(an(w-d)+an(d-g))/2}return{k:d,r:h,dk:u,adk:l}},inflections:function(e){if(e.length<4)return[];const n=z.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(z.approximately(s,0)){if(!z.approximately(l,0)){let f=-u/l;if(0<=f&&f<=1)return[f]}return[]}const d=2*s;if(z.approximately(d,0))return[];const h=l*l-4*s*u;if(h<0)return[];const m=Math.sqrt(h);return[(m-l)/d,-(l+m)/d].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,an(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),d=[{left:l.left,right:u.left},{left:l.left,right:u.right},{left:l.right,right:u.right},{left:l.right,right:u.left}];d=d.filter(function(m){return z.bboxoverlap(m.left.bbox(),m.right.bbox())});let h=[];return d.length===0||(d.forEach(function(m){h=h.concat(z.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*dt(bt)-i*Yt(bt),u=o*Yt(bt)+i*dt(bt),d=a*dt(bt)-s*Yt(bt),h=a*Yt(bt)+s*dt(bt),m=(e.x+n.x)/2,f=(e.y+n.y)/2,p=(n.x+r.x)/2,g=(n.y+r.y)/2,w=m+l,b=f+u,v=p+d,I=g+h,D=z.lli8(m,f,w,b,p,g,v,I),P=z.dist(D,e);let _=sn(e.y-D.y,e.x-D.x),N=sn(n.y-D.y,n.x-D.x),S=sn(r.y-D.y,r.x-D.x),T;return _<S?((_>N||N>S)&&(_+=Tn),_>S&&(T=S,S=_,_=T)):S<N&&N<_?(T=S,S=_,_=T):S+=Tn,D.s=_,D.e=S,D.r=P,D},numberSort:function(e,n){return e-n}};class pn{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 z.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++)z.expandbox(r,n[o].bbox());return r}offset(n){const r=[];return this.curves.forEach(function(o){r.push(...o.offset(n))}),new pn(r)}}const{abs:cn,min:si,max:li,cos:Kd,sin:Yd,acos:Jd,sqrt:dn}=Math,Xd=Math.PI;class de{constructor(n){let r=n&&n.forEach?n:Array.from(arguments).slice(),o=!1;if(typeof r[0]=="object"){o=r.length;const p=[];r.forEach(function(g){["x","y","z"].forEach(function(w){typeof g[w]<"u"&&p.push(g[w])})}),r=p}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 p=0,g=s?3:2;p<a;p+=g){var u={x:r[p],y:r[p+1]};s&&(u.z=r[p+2]),l.push(u)}const d=this.order=l.length-1,h=this.dims=["x","y"];s&&h.push("z"),this.dimlen=h.length;const m=z.align(l,{p1:l[0],p2:l[d]}),f=z.dist(l[0],l[d]);this._linear=m.reduce((p,g)=>p+cn(g.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 de(r,r,o);if(i===1)return new de(n,r,r);const a=de.getABC(2,n,r,o,i);return new de(n,a.A,o)}static cubicFromPoints(n,r,o,i,a){typeof i>"u"&&(i=.5);const s=de.getABC(3,n,r,o,i);typeof a>"u"&&(a=z.dist(r,s.C));const l=a*(1-i)/i,u=z.dist(n,o),d=(o.x-n.x)/u,h=(o.y-n.y)/u,m=a*d,f=a*h,p=l*d,g=l*h,w={x:r.x-m,y:r.y-f},b={x:r.x+p,y:r.y+g},v=s.A,I={x:v.x+(w.x-v.x)/(1-i),y:v.y+(w.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:o.x+(D.x-o.x)/(1-i),y:o.y+(D.y-o.y)/(1-i)};return new de(n,P,_,o)}static getUtils(){return z}getUtils(){return de.getUtils()}static get PolyBezier(){return pn}valueOf(){return this.toString()}toString(){return z.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=z.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,r=z.angle(n[0],n[this.order],n[1]);this.clockwise=r>0}length(){return z.length(this.derivative.bind(this))}static getABC(n=2,r,o,i,a=.5){const s=z.projectionratio(a,n),l=1-s,u={x:s*r.x+l*i.x,y:s*r.y+l*i.y},d=z.abcratio(a,n);return{A:{x:o.x+(o.x-u.x)/d,y:o.y+(o.y-u.y)/d},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 de.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],z.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=z.closest(r,n),a=i.mpos,s=(a-1)/o,l=(a+1)/o,u=.1/o;let d=i.mdist,h=s,m=h,f;d+=1;for(let p;h<l+u;h+=u)f=this.compute(h),p=z.dist(n,f),p<d&&(d=p,m=h);return m=m<0?0:m>1?1:m,f=this.compute(m),f.t=m,f.d=d,f}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?z.computeWithRatios(n,this.points,this.ratios,this._3d):z.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 de(r)}derivative(n){return z.compute(n,this.dpoints[0],this._3d)}dderivative(n){return z.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new de(z.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return z.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return z.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const r=this.derivative(n),o=dn(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=dn(r.x*r.x+r.y*r.y+r.z*r.z),a=dn(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=dn(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=z.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 de([o[0],o[3],o[5]]):new de([o[0],o[4],o[7],o[9]]),right:this.order===2?new de([o[5],o[4],o[2]]):new de([o[9],o[8],o[6],o[3]]),span:o};return i.left._t1=z.map(0,0,1,this._t1,this._t2),i.left._t2=z.map(n,0,1,this._t1,this._t2),i.right._t1=z.map(n,0,1,this._t1,this._t2),i.right._t2=z.map(1,0,1,this._t1,this._t2),r?(r=z.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]=z.droots(a),this.order===3&&(a=this.dpoints[1].map(i),n[o]=n[o].concat(z.droots(a))),n[o]=n[o].filter(function(s){return s>=0&&s<=1}),r=r.concat(n[o].sort(z.numberSort))}).bind(this)),n.values=r.sort(z.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]=z.getminmax(this,o,n[o])}).bind(this)),r}overlaps(n){const r=this.bbox(),o=n.bbox();return z.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 de(i)]}return this.reduce().map(function(o){return o._linear?o.offset(n)[0]:o.scale(n)})}simple(){if(this.order===3){const i=z.angle(this.points[0],this.points[3],this.points[1]),a=z.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),cn(Jd(o))<Xd/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(d){for(r=0,o=0;o<=1;)for(o=r+i;o<=1+i;o+=i)if(a=d.split(r,o),!a.simple()){if(o-=i,cn(r-o)<i)return[];a=d.split(r,o),a._t1=z.map(r,0,1,d._t1,d._t2),a._t2=z.map(o,0,1,d._t1,d._t2),l.push(a),r=o;break}r<1&&(a=d.split(r,1),a._t1=z.map(r,0,1,d._t1,d._t2),a._t2=d._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 de(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)],d=[],h=z.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=d[m*r]=z.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],p={x:f.x-h.x,y:f.y-h.y},g=o?o((m+1)/r):n;o&&!i&&(g=-g);var w=dn(p.x*p.x+p.y*p.y);p.x/=w,p.y/=w,d[m+1]={x:f.x+g*p.x,y:f.y+g*p.y}}}),new de(d)):([0,1].forEach(m=>{if(r===2&&m)return;const f=d[m*r],p=this.derivative(m),g={x:f.x+p.x,y:f.y+p.y};d[m+1]=z.lli4(f,g,h,a[m+1])}),new de(d))}outline(n,r,o,i){if(r=r===void 0?n:r,this._linear){const _=this.normal(0),N=this.points[0],S=this.points[this.points.length-1];let T,$,E;o===void 0&&(o=n,i=r),T={x:N.x+_.x*n,y:N.y+_.y*n},E={x:S.x+_.x*o,y:S.y+_.y*o},$={x:(T.x+E.x)/2,y:(T.y+E.y)/2};const R=[T,$,E];T={x:N.x-_.x*r,y:N.y-_.y*r},E={x:S.x-_.x*i,y:S.y-_.y*i},$={x:(T.x+E.x)/2,y:(T.y+E.y)/2};const U=[E,$,T],H=z.makeline(U[2],R[0]),Y=z.makeline(R[2],U[0]),te=[H,new de(R),Y,new de(U)];return new pn(te)}const a=this.reduce(),s=a.length,l=[];let u=[],d,h=0,m=this.length();const f=typeof o<"u"&&typeof i<"u";function p(_,N,S,T,$){return function(E){const R=T/S,U=(T+$)/S,H=N-_;return z.map(E,0,1,_+R*H,_+U*H)}}a.forEach(function(_){const N=_.length();f?(l.push(_.scale(p(n,o,m,h,N))),u.push(_.scale(p(-r,-i,m,h,N)))):(l.push(_.scale(n)),u.push(_.scale(-r))),h+=N}),u=u.map(function(_){return d=_.points,d[3]?_.points=[d[3],d[2],d[1],d[0]]:_.points=[d[2],d[1],d[0]],_}).reverse();const g=l[0].points[0],w=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=z.makeline(b,g),D=z.makeline(w,v),P=[I].concat(l).concat([D]).concat(u);return new pn(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=z.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 de&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(n){const r=si(n.p1.x,n.p2.x),o=si(n.p1.y,n.p2.y),i=li(n.p1.x,n.p2.x),a=li(n.p1.y,n.p2.y);return z.roots(this.points,n).filter(s=>{var l=this.get(s);return z.between(l.x,r,i)&&z.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=z.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=z.dist(n,r),d=z.dist(n,s),h=z.dist(n,l);return cn(d-u)+cn(h-u)}_iterate(n,r){let o=0,i=1,a;do{a=0,i=1;let s=this.get(o),l,u,d,h,m=!1,f=!1,p,g=i,w=1;do if(f=m,h=d,g=(o+i)/2,l=this.get(g),u=this.get(i),d=z.getccenter(s,l,u),d.interval={start:o,end:i},m=this._error(d,s,o,i)<=n,p=f&&!m,p||(w=i),m){if(i>=1){if(d.interval.end=w=1,h=d,i>1){let v={x:d.x+d.r*Kd(d.e),y:d.y+d.r*Yd(d.e)};d.e+=z.angle({x:d.x,y:d.y},v,this.get(1))}break}i=i+(i-o)/2}else i=g;while(!p&&a++<100);if(a>=100)break;h=h||d,r.push(h),o=w}while(i<1);return r}}function Er(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 Zd(e){if(Array.isArray(e))return e}function Qd(e){if(Array.isArray(e))return Er(e)}function eu(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tu(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function nu(){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 ru(){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 ou(e,n){if(e==null)return{};var r,o,i=iu(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 iu(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 au(e,n){return Zd(e)||tu(e,n)||oa(e,n)||nu()}function su(e){return Qd(e)||eu(e)||oa(e)||ru()}function lu(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 cu(e){var n=lu(e,"string");return typeof n=="symbol"?n:n+""}function oa(e,n){if(e){if(typeof e=="string")return Er(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)?Er(e,n):void 0}}var du=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 d=l,h=u;return i.forEach(function(m,f){var p=m.keyAccessor,g=m.isProp,w;if(g){var b=h,v=b[p],I=ou(b,[p].map(cu));w=v,h=I}else w=p(h,f);f+1<i.length?(d.hasOwnProperty(w)||(d[w]={}),d=d[w]):r?(d.hasOwnProperty(w)||(d[w]=[]),d[w].push(h)):d[w]=h}),l},{});r instanceof Function&&function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;d===i.length?Object.keys(u).forEach(function(h){return u[h]=r(u[h])}):Object.values(u).forEach(function(h){return l(h,d+1)})}(a);var s=a;return o&&(s=[],function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];d.length===i.length?s.push({keys:d,vals:u}):Object.entries(u).forEach(function(h){var m=au(h,2),f=m[0],p=m[1];return l(p,[].concat(su(d),[f]))})}(a),n instanceof Array&&n.length===0&&s.length===1&&(s[0].keys=[])),s};function uu(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 fu=`.force-graph-container canvas {
266
+ `;ed(td);var nd=Br({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&&Un(n)==="object"&&!!n.node&&typeof n.node=="function",l=_r(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(d){var h=Kc(d,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(d){r.mouseInside=!0;var h=Ka(d),m=l.node(),f=m.offsetWidth,p=m.offsetHeight,g=[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?p>130&&p-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(g.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):Zc(n.content)?(n.tooltipEl.text(""),Qc(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 rd(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,d=0,h=0,m=0;for(s=0;s<l;++s)u=o[s],d+=u.x||0,h+=u.y||0,m+=u.z||0;for(d=(d/l-e)*i,h=(h/l-n)*i,m=(m/l-r)*i,s=0;s<l;++s)u=o[s],d&&(u.x-=d),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 od(e){const n=+this._x.call(null,e);return ta(this.cover(n),n,e)}function ta(e,n,r){if(isNaN(n))return e;var o,i=e._root,a={data:r},s=e._x0,l=e._x1,u,d,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(d=+e._x.call(null,i.data),n===d)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=+(d>=u)));return o[f]=i,o[m]=a,e}function id(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)ta(this,r[a],e[a]);return this}function ad(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 sd(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function ld(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function pt(e,n,r){this.node=e,this.x0=n,this.x1=r}function cd(e,n){var r,o=this._x0,i,a,s=this._x1,l=[],u=this._root,d,h;for(u&&l.push(new pt(u,o,s)),n==null?n=1/0:(o=e-n,s=e+n);d=l.pop();)if(!(!(u=d.node)||(i=d.x0)>s||(a=d.x1)<o))if(u.length){var m=(i+a)/2;l.push(new pt(u[1],m,a),new pt(u[0],i,m)),(h=+(e>=m))&&(d=l[l.length-1],l[l.length-1]=l[l.length-1-h],l[l.length-1-h]=d)}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 dd(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,d,h,m,f;if(!r)return this;if(r.length)for(;;){if((h=u>=(d=(s+l)/2))?s=d:l=d,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 ud(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function fd(){return this._root}function md(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function hd(e){var n=[],r,o=this._root,i,a,s;for(o&&n.push(new pt(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 pt(i,l,s)),(i=o[0])&&n.push(new pt(i,a,l))}return this}function pd(e){var n=[],r=[],o;for(this._root&&n.push(new pt(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 pt(a,s,u)),(a=i[1])&&n.push(new pt(a,u,l))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.x1);return this}function gd(e){return e[0]}function yd(e){return arguments.length?(this._x=e,this):this._x}function na(e,n){var r=new qr(n??gd,NaN,NaN);return e==null?r:r.addAll(e)}function qr(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function ni(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Re=na.prototype=qr.prototype;Re.copy=function(){var e=new qr(this._x,this._x0,this._x1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=ni(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]=ni(o));return e};Re.add=od;Re.addAll=id;Re.cover=ad;Re.data=sd;Re.extent=ld;Re.find=cd;Re.remove=dd;Re.removeAll=ud;Re.root=fd;Re.size=md;Re.visit=hd;Re.visitAfter=pd;Re.x=yd;function vd(e){const n=+this._x.call(null,e),r=+this._y.call(null,e),o=+this._z.call(null,e);return ra(this.cover(n,r,o),n,r,o,e)}function ra(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,d=e._y0,h=e._z0,m=e._x1,f=e._y1,p=e._z1,g,w,b,v,I,D,N,_,P,S,T;if(!s)return e._root=l,e;for(;s.length;)if((N=n>=(g=(u+m)/2))?u=g:m=g,(_=r>=(w=(d+f)/2))?d=w:f=w,(P=o>=(b=(h+p)/2))?h=b:p=b,a=s,!(s=s[S=P<<2|_<<1|N]))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),(N=n>=(g=(u+m)/2))?u=g:m=g,(_=r>=(w=(d+f)/2))?d=w:f=w,(P=o>=(b=(h+p)/2))?h=b:p=b;while((S=P<<2|_<<1|N)===(T=(D>=b)<<2|(I>=w)<<1|v>=g));return a[T]=s,a[S]=l,e}function bd(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,d=-1/0,h=-1/0;for(let m=0,f,p,g,w;m<n;++m)isNaN(p=+this._x.call(null,f=e[m]))||isNaN(g=+this._y.call(null,f))||isNaN(w=+this._z.call(null,f))||(r[m]=p,o[m]=g,i[m]=w,p<a&&(a=p),p>u&&(u=p),g<s&&(s=g),g>d&&(d=g),w<l&&(l=w),w>h&&(h=w));if(a>u||s>d||l>h)return this;this.cover(a,s,l).cover(u,d,h);for(let m=0;m<n;++m)ra(this,r[m],o[m],i[m],e[m]);return this}function xd(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 d=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,d*=2,f){case 0:s=o+d,l=i+d,u=a+d;break;case 1:o=s-d,l=i+d,u=a+d;break;case 2:s=o+d,i=l-d,u=a+d;break;case 3:o=s-d,i=l-d,u=a+d;break;case 4:s=o+d,l=i+d,a=u-d;break;case 5:o=s-d,l=i+d,a=u-d;break;case 6:s=o+d,i=l-d,a=u-d;break;case 7:o=s-d,i=l-d,a=u-d;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 wd(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function _d(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 ce(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 kd(e,n,r,o){var i,a=this._x0,s=this._y0,l=this._z0,u,d,h,m,f,p,g=this._x1,w=this._y1,b=this._z1,v=[],I=this._root,D,N;for(I&&v.push(new ce(I,a,s,l,g,w,b)),o==null?o=1/0:(a=e-o,s=n-o,l=r-o,g=e+o,w=n+o,b=r+o,o*=o);D=v.pop();)if(!(!(I=D.node)||(u=D.x0)>g||(d=D.y0)>w||(h=D.z0)>b||(m=D.x1)<a||(f=D.y1)<s||(p=D.z1)<l))if(I.length){var _=(u+m)/2,P=(d+f)/2,S=(h+p)/2;v.push(new ce(I[7],_,P,S,m,f,p),new ce(I[6],u,P,S,_,f,p),new ce(I[5],_,d,S,m,P,p),new ce(I[4],u,d,S,_,P,p),new ce(I[3],_,P,h,m,f,S),new ce(I[2],u,P,h,_,f,S),new ce(I[1],_,d,h,m,P,S),new ce(I[0],u,d,h,_,P,S)),(N=(r>=S)<<2|(n>=P)<<1|e>=_)&&(D=v[v.length-1],v[v.length-1]=v[v.length-1-N],v[v.length-1-N]=D)}else{var T=e-+this._x.call(null,I.data),$=n-+this._y.call(null,I.data),O=r-+this._z.call(null,I.data),R=T*T+$*$+O*O;if(R<o){var U=Math.sqrt(o=R);a=e-U,s=n-U,l=r-U,g=e+U,w=n+U,b=r+U,i=I.data}}return i}const Id=(e,n,r,o,i,a)=>Math.sqrt((e-o)**2+(n-i)**2+(r-a)**2);function Cd(e,n,r,o){const i=[],a=e-o,s=n-o,l=r-o,u=e+o,d=n+o,h=r+o;return this.visit((m,f,p,g,w,b,v)=>{if(!m.length)do{const I=m.data;Id(e,n,r,this._x(I),this._y(I),this._z(I))<=o&&i.push(I)}while(m=m.next);return f>u||p>d||g>h||w<a||b<s||v<l}),i}function Sd(e){if(isNaN(f=+this._x.call(null,e))||isNaN(p=+this._y.call(null,e))||isNaN(g=+this._z.call(null,e)))return this;var n,r=this._root,o,i,a,s=this._x0,l=this._y0,u=this._z0,d=this._x1,h=this._y1,m=this._z1,f,p,g,w,b,v,I,D,N,_,P;if(!r)return this;if(r.length)for(;;){if((I=f>=(w=(s+d)/2))?s=w:d=w,(D=p>=(b=(l+h)/2))?l=b:h=b,(N=g>=(v=(u+m)/2))?u=v:m=v,n=r,!(r=r[_=N<<2|D<<1|I]))return this;if(!r.length)break;(n[_+1&7]||n[_+2&7]||n[_+3&7]||n[_+4&7]||n[_+5&7]||n[_+6&7]||n[_+7&7])&&(o=n,P=_)}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[_]=a:delete n[_],(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[P]=r:this._root=r),this):(this._root=a,this)}function Dd(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function Nd(){return this._root}function Pd(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function Td(e){var n=[],r,o=this._root,i,a,s,l,u,d,h;for(o&&n.push(new ce(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,d=r.y1,h=r.z1)&&o.length){var m=(a+u)/2,f=(s+d)/2,p=(l+h)/2;(i=o[7])&&n.push(new ce(i,m,f,p,u,d,h)),(i=o[6])&&n.push(new ce(i,a,f,p,m,d,h)),(i=o[5])&&n.push(new ce(i,m,s,p,u,f,h)),(i=o[4])&&n.push(new ce(i,a,s,p,m,f,h)),(i=o[3])&&n.push(new ce(i,m,f,l,u,d,p)),(i=o[2])&&n.push(new ce(i,a,f,l,m,d,p)),(i=o[1])&&n.push(new ce(i,m,s,l,u,f,p)),(i=o[0])&&n.push(new ce(i,a,s,l,m,f,p))}return this}function Ad(e){var n=[],r=[],o;for(this._root&&n.push(new ce(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,d=o.x1,h=o.y1,m=o.z1,f=(s+d)/2,p=(l+h)/2,g=(u+m)/2;(a=i[0])&&n.push(new ce(a,s,l,u,f,p,g)),(a=i[1])&&n.push(new ce(a,f,l,u,d,p,g)),(a=i[2])&&n.push(new ce(a,s,p,u,f,h,g)),(a=i[3])&&n.push(new ce(a,f,p,u,d,h,g)),(a=i[4])&&n.push(new ce(a,s,l,g,f,p,m)),(a=i[5])&&n.push(new ce(a,f,l,g,d,p,m)),(a=i[6])&&n.push(new ce(a,s,p,g,f,h,m)),(a=i[7])&&n.push(new ce(a,f,p,g,d,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 jd(e){return e[0]}function Md(e){return arguments.length?(this._x=e,this):this._x}function Ed(e){return e[1]}function Od(e){return arguments.length?(this._y=e,this):this._y}function Rd(e){return e[2]}function Fd(e){return arguments.length?(this._z=e,this):this._z}function oa(e,n,r,o){var i=new Kr(n??jd,r??Ed,o??Rd,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Kr(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 ri(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Ie=oa.prototype=Kr.prototype;Ie.copy=function(){var e=new Kr(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=ri(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]=ri(o));return e};Ie.add=vd;Ie.addAll=bd;Ie.cover=xd;Ie.data=wd;Ie.extent=_d;Ie.find=kd;Ie.findAllWithinRadius=Cd;Ie.remove=Sd;Ie.removeAll=Dd;Ie.root=Nd;Ie.size=Pd;Ie.visit=Td;Ie.visitAfter=Ad;Ie.x=Md;Ie.y=Od;Ie.z=Fd;function ht(e){return function(){return e}}function mt(e){return(e()-.5)*1e-6}function Ld(e){return e.index}function oi(e,n){var r=e.get(n);if(!r)throw new Error("node not found: "+n);return r}function zd(e){var n=Ld,r=f,o,i=ht(30),a,s,l,u,d,h,m=1;e==null&&(e=[]);function f(v){return 1/Math.min(u[v.source.index],u[v.target.index])}function p(v){for(var I=0,D=e.length;I<m;++I)for(var N=0,_,P,S,T=0,$=0,O=0,R,U;N<D;++N)_=e[N],P=_.source,S=_.target,T=S.x+S.vx-P.x-P.vx||mt(h),l>1&&($=S.y+S.vy-P.y-P.vy||mt(h)),l>2&&(O=S.z+S.vz-P.z-P.vz||mt(h)),R=Math.sqrt(T*T+$*$+O*O),R=(R-a[N])/R*v*o[N],T*=R,$*=R,O*=R,S.vx-=T*(U=d[N]),l>1&&(S.vy-=$*U),l>2&&(S.vz-=O*U),P.vx+=T*(U=1-U),l>1&&(P.vy+=$*U),l>2&&(P.vz+=O*U)}function g(){if(s){var v,I=s.length,D=e.length,N=new Map(s.map((P,S)=>[n(P,S,s),P])),_;for(v=0,u=new Array(I);v<D;++v)_=e[v],_.index=v,typeof _.source!="object"&&(_.source=oi(N,_.source)),typeof _.target!="object"&&(_.target=oi(N,_.target)),u[_.source.index]=(u[_.source.index]||0)+1,u[_.target.index]=(u[_.target.index]||0)+1;for(v=0,d=new Array(D);v<D;++v)_=e[v],d[v]=u[_.source.index]/(u[_.source.index]+u[_.target.index]);o=new Array(D),w(),a=new Array(D),b()}}function w(){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 p.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,g()},p.links=function(v){return arguments.length?(e=v,g(),p):e},p.id=function(v){return arguments.length?(n=v,p):n},p.iterations=function(v){return arguments.length?(m=+v,p):m},p.strength=function(v){return arguments.length?(r=typeof v=="function"?v:ht(+v),w(),p):r},p.distance=function(v){return arguments.length?(i=typeof v=="function"?v:ht(+v),b(),p):i},p}const $d=1664525,Ud=1013904223,ii=4294967296;function Bd(){let e=1;return()=>(e=($d*e+Ud)%ii)/ii}var ai=3;function sr(e){return e.x}function si(e){return e.y}function Hd(e){return e.z}var Vd=10,Gd=Math.PI*(3-Math.sqrt(5)),Wd=Math.PI*20/(9+Math.sqrt(221));function qd(e,n){n=n||2;var r=Math.min(ai,Math.max(1,Math.round(n))),o,i=1,a=.001,s=1-Math.pow(a,1/300),l=0,u=.6,d=new Map,h=Ya(p),m=Ja("tick","end"),f=Bd();e==null&&(e=[]);function p(){g(),m.call("tick",o),i<a&&(h.stop(),m.call("end",o))}function g(v){var I,D=e.length,N;v===void 0&&(v=1);for(var _=0;_<v;++_)for(i+=(l-i)*s,d.forEach(function(P){P(i)}),I=0;I<D;++I)N=e[I],N.fx==null?N.x+=N.vx*=u:(N.x=N.fx,N.vx=0),r>1&&(N.fy==null?N.y+=N.vy*=u:(N.y=N.fy,N.vy=0)),r>2&&(N.fz==null?N.z+=N.vz*=u:(N.z=N.fz,N.vz=0));return o}function w(){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 N=Vd*(r>2?Math.cbrt(.5+v):r>1?Math.sqrt(.5+v):v),_=v*Gd,P=v*Wd;r===1?D.x=N:r===2?(D.x=N*Math.cos(_),D.y=N*Math.sin(_)):(D.x=N*Math.sin(_)*Math.cos(P),D.y=N*Math.cos(_),D.z=N*Math.sin(_)*Math.sin(P))}(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 w(),o={tick:g,restart:function(){return h.restart(p),o},stop:function(){return h.stop(),o},numDimensions:function(v){return arguments.length?(r=Math.min(ai,Math.max(1,Math.round(v))),d.forEach(b),o):r},nodes:function(v){return arguments.length?(e=v,w(),d.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,d.forEach(b),o):f},force:function(v,I){return arguments.length>1?(I==null?d.delete(v):d.set(v,b(I)),o):d.get(v)},find:function(){var v=Array.prototype.slice.call(arguments),I=v.shift()||0,D=(r>1?v.shift():null)||0,N=(r>2?v.shift():null)||0,_=v.shift()||1/0,P=0,S=e.length,T,$,O,R,U,V;for(_*=_,P=0;P<S;++P)U=e[P],T=I-U.x,$=D-(U.y||0),O=N-(U.z||0),R=T*T+$*$+O*O,R<_&&(V=U,_=R);return V},on:function(v,I){return arguments.length>1?(m.on(v,I),o):m.on(v)}}}function Kd(){var e,n,r,o,i,a=ht(-30),s,l=1,u=1/0,d=.81;function h(g){var w,b=e.length,v=(n===1?na(e,sr):n===2?Xa(e,sr,si):n===3?oa(e,sr,si,Hd):null).visitAfter(f);for(i=g,w=0;w<b;++w)r=e[w],v.visit(p)}function m(){if(e){var g,w=e.length,b;for(s=new Array(w),g=0;g<w;++g)b=e[g],s[b.index]=+a(b,g,e)}}function f(g){var w=0,b,v,I=0,D,N,_,P,S=g.length;if(S){for(D=N=_=P=0;P<S;++P)(b=g[P])&&(v=Math.abs(b.value))&&(w+=b.value,I+=v,D+=v*(b.x||0),N+=v*(b.y||0),_+=v*(b.z||0));w*=Math.sqrt(4/S),g.x=D/I,n>1&&(g.y=N/I),n>2&&(g.z=_/I)}else{b=g,b.x=b.data.x,n>1&&(b.y=b.data.y),n>2&&(b.z=b.data.z);do w+=s[b.data.index];while(b=b.next)}g.value=w}function p(g,w,b,v,I){if(!g.value)return!0;var D=[b,v,I][n-1],N=g.x-r.x,_=n>1?g.y-r.y:0,P=n>2?g.z-r.z:0,S=D-w,T=N*N+_*_+P*P;if(S*S/d<T)return T<u&&(N===0&&(N=mt(o),T+=N*N),n>1&&_===0&&(_=mt(o),T+=_*_),n>2&&P===0&&(P=mt(o),T+=P*P),T<l&&(T=Math.sqrt(l*T)),r.vx+=N*g.value*i/T,n>1&&(r.vy+=_*g.value*i/T),n>2&&(r.vz+=P*g.value*i/T)),!0;if(g.length||T>=u)return;(g.data!==r||g.next)&&(N===0&&(N=mt(o),T+=N*N),n>1&&_===0&&(_=mt(o),T+=_*_),n>2&&P===0&&(P=mt(o),T+=P*P),T<l&&(T=Math.sqrt(l*T)));do g.data!==r&&(S=s[g.data.index]*i/T,r.vx+=N*S,n>1&&(r.vy+=_*S),n>2&&(r.vz+=P*S));while(g=g.next)}return h.initialize=function(g,...w){e=g,o=w.find(b=>typeof b=="function")||Math.random,n=w.find(b=>[1,2,3].includes(b))||2,m()},h.strength=function(g){return arguments.length?(a=typeof g=="function"?g:ht(+g),m(),h):a},h.distanceMin=function(g){return arguments.length?(l=g*g,h):Math.sqrt(l)},h.distanceMax=function(g){return arguments.length?(u=g*g,h):Math.sqrt(u)},h.theta=function(g){return arguments.length?(d=g*g,h):Math.sqrt(d)},h}function Yd(e,n,r,o){var i,a,s=ht(.1),l,u;typeof e!="function"&&(e=ht(+e)),n==null&&(n=0),r==null&&(r=0),o==null&&(o=0);function d(m){for(var f=0,p=i.length;f<p;++f){var g=i[f],w=g.x-n||1e-6,b=(g.y||0)-r||1e-6,v=(g.z||0)-o||1e-6,I=Math.sqrt(w*w+b*b+v*v),D=(u[f]-I)*l[f]*m/I;g.vx+=w*D,a>1&&(g.vy+=b*D),a>2&&(g.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 d.initialize=function(m,...f){i=m,a=f.find(p=>[1,2,3].includes(p))||2,h()},d.strength=function(m){return arguments.length?(s=typeof m=="function"?m:ht(+m),h(),d):s},d.radius=function(m){return arguments.length?(e=typeof m=="function"?m:ht(+m),h(),d):e},d.x=function(m){return arguments.length?(n=+m,d):n},d.y=function(m){return arguments.length?(r=+m,d):r},d.z=function(m){return arguments.length?(o=+m,d):o},d}const{abs:an,cos:ut,sin:Yt,acos:Jd,atan2:sn,sqrt:wt,pow:Ue}=Math;function ln(e){return e<0?-Ue(-e,1/3):Ue(e,1/3)}const ia=Math.PI,Tn=2*ia,_t=ia/2,Xd=1e-6,lr=Number.MAX_SAFE_INTEGER||9007199254740991,cr=Number.MIN_SAFE_INTEGER||-9007199254740991,Zd={x:0,y:0,z:0},z={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),wt(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,d,h,m,f=0;o===2?(a=[a[0],a[1],a[2],Zd],d=l,h=i*e*2,m=u):o===3&&(d=l*i,h=l*e*3,m=i*u*3,f=e*u);const p={x:d*a[0].x+h*a[1].x+m*a[2].x+f*a[3].x,y:d*a[0].y+h*a[1].y+m*a[2].y+f*a[3].y,t:e};return r&&(p.z=d*a[0].z+h*a[1].z+m*a[2].z+f*a[3].z),p}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],d=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,d*=e*e,s.length===3)return m=l+u+d,{x:(l*s[0].x+u*s[1].x+d*s[2].x)/m,y:(l*s[0].y+u*s[1].y+d*s[2].y)/m,z:o?(l*s[0].z+u*s[1].z+d*s[2].z)/m:!1,t:e};if(l*=i,u*=1.5*i,d*=3*i,h*=e*e*e,s.length===4)return m=l+u+d+h,{x:(l*s[0].x+u*s[1].x+d*s[2].x+h*s[3].x)/m,y:(l*s[0].y+u*s[1].y+d*s[2].y+h*s[3].y)/m,z:o?(l*s[0].z+u*s[1].z+d*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||z.approximately(e,n)||z.approximately(e,r)},approximately:function(e,n,r){return an(e-n)<=(r||Xd)},length:function(e){const r=z.Tvalues.length;let o=0;for(let i=0,a;i<r;i++)a=.5*z.Tvalues[i]+.5,o+=z.Cvalues[i]*z.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(z.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 sn(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 wt(r*r+o*o)},closest:function(e,n){let r=Ue(2,63),o,i;return e.forEach(function(a,s){i=z.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=Ue(e,n)+Ue(1-e,n),o=r-1;return an(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=Ue(1-e,n),o=Ue(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),d=(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:d/h}},lli4:function(e,n,r,o){const i=e.x,a=e.y,s=n.x,l=n.y,u=r.x,d=r.y,h=o.x,m=o.y;return z.lli8(i,a,s,l,u,d,h,m)},lli:function(e,n){return z.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=lr,r=lr,o=cr,i=cr;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(!z.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(d){if(d.virtual)return;const h=u.intersects(d,i);h.length>0&&(h.c1=u,h.c2=d,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=z.makeline(n.points[o-1],e.points[0]),s=z.makeline(e.points[i-1],n.points[0]),l={startcap:a,forward:e,back:n,endcap:s,bbox:z.findbbox([a,e,n,s])};return l.intersections=function(u){return z.shapeintersections(l,l.bbox,u,u.bbox,r)},l},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let o=lr,i=cr,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=-sn(n.p2.y-o,n.p2.x-r),a=function(s){return{x:(s.x-r)*ut(i)-(s.y-o)*Yt(i),y:(s.x-r)*Yt(i)+(s.y-o)*ut(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=z.align(e,n),i=function(S){return 0<=S&&S<=1};if(r===2){const S=o[0].y,T=o[1].y,$=o[2].y,O=S-2*T+$;if(O!==0){const R=-wt(T*T-S*$),U=-S+T,V=-(R+U)/O,Y=-(-R+U)/O;return[V,Y].filter(i)}else if(T!==$&&O===0)return[(2*T-$)/(2*T-2*$)].filter(i);return[]}const a=o[0].y,s=o[1].y,l=o[2].y,u=o[3].y;let d=-a+3*s-3*l+u,h=3*a-6*s+3*l,m=-3*a+3*s,f=a;if(z.approximately(d,0)){if(z.approximately(h,0))return z.approximately(m,0)?[]:[-f/m].filter(i);const S=wt(m*m-4*h*f),T=2*h;return[(S-m)/T,(-m-S)/T].filter(i)}h/=d,m/=d,f/=d;const p=(3*m-h*h)/3,g=p/3,w=(2*h*h*h-9*h*m+27*f)/27,b=w/2,v=b*b+g*g*g;let I,D,N,_,P;if(v<0){const S=-p/3,T=S*S*S,$=wt(T),O=-w/(2*$),R=O<-1?-1:O>1?1:O,U=Jd(R),V=ln($),Y=2*V;return N=Y*ut(U/3)-h/3,_=Y*ut((U+Tn)/3)-h/3,P=Y*ut((U+2*Tn)/3)-h/3,[N,_,P].filter(i)}else{if(v===0)return I=b<0?ln(-b):-ln(b),N=2*I-h/3,_=-I-h/3,[N,_].filter(i);{const S=wt(v);return I=ln(-b+S),D=ln(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=-wt(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,d=0,h=0;const m=z.compute(e,n),f=z.compute(e,r),p=m.x*m.x+m.y*m.y;if(o?(a=wt(Ue(m.y*f.z-f.y*m.z,2)+Ue(m.z*f.x-f.z*m.x,2)+Ue(m.x*f.y-f.x*m.y,2)),s=Ue(p+m.z*m.z,3/2)):(a=m.x*f.y-m.y*f.x,s=Ue(p,3/2)),a===0||s===0)return{k:0,r:0};if(d=a/s,h=s/a,!i){const g=z.curvature(e-.001,n,r,o,!0).k,w=z.curvature(e+.001,n,r,o,!0).k;u=(w-d+(d-g))/2,l=(an(w-d)+an(d-g))/2}return{k:d,r:h,dk:u,adk:l}},inflections:function(e){if(e.length<4)return[];const n=z.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(z.approximately(s,0)){if(!z.approximately(l,0)){let f=-u/l;if(0<=f&&f<=1)return[f]}return[]}const d=2*s;if(z.approximately(d,0))return[];const h=l*l-4*s*u;if(h<0)return[];const m=Math.sqrt(h);return[(m-l)/d,-(l+m)/d].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,an(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),d=[{left:l.left,right:u.left},{left:l.left,right:u.right},{left:l.right,right:u.right},{left:l.right,right:u.left}];d=d.filter(function(m){return z.bboxoverlap(m.left.bbox(),m.right.bbox())});let h=[];return d.length===0||(d.forEach(function(m){h=h.concat(z.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*ut(_t)-i*Yt(_t),u=o*Yt(_t)+i*ut(_t),d=a*ut(_t)-s*Yt(_t),h=a*Yt(_t)+s*ut(_t),m=(e.x+n.x)/2,f=(e.y+n.y)/2,p=(n.x+r.x)/2,g=(n.y+r.y)/2,w=m+l,b=f+u,v=p+d,I=g+h,D=z.lli8(m,f,w,b,p,g,v,I),N=z.dist(D,e);let _=sn(e.y-D.y,e.x-D.x),P=sn(n.y-D.y,n.x-D.x),S=sn(r.y-D.y,r.x-D.x),T;return _<S?((_>P||P>S)&&(_+=Tn),_>S&&(T=S,S=_,_=T)):S<P&&P<_?(T=S,S=_,_=T):S+=Tn,D.s=_,D.e=S,D.r=N,D},numberSort:function(e,n){return e-n}};class pn{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 z.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++)z.expandbox(r,n[o].bbox());return r}offset(n){const r=[];return this.curves.forEach(function(o){r.push(...o.offset(n))}),new pn(r)}}const{abs:cn,min:li,max:ci,cos:Qd,sin:eu,acos:tu,sqrt:dn}=Math,nu=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 p=[];r.forEach(function(g){["x","y","z"].forEach(function(w){typeof g[w]<"u"&&p.push(g[w])})}),r=p}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 p=0,g=s?3:2;p<a;p+=g){var u={x:r[p],y:r[p+1]};s&&(u.z=r[p+2]),l.push(u)}const d=this.order=l.length-1,h=this.dims=["x","y"];s&&h.push("z"),this.dimlen=h.length;const m=z.align(l,{p1:l[0],p2:l[d]}),f=z.dist(l[0],l[d]);this._linear=m.reduce((p,g)=>p+cn(g.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=z.dist(r,s.C));const l=a*(1-i)/i,u=z.dist(n,o),d=(o.x-n.x)/u,h=(o.y-n.y)/u,m=a*d,f=a*h,p=l*d,g=l*h,w={x:r.x-m,y:r.y-f},b={x:r.x+p,y:r.y+g},v=s.A,I={x:v.x+(w.x-v.x)/(1-i),y:v.y+(w.y-v.y)/(1-i)},D={x:v.x+(b.x-v.x)/i,y:v.y+(b.y-v.y)/i},N={x:n.x+(I.x-n.x)/i,y:n.y+(I.y-n.y)/i},_={x:o.x+(D.x-o.x)/(1-i),y:o.y+(D.y-o.y)/(1-i)};return new ue(n,N,_,o)}static getUtils(){return z}getUtils(){return ue.getUtils()}static get PolyBezier(){return pn}valueOf(){return this.toString()}toString(){return z.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=z.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,r=z.angle(n[0],n[this.order],n[1]);this.clockwise=r>0}length(){return z.length(this.derivative.bind(this))}static getABC(n=2,r,o,i,a=.5){const s=z.projectionratio(a,n),l=1-s,u={x:s*r.x+l*i.x,y:s*r.y+l*i.y},d=z.abcratio(a,n);return{A:{x:o.x+(o.x-u.x)/d,y:o.y+(o.y-u.y)/d},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],z.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=z.closest(r,n),a=i.mpos,s=(a-1)/o,l=(a+1)/o,u=.1/o;let d=i.mdist,h=s,m=h,f;d+=1;for(let p;h<l+u;h+=u)f=this.compute(h),p=z.dist(n,f),p<d&&(d=p,m=h);return m=m<0?0:m>1?1:m,f=this.compute(m),f.t=m,f.d=d,f}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?z.computeWithRatios(n,this.points,this.ratios,this._3d):z.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 z.compute(n,this.dpoints[0],this._3d)}dderivative(n){return z.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new ue(z.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return z.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return z.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const r=this.derivative(n),o=dn(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=dn(r.x*r.x+r.y*r.y+r.z*r.z),a=dn(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=dn(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=z.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=z.map(0,0,1,this._t1,this._t2),i.left._t2=z.map(n,0,1,this._t1,this._t2),i.right._t1=z.map(n,0,1,this._t1,this._t2),i.right._t2=z.map(1,0,1,this._t1,this._t2),r?(r=z.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]=z.droots(a),this.order===3&&(a=this.dpoints[1].map(i),n[o]=n[o].concat(z.droots(a))),n[o]=n[o].filter(function(s){return s>=0&&s<=1}),r=r.concat(n[o].sort(z.numberSort))}).bind(this)),n.values=r.sort(z.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]=z.getminmax(this,o,n[o])}).bind(this)),r}overlaps(n){const r=this.bbox(),o=n.bbox();return z.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=z.angle(this.points[0],this.points[3],this.points[1]),a=z.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),cn(tu(o))<nu/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(d){for(r=0,o=0;o<=1;)for(o=r+i;o<=1+i;o+=i)if(a=d.split(r,o),!a.simple()){if(o-=i,cn(r-o)<i)return[];a=d.split(r,o),a._t1=z.map(r,0,1,d._t1,d._t2),a._t2=z.map(o,0,1,d._t1,d._t2),l.push(a),r=o;break}r<1&&(a=d.split(r,1),a._t1=z.map(r,0,1,d._t1,d._t2),a._t2=d._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)],d=[],h=z.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=d[m*r]=z.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],p={x:f.x-h.x,y:f.y-h.y},g=o?o((m+1)/r):n;o&&!i&&(g=-g);var w=dn(p.x*p.x+p.y*p.y);p.x/=w,p.y/=w,d[m+1]={x:f.x+g*p.x,y:f.y+g*p.y}}}),new ue(d)):([0,1].forEach(m=>{if(r===2&&m)return;const f=d[m*r],p=this.derivative(m),g={x:f.x+p.x,y:f.y+p.y};d[m+1]=z.lli4(f,g,h,a[m+1])}),new ue(d))}outline(n,r,o,i){if(r=r===void 0?n:r,this._linear){const _=this.normal(0),P=this.points[0],S=this.points[this.points.length-1];let T,$,O;o===void 0&&(o=n,i=r),T={x:P.x+_.x*n,y:P.y+_.y*n},O={x:S.x+_.x*o,y:S.y+_.y*o},$={x:(T.x+O.x)/2,y:(T.y+O.y)/2};const R=[T,$,O];T={x:P.x-_.x*r,y:P.y-_.y*r},O={x:S.x-_.x*i,y:S.y-_.y*i},$={x:(T.x+O.x)/2,y:(T.y+O.y)/2};const U=[O,$,T],V=z.makeline(U[2],R[0]),Y=z.makeline(R[2],U[0]),te=[V,new ue(R),Y,new ue(U)];return new pn(te)}const a=this.reduce(),s=a.length,l=[];let u=[],d,h=0,m=this.length();const f=typeof o<"u"&&typeof i<"u";function p(_,P,S,T,$){return function(O){const R=T/S,U=(T+$)/S,V=P-_;return z.map(O,0,1,_+R*V,_+U*V)}}a.forEach(function(_){const P=_.length();f?(l.push(_.scale(p(n,o,m,h,P))),u.push(_.scale(p(-r,-i,m,h,P)))):(l.push(_.scale(n)),u.push(_.scale(-r))),h+=P}),u=u.map(function(_){return d=_.points,d[3]?_.points=[d[3],d[2],d[1],d[0]]:_.points=[d[2],d[1],d[0]],_}).reverse();const g=l[0].points[0],w=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=z.makeline(b,g),D=z.makeline(w,v),N=[I].concat(l).concat([D]).concat(u);return new pn(N)}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=z.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=li(n.p1.x,n.p2.x),o=li(n.p1.y,n.p2.y),i=ci(n.p1.x,n.p2.x),a=ci(n.p1.y,n.p2.y);return z.roots(this.points,n).filter(s=>{var l=this.get(s);return z.between(l.x,r,i)&&z.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=z.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=z.dist(n,r),d=z.dist(n,s),h=z.dist(n,l);return cn(d-u)+cn(h-u)}_iterate(n,r){let o=0,i=1,a;do{a=0,i=1;let s=this.get(o),l,u,d,h,m=!1,f=!1,p,g=i,w=1;do if(f=m,h=d,g=(o+i)/2,l=this.get(g),u=this.get(i),d=z.getccenter(s,l,u),d.interval={start:o,end:i},m=this._error(d,s,o,i)<=n,p=f&&!m,p||(w=i),m){if(i>=1){if(d.interval.end=w=1,h=d,i>1){let v={x:d.x+d.r*Qd(d.e),y:d.y+d.r*eu(d.e)};d.e+=z.angle({x:d.x,y:d.y},v,this.get(1))}break}i=i+(i-o)/2}else i=g;while(!p&&a++<100);if(a>=100)break;h=h||d,r.push(h),o=w}while(i<1);return r}}function Or(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 ru(e){if(Array.isArray(e))return e}function ou(e){if(Array.isArray(e))return Or(e)}function iu(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function au(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function su(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
267
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lu(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
268
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cu(e,n){if(e==null)return{};var r,o,i=du(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 du(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 uu(e,n){return ru(e)||au(e,n)||aa(e,n)||su()}function fu(e){return ou(e)||iu(e)||aa(e)||lu()}function mu(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 hu(e){var n=mu(e,"string");return typeof n=="symbol"?n:n+""}function aa(e,n){if(e){if(typeof e=="string")return Or(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)?Or(e,n):void 0}}var pu=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 d=l,h=u;return i.forEach(function(m,f){var p=m.keyAccessor,g=m.isProp,w;if(g){var b=h,v=b[p],I=cu(b,[p].map(hu));w=v,h=I}else w=p(h,f);f+1<i.length?(d.hasOwnProperty(w)||(d[w]={}),d=d[w]):r?(d.hasOwnProperty(w)||(d[w]=[]),d[w].push(h)):d[w]=h}),l},{});r instanceof Function&&function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;d===i.length?Object.keys(u).forEach(function(h){return u[h]=r(u[h])}):Object.values(u).forEach(function(h){return l(h,d+1)})}(a);var s=a;return o&&(s=[],function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];d.length===i.length?s.push({keys:d,vals:u}):Object.entries(u).forEach(function(h){var m=uu(h,2),f=m[0],p=m[1];return l(p,[].concat(fu(d),[f]))})}(a),n instanceof Array&&n.length===0&&s.length===1&&(s[0].keys=[])),s};function gu(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 yu=`.force-graph-container canvas {
264
269
  display: block;
265
270
  user-select: none;
266
271
  outline: none;
@@ -283,6 +288,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
283
288
  cursor: -moz-grabbing;
284
289
  cursor: -webkit-grabbing;
285
290
  }
286
- `;uu(fu);function Or(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 mu(e){if(Array.isArray(e))return e}function hu(e){if(Array.isArray(e))return Or(e)}function ci(e,n,r){if(ia())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 yn(e,n,r){return(n=xu(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ia(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ia=function(){return!!e})()}function pu(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function gu(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function yu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
287
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vu(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
288
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function di(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 Jt(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?di(Object(r),!0).forEach(function(o){yn(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):di(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function gn(e,n){return mu(e)||gu(e,n)||aa(e,n)||yu()}function Be(e){return hu(e)||pu(e)||aa(e)||vu()}function bu(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 xu(e){var n=bu(e,"string");return typeof n=="symbol"?n:n+""}function Rr(e){"@babel/helpers - typeof";return Rr=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},Rr(e)}function aa(e,n){if(e){if(typeof e=="string")return Or(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)?Or(e,n):void 0}}var wu=Ya(Ja);function ui(e,n,r){!n||typeof r!="string"||e.filter(function(o){return!o[r]}).forEach(function(o){o[r]=wu(n(o))})}function _u(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(p){throw"Invalid DAG structure! Found cycle in node path: ".concat(p.join(" -> "),".")}:l,d={};r.forEach(function(p){return d[n(p)]={data:p,out:[],depth:-1,skip:!s(p)}}),o.forEach(function(p){var g=p.source,w=p.target,b=P(g),v=P(w);if(!d.hasOwnProperty(b))throw"Missing source node with id: ".concat(b);if(!d.hasOwnProperty(v))throw"Missing target node with id: ".concat(v);var I=d[b],D=d[v];I.out.push(D);function P(_){return Rr(_)==="object"?n(_):_}});var h=[];f(Object.values(d));var m=Object.assign.apply(Object,[{}].concat(Be(Object.entries(d).filter(function(p){var g=gn(p,2),w=g[1];return!w.skip}).map(function(p){var g=gn(p,2),w=g[0],b=g[1];return yn({},w,b.depth)}))));return m;function f(p){for(var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,b=function(){var P=p[v];if(g.indexOf(P)!==-1){var _=[].concat(Be(g.slice(g.indexOf(P))),[P]).map(function(N){return n(N.data)});return h.some(function(N){return N.length===_.length&&N.every(function(S,T){return S===_[T]})})||(h.push(_),u(_)),1}w>P.depth&&(P.depth=w,f(P.out,[].concat(Be(g),[P]),w+(P.skip?0:1)))},v=0,I=p.length;v<I;v++)b()}}var ku=2,Pe=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},fi=function(n,r){if(!r.isShadow){var o=ie(r.linkDirectionalParticles);r.graphData.links.forEach(function(i){var a=Math.round(Math.abs(o(i)));a?i.__photons=Be(Array(a)).map(function(){return{}}):delete i.__photons})}},Bn=Ur({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,fi(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:Pe},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:Pe},nodeColor:{default:"color",triggerUpdate:!1,onChange:Pe},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:Pe},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Pe},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:Pe},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:Pe},linkColor:{default:"color",triggerUpdate:!1,onChange:Pe},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:Pe},linkWidth:{default:1,triggerUpdate:!1,onChange:Pe},linkCurvature:{default:0,triggerUpdate:!1,onChange:Pe},linkCanvasObject:{triggerUpdate:!1,onChange:Pe},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Pe},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:Pe},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:Pe},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:Pe},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:fi},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=ie(n.nodeVisibility),u=ie(n.nodeVal),d=ie(n.nodeColor),h=ie(n.nodeCanvasObjectMode),m=n.ctx,f=n.isShadow/n.globalScale,p=n.graphData.nodes.filter(l);m.save(),p.forEach(function(g){var w=h(g);if(n.nodeCanvasObject&&(w==="before"||w==="replace")&&(n.nodeCanvasObject(g,m,n.globalScale),w==="replace")){m.restore();return}var b=Math.sqrt(Math.max(0,u(g)||1))*n.nodeRelSize+f;m.beginPath(),m.arc(g.x,g.y,b,0,2*Math.PI,!1),m.fillStyle=d(g)||"rgba(31, 120, 180, 0.92)",m.fill(),n.nodeCanvasObject&&w==="after"&&n.nodeCanvasObject(g,n.ctx,n.globalScale)}),m.restore()}function i(){var l=ie(n.linkVisibility),u=ie(n.linkColor),d=ie(n.linkWidth),h=ie(n.linkLineDash),m=ie(n.linkCurvature),f=ie(n.linkCanvasObjectMode),p=n.ctx,g=n.isShadow*2,w=n.graphData.links.filter(l);w.forEach(N);var b=[],v=[],I=w;if(n.linkCanvasObject){var D=[],P=[];w.forEach(function(S){return({before:b,after:v,replace:D}[f(S)]||P).push(S)}),I=[].concat(Be(b),v,P),b=b.concat(D)}p.save(),b.forEach(function(S){return n.linkCanvasObject(S,p,n.globalScale)}),p.restore();var _=du(I,[u,d,h]);p.save(),Object.entries(_).forEach(function(S){var T=gn(S,2),$=T[0],E=T[1],R=!$||$==="undefined"?"rgba(0,0,0,0.15)":$;Object.entries(E).forEach(function(U){var H=gn(U,2),Y=H[0],te=H[1],ne=(Y||1)/n.globalScale+g;Object.entries(te).forEach(function(K){var ve=gn(K,2);ve[0];var Ce=ve[1],M=h(Ce[0]);p.beginPath(),Ce.forEach(function(oe){var ae=oe.source,re=oe.target;if(!(!ae||!re||!ae.hasOwnProperty("x")||!re.hasOwnProperty("x"))){p.moveTo(ae.x,ae.y);var W=oe.__controlPoints;W?p[W.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(p,Be(W).concat([re.x,re.y])):p.lineTo(re.x,re.y)}}),p.strokeStyle=R,p.lineWidth=ne,p.setLineDash(M||[]),p.stroke()})})}),p.restore(),p.save(),v.forEach(function(S){return n.linkCanvasObject(S,p,n.globalScale)}),p.restore();function N(S){var T=m(S);if(!T){S.__controlPoints=null;return}var $=S.source,E=S.target;if(!(!$||!E||!$.hasOwnProperty("x")||!E.hasOwnProperty("x"))){var R=Math.sqrt(Math.pow(E.x-$.x,2)+Math.pow(E.y-$.y,2));if(R>0){var U=Math.atan2(E.y-$.y,E.x-$.x),H=R*T,Y={x:($.x+E.x)/2+H*Math.cos(U-Math.PI/2),y:($.y+E.y)/2+H*Math.sin(U-Math.PI/2)};S.__controlPoints=[Y.x,Y.y]}else{var te=T*70;S.__controlPoints=[E.x,E.y-te,E.x+te,E.y]}}}}function a(){var l=1.6,u=.2,d=ie(n.linkDirectionalArrowLength),h=ie(n.linkDirectionalArrowRelPos),m=ie(n.linkVisibility),f=ie(n.linkDirectionalArrowColor||n.linkColor),p=ie(n.nodeVal),g=n.ctx;g.save(),n.graphData.links.filter(m).forEach(function(w){var b=d(w);if(!(!b||b<0)){var v=w.source,I=w.target;if(!(!v||!I||!v.hasOwnProperty("x")||!I.hasOwnProperty("x"))){var D=Math.sqrt(Math.max(0,p(v)||1))*n.nodeRelSize,P=Math.sqrt(Math.max(0,p(I)||1))*n.nodeRelSize,_=Math.min(1,Math.max(0,h(w))),N=f(w)||"rgba(0,0,0,0.28)",S=b/l/2,T=w.__controlPoints&&ci(de,[v.x,v.y].concat(Be(w.__controlPoints),[I.x,I.y])),$=T?function(ne){return T.get(ne)}:function(ne){return{x:v.x+(I.x-v.x)*ne||0,y:v.y+(I.y-v.y)*ne||0}},E=T?T.length():Math.sqrt(Math.pow(I.x-v.x,2)+Math.pow(I.y-v.y,2)),R=D+b+(E-D-P-b)*_,U=$(R/E),H=$((R-b)/E),Y=$((R-b*(1-u))/E),te=Math.atan2(U.y-H.y,U.x-H.x)-Math.PI/2;g.beginPath(),g.moveTo(U.x,U.y),g.lineTo(H.x+S*Math.cos(te),H.y+S*Math.sin(te)),g.lineTo(Y.x,Y.y),g.lineTo(H.x-S*Math.cos(te),H.y-S*Math.sin(te)),g.fillStyle=N,g.fill()}}}),g.restore()}function s(){var l=ie(n.linkDirectionalParticles),u=ie(n.linkDirectionalParticleSpeed),d=ie(n.linkDirectionalParticleOffset),h=ie(n.linkDirectionalParticleWidth),m=ie(n.linkVisibility),f=ie(n.linkDirectionalParticleColor||n.linkColor),p=n.ctx;p.save(),n.graphData.links.filter(m).forEach(function(g){var w=l(g);if(!(!g.hasOwnProperty("__photons")||!g.__photons.length)){var b=g.source,v=g.target;if(!(!b||!v||!b.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var I=u(g),D=Math.abs(d(g)),P=g.__photons||[],_=Math.max(0,h(g)/2)/Math.sqrt(n.globalScale),N=f(g)||"rgba(0,0,0,0.28)";p.fillStyle=N;var S=g.__controlPoints?ci(de,[b.x,b.y].concat(Be(g.__controlPoints),[v.x,v.y])):null,T=0,$=!1;P.forEach(function(E){var R=!!E.__singleHop;if(E.hasOwnProperty("__progressRatio")||(E.__progressRatio=R?I<0?1:0:(T+D)/w),!R&&T++,E.__progressRatio+=I,E.__progressRatio>=1||E.__progressRatio<0)if(!R)E.__progressRatio=E.__progressRatio%1,E.__progressRatio<0&&E.__progressRatio++;else{$=!0;return}var U=E.__progressRatio,H=S?S.get(U):{x:b.x+(v.x-b.x)*U||0,y:b.y+(v.y-b.y)*U||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(H.x,H.y,g,p,n.globalScale):(p.beginPath(),p.arc(H.x,H.y,_,0,2*Math.PI,!1),p.fill())}),$&&(g.__photons=g.__photons.filter(function(E){return!E.__singleHop||E.__progressRatio<=1&&E.__progressRatio>=0}))}}}),p.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:Bd().force("link",Ed()).force("charge",Hd()).force("center",Zc()).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&&ui(n.graphData.nodes,ie(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&ui(n.graphData.links,ie(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&&_u(n.graphData,function(f){return f[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,Be(Object.values(i||[]))),s=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*ku*(["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),d=function(p){return(i[p[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]=d(f)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?Vd(function(f){var p=i[f[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-p:p)*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 sa(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(d){return u[d][a](l)})},triggerUpdate:!1}},linkMethod:function(a){return function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;d<l;d++)u[d-1]=arguments[d];var h=[];return r.forEach(function(m){var f=s[m],p=f[a].apply(f,u);p!==f&&h.push(p)}),h.length?h[0]:this}}}}var Iu=800,Cu=4,Su=5,la=sa("forceGraph",Bn),Du=sa(["forceGraph","shadowGraph"],Bn),Pu=Object.assign.apply(Object,Be(["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 yn({},e,la.linkProp(e))})).concat(Be(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return yn({},e,Du.linkProp(e))})))),Nu=Object.assign.apply(Object,Be(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return yn({},e,la.linkMethod(e))})));function cr(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=ut(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/i,(e.height-r)/2/i),e.needsRedraw=!0}}function ca(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function mi(e,n,r){e.save(),ca(e),e.clearRect(0,0,n,r),e.restore()}var Tu=Ur({props:Jt({width:{default:window.innerWidth,onChange:function(n,r){return cr(r)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,r){return cr(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}},Pu),aliases:{stopAnimation:"pauseAnimation"},methods:Jt({graph2ScreenCoords:function(n,r,o){var i=ut(n.canvas);return{x:r*i.k+i.x,y:o*i.k+i.y}},screen2GraphCoords:function(n,r,o){var i=ut(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 Lo(s()).to(a,i).easing(jt.Quadratic.Out).onUpdate(l).onComplete(function(){n.tweenGroup.remove(this)}).start()):l(a),this}return s();function s(){var u=ut(n.canvas);return{x:(n.width/2-u.x)/u.k,y:(n.height/2-u.y)/u.k}}function l(u){var d=u.x,h=u.y;n.zoom.translateTo(n.zoom.__baseElem,d===void 0?s().x:d,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 Lo({k:i()}).to({k:r},o).easing(jt.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 ut(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},d=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(d,r)}return this},getGraphBbox:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},o=ie(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:[po(a,function(s){return s.x-s.r}),go(a,function(s){return s.x+s.r})],y:[po(a,function(s){return s.y-s.r}),go(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:[]})}},Nu),stateInit:function(){return{lastSetZoom:1,zoom:es(),forceGraph:new Bn,shadowGraph:new Bn().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new Nc,tweenGroup:new Ei}},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,p=l.x>0&&l.y>0?s.getImageData(l.x*f,l.y*f,1,1):null;return p&&(m=r.colorTracker.lookup(p.data)),m};wr(r.canvas).call(Xa().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,p=h,g=ut(r.canvas).k,w={x:f.x+(p.x-f.x)/g-m.x,y:f.y+(p.y-f.y)/g-m.y};["x","y"].forEach(function(b){return m["f".concat(b)]=m[b]=f[b]+(p[b]-f[b])/g}),!(!m.__dragged&&Su>=Math.sqrt(Za(["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,w))}).on("end",function(h){var m=h.subject,f=m.__initialDragPos,p={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,p))})),r.zoom(r.zoom.__baseElem=wr(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(h){return!h.button&&r.enableZoomPanInteraction&&(h.type!=="wheel"||ie(r.enableZoomInteraction)(h))&&(h.type==="wheel"||ie(r.enablePanInteraction)(h))}).on("zoom",function(h){var m=h.transform;[a,s].forEach(function(f){ca(f),f.translate(m.x,m.y),f.scale(m.k,m.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Jt(Jt({},m),o.centerAt())),r.needsRedraw=!0}).on("end",function(h){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Jt(Jt({},h.transform),o.centerAt()))}),cr(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){ut(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=Cu/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new Xc(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(g){return Math.abs(g)>1}))&&(r.isPointerDragging=!0);var f=p(i);l.x=m.pageX-f.left,l.y=m.pageY-f.top;function p(g){var w=g.getBoundingClientRect(),b=window.pageXOffset||document.documentElement.scrollLeft,v=window.pageYOffset||document.documentElement.scrollTop;return{top:w.top+v,left:w.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 p=r["on".concat(r.hoverObj.type,"RightClick")];p&&p.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 d=Qa(function(){mi(s,r.width,r.height),r.shadowGraph.linkWidth(function(m){return ie(r.linkWidth)(m)+r.linkHoverPrecision});var h=ut(r.canvas);r.shadowGraph.globalScale(h.k).tickFrame()},Iu);r.flushShadowCanvas=d.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 p=r.hoverObj,g=p?p.type:null,w=f?f.type:null;if(g&&g!==w){var b=r["on".concat(g,"Hover")];b&&b(null,p.d)}if(w){var v=r["on".concat(w,"Hover")];v&&v(f.d,g===w?p.d:null)}r.tooltip.content(f&&ie(r["".concat(f.type.toLowerCase(),"Label")])(f.d)||null),r.canvas.classList[(f&&r["on".concat(w,"Click")]||!f&&r.onBackgroundClick)&&ie(r.showPointerCursor)(f==null?void 0:f.d)?"add":"remove"]("clickable"),r.hoverObj=f}m&&d()}if(m){mi(a,r.width,r.height);var I=ut(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){}}),da={exports:{}},Au="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ju=Au,Mu=ju;function ua(){}function fa(){}fa.resetWarningCache=ua;var Eu=function(){function e(o,i,a,s,l,u){if(u!==Mu){var d=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 d.name="Invariant Violation",d}}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:fa,resetWarningCache:ua};return r.PropTypes=r,r};da.exports=Eu();var Ou=da.exports;const C=Ra(Ou),qn={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},ma={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},Kr={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])},Ru=Object.assign({},qn,ma,{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({},qn,ma,Kr,{enableNavigationControls:C.bool,controlType:C.oneOf(["trackball","orbit","fly"]),rendererConfig:C.object,extraRenderers:C.arrayOf(C.shape({render:C.func.isRequired}))});Object.assign({},qn,Kr,{nodeDesc:C.oneOfType([C.string,C.func]),linkDesc:C.oneOfType([C.string,C.func])});Object.assign({},qn,Kr,{markerAttrs:C.object,yOffset:C.number,glScale:C.number});const Yr=Rl(Tu,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});Yr.displayName="ForceGraph2D";Yr.propTypes=Ru;const Fu=[{value:"openai-completions",label:"OpenAI 兼容"},{value:"anthropic-messages",label:"Anthropic 兼容"}];function Lu(e){const{t:n}=it(),[r,o]=x.useState("deepseek"),[i,a]=x.useState(""),[s,l]=x.useState(""),[u,d]=x.useState("openai-completions"),[h,m]=x.useState(""),[f,p]=x.useState(!1),[g,w]=x.useState(!1),[b,v]=x.useState(null),I=x.useRef(!1);function D(S){if(a(S),I.current)return;S.toLowerCase().includes("anthropic")?d("anthropic-messages"):d("openai-completions")}function P(S){I.current=!0,d(S)}async function _(){var T;const S=h.trim();if(!S){v("请输入 API Key");return}w(!0),v(null);try{if(r==="deepseek")await Mo({kind:"deepseek",modelId:"deepseek-flash",apiKey:S});else{const $=i.trim();if(!$){v("请输入 API 地址");return}const E=s.trim();if(!E){v("请输入 Model ID");return}await Mo({kind:"custom",baseUrl:$,modelId:E,apiType:u,apiKey:S})}m(""),a(""),l(""),await((T=e.onConfigured)==null?void 0:T.call(e))}catch($){v($ instanceof Error?$.message:String($))}finally{w(!1)}}const N=h.trim()&&(r==="deepseek"||i.trim()&&s.trim());return c.jsxs("div",{className:"mdocs-agent-apikey-inline",children:[c.jsx("p",{className:"mdocs-agent-apikey-inline-lead",children:"配置 AI 供应商后即可使用(仅本人可见,不会分享给其他访客)"}),c.jsxs("div",{className:"mdocs-agent-kind-tabs mdocs-agent-apikey-inline-tabs",role:"tablist","aria-label":"配置方式",children:[c.jsx("button",{type:"button",role:"tab","aria-selected":r==="deepseek",className:r==="deepseek"?"active":"",onClick:()=>o("deepseek"),disabled:g,children:"Deepseek"}),c.jsx("button",{type:"button",role:"tab","aria-selected":r==="custom",className:r==="custom"?"active":"",onClick:()=>o("custom"),disabled:g,children:"自定义"})]}),r==="custom"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[c.jsx("span",{children:"API 地址"}),c.jsx("input",{type:"url",value:i,onChange:S=>D(S.target.value),placeholder:"https://api.example.com/v1",className:"mdocs-agent-mono",disabled:g,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),_())}})]}),c.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[c.jsx("span",{children:"API 协议"}),c.jsx("div",{className:"mdocs-agent-apikey-inline-protocol",children:Fu.map(S=>c.jsx("button",{type:"button",className:u===S.value?"active":"",onClick:()=>P(S.value),disabled:g,children:S.label},S.value))})]}),c.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[c.jsx("span",{children:"Model ID"}),c.jsx("input",{type:"text",value:s,onChange:S=>l(S.target.value),placeholder:"模型名称,如 gpt-4o / claude-3-5-sonnet",className:"mdocs-agent-mono",disabled:g,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),_())}})]})]}):null,c.jsxs("div",{className:"mdocs-agent-config-apikey mdocs-agent-apikey-inline-field",children:[c.jsx("input",{type:f?"text":"password",value:h,onChange:S=>m(S.target.value),placeholder:n("agentConfigApiKeyPlaceholder"),autoComplete:"off",disabled:g,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),_())}}),c.jsx("button",{type:"button",className:"mdocs-agent-config-eye","aria-label":n(f?"agentConfigHideKey":"agentConfigShowKey"),onClick:()=>p(S=>!S),disabled:g,children:f?c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[c.jsx("path",{d:"M3 3l18 18"}),c.jsx("path",{d:"M10.6 10.6a2 2 0 002.8 2.8"}),c.jsx("path",{d:"M9.9 5.1A10.5 0 0121 12c-.6 1.1-1.4 2.1-2.4 2.9"}),c.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"})]}):c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[c.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"}),c.jsx("circle",{cx:"12",cy:"12",r:"3"})]})})]}),b?c.jsx("p",{className:"mdocs-agent-apikey-inline-error",children:b}):null,c.jsx("button",{type:"button",className:"mdocs-agent-apikey-inline-save",onClick:()=>void _(),disabled:g||!N,children:g?n("saving"):"保存并启用"})]})}function hi(e){return e==="contains"}function zu(e){return e==="related_to"||e==="part_of"||e==="depends_on"}function $u(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 w of e)f.set(w,(((h=o.get(w))==null?void 0:h.length)??0)+(((m=i.get(w))==null?void 0:m.length)??0));const p=[...e].sort((w,b)=>(f.get(b)??0)-(f.get(w)??0)),g=f.get(p[0])??0;s=p.filter(w=>(f.get(w)??0)===g).slice(0,12)}const l=new Map,u=[];for(const f of s)l.set(f,0),u.push(f);let d=0;for(;d<u.length;){const f=u[d++],p=l.get(f)??0;for(const g of o.get(f)??[]){const w=p+1;(!l.has(g)||w<(l.get(g)??1/0))&&(l.set(g,w),u.push(g))}}for(const f of e)l.has(f)||l.set(f,0);return{childrenOf:o,parentsOf:i,roots:s,depthMap:l}}function dr(e,n,r,o,i){return i.has(e)?!1:(r.get(e)??0)<n?!0:o.has(e)}function Uu(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 Bu(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 Hu(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 ur(e){return e<=1?"排队中,即将开始…":`排队中,前面还有 ${e-1} 个任务`}function fr(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]=x.useState(null),[l,u]=x.useState(!0),[d,h]=x.useState(null),[m,f]=x.useState(!1),[p,g]=x.useState(!1),[w,b]=x.useState(0),[v,I]=x.useState(()=>new Set),[D,P]=x.useState(()=>new Set),[_,N]=x.useState(null),[S,T]=x.useState(null),[$,E]=x.useState(null),R=x.useRef(null),U=x.useRef(new Map),[H,Y]=x.useState("not_found"),[te,ne]=x.useState([]),[K,ve]=x.useState(null),[Ce,M]=x.useState(0),oe=`graph:${e==="domain"?"domain":"dir"}:${n}`,ae=x.useRef(oe),re=x.useRef(null),[W,X]=x.useState(!1),[xe,se]=x.useState(!1),[Ye,kt]=x.useState(!1),[pt,en]=x.useState(!1),[Rt,It]=x.useState(!1),Je=x.useRef(null),_e=H==="running"||H==="pending";x.useEffect(()=>{let k=!1;return u(!0),h(null),N(null),b(0),I(new Set),P(new Set),g(!1),E(null),U.current=new Map,(e==="domain"?Oo:Eo)(n).then(L=>{k||(s(L),u(!1))}).catch(L=>{k||(h(L.message||"加载失败"),u(!1))}),()=>{k=!0}},[n,e]),x.useEffect(()=>(ae.current=oe,Ze(),Xe(),()=>Ze()),[oe]);async function Xe(){try{const k=await gl(ae.current);Y(k.status),ne(k.logs),ve(k.progress??null),M(k.position),k.status==="completed"?(Ze(),Ct()):k.status==="failed"||k.status==="stale"?(Ze(),k.error&&h(k.error)):(k.status==="running"||k.status==="pending")&&xn()}catch{}}function xn(){re.current||(re.current=window.setInterval(()=>{Xe()},2e3))}function Ze(){re.current&&(clearInterval(re.current),re.current=null)}async function Ct(){try{const j=await(e==="domain"?Oo:Eo)(n);s(j)}catch(k){h(k.message||"加载失败")}}const ze=async()=>{if(!_e){h(null),X(!1);try{const j=await(e==="domain"?pl:hl)(n);ae.current=j.taskId,Y(j.status),M(j.position),ne([]),ve(null),xn()}catch(k){if(k instanceof Ke&&k.code==="AI_NOT_CONFIGURED"){X(!0),h(k.message);return}h((k==null?void 0:k.message)||"生成失败")}}},Ft=async()=>{se(!1),X(!1),h(null),await ze()},Te=x.useMemo(()=>a?m?a.nodes:a.nodes.filter(k=>k.type==="concept"):[],[a,m]),ue=x.useMemo(()=>{if(!a)return[];const k=new Set(Te.map(j=>j.id));return a.edges.filter(j=>k.has(j.from)&&k.has(j.to))},[a,Te]),Se=x.useMemo(()=>{const k=ue.filter(j=>hi(String(j.type))).map(j=>({from:j.from,to:j.to}));return $u(Te.map(j=>j.id),k)},[Te,ue]),ye=x.useMemo(()=>Uu(Se.roots,Se.childrenOf,k=>dr(k,w,Se.depthMap,v,D)),[Se,w,v,D]),{displayNodes:be,displayEdges:St}=x.useMemo(()=>{const k=Te.filter(L=>ye.has(L.id)),j=ue.filter(L=>{if(!ye.has(L.from)||!ye.has(L.to))return!1;const F=String(L.type);return!!(hi(F)||p&&zu(F))});return{displayNodes:k,displayEdges:j}},[Te,ue,ye,p]),gt=x.useMemo(()=>{const k=new Map;for(const j of Te)k.set(j.id,j);return k},[Te]);function at(k){b(k),I(new Set),P(new Set)}function tn(k){if((Se.childrenOf.get(k)??[]).length===0)return;dr(k,w,Se.depthMap,v,D)?(P(F=>new Set(F).add(k)),I(F=>{const G=new Set(F);return G.delete(k),G})):(P(F=>{const G=new Set(F);return G.delete(k),G}),I(F=>new Set(F).add(k)))}function Ae(k){const j=Bu(k.id,Se.parentsOf);P(L=>{const F=new Set(L);for(const G of j)F.delete(G);return F}),I(L=>{const F=new Set(L);for(const G of j)F.add(G);return F}),N(k)}const wn=x.useMemo(()=>{const k=be.map(F=>{var Fe;const G=((Fe=Se.childrenOf.get(F.id))==null?void 0:Fe.length)??0,J=dr(F.id,w,Se.depthMap,v,D),ee=U.current.get(F.id);let Z=ee==null?void 0:ee.x,he=ee==null?void 0:ee.y;if(Z==null||he==null){const je=(Se.parentsOf.get(F.id)??[]).map(Me=>U.current.get(Me)).find(Me=>Me!=null);je?(Z=je.x+(Math.random()-.5)*60,he=je.y+50+Math.random()*40):(Z=(Math.random()-.5)*240,he=(Math.random()-.5)*180),U.current.set(F.id,{x:Z,y:he})}return{id:F.id,name:F.label,type:F.type,val:F.type==="concept"?4:2,x:Z,y:he,__raw:F,__childCount:G,__expanded:J}}),j=new Map,L=St.map(F=>{const G=`${F.from}->${F.to}`,J=j.get(G)??0;j.set(G,J+1);const ee=J===0?.08:.08+J*.14;return{source:F.from,target:F.to,type:F.type,curvature:ee,__raw:F}});return{nodes:k,links:L}},[be,St,Se,w,v,D]),st=x.useMemo(()=>{const k=Math.max(1,be.length);return{linkDistance:Math.min(140,70+Math.sqrt(k)*8),chargeStrength:Math.max(-420,-120-k*6)}},[be.length]),Re=x.useRef(null),[He,_n]=x.useState({width:800,height:600});x.useEffect(()=>{if(!Re.current)return;const k=()=>{Re.current&&_n({width:Re.current.clientWidth,height:Re.current.clientHeight})};k();const j=new ResizeObserver(k);return j.observe(Re.current),()=>j.disconnect()},[]),x.useEffect(()=>{if(!a||l)return;const k=window.setTimeout(()=>{var j,L;(L=(j=R.current)==null?void 0:j.zoomToFit)==null||L.call(j,400,80)},450);return()=>window.clearTimeout(k)},[a,m,p,l,He.width,He.height,w,ye]),x.useEffect(()=>{var F,G,J,ee;if(!a||l)return;const k=R.current;if(!k)return;const j=k.d3Force("charge");(F=j==null?void 0:j.strength)==null||F.call(j,st.chargeStrength);const L=k.d3Force("link");(G=L==null?void 0:L.distance)==null||G.call(L,st.linkDistance),(J=L==null?void 0:L.strength)==null||J.call(L,.35),(ee=k.d3ReheatSimulation)==null||ee.call(k)},[st,a,l,m,wn]);const yt=k=>(Se.childrenOf.get(k)??[]).map(L=>gt.get(L)??(a==null?void 0:a.nodes.find(F=>F.id===L))).filter(L=>!!L),Lt=k=>(Se.parentsOf.get(k)??[]).map(L=>gt.get(L)??(a==null?void 0:a.nodes.find(F=>F.id===L))).filter(L=>!!L),kn=k=>{if(!a)return[];const j=new Set,L=[],F=[k];for(;F.length>0;){const G=F.shift();if(j.has(G))continue;j.add(G);const J=a.nodes.find(Z=>Z.id===G);(J==null?void 0:J.type)==="doc"&&L.push(J);const ee=a.edges.filter(Z=>Z.from===G).map(Z=>Z.to);F.push(...ee)}return L};return x.useEffect(()=>{if(!Rt)return;const k=j=>{Je.current&&!Je.current.contains(j.target)&&It(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[Rt]),c.jsxs("div",{className:"graph-page",children:[c.jsxs("div",{className:"graph-toolbar",children:[c.jsxs("div",{className:"graph-toolbar-left",children:[c.jsx("span",{className:"graph-icon",children:"🕸️"}),c.jsxs("span",{className:"graph-title-text",title:`知识图谱 — ${r}`,children:["知识图谱 — ",r]}),i&&c.jsx("button",{className:"graph-btn graph-btn-danger",onClick:i,children:"退出图谱"})]}),c.jsxs("div",{className:"graph-toolbar-right",children:[c.jsxs("div",{className:"graph-mobile-toggle-wrap",ref:Je,children:[c.jsx("button",{type:"button",className:"graph-mobile-toggle-btn",onClick:()=>It(k=>!k),"aria-label":"更多操作",children:c.jsx(ps,{size:18,strokeWidth:1.75})}),Rt&&c.jsxs("div",{className:"graph-mobile-actions card",onClick:()=>It(!1),children:[c.jsxs("div",{className:"graph-mobile-action-group",children:[c.jsx("div",{className:"graph-mobile-action-label",children:"层级控制"}),c.jsx("button",{type:"button",className:`graph-mobile-action-item ${w===1?"active":""}`,onMouseDown:()=>at(1),children:"展开一级"}),c.jsx("button",{type:"button",className:`graph-mobile-action-item ${w===2?"active":""}`,onMouseDown:()=>at(2),children:"展开到二级"}),c.jsx("button",{type:"button",className:`graph-mobile-action-item ${w===0&&v.size===0?"active":""}`,onMouseDown:()=>at(0),children:"全部收起"})]}),c.jsxs("div",{className:"graph-mobile-action-group",children:[c.jsx("div",{className:"graph-mobile-action-label",children:"视图"}),c.jsxs("label",{className:"graph-mobile-action-switch",children:[c.jsx("input",{type:"checkbox",checked:p,onChange:k=>g(k.target.checked)}),c.jsx("span",{children:"显示其它关系"})]}),c.jsxs("label",{className:"graph-mobile-action-switch",children:[c.jsx("input",{type:"checkbox",checked:m,onChange:k=>f(k.target.checked)}),c.jsx("span",{children:"显示 doc 节点"})]})]}),c.jsxs("button",{className:"graph-mobile-action-item",onMouseDown:()=>se(!0),children:[c.jsx(tr,{size:14}),"配置 AI"]}),c.jsx("button",{className:"graph-mobile-action-item graph-mobile-action-primary",onMouseDown:ze,disabled:_e,children:_e?c.jsxs(c.Fragment,{children:[c.jsx(Dn,{size:14,className:"spin"}),H==="pending"?ur(Ce):"生成中..."]}):c.jsxs(c.Fragment,{children:[c.jsx(_o,{size:14}),a?"重新生成":"生成图谱"]})})]})]}),c.jsxs("div",{className:"graph-desktop-actions",children:[c.jsxs("div",{className:"graph-dropdown",children:[c.jsxs("button",{type:"button",className:"graph-btn",onClick:()=>kt(k=>!k),onBlur:()=>setTimeout(()=>kt(!1),150),children:["层级控制 ",c.jsx(vo,{size:12})]}),Ye&&c.jsxs("div",{className:"graph-dropdown-menu graph-dropdown-menu--right",children:[c.jsx("button",{type:"button",className:`graph-dropdown-item ${w===1?"active":""}`,onMouseDown:()=>{at(1),kt(!1)},children:"展开一级"}),c.jsx("button",{type:"button",className:`graph-dropdown-item ${w===2?"active":""}`,onMouseDown:()=>{at(2),kt(!1)},children:"展开到二级"}),c.jsx("button",{type:"button",className:`graph-dropdown-item ${w===0&&v.size===0?"active":""}`,onMouseDown:()=>{at(0),kt(!1)},children:"全部收起"})]})]}),c.jsxs("div",{className:"graph-dropdown",children:[c.jsxs("button",{type:"button",className:"graph-btn",onClick:()=>en(k=>!k),onBlur:()=>setTimeout(()=>en(!1),150),children:[c.jsx(ys,{size:14})," 视图 ",c.jsx(vo,{size:12})]}),pt&&c.jsxs("div",{className:"graph-dropdown-menu graph-dropdown-menu--right",children:[c.jsxs("label",{className:"graph-dropdown-switch",children:[c.jsx("input",{type:"checkbox",checked:p,onChange:k=>g(k.target.checked)}),c.jsx("span",{children:"显示其它关系"})]}),c.jsxs("label",{className:"graph-dropdown-switch",children:[c.jsx("input",{type:"checkbox",checked:m,onChange:k=>f(k.target.checked)}),c.jsx("span",{children:"显示 doc 节点"})]})]})]}),c.jsxs("button",{className:"graph-btn graph-btn-ghost",onClick:()=>se(!0),title:"配置用于图谱分析的 AI 模型",children:[c.jsx(tr,{size:14}),"配置 AI"]}),c.jsx("button",{className:"graph-btn graph-btn-primary",onClick:ze,disabled:_e,children:_e?c.jsxs(c.Fragment,{children:[c.jsx(Dn,{size:14,className:"spin"}),H==="pending"?ur(Ce):"生成中..."]}):c.jsxs(c.Fragment,{children:[c.jsx(_o,{size:14}),a?"重新生成":"生成图谱"]})})]})]})]}),c.jsxs("div",{className:"graph-canvas-container",ref:Re,children:[l&&c.jsxs("div",{className:"graph-loading",children:[c.jsx(Dn,{size:32,className:"spin"}),c.jsx("p",{children:"加载图谱中..."})]}),d&&!l&&c.jsx("div",{className:"graph-error",children:W?c.jsxs(c.Fragment,{children:[c.jsx("p",{style:{fontSize:40,margin:0},children:"🔑"}),c.jsx("h3",{children:"还没有配置 AI 模型"}),c.jsx("p",{className:"muted",children:"图谱由 AI 分析生成,需要先配置一个可用的模型"}),c.jsxs("button",{className:"graph-btn graph-btn-primary",onClick:()=>se(!0),style:{marginTop:12},children:[c.jsx(tr,{size:14}),"配置 AI"]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("p",{children:["❌ ",d]}),c.jsx("button",{className:"graph-btn",onClick:ze,children:"重试生成"})]})}),!l&&!d&&!a&&!_e&&c.jsxs("div",{className:"graph-empty",children:[c.jsx("p",{style:{fontSize:48,margin:0},children:"🕸️"}),c.jsx("h3",{children:"还没有知识图谱"}),c.jsx("p",{className:"muted",children:"点击右上角「生成图谱」开始构建"}),c.jsx("button",{className:"graph-btn graph-btn-primary",onClick:ze,disabled:_e,children:_e?"生成中...":"生成图谱"})]}),_e&&c.jsxs("div",{className:"graph-progress-panel",children:[c.jsxs("div",{className:"graph-progress-header",children:[c.jsx(Dn,{size:16,className:"spin"}),c.jsx("span",{children:H==="pending"?ur(Ce):K?`正在生成(${K.current}/${K.total})`:"正在生成..."})]}),K&&K.total>0&&c.jsx("div",{className:"graph-progress-bar",children:c.jsx("div",{className:"graph-progress-bar-fill",style:{width:`${K.current/K.total*100}%`}})}),c.jsx("div",{className:"graph-progress-logs",children:te.slice(-10).map((k,j)=>c.jsx("div",{className:`graph-log-item graph-log-${k.level}`,children:c.jsx("span",{className:"graph-log-event",children:Hu(k)})},j))})]}),!l&&!d&&a&&a.nodes.length===0&&!_e&&c.jsxs("div",{className:"graph-empty",children:[c.jsx("p",{style:{fontSize:48,margin:0},children:"📄"}),c.jsx("h3",{children:"图谱已生成"}),c.jsx("p",{className:"muted",children:"当前内容暂未提取到可关联的知识概念"}),c.jsx("p",{className:"muted",style:{fontSize:13,marginTop:4},children:"内容较少或结构较简单时可能出现这种情况,补充更多内容后可以重新生成"}),c.jsx("button",{className:"graph-btn graph-btn-primary",onClick:ze,disabled:_e,style:{marginTop:12},children:"重新生成"})]}),!l&&!d&&a&&a.nodes.length>0&&c.jsx(Yr,{ref:R,width:He.width,height:He.height,graphData:wn,nodeId:"id",nodeVal:k=>k.type==="concept"?6:3,nodeColor:k=>k.type==="concept"?"#8b5cf6":"#06b6d4",nodeCanvasObjectMode:()=>"replace",nodeCanvasObject:(k,j,L)=>{const F=String(k.name??""),G=k.type==="concept",J=k.id===(_==null?void 0:_.id)||k.id===S,ee=(G?9:5)/Math.max(L,.35);if(j.beginPath(),j.arc(k.x,k.y,ee,0,2*Math.PI),j.fillStyle=G?"#8b5cf6":"#06b6d4",j.globalAlpha=J||!_?1:.35,j.fill(),j.strokeStyle="#ffffff",j.lineWidth=1.5/Math.max(L,.35),j.stroke(),j.globalAlpha=1,k.__childCount>0){const $t=7/Math.max(L,.4),Ut=k.x+ee+$t*.9,pe=k.y-ee*.2;j.beginPath(),j.arc(Ut,pe,$t,0,2*Math.PI),j.fillStyle=k.__expanded?"#475569":"#6366f1",j.fill(),j.fillStyle="#ffffff";const Ve=k.__expanded?"−":"+",Dt=Math.max(10/L,9/L);j.font=`700 ${Dt}px -apple-system, BlinkMacSystemFont, sans-serif`,j.textAlign="center",j.textBaseline="middle",j.fillText(Ve,Ut,pe+.5/L)}if(!(J||G&&L>=.55||!G&&L>=1.4))return;const he=Math.max(10/L,G?11/L:9/L),Fe=G?L<.9?8:16:10,je=F.length>Fe?F.slice(0,Fe)+"…":F;j.font=`${G?"600":"400"} ${he}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,j.textAlign="center",j.textBaseline="top";const Me=k.y+ee+3/L,ke=j.measureText(je).width,De=4/L,zt=2/L;j.fillStyle="rgba(255,255,255,0.88)",j.fillRect(k.x-ke/2-De,Me-zt,ke+De*2,he+zt*2),j.fillStyle=G?"#1e1b4b":"#0c4a6e",j.fillText(je,k.x,Me)},linkDirectionalArrowLength:k=>{var F,G,J,ee,Z,he;const j=((G=(F=R.current)==null?void 0:F.zoom)==null?void 0:G.call(F))??1,L=((J=k.source)==null?void 0:J.id)===S||((ee=k.target)==null?void 0:ee.id)===S||((Z=k.source)==null?void 0:Z.id)===(_==null?void 0:_.id)||((he=k.target)==null?void 0:he.id)===(_==null?void 0:_.id);return fr(j,L?13:11,9)},linkDirectionalArrowRelPos:.86,linkDirectionalArrowColor:()=>"#475569",linkWidth:k=>{var F,G,J,ee,Z,he;const j=((G=(F=R.current)==null?void 0:F.zoom)==null?void 0:G.call(F))??1,L=((J=k.source)==null?void 0:J.id)===S||((ee=k.target)==null?void 0:ee.id)===S||((Z=k.source)==null?void 0:Z.id)===(_==null?void 0:_.id)||((he=k.target)==null?void 0:he.id)===(_==null?void 0:_.id);return fr(j,L?3.5:3,2.25)},linkColor:k=>{var L,F,G,J;return((L=k.source)==null?void 0:L.id)===S||((F=k.target)==null?void 0:F.id)===S||((G=k.source)==null?void 0:G.id)===(_==null?void 0:_.id)||((J=k.target)==null?void 0:J.id)===(_==null?void 0:_.id)?"#334155":"#64748b"},linkCurvature:k=>k.curvature??.12,linkCanvasObjectMode:()=>"after",linkCanvasObject:(k,j,L)=>{if(L<.45)return;const F=k.source,G=k.target;if(F.x==null||F.y==null||G.x==null||G.y==null)return;const ee={contains:"包含",related_to:"相关",part_of:"属于",depends_on:"依赖"}[k.type]||String(k.type??""),Z=typeof k.curvature=="number"?k.curvature:.12,he=(F.x+G.x)/2,Fe=(F.y+G.y)/2,je=he-(G.y-F.y)*Z,Me=Fe+(G.x-F.x)*Z,ke=.5,De=1-ke,zt=De*De*F.x+2*De*ke*je+ke*ke*G.x,$t=De*De*F.y+2*De*ke*Me+ke*ke*G.y,Ut=2*De*(je-F.x)+2*ke*(G.x-je),pe=2*De*(Me-F.y)+2*ke*(G.y-Me);let Ve=Math.atan2(pe,Ut);(Ve>Math.PI/2||Ve<-Math.PI/2)&&(Ve+=Math.PI);const Dt=fr(L,11,9);j.save(),j.translate(zt,$t),j.rotate(Ve),j.font=`500 ${Dt}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,j.textAlign="center",j.textBaseline="middle";const nn=j.measureText(ee).width,Pt=3/L,Bt=1.5/L;j.fillStyle="rgba(255,255,255,0.92)",j.fillRect(-nn/2-Pt,-Dt/2-Bt,nn+Pt*2,Dt+Bt*2),j.fillStyle="#475569",j.fillText(ee,0,0),j.restore()},onZoom:()=>{var k,j;(j=(k=R.current)==null?void 0:k.refresh)==null||j.call(k)},cooldownTicks:120,cooldownTime:4e3,d3AlphaDecay:.022,d3VelocityDecay:.3,onNodeClick:(k,j)=>{var F,G;const L=k.__childCount??0;if(L>0&&R.current&&Re.current){const J=Re.current.getBoundingClientRect(),ee=R.current.screen2GraphCoords(j.clientX-J.left,j.clientY-J.top),Z=((G=(F=R.current).zoom)==null?void 0:G.call(F))??1,he=(k.type==="concept"?9:5)/Math.max(Z,.35),Fe=7/Math.max(Z,.4),je=k.x+he+Fe*.9,Me=k.y-he*.2,ke=ee.x-je,De=ee.y-Me;if(ke*ke+De*De<=(Fe+4/Z)**2){tn(String(k.id)),N(k.__raw);return}}N(k.__raw),L>0&&!k.__expanded&&tn(String(k.id))},onNodeHover:k=>{var L;if(!k){T(null),E(null);return}T(String(k.id));const j=String(k.name??((L=k.__raw)==null?void 0:L.label)??"");if(R.current&&j){const F=R.current.graph2ScreenCoords(k.x,k.y);E({text:j,x:F.x,y:F.y})}else E({text:j,x:0,y:0})},onBackgroundClick:()=>{N(null),T(null),E(null)},onEngineTick:()=>{var j,L;const k=(L=(j=R.current)==null?void 0:j.graphData)==null?void 0:L.call(j);if(k!=null&&k.nodes)for(const F of k.nodes)F.id!=null&&F.x!=null&&F.y!=null&&U.current.set(String(F.id),{x:F.x,y:F.y})},onEngineStop:()=>{var k,j;(j=(k=R.current)==null?void 0:k.zoomToFit)==null||j.call(k,300,72)},linkHoverPrecision:8,enableNodeDrag:!0,enableZoomInteraction:!0,enablePanInteraction:!0,nodePointerAreaPaint:(k,j,L,F)=>{const G=(k.type==="concept"?14:9)/Math.max(F,.35);if(L.fillStyle=j,L.beginPath(),L.arc(k.x,k.y,G,0,2*Math.PI),L.fill(),k.__childCount>0){const J=10/Math.max(F,.4),ee=(k.type==="concept"?9:5)/Math.max(F,.35),Z=k.x+ee+J*.7,he=k.y-ee*.2;L.beginPath(),L.arc(Z,he,J,0,2*Math.PI),L.fill()}}}),$&&c.jsx("div",{className:"graph-node-tooltip",style:{left:$.x,top:$.y},children:$.text})]}),_&&c.jsxs("div",{className:"graph-detail-panel",children:[c.jsxs("div",{className:"graph-detail-header",children:[c.jsx("span",{className:`graph-node-type-badge ${_.type}`,children:_.type==="concept"?"概念":"知识要点"}),c.jsx("button",{type:"button",className:"graph-close-btn","aria-label":"关闭",onClick:()=>N(null),children:c.jsx(Xt,{size:18,strokeWidth:2.25})})]}),c.jsx("h3",{className:"graph-detail-title",children:_.label}),_.definition&&c.jsxs("div",{className:"graph-detail-section",children:[c.jsx("h4",{children:"定义"}),c.jsx("p",{children:_.definition})]}),c.jsxs("div",{className:"graph-detail-section",children:[c.jsx("h4",{children:"描述"}),c.jsx("p",{children:_.description})]}),c.jsx("div",{className:"graph-detail-meta",children:c.jsxs("span",{children:["置信度: ",(_.confidence*100).toFixed(0),"%"]})}),_.type==="concept"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"graph-detail-section",children:[c.jsxs("h4",{children:["包含的子节点 (",yt(_.id).length,")"]}),c.jsxs("ul",{className:"graph-node-list",children:[yt(_.id).slice(0,20).map(k=>c.jsxs("li",{className:`graph-node-item ${k.type}`,onClick:()=>Ae(k),children:[c.jsx("span",{className:"dot"}),k.label]},k.id)),yt(_.id).length>20&&c.jsxs("li",{className:"muted",children:["还有 ",yt(_.id).length-20," 个..."]})]})]}),c.jsxs("div",{className:"graph-detail-section",children:[c.jsxs("h4",{children:["相关文章 (",kn(_.id).length,")"]}),c.jsx("ul",{className:"graph-doc-list",children:Array.from(new Set(kn(_.id).flatMap(k=>{var j;return((j=k.sources)==null?void 0:j.map(L=>({documentId:L.documentId,title:L.title||L.documentId,heading:L.heading})))||[]}))).slice(0,10).map((k,j)=>c.jsx("li",{className:"graph-doc-item",children:c.jsxs("button",{onClick:()=>o(k.documentId),children:["📄 ",k.title,k.heading&&c.jsxs("span",{className:"muted",children:[" · ",k.heading]})]})},j))})]})]}),_.type==="doc"&&_.sources&&c.jsxs("div",{className:"graph-detail-section",children:[c.jsx("h4",{children:"来源"}),c.jsx("ul",{className:"graph-doc-list",children:_.sources.map((k,j)=>c.jsx("li",{className:"graph-doc-item",children:c.jsxs("button",{onClick:()=>o(k.documentId),children:["📄 ",k.title||k.documentId,k.heading&&c.jsxs("span",{className:"muted",children:[" · ",k.heading]})]})},j))})]}),Lt(_.id).length>0&&c.jsxs("div",{className:"graph-detail-section",children:[c.jsxs("h4",{children:["所属概念 (",Lt(_.id).length,")"]}),c.jsx("ul",{className:"graph-node-list",children:Lt(_.id).map(k=>c.jsxs("li",{className:`graph-node-item ${k.type}`,onClick:()=>Ae(k),children:[c.jsx("span",{className:"dot"}),k.label]},k.id))})]})]}),xe&&c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:k=>{k.target===k.currentTarget&&se(!1)},children:c.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true","aria-label":"配置 AI 模型",children:[c.jsx("h2",{children:"配置 AI 模型"}),c.jsx(Lu,{onConfigured:Ft}),c.jsx("div",{className:"mdocs-dialog-actions",children:c.jsx("button",{type:"button",onClick:()=>se(!1),children:"取消"})})]})})]})}async function pi(e){var r;const n=e.replace(/\u00a0/g," ");if(!n)return!1;try{if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))return await navigator.clipboard.writeText(n),!0}catch{}try{const o=document.createElement("textarea");o.value=n,o.setAttribute("readonly",""),o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="1px",o.style.height="1px",o.style.padding="0",o.style.border="none",o.style.outline="none",o.style.boxShadow="none",o.style.background="transparent",o.style.opacity="0",document.body.appendChild(o),o.focus(),o.select(),o.setSelectionRange(0,n.length);const i=document.execCommand("copy");return document.body.removeChild(o),i}catch{return!1}}function Gu(e){var d;const{t:n}=it(),r=x.useRef(null);x.useEffect(()=>{function h(f){r.current&&!r.current.contains(f.target)&&e.onClose()}function m(f){f.key==="Escape"&&e.onClose()}return window.addEventListener("mousedown",h),window.addEventListener("keydown",m),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",m)}},[e.onClose]);const o=e.node.type==="folder";let i="";if(e.node.type==="folder"){const h=e.node;i=((d=h.folderDisplayName)==null?void 0:d.trim())||h.path||""}const a=o?i?n("newDocIn",{name:i}):n("newDocAtRoot"):n("newDocBeside"),s=o?i?n("newFolderIn",{name:i}):n("newFolderAtRoot"):n("newFolderBeside"),l=e.node.documentId,u=e.node.type==="folder"&&e.node.descDocumentId||e.node.documentId;return c.jsxs("div",{ref:r,className:"mdocs-context-menu card",style:{left:e.x,top:e.y},children:[c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const h=o?e.node.path:e.parentPath;e.onCreateChild(h),e.onClose()},children:a}),c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const h=o?e.node.path:e.parentPath;e.onCreateFolder(h),e.onClose()},children:s}),c.jsx("div",{className:"mdocs-context-divider"}),c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{pi(l).finally(e.onClose)},children:n("copyDocumentId")}),c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const h="/",m=h.endsWith("/")?h:`${h}/`;pi(`${window.location.origin}${m}#/doc/${u}`).finally(e.onClose)},children:n("copyDocumentUrl")}),c.jsx("div",{className:"mdocs-context-divider"}),c.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 Wu({domains:e,value:n,onChange:r,ariaLabel:o,localizeName:i,onDomainsChange:a}){const[s,l]=x.useState(!1),[u,d]=x.useState(e),h=x.useRef(null),m=x.useRef(null);x.useEffect(()=>{d(e)},[e]);const f=u.find(b=>b.domainId===n),p=(f==null?void 0:f.permission)==="private";x.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]),x.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 g(b){r(b),l(!1)}function w(){if(s){l(!1);return}l(!0),Ni().then(b=>{d(b),a==null||a(b)})}return c.jsxs("div",{className:"mdocs-domain-select-wrapper",children:[c.jsxs("button",{ref:h,type:"button",className:"mdocs-domain-select-trigger","aria-label":o,"aria-expanded":s,"aria-haspopup":"listbox",onClick:w,children:[c.jsx("span",{className:"mdocs-domain-select-text",children:f?i(f.domainName):""}),p&&c.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:[c.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),c.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),c.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:c.jsx("path",{d:"M1 1l4 4 4-4"})})]}),s&&c.jsx("div",{ref:m,className:"mdocs-domain-select-menu card",role:"listbox","aria-label":o,children:u.map(b=>c.jsxs("button",{type:"button",className:"mdocs-domain-select-option"+(b.domainId===n?" active":""),role:"option","aria-selected":b.domainId===n,onClick:()=>g(b.domainId),children:[c.jsx("span",{children:i(b.domainName)}),b.permission==="private"&&c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"2",children:[c.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),c.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]},b.domainId))})]})}const ha="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",rt={left:12,bottom:64},Jr="mdocs.agentFabPosition",Hn=36,gi=3;function Xr(e){const r=Math.max(8,window.innerWidth-Hn-8),o=Math.max(8,window.innerHeight-Hn-8);return{left:Math.min(r,Math.max(8,e.left)),bottom:Math.min(o,Math.max(8,e.bottom))}}function qu(e,n,r,o){const i=e-r,a=n-o,s=window.innerHeight-a-Hn;return Xr({left:i,bottom:s})}function Ku(){try{const e=localStorage.getItem(Jr);if(!e)return rt;const n=JSON.parse(e);return typeof n.left!="number"||typeof n.bottom!="number"?rt:Xr({left:n.left,bottom:n.bottom})}catch{return rt}}function yi(e){localStorage.setItem(Jr,JSON.stringify(e))}function Yu(e){return e.left===rt.left&&e.bottom===rt.bottom}function Ju(e){const r=Math.min(480,window.innerWidth-72);let o=e.left+Hn+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 Xu(e){const{t:n}=it(),r=!!e.disableDrag,[o,i]=x.useState(!1),[a,s]=x.useState(e.position),l=x.useRef(null),u=x.useRef(null),d=x.useRef(a),h=x.useRef(e.onPositionChange),m=x.useRef(e.onToggle);d.current=a,h.current=e.onPositionChange,m.current=e.onToggle;const f=x.useRef(null),p=x.useRef(0),g=x.useRef(null);x.useEffect(()=>{f.current||(s(e.position),d.current=e.position)},[e.position]),x.useEffect(()=>{function D(){const P=Xr(d.current);P.left===d.current.left&&P.bottom===d.current.bottom||(d.current=P,s(P),h.current(P),yi(P))}return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]),x.useEffect(()=>{function D(){p.current=0;const N=g.current;if(!N)return;g.current=null,d.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 T=N.clientX-S.startX,$=N.clientY-S.startY;!S.didMove&&T*T+$*$>=gi*gi&&(S.didMove=!0,i(!0)),S.didMove&&(g.current=qu(N.clientX,N.clientY,S.offsetX,S.offsetY),p.current||(p.current=requestAnimationFrame(D)))}function _(N){var T;const S=f.current;if(!(!S||N.pointerId!==S.pointerId)){f.current=null,i(!1),p.current&&(cancelAnimationFrame(p.current),p.current=0),g.current&&(d.current=g.current,s(g.current),g.current=null);try{(T=l.current)==null||T.releasePointerCapture(N.pointerId)}catch{}if(S.didMove){const $=d.current;h.current($),yi($);return}m.current()}}return window.addEventListener("pointermove",P,{passive:!1}),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),p.current&&cancelAnimationFrame(p.current)}},[]);function w(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(){d.current=rt,s(rt),e.onPositionChange(rt),localStorage.removeItem(Jr)}const v=r?rt:a,I=!r&&!Yu(a);return c.jsxs("div",{ref:u,className:"mdocs-agent-fab-wrap"+(o?" dragging":""),style:{left:v.left,bottom:v.bottom},children:[c.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:w,children:c.jsx("img",{src:ha,alt:"",draggable:!1})}),I&&c.jsx("button",{type:"button",className:"mdocs-agent-fab-reset",onClick:b,"aria-label":n("agentFabReset"),children:n("agentFabReset")})]})}function Zu(){const[e,n]=x.useState(()=>typeof window>"u"?rt:Ku());return[e,n]}function Qu({title:e,message:n,onClose:r}){const{t:o}=it();return c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:i=>{i.target===i.currentTarget&&r()},children:c.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&c.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),c.jsx("p",{className:"mdocs-message-dialog-body",children:n}),c.jsx("div",{className:"mdocs-message-dialog-actions",children:c.jsx("button",{type:"button",className:"primary",onClick:r,children:o("gotIt")})})]})})}function pa({title:e,message:n,confirmLabel:r="确定",cancelLabel:o="取消",onConfirm:i,onCancel:a,busy:s=!1,danger:l=!1}){return c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:u=>{u.target===u.currentTarget&&!s&&a()},children:c.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&c.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),c.jsx("p",{className:"mdocs-message-dialog-body",children:n}),c.jsxs("div",{className:"mdocs-message-dialog-actions",style:{gap:8},children:[c.jsx("button",{type:"button",onClick:a,disabled:s,children:o}),c.jsx("button",{type:"button",className:l?"danger":"primary",onClick:i,disabled:s,children:s?"…":r})]})]})})}const vi={"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"},ga={"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 tt(e,n){if(n instanceof Ke)return n.message;if(n instanceof xt){const r=vi[n.message];return r?e(r):n.message}if(n instanceof Error){const r=vi[n.message]??ga[n.message];return r?e(r):n.message}return String(n)}function ef(e,n,r){if(e==="Default")return r("defaultDomain");const o="个人域";return e.endsWith(o)?e.slice(0,-o.length)+r("personalDomainSuffix"):e}function Rm(e,n){return e==="public"?n("domainPublic"):e==="restricted"?n("domainRestricted"):e==="private"?n("domainPrivate"):e}function An(e){const n=e.lastIndexOf("/");return n===-1?"":e.slice(0,n)}function tf(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 mr(e,n){const r=e.trim(),o=n.trim();return o?r?`${r}/${o}`:o:r}function ya(e,n=new Set){for(const r of e)r.type==="document"?n.add(r.path):(r.descDocumentId&&n.add(Gs(r.path)),ya(r.children,n));return n}function En(e,n){for(const r of e){if(r.type==="folder"&&r.path===n)return r.documentId;if(r.type==="folder"){const o=En(r.children,n);if(o)return o}}return null}function hr(e,n){const r=ga[n];return r?e(r):n}function nf(e){const{tree:n,currentDomainId:r,selectedCreateParentPath:o,t:i,onDocCreated:a,refreshTree:s}=e,[l,u]=x.useState(null),[d,h]=x.useState(null),[m,f]=x.useState(!1),p=x.useRef(null);x.useEffect(()=>{if(!l)return;const v=window.setTimeout(()=>{var I;return(I=p.current)==null?void 0:I.focus()},0);return()=>window.clearTimeout(v)},[l]);function g(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 w(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=ya(n),D=l.parentMode==="selection"?o:l.parentPath;try{if(l.kind==="document"){if(l.fileType==="html"){const te=So(l.draft);if(!te.ok){h(hr(i,te.message));return}const ne=te.displayFile,K=ne.replace(/\.html$/i,"").replace(/\.md$/i,"");let ve;try{ve=Do(mr(D,ne))}catch(oe){h(tt(i,oe));return}if(I.has(ve)){h(i("pathExists"));return}const Ce=D?En(n,D)??void 0:void 0,M=await Ir({fileName:ne,displayName:K,content:"",domainId:r,parentId:Ce,fileType:"html"});await s(),a(M),u(null);return}const $=So(l.draft);if(!$.ok){h(hr(i,$.message));return}const E=$.displayFile,R=E.replace(/\.md$/i,"");let U;try{U=Do(mr(D,E))}catch(te){h(tt(i,te));return}if(I.has(U)){h(i("pathExists"));return}const H=D?En(n,D)??void 0:void 0,Y=await Ir({fileName:E,displayName:R,content:tf(R),domainId:r,parentId:H});await s(),a(Y),u(null);return}const P=Ks(l.draft);if(!P.ok){h(hr(i,P.message));return}const _=_r(P.display);if(!_){h(i("invalidFolderName"));return}const N=mr(D,_);if(I.has(N)){h(i("folderExists"));return}const S=D?En(n,D)??void 0:void 0;await sl({name:_,parentId:S,domainId:r}),await s(),u(null)}catch(P){h(tt(i,P))}finally{f(!1)}}return{createModal:l,setCreateModal:u,createModalError:d,createModalBusy:m,createModalInputRef:p,openNewDocumentModal:g,openNewFolderModal:w,submitCreateModal:b}}const bi="(max-width: 768px)";function rf(){const[e,n]=x.useState(()=>typeof window<"u"?window.matchMedia(bi).matches:!1);return x.useEffect(()=>{const r=window.matchMedia(bi),o=()=>n(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),e}function of({open:e,onClose:n,onResolve:r,onForceOverwrite:o,forceBusy:i}){const{t:a}=it();return e?c.jsx("div",{className:"mdocs-conflict-modal-root",role:"alertdialog","aria-modal":"true",children:c.jsxs("div",{className:"mdocs-conflict-modal-panel",children:[c.jsx("h2",{className:"mdocs-conflict-modal-title",children:a("conflictTitle")}),c.jsx("p",{className:"mdocs-conflict-modal-body",children:a("conflictBody")}),o?c.jsx("p",{className:"mdocs-conflict-modal-force-hint",children:a("conflictForceHint")}):null,c.jsxs("div",{className:"mdocs-conflict-modal-actions",children:[c.jsx("button",{type:"button",className:"primary",onClick:r,disabled:i,children:a("conflictResolve")}),o?c.jsx("button",{type:"button",className:"mdocs-conflict-force-btn",disabled:i,onClick:o,children:a(i?"conflictForceBusy":"conflictForce")}):null,c.jsx("button",{type:"button",className:"secondary",onClick:n,disabled:i,children:a("conflictClose")})]})]})}):null}function xi({documentId:e,visitorId:n,visitorName:r,documentOwnerId:o,onClose:i}){const[a,s]=x.useState([]),[l,u]=x.useState(""),[d,h]=x.useState(null),[m,f]=x.useState(!0),[p,g]=x.useState(!1),[w,b]=x.useState(null),[v,I]=x.useState(null),[D,P]=x.useState(360),[_,N]=x.useState(80),S=x.useRef(!1),T=x.useRef(!1),$=300,E=80,R=x.useRef(null);function U(){const W=R.current;if(!W)return;W.style.height="auto";const X=W.scrollHeight,xe=Math.min(Math.max(X,E),$);W.style.height=`${xe}px`,N(xe)}x.useEffect(()=>{setTimeout(()=>U(),0)},[d]);function H(W){return n?W.visitorId===n||o===n:!1}const{rootComments:Y,repliesByParentId:te,totalCount:ne}=x.useMemo(()=>{const W=[],X=new Map;let xe=0;for(const se of a)se.isDeleted||(xe++,se.parentId?(X.has(se.parentId)||X.set(se.parentId,[]),X.get(se.parentId).push(se)):W.push(se));return{rootComments:W,repliesByParentId:X,totalCount:xe}},[a]),K=x.useRef(e);x.useEffect(()=>{K.current=e,u(""),h(null),I(null),ve()},[e]);async function ve(){const W=K.current;f(!0);try{const X=await ul(e);if(K.current!==W)return;s(X.comments)}catch(X){if(K.current!==W)return;I("加载评论失败"),console.error("Failed to load comments:",X)}finally{K.current===W&&f(!1)}}async function Ce(){var W;if(!(!l.trim()||!n)){g(!0),I(null);try{await fl(e,{content:l,parentId:(d==null?void 0:d.commentId)||null,replyToVisitorId:d?((W=a.find(X=>X.commentId===d.commentId))==null?void 0:W.visitorId)??null:null,replyToVisitorName:(d==null?void 0:d.visitorName)||null}),u(""),h(null),setTimeout(()=>U(),0),await ve()}catch(X){I(X.message||"发表失败,请重试")}finally{g(!1)}}}async function M(W){I(null);try{await ml(e,W),await ve()}catch(X){I(X.message||"删除失败,请重试")}finally{b(null)}}function oe(W){const X=Date.now()-new Date(W).getTime(),xe=Math.floor(X/6e4),se=Math.floor(X/36e5),Ye=Math.floor(X/864e5);return xe<1?"刚刚":xe<60?`${xe}分钟前`:se<24?`${se}小时前`:`${Ye}天前`}function ae(W){S.current=!0,W.preventDefault()}function re(W){T.current=!0,W.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="row-resize"}return x.useEffect(()=>{function W(xe){if(S.current){const se=Math.max(280,Math.min(600,window.innerWidth-xe.clientX));P(se)}if(T.current){const se=-xe.movementY;N(Ye=>Math.max(60,Math.min(600,Ye+se)))}}function X(){S.current=!1,T.current=!1,document.body.style.userSelect="",document.body.style.cursor=""}return window.addEventListener("mousemove",W),window.addEventListener("mouseup",X),()=>{window.removeEventListener("mousemove",W),window.removeEventListener("mouseup",X)}},[]),c.jsxs("div",{className:"mdocs-comments-panel",style:{width:D},children:[c.jsx("div",{className:"mdocs-comments-resize-handle",onMouseDown:ae}),c.jsxs("div",{className:"mdocs-comments-header",children:[c.jsxs("h3",{style:{margin:0,fontSize:"1rem",display:"flex",alignItems:"center",gap:6},children:[c.jsx(Ns,{size:18}),"评论 (",ne,")"]}),c.jsx("button",{type:"button",onClick:i,className:"mdocs-comments-close-btn",children:c.jsx(Xt,{size:18})})]}),v&&c.jsxs("div",{className:"mdocs-comments-error",children:[v,c.jsx("button",{type:"button",onClick:()=>I(null),children:c.jsx(Xt,{size:14})})]}),c.jsx("div",{className:"mdocs-comments-list",children:m?c.jsx("div",{className:"mdocs-comments-empty",children:"加载中..."}):Y.length===0?c.jsx("div",{className:"mdocs-comments-empty",children:"暂无评论,来发表第一条吧~"}):Y.map(W=>c.jsxs("div",{className:"mdocs-comment-root",children:[c.jsxs("div",{className:"mdocs-comment-header",children:[c.jsx("span",{className:"mdocs-comment-avatar",children:W.visitorName.charAt(0).toUpperCase()}),c.jsx("span",{className:"mdocs-comment-author",children:W.visitorName}),c.jsx("span",{className:"mdocs-comment-time",children:oe(W.createdAt)}),H(W)&&c.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>b(W.commentId),title:"删除",children:c.jsx(Xt,{size:14})})]}),c.jsx("div",{className:"mdocs-comment-content",children:W.content}),n&&c.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>h({commentId:W.commentId,visitorName:W.visitorName}),children:"回复"}),(te.get(W.commentId)??[]).length>0&&c.jsx("div",{className:"mdocs-comment-replies",children:(te.get(W.commentId)??[]).map(X=>c.jsxs("div",{className:"mdocs-comment-reply",children:[c.jsxs("div",{className:"mdocs-comment-header",children:[c.jsx("span",{className:"mdocs-comment-avatar mdocs-comment-avatar-small",children:X.visitorName.charAt(0).toUpperCase()}),c.jsx("span",{className:"mdocs-comment-author",children:X.visitorName}),X.replyToVisitorName&&c.jsxs("span",{className:"mdocs-comment-reply-to",children:["回复 ",X.replyToVisitorName]}),c.jsx("span",{className:"mdocs-comment-time",children:oe(X.createdAt)}),H(X)&&c.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>b(X.commentId),title:"删除",children:c.jsx(Xt,{size:12})})]}),c.jsx("div",{className:"mdocs-comment-content",children:X.content}),n&&c.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>h({commentId:W.commentId,visitorName:X.visitorName}),children:"回复"})]},X.commentId))})]},W.commentId))}),n?c.jsxs("div",{className:"mdocs-comments-input-wrapper",children:[c.jsx("div",{className:"mdocs-comments-input-drag-handle",onMouseDown:re}),d&&c.jsxs("div",{className:"mdocs-comment-reply-notice",children:[c.jsxs("span",{children:["回复 ",c.jsx("span",{className:"mdocs-comment-reply-to-name",children:d.visitorName})]}),c.jsxs("button",{type:"button",onClick:()=>h(null),children:[c.jsx(Xt,{size:14})," 取消"]})]}),c.jsx("textarea",{ref:R,value:l,onChange:W=>{u(W.target.value.slice(0,512)),setTimeout(()=>U(),0)},placeholder:d?`回复 ${d.visitorName}...`:"发表评论...",className:"mdocs-comments-input",style:{height:_},maxLength:512,onKeyDown:W=>{W.key==="Enter"&&(W.metaKey||W.ctrlKey)&&Ce()}}),c.jsxs("div",{className:`mdocs-comments-char-count${l.length>=460?" mdocs-char-count--warn":""}`,children:[l.length,"/512"]}),c.jsx("div",{className:"mdocs-comments-input-actions",children:c.jsx("button",{type:"button",className:"mdocs-btn-primary",onClick:Ce,disabled:p||!l.trim(),children:p?"发表中...":"发表"})})]}):c.jsx("div",{className:"mdocs-comments-input-wrapper",style:{textAlign:"center"},children:c.jsx("div",{style:{color:"#666",fontSize:"0.9rem"},children:"请先创建访客身份以发表评论"})}),w&&c.jsx(pa,{title:"删除评论",message:"确定要删除这条评论吗?",confirmLabel:"删除",danger:!0,onConfirm:()=>M(w),onCancel:()=>b(null)})]})}const af="mdocs-drafts",sf=5,Ne="drafts";let va=0;const Fr=new Set;function Fm(e){return Fr.add(e),()=>{Fr.delete(e)}}function Lm(){return va}function ba(e,n){va+=1;for(const r of Fr)r(e,n)}const Zt={DOC_NOT_FOUND:"DOC_NOT_FOUND",SYNC_HEAD_MISSING:"SYNC_HEAD_MISSING"};let pr=null;function Qt(){return pr||(pr=new Promise((e,n)=>{const r=indexedDB.open(af,sf);r.onupgradeneeded=o=>{const i=r.result;i.objectStoreNames.contains(Ne)||i.createObjectStore(Ne,{keyPath:"documentId"});const a=o.oldVersion;if(a>0&&a<4){const u=r.transaction.objectStore(Ne).openCursor();u.onsuccess=()=>{const d=u.result;if(!d)return;const h=d.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)),d.update(h),d.continue()}}if(a>0&&a<5){const u=r.transaction.objectStore(Ne).openCursor();u.onsuccess=()=>{const d=u.result;if(!d)return;const h=d.value;h.contentKind==null&&(h.contentKind="lexical",d.update(h)),d.continue()}}},r.onsuccess=()=>e(r.result),r.onerror=()=>n(r.error)})),pr}async function lf(e){var o;const n=await Ee(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 At(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 At(e){const n=await Qt(),r=Zr(e);return new Promise((o,i)=>{const a=n.transaction(Ne,"readwrite");a.objectStore(Ne).put(r),a.oncomplete=()=>{ba(r.documentId,!r.published),o()},a.onerror=()=>i(a.error)})}async function Ee(e){const n=await Qt();return new Promise((r,o)=>{const a=n.transaction(Ne,"readonly").objectStore(Ne).get(e);a.onsuccess=()=>r(a.result),a.onerror=()=>o(a.error)})}async function gr(e){const n=await Qt();return new Promise((r,o)=>{const i=n.transaction(Ne,"readwrite");i.objectStore(Ne).delete(e),i.oncomplete=()=>{ba(e,!1),r()},i.onerror=()=>o(i.error)})}async function cf(e){const n=await Qt();return new Promise((r,o)=>{const a=n.transaction(Ne,"readonly").objectStore(Ne).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 df(e,n){const r=await Qt();return new Promise((o,i)=>{const s=r.transaction(Ne,"readwrite").objectStore(Ne),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 yr(e){const n=await Qt();return new Promise((r,o)=>{const a=n.transaction(Ne,"readwrite").objectStore(Ne),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 vr(e,n){const r=await Ee(e);r&&await At({...r,localBaseCommitId:n.localBaseCommitId,conflictStatus:n.conflictStatus,conflict:n.conflict})}async function br(e){const n=await Ee(e);n&&await At({...n,conflict:void 0,conflictStatus:"none"})}class vn extends Error{constructor(r,o){super(r);qt(this,"code");qt(this,"cause");this.name="DraftPublishAborted",this.code=r,this.cause=o==null?void 0:o.cause}}function uf(e){return e instanceof vn?e.code:e instanceof Ke?e.status===404?Zt.DOC_NOT_FOUND:e.code||`HTTP_${e.status}`:e instanceof Error&&e.message.trim()?e.message.trim().slice(0,120):"UNKNOWN"}function ff(e,n,r,o){const i=(n==null?void 0:n.displayName)||e("unknownTitle");if(r===Zt.SYNC_HEAD_MISSING)return e("draftPublishFailedSyncHead",{name:i});if(r===Zt.DOC_NOT_FOUND)return e("draftPublishFailedNotice",{name:i});const a=o instanceof Ke||o instanceof Error&&o.message?o.message:r;return e("draftPublishFailedGeneric",{name:i,reason:a})}async function mf(e,n,r){const o=uf(n);throw await df(e,o),n instanceof vn?n:new vn(o,{cause:n})}function hf(e,n){const r=x.useRef(n);r.current=n,x.useEffect(()=>{if(!e)return;const o=3e4,i=1e4,a=async()=>{const l=await cf({skipFailed:!0}),u=Date.now();for(const d of l)if(!d.published&&!(u-d.updatedAt<o))try{await r.current(d.documentId)}catch(h){console.log("[autoPublish] scan publish failed:",h)}};a();const s=setInterval(a,i);return()=>clearInterval(s)},[e])}const pf=1e4;function gf(e,n){const[r,o]=x.useState(null),[i,a]=x.useState("up_to_date");return x.useEffect(()=>{if(!e){o(null),a("up_to_date");return}let l=!1;const u=e;async function d(){try{const m=await ol(u,n??void 0);if(l)return;o(m.headCommitId),a(m.status)}catch{}}d();const h=window.setInterval(()=>void d(),pf);return()=>{l=!0,window.clearInterval(h)}},[e,n]),{remoteCommitId:r,syncStatus:i,syncBehind:!!(n&&r&&n!==r)||i==="behind"}}function wi(e){return e.trim()}function yf(e){return e.trim()}const vf=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".ico",".bmp",".jfif",".pjpeg"]);function bf(e){const n=e.split("/").pop()??"",r=n.lastIndexOf(".");return r<=0?"":n.slice(r).toLowerCase()}function xf(e,n,r){let o,i;try{o=new URL(r),i=new URL(e,r)}catch{return null}if(i.origin!==o.origin||!i.pathname.startsWith("/api/assets/")||vf.has(bf(i.pathname)))return null;const a=n==null?void 0:n.trim();return a&&!i.searchParams.has("name")&&i.searchParams.set("name",a),i.toString()}function wf(){const e=n=>{if(n.button!==0)return;const o=n.composedPath().find(a=>a instanceof HTMLAnchorElement);if(!o)return;const i=xf(o.href,o.getAttribute("download"),window.location.href);i&&(n.preventDefault(),n.stopPropagation(),window.location.assign(i))};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)}const Ge={DOCUMENT:"md",HTML:"html",FOLDER:"dir",FOLDER_DESC:"folder_desc",GRAPH_FILE:"graph_file",GRAPH_DIR:"graph_dir"},_f="/assets/mdocs-logo-Dsv_2t6v.svg",kf=x.lazy(()=>Ot(()=>import("./DocumentEditor-ByqPHijF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.DocumentEditor}))),If=x.lazy(()=>Ot(()=>import("./HtmlEditor-CpqCAPAr.js"),__vite__mapDeps([14,1,11,12,13,2,3,6,15])).then(e=>({default:e.HtmlEditor}))),Cf=x.lazy(()=>Ot(()=>import("./SettingsPage-C8doYEbb.js"),__vite__mapDeps([16,1,13,8,2,3,6])).then(e=>({default:e.SettingsPage}))),Sf=x.lazy(()=>Ot(()=>import("./AgentChatPanel-C3c14Bo_.js"),__vite__mapDeps([17,1,18,8,9,7,2,3,6])).then(e=>({default:e.AgentChatPanel}))),Df=x.lazy(()=>Ot(()=>import("./AiWriteWorkbench-ze827qk7.js"),__vite__mapDeps([19,1,18,7,2,3,6])).then(e=>({default:e.AiWriteWorkbench}))),Pf=x.lazy(()=>Ot(()=>import("./MergeView-D93ZHlTG.js"),__vite__mapDeps([20,1,4,5,2,3,6,7,8,9,12])).then(e=>({default:e.MergeView})));function Nf(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 xr(e,n,r,o){const i=await Ni();n(i);const a=localStorage.getItem("mdocs.currentDomainId"),l=a&&i.some(u=>u.domainId===a)?a:vl(i,e);r(l),await o(l)}function _i(){const{t:e,lang:n,setLang:r}=it(),[o,i]=x.useState("loading"),[a,s]=x.useState(()=>localStorage.getItem("mdocs.sidebarCollapsed")==="true"),l=rf(),[u,d]=x.useState(!1),h=()=>{if(l){d(O=>!O);return}const y=!a;s(y),localStorage.setItem("mdocs.sidebarCollapsed",String(y))};x.useEffect(()=>{l||d(!1)},[l]),x.useEffect(()=>wf(),[]);const[m,f]=x.useState(!1),[p,g]=x.useState(0),w=x.useRef(null),[b,v]=x.useState(null),[I,D]=x.useState(null),[P,_]=x.useState(null),[N,S]=x.useState([]),[T,$]=x.useState([]),[E,R]=x.useState("default"),[U,H]=x.useState(!1),Y=x.useRef(null),{documentId:te}=Fa(),ne=La(),[K,ve]=x.useState(null),Ce=(K==null?void 0:K.kind)==="document"?K.documentId:null,[M,oe]=x.useState(null),[ae,re]=x.useState(null),W=x.useRef(ae);W.current=ae;const[X,xe]=x.useState(0),[se,Ye]=x.useState(null),[kt,pt]=x.useState(!1),[en,Rt]=x.useState(!1),[It,Je]=x.useState(!1),[_e,Xe]=x.useState(!1),xn=(M==null?void 0:M.documentId)??null,{syncBehind:Ze,remoteCommitId:Ct}=gf(xn,se),[ze,Ft]=x.useState(null);x.useEffect(()=>{if(!It||!M){Ft(null);return}(async()=>{const y=await Ee(M.documentId);if(y!=null&&y.conflict){Ft(y.conflict);return}if(y&&se&&Ct){const O=y.localBaseCommitId??se;if(!O)return;const A={localBaseCommitId:O,remoteCommitId:Ct,localSnapshotContent:y.content};await vr(M.documentId,{localBaseCommitId:A.localBaseCommitId,conflictStatus:"diverged",conflict:A}),Ft(A)}})()},[It,M,se,Ct]),x.useEffect(()=>{!M||!Ze||!_e||Ee(M.documentId).then(async y=>{!y||y.conflict||y.conflictStatus==="publish_conflict"||y.conflictStatus!=="diverged"&&await At({...y,conflictStatus:"diverged"})})},[M==null?void 0:M.documentId,Ze,_e]),x.useEffect(()=>{if(!M){Ye(null);return}let y=!1;return Ee(M.documentId).then(O=>{y||(O&&!O.published&&O.localBaseCommitId?Ye(O.localBaseCommitId):Ye(M.headCommitId??null))}),()=>{y=!0}},[M==null?void 0:M.documentId,M==null?void 0:M.headCommitId,_e]);const[Te,ue]=x.useState(null),[Se,ye]=x.useState(null),[be,St]=x.useState(null),[gt,at]=x.useState(null),[tn,Ae]=x.useState(""),[wn,st]=x.useState("docs"),[Re,He]=x.useState(!1),[_n,yt]=x.useState(!1),[Lt,kn]=Zu(),k=x.useRef(null),[j,L]=x.useState(!1),[F,G]=x.useState(null),J=x.useRef(void 0),ee=x.useRef(void 0);hf(localStorage.getItem("mdocs.autoPublish")==="true",lo);async function Z(y){var O;await((O=J.current)==null?void 0:O.call(J)),y()}function he(y){const A=(y.trim()||"untitled").replace(/[\\/:*?"<>|]/g,"-").slice(0,80);return A.endsWith(".md")?A:`${A}.md`}async function Fe(){var A,B;if(!M||!ae)return;await((A=J.current)==null?void 0:A.call(J));const y=M.fileType===Ge.HTML;let O="";if(y)O=wi(ae.content);else if(O=((B=ee.current)==null?void 0:B.call(ee))??"",!O.trim())try{O=(await or({content:ae.content,from:"lexical",to:"markdown"})).content}catch{O=""}G({markdown:O,documentId:M.documentId,displayName:ae.displayName||M.displayName||"未命名",fileType:y?Ge.HTML:Ge.DOCUMENT}),L(!0),He(!1)}function je(){G({markdown:"",documentId:null,displayName:"未命名",fileType:Ge.DOCUMENT}),L(!0),He(!1)}async function Me(y){var le,we;const O=y.documentId.trim();if(!O)return;await((le=J.current)==null?void 0:le.call(J));let A="",B=y.displayName.trim()||"未命名",Q=Ge.DOCUMENT;try{const Wt=await Kt(O);if(B=((we=Wt.displayName)==null?void 0:we.trim())||B,Q=Wt.fileType===Ge.HTML?Ge.HTML:Ge.DOCUMENT,Q===Ge.HTML)A=wi(Wt.content);else try{A=(await or({content:Wt.content,from:"lexical",to:"markdown"})).content}catch{A=""}}catch{}G({markdown:A,documentId:O,displayName:B,fileType:Q}),L(!0),He(!1),st("docs"),Z(()=>ne(`/doc/${O}`))}async function ke(y){(M==null?void 0:M.documentId)===y.documentId&&await Xn()}async function De(y){const A=(y.documentId&&(F==null?void 0:F.documentId)===y.documentId?F.fileType:(M==null?void 0:M.documentId)===y.documentId?M.fileType:Ge.DOCUMENT)===Ge.HTML;if(y.documentId){const Q=(M==null?void 0:M.documentId)===y.documentId?M:null;let le;return A?le=yf(y.markdown):le=(await or({content:y.markdown,from:"markdown",to:"lexical"})).content,await lf({documentId:y.documentId,content:le,displayName:y.displayName,localBaseCommitIdAtEditStart:(Q==null?void 0:Q.headCommitId)??null,contentKind:A?"html":"lexical",snapshotMeta:Q?{permission:Q.permission,ownerVisitorId:Q.ownerVisitorId,domainId:Q.domainId}:void 0}),(M==null?void 0:M.documentId)===y.documentId?(re({documentId:y.documentId,content:le,displayName:y.displayName}),xe(we=>we+1),Xe(!0)):await Ht(y.documentId),ue("帮写已写入草稿,可在编辑器中继续修改后发布"),{documentId:y.documentId}}const B=await Ir({fileName:he(y.displayName),displayName:y.displayName,content:y.markdown,contentFormat:"markdown",domainId:E||void 0,parentId:void 0});return await pe(),await Ht(B.documentId),ue("已创建文档"),{documentId:B.documentId}}x.useEffect(()=>{zt()},[]),x.useEffect(()=>{if(!Te)return;const y=()=>{ue(null)};return window.addEventListener("pointerdown",y,!0),()=>window.removeEventListener("pointerdown",y,!0)},[Te]),x.useEffect(()=>{const y=O=>{var Q,le,we;const A=O;if(((Q=A.detail)==null?void 0:Q.status)===409||((le=A.detail)==null?void 0:le.code)==="AI_NOT_CONFIGURED")return;const B=(we=A.detail)==null?void 0:we.message;B&&ye(B)};return window.addEventListener(kr,y),()=>window.removeEventListener(kr,y)},[]);async function zt(){try{const y=await jo();v(y),On(y.visitorId),await xr(y.visitorId,$,R,pe),i("ready")}catch(y){if(y instanceof Ke&&y.status===401){i("needsRegister");return}ye(tt(e,y)),i("needsRegister")}}async function $t(y,O){const A=await Qs(y,O);v(A.visitor),D(A.visitor.visitorId),_(A.recoveryCode),On(A.visitor.visitorId),await xr(A.visitor.visitorId,$,R,pe),i("ready")}async function Ut(y){const O=await jo();v(O),await xr(O.visitorId,$,R,pe),i("ready")}async function pe(y){const A=await rl(y??E);S(A)}function Ve(y){re({documentId:y.documentId,content:y.content,displayName:y.displayName}),xe(O=>O+1),Xe(!1)}function Dt(y,O){re({documentId:y,content:O.content,displayName:O.displayName}),xe(A=>A+1),Xe(!0)}async function nn(y,O){await gr(y);const A=await Kt(y);if((M==null?void 0:M.documentId)===y&&w.current===y){oe(on(A)),Xe(!1);const B=W.current,Q=O!==void 0&&A.content===O,le=(B==null?void 0:B.documentId)===y&&B.content===A.content;Q||le?(B==null?void 0:B.documentId)===y&&B.displayName!==A.displayName&&re({...B,displayName:A.displayName}):Ve(A)}return A}function Pt(y,O,A="folder"){console.log("[openGraph]",A,y,O),oe(null),re(null),ve({kind:"graph",scope:A,resourceId:y,name:O})}function Bt(){ve(null)}x.useEffect(()=>{function y(O){Y.current&&!Y.current.contains(O.target)&&H(!1)}if(U)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[U]);async function Ht(y){w.current=y,st("docs"),ve({kind:"document",documentId:y});try{const O=await Ee(y);if(w.current!==y)return;const A=await Kt(y);if(w.current!==y||(A.domainId!==E&&(localStorage.setItem("mdocs.currentDomainId",A.domainId),R(A.domainId),pe(A.domainId)),Ae(An(A.relativePath)),A.headCommitId&&O&&!O.published&&(O.publishError===Zt.SYNC_HEAD_MISSING&&await yr(y),O.localBaseCommitId||await At({...O,localBaseCommitId:A.headCommitId})),oe(on(A)),w.current!==y))return;O&&!O.published?Dt(y,O):Ve(A)}catch(O){if(w.current!==y)return;ye(tt(e,O))}}x.useEffect(()=>{o==="ready"&&(te?Ht(te):(ve(null),oe(null),re(null),Ye(null)))},[o,te]);const{createModal:Vt,setCreateModal:Kn,createModalError:Qr,createModalBusy:Gt,createModalInputRef:wa,openNewDocumentModal:In,openNewFolderModal:eo,submitCreateModal:_a}=nf({tree:N,currentDomainId:E,selectedCreateParentPath:tn,t:e,onDocCreated:y=>{oe(on(y)),Ve(y),Ae(An(y.relativePath)),ne(`/doc/${y.documentId}`)},refreshTree:pe}),[ka,Cn]=x.useState(!1),[Ia,rn]=x.useState(!1),[Nt,to]=x.useState([]),[Yn,no]=x.useState(""),[Sn,ro]=x.useState(""),[Ca,oo]=x.useState(new Set);async function Sa(){try{const y=await cl();to(y)}catch(y){ye(tt(e,y))}}const Jn=x.useMemo(()=>{const y={};for(const O of T)y[O.domainId]=O.domainName;return y},[T]),io=x.useMemo(()=>{let y=Nt;const O=Yn.trim().toLowerCase();return O&&(y=y.filter(A=>{var B;return(B=A.displayName)==null?void 0:B.toLowerCase().includes(O)})),Sn&&(y=y.filter(A=>A.domainId===Sn)),y},[Nt,Yn,Sn]),Da=x.useMemo(()=>{const y=new Set,O=[];for(const A of Nt){const B=A.domainId;B&&!y.has(B)&&(y.add(B),O.push({id:B,name:Jn[B]??B}))}return O},[Nt,Jn]);async function Pa(y,O,A,B,Q){let le=await Ee(y);!le&&(M==null?void 0:M.documentId)===y&&(le={documentId:y,content:O,displayName:A,updatedAt:Date.now(),published:!1,localBaseCommitId:B,permission:M.permission,ownerVisitorId:M.ownerVisitorId,domainId:M.domainId},await At(le)),le&&await vr(y,{localBaseCommitId:B,conflictStatus:"publish_conflict",conflict:{localBaseCommitId:B,remoteCommitId:Q.headCommitId,localSnapshotContent:O}}),pt(!0)}async function Na(){if(!M||en||(b==null?void 0:b.visitorId)!==M.ownerVisitorId||!window.confirm(e("conflictForceConfirm")))return;const O=M.documentId;Rt(!0);try{await nr(O).execute(async()=>{var Qn,uo,fo,mo,ho;const A=await Ee(O),B=((Qn=A==null?void 0:A.conflict)==null?void 0:Qn.localBaseCommitId)??(A==null?void 0:A.localBaseCommitId)??se??M.headCommitId,Q=((uo=A==null?void 0:A.conflict)==null?void 0:uo.remoteCommitId)??(ze==null?void 0:ze.remoteCommitId),le=((fo=A==null?void 0:A.conflict)==null?void 0:fo.localSnapshotContent)??(A==null?void 0:A.content)??((mo=W.current)==null?void 0:mo.content),we=(A==null?void 0:A.displayName)??((ho=W.current)==null?void 0:ho.displayName)??M.displayName;if(!B||!Q||le==null)throw ye(e("syncHeadMissing")),new Error("missing force overwrite payload");await rr(O,{content:le,displayName:we,version:{localBaseCommitId:B,merge:{remoteCommitId:Q,localSnapshotContent:le,forceLocal:!0}}});const Wt=await Kt(O);await so(Wt)})}catch(A){A instanceof Error&&A.message==="missing force overwrite payload"||ye(tt(e,A))}finally{Rt(!1)}}async function ao(y,O,A,B){return nr(A).execute(async()=>{const Q=await Ee(A),le=(Q==null?void 0:Q.localBaseCommitId)??(M==null?void 0:M.headCommitId);if(!le)throw ye(e("syncHeadMissing")),new Error("missing localBaseCommitId");try{await rr(A,{content:y,displayName:O,permission:B,version:{localBaseCommitId:le}}),await br(A),await nn(A,y),await pe(),pt(!1),ue(e("published")),window.setTimeout(()=>ue(null),1200)}catch(we){throw we instanceof Ke&&we.status===409&&we.code==="VERSION_CONFLICT"&&we.details&&typeof we.details=="object"&&await Pa(A,y,O,le,we.details),we}})}async function Ta(){if(!M)return;const y=await Kt(M.documentId);y.domainId!==E&&(localStorage.setItem("mdocs.currentDomainId",y.domainId),R(y.domainId),pe(y.domainId)),Ae(An(y.relativePath)),oe(on(y)),Ve(y),ue(e("syncPullDone")),window.setTimeout(()=>ue(null),1200)}async function Xn(){if(!M)return;const y=await Ee(M.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)){Je(!0);return}if(O&&y){if(Ze&&Ct){const B=y.localBaseCommitId??se;if(B){const Q={localBaseCommitId:B,remoteCommitId:Ct,localSnapshotContent:y.content};await vr(M.documentId,{localBaseCommitId:B,conflictStatus:"diverged",conflict:Q}),Ft(Q)}Je(!0);return}ue(e("pullBlockedDraft")),window.setTimeout(()=>ue(null),3e3);return}await Ta()}async function so(y){await br(y.documentId),await gr(y.documentId),Xe(!1),Je(!1),pt(!1),await Ht(y.documentId),pe(y.domainId),ue(e("published")),window.setTimeout(()=>ue(null),1200)}async function Aa(y,O,A){try{await mf(y,O,A)}catch(B){if(!(B instanceof vn))throw B;const Q=A??await Ee(y);throw ue(ff(e,Q,B.code,B.cause??O)),window.setTimeout(()=>ue(null),4e3),B}}async function lo(y){let O;try{await nr(y).execute(async()=>{const A=await Ee(y);if(!A)return;O=A;let B=A.localBaseCommitId;if(B||(B=(await Kt(y)).headCommitId??void 0,B&&(await At({...A,localBaseCommitId:B}),A.publishError===Zt.SYNC_HEAD_MISSING&&await yr(y))),!B)throw new vn(Zt.SYNC_HEAD_MISSING);const Q=await Ee(y);Q&&(await rr(y,{content:Q.content,displayName:Q.displayName,version:{localBaseCommitId:B}}),await br(y),await yr(y),(M==null?void 0:M.documentId)===y?await nn(y,Q.content):await gr(y),await pe(),ue(e("published")),window.setTimeout(()=>ue(null),1200))})}catch(A){await Aa(y,A,O)}}function Zn(y,O){St({type:"document",id:y,name:O})}function co(y,O){St({type:"folder",id:y,name:O})}async function ja(y,O){try{const A=await al(y,O);await pe(A.domainId),(M==null?void 0:M.documentId)===y&&(oe(on(A)),Ae(An(A.relativePath)))}catch(A){A instanceof Ke?A.status===409&&ye(A.message):ye(tt(e,A))}}async function Ma(){if(be)try{be.type==="document"?(await il(be.id),(M==null?void 0:M.documentId)===be.id&&(oe(null),re(null),Ae(""),ne("/"))):be.type==="folder"&&(await ll(be.id),M&&(oe(null),re(null),Ae(""),ne("/"))),await pe(),ue(be.type==="folder"?`已删除「${be.name}」及其下所有内容`:`已删除「${be.name}」`),window.setTimeout(()=>ue(null),2e3)}catch(y){ye(tt(e,y))}finally{St(null)}}return o==="loading"?c.jsx("div",{className:"mdocs-loading muted",children:e("loading")}):o==="needsRegister"?c.jsx(bl,{onSubmit:$t,onRecover:Ut,error:Te}):c.jsxs("div",{className:"mdocs-app-root",children:[Pi(),c.jsx("div",{className:"mdocs-shell",children:wn==="settings"?c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"mdocs-main muted",style:{padding:24},children:"加载设置…"}),children:c.jsx(Cf,{onBack:()=>st("docs"),onPublishDraft:lo,onOpenDocument:Ht,onRecoverDraft:()=>void pe()})}):c.jsxs("div",{className:"mdocs-layout"+(l?" mdocs-layout--reader":""),children:[l&&u?c.jsx("button",{type:"button",className:"mdocs-mobile-nav-scrim","aria-label":e("collapseSidebar"),onClick:()=>d(!1)}):null,c.jsxs("aside",{className:"mdocs-sidebar"+(l?u?" mdocs-sidebar--drawer-open":" mdocs-sidebar--drawer":a?" mdocs-sidebar-collapsed":""),children:[c.jsxs("header",{className:"mdocs-sidebar-header",children:[c.jsxs("div",{className:"mdocs-brand",children:[c.jsx("img",{src:_f,alt:e("brand"),className:"mdocs-brand-logo"}),c.jsx("span",{children:e("brand")})]}),c.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?c.jsx(xo,{size:18}):a?c.jsx(wo,{size:18}):c.jsx(xo,{size:18})})]}),c.jsxs("div",{className:"mdocs-sidebar-actions",ref:Y,children:[c.jsxs("button",{type:"button",className:"mdocs-sidebar-create-btn",onClick:()=>H(y=>!y),children:[c.jsx(bo,{size:15,strokeWidth:1.75}),e("newArticle")]}),U&&c.jsxs("div",{className:"mdocs-create-dropdown",children:[c.jsxs("button",{type:"button",className:"mdocs-create-dropdown-item",onClick:()=>{H(!1),In()},children:[c.jsx(bo,{size:14,strokeWidth:1.5}),"Markdown"]}),c.jsxs("button",{type:"button",className:"mdocs-create-dropdown-item",onClick:()=>{H(!1),In(void 0,"html")},children:[c.jsx(ms,{size:14,strokeWidth:1.5}),"HTML"]})]}),c.jsxs("button",{type:"button",className:"mdocs-sidebar-create-btn",onClick:()=>{H(!1),eo()},children:[c.jsx(_s,{size:15,strokeWidth:1.75}),e("newDirectory")]}),c.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":"知识图谱",onClick:()=>Pt(E,"知识图谱","domain"),children:c.jsx(Lr,{size:18,strokeWidth:1.75})})]}),c.jsx(wl,{nodes:N,activeDocumentId:Ce,graphFocusAnchorId:(K==null?void 0:K.kind)==="graph"?K.resourceId:null,selectedParentPath:tn,onOpen:y=>{l&&d(!1),Z(()=>ne(`/doc/${y.documentId}`))},onOpenFolder:(y,O)=>{Z(()=>{Ae(y),O&&(Bt(),l&&d(!1),ne(`/doc/${O}`))})},onContextMenu:at,onMoveDocument:ja,onDeselect:()=>{Bt(),Z(()=>{Ae(""),ne("/")})},onOpenGraph:(y,O)=>{if(y.type==="folder")Pt(y.documentId,y.name);else if(O){const A=N.find(B=>B.documentId===O);Pt(O,(A==null?void 0:A.name)??"图谱")}},onGenerateGraph:async(y,O)=>{var Q;const A=y.type==="folder"?y.documentId:O;if(!A)return;const B=y.type==="folder"?y.name:((Q=N.find(le=>le.documentId===O))==null?void 0:Q.name)??"图谱";Pt(A,B)}}),c.jsxs("footer",{className:"mdocs-sidebar-footer",children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,cursor:"pointer"},onClick:()=>Z(()=>st("settings")),children:[c.jsx("span",{className:"mdocs-visitor-avatar",children:b?b.visitorName.charAt(0).toUpperCase():"?"}),c.jsx("span",{className:"mdocs-visitor-footer-name",children:b?b.visitorName:""})]}),c.jsx("button",{type:"button",className:"mdocs-sidebar-bookmark mdocs-tooltip","data-tooltip":e("bookmark"),onClick:()=>{rn(!0),no(""),ro(""),Sa()},style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",fontSize:"1rem",lineHeight:1,borderRadius:4},children:c.jsx(Rs,{size:16,strokeWidth:1.5})}),c.jsx("button",{type:"button",className:"mdocs-sidebar-logout mdocs-tooltip","data-tooltip":e("logout"),onClick:()=>Cn(!0),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4},children:c.jsx(Ds,{size:16,strokeWidth:1.5})})]})]}),c.jsxs("main",{className:"mdocs-main",children:[(K==null?void 0:K.kind)==="graph"?c.jsx(Vu,{scope:K.scope,resourceId:K.resourceId,name:K.name,onClose:Bt,onOpenDocument:y=>{Ht(y)}},`${K.scope}-${K.resourceId}`):M&&ae&&ae.documentId===M.documentId?M.fileType==="html"?c.jsxs("div",{className:"mdocs-editor-with-comments",children:[c.jsx("div",{className:"mdocs-editor-container",children:c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"muted",style:{padding:24},children:"加载编辑器…"}),children:c.jsx(If,{meta:M,initialContent:ae.content,initialDisplayName:ae.displayName,contentRevision:X,canEdit:!!(b&&(M.ownerVisitorId===b.visitorId||Io(M.permission)||M.invitedEdit===!0)),domains:T,currentDomainId:E,onDomainChange:y=>{Z(()=>{localStorage.setItem("mdocs.currentDomainId",y),R(y),oe(null),re(null),Ae(""),ne("/"),pe(y)})},onDomainsChange:$,onContentChange:y=>{re(O=>O&&{...O,content:y})},onDraftExistsChange:Xe,hasLocalDraft:_e,onPublish:ao,syncBehind:Ze,onSyncClick:()=>void Xn(),canManageInvites:!!(b&&b.visitorId===M.ownerVisitorId),onDelete:async()=>{Zn(M.documentId,M.relativePath)},onToggleComments:()=>f(!m),commentPanelOpen:m,commentCount:p,onAiWrite:l?void 0:()=>void Fe(),onShowToast:ue,readerChrome:l,onOpenMobileNav:()=>d(!0)},M.documentId)})}),m&&c.jsx(xi,{documentId:M.documentId,visitorId:b==null?void 0:b.visitorId,visitorName:b==null?void 0:b.visitorName,documentOwnerId:M.ownerVisitorId,onClose:()=>f(!1)})]}):c.jsxs("div",{className:"mdocs-editor-with-comments",children:[c.jsx("div",{className:"mdocs-editor-container",children:c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"muted",style:{padding:24},children:"加载编辑器…"}),children:c.jsx(kf,{meta:M,initialContent:ae.content,initialDisplayName:ae.displayName,contentRevision:X,canEdit:!!(b&&(M.ownerVisitorId===b.visitorId||Io(M.permission)||M.invitedEdit===!0)),domains:T,currentDomainId:E,onDomainChange:y=>{Z(()=>{localStorage.setItem("mdocs.currentDomainId",y),R(y),oe(null),re(null),Ae(""),ne("/"),pe(y)})},onDomainsChange:$,onPublish:ao,syncBehind:Ze,onSyncClick:()=>void Xn(),onDraftExistsChange:Xe,hasLocalDraft:_e,onConflictModalRequest:()=>pt(!0),onMergeRequest:()=>Je(!0),canManageInvites:!!(b&&b.visitorId===M.ownerVisitorId),onDelete:async()=>{if(M.relativePath.endsWith("/___desc___.md")){const y=M.relativePath.replace(/\/___desc___\.md$/,"");co(M.documentId,y)}else Zn(M.documentId,M.relativePath)},saveBeforeNavRef:J,exportMarkdownRef:ee,onShowToast:ue,onShowError:ye,onToggleComments:()=>f(!m),commentPanelOpen:m,commentCount:p,onAiWrite:l?void 0:()=>void Fe(),readerChrome:l,onOpenMobileNav:()=>d(!0)},M.documentId)})}),m&&c.jsx(xi,{documentId:M.documentId,visitorId:b==null?void 0:b.visitorId,visitorName:b==null?void 0:b.visitorName,documentOwnerId:M.ownerVisitorId,onClose:()=>f(!1)})]}):c.jsxs("div",{className:"mdocs-welcome",children:[l?c.jsxs("button",{type:"button",className:"mdocs-reader-float-pill",onClick:()=>d(!0),"aria-label":e("expandSidebar"),children:[c.jsx(wo,{size:18,strokeWidth:1.75}),c.jsx("span",{children:e("brand")})]}):null,c.jsx("div",{className:"mdocs-welcome-icon",children:c.jsx(us,{size:64,strokeWidth:1,opacity:.15})}),c.jsx("h1",{children:e("brand")}),c.jsx("p",{className:"mdocs-welcome-lead",children:e("createDocToStart")}),c.jsxs("div",{className:"mdocs-welcome-actions",children:[c.jsxs("button",{type:"button",className:"primary",onClick:()=>In(),style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx(xs,{size:16,strokeWidth:1.5}),e("startWriting")]}),l?null:c.jsxs("button",{type:"button",className:"secondary",onClick:()=>je(),style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx("img",{src:ha,alt:"",width:16,height:16,style:{display:"block"}}),"AI 帮写"]})]}),c.jsxs("div",{className:"mdocs-welcome-domain",children:[c.jsx("label",{className:"muted mdocs-welcome-domain-label",children:e("domainLabel")}),c.jsx(Wu,{domains:T.length?T:[{domainId:"default",domainName:e("defaultDomain"),permission:"",creatorVisitorId:"",docCount:0}],value:E,onChange:y=>{Z(()=>{localStorage.setItem("mdocs.currentDomainId",y),R(y),oe(null),re(null),Ae(""),ne("/"),pe(y)})},onDomainsChange:$,ariaLabel:e("domainLabel"),localizeName:y=>ef(y,n,e)})]})]}),c.jsx(of,{open:kt,onClose:()=>pt(!1),onResolve:()=>{pt(!1),Je(!0)},onForceOverwrite:b&&M&&b.visitorId===M.ownerVisitorId?()=>void Na():void 0,forceBusy:en}),It&&M&&ze&&c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"merge-view-loading",children:e("mergeLoadingRemote")}),children:c.jsx(Pf,{documentId:M.documentId,displayName:M.displayName,conflict:ze,fileType:M.fileType,onClose:()=>Je(!1),onSuccess:so,onError:y=>ye(y)})}),Te&&c.jsx("div",{className:"mdocs-toast",role:"status",children:Te}),Se&&c.jsx(Qu,{title:e("error"),message:Se,onClose:()=>ye(null)})]}),ka&&c.jsx("div",{className:"mdocs-dialog-backdrop",onClick:y=>{y.target===y.currentTarget&&Cn(!1)},children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:440},children:[c.jsx("h1",{style:{fontSize:"1.125rem",marginBottom:8},children:"退出当前登录身份?"}),c.jsx("p",{style:{lineHeight:1.6,color:"var(--mdocs-text-secondary, #666)",marginBottom:20},children:"这将会导致您无法修改以前的文章。如果想找回账号,需要恢复码或联系管理员执行合并用户脚本。"}),c.jsxs("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end"},children:[c.jsx("button",{type:"button",onClick:()=>Cn(!1),children:"取消"}),c.jsx("button",{type:"button",className:"primary",style:{background:"#d32f2f"},onClick:()=>{Zs(),oe(null),re(null),v(null),S([]),Cn(!1),i("needsRegister")},children:"确认退出"})]})]})}),Ia&&c.jsx("div",{className:"mdocs-dialog-backdrop",onClick:y=>{y.target===y.currentTarget&&rn(!1)},children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:640,width:"min(640px, 100%)",maxHeight:"70vh",display:"flex",flexDirection:"column"},children:[c.jsxs("h1",{style:{fontSize:"1.125rem",marginBottom:16},children:[e("bookmarkTitle"),"(",Nt.length,")"]}),Nt.length>0&&c.jsxs("div",{className:"mdocs-bookmark-filterbar",children:[c.jsx("input",{type:"text",placeholder:e("bookmarkSearch"),value:Yn,onChange:y=>no(y.target.value)}),c.jsxs("select",{value:Sn,onChange:y=>ro(y.target.value),children:[c.jsx("option",{value:"",children:e("bookmarkFilterAll")}),Da.map(y=>c.jsx("option",{value:y.id,children:y.name},y.id))]})]}),Nt.length===0?c.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkEmpty")}):io.length===0?c.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkNoMatch")}):c.jsx("div",{style:{overflowY:"auto",flex:1,margin:"0 -1rem",padding:"0 1rem"},children:c.jsxs("table",{className:"mdocs-bookmark-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:e("bookmarkColTitle")}),c.jsx("th",{children:e("bookmarkColDomain")}),c.jsx("th",{children:e("bookmarkColAuthor")}),c.jsx("th",{children:e("bookmarkColTime")}),c.jsx("th",{className:"mdocs-bookmark-col-action"})]})}),c.jsx("tbody",{children:io.map(y=>{const O=Ca.has(y.documentId);return c.jsxs("tr",{className:`${O?"mdocs-bookmark-removing":""}`,style:{opacity:y.isDeleted?.6:1},children:[c.jsx("td",{className:"mdocs-bookmark-col-title",children:c.jsxs("div",{style:{cursor:y.isDeleted?"default":"pointer",display:"flex",alignItems:"center",gap:6,overflow:"hidden"},onClick:()=>{y.isDeleted||Z(()=>{rn(!1),ne(`/doc/${y.documentId}`)})},children:[c.jsx("span",{ref:A=>{if(A){const B=A.scrollWidth>A.clientWidth;A.title=B?y.displayName??"":""}},style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:y.displayName??"(无标题)"}),y.isDeleted&&c.jsx("span",{style:{fontSize:"0.7rem",color:"#d32f2f",background:"#ffebee",padding:"1px 6px",borderRadius:4,flexShrink:0},children:"已删除"})]})}),c.jsx("td",{children:y.isDeleted?"":Jn[y.domainId??""]??y.domainId??""}),c.jsx("td",{children:y.isDeleted?"":y.ownerVisitorName??"-"}),c.jsx("td",{children:y.isDeleted?"":Nf(y.bookmarkedAt,n)}),c.jsx("td",{className:"mdocs-bookmark-col-action",children:c.jsxs("div",{style:{display:"flex",gap:2,alignItems:"center",justifyContent:"flex-end"},children:[c.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkOpen"),onClick:()=>{y.isDeleted||Z(()=>{rn(!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:c.jsx(ls,{size:14,strokeWidth:1.5})}),c.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkRemove"),onClick:async()=>{try{await dl(y.documentId),oo(A=>new Set(A).add(y.documentId)),setTimeout(()=>{to(A=>A.filter(B=>B.documentId!==y.documentId)),oo(A=>{const B=new Set(A);return B.delete(y.documentId),B})},300)}catch(A){ye(tt(e,A))}},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:A=>{A.currentTarget.style.color="#d32f2f"},onMouseLeave:A=>{A.currentTarget.style.color="var(--mdocs-text-muted, #999)"},children:"✕"})]})})]},y.documentId)})})]})}),c.jsx("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end",marginTop:16,paddingTop:16,borderTop:"1px solid var(--mdocs-border, #eee)"},children:c.jsx("button",{type:"button",onClick:()=>rn(!1),children:e("close")})})]})}),gt&&c.jsx(Gu,{x:gt.x,y:gt.y,node:gt.node,parentPath:gt.parentPath,onClose:()=>at(null),onCreateChild:y=>In(y),onCreateFolder:y=>eo(y),onDeleteDocument:y=>Zn(y.documentId,y.path),onDeleteFolder:y=>co(y.documentId,y.folderDisplayName||y.name)}),be&&c.jsx(pa,{title:be.type==="folder"?"删除文件夹":"删除文档",message:be.type==="folder"?`确定要删除「${be.name}」及其下的所有文档和子文件夹吗?此操作不可撤销。`:`确定要删除「${be.name}」吗?`,confirmLabel:"删除",cancelLabel:"取消",onConfirm:Ma,onCancel:()=>St(null),danger:!0}),Vt&&c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&!Gt&&Kn(null)},children:c.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[c.jsx("h1",{children:Vt.kind==="document"?e("newDocumentTitle"):e("newFolderTitle")}),c.jsx("p",{className:"muted",children:Vt.kind==="document"?e("fileNameHint"):e("folderNameHint")}),c.jsxs("form",{onSubmit:_a,className:"mdocs-dialog-form",children:[c.jsxs("label",{className:"mdocs-dialog-label",children:[Vt.kind==="document"?e("fileNameLabel"):e("folderNameLabel"),c.jsx("input",{ref:wa,value:Vt.draft,onChange:y=>Kn(O=>O&&{...O,draft:y.target.value}),placeholder:Vt.kind==="document"?e("untitledPlaceholder"):e("folderExamplePlaceholder"),maxLength:200,disabled:Gt})]}),Qr&&c.jsx("div",{className:"mdocs-dialog-error",children:Qr}),c.jsxs("div",{className:"mdocs-dialog-actions",children:[c.jsx("button",{type:"button",onClick:()=>!Gt&&Kn(null),disabled:Gt,children:e("cancel")}),c.jsx("button",{type:"submit",className:"primary",disabled:Gt,children:e(Gt?"creating":"create")})]})]})]})})]})}),I&&b&&c.jsx(xl,{visitorId:I,onDismiss:()=>D(null)}),P&&c.jsx("div",{className:"mdocs-dialog-backdrop",style:{position:"fixed",zIndex:9999},onClick:y=>{y.target===y.currentTarget&&_(null)},children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:480,textAlign:"center"},children:[c.jsx("h1",{style:{fontSize:"1.25rem",marginBottom:8},children:"🔑 保存你的恢复码"}),c.jsxs("p",{className:"muted",style:{marginBottom:16,lineHeight:1.5},children:["恢复码是你的唯一凭证,当 Token 丢失时可用它找回身份。",c.jsx("br",{}),c.jsx("strong",{children:"请立即复制保存,此弹窗关闭后不可再查看。"})]}),c.jsx("div",{style:{background:"#f5f5f5",borderRadius:8,padding:"12px 16px",fontFamily:"monospace",fontSize:"1.25rem",letterSpacing:"0.1em",marginBottom:20,userSelect:"all"},children:P}),c.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:[c.jsx("button",{type:"button",className:"primary",onClick:()=>{navigator.clipboard.writeText(P)},children:"复制恢复码"}),c.jsx("button",{type:"button",onClick:()=>_(null),children:"已保存,关闭"})]})]})}),c.jsxs(c.Fragment,{children:[c.jsx(Xu,{open:Re,onToggle:()=>{var y;Re?(y=k.current)==null||y.requestClose():He(!0)},position:Lt,onPositionChange:kn,disableDrag:l}),Re?c.jsx(x.Suspense,{fallback:null,children:c.jsx(Sf,{ref:k,open:Re,onClose:()=>{He(!1),yt(!1)},visitorName:b==null?void 0:b.visitorName,fullscreen:l||_n,onToggleFullscreen:l?void 0:()=>yt(y=>!y),domainId:E||null,documentId:(M==null?void 0:M.documentId)??null,documentTitle:(M==null?void 0:M.displayName)??null,documentPath:(M==null?void 0:M.relativePath)??null,graphFileId:(K==null?void 0:K.kind)==="graph"?`${K.resourceId}.graph-file`:null,graphLabel:(K==null?void 0:K.kind)==="graph"?K.name:null,anchorStyle:l||_n?void 0:Ju(Lt),onOpenDocument:y=>{st("docs"),Z(()=>ne(`/doc/${y}`)),He(!1),yt(!1)},onTreeChanged:()=>void pe(),onDocumentOverwritten:y=>void ke(y),onOpenCoding:l?void 0:y=>void Me(y)})}):null]}),F?c.jsx(x.Suspense,{fallback:null,children:c.jsx(Df,{open:j,initialMarkdown:F.markdown,documentId:F.documentId,displayName:F.displayName,onClose:()=>{L(!1),G(null)},onComplete:De})}):null]})}const Tf=x.lazy(()=>Ot(()=>import("./PlaygroundPage-CodSaeWS.js"),__vite__mapDeps([21,1,4,5,2,3,6,7,8,9,10])).then(e=>({default:e.PlaygroundPage})));function Af(){return c.jsxs(za,{children:[c.jsx(er,{path:"/",element:c.jsx(_i,{})}),c.jsx(er,{path:"/doc/:documentId",element:c.jsx(_i,{})}),c.jsx(er,{path:"/playground",element:c.jsx(x.Suspense,{fallback:c.jsx("div",{style:{padding:24},children:"Loading playground…"}),children:c.jsx(Tf,{})})})]})}function jf(){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\/([^/?#]+)/),d=(u==null?void 0:u[1])??l[1];if(!d)return;const h=i.endsWith("/")?i:`${i}/`;window.location.replace(`${o}${h}${r}#/doc/${d}`)}jf();const xa=document.getElementById("root");if(!xa)throw new Error("root element missing");$a.createRoot(xa).render(c.jsx(ki.StrictMode,{children:c.jsx(Ba,{motion:ts,children:c.jsx(Ha,{children:c.jsx(Hs,{children:c.jsx(Ua,{children:c.jsx(Af,{})})})})})}));export{nm as $,ff as A,yr as B,us as C,Qe as D,ps as E,yl as F,vn as G,Uf as H,nl as I,Rm as J,Zf as K,Xf as L,Ns as M,Lr as N,Jf as O,wo as P,Yf as Q,_o as R,Rs as S,tm as T,Bf as U,Vf as V,Hf as W,Gf as X,Xt as Y,em as Z,Qf as _,Ee as a,rm as a0,om as a1,pm as a2,jo as a3,pa as a4,gm as a5,Mo as a6,ym as a7,vm as a8,bm as a9,Pm as aA,Mm as aB,jm as aC,Kt as aD,im as aE,or as aF,rr as aG,Dn as aH,vo as aI,xm as aa,wm as ab,rf as ac,um as ad,cl as ae,hm as af,_f as ag,xo as ah,Pi as ai,qf as aj,Wf as ak,dm as al,pi as am,_m as an,Im as ao,Lu as ap,bo as aq,km as ar,Cm as as,Sm as at,Dm as au,Om as av,Am as aw,Em as ax,Tm as ay,Nm as az,Lm as b,it as c,gr as d,fm as e,Kf as f,nr as g,Lf as h,mm as i,am as j,lm as k,ef as l,sm as m,cm as n,ge as o,Wu as p,ha as q,dl as r,Fm as s,Ni as t,lf as u,rl as v,wl as w,Ir as x,tt as y,cf as z};
291
+ `;gu(yu);function Rr(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 vu(e){if(Array.isArray(e))return e}function bu(e){if(Array.isArray(e))return Rr(e)}function di(e,n,r){if(sa())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 yn(e,n,r){return(n=Cu(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function sa(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(sa=function(){return!!e})()}function xu(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wu(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,d=!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){d=!0,i=h}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function _u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
292
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ku(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
293
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ui(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 Jt(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?ui(Object(r),!0).forEach(function(o){yn(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ui(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function gn(e,n){return vu(e)||wu(e,n)||la(e,n)||_u()}function Be(e){return bu(e)||xu(e)||la(e)||ku()}function Iu(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 Cu(e){var n=Iu(e,"string");return typeof n=="symbol"?n:n+""}function Fr(e){"@babel/helpers - typeof";return Fr=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},Fr(e)}function la(e,n){if(e){if(typeof e=="string")return Rr(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)?Rr(e,n):void 0}}var Su=Za(Qa);function fi(e,n,r){!n||typeof r!="string"||e.filter(function(o){return!o[r]}).forEach(function(o){o[r]=Su(n(o))})}function Du(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(p){throw"Invalid DAG structure! Found cycle in node path: ".concat(p.join(" -> "),".")}:l,d={};r.forEach(function(p){return d[n(p)]={data:p,out:[],depth:-1,skip:!s(p)}}),o.forEach(function(p){var g=p.source,w=p.target,b=N(g),v=N(w);if(!d.hasOwnProperty(b))throw"Missing source node with id: ".concat(b);if(!d.hasOwnProperty(v))throw"Missing target node with id: ".concat(v);var I=d[b],D=d[v];I.out.push(D);function N(_){return Fr(_)==="object"?n(_):_}});var h=[];f(Object.values(d));var m=Object.assign.apply(Object,[{}].concat(Be(Object.entries(d).filter(function(p){var g=gn(p,2),w=g[1];return!w.skip}).map(function(p){var g=gn(p,2),w=g[0],b=g[1];return yn({},w,b.depth)}))));return m;function f(p){for(var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],w=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,b=function(){var N=p[v];if(g.indexOf(N)!==-1){var _=[].concat(Be(g.slice(g.indexOf(N))),[N]).map(function(P){return n(P.data)});return h.some(function(P){return P.length===_.length&&P.every(function(S,T){return S===_[T]})})||(h.push(_),u(_)),1}w>N.depth&&(N.depth=w,f(N.out,[].concat(Be(g),[N]),w+(N.skip?0:1)))},v=0,I=p.length;v<I;v++)b()}}var Nu=2,Te=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},mi=function(n,r){if(!r.isShadow){var o=ie(r.linkDirectionalParticles);r.graphData.links.forEach(function(i){var a=Math.round(Math.abs(o(i)));a?i.__photons=Be(Array(a)).map(function(){return{}}):delete i.__photons})}},Bn=Br({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,mi(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:Te},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:Te},nodeColor:{default:"color",triggerUpdate:!1,onChange:Te},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:Te},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Te},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:Te},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:Te},linkColor:{default:"color",triggerUpdate:!1,onChange:Te},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:Te},linkWidth:{default:1,triggerUpdate:!1,onChange:Te},linkCurvature:{default:0,triggerUpdate:!1,onChange:Te},linkCanvasObject:{triggerUpdate:!1,onChange:Te},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Te},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:Te},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:Te},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:Te},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:mi},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=ie(n.nodeVisibility),u=ie(n.nodeVal),d=ie(n.nodeColor),h=ie(n.nodeCanvasObjectMode),m=n.ctx,f=n.isShadow/n.globalScale,p=n.graphData.nodes.filter(l);m.save(),p.forEach(function(g){var w=h(g);if(n.nodeCanvasObject&&(w==="before"||w==="replace")&&(n.nodeCanvasObject(g,m,n.globalScale),w==="replace")){m.restore();return}var b=Math.sqrt(Math.max(0,u(g)||1))*n.nodeRelSize+f;m.beginPath(),m.arc(g.x,g.y,b,0,2*Math.PI,!1),m.fillStyle=d(g)||"rgba(31, 120, 180, 0.92)",m.fill(),n.nodeCanvasObject&&w==="after"&&n.nodeCanvasObject(g,n.ctx,n.globalScale)}),m.restore()}function i(){var l=ie(n.linkVisibility),u=ie(n.linkColor),d=ie(n.linkWidth),h=ie(n.linkLineDash),m=ie(n.linkCurvature),f=ie(n.linkCanvasObjectMode),p=n.ctx,g=n.isShadow*2,w=n.graphData.links.filter(l);w.forEach(P);var b=[],v=[],I=w;if(n.linkCanvasObject){var D=[],N=[];w.forEach(function(S){return({before:b,after:v,replace:D}[f(S)]||N).push(S)}),I=[].concat(Be(b),v,N),b=b.concat(D)}p.save(),b.forEach(function(S){return n.linkCanvasObject(S,p,n.globalScale)}),p.restore();var _=pu(I,[u,d,h]);p.save(),Object.entries(_).forEach(function(S){var T=gn(S,2),$=T[0],O=T[1],R=!$||$==="undefined"?"rgba(0,0,0,0.15)":$;Object.entries(O).forEach(function(U){var V=gn(U,2),Y=V[0],te=V[1],ne=(Y||1)/n.globalScale+g;Object.entries(te).forEach(function(K){var ve=gn(K,2);ve[0];var Ce=ve[1],M=h(Ce[0]);p.beginPath(),Ce.forEach(function(oe){var ae=oe.source,re=oe.target;if(!(!ae||!re||!ae.hasOwnProperty("x")||!re.hasOwnProperty("x"))){p.moveTo(ae.x,ae.y);var W=oe.__controlPoints;W?p[W.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(p,Be(W).concat([re.x,re.y])):p.lineTo(re.x,re.y)}}),p.strokeStyle=R,p.lineWidth=ne,p.setLineDash(M||[]),p.stroke()})})}),p.restore(),p.save(),v.forEach(function(S){return n.linkCanvasObject(S,p,n.globalScale)}),p.restore();function P(S){var T=m(S);if(!T){S.__controlPoints=null;return}var $=S.source,O=S.target;if(!(!$||!O||!$.hasOwnProperty("x")||!O.hasOwnProperty("x"))){var R=Math.sqrt(Math.pow(O.x-$.x,2)+Math.pow(O.y-$.y,2));if(R>0){var U=Math.atan2(O.y-$.y,O.x-$.x),V=R*T,Y={x:($.x+O.x)/2+V*Math.cos(U-Math.PI/2),y:($.y+O.y)/2+V*Math.sin(U-Math.PI/2)};S.__controlPoints=[Y.x,Y.y]}else{var te=T*70;S.__controlPoints=[O.x,O.y-te,O.x+te,O.y]}}}}function a(){var l=1.6,u=.2,d=ie(n.linkDirectionalArrowLength),h=ie(n.linkDirectionalArrowRelPos),m=ie(n.linkVisibility),f=ie(n.linkDirectionalArrowColor||n.linkColor),p=ie(n.nodeVal),g=n.ctx;g.save(),n.graphData.links.filter(m).forEach(function(w){var b=d(w);if(!(!b||b<0)){var v=w.source,I=w.target;if(!(!v||!I||!v.hasOwnProperty("x")||!I.hasOwnProperty("x"))){var D=Math.sqrt(Math.max(0,p(v)||1))*n.nodeRelSize,N=Math.sqrt(Math.max(0,p(I)||1))*n.nodeRelSize,_=Math.min(1,Math.max(0,h(w))),P=f(w)||"rgba(0,0,0,0.28)",S=b/l/2,T=w.__controlPoints&&di(ue,[v.x,v.y].concat(Be(w.__controlPoints),[I.x,I.y])),$=T?function(ne){return T.get(ne)}:function(ne){return{x:v.x+(I.x-v.x)*ne||0,y:v.y+(I.y-v.y)*ne||0}},O=T?T.length():Math.sqrt(Math.pow(I.x-v.x,2)+Math.pow(I.y-v.y,2)),R=D+b+(O-D-N-b)*_,U=$(R/O),V=$((R-b)/O),Y=$((R-b*(1-u))/O),te=Math.atan2(U.y-V.y,U.x-V.x)-Math.PI/2;g.beginPath(),g.moveTo(U.x,U.y),g.lineTo(V.x+S*Math.cos(te),V.y+S*Math.sin(te)),g.lineTo(Y.x,Y.y),g.lineTo(V.x-S*Math.cos(te),V.y-S*Math.sin(te)),g.fillStyle=P,g.fill()}}}),g.restore()}function s(){var l=ie(n.linkDirectionalParticles),u=ie(n.linkDirectionalParticleSpeed),d=ie(n.linkDirectionalParticleOffset),h=ie(n.linkDirectionalParticleWidth),m=ie(n.linkVisibility),f=ie(n.linkDirectionalParticleColor||n.linkColor),p=n.ctx;p.save(),n.graphData.links.filter(m).forEach(function(g){var w=l(g);if(!(!g.hasOwnProperty("__photons")||!g.__photons.length)){var b=g.source,v=g.target;if(!(!b||!v||!b.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var I=u(g),D=Math.abs(d(g)),N=g.__photons||[],_=Math.max(0,h(g)/2)/Math.sqrt(n.globalScale),P=f(g)||"rgba(0,0,0,0.28)";p.fillStyle=P;var S=g.__controlPoints?di(ue,[b.x,b.y].concat(Be(g.__controlPoints),[v.x,v.y])):null,T=0,$=!1;N.forEach(function(O){var R=!!O.__singleHop;if(O.hasOwnProperty("__progressRatio")||(O.__progressRatio=R?I<0?1:0:(T+D)/w),!R&&T++,O.__progressRatio+=I,O.__progressRatio>=1||O.__progressRatio<0)if(!R)O.__progressRatio=O.__progressRatio%1,O.__progressRatio<0&&O.__progressRatio++;else{$=!0;return}var U=O.__progressRatio,V=S?S.get(U):{x:b.x+(v.x-b.x)*U||0,y:b.y+(v.y-b.y)*U||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(V.x,V.y,g,p,n.globalScale):(p.beginPath(),p.arc(V.x,V.y,_,0,2*Math.PI,!1),p.fill())}),$&&(g.__photons=g.__photons.filter(function(O){return!O.__singleHop||O.__progressRatio<=1&&O.__progressRatio>=0}))}}}),p.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:qd().force("link",zd()).force("charge",Kd()).force("center",rd()).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&&fi(n.graphData.nodes,ie(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&fi(n.graphData.links,ie(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&&Du(n.graphData,function(f){return f[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,Be(Object.values(i||[]))),s=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*Nu*(["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),d=function(p){return(i[p[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]=d(f)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?Yd(function(f){var p=i[f[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-p:p)*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 ca(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(d){return u[d][a](l)})},triggerUpdate:!1}},linkMethod:function(a){return function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;d<l;d++)u[d-1]=arguments[d];var h=[];return r.forEach(function(m){var f=s[m],p=f[a].apply(f,u);p!==f&&h.push(p)}),h.length?h[0]:this}}}}var Pu=800,Tu=4,Au=5,da=ca("forceGraph",Bn),ju=ca(["forceGraph","shadowGraph"],Bn),Mu=Object.assign.apply(Object,Be(["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 yn({},e,da.linkProp(e))})).concat(Be(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return yn({},e,ju.linkProp(e))})))),Eu=Object.assign.apply(Object,Be(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return yn({},e,da.linkMethod(e))})));function dr(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=ft(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/i,(e.height-r)/2/i),e.needsRedraw=!0}}function ua(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function hi(e,n,r){e.save(),ua(e),e.clearRect(0,0,n,r),e.restore()}var Ou=Br({props:Jt({width:{default:window.innerWidth,onChange:function(n,r){return dr(r)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,r){return dr(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}},Mu),aliases:{stopAnimation:"pauseAnimation"},methods:Jt({graph2ScreenCoords:function(n,r,o){var i=ft(n.canvas);return{x:r*i.k+i.x,y:o*i.k+i.y}},screen2GraphCoords:function(n,r,o){var i=ft(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 zo(s()).to(a,i).easing(Rt.Quadratic.Out).onUpdate(l).onComplete(function(){n.tweenGroup.remove(this)}).start()):l(a),this}return s();function s(){var u=ft(n.canvas);return{x:(n.width/2-u.x)/u.k,y:(n.height/2-u.y)/u.k}}function l(u){var d=u.x,h=u.y;n.zoom.translateTo(n.zoom.__baseElem,d===void 0?s().x:d,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 zo({k:i()}).to({k:r},o).easing(Rt.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 ft(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},d=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(d,r)}return this},getGraphBbox:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},o=ie(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:[go(a,function(s){return s.x-s.r}),yo(a,function(s){return s.x+s.r})],y:[go(a,function(s){return s.y-s.r}),yo(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:[]})}},Eu),stateInit:function(){return{lastSetZoom:1,zoom:rs(),forceGraph:new Bn,shadowGraph:new Bn().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new Ec,tweenGroup:new Ri}},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,p=l.x>0&&l.y>0?s.getImageData(l.x*f,l.y*f,1,1):null;return p&&(m=r.colorTracker.lookup(p.data)),m};_r(r.canvas).call(es().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,p=h,g=ft(r.canvas).k,w={x:f.x+(p.x-f.x)/g-m.x,y:f.y+(p.y-f.y)/g-m.y};["x","y"].forEach(function(b){return m["f".concat(b)]=m[b]=f[b]+(p[b]-f[b])/g}),!(!m.__dragged&&Au>=Math.sqrt(ts(["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,w))}).on("end",function(h){var m=h.subject,f=m.__initialDragPos,p={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,p))})),r.zoom(r.zoom.__baseElem=_r(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(h){return!h.button&&r.enableZoomPanInteraction&&(h.type!=="wheel"||ie(r.enableZoomInteraction)(h))&&(h.type==="wheel"||ie(r.enablePanInteraction)(h))}).on("zoom",function(h){var m=h.transform;[a,s].forEach(function(f){ua(f),f.translate(m.x,m.y),f.scale(m.k,m.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(Jt(Jt({},m),o.centerAt())),r.needsRedraw=!0}).on("end",function(h){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(Jt(Jt({},h.transform),o.centerAt()))}),dr(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){ft(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=Tu/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new nd(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(g){return Math.abs(g)>1}))&&(r.isPointerDragging=!0);var f=p(i);l.x=m.pageX-f.left,l.y=m.pageY-f.top;function p(g){var w=g.getBoundingClientRect(),b=window.pageXOffset||document.documentElement.scrollLeft,v=window.pageYOffset||document.documentElement.scrollTop;return{top:w.top+v,left:w.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 p=r["on".concat(r.hoverObj.type,"RightClick")];p&&p.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 d=ns(function(){hi(s,r.width,r.height),r.shadowGraph.linkWidth(function(m){return ie(r.linkWidth)(m)+r.linkHoverPrecision});var h=ft(r.canvas);r.shadowGraph.globalScale(h.k).tickFrame()},Pu);r.flushShadowCanvas=d.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 p=r.hoverObj,g=p?p.type:null,w=f?f.type:null;if(g&&g!==w){var b=r["on".concat(g,"Hover")];b&&b(null,p.d)}if(w){var v=r["on".concat(w,"Hover")];v&&v(f.d,g===w?p.d:null)}r.tooltip.content(f&&ie(r["".concat(f.type.toLowerCase(),"Label")])(f.d)||null),r.canvas.classList[(f&&r["on".concat(w,"Click")]||!f&&r.onBackgroundClick)&&ie(r.showPointerCursor)(f==null?void 0:f.d)?"add":"remove"]("clickable"),r.hoverObj=f}m&&d()}if(m){hi(a,r.width,r.height);var I=ft(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){}}),fa={exports:{}},Ru="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Fu=Ru,Lu=Fu;function ma(){}function ha(){}ha.resetWarningCache=ma;var zu=function(){function e(o,i,a,s,l,u){if(u!==Lu){var d=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 d.name="Invariant Violation",d}}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:ha,resetWarningCache:ma};return r.PropTypes=r,r};fa.exports=zu();var $u=fa.exports;const C=za($u),qn={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},pa={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},Yr={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])},Uu=Object.assign({},qn,pa,{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({},qn,pa,Yr,{enableNavigationControls:C.bool,controlType:C.oneOf(["trackball","orbit","fly"]),rendererConfig:C.object,extraRenderers:C.arrayOf(C.shape({render:C.func.isRequired}))});Object.assign({},qn,Yr,{nodeDesc:C.oneOfType([C.string,C.func]),linkDesc:C.oneOfType([C.string,C.func])});Object.assign({},qn,Yr,{markerAttrs:C.object,yOffset:C.number,glScale:C.number});const Jr=Ul(Ou,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});Jr.displayName="ForceGraph2D";Jr.propTypes=Uu;const Bu=[{value:"openai-completions",label:"OpenAI 兼容"},{value:"anthropic-messages",label:"Anthropic 兼容"}];function Hu(e){const{t:n}=Ye(),[r,o]=x.useState("deepseek"),[i,a]=x.useState(""),[s,l]=x.useState(""),[u,d]=x.useState("openai-completions"),[h,m]=x.useState(""),[f,p]=x.useState(!1),[g,w]=x.useState(!1),[b,v]=x.useState(null),I=x.useRef(!1);function D(S){if(a(S),I.current)return;S.toLowerCase().includes("anthropic")?d("anthropic-messages"):d("openai-completions")}function N(S){I.current=!0,d(S)}async function _(){var T;const S=h.trim();if(!S){v("请输入 API Key");return}w(!0),v(null);try{if(r==="deepseek")await Eo({kind:"deepseek",modelId:"deepseek-flash",apiKey:S});else{const $=i.trim();if(!$){v("请输入 API 地址");return}const O=s.trim();if(!O){v("请输入 Model ID");return}await Eo({kind:"custom",baseUrl:$,modelId:O,apiType:u,apiKey:S})}m(""),a(""),l(""),await((T=e.onConfigured)==null?void 0:T.call(e))}catch($){v($ instanceof Error?$.message:String($))}finally{w(!1)}}const P=h.trim()&&(r==="deepseek"||i.trim()&&s.trim());return c.jsxs("div",{className:"mdocs-agent-apikey-inline",children:[c.jsx("p",{className:"mdocs-agent-apikey-inline-lead",children:"配置 AI 供应商后即可使用(仅本人可见,不会分享给其他访客)"}),c.jsxs("div",{className:"mdocs-agent-kind-tabs mdocs-agent-apikey-inline-tabs",role:"tablist","aria-label":"配置方式",children:[c.jsx("button",{type:"button",role:"tab","aria-selected":r==="deepseek",className:r==="deepseek"?"active":"",onClick:()=>o("deepseek"),disabled:g,children:"Deepseek"}),c.jsx("button",{type:"button",role:"tab","aria-selected":r==="custom",className:r==="custom"?"active":"",onClick:()=>o("custom"),disabled:g,children:"自定义"})]}),r==="custom"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[c.jsx("span",{children:"API 地址"}),c.jsx("input",{type:"url",value:i,onChange:S=>D(S.target.value),placeholder:"https://api.example.com/v1",className:"mdocs-agent-mono",disabled:g,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),_())}})]}),c.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[c.jsx("span",{children:"API 协议"}),c.jsx("div",{className:"mdocs-agent-apikey-inline-protocol",children:Bu.map(S=>c.jsx("button",{type:"button",className:u===S.value?"active":"",onClick:()=>N(S.value),disabled:g,children:S.label},S.value))})]}),c.jsxs("label",{className:"mdocs-agent-field mdocs-agent-apikey-inline-field",children:[c.jsx("span",{children:"Model ID"}),c.jsx("input",{type:"text",value:s,onChange:S=>l(S.target.value),placeholder:"模型名称,如 gpt-4o / claude-3-5-sonnet",className:"mdocs-agent-mono",disabled:g,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),_())}})]})]}):null,c.jsxs("div",{className:"mdocs-agent-config-apikey mdocs-agent-apikey-inline-field",children:[c.jsx("input",{type:f?"text":"password",value:h,onChange:S=>m(S.target.value),placeholder:n("agentConfigApiKeyPlaceholder"),autoComplete:"off",disabled:g,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),_())}}),c.jsx("button",{type:"button",className:"mdocs-agent-config-eye","aria-label":n(f?"agentConfigHideKey":"agentConfigShowKey"),onClick:()=>p(S=>!S),disabled:g,children:f?c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[c.jsx("path",{d:"M3 3l18 18"}),c.jsx("path",{d:"M10.6 10.6a2 2 0 002.8 2.8"}),c.jsx("path",{d:"M9.9 5.1A10.5 0 0121 12c-.6 1.1-1.4 2.1-2.4 2.9"}),c.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"})]}):c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":!0,children:[c.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"}),c.jsx("circle",{cx:"12",cy:"12",r:"3"})]})})]}),b?c.jsx("p",{className:"mdocs-agent-apikey-inline-error",children:b}):null,c.jsx("button",{type:"button",className:"mdocs-agent-apikey-inline-save",onClick:()=>void _(),disabled:g||!P,children:g?n("saving"):"保存并启用"})]})}function pi(e){return e==="contains"}function Vu(e){return e==="related_to"||e==="part_of"||e==="depends_on"}function Gu(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 w of e)f.set(w,(((h=o.get(w))==null?void 0:h.length)??0)+(((m=i.get(w))==null?void 0:m.length)??0));const p=[...e].sort((w,b)=>(f.get(b)??0)-(f.get(w)??0)),g=f.get(p[0])??0;s=p.filter(w=>(f.get(w)??0)===g).slice(0,12)}const l=new Map,u=[];for(const f of s)l.set(f,0),u.push(f);let d=0;for(;d<u.length;){const f=u[d++],p=l.get(f)??0;for(const g of o.get(f)??[]){const w=p+1;(!l.has(g)||w<(l.get(g)??1/0))&&(l.set(g,w),u.push(g))}}for(const f of e)l.has(f)||l.set(f,0);return{childrenOf:o,parentsOf:i,roots:s,depthMap:l}}function ur(e,n,r,o,i){return i.has(e)?!1:(r.get(e)??0)<n?!0:o.has(e)}function Wu(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 qu(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 Ku(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 fr(e){return e<=1?"排队中,即将开始…":`排队中,前面还有 ${e-1} 个任务`}function mr(e,n,r){const o=Math.max(e,.2);return Math.max(r??n*.75,n)/o}function Yu({scope:e,resourceId:n,name:r,onOpenDocument:o,onClose:i}){const[a,s]=x.useState(null),[l,u]=x.useState(!0),[d,h]=x.useState(null),[m,f]=x.useState(!1),[p,g]=x.useState(!1),[w,b]=x.useState(0),[v,I]=x.useState(()=>new Set),[D,N]=x.useState(()=>new Set),[_,P]=x.useState(null),[S,T]=x.useState(null),[$,O]=x.useState(null),R=x.useRef(null),U=x.useRef(new Map),[V,Y]=x.useState("not_found"),[te,ne]=x.useState([]),[K,ve]=x.useState(null),[Ce,M]=x.useState(0),oe=`graph:${e==="domain"?"domain":"dir"}:${n}`,ae=x.useRef(oe),re=x.useRef(null),[W,X]=x.useState(!1),[xe,se]=x.useState(!1),[Je,St]=x.useState(!1),[gt,Qt]=x.useState(!1),[$t,Dt]=x.useState(!1),Xe=x.useRef(null),_e=V==="running"||V==="pending";x.useEffect(()=>{let k=!1;return u(!0),h(null),P(null),b(0),I(new Set),N(new Set),g(!1),O(null),U.current=new Map,(e==="domain"?Ro:Oo)(n).then(L=>{k||(s(L),u(!1))}).catch(L=>{k||(h(L.message||"加载失败"),u(!1))}),()=>{k=!0}},[n,e]),x.useEffect(()=>(ae.current=oe,Qe(),Ze(),()=>Qe()),[oe]);async function Ze(){try{const k=await wl(ae.current);Y(k.status),ne(k.logs),ve(k.progress??null),M(k.position),k.status==="completed"?(Qe(),Nt()):k.status==="failed"||k.status==="stale"?(Qe(),k.error&&h(k.error)):(k.status==="running"||k.status==="pending")&&xn()}catch{}}function xn(){re.current||(re.current=window.setInterval(()=>{Ze()},2e3))}function Qe(){re.current&&(clearInterval(re.current),re.current=null)}async function Nt(){try{const j=await(e==="domain"?Ro:Oo)(n);s(j)}catch(k){h(k.message||"加载失败")}}const ze=async()=>{if(!_e){h(null),X(!1);try{const j=await(e==="domain"?xl:bl)(n);ae.current=j.taskId,Y(j.status),M(j.position),ne([]),ve(null),xn()}catch(k){if(k instanceof Ke&&k.code==="AI_NOT_CONFIGURED"){X(!0),h(k.message);return}h((k==null?void 0:k.message)||"生成失败")}}},Ut=async()=>{se(!1),X(!1),h(null),await ze()},Me=x.useMemo(()=>a?m?a.nodes:a.nodes.filter(k=>k.type==="concept"):[],[a,m]),fe=x.useMemo(()=>{if(!a)return[];const k=new Set(Me.map(j=>j.id));return a.edges.filter(j=>k.has(j.from)&&k.has(j.to))},[a,Me]),Se=x.useMemo(()=>{const k=fe.filter(j=>pi(String(j.type))).map(j=>({from:j.from,to:j.to}));return Gu(Me.map(j=>j.id),k)},[Me,fe]),ye=x.useMemo(()=>Wu(Se.roots,Se.childrenOf,k=>ur(k,w,Se.depthMap,v,D)),[Se,w,v,D]),{displayNodes:be,displayEdges:Pt}=x.useMemo(()=>{const k=Me.filter(L=>ye.has(L.id)),j=fe.filter(L=>{if(!ye.has(L.from)||!ye.has(L.to))return!1;const F=String(L.type);return!!(pi(F)||p&&Vu(F))});return{displayNodes:k,displayEdges:j}},[Me,fe,ye,p]),yt=x.useMemo(()=>{const k=new Map;for(const j of Me)k.set(j.id,j);return k},[Me]);function st(k){b(k),I(new Set),N(new Set)}function en(k){if((Se.childrenOf.get(k)??[]).length===0)return;ur(k,w,Se.depthMap,v,D)?(N(F=>new Set(F).add(k)),I(F=>{const G=new Set(F);return G.delete(k),G})):(N(F=>{const G=new Set(F);return G.delete(k),G}),I(F=>new Set(F).add(k)))}function Ee(k){const j=qu(k.id,Se.parentsOf);N(L=>{const F=new Set(L);for(const G of j)F.delete(G);return F}),I(L=>{const F=new Set(L);for(const G of j)F.add(G);return F}),P(k)}const wn=x.useMemo(()=>{const k=be.map(F=>{var De;const G=((De=Se.childrenOf.get(F.id))==null?void 0:De.length)??0,J=ur(F.id,w,Se.depthMap,v,D),ee=U.current.get(F.id);let Z=ee==null?void 0:ee.x,pe=ee==null?void 0:ee.y;if(Z==null||pe==null){const je=(Se.parentsOf.get(F.id)??[]).map(Ne=>U.current.get(Ne)).find(Ne=>Ne!=null);je?(Z=je.x+(Math.random()-.5)*60,pe=je.y+50+Math.random()*40):(Z=(Math.random()-.5)*240,pe=(Math.random()-.5)*180),U.current.set(F.id,{x:Z,y:pe})}return{id:F.id,name:F.label,type:F.type,val:F.type==="concept"?4:2,x:Z,y:pe,__raw:F,__childCount:G,__expanded:J}}),j=new Map,L=Pt.map(F=>{const G=`${F.from}->${F.to}`,J=j.get(G)??0;j.set(G,J+1);const ee=J===0?.08:.08+J*.14;return{source:F.from,target:F.to,type:F.type,curvature:ee,__raw:F}});return{nodes:k,links:L}},[be,Pt,Se,w,v,D]),et=x.useMemo(()=>{const k=Math.max(1,be.length);return{linkDistance:Math.min(140,70+Math.sqrt(k)*8),chargeStrength:Math.max(-420,-120-k*6)}},[be.length]),Fe=x.useRef(null),[He,_n]=x.useState({width:800,height:600});x.useEffect(()=>{if(!Fe.current)return;const k=()=>{Fe.current&&_n({width:Fe.current.clientWidth,height:Fe.current.clientHeight})};k();const j=new ResizeObserver(k);return j.observe(Fe.current),()=>j.disconnect()},[]),x.useEffect(()=>{if(!a||l)return;const k=window.setTimeout(()=>{var j,L;(L=(j=R.current)==null?void 0:j.zoomToFit)==null||L.call(j,400,80)},450);return()=>window.clearTimeout(k)},[a,m,p,l,He.width,He.height,w,ye]),x.useEffect(()=>{var F,G,J,ee;if(!a||l)return;const k=R.current;if(!k)return;const j=k.d3Force("charge");(F=j==null?void 0:j.strength)==null||F.call(j,et.chargeStrength);const L=k.d3Force("link");(G=L==null?void 0:L.distance)==null||G.call(L,et.linkDistance),(J=L==null?void 0:L.strength)==null||J.call(L,.35),(ee=k.d3ReheatSimulation)==null||ee.call(k)},[et,a,l,m,wn]);const vt=k=>(Se.childrenOf.get(k)??[]).map(L=>yt.get(L)??(a==null?void 0:a.nodes.find(F=>F.id===L))).filter(L=>!!L),Bt=k=>(Se.parentsOf.get(k)??[]).map(L=>yt.get(L)??(a==null?void 0:a.nodes.find(F=>F.id===L))).filter(L=>!!L),kn=k=>{if(!a)return[];const j=new Set,L=[],F=[k];for(;F.length>0;){const G=F.shift();if(j.has(G))continue;j.add(G);const J=a.nodes.find(Z=>Z.id===G);(J==null?void 0:J.type)==="doc"&&L.push(J);const ee=a.edges.filter(Z=>Z.from===G).map(Z=>Z.to);F.push(...ee)}return L};return x.useEffect(()=>{if(!$t)return;const k=j=>{Xe.current&&!Xe.current.contains(j.target)&&Dt(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[$t]),c.jsxs("div",{className:"graph-page",children:[c.jsxs("div",{className:"graph-toolbar",children:[c.jsxs("div",{className:"graph-toolbar-left",children:[c.jsx("span",{className:"graph-icon",children:"🕸️"}),c.jsxs("span",{className:"graph-title-text",title:`知识图谱 — ${r}`,children:["知识图谱 — ",r]}),i&&c.jsx("button",{className:"graph-btn graph-btn-danger",onClick:i,children:"退出图谱"})]}),c.jsxs("div",{className:"graph-toolbar-right",children:[c.jsxs("div",{className:"graph-mobile-toggle-wrap",ref:Xe,children:[c.jsx("button",{type:"button",className:"graph-mobile-toggle-btn",onClick:()=>Dt(k=>!k),"aria-label":"更多操作",children:c.jsx(vs,{size:18,strokeWidth:1.75})}),$t&&c.jsxs("div",{className:"graph-mobile-actions card",onClick:()=>Dt(!1),children:[c.jsxs("div",{className:"graph-mobile-action-group",children:[c.jsx("div",{className:"graph-mobile-action-label",children:"层级控制"}),c.jsx("button",{type:"button",className:`graph-mobile-action-item ${w===1?"active":""}`,onMouseDown:()=>st(1),children:"展开一级"}),c.jsx("button",{type:"button",className:`graph-mobile-action-item ${w===2?"active":""}`,onMouseDown:()=>st(2),children:"展开到二级"}),c.jsx("button",{type:"button",className:`graph-mobile-action-item ${w===0&&v.size===0?"active":""}`,onMouseDown:()=>st(0),children:"全部收起"})]}),c.jsxs("div",{className:"graph-mobile-action-group",children:[c.jsx("div",{className:"graph-mobile-action-label",children:"视图"}),c.jsxs("label",{className:"graph-mobile-action-switch",children:[c.jsx("input",{type:"checkbox",checked:p,onChange:k=>g(k.target.checked)}),c.jsx("span",{children:"显示其它关系"})]}),c.jsxs("label",{className:"graph-mobile-action-switch",children:[c.jsx("input",{type:"checkbox",checked:m,onChange:k=>f(k.target.checked)}),c.jsx("span",{children:"显示 doc 节点"})]})]}),c.jsxs("button",{className:"graph-mobile-action-item",onMouseDown:()=>se(!0),children:[c.jsx(nr,{size:14}),"配置 AI"]}),c.jsx("button",{className:"graph-mobile-action-item graph-mobile-action-primary",onMouseDown:ze,disabled:_e,children:_e?c.jsxs(c.Fragment,{children:[c.jsx(Dn,{size:14,className:"spin"}),V==="pending"?fr(Ce):"生成中..."]}):c.jsxs(c.Fragment,{children:[c.jsx(ko,{size:14}),a?"重新生成":"生成图谱"]})})]})]}),c.jsxs("div",{className:"graph-desktop-actions",children:[c.jsxs("div",{className:"graph-dropdown",children:[c.jsxs("button",{type:"button",className:"graph-btn",onClick:()=>St(k=>!k),onBlur:()=>setTimeout(()=>St(!1),150),children:["层级控制 ",c.jsx(bo,{size:12})]}),Je&&c.jsxs("div",{className:"graph-dropdown-menu graph-dropdown-menu--right",children:[c.jsx("button",{type:"button",className:`graph-dropdown-item ${w===1?"active":""}`,onMouseDown:()=>{st(1),St(!1)},children:"展开一级"}),c.jsx("button",{type:"button",className:`graph-dropdown-item ${w===2?"active":""}`,onMouseDown:()=>{st(2),St(!1)},children:"展开到二级"}),c.jsx("button",{type:"button",className:`graph-dropdown-item ${w===0&&v.size===0?"active":""}`,onMouseDown:()=>{st(0),St(!1)},children:"全部收起"})]})]}),c.jsxs("div",{className:"graph-dropdown",children:[c.jsxs("button",{type:"button",className:"graph-btn",onClick:()=>Qt(k=>!k),onBlur:()=>setTimeout(()=>Qt(!1),150),children:[c.jsx(xs,{size:14})," 视图 ",c.jsx(bo,{size:12})]}),gt&&c.jsxs("div",{className:"graph-dropdown-menu graph-dropdown-menu--right",children:[c.jsxs("label",{className:"graph-dropdown-switch",children:[c.jsx("input",{type:"checkbox",checked:p,onChange:k=>g(k.target.checked)}),c.jsx("span",{children:"显示其它关系"})]}),c.jsxs("label",{className:"graph-dropdown-switch",children:[c.jsx("input",{type:"checkbox",checked:m,onChange:k=>f(k.target.checked)}),c.jsx("span",{children:"显示 doc 节点"})]})]})]}),c.jsxs("button",{className:"graph-btn graph-btn-ghost",onClick:()=>se(!0),title:"配置用于图谱分析的 AI 模型",children:[c.jsx(nr,{size:14}),"配置 AI"]}),c.jsx("button",{className:"graph-btn graph-btn-primary",onClick:ze,disabled:_e,children:_e?c.jsxs(c.Fragment,{children:[c.jsx(Dn,{size:14,className:"spin"}),V==="pending"?fr(Ce):"生成中..."]}):c.jsxs(c.Fragment,{children:[c.jsx(ko,{size:14}),a?"重新生成":"生成图谱"]})})]})]})]}),c.jsxs("div",{className:"graph-canvas-container",ref:Fe,children:[l&&c.jsxs("div",{className:"graph-loading",children:[c.jsx(Dn,{size:32,className:"spin"}),c.jsx("p",{children:"加载图谱中..."})]}),d&&!l&&c.jsx("div",{className:"graph-error",children:W?c.jsxs(c.Fragment,{children:[c.jsx("p",{style:{fontSize:40,margin:0},children:"🔑"}),c.jsx("h3",{children:"还没有配置 AI 模型"}),c.jsx("p",{className:"muted",children:"图谱由 AI 分析生成,需要先配置一个可用的模型"}),c.jsxs("button",{className:"graph-btn graph-btn-primary",onClick:()=>se(!0),style:{marginTop:12},children:[c.jsx(nr,{size:14}),"配置 AI"]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("p",{children:["❌ ",d]}),c.jsx("button",{className:"graph-btn",onClick:ze,children:"重试生成"})]})}),!l&&!d&&!a&&!_e&&c.jsxs("div",{className:"graph-empty",children:[c.jsx("p",{style:{fontSize:48,margin:0},children:"🕸️"}),c.jsx("h3",{children:"还没有知识图谱"}),c.jsx("p",{className:"muted",children:"点击右上角「生成图谱」开始构建"}),c.jsx("button",{className:"graph-btn graph-btn-primary",onClick:ze,disabled:_e,children:_e?"生成中...":"生成图谱"})]}),_e&&c.jsxs("div",{className:"graph-progress-panel",children:[c.jsxs("div",{className:"graph-progress-header",children:[c.jsx(Dn,{size:16,className:"spin"}),c.jsx("span",{children:V==="pending"?fr(Ce):K?`正在生成(${K.current}/${K.total})`:"正在生成..."})]}),K&&K.total>0&&c.jsx("div",{className:"graph-progress-bar",children:c.jsx("div",{className:"graph-progress-bar-fill",style:{width:`${K.current/K.total*100}%`}})}),c.jsx("div",{className:"graph-progress-logs",children:te.slice(-10).map((k,j)=>c.jsx("div",{className:`graph-log-item graph-log-${k.level}`,children:c.jsx("span",{className:"graph-log-event",children:Ku(k)})},j))})]}),!l&&!d&&a&&a.nodes.length===0&&!_e&&c.jsxs("div",{className:"graph-empty",children:[c.jsx("p",{style:{fontSize:48,margin:0},children:"📄"}),c.jsx("h3",{children:"图谱已生成"}),c.jsx("p",{className:"muted",children:"当前内容暂未提取到可关联的知识概念"}),c.jsx("p",{className:"muted",style:{fontSize:13,marginTop:4},children:"内容较少或结构较简单时可能出现这种情况,补充更多内容后可以重新生成"}),c.jsx("button",{className:"graph-btn graph-btn-primary",onClick:ze,disabled:_e,style:{marginTop:12},children:"重新生成"})]}),!l&&!d&&a&&a.nodes.length>0&&c.jsx(Jr,{ref:R,width:He.width,height:He.height,graphData:wn,nodeId:"id",nodeVal:k=>k.type==="concept"?6:3,nodeColor:k=>k.type==="concept"?"#8b5cf6":"#06b6d4",nodeCanvasObjectMode:()=>"replace",nodeCanvasObject:(k,j,L)=>{const F=String(k.name??""),G=k.type==="concept",J=k.id===(_==null?void 0:_.id)||k.id===S,ee=(G?9:5)/Math.max(L,.35);if(j.beginPath(),j.arc(k.x,k.y,ee,0,2*Math.PI),j.fillStyle=G?"#8b5cf6":"#06b6d4",j.globalAlpha=J||!_?1:.35,j.fill(),j.strokeStyle="#ffffff",j.lineWidth=1.5/Math.max(L,.35),j.stroke(),j.globalAlpha=1,k.__childCount>0){const xt=7/Math.max(L,.4),lt=k.x+ee+xt*.9,de=k.y-ee*.2;j.beginPath(),j.arc(lt,de,xt,0,2*Math.PI),j.fillStyle=k.__expanded?"#475569":"#6366f1",j.fill(),j.fillStyle="#ffffff";const Ve=k.__expanded?"−":"+",Tt=Math.max(10/L,9/L);j.font=`700 ${Tt}px -apple-system, BlinkMacSystemFont, sans-serif`,j.textAlign="center",j.textBaseline="middle",j.fillText(Ve,lt,de+.5/L)}if(!(J||G&&L>=.55||!G&&L>=1.4))return;const pe=Math.max(10/L,G?11/L:9/L),De=G?L<.9?8:16:10,je=F.length>De?F.slice(0,De)+"…":F;j.font=`${G?"600":"400"} ${pe}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,j.textAlign="center",j.textBaseline="top";const Ne=k.y+ee+3/L,ke=j.measureText(je).width,Pe=4/L,bt=2/L;j.fillStyle="rgba(255,255,255,0.88)",j.fillRect(k.x-ke/2-Pe,Ne-bt,ke+Pe*2,pe+bt*2),j.fillStyle=G?"#1e1b4b":"#0c4a6e",j.fillText(je,k.x,Ne)},linkDirectionalArrowLength:k=>{var F,G,J,ee,Z,pe;const j=((G=(F=R.current)==null?void 0:F.zoom)==null?void 0:G.call(F))??1,L=((J=k.source)==null?void 0:J.id)===S||((ee=k.target)==null?void 0:ee.id)===S||((Z=k.source)==null?void 0:Z.id)===(_==null?void 0:_.id)||((pe=k.target)==null?void 0:pe.id)===(_==null?void 0:_.id);return mr(j,L?13:11,9)},linkDirectionalArrowRelPos:.86,linkDirectionalArrowColor:()=>"#475569",linkWidth:k=>{var F,G,J,ee,Z,pe;const j=((G=(F=R.current)==null?void 0:F.zoom)==null?void 0:G.call(F))??1,L=((J=k.source)==null?void 0:J.id)===S||((ee=k.target)==null?void 0:ee.id)===S||((Z=k.source)==null?void 0:Z.id)===(_==null?void 0:_.id)||((pe=k.target)==null?void 0:pe.id)===(_==null?void 0:_.id);return mr(j,L?3.5:3,2.25)},linkColor:k=>{var L,F,G,J;return((L=k.source)==null?void 0:L.id)===S||((F=k.target)==null?void 0:F.id)===S||((G=k.source)==null?void 0:G.id)===(_==null?void 0:_.id)||((J=k.target)==null?void 0:J.id)===(_==null?void 0:_.id)?"#334155":"#64748b"},linkCurvature:k=>k.curvature??.12,linkCanvasObjectMode:()=>"after",linkCanvasObject:(k,j,L)=>{if(L<.45)return;const F=k.source,G=k.target;if(F.x==null||F.y==null||G.x==null||G.y==null)return;const ee={contains:"包含",related_to:"相关",part_of:"属于",depends_on:"依赖"}[k.type]||String(k.type??""),Z=typeof k.curvature=="number"?k.curvature:.12,pe=(F.x+G.x)/2,De=(F.y+G.y)/2,je=pe-(G.y-F.y)*Z,Ne=De+(G.x-F.x)*Z,ke=.5,Pe=1-ke,bt=Pe*Pe*F.x+2*Pe*ke*je+ke*ke*G.x,xt=Pe*Pe*F.y+2*Pe*ke*Ne+ke*ke*G.y,lt=2*Pe*(je-F.x)+2*ke*(G.x-je),de=2*Pe*(Ne-F.y)+2*ke*(G.y-Ne);let Ve=Math.atan2(de,lt);(Ve>Math.PI/2||Ve<-Math.PI/2)&&(Ve+=Math.PI);const Tt=mr(L,11,9);j.save(),j.translate(bt,xt),j.rotate(Ve),j.font=`500 ${Tt}px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,j.textAlign="center",j.textBaseline="middle";const tn=j.measureText(ee).width,At=3/L,Ht=1.5/L;j.fillStyle="rgba(255,255,255,0.92)",j.fillRect(-tn/2-At,-Tt/2-Ht,tn+At*2,Tt+Ht*2),j.fillStyle="#475569",j.fillText(ee,0,0),j.restore()},onZoom:()=>{var k,j;(j=(k=R.current)==null?void 0:k.refresh)==null||j.call(k)},cooldownTicks:120,cooldownTime:4e3,d3AlphaDecay:.022,d3VelocityDecay:.3,onNodeClick:(k,j)=>{var G,J,ee,Z,pe;const L=k.__childCount??0;if(L>0&&R.current&&Fe.current){const De=Fe.current.getBoundingClientRect(),je=R.current.screen2GraphCoords(j.clientX-De.left,j.clientY-De.top),Ne=((J=(G=R.current).zoom)==null?void 0:J.call(G))??1,ke=(k.type==="concept"?9:5)/Math.max(Ne,.35),Pe=7/Math.max(Ne,.4),bt=k.x+ke+Pe*.9,xt=k.y-ke*.2,lt=je.x-bt,de=je.y-xt;if(lt*lt+de*de<=(Pe+4/Ne)**2){en(String(k.id)),P(k.__raw);return}}const F=k.__raw;if(P(F),L>0&&!k.__expanded&&en(String(k.id)),(F==null?void 0:F.type)==="doc"){const De=(pe=(Z=(ee=F.sources)==null?void 0:ee[0])==null?void 0:Z.documentId)==null?void 0:pe.trim();De&&o(De)}},onNodeHover:k=>{var L;if(!k){T(null),O(null);return}T(String(k.id));const j=String(k.name??((L=k.__raw)==null?void 0:L.label)??"");if(R.current&&j){const F=R.current.graph2ScreenCoords(k.x,k.y);O({text:j,x:F.x,y:F.y})}else O({text:j,x:0,y:0})},onBackgroundClick:()=>{P(null),T(null),O(null)},onEngineTick:()=>{var j,L;const k=(L=(j=R.current)==null?void 0:j.graphData)==null?void 0:L.call(j);if(k!=null&&k.nodes)for(const F of k.nodes)F.id!=null&&F.x!=null&&F.y!=null&&U.current.set(String(F.id),{x:F.x,y:F.y})},onEngineStop:()=>{var k,j;(j=(k=R.current)==null?void 0:k.zoomToFit)==null||j.call(k,300,72)},linkHoverPrecision:8,enableNodeDrag:!0,enableZoomInteraction:!0,enablePanInteraction:!0,nodePointerAreaPaint:(k,j,L,F)=>{const G=(k.type==="concept"?14:9)/Math.max(F,.35);if(L.fillStyle=j,L.beginPath(),L.arc(k.x,k.y,G,0,2*Math.PI),L.fill(),k.__childCount>0){const J=10/Math.max(F,.4),ee=(k.type==="concept"?9:5)/Math.max(F,.35),Z=k.x+ee+J*.7,pe=k.y-ee*.2;L.beginPath(),L.arc(Z,pe,J,0,2*Math.PI),L.fill()}}}),$&&c.jsx("div",{className:"graph-node-tooltip",style:{left:$.x,top:$.y},children:$.text})]}),_&&c.jsxs("div",{className:"graph-detail-panel",children:[c.jsxs("div",{className:"graph-detail-header",children:[c.jsx("span",{className:`graph-node-type-badge ${_.type}`,children:_.type==="concept"?"概念":"知识要点"}),c.jsx("button",{type:"button",className:"graph-close-btn","aria-label":"关闭",onClick:()=>P(null),children:c.jsx(Et,{size:18,strokeWidth:2.25})})]}),c.jsx("h3",{className:"graph-detail-title",children:_.label}),_.definition&&c.jsxs("div",{className:"graph-detail-section",children:[c.jsx("h4",{children:"定义"}),c.jsx("p",{children:_.definition})]}),c.jsxs("div",{className:"graph-detail-section",children:[c.jsx("h4",{children:"描述"}),c.jsx("p",{children:_.description})]}),c.jsx("div",{className:"graph-detail-meta",children:c.jsxs("span",{children:["置信度: ",(_.confidence*100).toFixed(0),"%"]})}),_.type==="concept"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"graph-detail-section",children:[c.jsxs("h4",{children:["包含的子节点 (",vt(_.id).length,")"]}),c.jsxs("ul",{className:"graph-node-list",children:[vt(_.id).slice(0,20).map(k=>c.jsxs("li",{className:`graph-node-item ${k.type}`,onClick:()=>Ee(k),children:[c.jsx("span",{className:"dot"}),k.label]},k.id)),vt(_.id).length>20&&c.jsxs("li",{className:"muted",children:["还有 ",vt(_.id).length-20," 个..."]})]})]}),c.jsxs("div",{className:"graph-detail-section",children:[c.jsxs("h4",{children:["相关文章 (",kn(_.id).length,")"]}),c.jsx("ul",{className:"graph-doc-list",children:Array.from(new Set(kn(_.id).flatMap(k=>{var j;return((j=k.sources)==null?void 0:j.map(L=>({documentId:L.documentId,title:L.title||L.documentId,heading:L.heading})))||[]}))).slice(0,10).map((k,j)=>c.jsx("li",{className:"graph-doc-item",children:c.jsxs("button",{onClick:()=>o(k.documentId),children:["📄 ",k.title,k.heading&&c.jsxs("span",{className:"muted",children:[" · ",k.heading]})]})},j))})]})]}),_.type==="doc"&&_.sources&&c.jsxs("div",{className:"graph-detail-section",children:[c.jsx("h4",{children:"来源"}),c.jsx("ul",{className:"graph-doc-list",children:_.sources.map((k,j)=>c.jsx("li",{className:"graph-doc-item",children:c.jsxs("button",{onClick:()=>o(k.documentId),children:["📄 ",k.title||k.documentId,k.heading&&c.jsxs("span",{className:"muted",children:[" · ",k.heading]})]})},j))})]}),Bt(_.id).length>0&&c.jsxs("div",{className:"graph-detail-section",children:[c.jsxs("h4",{children:["所属概念 (",Bt(_.id).length,")"]}),c.jsx("ul",{className:"graph-node-list",children:Bt(_.id).map(k=>c.jsxs("li",{className:`graph-node-item ${k.type}`,onClick:()=>Ee(k),children:[c.jsx("span",{className:"dot"}),k.label]},k.id))})]})]}),xe&&c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:k=>{k.target===k.currentTarget&&se(!1)},children:c.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true","aria-label":"配置 AI 模型",children:[c.jsx("h2",{children:"配置 AI 模型"}),c.jsx(Hu,{onConfigured:Ut}),c.jsx("div",{className:"mdocs-dialog-actions",children:c.jsx("button",{type:"button",onClick:()=>se(!1),children:"取消"})})]})})]})}async function gi(e){var r;const n=e.replace(/\u00a0/g," ");if(!n)return!1;try{if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))return await navigator.clipboard.writeText(n),!0}catch{}try{const o=document.createElement("textarea");o.value=n,o.setAttribute("readonly",""),o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="1px",o.style.height="1px",o.style.padding="0",o.style.border="none",o.style.outline="none",o.style.boxShadow="none",o.style.background="transparent",o.style.opacity="0",document.body.appendChild(o),o.focus(),o.select(),o.setSelectionRange(0,n.length);const i=document.execCommand("copy");return document.body.removeChild(o),i}catch{return!1}}function Ju(e){var d;const{t:n}=Ye(),r=x.useRef(null);x.useEffect(()=>{function h(f){r.current&&!r.current.contains(f.target)&&e.onClose()}function m(f){f.key==="Escape"&&e.onClose()}return window.addEventListener("mousedown",h),window.addEventListener("keydown",m),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",m)}},[e.onClose]);const o=e.node.type==="folder";let i="";if(e.node.type==="folder"){const h=e.node;i=((d=h.folderDisplayName)==null?void 0:d.trim())||h.path||""}const a=o?i?n("newDocIn",{name:i}):n("newDocAtRoot"):n("newDocBeside"),s=o?i?n("newFolderIn",{name:i}):n("newFolderAtRoot"):n("newFolderBeside"),l=e.node.documentId,u=e.node.type==="folder"&&e.node.descDocumentId||e.node.documentId;return c.jsxs("div",{ref:r,className:"mdocs-context-menu card",style:{left:e.x,top:e.y},children:[c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const h=o?e.node.path:e.parentPath;e.onCreateChild(h),e.onClose()},children:a}),c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const h=o?e.node.path:e.parentPath;e.onCreateFolder(h),e.onClose()},children:s}),c.jsx("div",{className:"mdocs-context-divider"}),c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{gi(l).finally(e.onClose)},children:n("copyDocumentId")}),c.jsx("button",{type:"button",className:"mdocs-context-item",onClick:()=>{const h="/",m=h.endsWith("/")?h:`${h}/`;gi(`${window.location.origin}${m}#/doc/${u}`).finally(e.onClose)},children:n("copyDocumentUrl")}),c.jsx("div",{className:"mdocs-context-divider"}),c.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]=x.useState(!1),[u,d]=x.useState(e),h=x.useRef(null),m=x.useRef(null);x.useEffect(()=>{d(e)},[e]);const f=u.find(b=>b.domainId===n),p=(f==null?void 0:f.permission)==="private";x.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]),x.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 g(b){r(b),l(!1)}function w(){if(s){l(!1);return}l(!0),Ai().then(b=>{d(b),a==null||a(b)})}return c.jsxs("div",{className:"mdocs-domain-select-wrapper",children:[c.jsxs("button",{ref:h,type:"button",className:"mdocs-domain-select-trigger","aria-label":o,"aria-expanded":s,"aria-haspopup":"listbox",onClick:w,children:[c.jsx("span",{className:"mdocs-domain-select-text",children:f?i(f.domainName):""}),p&&c.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:[c.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),c.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),c.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:c.jsx("path",{d:"M1 1l4 4 4-4"})})]}),s&&c.jsx("div",{ref:m,className:"mdocs-domain-select-menu card",role:"listbox","aria-label":o,children:u.map(b=>c.jsxs("button",{type:"button",className:"mdocs-domain-select-option"+(b.domainId===n?" active":""),role:"option","aria-selected":b.domainId===n,onClick:()=>g(b.domainId),children:[c.jsx("span",{children:i(b.domainName)}),b.permission==="private"&&c.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"2",children:[c.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),c.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]},b.domainId))})]})}const ga="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",it={left:12,bottom:64},Xr="mdocs.agentFabPosition",Hn=36,yi=3;function Zr(e){const r=Math.max(8,window.innerWidth-Hn-8),o=Math.max(8,window.innerHeight-Hn-8);return{left:Math.min(r,Math.max(8,e.left)),bottom:Math.min(o,Math.max(8,e.bottom))}}function Zu(e,n,r,o){const i=e-r,a=n-o,s=window.innerHeight-a-Hn;return Zr({left:i,bottom:s})}function Qu(){try{const e=localStorage.getItem(Xr);if(!e)return it;const n=JSON.parse(e);return typeof n.left!="number"||typeof n.bottom!="number"?it:Zr({left:n.left,bottom:n.bottom})}catch{return it}}function vi(e){localStorage.setItem(Xr,JSON.stringify(e))}function ef(e){return e.left===it.left&&e.bottom===it.bottom}function tf(e){const r=Math.min(480,window.innerWidth-72);let o=e.left+Hn+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 nf(e){const{t:n}=Ye(),r=!!e.disableDrag,[o,i]=x.useState(!1),[a,s]=x.useState(e.position),l=x.useRef(null),u=x.useRef(null),d=x.useRef(a),h=x.useRef(e.onPositionChange),m=x.useRef(e.onToggle);d.current=a,h.current=e.onPositionChange,m.current=e.onToggle;const f=x.useRef(null),p=x.useRef(0),g=x.useRef(null);x.useEffect(()=>{f.current||(s(e.position),d.current=e.position)},[e.position]),x.useEffect(()=>{function D(){const N=Zr(d.current);N.left===d.current.left&&N.bottom===d.current.bottom||(d.current=N,s(N),h.current(N),vi(N))}return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]),x.useEffect(()=>{function D(){p.current=0;const P=g.current;if(!P)return;g.current=null,d.current=P,s(P);const S=u.current;S&&(S.style.left=`${P.left}px`,S.style.bottom=`${P.bottom}px`),h.current(P)}function N(P){const S=f.current;if(!S||P.pointerId!==S.pointerId)return;P.preventDefault();const T=P.clientX-S.startX,$=P.clientY-S.startY;!S.didMove&&T*T+$*$>=yi*yi&&(S.didMove=!0,i(!0)),S.didMove&&(g.current=Zu(P.clientX,P.clientY,S.offsetX,S.offsetY),p.current||(p.current=requestAnimationFrame(D)))}function _(P){var T;const S=f.current;if(!(!S||P.pointerId!==S.pointerId)){f.current=null,i(!1),p.current&&(cancelAnimationFrame(p.current),p.current=0),g.current&&(d.current=g.current,s(g.current),g.current=null);try{(T=l.current)==null||T.releasePointerCapture(P.pointerId)}catch{}if(S.didMove){const $=d.current;h.current($),vi($);return}m.current()}}return window.addEventListener("pointermove",N,{passive:!1}),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_),()=>{window.removeEventListener("pointermove",N),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_),p.current&&cancelAnimationFrame(p.current)}},[]);function w(D){if(D.button!==0)return;if(r){D.preventDefault(),e.onToggle();return}D.preventDefault();const N=D.currentTarget.getBoundingClientRect();f.current={pointerId:D.pointerId,offsetX:D.clientX-N.left,offsetY:D.clientY-N.top,startX:D.clientX,startY:D.clientY,didMove:!1},D.currentTarget.setPointerCapture(D.pointerId)}function b(){d.current=it,s(it),e.onPositionChange(it),localStorage.removeItem(Xr)}const v=r?it:a,I=!r&&!ef(a);return c.jsxs("div",{ref:u,className:"mdocs-agent-fab-wrap"+(o?" dragging":""),style:{left:v.left,bottom:v.bottom},children:[c.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:w,children:c.jsx("img",{src:ga,alt:"",draggable:!1})}),I&&c.jsx("button",{type:"button",className:"mdocs-agent-fab-reset",onClick:b,"aria-label":n("agentFabReset"),children:n("agentFabReset")})]})}function rf(){const[e,n]=x.useState(()=>typeof window>"u"?it:Qu());return[e,n]}function of({title:e,message:n,onClose:r}){const{t:o}=Ye();return c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:i=>{i.target===i.currentTarget&&r()},children:c.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&c.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),c.jsx("p",{className:"mdocs-message-dialog-body",children:n}),c.jsx("div",{className:"mdocs-message-dialog-actions",children:c.jsx("button",{type:"button",className:"primary",onClick:r,children:o("gotIt")})})]})})}function ya({title:e,message:n,confirmLabel:r="确定",cancelLabel:o="取消",onConfirm:i,onCancel:a,busy:s=!1,danger:l=!1}){return c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:u=>{u.target===u.currentTarget&&!s&&a()},children:c.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[e&&c.jsx("h2",{className:"mdocs-message-dialog-title",children:e}),c.jsx("p",{className:"mdocs-message-dialog-body",children:n}),c.jsxs("div",{className:"mdocs-message-dialog-actions",style:{gap:8},children:[c.jsx("button",{type:"button",onClick:a,disabled:s,children:o}),c.jsx("button",{type:"button",className:l?"danger":"primary",onClick:i,disabled:s,children:s?"…":r})]})]})})}const af=280;function sf(e,n){const r=new Date(e);return Number.isNaN(r.getTime())?"":r.toLocaleString(n==="zh"?"zh-CN":"en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function lf(e){const{t:n,lang:r}=Ye(),o=x.useRef(null),[i,a]=x.useState(""),[s,l]=x.useState([]),[u,d]=x.useState(!1),[h,m]=x.useState(null),f=x.useRef(0);return x.useEffect(()=>{if(!e.open)return;a(""),l([]),m(null),d(!1);const p=window.setTimeout(()=>{var g;return(g=o.current)==null?void 0:g.focus()},0);return()=>window.clearTimeout(p)},[e.open]),x.useEffect(()=>{if(!e.open)return;const p=g=>{g.key==="Escape"&&(g.preventDefault(),e.onClose())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[e.open,e.onClose]),x.useEffect(()=>{if(!e.open)return;const p=i.trim();if(!p||!e.domainId){l([]),d(!1),m(null);return}d(!0),m(null);const g=++f.current,w=window.setTimeout(()=>{ml({query:p,domainId:e.domainId,topN:20}).then(b=>{g===f.current&&(l(b),d(!1))}).catch(b=>{g===f.current&&(l([]),d(!1),m(b instanceof Error?b.message:n("docSearchFailed")))})},af);return()=>window.clearTimeout(w)},[i,e.open,e.domainId,n]),e.open?c.jsx("div",{className:"mdocs-doc-search-backdrop",role:"presentation",onMouseDown:p=>{p.target===p.currentTarget&&e.onClose()},children:c.jsxs("div",{className:"mdocs-doc-search-panel",role:"dialog","aria-modal":"true","aria-label":n("docSearchTitle"),children:[c.jsxs("div",{className:"mdocs-doc-search-bar",children:[c.jsx(Si,{size:18,strokeWidth:1.75,"aria-hidden":!0}),c.jsx("input",{ref:o,className:"mdocs-doc-search-input",type:"search",value:i,placeholder:n("docSearchPlaceholder"),"aria-label":n("docSearchPlaceholder"),onChange:p=>a(p.target.value)}),c.jsx("button",{type:"button",className:"mdocs-doc-search-close","aria-label":n("close"),onClick:e.onClose,children:c.jsx(Et,{size:16,strokeWidth:1.75})})]}),c.jsxs("div",{className:"mdocs-doc-search-results",children:[!e.domainId&&c.jsx("p",{className:"mdocs-doc-search-hint",children:n("docSearchNoDomain")}),e.domainId&&!i.trim()&&c.jsx("p",{className:"mdocs-doc-search-hint",children:n("docSearchEmptyHint")}),u&&c.jsx("p",{className:"mdocs-doc-search-hint",children:n("loading")}),h&&c.jsx("p",{className:"mdocs-doc-search-error",children:h}),!u&&!h&&i.trim()&&s.length===0&&c.jsx("p",{className:"mdocs-doc-search-hint",children:n("docSearchNoResults")}),s.map(p=>{var b;const g=sf(p.updatedAt,r),w=[(b=p.ownerVisitorName)==null?void 0:b.trim(),g].filter(Boolean);return c.jsxs("button",{type:"button",className:"mdocs-doc-search-row",onClick:()=>{e.onOpenDocument(p.documentId),e.onClose()},children:[c.jsx("span",{className:"mdocs-doc-search-row-title",children:p.displayName}),w.length>0&&c.jsx("span",{className:"mdocs-doc-search-row-meta",children:w.join(" · ")}),p.relativePath&&c.jsx("span",{className:"mdocs-doc-search-row-path",children:p.relativePath}),p.snippet&&c.jsx("span",{className:"mdocs-doc-search-row-snippet",children:p.snippet})]},p.documentId)})]})]})}):null}const bi={"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"},va={"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 rt(e,n){if(n instanceof Ke)return n.message;if(n instanceof kt){const r=bi[n.message];return r?e(r):n.message}if(n instanceof Error){const r=bi[n.message]??va[n.message];return r?e(r):n.message}return String(n)}function cf(e,n,r){if(e==="Default")return r("defaultDomain");const o="个人域";return e.endsWith(o)?e.slice(0,-o.length)+r("personalDomainSuffix"):e}function Vm(e,n){return e==="public"?n("domainPublic"):e==="restricted"?n("domainRestricted"):e==="private"?n("domainPrivate"):e}function An(e){const n=e.lastIndexOf("/");return n===-1?"":e.slice(0,n)}function df(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 hr(e,n){const r=e.trim(),o=n.trim();return o?r?`${r}/${o}`:o:r}function ba(e,n=new Set){for(const r of e)r.type==="document"?n.add(r.path):(r.descDocumentId&&n.add(Ys(r.path)),ba(r.children,n));return n}function En(e,n){for(const r of e){if(r.type==="folder"&&r.path===n)return r.documentId;if(r.type==="folder"){const o=En(r.children,n);if(o)return o}}return null}function pr(e,n){const r=va[n];return r?e(r):n}function uf(e){const{tree:n,currentDomainId:r,selectedCreateParentPath:o,t:i,onDocCreated:a,refreshTree:s}=e,[l,u]=x.useState(null),[d,h]=x.useState(null),[m,f]=x.useState(!1),p=x.useRef(null);x.useEffect(()=>{if(!l)return;const v=window.setTimeout(()=>{var I;return(I=p.current)==null?void 0:I.focus()},0);return()=>window.clearTimeout(v)},[l]);function g(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 w(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=ba(n),D=l.parentMode==="selection"?o:l.parentPath;try{if(l.kind==="document"){if(l.fileType==="html"){const te=Do(l.draft);if(!te.ok){h(pr(i,te.message));return}const ne=te.displayFile,K=ne.replace(/\.html$/i,"").replace(/\.md$/i,"");let ve;try{ve=No(hr(D,ne))}catch(oe){h(rt(i,oe));return}if(I.has(ve)){h(i("pathExists"));return}const Ce=D?En(n,D)??void 0:void 0,M=await Cr({fileName:ne,displayName:K,content:"",domainId:r,parentId:Ce,fileType:"html"});await s(),a(M),u(null);return}const $=Do(l.draft);if(!$.ok){h(pr(i,$.message));return}const O=$.displayFile,R=O.replace(/\.md$/i,"");let U;try{U=No(hr(D,O))}catch(te){h(rt(i,te));return}if(I.has(U)){h(i("pathExists"));return}const V=D?En(n,D)??void 0:void 0,Y=await Cr({fileName:O,displayName:R,content:df(R),domainId:r,parentId:V});await s(),a(Y),u(null);return}const N=Zs(l.draft);if(!N.ok){h(pr(i,N.message));return}const _=kr(N.display);if(!_){h(i("invalidFolderName"));return}const P=hr(D,_);if(I.has(P)){h(i("folderExists"));return}const S=D?En(n,D)??void 0:void 0;await ul({name:_,parentId:S,domainId:r}),await s(),u(null)}catch(N){h(rt(i,N))}finally{f(!1)}}return{createModal:l,setCreateModal:u,createModalError:d,createModalBusy:m,createModalInputRef:p,openNewDocumentModal:g,openNewFolderModal:w,submitCreateModal:b}}const xi="(max-width: 768px)";function ff(){const[e,n]=x.useState(()=>typeof window<"u"?window.matchMedia(xi).matches:!1);return x.useEffect(()=>{const r=window.matchMedia(xi),o=()=>n(r.matches);return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),e}function mf({open:e,onClose:n,onResolve:r,onForceOverwrite:o,forceBusy:i}){const{t:a}=Ye();return e?c.jsx("div",{className:"mdocs-conflict-modal-root",role:"alertdialog","aria-modal":"true",children:c.jsxs("div",{className:"mdocs-conflict-modal-panel",children:[c.jsx("h2",{className:"mdocs-conflict-modal-title",children:a("conflictTitle")}),c.jsx("p",{className:"mdocs-conflict-modal-body",children:a("conflictBody")}),o?c.jsx("p",{className:"mdocs-conflict-modal-force-hint",children:a("conflictForceHint")}):null,c.jsxs("div",{className:"mdocs-conflict-modal-actions",children:[c.jsx("button",{type:"button",className:"primary",onClick:r,disabled:i,children:a("conflictResolve")}),o?c.jsx("button",{type:"button",className:"mdocs-conflict-force-btn",disabled:i,onClick:o,children:a(i?"conflictForceBusy":"conflictForce")}):null,c.jsx("button",{type:"button",className:"secondary",onClick:n,disabled:i,children:a("conflictClose")})]})]})}):null}function wi({documentId:e,visitorId:n,visitorName:r,documentOwnerId:o,onClose:i}){const[a,s]=x.useState([]),[l,u]=x.useState(""),[d,h]=x.useState(null),[m,f]=x.useState(!0),[p,g]=x.useState(!1),[w,b]=x.useState(null),[v,I]=x.useState(null),[D,N]=x.useState(360),[_,P]=x.useState(80),S=x.useRef(!1),T=x.useRef(!1),$=300,O=80,R=x.useRef(null);function U(){const W=R.current;if(!W)return;W.style.height="auto";const X=W.scrollHeight,xe=Math.min(Math.max(X,O),$);W.style.height=`${xe}px`,P(xe)}x.useEffect(()=>{setTimeout(()=>U(),0)},[d]);function V(W){return n?W.visitorId===n||o===n:!1}const{rootComments:Y,repliesByParentId:te,totalCount:ne}=x.useMemo(()=>{const W=[],X=new Map;let xe=0;for(const se of a)se.isDeleted||(xe++,se.parentId?(X.has(se.parentId)||X.set(se.parentId,[]),X.get(se.parentId).push(se)):W.push(se));return{rootComments:W,repliesByParentId:X,totalCount:xe}},[a]),K=x.useRef(e);x.useEffect(()=>{K.current=e,u(""),h(null),I(null),ve()},[e]);async function ve(){const W=K.current;f(!0);try{const X=await gl(e);if(K.current!==W)return;s(X.comments)}catch(X){if(K.current!==W)return;I("加载评论失败"),console.error("Failed to load comments:",X)}finally{K.current===W&&f(!1)}}async function Ce(){var W;if(!(!l.trim()||!n)){g(!0),I(null);try{await yl(e,{content:l,parentId:(d==null?void 0:d.commentId)||null,replyToVisitorId:d?((W=a.find(X=>X.commentId===d.commentId))==null?void 0:W.visitorId)??null:null,replyToVisitorName:(d==null?void 0:d.visitorName)||null}),u(""),h(null),setTimeout(()=>U(),0),await ve()}catch(X){I(X.message||"发表失败,请重试")}finally{g(!1)}}}async function M(W){I(null);try{await vl(e,W),await ve()}catch(X){I(X.message||"删除失败,请重试")}finally{b(null)}}function oe(W){const X=Date.now()-new Date(W).getTime(),xe=Math.floor(X/6e4),se=Math.floor(X/36e5),Je=Math.floor(X/864e5);return xe<1?"刚刚":xe<60?`${xe}分钟前`:se<24?`${se}小时前`:`${Je}天前`}function ae(W){S.current=!0,W.preventDefault()}function re(W){T.current=!0,W.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="row-resize"}return x.useEffect(()=>{function W(xe){if(S.current){const se=Math.max(280,Math.min(600,window.innerWidth-xe.clientX));N(se)}if(T.current){const se=-xe.movementY;P(Je=>Math.max(60,Math.min(600,Je+se)))}}function X(){S.current=!1,T.current=!1,document.body.style.userSelect="",document.body.style.cursor=""}return window.addEventListener("mousemove",W),window.addEventListener("mouseup",X),()=>{window.removeEventListener("mousemove",W),window.removeEventListener("mouseup",X)}},[]),c.jsxs("div",{className:"mdocs-comments-panel",style:{width:D},children:[c.jsx("div",{className:"mdocs-comments-resize-handle",onMouseDown:ae}),c.jsxs("div",{className:"mdocs-comments-header",children:[c.jsxs("h3",{style:{margin:0,fontSize:"1rem",display:"flex",alignItems:"center",gap:6},children:[c.jsx(js,{size:18}),"评论 (",ne,")"]}),c.jsx("button",{type:"button",onClick:i,className:"mdocs-comments-close-btn",children:c.jsx(Et,{size:18})})]}),v&&c.jsxs("div",{className:"mdocs-comments-error",children:[v,c.jsx("button",{type:"button",onClick:()=>I(null),children:c.jsx(Et,{size:14})})]}),c.jsx("div",{className:"mdocs-comments-list",children:m?c.jsx("div",{className:"mdocs-comments-empty",children:"加载中..."}):Y.length===0?c.jsx("div",{className:"mdocs-comments-empty",children:"暂无评论,来发表第一条吧~"}):Y.map(W=>c.jsxs("div",{className:"mdocs-comment-root",children:[c.jsxs("div",{className:"mdocs-comment-header",children:[c.jsx("span",{className:"mdocs-comment-avatar",children:W.visitorName.charAt(0).toUpperCase()}),c.jsx("span",{className:"mdocs-comment-author",children:W.visitorName}),c.jsx("span",{className:"mdocs-comment-time",children:oe(W.createdAt)}),V(W)&&c.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>b(W.commentId),title:"删除",children:c.jsx(Et,{size:14})})]}),c.jsx("div",{className:"mdocs-comment-content",children:W.content}),n&&c.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>h({commentId:W.commentId,visitorName:W.visitorName}),children:"回复"}),(te.get(W.commentId)??[]).length>0&&c.jsx("div",{className:"mdocs-comment-replies",children:(te.get(W.commentId)??[]).map(X=>c.jsxs("div",{className:"mdocs-comment-reply",children:[c.jsxs("div",{className:"mdocs-comment-header",children:[c.jsx("span",{className:"mdocs-comment-avatar mdocs-comment-avatar-small",children:X.visitorName.charAt(0).toUpperCase()}),c.jsx("span",{className:"mdocs-comment-author",children:X.visitorName}),X.replyToVisitorName&&c.jsxs("span",{className:"mdocs-comment-reply-to",children:["回复 ",X.replyToVisitorName]}),c.jsx("span",{className:"mdocs-comment-time",children:oe(X.createdAt)}),V(X)&&c.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>b(X.commentId),title:"删除",children:c.jsx(Et,{size:12})})]}),c.jsx("div",{className:"mdocs-comment-content",children:X.content}),n&&c.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>h({commentId:W.commentId,visitorName:X.visitorName}),children:"回复"})]},X.commentId))})]},W.commentId))}),n?c.jsxs("div",{className:"mdocs-comments-input-wrapper",children:[c.jsx("div",{className:"mdocs-comments-input-drag-handle",onMouseDown:re}),d&&c.jsxs("div",{className:"mdocs-comment-reply-notice",children:[c.jsxs("span",{children:["回复 ",c.jsx("span",{className:"mdocs-comment-reply-to-name",children:d.visitorName})]}),c.jsxs("button",{type:"button",onClick:()=>h(null),children:[c.jsx(Et,{size:14})," 取消"]})]}),c.jsx("textarea",{ref:R,value:l,onChange:W=>{u(W.target.value.slice(0,512)),setTimeout(()=>U(),0)},placeholder:d?`回复 ${d.visitorName}...`:"发表评论...",className:"mdocs-comments-input",style:{height:_},maxLength:512,onKeyDown:W=>{W.key==="Enter"&&(W.metaKey||W.ctrlKey)&&Ce()}}),c.jsxs("div",{className:`mdocs-comments-char-count${l.length>=460?" mdocs-char-count--warn":""}`,children:[l.length,"/512"]}),c.jsx("div",{className:"mdocs-comments-input-actions",children:c.jsx("button",{type:"button",className:"mdocs-btn-primary",onClick:Ce,disabled:p||!l.trim(),children:p?"发表中...":"发表"})})]}):c.jsx("div",{className:"mdocs-comments-input-wrapper",style:{textAlign:"center"},children:c.jsx("div",{style:{color:"#666",fontSize:"0.9rem"},children:"请先创建访客身份以发表评论"})}),w&&c.jsx(ya,{title:"删除评论",message:"确定要删除这条评论吗?",confirmLabel:"删除",danger:!0,onConfirm:()=>M(w),onCancel:()=>b(null)})]})}const hf="mdocs-drafts",pf=5,Ae="drafts";let xa=0;const Lr=new Set;function Gm(e){return Lr.add(e),()=>{Lr.delete(e)}}function Wm(){return xa}function wa(e,n){xa+=1;for(const r of Lr)r(e,n)}const Xt={DOC_NOT_FOUND:"DOC_NOT_FOUND",SYNC_HEAD_MISSING:"SYNC_HEAD_MISSING"};let gr=null;function Zt(){return gr||(gr=new Promise((e,n)=>{const r=indexedDB.open(hf,pf);r.onupgradeneeded=o=>{const i=r.result;i.objectStoreNames.contains(Ae)||i.createObjectStore(Ae,{keyPath:"documentId"});const a=o.oldVersion;if(a>0&&a<4){const u=r.transaction.objectStore(Ae).openCursor();u.onsuccess=()=>{const d=u.result;if(!d)return;const h=d.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)),d.update(h),d.continue()}}if(a>0&&a<5){const u=r.transaction.objectStore(Ae).openCursor();u.onsuccess=()=>{const d=u.result;if(!d)return;const h=d.value;h.contentKind==null&&(h.contentKind="lexical",d.update(h)),d.continue()}}},r.onsuccess=()=>e(r.result),r.onerror=()=>n(r.error)})),gr}async function gf(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 Ot(r)}function Qr(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 Ot(e){const n=await Zt(),r=Qr(e);return new Promise((o,i)=>{const a=n.transaction(Ae,"readwrite");a.objectStore(Ae).put(r),a.oncomplete=()=>{wa(r.documentId,!r.published),o()},a.onerror=()=>i(a.error)})}async function Oe(e){const n=await Zt();return new Promise((r,o)=>{const a=n.transaction(Ae,"readonly").objectStore(Ae).get(e);a.onsuccess=()=>r(a.result),a.onerror=()=>o(a.error)})}async function yr(e){const n=await Zt();return new Promise((r,o)=>{const i=n.transaction(Ae,"readwrite");i.objectStore(Ae).delete(e),i.oncomplete=()=>{wa(e,!1),r()},i.onerror=()=>o(i.error)})}async function yf(e){const n=await Zt();return new Promise((r,o)=>{const a=n.transaction(Ae,"readonly").objectStore(Ae).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 vf(e,n){const r=await Zt();return new Promise((o,i)=>{const s=r.transaction(Ae,"readwrite").objectStore(Ae),l=s.get(e);l.onsuccess=()=>{const u=l.result;u&&s.put(Qr({...u,publishError:n,publishErrorAt:Date.now()})),o()},l.onerror=()=>i(l.error)})}async function vr(e){const n=await Zt();return new Promise((r,o)=>{const a=n.transaction(Ae,"readwrite").objectStore(Ae),s=a.get(e);s.onsuccess=()=>{const l=s.result;l&&a.put(Qr({...l,publishError:void 0,publishErrorAt:void 0})),r()},s.onerror=()=>o(s.error)})}async function br(e,n){const r=await Oe(e);r&&await Ot({...r,localBaseCommitId:n.localBaseCommitId,conflictStatus:n.conflictStatus,conflict:n.conflict})}async function xr(e){const n=await Oe(e);n&&await Ot({...n,conflict:void 0,conflictStatus:"none"})}class vn extends Error{constructor(r,o){super(r);qt(this,"code");qt(this,"cause");this.name="DraftPublishAborted",this.code=r,this.cause=o==null?void 0:o.cause}}function bf(e){return e instanceof vn?e.code:e instanceof Ke?e.status===404?Xt.DOC_NOT_FOUND:e.code||`HTTP_${e.status}`:e instanceof Error&&e.message.trim()?e.message.trim().slice(0,120):"UNKNOWN"}function xf(e,n,r,o){const i=(n==null?void 0:n.displayName)||e("unknownTitle");if(r===Xt.SYNC_HEAD_MISSING)return e("draftPublishFailedSyncHead",{name:i});if(r===Xt.DOC_NOT_FOUND)return e("draftPublishFailedNotice",{name:i});const a=o instanceof Ke||o instanceof Error&&o.message?o.message:r;return e("draftPublishFailedGeneric",{name:i,reason:a})}async function wf(e,n,r){const o=bf(n);throw await vf(e,o),n instanceof vn?n:new vn(o,{cause:n})}function _f(e,n){const r=x.useRef(n);r.current=n,x.useEffect(()=>{if(!e)return;const o=3e4,i=1e4,a=async()=>{const l=await yf({skipFailed:!0}),u=Date.now();for(const d of l)if(!d.published&&!(u-d.updatedAt<o))try{await r.current(d.documentId)}catch(h){console.log("[autoPublish] scan publish failed:",h)}};a();const s=setInterval(a,i);return()=>clearInterval(s)},[e])}const kf=1e4;function If(e,n){const[r,o]=x.useState(null),[i,a]=x.useState("up_to_date");return x.useEffect(()=>{if(!e){o(null),a("up_to_date");return}let l=!1;const u=e;async function d(){try{const m=await ll(u,n??void 0);if(l)return;o(m.headCommitId),a(m.status)}catch{}}d();const h=window.setInterval(()=>void d(),kf);return()=>{l=!0,window.clearInterval(h)}},[e,n]),{remoteCommitId:r,syncStatus:i,syncBehind:!!(n&&r&&n!==r)||i==="behind"}}function _i(e){return e.trim()}function Cf(e){return e.trim()}const Sf=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".ico",".bmp",".jfif",".pjpeg"]);function Df(e){const n=e.split("/").pop()??"",r=n.lastIndexOf(".");return r<=0?"":n.slice(r).toLowerCase()}function Nf(e,n,r){let o,i;try{o=new URL(r),i=new URL(e,r)}catch{return null}if(i.origin!==o.origin||!i.pathname.startsWith("/api/assets/")||Sf.has(Df(i.pathname)))return null;const a=n==null?void 0:n.trim();return a&&!i.searchParams.has("name")&&i.searchParams.set("name",a),i.toString()}function Pf(){const e=n=>{if(n.button!==0)return;const o=n.composedPath().find(a=>a instanceof HTMLAnchorElement);if(!o)return;const i=Nf(o.href,o.getAttribute("download"),window.location.href);i&&(n.preventDefault(),n.stopPropagation(),window.location.assign(i))};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)}const Ge={DOCUMENT:"md",HTML:"html",FOLDER:"dir",FOLDER_DESC:"folder_desc",GRAPH_FILE:"graph_file",GRAPH_DIR:"graph_dir"},Tf="/assets/mdocs-logo-Dsv_2t6v.svg",Af=x.lazy(()=>zt(()=>import("./DocumentEditor-KEURMFDp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.DocumentEditor}))),jf=x.lazy(()=>zt(()=>import("./HtmlEditor-jCKtKOCT.js"),__vite__mapDeps([14,1,11,12,13,2,3,6,15])).then(e=>({default:e.HtmlEditor}))),Mf=x.lazy(()=>zt(()=>import("./SettingsPage-mS3g_vBq.js"),__vite__mapDeps([16,1,13,8,2,3,6])).then(e=>({default:e.SettingsPage}))),Ef=x.lazy(()=>zt(()=>import("./AgentChatPanel-DTj8Nz0Z.js"),__vite__mapDeps([17,1,18,8,9,7,2,3,6])).then(e=>({default:e.AgentChatPanel}))),Of=x.lazy(()=>zt(()=>import("./AiWriteWorkbench-D2RzXzty.js"),__vite__mapDeps([19,1,18,7,2,3,6])).then(e=>({default:e.AiWriteWorkbench}))),Rf=x.lazy(()=>zt(()=>import("./MergeView-eRcs-x1s.js"),__vite__mapDeps([20,1,4,5,2,3,6,7,8,9,12])).then(e=>({default:e.MergeView})));function Ff(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 wr(e,n,r,o){const i=await Ai();n(i);const a=localStorage.getItem("mdocs.currentDomainId"),l=a&&i.some(u=>u.domainId===a)?a:kl(i,e);r(l),await o(l)}function ki(){const{t:e,lang:n,setLang:r}=Ye(),[o,i]=x.useState("loading"),[a,s]=x.useState(()=>localStorage.getItem("mdocs.sidebarCollapsed")==="true"),l=ff(),[u,d]=x.useState(!1),h=()=>{if(l){d(E=>!E);return}const y=!a;s(y),localStorage.setItem("mdocs.sidebarCollapsed",String(y))};x.useEffect(()=>{l||d(!1)},[l]),x.useEffect(()=>Pf(),[]);const[m,f]=x.useState(!1),[p,g]=x.useState(0),w=x.useRef(null),[b,v]=x.useState(null),[I,D]=x.useState(null),[N,_]=x.useState(null),[P,S]=x.useState([]),[T,$]=x.useState([]),[O,R]=x.useState("default"),[U,V]=x.useState(!1),Y=x.useRef(null),{documentId:te}=$a(),ne=Ua(),[K,ve]=x.useState(null),Ce=(K==null?void 0:K.kind)==="document"?K.documentId:null,[M,oe]=x.useState(null),[ae,re]=x.useState(null),W=x.useRef(ae);W.current=ae;const[X,xe]=x.useState(0),[se,Je]=x.useState(null),[St,gt]=x.useState(!1),[Qt,$t]=x.useState(!1),[Dt,Xe]=x.useState(!1),[_e,Ze]=x.useState(!1),xn=(M==null?void 0:M.documentId)??null,{syncBehind:Qe,remoteCommitId:Nt}=If(xn,se),[ze,Ut]=x.useState(null);x.useEffect(()=>{if(!Dt||!M){Ut(null);return}(async()=>{const y=await Oe(M.documentId);if(y!=null&&y.conflict){Ut(y.conflict);return}if(y&&se&&Nt){const E=y.localBaseCommitId??se;if(!E)return;const A={localBaseCommitId:E,remoteCommitId:Nt,localSnapshotContent:y.content};await br(M.documentId,{localBaseCommitId:A.localBaseCommitId,conflictStatus:"diverged",conflict:A}),Ut(A)}})()},[Dt,M,se,Nt]),x.useEffect(()=>{!M||!Qe||!_e||Oe(M.documentId).then(async y=>{!y||y.conflict||y.conflictStatus==="publish_conflict"||y.conflictStatus!=="diverged"&&await Ot({...y,conflictStatus:"diverged"})})},[M==null?void 0:M.documentId,Qe,_e]),x.useEffect(()=>{if(!M){Je(null);return}let y=!1;return Oe(M.documentId).then(E=>{y||(E&&!E.published&&E.localBaseCommitId?Je(E.localBaseCommitId):Je(M.headCommitId??null))}),()=>{y=!0}},[M==null?void 0:M.documentId,M==null?void 0:M.headCommitId,_e]);const[Me,fe]=x.useState(null),[Se,ye]=x.useState(null),[be,Pt]=x.useState(null),[yt,st]=x.useState(null),[en,Ee]=x.useState(""),[wn,et]=x.useState("docs"),[Fe,He]=x.useState(!1),[_n,vt]=x.useState(!1),[Bt,kn]=rf(),k=x.useRef(null),[j,L]=x.useState(!1),[F,G]=x.useState(null),J=x.useRef(void 0),ee=x.useRef(void 0);_f(localStorage.getItem("mdocs.autoPublish")==="true",co);async function Z(y){var E;await((E=J.current)==null?void 0:E.call(J)),y()}function pe(y){const A=(y.trim()||"untitled").replace(/[\\/:*?"<>|]/g,"-").slice(0,80);return A.endsWith(".md")?A:`${A}.md`}async function De(){var A,B;if(!M||!ae)return;await((A=J.current)==null?void 0:A.call(J));const y=M.fileType===Ge.HTML;let E="";if(y)E=_i(ae.content);else if(E=((B=ee.current)==null?void 0:B.call(ee))??"",!E.trim())try{E=(await ir({content:ae.content,from:"lexical",to:"markdown"})).content}catch{E=""}G({markdown:E,documentId:M.documentId,displayName:ae.displayName||M.displayName||"未命名",fileType:y?Ge.HTML:Ge.DOCUMENT}),L(!0),He(!1)}function je(){G({markdown:"",documentId:null,displayName:"未命名",fileType:Ge.DOCUMENT}),L(!0),He(!1)}async function Ne(y){var le,we;const E=y.documentId.trim();if(!E)return;await((le=J.current)==null?void 0:le.call(J));let A="",B=y.displayName.trim()||"未命名",Q=Ge.DOCUMENT;try{const Wt=await Kt(E);if(B=((we=Wt.displayName)==null?void 0:we.trim())||B,Q=Wt.fileType===Ge.HTML?Ge.HTML:Ge.DOCUMENT,Q===Ge.HTML)A=_i(Wt.content);else try{A=(await ir({content:Wt.content,from:"lexical",to:"markdown"})).content}catch{A=""}}catch{}G({markdown:A,documentId:E,displayName:B,fileType:Q}),L(!0),He(!1),et("docs"),Z(()=>ne(`/doc/${E}`))}async function ke(y){(M==null?void 0:M.documentId)===y.documentId&&await Zn()}async function Pe(y){const A=(y.documentId&&(F==null?void 0:F.documentId)===y.documentId?F.fileType:(M==null?void 0:M.documentId)===y.documentId?M.fileType:Ge.DOCUMENT)===Ge.HTML;if(y.documentId){const Q=(M==null?void 0:M.documentId)===y.documentId?M:null;let le;return A?le=Cf(y.markdown):le=(await ir({content:y.markdown,from:"markdown",to:"lexical"})).content,await gf({documentId:y.documentId,content:le,displayName:y.displayName,localBaseCommitIdAtEditStart:(Q==null?void 0:Q.headCommitId)??null,contentKind:A?"html":"lexical",snapshotMeta:Q?{permission:Q.permission,ownerVisitorId:Q.ownerVisitorId,domainId:Q.domainId}:void 0}),(M==null?void 0:M.documentId)===y.documentId?(re({documentId:y.documentId,content:le,displayName:y.displayName}),xe(we=>we+1),Ze(!0)):await nn(y.documentId),fe("帮写已写入草稿,可在编辑器中继续修改后发布"),{documentId:y.documentId}}const B=await Cr({fileName:pe(y.displayName),displayName:y.displayName,content:y.markdown,contentFormat:"markdown",domainId:O||void 0,parentId:void 0});return await de(),await nn(B.documentId),fe("已创建文档"),{documentId:B.documentId}}x.useEffect(()=>{bt()},[]),x.useEffect(()=>{if(!Me)return;const y=()=>{fe(null)};return window.addEventListener("pointerdown",y,!0),()=>window.removeEventListener("pointerdown",y,!0)},[Me]),x.useEffect(()=>{const y=E=>{var Q,le,we;const A=E;if(((Q=A.detail)==null?void 0:Q.status)===409||((le=A.detail)==null?void 0:le.code)==="AI_NOT_CONFIGURED")return;const B=(we=A.detail)==null?void 0:we.message;B&&ye(B)};return window.addEventListener(Ir,y),()=>window.removeEventListener(Ir,y)},[]);async function bt(){try{const y=await Mo();v(y),On(y.visitorId),await wr(y.visitorId,$,R,de),i("ready")}catch(y){if(y instanceof Ke&&y.status===401){i("needsRegister");return}ye(rt(e,y)),i("needsRegister")}}async function xt(y,E){const A=await rl(y,E);v(A.visitor),D(A.visitor.visitorId),_(A.recoveryCode),On(A.visitor.visitorId),await wr(A.visitor.visitorId,$,R,de),i("ready")}async function lt(y){const E=await Mo();v(E),await wr(E.visitorId,$,R,de),i("ready")}async function de(y){const A=await sl(y??O);S(A)}function Ve(y){re({documentId:y.documentId,content:y.content,displayName:y.displayName}),xe(E=>E+1),Ze(!1)}function Tt(y,E){re({documentId:y,content:E.content,displayName:E.displayName}),xe(A=>A+1),Ze(!0)}async function tn(y,E){await yr(y);const A=await Kt(y);if((M==null?void 0:M.documentId)===y&&w.current===y){oe(on(A)),Ze(!1);const B=W.current,Q=E!==void 0&&A.content===E,le=(B==null?void 0:B.documentId)===y&&B.content===A.content;Q||le?(B==null?void 0:B.documentId)===y&&B.displayName!==A.displayName&&re({...B,displayName:A.displayName}):Ve(A)}return A}function At(y,E,A="folder"){console.log("[openGraph]",A,y,E),oe(null),re(null),ve({kind:"graph",scope:A,resourceId:y,name:E})}function Ht(){ve(null)}x.useEffect(()=>{function y(E){Y.current&&!Y.current.contains(E.target)&&V(!1)}if(U)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[U]);async function nn(y){w.current=y,et("docs"),ve({kind:"document",documentId:y});try{const E=await Oe(y);if(w.current!==y)return;const A=await Kt(y);if(w.current!==y||(A.domainId!==O&&(localStorage.setItem("mdocs.currentDomainId",A.domainId),R(A.domainId),de(A.domainId)),Ee(An(A.relativePath)),A.headCommitId&&E&&!E.published&&(E.publishError===Xt.SYNC_HEAD_MISSING&&await vr(y),E.localBaseCommitId||await Ot({...E,localBaseCommitId:A.headCommitId})),oe(on(A)),w.current!==y))return;E&&!E.published?Tt(y,E):Ve(A)}catch(E){if(w.current!==y)return;ye(rt(e,E))}}x.useEffect(()=>{o==="ready"&&(te?nn(te):(ve(null),oe(null),re(null),Je(null)))},[o,te]);const{createModal:Vt,setCreateModal:Kn,createModalError:eo,createModalBusy:Gt,createModalInputRef:ka,openNewDocumentModal:In,openNewFolderModal:to,submitCreateModal:Ia}=uf({tree:P,currentDomainId:O,selectedCreateParentPath:en,t:e,onDocCreated:y=>{oe(on(y)),Ve(y),Ee(An(y.relativePath)),ne(`/doc/${y.documentId}`)},refreshTree:de}),[Ca,Cn]=x.useState(!1),[Sa,Yn]=x.useState(!1);x.useEffect(()=>{const y=E=>{!(E.metaKey||E.ctrlKey)||E.key.toLowerCase()!=="k"||(E.preventDefault(),Yn(!0))};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[]);const[Da,rn]=x.useState(!1),[jt,no]=x.useState([]),[Jn,ro]=x.useState(""),[Sn,oo]=x.useState(""),[Na,io]=x.useState(new Set);async function Pa(){try{const y=await hl();no(y)}catch(y){ye(rt(e,y))}}const Xn=x.useMemo(()=>{const y={};for(const E of T)y[E.domainId]=E.domainName;return y},[T]),ao=x.useMemo(()=>{let y=jt;const E=Jn.trim().toLowerCase();return E&&(y=y.filter(A=>{var B;return(B=A.displayName)==null?void 0:B.toLowerCase().includes(E)})),Sn&&(y=y.filter(A=>A.domainId===Sn)),y},[jt,Jn,Sn]),Ta=x.useMemo(()=>{const y=new Set,E=[];for(const A of jt){const B=A.domainId;B&&!y.has(B)&&(y.add(B),E.push({id:B,name:Xn[B]??B}))}return E},[jt,Xn]);async function Aa(y,E,A,B,Q){let le=await Oe(y);!le&&(M==null?void 0:M.documentId)===y&&(le={documentId:y,content:E,displayName:A,updatedAt:Date.now(),published:!1,localBaseCommitId:B,permission:M.permission,ownerVisitorId:M.ownerVisitorId,domainId:M.domainId},await Ot(le)),le&&await br(y,{localBaseCommitId:B,conflictStatus:"publish_conflict",conflict:{localBaseCommitId:B,remoteCommitId:Q.headCommitId,localSnapshotContent:E}}),gt(!0)}async function ja(){if(!M||Qt||(b==null?void 0:b.visitorId)!==M.ownerVisitorId||!window.confirm(e("conflictForceConfirm")))return;const E=M.documentId;$t(!0);try{await rr(E).execute(async()=>{var er,fo,mo,ho,po;const A=await Oe(E),B=((er=A==null?void 0:A.conflict)==null?void 0:er.localBaseCommitId)??(A==null?void 0:A.localBaseCommitId)??se??M.headCommitId,Q=((fo=A==null?void 0:A.conflict)==null?void 0:fo.remoteCommitId)??(ze==null?void 0:ze.remoteCommitId),le=((mo=A==null?void 0:A.conflict)==null?void 0:mo.localSnapshotContent)??(A==null?void 0:A.content)??((ho=W.current)==null?void 0:ho.content),we=(A==null?void 0:A.displayName)??((po=W.current)==null?void 0:po.displayName)??M.displayName;if(!B||!Q||le==null)throw ye(e("syncHeadMissing")),new Error("missing force overwrite payload");await or(E,{content:le,displayName:we,version:{localBaseCommitId:B,merge:{remoteCommitId:Q,localSnapshotContent:le,forceLocal:!0}}});const Wt=await Kt(E);await lo(Wt)})}catch(A){A instanceof Error&&A.message==="missing force overwrite payload"||ye(rt(e,A))}finally{$t(!1)}}async function so(y,E,A,B){return rr(A).execute(async()=>{const Q=await Oe(A),le=(Q==null?void 0:Q.localBaseCommitId)??(M==null?void 0:M.headCommitId);if(!le)throw ye(e("syncHeadMissing")),new Error("missing localBaseCommitId");try{await or(A,{content:y,displayName:E,permission:B,version:{localBaseCommitId:le}}),await xr(A),await tn(A,y),await de(),gt(!1),fe(e("published")),window.setTimeout(()=>fe(null),1200)}catch(we){throw we instanceof Ke&&we.status===409&&we.code==="VERSION_CONFLICT"&&we.details&&typeof we.details=="object"&&await Aa(A,y,E,le,we.details),we}})}async function Ma(){if(!M)return;const y=await Kt(M.documentId);y.domainId!==O&&(localStorage.setItem("mdocs.currentDomainId",y.domainId),R(y.domainId),de(y.domainId)),Ee(An(y.relativePath)),oe(on(y)),Ve(y),fe(e("syncPullDone")),window.setTimeout(()=>fe(null),1200)}async function Zn(){if(!M)return;const y=await Oe(M.documentId),E=!!(y&&!y.published);if((y==null?void 0:y.conflictStatus)==="publish_conflict"||(y==null?void 0:y.conflictStatus)==="diverged"||!!(y!=null&&y.conflict)){Xe(!0);return}if(E&&y){if(Qe&&Nt){const B=y.localBaseCommitId??se;if(B){const Q={localBaseCommitId:B,remoteCommitId:Nt,localSnapshotContent:y.content};await br(M.documentId,{localBaseCommitId:B,conflictStatus:"diverged",conflict:Q}),Ut(Q)}Xe(!0);return}fe(e("pullBlockedDraft")),window.setTimeout(()=>fe(null),3e3);return}await Ma()}async function lo(y){await xr(y.documentId),await yr(y.documentId),Ze(!1),Xe(!1),gt(!1),await nn(y.documentId),de(y.domainId),fe(e("published")),window.setTimeout(()=>fe(null),1200)}async function Ea(y,E,A){try{await wf(y,E,A)}catch(B){if(!(B instanceof vn))throw B;const Q=A??await Oe(y);throw fe(xf(e,Q,B.code,B.cause??E)),window.setTimeout(()=>fe(null),4e3),B}}async function co(y){let E;try{await rr(y).execute(async()=>{const A=await Oe(y);if(!A)return;E=A;let B=A.localBaseCommitId;if(B||(B=(await Kt(y)).headCommitId??void 0,B&&(await Ot({...A,localBaseCommitId:B}),A.publishError===Xt.SYNC_HEAD_MISSING&&await vr(y))),!B)throw new vn(Xt.SYNC_HEAD_MISSING);const Q=await Oe(y);Q&&(await or(y,{content:Q.content,displayName:Q.displayName,version:{localBaseCommitId:B}}),await xr(y),await vr(y),(M==null?void 0:M.documentId)===y?await tn(y,Q.content):await yr(y),await de(),fe(e("published")),window.setTimeout(()=>fe(null),1200))})}catch(A){await Ea(y,A,E)}}function Qn(y,E){Pt({type:"document",id:y,name:E})}function uo(y,E){Pt({type:"folder",id:y,name:E})}async function Oa(y,E){try{const A=await dl(y,E);await de(A.domainId),(M==null?void 0:M.documentId)===y&&(oe(on(A)),Ee(An(A.relativePath)))}catch(A){A instanceof Ke?A.status===409&&ye(A.message):ye(rt(e,A))}}async function Ra(){if(be)try{be.type==="document"?(await cl(be.id),(M==null?void 0:M.documentId)===be.id&&(oe(null),re(null),Ee(""),ne("/"))):be.type==="folder"&&(await fl(be.id),M&&(oe(null),re(null),Ee(""),ne("/"))),await de(),fe(be.type==="folder"?`已删除「${be.name}」及其下所有内容`:`已删除「${be.name}」`),window.setTimeout(()=>fe(null),2e3)}catch(y){ye(rt(e,y))}finally{Pt(null)}}return o==="loading"?c.jsx("div",{className:"mdocs-loading muted",children:e("loading")}):o==="needsRegister"?c.jsx(Il,{onSubmit:xt,onRecover:lt,error:Me}):c.jsxs("div",{className:"mdocs-app-root",children:[Ti(),c.jsx("div",{className:"mdocs-shell",children:wn==="settings"?c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"mdocs-main muted",style:{padding:24},children:"加载设置…"}),children:c.jsx(Mf,{onBack:()=>et("docs"),onPublishDraft:co,onOpenDocument:nn,onRecoverDraft:()=>void de()})}):c.jsxs("div",{className:"mdocs-layout"+(l?" mdocs-layout--reader":""),children:[l&&u?c.jsx("button",{type:"button",className:"mdocs-mobile-nav-scrim","aria-label":e("collapseSidebar"),onClick:()=>d(!1)}):null,c.jsxs("aside",{className:"mdocs-sidebar"+(l?u?" mdocs-sidebar--drawer-open":" mdocs-sidebar--drawer":a?" mdocs-sidebar-collapsed":""),children:[c.jsxs("header",{className:"mdocs-sidebar-header",children:[c.jsxs("div",{className:"mdocs-brand",children:[c.jsx("img",{src:Tf,alt:e("brand"),className:"mdocs-brand-logo"}),c.jsx("span",{children:e("brand")})]}),c.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?c.jsx(wo,{size:18}):a?c.jsx(_o,{size:18}):c.jsx(wo,{size:18})})]}),c.jsxs("div",{className:"mdocs-sidebar-actions",ref:Y,children:[c.jsxs("button",{type:"button",className:"mdocs-sidebar-create-btn",onClick:()=>V(y=>!y),children:[c.jsx(xo,{size:15,strokeWidth:1.75}),e("newArticle")]}),U&&c.jsxs("div",{className:"mdocs-create-dropdown",children:[c.jsxs("button",{type:"button",className:"mdocs-create-dropdown-item",onClick:()=>{V(!1),In()},children:[c.jsx(xo,{size:14,strokeWidth:1.5}),"Markdown"]}),c.jsxs("button",{type:"button",className:"mdocs-create-dropdown-item",onClick:()=>{V(!1),In(void 0,"html")},children:[c.jsx(gs,{size:14,strokeWidth:1.5}),"HTML"]})]}),c.jsxs("button",{type:"button",className:"mdocs-sidebar-create-btn",onClick:()=>{V(!1),to()},children:[c.jsx(Cs,{size:15,strokeWidth:1.75}),e("newDirectory")]}),c.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":e("docSearch"),onClick:()=>Yn(!0),children:c.jsx(Si,{size:18,strokeWidth:1.75})}),c.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":"知识图谱",onClick:()=>At(O,"知识图谱","domain"),children:c.jsx(zr,{size:18,strokeWidth:1.75})})]}),c.jsx(Sl,{nodes:P,activeDocumentId:Ce,graphFocusAnchorId:(K==null?void 0:K.kind)==="graph"?K.resourceId:null,selectedParentPath:en,onOpen:y=>{l&&d(!1),Z(()=>ne(`/doc/${y.documentId}`))},onOpenFolder:(y,E)=>{Z(()=>{Ee(y),E&&(Ht(),l&&d(!1),ne(`/doc/${E}`))})},onContextMenu:st,onMoveDocument:Oa,onDeselect:()=>{Ht(),Z(()=>{Ee(""),ne("/")})},onOpenGraph:(y,E)=>{if(y.type==="folder")At(y.documentId,y.name);else if(E){const A=P.find(B=>B.documentId===E);At(E,(A==null?void 0:A.name)??"图谱")}},onGenerateGraph:async(y,E)=>{var Q;const A=y.type==="folder"?y.documentId:E;if(!A)return;const B=y.type==="folder"?y.name:((Q=P.find(le=>le.documentId===E))==null?void 0:Q.name)??"图谱";At(A,B)}}),c.jsxs("footer",{className:"mdocs-sidebar-footer",children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,cursor:"pointer"},onClick:()=>Z(()=>et("settings")),children:[c.jsx("span",{className:"mdocs-visitor-avatar",children:b?b.visitorName.charAt(0).toUpperCase():"?"}),c.jsx("span",{className:"mdocs-visitor-footer-name",children:b?b.visitorName:""})]}),c.jsx("button",{type:"button",className:"mdocs-sidebar-bookmark mdocs-tooltip","data-tooltip":e("bookmark"),onClick:()=>{rn(!0),ro(""),oo(""),Pa()},style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",fontSize:"1rem",lineHeight:1,borderRadius:4},children:c.jsx($s,{size:16,strokeWidth:1.5})}),c.jsx("button",{type:"button",className:"mdocs-sidebar-logout mdocs-tooltip","data-tooltip":e("logout"),onClick:()=>Cn(!0),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4},children:c.jsx(Ts,{size:16,strokeWidth:1.5})})]})]}),c.jsxs("main",{className:"mdocs-main",children:[(K==null?void 0:K.kind)==="graph"?c.jsx(Yu,{scope:K.scope,resourceId:K.resourceId,name:K.name,onClose:Ht,onOpenDocument:y=>{Z(()=>ne(`/doc/${y}`))}},`${K.scope}-${K.resourceId}`):M&&ae&&ae.documentId===M.documentId?M.fileType==="html"?c.jsxs("div",{className:"mdocs-editor-with-comments",children:[c.jsx("div",{className:"mdocs-editor-container",children:c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"muted",style:{padding:24},children:"加载编辑器…"}),children:c.jsx(jf,{meta:M,initialContent:ae.content,initialDisplayName:ae.displayName,contentRevision:X,canEdit:!!(b&&(M.ownerVisitorId===b.visitorId||Co(M.permission)||M.invitedEdit===!0)),domains:T,currentDomainId:O,onDomainChange:y=>{Z(()=>{localStorage.setItem("mdocs.currentDomainId",y),R(y),oe(null),re(null),Ee(""),ne("/"),de(y)})},onDomainsChange:$,onContentChange:y=>{re(E=>E&&{...E,content:y})},onDraftExistsChange:Ze,hasLocalDraft:_e,onPublish:so,syncBehind:Qe,onSyncClick:()=>void Zn(),canManageInvites:!!(b&&b.visitorId===M.ownerVisitorId),onDelete:async()=>{Qn(M.documentId,M.relativePath)},onToggleComments:()=>f(!m),commentPanelOpen:m,commentCount:p,onAiWrite:l?void 0:()=>void De(),onShowToast:fe,readerChrome:l,onOpenMobileNav:()=>d(!0)},M.documentId)})}),m&&c.jsx(wi,{documentId:M.documentId,visitorId:b==null?void 0:b.visitorId,visitorName:b==null?void 0:b.visitorName,documentOwnerId:M.ownerVisitorId,onClose:()=>f(!1)})]}):c.jsxs("div",{className:"mdocs-editor-with-comments",children:[c.jsx("div",{className:"mdocs-editor-container",children:c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"muted",style:{padding:24},children:"加载编辑器…"}),children:c.jsx(Af,{meta:M,initialContent:ae.content,initialDisplayName:ae.displayName,contentRevision:X,canEdit:!!(b&&(M.ownerVisitorId===b.visitorId||Co(M.permission)||M.invitedEdit===!0)),domains:T,currentDomainId:O,onDomainChange:y=>{Z(()=>{localStorage.setItem("mdocs.currentDomainId",y),R(y),oe(null),re(null),Ee(""),ne("/"),de(y)})},onDomainsChange:$,onPublish:so,syncBehind:Qe,onSyncClick:()=>void Zn(),onDraftExistsChange:Ze,hasLocalDraft:_e,onConflictModalRequest:()=>gt(!0),onMergeRequest:()=>Xe(!0),canManageInvites:!!(b&&b.visitorId===M.ownerVisitorId),onDelete:async()=>{if(M.relativePath.endsWith("/___desc___.md")){const y=M.relativePath.replace(/\/___desc___\.md$/,"");uo(M.documentId,y)}else Qn(M.documentId,M.relativePath)},saveBeforeNavRef:J,exportMarkdownRef:ee,onShowToast:fe,onShowError:ye,onToggleComments:()=>f(!m),commentPanelOpen:m,commentCount:p,onAiWrite:l?void 0:()=>void De(),readerChrome:l,onOpenMobileNav:()=>d(!0)},M.documentId)})}),m&&c.jsx(wi,{documentId:M.documentId,visitorId:b==null?void 0:b.visitorId,visitorName:b==null?void 0:b.visitorName,documentOwnerId:M.ownerVisitorId,onClose:()=>f(!1)})]}):c.jsxs("div",{className:"mdocs-welcome",children:[l?c.jsxs("button",{type:"button",className:"mdocs-reader-float-pill",onClick:()=>d(!0),"aria-label":e("expandSidebar"),children:[c.jsx(_o,{size:18,strokeWidth:1.75}),c.jsx("span",{children:e("brand")})]}):null,c.jsx("div",{className:"mdocs-welcome-icon",children:c.jsx(hs,{size:64,strokeWidth:1,opacity:.15})}),c.jsx("h1",{children:e("brand")}),c.jsx("p",{className:"mdocs-welcome-lead",children:e("createDocToStart")}),c.jsxs("div",{className:"mdocs-welcome-actions",children:[c.jsxs("button",{type:"button",className:"primary",onClick:()=>In(),style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx(ks,{size:16,strokeWidth:1.5}),e("startWriting")]}),l?null:c.jsxs("button",{type:"button",className:"secondary",onClick:()=>je(),style:{display:"flex",alignItems:"center",gap:6},children:[c.jsx("img",{src:ga,alt:"",width:16,height:16,style:{display:"block"}}),"AI 帮写"]})]}),c.jsxs("div",{className:"mdocs-welcome-domain",children:[c.jsx("label",{className:"muted mdocs-welcome-domain-label",children:e("domainLabel")}),c.jsx(Xu,{domains:T.length?T:[{domainId:"default",domainName:e("defaultDomain"),permission:"",creatorVisitorId:"",docCount:0}],value:O,onChange:y=>{Z(()=>{localStorage.setItem("mdocs.currentDomainId",y),R(y),oe(null),re(null),Ee(""),ne("/"),de(y)})},onDomainsChange:$,ariaLabel:e("domainLabel"),localizeName:y=>cf(y,n,e)})]})]}),c.jsx(mf,{open:St,onClose:()=>gt(!1),onResolve:()=>{gt(!1),Xe(!0)},onForceOverwrite:b&&M&&b.visitorId===M.ownerVisitorId?()=>void ja():void 0,forceBusy:Qt}),Dt&&M&&ze&&c.jsx(x.Suspense,{fallback:c.jsx("div",{className:"merge-view-loading",children:e("mergeLoadingRemote")}),children:c.jsx(Rf,{documentId:M.documentId,displayName:M.displayName,conflict:ze,fileType:M.fileType,onClose:()=>Xe(!1),onSuccess:lo,onError:y=>ye(y)})}),Me&&c.jsx("div",{className:"mdocs-toast",role:"status",children:Me}),Se&&c.jsx(of,{title:e("error"),message:Se,onClose:()=>ye(null)})]}),Ca&&c.jsx("div",{className:"mdocs-dialog-backdrop",onClick:y=>{y.target===y.currentTarget&&Cn(!1)},children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:440},children:[c.jsx("h1",{style:{fontSize:"1.125rem",marginBottom:8},children:"退出当前登录身份?"}),c.jsx("p",{style:{lineHeight:1.6,color:"var(--mdocs-text-secondary, #666)",marginBottom:20},children:"这将会导致您无法修改以前的文章。如果想找回账号,需要恢复码或联系管理员执行合并用户脚本。"}),c.jsxs("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end"},children:[c.jsx("button",{type:"button",onClick:()=>Cn(!1),children:"取消"}),c.jsx("button",{type:"button",className:"primary",style:{background:"#d32f2f"},onClick:()=>{nl(),oe(null),re(null),v(null),S([]),Cn(!1),i("needsRegister")},children:"确认退出"})]})]})}),Da&&c.jsx("div",{className:"mdocs-dialog-backdrop",onClick:y=>{y.target===y.currentTarget&&rn(!1)},children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:640,width:"min(640px, 100%)",maxHeight:"70vh",display:"flex",flexDirection:"column"},children:[c.jsxs("h1",{style:{fontSize:"1.125rem",marginBottom:16},children:[e("bookmarkTitle"),"(",jt.length,")"]}),jt.length>0&&c.jsxs("div",{className:"mdocs-bookmark-filterbar",children:[c.jsx("input",{type:"text",placeholder:e("bookmarkSearch"),value:Jn,onChange:y=>ro(y.target.value)}),c.jsxs("select",{value:Sn,onChange:y=>oo(y.target.value),children:[c.jsx("option",{value:"",children:e("bookmarkFilterAll")}),Ta.map(y=>c.jsx("option",{value:y.id,children:y.name},y.id))]})]}),jt.length===0?c.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkEmpty")}):ao.length===0?c.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:e("bookmarkNoMatch")}):c.jsx("div",{style:{overflowY:"auto",flex:1,margin:"0 -1rem",padding:"0 1rem"},children:c.jsxs("table",{className:"mdocs-bookmark-table",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:e("bookmarkColTitle")}),c.jsx("th",{children:e("bookmarkColDomain")}),c.jsx("th",{children:e("bookmarkColAuthor")}),c.jsx("th",{children:e("bookmarkColTime")}),c.jsx("th",{className:"mdocs-bookmark-col-action"})]})}),c.jsx("tbody",{children:ao.map(y=>{const E=Na.has(y.documentId);return c.jsxs("tr",{className:`${E?"mdocs-bookmark-removing":""}`,style:{opacity:y.isDeleted?.6:1},children:[c.jsx("td",{className:"mdocs-bookmark-col-title",children:c.jsxs("div",{style:{cursor:y.isDeleted?"default":"pointer",display:"flex",alignItems:"center",gap:6,overflow:"hidden"},onClick:()=>{y.isDeleted||Z(()=>{rn(!1),ne(`/doc/${y.documentId}`)})},children:[c.jsx("span",{ref:A=>{if(A){const B=A.scrollWidth>A.clientWidth;A.title=B?y.displayName??"":""}},style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:y.displayName??"(无标题)"}),y.isDeleted&&c.jsx("span",{style:{fontSize:"0.7rem",color:"#d32f2f",background:"#ffebee",padding:"1px 6px",borderRadius:4,flexShrink:0},children:"已删除"})]})}),c.jsx("td",{children:y.isDeleted?"":Xn[y.domainId??""]??y.domainId??""}),c.jsx("td",{children:y.isDeleted?"":y.ownerVisitorName??"-"}),c.jsx("td",{children:y.isDeleted?"":Ff(y.bookmarkedAt,n)}),c.jsx("td",{className:"mdocs-bookmark-col-action",children:c.jsxs("div",{style:{display:"flex",gap:2,alignItems:"center",justifyContent:"flex-end"},children:[c.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkOpen"),onClick:()=>{y.isDeleted||Z(()=>{rn(!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:c.jsx(us,{size:14,strokeWidth:1.5})}),c.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":e("bookmarkRemove"),onClick:async()=>{try{await pl(y.documentId),io(A=>new Set(A).add(y.documentId)),setTimeout(()=>{no(A=>A.filter(B=>B.documentId!==y.documentId)),io(A=>{const B=new Set(A);return B.delete(y.documentId),B})},300)}catch(A){ye(rt(e,A))}},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:A=>{A.currentTarget.style.color="#d32f2f"},onMouseLeave:A=>{A.currentTarget.style.color="var(--mdocs-text-muted, #999)"},children:"✕"})]})})]},y.documentId)})})]})}),c.jsx("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end",marginTop:16,paddingTop:16,borderTop:"1px solid var(--mdocs-border, #eee)"},children:c.jsx("button",{type:"button",onClick:()=>rn(!1),children:e("close")})})]})}),yt&&c.jsx(Ju,{x:yt.x,y:yt.y,node:yt.node,parentPath:yt.parentPath,onClose:()=>st(null),onCreateChild:y=>In(y),onCreateFolder:y=>to(y),onDeleteDocument:y=>Qn(y.documentId,y.path),onDeleteFolder:y=>uo(y.documentId,y.folderDisplayName||y.name)}),be&&c.jsx(ya,{title:be.type==="folder"?"删除文件夹":"删除文档",message:be.type==="folder"?`确定要删除「${be.name}」及其下的所有文档和子文件夹吗?此操作不可撤销。`:`确定要删除「${be.name}」吗?`,confirmLabel:"删除",cancelLabel:"取消",onConfirm:Ra,onCancel:()=>Pt(null),danger:!0}),Vt&&c.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&!Gt&&Kn(null)},children:c.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[c.jsx("h1",{children:Vt.kind==="document"?e("newDocumentTitle"):e("newFolderTitle")}),c.jsx("p",{className:"muted",children:Vt.kind==="document"?e("fileNameHint"):e("folderNameHint")}),c.jsxs("form",{onSubmit:Ia,className:"mdocs-dialog-form",children:[c.jsxs("label",{className:"mdocs-dialog-label",children:[Vt.kind==="document"?e("fileNameLabel"):e("folderNameLabel"),c.jsx("input",{ref:ka,value:Vt.draft,onChange:y=>Kn(E=>E&&{...E,draft:y.target.value}),placeholder:Vt.kind==="document"?e("untitledPlaceholder"):e("folderExamplePlaceholder"),maxLength:200,disabled:Gt})]}),eo&&c.jsx("div",{className:"mdocs-dialog-error",children:eo}),c.jsxs("div",{className:"mdocs-dialog-actions",children:[c.jsx("button",{type:"button",onClick:()=>!Gt&&Kn(null),disabled:Gt,children:e("cancel")}),c.jsx("button",{type:"submit",className:"primary",disabled:Gt,children:e(Gt?"creating":"create")})]})]})]})})]})}),I&&b&&c.jsx(Cl,{visitorId:I,onDismiss:()=>D(null)}),N&&c.jsx("div",{className:"mdocs-dialog-backdrop",style:{position:"fixed",zIndex:9999},onClick:y=>{y.target===y.currentTarget&&_(null)},children:c.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:480,textAlign:"center"},children:[c.jsx("h1",{style:{fontSize:"1.25rem",marginBottom:8},children:"🔑 保存你的恢复码"}),c.jsxs("p",{className:"muted",style:{marginBottom:16,lineHeight:1.5},children:["恢复码是你的唯一凭证,当 Token 丢失时可用它找回身份。",c.jsx("br",{}),c.jsx("strong",{children:"请立即复制保存,此弹窗关闭后不可再查看。"})]}),c.jsx("div",{style:{background:"#f5f5f5",borderRadius:8,padding:"12px 16px",fontFamily:"monospace",fontSize:"1.25rem",letterSpacing:"0.1em",marginBottom:20,userSelect:"all"},children:N}),c.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:[c.jsx("button",{type:"button",className:"primary",onClick:()=>{navigator.clipboard.writeText(N)},children:"复制恢复码"}),c.jsx("button",{type:"button",onClick:()=>_(null),children:"已保存,关闭"})]})]})}),c.jsxs(c.Fragment,{children:[c.jsx(nf,{open:Fe,onToggle:()=>{var y;Fe?(y=k.current)==null||y.requestClose():He(!0)},position:Bt,onPositionChange:kn,disableDrag:l}),Fe?c.jsx(x.Suspense,{fallback:null,children:c.jsx(Ef,{ref:k,open:Fe,onClose:()=>{He(!1),vt(!1)},visitorName:b==null?void 0:b.visitorName,fullscreen:l||_n,onToggleFullscreen:l?void 0:()=>vt(y=>!y),domainId:O||null,documentId:(M==null?void 0:M.documentId)??null,documentTitle:(M==null?void 0:M.displayName)??null,documentPath:(M==null?void 0:M.relativePath)??null,graphFileId:(K==null?void 0:K.kind)==="graph"?`${K.resourceId}.graph-file`:null,graphLabel:(K==null?void 0:K.kind)==="graph"?K.name:null,anchorStyle:l||_n?void 0:tf(Bt),onOpenDocument:y=>{et("docs"),Z(()=>ne(`/doc/${y}`)),He(!1),vt(!1)},onTreeChanged:()=>void de(),onDocumentOverwritten:y=>void ke(y),onOpenCoding:l?void 0:y=>void Ne(y)})}):null]}),F?c.jsx(x.Suspense,{fallback:null,children:c.jsx(Of,{open:j,initialMarkdown:F.markdown,documentId:F.documentId,displayName:F.displayName,onClose:()=>{L(!1),G(null)},onComplete:Pe})}):null,c.jsx(lf,{open:Sa,domainId:O||null,onClose:()=>Yn(!1),onOpenDocument:y=>{l&&d(!1),et("docs"),Z(()=>ne(`/doc/${y}`))}})]})}const Lf=x.lazy(()=>zt(()=>import("./PlaygroundPage-M7fqYn4Z.js"),__vite__mapDeps([21,1,4,5,2,3,6,7,8,9,10])).then(e=>({default:e.PlaygroundPage})));function zf(){return c.jsxs(Ba,{children:[c.jsx(tr,{path:"/",element:c.jsx(ki,{})}),c.jsx(tr,{path:"/doc/:documentId",element:c.jsx(ki,{})}),c.jsx(tr,{path:"/playground",element:c.jsx(x.Suspense,{fallback:c.jsx("div",{style:{padding:24},children:"Loading playground…"}),children:c.jsx(Lf,{})})})]})}function $f(){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\/([^/?#]+)/),d=(u==null?void 0:u[1])??l[1];if(!d)return;const h=i.endsWith("/")?i:`${i}/`;window.location.replace(`${o}${h}${r}#/doc/${d}`)}$f();const _a=document.getElementById("root");if(!_a)throw new Error("root element missing");Ha.createRoot(_a).render(c.jsx(Ii.StrictMode,{children:c.jsx(Ga,{motion:os,children:c.jsx(Wa,{children:c.jsx(qs,{children:c.jsx(Va,{children:c.jsx(zf,{})})})})})}));export{dm as $,xf as A,vr as B,hs as C,tt as D,vs as E,_l as F,vn as G,Yf as H,al as I,Vm as J,am as K,im as L,js as M,zr as N,om as O,_o as P,rm as Q,ko as R,$s as S,cm as T,Jf as U,Zf as V,Xf as W,Qf as X,Et as Y,lm as Z,sm as _,Oe as a,um as a0,fm as a1,km as a2,Mo as a3,ya as a4,Im as a5,Eo as a6,Cm as a7,Sm as a8,Dm as a9,Fm as aA,Rm as aB,Um as aC,$m as aD,Kt as aE,mm as aF,ir as aG,or as aH,Dn as aI,bo as aJ,Nm as aa,Pm as ab,ff as ac,bm as ad,hl as ae,_m as af,Tf as ag,wo as ah,Ti as ai,Si as aj,tm as ak,em as al,vm as am,gi as an,Tm as ao,jm as ap,Hu as aq,xo as ar,Am as as,Mm as at,Em as au,Om as av,Hm as aw,zm as ax,Bm as ay,Lm as az,Wm as b,Ye as c,yr as d,xm as e,nm as f,rr as g,Wf as h,wm as i,hm as j,gm as k,cf as l,pm as m,ym as n,ge as o,Xu as p,ga as q,pl as r,Gm as s,Ai as t,gf as u,sl as v,Sl as w,Cr as x,rt as y,yf as z};