@fgbg/mdocs 0.8.8 → 0.8.9

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 (58) hide show
  1. package/dist/web/assets/{MergeView-BBr64bam.js → MergeView-CTeS5Pgb.js} +1 -1
  2. package/dist/web/assets/{_baseUniq-DPiuTO9O.js → _baseUniq-BEyyLo4a.js} +1 -1
  3. package/dist/web/assets/{arc-BjFiPdRI.js → arc-DRyJIB49.js} +1 -1
  4. package/dist/web/assets/{architectureDiagram-Q4EWVU46-Bg5q-eAF.js → architectureDiagram-Q4EWVU46-C6FcFqys.js} +1 -1
  5. package/dist/web/assets/{blockDiagram-DXYQGD6D-BD2W9g1m.js → blockDiagram-DXYQGD6D-C5DamiPe.js} +1 -1
  6. package/dist/web/assets/{c4Diagram-AHTNJAMY-EutGBUph.js → c4Diagram-AHTNJAMY-BQf9874A.js} +1 -1
  7. package/dist/web/assets/channel-CiCXcXC3.js +1 -0
  8. package/dist/web/assets/{chunk-4BX2VUAB-DjI4WDbc.js → chunk-4BX2VUAB-CvLXGWM9.js} +1 -1
  9. package/dist/web/assets/{chunk-4TB4RGXK-STKj2CZp.js → chunk-4TB4RGXK-C2B5cSFk.js} +1 -1
  10. package/dist/web/assets/{chunk-55IACEB6-DjjX4E45.js → chunk-55IACEB6-C-va7Y5a.js} +1 -1
  11. package/dist/web/assets/{chunk-EDXVE4YY-BV5S3HvN.js → chunk-EDXVE4YY-NG3zjl2t.js} +1 -1
  12. package/dist/web/assets/{chunk-FMBD7UC4-BqEWdzLG.js → chunk-FMBD7UC4-A2P0ciLw.js} +1 -1
  13. package/dist/web/assets/{chunk-OYMX7WX6-CaY5tJMJ.js → chunk-OYMX7WX6-Cto0U3kG.js} +1 -1
  14. package/dist/web/assets/{chunk-QZHKN3VN-Dpnf7BSM.js → chunk-QZHKN3VN-DNdWRP-4.js} +1 -1
  15. package/dist/web/assets/{chunk-YZCP3GAM-CkhOhodd.js → chunk-YZCP3GAM-B7BWetQd.js} +1 -1
  16. package/dist/web/assets/classDiagram-6PBFFD2Q-DLatDrXa.js +1 -0
  17. package/dist/web/assets/classDiagram-v2-HSJHXN6E-DLatDrXa.js +1 -0
  18. package/dist/web/assets/clone-CSlMEjIx.js +1 -0
  19. package/dist/web/assets/{cose-bilkent-S5V4N54A-TnRvn8wH.js → cose-bilkent-S5V4N54A-DAp6XOTI.js} +1 -1
  20. package/dist/web/assets/{dagre-KV5264BT-sJWGoaLD.js → dagre-KV5264BT-bXw64vAF.js} +1 -1
  21. package/dist/web/assets/{diagram-5BDNPKRD-D-m_kU_W.js → diagram-5BDNPKRD-BZyIxgPb.js} +1 -1
  22. package/dist/web/assets/{diagram-G4DWMVQ6-Czc0GOtJ.js → diagram-G4DWMVQ6-B7DIbmE6.js} +1 -1
  23. package/dist/web/assets/{diagram-MMDJMWI5-IOAJuFuD.js → diagram-MMDJMWI5-CYIS8pup.js} +1 -1
  24. package/dist/web/assets/{diagram-TYMM5635-B6J_V3un.js → diagram-TYMM5635-iVE2rLmi.js} +1 -1
  25. package/dist/web/assets/{erDiagram-SMLLAGMA-Dzv2Z19V.js → erDiagram-SMLLAGMA-TYkyJdZq.js} +1 -1
  26. package/dist/web/assets/{flowDiagram-DWJPFMVM-BEVdVQjJ.js → flowDiagram-DWJPFMVM-DCq4RRIH.js} +1 -1
  27. package/dist/web/assets/{ganttDiagram-T4ZO3ILL-CqDRowWZ.js → ganttDiagram-T4ZO3ILL-BwOIx_Vs.js} +1 -1
  28. package/dist/web/assets/{gitGraphDiagram-UUTBAWPF-id1A35b6.js → gitGraphDiagram-UUTBAWPF-CS9cfxUA.js} +1 -1
  29. package/dist/web/assets/{graph-D1ZUACO1.js → graph-K8x8ab-D.js} +1 -1
  30. package/dist/web/assets/{index-CG_5hNy2.js → index-DRsX6c0H.js} +85 -70
  31. package/dist/web/assets/{infoDiagram-42DDH7IO-VCo7Y_XY.js → infoDiagram-42DDH7IO-DFs9J8cW.js} +1 -1
  32. package/dist/web/assets/{ishikawaDiagram-UXIWVN3A-2zkFwtGK.js → ishikawaDiagram-UXIWVN3A-ChYUj0ld.js} +1 -1
  33. package/dist/web/assets/{journeyDiagram-VCZTEJTY-9xfjIDzZ.js → journeyDiagram-VCZTEJTY-CysvVjkr.js} +1 -1
  34. package/dist/web/assets/{kanban-definition-6JOO6SKY-CtlIC6o7.js → kanban-definition-6JOO6SKY-DlGvCOou.js} +1 -1
  35. package/dist/web/assets/{layout-BwiWnDDL.js → layout-DDk1jHzS.js} +1 -1
  36. package/dist/web/assets/{linear-BCmqTrEt.js → linear-CCo9IeHT.js} +1 -1
  37. package/dist/web/assets/{min-HUIhyFEJ.js → min-BTxfBtS6.js} +1 -1
  38. package/dist/web/assets/{mindmap-definition-QFDTVHPH-CxMrCCZd.js → mindmap-definition-QFDTVHPH-D2Y8ZrN3.js} +1 -1
  39. package/dist/web/assets/{pieDiagram-DEJITSTG-DfotdBjp.js → pieDiagram-DEJITSTG-DuaVu740.js} +1 -1
  40. package/dist/web/assets/{quadrantDiagram-34T5L4WZ-BQP7wk7X.js → quadrantDiagram-34T5L4WZ-D9P6tcbK.js} +1 -1
  41. package/dist/web/assets/{requirementDiagram-MS252O5E-B_TtEKSs.js → requirementDiagram-MS252O5E-B8v3RtvO.js} +1 -1
  42. package/dist/web/assets/{sankeyDiagram-XADWPNL6-DaSKJ2JV.js → sankeyDiagram-XADWPNL6-CJIIvTEv.js} +1 -1
  43. package/dist/web/assets/{sequenceDiagram-FGHM5R23-BjmdElN-.js → sequenceDiagram-FGHM5R23-WgQSy-Eh.js} +1 -1
  44. package/dist/web/assets/{stateDiagram-FHFEXIEX-BNaY_Ekl.js → stateDiagram-FHFEXIEX-Bg9XaNxo.js} +1 -1
  45. package/dist/web/assets/stateDiagram-v2-QKLJ7IA2-BZf_Cq1t.js +1 -0
  46. package/dist/web/assets/{timeline-definition-GMOUNBTQ-BsVGIy02.js → timeline-definition-GMOUNBTQ-2h7ZeLc6.js} +1 -1
  47. package/dist/web/assets/{vennDiagram-DHZGUBPP-DvxeoAnH.js → vennDiagram-DHZGUBPP-Ab3_6Oe9.js} +1 -1
  48. package/dist/web/assets/wardley-RL74JXVD-DVPCK5Ky.js +162 -0
  49. package/dist/web/assets/{wardleyDiagram-NUSXRM2D-IHiVP54x.js → wardleyDiagram-NUSXRM2D-rM9jo8v5.js} +1 -1
  50. package/dist/web/assets/{xychartDiagram-5P7HB3ND-juQThxJ3.js → xychartDiagram-5P7HB3ND-BnxoasRp.js} +1 -1
  51. package/dist/web/index.html +1 -1
  52. package/package.json +2 -2
  53. package/dist/web/assets/channel-DXrjDOYn.js +0 -1
  54. package/dist/web/assets/classDiagram-6PBFFD2Q-9bBkEPwQ.js +0 -1
  55. package/dist/web/assets/classDiagram-v2-HSJHXN6E-9bBkEPwQ.js +0 -1
  56. package/dist/web/assets/clone-CeG9DhNI.js +0 -1
  57. package/dist/web/assets/stateDiagram-v2-QKLJ7IA2-spf8Ruqx.js +0 -1
  58. package/dist/web/assets/wardley-RL74JXVD-Cefj9jwz.js +0 -162
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-pp8916En.js","assets/javascript-XPxc2APE.js","assets/css-CLj8gQPS.js","assets/scss-D5BDwBP9.js","assets/vue-DMJtu8ND.js","assets/typescript-DttGkNCf.js","assets/json-CjLXzM_z.js","assets/svelte-DR4MIrkg.js","assets/xml-DtyAt_xK.js","assets/java-B2AjWfgk.js","assets/cpp-Bp17OOWP.js","assets/c-CyUOlKFr.js","assets/sql-CKXjX23X.js","assets/ruby-CM5gBc7p.js","assets/graphql-By4-2MiP.js","assets/jsx-BGEKFWBk.js","assets/tsx-Dio8iE-N.js","assets/shellscript-CE-5zpiL.js","assets/lua-JmSlR1pZ.js","assets/yaml-B92AUxDB.js","assets/php-R6g_5hLQ.js","assets/shellsession-BhddCRKA.js","assets/nginx-bBKbG2uI.js","assets/html-GMplVEZG.js","assets/javascript-wDzz0qaB.js","assets/css-DPfMkruS.js","assets/scss-OYdSNvt2.js","assets/vue-DVfSmUF7.js","assets/typescript-BPQ3VLAy.js","assets/json-Cp-IABpG.js","assets/svelte-DZMnMd3x.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/cpp-BRuaLJcg.js","assets/c-BIGW1oBm.js","assets/sql-BLtJtn59.js","assets/ruby-BGX7qA9Y.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/tsx-COt5Ahok.js","assets/shellscript-Yzrsuije.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/php-Dhbhpdrm.js","assets/shellsession-BADoaaVG.js","assets/nginx-BpAMiNFr.js","assets/dagre-KV5264BT-sJWGoaLD.js","assets/graph-D1ZUACO1.js","assets/_baseUniq-DPiuTO9O.js","assets/layout-BwiWnDDL.js","assets/min-HUIhyFEJ.js","assets/clone-CeG9DhNI.js","assets/cose-bilkent-S5V4N54A-TnRvn8wH.js","assets/cytoscape.esm-BiciSPf8.js","assets/c4Diagram-AHTNJAMY-EutGBUph.js","assets/chunk-YZCP3GAM-CkhOhodd.js","assets/flowDiagram-DWJPFMVM-BEVdVQjJ.js","assets/chunk-FMBD7UC4-BqEWdzLG.js","assets/chunk-55IACEB6-DjjX4E45.js","assets/chunk-EDXVE4YY-BV5S3HvN.js","assets/channel-DXrjDOYn.js","assets/erDiagram-SMLLAGMA-Dzv2Z19V.js","assets/gitGraphDiagram-UUTBAWPF-id1A35b6.js","assets/chunk-4BX2VUAB-DjI4WDbc.js","assets/chunk-QZHKN3VN-Dpnf7BSM.js","assets/wardley-RL74JXVD-Cefj9jwz.js","assets/ganttDiagram-T4ZO3ILL-CqDRowWZ.js","assets/linear-BCmqTrEt.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-42DDH7IO-VCo7Y_XY.js","assets/pieDiagram-DEJITSTG-DfotdBjp.js","assets/arc-BjFiPdRI.js","assets/quadrantDiagram-34T5L4WZ-BQP7wk7X.js","assets/xychartDiagram-5P7HB3ND-juQThxJ3.js","assets/requirementDiagram-MS252O5E-B_TtEKSs.js","assets/sequenceDiagram-FGHM5R23-BjmdElN-.js","assets/classDiagram-6PBFFD2Q-9bBkEPwQ.js","assets/chunk-4TB4RGXK-STKj2CZp.js","assets/classDiagram-v2-HSJHXN6E-9bBkEPwQ.js","assets/stateDiagram-FHFEXIEX-BNaY_Ekl.js","assets/chunk-OYMX7WX6-CaY5tJMJ.js","assets/stateDiagram-v2-QKLJ7IA2-spf8Ruqx.js","assets/journeyDiagram-VCZTEJTY-9xfjIDzZ.js","assets/timeline-definition-GMOUNBTQ-BsVGIy02.js","assets/mindmap-definition-QFDTVHPH-CxMrCCZd.js","assets/kanban-definition-6JOO6SKY-CtlIC6o7.js","assets/diagram-TYMM5635-B6J_V3un.js","assets/diagram-MMDJMWI5-IOAJuFuD.js","assets/blockDiagram-DXYQGD6D-BD2W9g1m.js","assets/diagram-5BDNPKRD-D-m_kU_W.js","assets/architectureDiagram-Q4EWVU46-Bg5q-eAF.js","assets/diagram-G4DWMVQ6-Czc0GOtJ.js","assets/wardleyDiagram-NUSXRM2D-IHiVP54x.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-pp8916En.js","assets/javascript-XPxc2APE.js","assets/css-CLj8gQPS.js","assets/scss-D5BDwBP9.js","assets/vue-DMJtu8ND.js","assets/typescript-DttGkNCf.js","assets/json-CjLXzM_z.js","assets/svelte-DR4MIrkg.js","assets/xml-DtyAt_xK.js","assets/java-B2AjWfgk.js","assets/cpp-Bp17OOWP.js","assets/c-CyUOlKFr.js","assets/sql-CKXjX23X.js","assets/ruby-CM5gBc7p.js","assets/graphql-By4-2MiP.js","assets/jsx-BGEKFWBk.js","assets/tsx-Dio8iE-N.js","assets/shellscript-CE-5zpiL.js","assets/lua-JmSlR1pZ.js","assets/yaml-B92AUxDB.js","assets/php-R6g_5hLQ.js","assets/shellsession-BhddCRKA.js","assets/nginx-bBKbG2uI.js","assets/html-GMplVEZG.js","assets/javascript-wDzz0qaB.js","assets/css-DPfMkruS.js","assets/scss-OYdSNvt2.js","assets/vue-DVfSmUF7.js","assets/typescript-BPQ3VLAy.js","assets/json-Cp-IABpG.js","assets/svelte-DZMnMd3x.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/cpp-BRuaLJcg.js","assets/c-BIGW1oBm.js","assets/sql-BLtJtn59.js","assets/ruby-BGX7qA9Y.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/tsx-COt5Ahok.js","assets/shellscript-Yzrsuije.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/php-Dhbhpdrm.js","assets/shellsession-BADoaaVG.js","assets/nginx-BpAMiNFr.js","assets/dagre-KV5264BT-bXw64vAF.js","assets/graph-K8x8ab-D.js","assets/_baseUniq-BEyyLo4a.js","assets/layout-DDk1jHzS.js","assets/min-BTxfBtS6.js","assets/clone-CSlMEjIx.js","assets/cose-bilkent-S5V4N54A-DAp6XOTI.js","assets/cytoscape.esm-BiciSPf8.js","assets/c4Diagram-AHTNJAMY-BQf9874A.js","assets/chunk-YZCP3GAM-B7BWetQd.js","assets/flowDiagram-DWJPFMVM-DCq4RRIH.js","assets/chunk-FMBD7UC4-A2P0ciLw.js","assets/chunk-55IACEB6-C-va7Y5a.js","assets/chunk-EDXVE4YY-NG3zjl2t.js","assets/channel-CiCXcXC3.js","assets/erDiagram-SMLLAGMA-TYkyJdZq.js","assets/gitGraphDiagram-UUTBAWPF-CS9cfxUA.js","assets/chunk-4BX2VUAB-CvLXGWM9.js","assets/chunk-QZHKN3VN-DNdWRP-4.js","assets/wardley-RL74JXVD-DVPCK5Ky.js","assets/ganttDiagram-T4ZO3ILL-BwOIx_Vs.js","assets/linear-CCo9IeHT.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-42DDH7IO-DFs9J8cW.js","assets/pieDiagram-DEJITSTG-DuaVu740.js","assets/arc-DRyJIB49.js","assets/quadrantDiagram-34T5L4WZ-D9P6tcbK.js","assets/xychartDiagram-5P7HB3ND-BnxoasRp.js","assets/requirementDiagram-MS252O5E-B8v3RtvO.js","assets/sequenceDiagram-FGHM5R23-WgQSy-Eh.js","assets/classDiagram-6PBFFD2Q-DLatDrXa.js","assets/chunk-4TB4RGXK-C2B5cSFk.js","assets/classDiagram-v2-HSJHXN6E-DLatDrXa.js","assets/stateDiagram-FHFEXIEX-Bg9XaNxo.js","assets/chunk-OYMX7WX6-Cto0U3kG.js","assets/stateDiagram-v2-QKLJ7IA2-BZf_Cq1t.js","assets/journeyDiagram-VCZTEJTY-CysvVjkr.js","assets/timeline-definition-GMOUNBTQ-2h7ZeLc6.js","assets/mindmap-definition-QFDTVHPH-D2Y8ZrN3.js","assets/kanban-definition-6JOO6SKY-DlGvCOou.js","assets/diagram-TYMM5635-iVE2rLmi.js","assets/diagram-MMDJMWI5-CYIS8pup.js","assets/blockDiagram-DXYQGD6D-C5DamiPe.js","assets/diagram-5BDNPKRD-BZyIxgPb.js","assets/architectureDiagram-Q4EWVU46-C6FcFqys.js","assets/diagram-G4DWMVQ6-B7DIbmE6.js","assets/wardleyDiagram-NUSXRM2D-rM9jo8v5.js"])))=>i.map(i=>d[i]);
2
2
  var j0=Object.defineProperty;var z0=Object.getPrototypeOf;var H0=Reflect.get;var pm=Un=>{throw TypeError(Un)};var q0=(Un,Pn,ei)=>Pn in Un?j0(Un,Pn,{enumerable:!0,configurable:!0,writable:!0,value:ei}):Un[Pn]=ei;var Ba=(Un,Pn,ei)=>q0(Un,typeof Pn!="symbol"?Pn+"":Pn,ei),qf=(Un,Pn,ei)=>Pn.has(Un)||pm("Cannot "+ei);var ed=(Un,Pn,ei)=>(qf(Un,Pn,"read from private field"),ei?ei.call(Un):Pn.get(Un)),zd=(Un,Pn,ei)=>Pn.has(Un)?pm("Cannot add the same private member more than once"):Pn instanceof WeakSet?Pn.add(Un):Pn.set(Un,ei),yd=(Un,Pn,ei,co)=>(qf(Un,Pn,"write to private field"),co?co.call(Un,ei):Pn.set(Un,ei),ei),Vf=(Un,Pn,ei)=>(qf(Un,Pn,"access private method"),ei);var mm=(Un,Pn,ei)=>H0(z0(Un),ei,Pn);function _mergeNamespaces(Un,Pn){for(var ei=0;ei<Pn.length;ei++){const co=Pn[ei];if(typeof co!="string"&&!Array.isArray(co)){for(const xo in co)if(xo!=="default"&&!(xo in Un)){const os=Object.getOwnPropertyDescriptor(co,xo);os&&Object.defineProperty(Un,xo,os.get?os:{enumerable:!0,get:()=>co[xo]})}}}return Object.freeze(Object.defineProperty(Un,Symbol.toStringTag,{value:"Module"}))}(function(){const Pn=document.createElement("link").relList;if(Pn&&Pn.supports&&Pn.supports("modulepreload"))return;for(const xo of document.querySelectorAll('link[rel="modulepreload"]'))co(xo);new MutationObserver(xo=>{for(const os of xo)if(os.type==="childList")for(const hs of os.addedNodes)hs.tagName==="LINK"&&hs.rel==="modulepreload"&&co(hs)}).observe(document,{childList:!0,subtree:!0});function ei(xo){const os={};return xo.integrity&&(os.integrity=xo.integrity),xo.referrerPolicy&&(os.referrerPolicy=xo.referrerPolicy),xo.crossOrigin==="use-credentials"?os.credentials="include":xo.crossOrigin==="anonymous"?os.credentials="omit":os.credentials="same-origin",os}function co(xo){if(xo.ep)return;xo.ep=!0;const os=ei(xo);fetch(xo.href,os)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$1(Un){return Un&&Un.__esModule&&Object.prototype.hasOwnProperty.call(Un,"default")?Un.default:Un}function getAugmentedNamespace(Un){if(Un.__esModule)return Un;var Pn=Un.default;if(typeof Pn=="function"){var ei=function co(){return this instanceof co?Reflect.construct(Pn,arguments,this.constructor):Pn.apply(this,arguments)};ei.prototype=Pn.prototype}else ei={};return Object.defineProperty(ei,"__esModule",{value:!0}),Object.keys(Un).forEach(function(co){var xo=Object.getOwnPropertyDescriptor(Un,co);Object.defineProperty(ei,co,xo.get?xo:{enumerable:!0,get:function(){return Un[co]}})}),ei}var jsxRuntime={exports:{}},reactJsxRuntime_production={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -864,162 +864,162 @@ ${hs}
864
864
  *
865
865
  * This source code is licensed under the ISC license.
866
866
  * See the LICENSE file in the root directory of this source tree.
867
- */const __iconNode$1p=[["path",{d:"M9 19a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-6a1 1 0 0 1 1-1h3.293a.707.707 0 0 0 .5-1.207l-7.086-7.086a1 1 0 0 0-1.414 0l-7.086 7.086a.707.707 0 0 0 .5 1.207H8a1 1 0 0 1 1 1z",key:"106j91"}]],ArrowBigUp=createLucideIcon$1("arrow-big-up",__iconNode$1p);/**
867
+ */const __iconNode$1s=[["path",{d:"M9 19a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-6a1 1 0 0 1 1-1h3.293a.707.707 0 0 0 .5-1.207l-7.086-7.086a1 1 0 0 0-1.414 0l-7.086 7.086a.707.707 0 0 0 .5 1.207H8a1 1 0 0 1 1 1z",key:"106j91"}]],ArrowBigUp=createLucideIcon$1("arrow-big-up",__iconNode$1s);/**
868
868
  * @license lucide-react v1.14.0 - ISC
869
869
  *
870
870
  * This source code is licensed under the ISC license.
871
871
  * See the LICENSE file in the root directory of this source tree.
872
- */const __iconNode$1o=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ArrowDown=createLucideIcon$1("arrow-down",__iconNode$1o);/**
872
+ */const __iconNode$1r=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ArrowDown=createLucideIcon$1("arrow-down",__iconNode$1r);/**
873
873
  * @license lucide-react v1.14.0 - ISC
874
874
  *
875
875
  * This source code is licensed under the ISC license.
876
876
  * See the LICENSE file in the root directory of this source tree.
877
- */const __iconNode$1n=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ArrowLeft=createLucideIcon$1("arrow-left",__iconNode$1n);/**
877
+ */const __iconNode$1q=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ArrowLeft=createLucideIcon$1("arrow-left",__iconNode$1q);/**
878
878
  * @license lucide-react v1.14.0 - ISC
879
879
  *
880
880
  * This source code is licensed under the ISC license.
881
881
  * See the LICENSE file in the root directory of this source tree.
882
- */const __iconNode$1m=[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]],ArrowRightToLine=createLucideIcon$1("arrow-right-to-line",__iconNode$1m);/**
882
+ */const __iconNode$1p=[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]],ArrowRightToLine=createLucideIcon$1("arrow-right-to-line",__iconNode$1p);/**
883
883
  * @license lucide-react v1.14.0 - ISC
884
884
  *
885
885
  * This source code is licensed under the ISC license.
886
886
  * See the LICENSE file in the root directory of this source tree.
887
- */const __iconNode$1l=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ArrowRight=createLucideIcon$1("arrow-right",__iconNode$1l);/**
887
+ */const __iconNode$1o=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ArrowRight=createLucideIcon$1("arrow-right",__iconNode$1o);/**
888
888
  * @license lucide-react v1.14.0 - ISC
889
889
  *
890
890
  * This source code is licensed under the ISC license.
891
891
  * See the LICENSE file in the root directory of this source tree.
892
- */const __iconNode$1k=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ArrowUp=createLucideIcon$1("arrow-up",__iconNode$1k);/**
892
+ */const __iconNode$1n=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ArrowUp=createLucideIcon$1("arrow-up",__iconNode$1n);/**
893
893
  * @license lucide-react v1.14.0 - ISC
894
894
  *
895
895
  * This source code is licensed under the ISC license.
896
896
  * See the LICENSE file in the root directory of this source tree.
897
- */const __iconNode$1j=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Check$1=createLucideIcon$1("check",__iconNode$1j);/**
897
+ */const __iconNode$1m=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Check$1=createLucideIcon$1("check",__iconNode$1m);/**
898
898
  * @license lucide-react v1.14.0 - ISC
899
899
  *
900
900
  * This source code is licensed under the ISC license.
901
901
  * See the LICENSE file in the root directory of this source tree.
902
- */const __iconNode$1i=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ChevronDown$1=createLucideIcon$1("chevron-down",__iconNode$1i);/**
902
+ */const __iconNode$1l=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ChevronDown$1=createLucideIcon$1("chevron-down",__iconNode$1l);/**
903
903
  * @license lucide-react v1.14.0 - ISC
904
904
  *
905
905
  * This source code is licensed under the ISC license.
906
906
  * See the LICENSE file in the root directory of this source tree.
907
- */const __iconNode$1h=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ChevronRight$1=createLucideIcon$1("chevron-right",__iconNode$1h);/**
907
+ */const __iconNode$1k=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ChevronRight$1=createLucideIcon$1("chevron-right",__iconNode$1k);/**
908
908
  * @license lucide-react v1.14.0 - ISC
909
909
  *
910
910
  * This source code is licensed under the ISC license.
911
911
  * See the LICENSE file in the root directory of this source tree.
912
- */const __iconNode$1g=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ChevronUp=createLucideIcon$1("chevron-up",__iconNode$1g);/**
912
+ */const __iconNode$1j=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ChevronUp=createLucideIcon$1("chevron-up",__iconNode$1j);/**
913
913
  * @license lucide-react v1.14.0 - ISC
914
914
  *
915
915
  * This source code is licensed under the ISC license.
916
916
  * See the LICENSE file in the root directory of this source tree.
917
- */const __iconNode$1f=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],CircleCheckBig=createLucideIcon$1("circle-check-big",__iconNode$1f);/**
917
+ */const __iconNode$1i=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],CircleCheckBig=createLucideIcon$1("circle-check-big",__iconNode$1i);/**
918
918
  * @license lucide-react v1.14.0 - ISC
919
919
  *
920
920
  * This source code is licensed under the ISC license.
921
921
  * See the LICENSE file in the root directory of this source tree.
922
- */const __iconNode$1e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],CircleX=createLucideIcon$1("circle-x",__iconNode$1e);/**
922
+ */const __iconNode$1h=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],CircleX=createLucideIcon$1("circle-x",__iconNode$1h);/**
923
923
  * @license lucide-react v1.14.0 - ISC
924
924
  *
925
925
  * This source code is licensed under the ISC license.
926
926
  * See the LICENSE file in the root directory of this source tree.
927
- */const __iconNode$1d=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Command=createLucideIcon$1("command",__iconNode$1d);/**
927
+ */const __iconNode$1g=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Command=createLucideIcon$1("command",__iconNode$1g);/**
928
928
  * @license lucide-react v1.14.0 - ISC
929
929
  *
930
930
  * This source code is licensed under the ISC license.
931
931
  * See the LICENSE file in the root directory of this source tree.
932
- */const __iconNode$1c=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Copy$1=createLucideIcon$1("copy",__iconNode$1c);/**
932
+ */const __iconNode$1f=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Copy$1=createLucideIcon$1("copy",__iconNode$1f);/**
933
933
  * @license lucide-react v1.14.0 - ISC
934
934
  *
935
935
  * This source code is licensed under the ISC license.
936
936
  * See the LICENSE file in the root directory of this source tree.
937
- */const __iconNode$1b=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],CornerDownLeft=createLucideIcon$1("corner-down-left",__iconNode$1b);/**
937
+ */const __iconNode$1e=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],CornerDownLeft=createLucideIcon$1("corner-down-left",__iconNode$1e);/**
938
938
  * @license lucide-react v1.14.0 - ISC
939
939
  *
940
940
  * This source code is licensed under the ISC license.
941
941
  * See the LICENSE file in the root directory of this source tree.
942
- */const __iconNode$1a=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],Delete=createLucideIcon$1("delete",__iconNode$1a);/**
942
+ */const __iconNode$1d=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],Delete=createLucideIcon$1("delete",__iconNode$1d);/**
943
943
  * @license lucide-react v1.14.0 - ISC
944
944
  *
945
945
  * This source code is licensed under the ISC license.
946
946
  * See the LICENSE file in the root directory of this source tree.
947
- */const __iconNode$19=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Download=createLucideIcon$1("download",__iconNode$19);/**
947
+ */const __iconNode$1c=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Download=createLucideIcon$1("download",__iconNode$1c);/**
948
948
  * @license lucide-react v1.14.0 - ISC
949
949
  *
950
950
  * This source code is licensed under the ISC license.
951
951
  * See the LICENSE file in the root directory of this source tree.
952
- */const __iconNode$18=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ellipsis$1=createLucideIcon$1("ellipsis",__iconNode$18);/**
952
+ */const __iconNode$1b=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ellipsis$1=createLucideIcon$1("ellipsis",__iconNode$1b);/**
953
953
  * @license lucide-react v1.14.0 - ISC
954
954
  *
955
955
  * This source code is licensed under the ISC license.
956
956
  * See the LICENSE file in the root directory of this source tree.
957
- */const __iconNode$17=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],Grid2x2=createLucideIcon$1("grid-2x2",__iconNode$17);/**
957
+ */const __iconNode$1a=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],Grid2x2=createLucideIcon$1("grid-2x2",__iconNode$1a);/**
958
958
  * @license lucide-react v1.14.0 - ISC
959
959
  *
960
960
  * This source code is licensed under the ISC license.
961
961
  * See the LICENSE file in the root directory of this source tree.
962
- */const __iconNode$16=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Info$1=createLucideIcon$1("info",__iconNode$16);/**
962
+ */const __iconNode$19=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Info$1=createLucideIcon$1("info",__iconNode$19);/**
963
963
  * @license lucide-react v1.14.0 - ISC
964
964
  *
965
965
  * This source code is licensed under the ISC license.
966
966
  * See the LICENSE file in the root directory of this source tree.
967
- */const __iconNode$15=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],LoaderCircle$1=createLucideIcon$1("loader-circle",__iconNode$15);/**
967
+ */const __iconNode$18=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],LoaderCircle$1=createLucideIcon$1("loader-circle",__iconNode$18);/**
968
968
  * @license lucide-react v1.14.0 - ISC
969
969
  *
970
970
  * This source code is licensed under the ISC license.
971
971
  * See the LICENSE file in the root directory of this source tree.
972
- */const __iconNode$14=[["rect",{x:"5",y:"2",width:"14",height:"20",rx:"7",key:"11ol66"}],["path",{d:"M12 6v4",key:"16clxf"}]],Mouse=createLucideIcon$1("mouse",__iconNode$14);/**
972
+ */const __iconNode$17=[["rect",{x:"5",y:"2",width:"14",height:"20",rx:"7",key:"11ol66"}],["path",{d:"M12 6v4",key:"16clxf"}]],Mouse=createLucideIcon$1("mouse",__iconNode$17);/**
973
973
  * @license lucide-react v1.14.0 - ISC
974
974
  *
975
975
  * This source code is licensed under the ISC license.
976
976
  * See the LICENSE file in the root directory of this source tree.
977
- */const __iconNode$13=[["path",{d:"M3 3h6l6 18h6",key:"ph9rgk"}],["path",{d:"M14 3h7",key:"16f0ms"}]],Option=createLucideIcon$1("option",__iconNode$13);/**
977
+ */const __iconNode$16=[["path",{d:"M3 3h6l6 18h6",key:"ph9rgk"}],["path",{d:"M14 3h7",key:"16f0ms"}]],Option=createLucideIcon$1("option",__iconNode$16);/**
978
978
  * @license lucide-react v1.14.0 - ISC
979
979
  *
980
980
  * This source code is licensed under the ISC license.
981
981
  * See the LICENSE file in the root directory of this source tree.
982
- */const __iconNode$12=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],RotateCcw=createLucideIcon$1("rotate-ccw",__iconNode$12);/**
982
+ */const __iconNode$15=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],RotateCcw=createLucideIcon$1("rotate-ccw",__iconNode$15);/**
983
983
  * @license lucide-react v1.14.0 - ISC
984
984
  *
985
985
  * This source code is licensed under the ISC license.
986
986
  * See the LICENSE file in the root directory of this source tree.
987
- */const __iconNode$11=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],RotateCw=createLucideIcon$1("rotate-cw",__iconNode$11);/**
987
+ */const __iconNode$14=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],RotateCw=createLucideIcon$1("rotate-cw",__iconNode$14);/**
988
988
  * @license lucide-react v1.14.0 - ISC
989
989
  *
990
990
  * This source code is licensed under the ISC license.
991
991
  * See the LICENSE file in the root directory of this source tree.
992
- */const __iconNode$10=[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]],Space=createLucideIcon$1("space",__iconNode$10);/**
992
+ */const __iconNode$13=[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]],Space=createLucideIcon$1("space",__iconNode$13);/**
993
993
  * @license lucide-react v1.14.0 - ISC
994
994
  *
995
995
  * This source code is licensed under the ISC license.
996
996
  * See the LICENSE file in the root directory of this source tree.
997
- */const __iconNode$$=[["path",{d:"M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3",key:"14bfxa"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]],SquareCenterlineDashedVertical=createLucideIcon$1("square-centerline-dashed-vertical",__iconNode$$);/**
997
+ */const __iconNode$12=[["path",{d:"M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3",key:"14bfxa"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]],SquareCenterlineDashedVertical=createLucideIcon$1("square-centerline-dashed-vertical",__iconNode$12);/**
998
998
  * @license lucide-react v1.14.0 - ISC
999
999
  *
1000
1000
  * This source code is licensed under the ISC license.
1001
1001
  * See the LICENSE file in the root directory of this source tree.
1002
- */const __iconNode$_=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3",key:"1i73f7"}],["path",{d:"M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3",key:"saxlbk"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]],SquareCenterlineDashedHorizontal=createLucideIcon$1("square-centerline-dashed-horizontal",__iconNode$_);/**
1002
+ */const __iconNode$11=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3",key:"1i73f7"}],["path",{d:"M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3",key:"saxlbk"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]],SquareCenterlineDashedHorizontal=createLucideIcon$1("square-centerline-dashed-horizontal",__iconNode$11);/**
1003
1003
  * @license lucide-react v1.14.0 - ISC
1004
1004
  *
1005
1005
  * This source code is licensed under the ISC license.
1006
1006
  * See the LICENSE file in the root directory of this source tree.
1007
- */const __iconNode$Z=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],TriangleAlert=createLucideIcon$1("triangle-alert",__iconNode$Z);/**
1007
+ */const __iconNode$10=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],TriangleAlert=createLucideIcon$1("triangle-alert",__iconNode$10);/**
1008
1008
  * @license lucide-react v1.14.0 - ISC
1009
1009
  *
1010
1010
  * This source code is licensed under the ISC license.
1011
1011
  * See the LICENSE file in the root directory of this source tree.
1012
- */const __iconNode$Y=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],X$8=createLucideIcon$1("x",__iconNode$Y);/**
1012
+ */const __iconNode$$=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],X$8=createLucideIcon$1("x",__iconNode$$);/**
1013
1013
  * @license lucide-react v1.14.0 - ISC
1014
1014
  *
1015
1015
  * This source code is licensed under the ISC license.
1016
1016
  * See the LICENSE file in the root directory of this source tree.
1017
- */const __iconNode$X=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ZoomIn=createLucideIcon$1("zoom-in",__iconNode$X);/**
1017
+ */const __iconNode$_=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ZoomIn=createLucideIcon$1("zoom-in",__iconNode$_);/**
1018
1018
  * @license lucide-react v1.14.0 - ISC
1019
1019
  *
1020
1020
  * This source code is licensed under the ISC license.
1021
1021
  * See the LICENSE file in the root directory of this source tree.
1022
- */const __iconNode$W=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ZoomOut=createLucideIcon$1("zoom-out",__iconNode$W),LeftClickIcon=createLucideIcon$1("LeftClick",[["path",{d:"M2 9.333C2 6.36 3.491 3.71 5.814 2M19 10C19 9.08075 18.8189 8.1705 18.4672 7.32122C18.1154 6.47194 17.5998 5.70026 16.9497 5.05025C16.2997 4.40024 15.5281 3.88463 14.6788 3.53284C13.8295 3.18106 12.9193 3 12 3C11.0807 3 10.1705 3.18106 9.32122 3.53284C8.47194 3.88463 7.70026 4.40024 7.05025 5.05025C6.40024 5.70026 5.88463 6.47194 5.53284 7.32122C5.18106 8.1705 5 9.08075 5 10V14C5 14.9193 5.18106 15.8295 5.53284 16.6788C5.88463 17.5281 6.40024 18.2997 7.05025 18.9497C7.70026 19.5998 8.47194 20.1154 9.32122 20.4672C10.1705 20.8189 11.0807 21 12 21C12.9193 21 13.8295 20.8189 14.6788 20.4672C15.5281 20.1154 16.2997 19.5998 16.9497 18.9497C17.5998 18.2997 18.1154 17.5281 18.4672 16.6788C18.8189 15.8295 19 14.9193 19 14V10Z",key:"1"}],["path",{d:"M12 4V11H6",key:"2"}]]);LeftClickIcon.displayName="LeftClickIcon";const LeftDoubleClickIcon=createLucideIcon$1("LeftDoubleClick",[["path",{d:"M19 10V14C19 14.9193 18.8189 15.8295 18.4672 16.6788C18.1154 17.5281 17.5998 18.2997 16.9497 18.9497C16.2997 19.5998 15.5281 20.1154 14.6788 20.4672C13.8295 20.8189 12.9193 21 12 21C11.0807 21 10.1705 20.8189 9.32122 20.4672C8.47194 20.1154 7.70026 19.5998 7.05025 18.9497C6.40024 18.2997 5.88463 17.5281 5.53284 16.6788C5.18106 15.8295 5 14.9193 5 14V11M5 11V10C5 8.14348 5.7375 6.36301 7.05025 5.05025C8.36301 3.7375 10.1435 3 12 3V11H5ZM2 9.333C2 6.36 3.491 3.71 5.814 2M20.5 2H21.75C22.44 2 23 2.56 23 3.25C23 3.94 22.44 4.5 21.75 4.5C21.06 4.5 20.5 5.06 20.5 5.75V7H23M15 4L18 7M18 4L15 7",key:"1"}]]);LeftDoubleClickIcon.displayName="LeftDoubleClickIcon";const RightClickIcon=createLucideIcon$1("RightClick",[["path",{d:"M22 9.333C22 6.36 20.509 3.71 18.186 2M19 10C19 9.08075 18.8189 8.1705 18.4672 7.32122C18.1154 6.47194 17.5998 5.70026 16.9497 5.05025C16.2997 4.40024 15.5281 3.88463 14.6788 3.53284C13.8295 3.18106 12.9193 3 12 3C11.0807 3 10.1705 3.18106 9.32122 3.53284C8.47194 3.88463 7.70026 4.40024 7.05025 5.05025C6.40024 5.70026 5.88463 6.47194 5.53284 7.32122C5.18106 8.1705 5 9.08075 5 10V14C5 14.9193 5.18106 15.8295 5.53284 16.6788C5.88463 17.5281 6.40024 18.2997 7.05025 18.9497C7.70026 19.5998 8.47194 20.1154 9.32122 20.4672C10.1705 20.8189 11.0807 21 12 21C12.9193 21 13.8295 20.8189 14.6788 20.4672C15.5281 20.1154 16.2997 19.5998 16.9497 18.9497C17.5998 18.2997 18.1154 17.5281 18.4672 16.6788C18.8189 15.8295 19 14.9193 19 14V10Z",key:"1"}],["path",{d:"M12 4V11H18",key:"2"}]]);RightClickIcon.displayName="RightClickIcon";const RightDoubleClickIcon=createLucideIcon$1("RightDoubleClick",[["path",{d:"M12 3C13.8565 3 15.637 3.7375 16.9497 5.05025C18.2625 6.36301 19 8.14348 19 10V14C19 14.9193 18.8189 15.8295 18.4672 16.6788C18.1154 17.5281 17.5998 18.2997 16.9497 18.9497C16.2997 19.5998 15.5281 20.1154 14.6788 20.4672C13.8295 20.8189 12.9193 21 12 21C11.0807 21 10.1705 20.8189 9.32122 20.4672C8.47194 20.1154 7.70026 19.5998 7.05025 18.9497C6.40024 18.2997 5.88463 17.5281 5.53284 16.6788C5.18106 15.8295 5 14.9193 5 14V10",key:"1"}],["path",{d:"M12 3V11H18.5M22 9.333C22 6.36 20.509 3.71 18.186 2M6.5 2H7.75C8.44 2 9 2.56 9 3.25C9 3.94 8.44 4.5 7.75 4.5C7.06 4.5 6.5 5.06 6.5 5.75V7H9M1 4L4 7M4 4L1 7",key:"2"}]]);RightDoubleClickIcon.displayName="RightDoubleClickIcon";const styles$C=createStaticStyles(({css:Un,cssVar:Pn})=>({borderless:Un`
1022
+ */const __iconNode$Z=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],ZoomOut=createLucideIcon$1("zoom-out",__iconNode$Z),LeftClickIcon=createLucideIcon$1("LeftClick",[["path",{d:"M2 9.333C2 6.36 3.491 3.71 5.814 2M19 10C19 9.08075 18.8189 8.1705 18.4672 7.32122C18.1154 6.47194 17.5998 5.70026 16.9497 5.05025C16.2997 4.40024 15.5281 3.88463 14.6788 3.53284C13.8295 3.18106 12.9193 3 12 3C11.0807 3 10.1705 3.18106 9.32122 3.53284C8.47194 3.88463 7.70026 4.40024 7.05025 5.05025C6.40024 5.70026 5.88463 6.47194 5.53284 7.32122C5.18106 8.1705 5 9.08075 5 10V14C5 14.9193 5.18106 15.8295 5.53284 16.6788C5.88463 17.5281 6.40024 18.2997 7.05025 18.9497C7.70026 19.5998 8.47194 20.1154 9.32122 20.4672C10.1705 20.8189 11.0807 21 12 21C12.9193 21 13.8295 20.8189 14.6788 20.4672C15.5281 20.1154 16.2997 19.5998 16.9497 18.9497C17.5998 18.2997 18.1154 17.5281 18.4672 16.6788C18.8189 15.8295 19 14.9193 19 14V10Z",key:"1"}],["path",{d:"M12 4V11H6",key:"2"}]]);LeftClickIcon.displayName="LeftClickIcon";const LeftDoubleClickIcon=createLucideIcon$1("LeftDoubleClick",[["path",{d:"M19 10V14C19 14.9193 18.8189 15.8295 18.4672 16.6788C18.1154 17.5281 17.5998 18.2997 16.9497 18.9497C16.2997 19.5998 15.5281 20.1154 14.6788 20.4672C13.8295 20.8189 12.9193 21 12 21C11.0807 21 10.1705 20.8189 9.32122 20.4672C8.47194 20.1154 7.70026 19.5998 7.05025 18.9497C6.40024 18.2997 5.88463 17.5281 5.53284 16.6788C5.18106 15.8295 5 14.9193 5 14V11M5 11V10C5 8.14348 5.7375 6.36301 7.05025 5.05025C8.36301 3.7375 10.1435 3 12 3V11H5ZM2 9.333C2 6.36 3.491 3.71 5.814 2M20.5 2H21.75C22.44 2 23 2.56 23 3.25C23 3.94 22.44 4.5 21.75 4.5C21.06 4.5 20.5 5.06 20.5 5.75V7H23M15 4L18 7M18 4L15 7",key:"1"}]]);LeftDoubleClickIcon.displayName="LeftDoubleClickIcon";const RightClickIcon=createLucideIcon$1("RightClick",[["path",{d:"M22 9.333C22 6.36 20.509 3.71 18.186 2M19 10C19 9.08075 18.8189 8.1705 18.4672 7.32122C18.1154 6.47194 17.5998 5.70026 16.9497 5.05025C16.2997 4.40024 15.5281 3.88463 14.6788 3.53284C13.8295 3.18106 12.9193 3 12 3C11.0807 3 10.1705 3.18106 9.32122 3.53284C8.47194 3.88463 7.70026 4.40024 7.05025 5.05025C6.40024 5.70026 5.88463 6.47194 5.53284 7.32122C5.18106 8.1705 5 9.08075 5 10V14C5 14.9193 5.18106 15.8295 5.53284 16.6788C5.88463 17.5281 6.40024 18.2997 7.05025 18.9497C7.70026 19.5998 8.47194 20.1154 9.32122 20.4672C10.1705 20.8189 11.0807 21 12 21C12.9193 21 13.8295 20.8189 14.6788 20.4672C15.5281 20.1154 16.2997 19.5998 16.9497 18.9497C17.5998 18.2997 18.1154 17.5281 18.4672 16.6788C18.8189 15.8295 19 14.9193 19 14V10Z",key:"1"}],["path",{d:"M12 4V11H18",key:"2"}]]);RightClickIcon.displayName="RightClickIcon";const RightDoubleClickIcon=createLucideIcon$1("RightDoubleClick",[["path",{d:"M12 3C13.8565 3 15.637 3.7375 16.9497 5.05025C18.2625 6.36301 19 8.14348 19 10V14C19 14.9193 18.8189 15.8295 18.4672 16.6788C18.1154 17.5281 17.5998 18.2997 16.9497 18.9497C16.2997 19.5998 15.5281 20.1154 14.6788 20.4672C13.8295 20.8189 12.9193 21 12 21C11.0807 21 10.1705 20.8189 9.32122 20.4672C8.47194 20.1154 7.70026 19.5998 7.05025 18.9497C6.40024 18.2997 5.88463 17.5281 5.53284 16.6788C5.18106 15.8295 5 14.9193 5 14V10",key:"1"}],["path",{d:"M12 3V11H18.5M22 9.333C22 6.36 20.509 3.71 18.186 2M6.5 2H7.75C8.44 2 9 2.56 9 3.25C9 3.94 8.44 4.5 7.75 4.5C7.06 4.5 6.5 5.06 6.5 5.75V7H9M1 4L4 7M4 4L1 7",key:"2"}]]);RightDoubleClickIcon.displayName="RightDoubleClickIcon";const styles$C=createStaticStyles(({css:Un,cssVar:Pn})=>({borderless:Un`
1023
1023
  ${staticStylish.variantBorderlessWithoutHover};
1024
1024
  padding-inline: 4px;
1025
1025
  `,filled:staticStylish.variantFilledWithoutHover,inverseThemeDark:Un`
@@ -3367,167 +3367,182 @@ l0,-`+(ei+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
3367
3367
  *
3368
3368
  * This source code is licensed under the ISC license.
3369
3369
  * See the LICENSE file in the root directory of this source tree.
3370
- */const __iconNode$V=[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Baseline=createLucideIcon("baseline",__iconNode$V);/**
3370
+ */const __iconNode$Y=[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]],ArrowDownToLine=createLucideIcon("arrow-down-to-line",__iconNode$Y);/**
3371
3371
  * @license lucide-react v0.562.0 - ISC
3372
3372
  *
3373
3373
  * This source code is licensed under the ISC license.
3374
3374
  * See the LICENSE file in the root directory of this source tree.
3375
- */const __iconNode$U=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Bold=createLucideIcon("bold",__iconNode$U);/**
3375
+ */const __iconNode$X=[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]],ArrowUpToLine=createLucideIcon("arrow-up-to-line",__iconNode$X);/**
3376
3376
  * @license lucide-react v0.562.0 - ISC
3377
3377
  *
3378
3378
  * This source code is licensed under the ISC license.
3379
3379
  * See the LICENSE file in the root directory of this source tree.
3380
- */const __iconNode$T=[["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"}]],BookOpen=createLucideIcon("book-open",__iconNode$T);/**
3380
+ */const __iconNode$W=[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Baseline=createLucideIcon("baseline",__iconNode$W);/**
3381
3381
  * @license lucide-react v0.562.0 - ISC
3382
3382
  *
3383
3383
  * This source code is licensed under the ISC license.
3384
3384
  * See the LICENSE file in the root directory of this source tree.
3385
- */const __iconNode$S=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Check=createLucideIcon("check",__iconNode$S);/**
3385
+ */const __iconNode$V=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],Bold=createLucideIcon("bold",__iconNode$V);/**
3386
3386
  * @license lucide-react v0.562.0 - ISC
3387
3387
  *
3388
3388
  * This source code is licensed under the ISC license.
3389
3389
  * See the LICENSE file in the root directory of this source tree.
3390
- */const __iconNode$R=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ChevronDown=createLucideIcon("chevron-down",__iconNode$R);/**
3390
+ */const __iconNode$U=[["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"}]],BookOpen=createLucideIcon("book-open",__iconNode$U);/**
3391
3391
  * @license lucide-react v0.562.0 - ISC
3392
3392
  *
3393
3393
  * This source code is licensed under the ISC license.
3394
3394
  * See the LICENSE file in the root directory of this source tree.
3395
- */const __iconNode$Q=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ChevronRight=createLucideIcon("chevron-right",__iconNode$Q);/**
3395
+ */const __iconNode$T=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Check=createLucideIcon("check",__iconNode$T);/**
3396
3396
  * @license lucide-react v0.562.0 - ISC
3397
3397
  *
3398
3398
  * This source code is licensed under the ISC license.
3399
3399
  * See the LICENSE file in the root directory of this source tree.
3400
- */const __iconNode$P=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]],CircleChevronLeft=createLucideIcon("circle-chevron-left",__iconNode$P);/**
3400
+ */const __iconNode$S=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ChevronDown=createLucideIcon("chevron-down",__iconNode$S);/**
3401
3401
  * @license lucide-react v0.562.0 - ISC
3402
3402
  *
3403
3403
  * This source code is licensed under the ISC license.
3404
3404
  * See the LICENSE file in the root directory of this source tree.
3405
- */const __iconNode$O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]],CircleChevronRight=createLucideIcon("circle-chevron-right",__iconNode$O);/**
3405
+ */const __iconNode$R=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ChevronRight=createLucideIcon("chevron-right",__iconNode$R);/**
3406
3406
  * @license lucide-react v0.562.0 - ISC
3407
3407
  *
3408
3408
  * This source code is licensed under the ISC license.
3409
3409
  * See the LICENSE file in the root directory of this source tree.
3410
- */const __iconNode$N=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]],CircleChevronUp=createLucideIcon("circle-chevron-up",__iconNode$N);/**
3410
+ */const __iconNode$Q=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]],CircleChevronLeft=createLucideIcon("circle-chevron-left",__iconNode$Q);/**
3411
3411
  * @license lucide-react v0.562.0 - ISC
3412
3412
  *
3413
3413
  * This source code is licensed under the ISC license.
3414
3414
  * See the LICENSE file in the root directory of this source tree.
3415
- */const __iconNode$M=[["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"}]],CodeXml=createLucideIcon("code-xml",__iconNode$M);/**
3415
+ */const __iconNode$P=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]],CircleChevronRight=createLucideIcon("circle-chevron-right",__iconNode$P);/**
3416
3416
  * @license lucide-react v0.562.0 - ISC
3417
3417
  *
3418
3418
  * This source code is licensed under the ISC license.
3419
3419
  * See the LICENSE file in the root directory of this source tree.
3420
- */const __iconNode$L=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Copy=createLucideIcon("copy",__iconNode$L);/**
3420
+ */const __iconNode$O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]],CircleChevronUp=createLucideIcon("circle-chevron-up",__iconNode$O);/**
3421
3421
  * @license lucide-react v0.562.0 - ISC
3422
3422
  *
3423
3423
  * This source code is licensed under the ISC license.
3424
3424
  * See the LICENSE file in the root directory of this source tree.
3425
- */const __iconNode$K=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ellipsis=createLucideIcon("ellipsis",__iconNode$K);/**
3425
+ */const __iconNode$N=[["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"}]],CodeXml=createLucideIcon("code-xml",__iconNode$N);/**
3426
3426
  * @license lucide-react v0.562.0 - ISC
3427
3427
  *
3428
3428
  * This source code is licensed under the ISC license.
3429
3429
  * See the LICENSE file in the root directory of this source tree.
3430
- */const __iconNode$J=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ExternalLink=createLucideIcon("external-link",__iconNode$J);/**
3430
+ */const __iconNode$M=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Copy=createLucideIcon("copy",__iconNode$M);/**
3431
3431
  * @license lucide-react v0.562.0 - ISC
3432
3432
  *
3433
3433
  * This source code is licensed under the ISC license.
3434
3434
  * See the LICENSE file in the root directory of this source tree.
3435
- */const __iconNode$I=[["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:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],FileUp=createLucideIcon("file-up",__iconNode$I);/**
3435
+ */const __iconNode$L=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ellipsis=createLucideIcon("ellipsis",__iconNode$L);/**
3436
3436
  * @license lucide-react v0.562.0 - ISC
3437
3437
  *
3438
3438
  * This source code is licensed under the ISC license.
3439
3439
  * See the LICENSE file in the root directory of this source tree.
3440
- */const __iconNode$H=[["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"}]],File$1=createLucideIcon("file",__iconNode$H);/**
3440
+ */const __iconNode$K=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ExternalLink=createLucideIcon("external-link",__iconNode$K);/**
3441
3441
  * @license lucide-react v0.562.0 - ISC
3442
3442
  *
3443
3443
  * This source code is licensed under the ISC license.
3444
3444
  * See the LICENSE file in the root directory of this source tree.
3445
- */const __iconNode$G=[["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"}]],Folder=createLucideIcon("folder",__iconNode$G);/**
3445
+ */const __iconNode$J=[["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:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],FileUp=createLucideIcon("file-up",__iconNode$J);/**
3446
3446
  * @license lucide-react v0.562.0 - ISC
3447
3447
  *
3448
3448
  * This source code is licensed under the ISC license.
3449
3449
  * See the LICENSE file in the root directory of this source tree.
3450
- */const __iconNode$F=[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 16 5 5",key:"8tpb07"}],["path",{d:"m16 21 5-5",key:"193jll"}]],Grid2x2X=createLucideIcon("grid-2x2-x",__iconNode$F);/**
3450
+ */const __iconNode$I=[["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"}]],File$1=createLucideIcon("file",__iconNode$I);/**
3451
3451
  * @license lucide-react v0.562.0 - ISC
3452
3452
  *
3453
3453
  * This source code is licensed under the ISC license.
3454
3454
  * See the LICENSE file in the root directory of this source tree.
3455
- */const __iconNode$E=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],Heading1=createLucideIcon("heading-1",__iconNode$E);/**
3455
+ */const __iconNode$H=[["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"}]],Folder=createLucideIcon("folder",__iconNode$H);/**
3456
3456
  * @license lucide-react v0.562.0 - ISC
3457
3457
  *
3458
3458
  * This source code is licensed under the ISC license.
3459
3459
  * See the LICENSE file in the root directory of this source tree.
3460
- */const __iconNode$D=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Heading2=createLucideIcon("heading-2",__iconNode$D);/**
3460
+ */const __iconNode$G=[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 16 5 5",key:"8tpb07"}],["path",{d:"m16 21 5-5",key:"193jll"}]],Grid2x2X=createLucideIcon("grid-2x2-x",__iconNode$G);/**
3461
3461
  * @license lucide-react v0.562.0 - ISC
3462
3462
  *
3463
3463
  * This source code is licensed under the ISC license.
3464
3464
  * See the LICENSE file in the root directory of this source tree.
3465
- */const __iconNode$C=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Heading3=createLucideIcon("heading-3",__iconNode$C);/**
3465
+ */const __iconNode$F=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],Heading1=createLucideIcon("heading-1",__iconNode$F);/**
3466
3466
  * @license lucide-react v0.562.0 - ISC
3467
3467
  *
3468
3468
  * This source code is licensed under the ISC license.
3469
3469
  * See the LICENSE file in the root directory of this source tree.
3470
- */const __iconNode$B=[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]],Highlighter=createLucideIcon("highlighter",__iconNode$B);/**
3470
+ */const __iconNode$E=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Heading2=createLucideIcon("heading-2",__iconNode$E);/**
3471
3471
  * @license lucide-react v0.562.0 - ISC
3472
3472
  *
3473
3473
  * This source code is licensed under the ISC license.
3474
3474
  * See the LICENSE file in the root directory of this source tree.
3475
- */const __iconNode$A=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Image$1=createLucideIcon("image",__iconNode$A);/**
3475
+ */const __iconNode$D=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Heading3=createLucideIcon("heading-3",__iconNode$D);/**
3476
3476
  * @license lucide-react v0.562.0 - ISC
3477
3477
  *
3478
3478
  * This source code is licensed under the ISC license.
3479
3479
  * See the LICENSE file in the root directory of this source tree.
3480
- */const __iconNode$z=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],Italic=createLucideIcon("italic",__iconNode$z);/**
3480
+ */const __iconNode$C=[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]],Highlighter=createLucideIcon("highlighter",__iconNode$C);/**
3481
3481
  * @license lucide-react v0.562.0 - ISC
3482
3482
  *
3483
3483
  * This source code is licensed under the ISC license.
3484
3484
  * See the LICENSE file in the root directory of this source tree.
3485
- */const __iconNode$y=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Link=createLucideIcon("link",__iconNode$y);/**
3485
+ */const __iconNode$B=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Image$1=createLucideIcon("image",__iconNode$B);/**
3486
3486
  * @license lucide-react v0.562.0 - ISC
3487
3487
  *
3488
3488
  * This source code is licensed under the ISC license.
3489
3489
  * See the LICENSE file in the root directory of this source tree.
3490
- */const __iconNode$x=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],ListOrdered=createLucideIcon("list-ordered",__iconNode$x);/**
3490
+ */const __iconNode$A=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],Italic=createLucideIcon("italic",__iconNode$A);/**
3491
3491
  * @license lucide-react v0.562.0 - ISC
3492
3492
  *
3493
3493
  * This source code is licensed under the ISC license.
3494
3494
  * See the LICENSE file in the root directory of this source tree.
3495
- */const __iconNode$w=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],ListTodo=createLucideIcon("list-todo",__iconNode$w);/**
3495
+ */const __iconNode$z=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Link=createLucideIcon("link",__iconNode$z);/**
3496
3496
  * @license lucide-react v0.562.0 - ISC
3497
3497
  *
3498
3498
  * This source code is licensed under the ISC license.
3499
3499
  * See the LICENSE file in the root directory of this source tree.
3500
- */const __iconNode$v=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],ListTree=createLucideIcon("list-tree",__iconNode$v);/**
3500
+ */const __iconNode$y=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],ListOrdered=createLucideIcon("list-ordered",__iconNode$y);/**
3501
3501
  * @license lucide-react v0.562.0 - ISC
3502
3502
  *
3503
3503
  * This source code is licensed under the ISC license.
3504
3504
  * See the LICENSE file in the root directory of this source tree.
3505
- */const __iconNode$u=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],List=createLucideIcon("list",__iconNode$u);/**
3505
+ */const __iconNode$x=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],ListTodo=createLucideIcon("list-todo",__iconNode$x);/**
3506
3506
  * @license lucide-react v0.562.0 - ISC
3507
3507
  *
3508
3508
  * This source code is licensed under the ISC license.
3509
3509
  * See the LICENSE file in the root directory of this source tree.
3510
- */const __iconNode$t=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],LoaderCircle=createLucideIcon("loader-circle",__iconNode$t);/**
3510
+ */const __iconNode$w=[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]],ListTree=createLucideIcon("list-tree",__iconNode$w);/**
3511
3511
  * @license lucide-react v0.562.0 - ISC
3512
3512
  *
3513
3513
  * This source code is licensed under the ISC license.
3514
3514
  * See the LICENSE file in the root directory of this source tree.
3515
- */const __iconNode$s=[["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"}]],LogOut=createLucideIcon("log-out",__iconNode$s);/**
3515
+ */const __iconNode$v=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],List=createLucideIcon("list",__iconNode$v);/**
3516
3516
  * @license lucide-react v0.562.0 - ISC
3517
3517
  *
3518
3518
  * This source code is licensed under the ISC license.
3519
3519
  * See the LICENSE file in the root directory of this source tree.
3520
- */const __iconNode$r=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["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"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],MessageSquareQuote=createLucideIcon("message-square-quote",__iconNode$r);/**
3520
+ */const __iconNode$u=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],LoaderCircle=createLucideIcon("loader-circle",__iconNode$u);/**
3521
3521
  * @license lucide-react v0.562.0 - ISC
3522
3522
  *
3523
3523
  * This source code is licensed under the ISC license.
3524
3524
  * See the LICENSE file in the root directory of this source tree.
3525
- */const __iconNode$q=[["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"}]],MessageSquare=createLucideIcon("message-square",__iconNode$q);/**
3525
+ */const __iconNode$t=[["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"}]],LogOut=createLucideIcon("log-out",__iconNode$t);/**
3526
3526
  * @license lucide-react v0.562.0 - ISC
3527
3527
  *
3528
3528
  * This source code is licensed under the ISC license.
3529
3529
  * See the LICENSE file in the root directory of this source tree.
3530
- */const __iconNode$p=[["path",{d:"M5 12h14",key:"1ays0h"}]],Minus=createLucideIcon("minus",__iconNode$p);/**
3530
+ */const __iconNode$s=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["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"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],MessageSquareQuote=createLucideIcon("message-square-quote",__iconNode$s);/**
3531
+ * @license lucide-react v0.562.0 - ISC
3532
+ *
3533
+ * This source code is licensed under the ISC license.
3534
+ * See the LICENSE file in the root directory of this source tree.
3535
+ */const __iconNode$r=[["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"}]],MessageSquare=createLucideIcon("message-square",__iconNode$r);/**
3536
+ * @license lucide-react v0.562.0 - ISC
3537
+ *
3538
+ * This source code is licensed under the ISC license.
3539
+ * See the LICENSE file in the root directory of this source tree.
3540
+ */const __iconNode$q=[["path",{d:"M5 12h14",key:"1ays0h"}]],Minus=createLucideIcon("minus",__iconNode$q);/**
3541
+ * @license lucide-react v0.562.0 - ISC
3542
+ *
3543
+ * This source code is licensed under the ISC license.
3544
+ * See the LICENSE file in the root directory of this source tree.
3545
+ */const __iconNode$p=[["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"}]],Network=createLucideIcon("network",__iconNode$p);/**
3531
3546
  * @license lucide-react v0.562.0 - ISC
3532
3547
  *
3533
3548
  * This source code is licensed under the ISC license.
@@ -4459,8 +4474,8 @@ Please report this to https://github.com/markedjs/marked.`,Pn){let xo="<p>An err
4459
4474
  L0,20`)},"requirement_arrow"),requirement_arrow_neo=__name((Un,Pn,ei)=>{const co=getConfig(),{themeVariables:xo}=co,{strokeWidth:os}=xo;Un.append("defs").append("marker").attr("id",ei+"_"+Pn+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${os}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
4460
4475
  L20,10
4461
4476
  M20,10
4462
- L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),requirement_contains=__name((Un,Pn,ei)=>{const co=Un.append("defs").append("marker").attr("id",ei+"_"+Pn+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");co.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),co.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),co.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),requirement_contains_neo=__name((Un,Pn,ei)=>{const co=getConfig(),{themeVariables:xo}=co,{strokeWidth:os}=xo,hs=Un.append("defs").append("marker").attr("id",ei+"_"+Pn+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");hs.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),hs.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),hs.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),hs.selectAll("*").attr("stroke-width",`${os}`)},"requirement_contains_neo"),markers={extension,composition,aggregation,dependency,lollipop,point,circle:circle$1,cross,barb,barbNeo,only_one,zero_or_one,one_or_more,zero_or_more,only_one_neo,zero_or_one_neo,one_or_more_neo,zero_or_more_neo,requirement_arrow,requirement_contains,requirement_arrow_neo,requirement_contains_neo},markers_default=insertMarkers,internalHelpers={common:common_default,getConfig,insertCluster,insertEdge,insertEdgeLabel,insertMarkers:markers_default,insertNode,interpolateToCurve,labelHelper,log,positionEdgeLabel},layoutAlgorithms={},registerLayoutLoaders=__name(Un=>{for(const Pn of Un)layoutAlgorithms[Pn.name]=Pn},"registerLayoutLoaders"),registerDefaultLayoutLoaders=__name(()=>{registerLayoutLoaders([{name:"dagre",loader:__name(async()=>await __vitePreload(()=>import("./dagre-KV5264BT-sJWGoaLD.js"),__vite__mapDeps([46,47,48,49,50,51])),"loader")},{name:"cose-bilkent",loader:__name(async()=>await __vitePreload(()=>import("./cose-bilkent-S5V4N54A-TnRvn8wH.js"),__vite__mapDeps([52,53])),"loader")}])},"registerDefaultLayoutLoaders");registerDefaultLayoutLoaders();var render$3=__name(async(Un,Pn)=>{if(!(Un.layoutAlgorithm in layoutAlgorithms))throw new Error(`Unknown layout algorithm: ${Un.layoutAlgorithm}`);if(Un.diagramId)for(const ra of Un.nodes){const na=ra.domId||ra.id;ra.domId=`${Un.diagramId}-${na}`}const ei=layoutAlgorithms[Un.layoutAlgorithm],co=await ei.loader(),{theme:xo,themeVariables:os}=Un.config,{useGradient:hs,gradientStart:Ms,gradientStop:ea}=os,ta=Pn.attr("id");if(Pn.append("defs").append("filter").attr("id",`${ta}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${xo!=null&&xo.includes("dark")?"#FFFFFF":"#000000"}`),Pn.append("defs").append("filter").attr("id",`${ta}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${xo!=null&&xo.includes("dark")?"#FFFFFF":"#000000"}`),hs){const ra=Pn.append("linearGradient").attr("id",Pn.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");ra.append("svg:stop").attr("offset","0%").attr("stop-color",Ms).attr("stop-opacity",1),ra.append("svg:stop").attr("offset","100%").attr("stop-color",ea).attr("stop-opacity",1)}return co.render(Un,Pn,internalHelpers,{algorithm:ei.algorithm})},"render"),getRegisteredLayoutAlgorithm=__name((Un="",{fallback:Pn="dagre"}={})=>{if(Un in layoutAlgorithms)return Un;if(Pn in layoutAlgorithms)return log.warn(`Layout algorithm ${Un} is not registered. Using ${Pn} as fallback.`),Pn;throw new Error(`Both layout algorithms ${Un} and ${Pn} are not registered.`)},"getRegisteredLayoutAlgorithm"),nativeKeys=overArg(Object.keys,Object),objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function baseKeys(Un){if(!isPrototype(Un))return nativeKeys(Un);var Pn=[];for(var ei in Object(Un))hasOwnProperty$1.call(Un,ei)&&ei!="constructor"&&Pn.push(ei);return Pn}var DataView$1=getNative(root$2,"DataView"),Promise$1=getNative(root$2,"Promise"),Set$1=getNative(root$2,"Set"),WeakMap$1=getNative(root$2,"WeakMap"),mapTag$1="[object Map]",objectTag="[object Object]",promiseTag="[object Promise]",setTag$1="[object Set]",weakMapTag="[object WeakMap]",dataViewTag="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag=baseGetTag;(DataView$1&&getTag(new DataView$1(new ArrayBuffer(1)))!=dataViewTag||Map$1&&getTag(new Map$1)!=mapTag$1||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set$1&&getTag(new Set$1)!=setTag$1||WeakMap$1&&getTag(new WeakMap$1)!=weakMapTag)&&(getTag=function(Un){var Pn=baseGetTag(Un),ei=Pn==objectTag?Un.constructor:void 0,co=ei?toSource(ei):"";if(co)switch(co){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag$1;case promiseCtorString:return promiseTag;case setCtorString:return setTag$1;case weakMapCtorString:return weakMapTag}return Pn});var mapTag="[object Map]",setTag="[object Set]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function isEmpty$1(Un){if(Un==null)return!0;if(isArrayLike$1(Un)&&(isArray(Un)||typeof Un=="string"||typeof Un.splice=="function"||isBuffer(Un)||isTypedArray(Un)||isArguments(Un)))return!Un.length;var Pn=getTag(Un);if(Pn==mapTag||Pn==setTag)return!Un.size;if(isPrototype(Un))return!baseKeys(Un).length;for(var ei in Un)if(hasOwnProperty.call(Un,ei))return!1;return!0}var id="c4",detector=__name(Un=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(Un),"detector"),loader=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./c4Diagram-AHTNJAMY-EutGBUph.js");return{diagram:Pn}},__vite__mapDeps([54,55]));return{id,diagram:Un}},"loader"),plugin$4={id,detector,loader},c4Detector_default=plugin$4,id2="flowchart",detector2=__name((Un,Pn)=>{var ei,co;return((ei=Pn==null?void 0:Pn.flowchart)==null?void 0:ei.defaultRenderer)==="dagre-wrapper"||((co=Pn==null?void 0:Pn.flowchart)==null?void 0:co.defaultRenderer)==="elk"?!1:/^\s*graph/.test(Un)},"detector"),loader2=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./flowDiagram-DWJPFMVM-BEVdVQjJ.js");return{diagram:Pn}},__vite__mapDeps([56,57,55,58,59,60]));return{id:id2,diagram:Un}},"loader"),plugin2={id:id2,detector:detector2,loader:loader2},flowDetector_default=plugin2,id3="flowchart-v2",detector3=__name((Un,Pn)=>{var ei,co,xo;return((ei=Pn==null?void 0:Pn.flowchart)==null?void 0:ei.defaultRenderer)==="dagre-d3"?!1:(((co=Pn==null?void 0:Pn.flowchart)==null?void 0:co.defaultRenderer)==="elk"&&(Pn.layout="elk"),/^\s*graph/.test(Un)&&((xo=Pn==null?void 0:Pn.flowchart)==null?void 0:xo.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(Un))},"detector"),loader3=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./flowDiagram-DWJPFMVM-BEVdVQjJ.js");return{diagram:Pn}},__vite__mapDeps([56,57,55,58,59,60]));return{id:id3,diagram:Un}},"loader"),plugin3={id:id3,detector:detector3,loader:loader3},flowDetector_v2_default=plugin3,id4="er",detector4=__name(Un=>/^\s*erDiagram/.test(Un),"detector"),loader4=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./erDiagram-SMLLAGMA-Dzv2Z19V.js");return{diagram:Pn}},__vite__mapDeps([61,58,59,60]));return{id:id4,diagram:Un}},"loader"),plugin4={id:id4,detector:detector4,loader:loader4},erDetector_default=plugin4,id5="gitGraph",detector5=__name(Un=>/^\s*gitGraph/.test(Un),"detector"),loader5=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./gitGraphDiagram-UUTBAWPF-id1A35b6.js");return{diagram:Pn}},__vite__mapDeps([62,63,64,65,50,48]));return{id:id5,diagram:Un}},"loader"),plugin5={id:id5,detector:detector5,loader:loader5},gitGraphDetector_default=plugin5,id6="gantt",detector6=__name(Un=>/^\s*gantt/.test(Un),"detector"),loader6=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./ganttDiagram-T4ZO3ILL-CqDRowWZ.js");return{diagram:Pn}},__vite__mapDeps([66,67,68]));return{id:id6,diagram:Un}},"loader"),plugin6={id:id6,detector:detector6,loader:loader6},ganttDetector_default=plugin6,id7="info",detector7=__name(Un=>/^\s*info/.test(Un),"detector"),loader7=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./infoDiagram-42DDH7IO-VCo7Y_XY.js");return{diagram:Pn}},__vite__mapDeps([69,65,50,48]));return{id:id7,diagram:Un}},"loader"),info={id:id7,detector:detector7,loader:loader7},id8="pie",detector8=__name(Un=>/^\s*pie/.test(Un),"detector"),loader8=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./pieDiagram-DEJITSTG-DfotdBjp.js");return{diagram:Pn}},__vite__mapDeps([70,63,65,50,48,71]));return{id:id8,diagram:Un}},"loader"),pie={id:id8,detector:detector8,loader:loader8},id9="quadrantChart",detector9=__name(Un=>/^\s*quadrantChart/.test(Un),"detector"),loader9=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./quadrantDiagram-34T5L4WZ-BQP7wk7X.js");return{diagram:Pn}},__vite__mapDeps([72,67,68]));return{id:id9,diagram:Un}},"loader"),plugin7={id:id9,detector:detector9,loader:loader9},quadrantDetector_default=plugin7,id10="xychart",detector10=__name(Un=>/^\s*xychart(-beta)?/.test(Un),"detector"),loader10=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./xychartDiagram-5P7HB3ND-juQThxJ3.js");return{diagram:Pn}},__vite__mapDeps([73,67,68]));return{id:id10,diagram:Un}},"loader"),plugin8={id:id10,detector:detector10,loader:loader10},xychartDetector_default=plugin8,id11="requirement",detector11=__name(Un=>/^\s*requirement(Diagram)?/.test(Un),"detector"),loader11=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./requirementDiagram-MS252O5E-B_TtEKSs.js");return{diagram:Pn}},__vite__mapDeps([74,58,59]));return{id:id11,diagram:Un}},"loader"),plugin9={id:id11,detector:detector11,loader:loader11},requirementDetector_default=plugin9,id12="sequence",detector12=__name(Un=>/^\s*sequenceDiagram/.test(Un),"detector"),loader12=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./sequenceDiagram-FGHM5R23-BjmdElN-.js");return{diagram:Pn}},__vite__mapDeps([75,55,64]));return{id:id12,diagram:Un}},"loader"),plugin10={id:id12,detector:detector12,loader:loader12},sequenceDetector_default=plugin10,id13="class",detector13=__name((Un,Pn)=>{var ei;return((ei=Pn==null?void 0:Pn.class)==null?void 0:ei.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(Un)},"detector"),loader13=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./classDiagram-6PBFFD2Q-9bBkEPwQ.js");return{diagram:Pn}},__vite__mapDeps([76,77,57,55,58,59]));return{id:id13,diagram:Un}},"loader"),plugin11={id:id13,detector:detector13,loader:loader13},classDetector_default=plugin11,id14="classDiagram",detector14=__name((Un,Pn)=>{var ei;return/^\s*classDiagram/.test(Un)&&((ei=Pn==null?void 0:Pn.class)==null?void 0:ei.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(Un)},"detector"),loader14=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./classDiagram-v2-HSJHXN6E-9bBkEPwQ.js");return{diagram:Pn}},__vite__mapDeps([78,77,57,55,58,59]));return{id:id14,diagram:Un}},"loader"),plugin12={id:id14,detector:detector14,loader:loader14},classDetector_V2_default=plugin12,id15="state",detector15=__name((Un,Pn)=>{var ei;return((ei=Pn==null?void 0:Pn.state)==null?void 0:ei.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(Un)},"detector"),loader15=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./stateDiagram-FHFEXIEX-BNaY_Ekl.js");return{diagram:Pn}},__vite__mapDeps([79,80,58,59,47,48,49,50]));return{id:id15,diagram:Un}},"loader"),plugin13={id:id15,detector:detector15,loader:loader15},stateDetector_default=plugin13,id16="stateDiagram",detector16=__name((Un,Pn)=>{var ei;return!!(/^\s*stateDiagram-v2/.test(Un)||/^\s*stateDiagram/.test(Un)&&((ei=Pn==null?void 0:Pn.state)==null?void 0:ei.defaultRenderer)==="dagre-wrapper")},"detector"),loader16=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./stateDiagram-v2-QKLJ7IA2-spf8Ruqx.js");return{diagram:Pn}},__vite__mapDeps([81,80,58,59]));return{id:id16,diagram:Un}},"loader"),plugin14={id:id16,detector:detector16,loader:loader16},stateDetector_V2_default=plugin14,id17="journey",detector17=__name(Un=>/^\s*journey/.test(Un),"detector"),loader17=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./journeyDiagram-VCZTEJTY-9xfjIDzZ.js");return{diagram:Pn}},__vite__mapDeps([82,57,55,71]));return{id:id17,diagram:Un}},"loader"),plugin15={id:id17,detector:detector17,loader:loader17},journeyDetector_default=plugin15,draw$1=__name((Un,Pn,ei)=>{log.debug(`rendering svg for syntax error
4463
- `);const co=selectSvgElement(Pn),xo=co.append("g");co.attr("viewBox","0 0 2412 512"),configureSvgSize(co,100,512,!0),xo.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),xo.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),xo.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),xo.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),xo.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),xo.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),xo.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),xo.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${ei}`)},"draw"),renderer={draw:draw$1},errorRenderer_default=renderer,diagram={db:{},renderer,parser:{parse:__name(()=>{},"parse")}},errorDiagram_default=diagram,id18="flowchart-elk",detector18=__name((Un,Pn={})=>{var ei;return/^\s*flowchart-elk/.test(Un)||/^\s*(flowchart|graph)/.test(Un)&&((ei=Pn==null?void 0:Pn.flowchart)==null?void 0:ei.defaultRenderer)==="elk"?(Pn.layout="elk",!0):!1},"detector"),loader18=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./flowDiagram-DWJPFMVM-BEVdVQjJ.js");return{diagram:Pn}},__vite__mapDeps([56,57,55,58,59,60]));return{id:id18,diagram:Un}},"loader"),plugin16={id:id18,detector:detector18,loader:loader18},detector_default=plugin16,id19="timeline",detector19=__name(Un=>/^\s*timeline/.test(Un),"detector"),loader19=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./timeline-definition-GMOUNBTQ-BsVGIy02.js");return{diagram:Pn}},__vite__mapDeps([83,71]));return{id:id19,diagram:Un}},"loader"),plugin17={id:id19,detector:detector19,loader:loader19},detector_default2=plugin17,id20="mindmap",detector20=__name(Un=>/^\s*mindmap/.test(Un),"detector"),loader20=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./mindmap-definition-QFDTVHPH-CxMrCCZd.js");return{diagram:Pn}},__vite__mapDeps([84,58,59]));return{id:id20,diagram:Un}},"loader"),plugin18={id:id20,detector:detector20,loader:loader20},detector_default3=plugin18,id21="kanban",detector21=__name(Un=>/^\s*kanban/.test(Un),"detector"),loader21=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./kanban-definition-6JOO6SKY-CtlIC6o7.js");return{diagram:Pn}},__vite__mapDeps([85,57]));return{id:id21,diagram:Un}},"loader"),plugin19={id:id21,detector:detector21,loader:loader21},detector_default4=plugin19,id22="sankey",detector22=__name(Un=>/^\s*sankey(-beta)?/.test(Un),"detector"),loader22=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./sankeyDiagram-XADWPNL6-DaSKJ2JV.js");return{diagram:Pn}},[]);return{id:id22,diagram:Un}},"loader"),plugin20={id:id22,detector:detector22,loader:loader22},sankeyDetector_default=plugin20,id23="packet",detector23=__name(Un=>/^\s*packet(-beta)?/.test(Un),"detector"),loader23=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./diagram-TYMM5635-B6J_V3un.js");return{diagram:Pn}},__vite__mapDeps([86,63,65,50,48]));return{id:id23,diagram:Un}},"loader"),packet={id:id23,detector:detector23,loader:loader23},id24="radar",detector24=__name(Un=>/^\s*radar-beta/.test(Un),"detector"),loader24=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./diagram-MMDJMWI5-IOAJuFuD.js");return{diagram:Pn}},__vite__mapDeps([87,63,65,50,48]));return{id:id24,diagram:Un}},"loader"),radar={id:id24,detector:detector24,loader:loader24},id25="block",detector25=__name(Un=>/^\s*block(-beta)?/.test(Un),"detector"),loader25=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./blockDiagram-DXYQGD6D-BD2W9g1m.js");return{diagram:Pn}},__vite__mapDeps([88,57,51,47,48,60]));return{id:id25,diagram:Un}},"loader"),plugin21={id:id25,detector:detector25,loader:loader25},blockDetector_default=plugin21,id26="treeView",detector26=__name(Un=>/^\s*treeView-beta/.test(Un),"detector"),loader26=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./diagram-5BDNPKRD-D-m_kU_W.js");return{diagram:Pn}},__vite__mapDeps([89,63,64,65,50,48]));return{id:id26,diagram:Un}},"loader"),plugin22={id:id26,detector:detector26,loader:loader26},detector_default5=plugin22,id27="architecture",detector27=__name(Un=>/^\s*architecture/.test(Un),"detector"),loader27=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./architectureDiagram-Q4EWVU46-Bg5q-eAF.js");return{diagram:Pn}},__vite__mapDeps([90,63,65,50,48,53]));return{id:id27,diagram:Un}},"loader"),architecture={id:id27,detector:detector27,loader:loader27},architectureDetector_default=architecture,id28="ishikawa",detector28=__name(Un=>/^\s*ishikawa(-beta)?\b/i.test(Un),"detector"),loader28=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./ishikawaDiagram-UXIWVN3A-2zkFwtGK.js");return{diagram:Pn}},[]);return{id:id28,diagram:Un}},"loader"),ishikawa={id:id28,detector:detector28,loader:loader28},id29="venn",detector29=__name(Un=>/^\s*venn-beta/.test(Un),"detector"),loader29=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./vennDiagram-DHZGUBPP-DvxeoAnH.js");return{diagram:Pn}},[]);return{id:id29,diagram:Un}},"loader"),plugin23={id:id29,detector:detector29,loader:loader29},vennDetector_default=plugin23,id30="treemap",detector30=__name(Un=>/^\s*treemap/.test(Un),"detector"),loader30=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./diagram-G4DWMVQ6-Czc0GOtJ.js");return{diagram:Pn}},__vite__mapDeps([91,59,63,65,50,48,68]));return{id:id30,diagram:Un}},"loader"),treemap={id:id30,detector:detector30,loader:loader30},id31="wardley-beta",detector31=__name(Un=>/^\s*wardley-beta/i.test(Un),"detector"),loader31=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./wardleyDiagram-NUSXRM2D-IHiVP54x.js");return{diagram:Pn}},__vite__mapDeps([92,63,65,50,48]));return{id:id31,diagram:Un}},"loader"),plugin24={id:id31,detector:detector31,loader:loader31},wardleyDetector_default=plugin24,hasLoadedDiagrams=!1,addDiagrams=__name(()=>{hasLoadedDiagrams||(hasLoadedDiagrams=!0,registerDiagram("error",errorDiagram_default,Un=>Un.toLowerCase().trim()==="error"),registerDiagram("---",{db:{clear:__name(()=>{},"clear")},styles:{},renderer:{draw:__name(()=>{},"draw")},parser:{parse:__name(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:__name(()=>null,"init")},Un=>Un.toLowerCase().trimStart().startsWith("---")),registerLazyLoadedDiagrams(detector_default,detector_default3,architectureDetector_default),registerLazyLoadedDiagrams(c4Detector_default,detector_default4,classDetector_V2_default,classDetector_default,erDetector_default,ganttDetector_default,info,pie,requirementDetector_default,sequenceDetector_default,flowDetector_v2_default,flowDetector_default,detector_default2,gitGraphDetector_default,stateDetector_V2_default,stateDetector_default,journeyDetector_default,quadrantDetector_default,sankeyDetector_default,packet,xychartDetector_default,blockDetector_default,detector_default5,radar,ishikawa,treemap,vennDetector_default,wardleyDetector_default))},"addDiagrams"),loadRegisteredDiagrams=__name(async()=>{log.debug("Loading registered diagrams");const Pn=(await Promise.allSettled(Object.entries(detectors).map(async([ei,{detector:co,loader:xo}])=>{if(xo)try{getDiagram(ei)}catch{try{const{diagram:os,id:hs}=await xo();registerDiagram(hs,os,co)}catch(os){throw log.error(`Failed to load external diagram with key ${ei}. Removing from detectors.`),delete detectors[ei],os}}}))).filter(ei=>ei.status==="rejected");if(Pn.length>0){log.error(`Failed to load ${Pn.length} external diagrams`);for(const ei of Pn)log.error(ei);throw new Error(`Failed to load ${Pn.length} external diagrams`)}},"loadRegisteredDiagrams"),SVG_ROLE="graphics-document document";function setA11yDiagramInfo(Un,Pn){Un.attr("role",SVG_ROLE),Pn!==""&&Un.attr("aria-roledescription",Pn)}__name(setA11yDiagramInfo,"setA11yDiagramInfo");function addSVGa11yTitleDescription(Un,Pn,ei,co){if(Un.insert!==void 0){if(ei){const xo=`chart-desc-${co}`;Un.attr("aria-describedby",xo),Un.insert("desc",":first-child").attr("id",xo).text(ei)}if(Pn){const xo=`chart-title-${co}`;Un.attr("aria-labelledby",xo),Un.insert("title",":first-child").attr("id",xo).text(Pn)}}}__name(addSVGa11yTitleDescription,"addSVGa11yTitleDescription");var Vd,Diagram=(Vd=class{constructor(Pn,ei,co,xo,os){this.type=Pn,this.text=ei,this.db=co,this.parser=xo,this.renderer=os}static async fromText(Pn,ei={}){var ta,ra;const co=getConfig(),xo=detectType$1(Pn,co);Pn=encodeEntities(Pn)+`
4477
+ L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),requirement_contains=__name((Un,Pn,ei)=>{const co=Un.append("defs").append("marker").attr("id",ei+"_"+Pn+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");co.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),co.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),co.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),requirement_contains_neo=__name((Un,Pn,ei)=>{const co=getConfig(),{themeVariables:xo}=co,{strokeWidth:os}=xo,hs=Un.append("defs").append("marker").attr("id",ei+"_"+Pn+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");hs.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),hs.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),hs.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),hs.selectAll("*").attr("stroke-width",`${os}`)},"requirement_contains_neo"),markers={extension,composition,aggregation,dependency,lollipop,point,circle:circle$1,cross,barb,barbNeo,only_one,zero_or_one,one_or_more,zero_or_more,only_one_neo,zero_or_one_neo,one_or_more_neo,zero_or_more_neo,requirement_arrow,requirement_contains,requirement_arrow_neo,requirement_contains_neo},markers_default=insertMarkers,internalHelpers={common:common_default,getConfig,insertCluster,insertEdge,insertEdgeLabel,insertMarkers:markers_default,insertNode,interpolateToCurve,labelHelper,log,positionEdgeLabel},layoutAlgorithms={},registerLayoutLoaders=__name(Un=>{for(const Pn of Un)layoutAlgorithms[Pn.name]=Pn},"registerLayoutLoaders"),registerDefaultLayoutLoaders=__name(()=>{registerLayoutLoaders([{name:"dagre",loader:__name(async()=>await __vitePreload(()=>import("./dagre-KV5264BT-bXw64vAF.js"),__vite__mapDeps([46,47,48,49,50,51])),"loader")},{name:"cose-bilkent",loader:__name(async()=>await __vitePreload(()=>import("./cose-bilkent-S5V4N54A-DAp6XOTI.js"),__vite__mapDeps([52,53])),"loader")}])},"registerDefaultLayoutLoaders");registerDefaultLayoutLoaders();var render$3=__name(async(Un,Pn)=>{if(!(Un.layoutAlgorithm in layoutAlgorithms))throw new Error(`Unknown layout algorithm: ${Un.layoutAlgorithm}`);if(Un.diagramId)for(const ra of Un.nodes){const na=ra.domId||ra.id;ra.domId=`${Un.diagramId}-${na}`}const ei=layoutAlgorithms[Un.layoutAlgorithm],co=await ei.loader(),{theme:xo,themeVariables:os}=Un.config,{useGradient:hs,gradientStart:Ms,gradientStop:ea}=os,ta=Pn.attr("id");if(Pn.append("defs").append("filter").attr("id",`${ta}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${xo!=null&&xo.includes("dark")?"#FFFFFF":"#000000"}`),Pn.append("defs").append("filter").attr("id",`${ta}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${xo!=null&&xo.includes("dark")?"#FFFFFF":"#000000"}`),hs){const ra=Pn.append("linearGradient").attr("id",Pn.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");ra.append("svg:stop").attr("offset","0%").attr("stop-color",Ms).attr("stop-opacity",1),ra.append("svg:stop").attr("offset","100%").attr("stop-color",ea).attr("stop-opacity",1)}return co.render(Un,Pn,internalHelpers,{algorithm:ei.algorithm})},"render"),getRegisteredLayoutAlgorithm=__name((Un="",{fallback:Pn="dagre"}={})=>{if(Un in layoutAlgorithms)return Un;if(Pn in layoutAlgorithms)return log.warn(`Layout algorithm ${Un} is not registered. Using ${Pn} as fallback.`),Pn;throw new Error(`Both layout algorithms ${Un} and ${Pn} are not registered.`)},"getRegisteredLayoutAlgorithm"),nativeKeys=overArg(Object.keys,Object),objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function baseKeys(Un){if(!isPrototype(Un))return nativeKeys(Un);var Pn=[];for(var ei in Object(Un))hasOwnProperty$1.call(Un,ei)&&ei!="constructor"&&Pn.push(ei);return Pn}var DataView$1=getNative(root$2,"DataView"),Promise$1=getNative(root$2,"Promise"),Set$1=getNative(root$2,"Set"),WeakMap$1=getNative(root$2,"WeakMap"),mapTag$1="[object Map]",objectTag="[object Object]",promiseTag="[object Promise]",setTag$1="[object Set]",weakMapTag="[object WeakMap]",dataViewTag="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag=baseGetTag;(DataView$1&&getTag(new DataView$1(new ArrayBuffer(1)))!=dataViewTag||Map$1&&getTag(new Map$1)!=mapTag$1||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set$1&&getTag(new Set$1)!=setTag$1||WeakMap$1&&getTag(new WeakMap$1)!=weakMapTag)&&(getTag=function(Un){var Pn=baseGetTag(Un),ei=Pn==objectTag?Un.constructor:void 0,co=ei?toSource(ei):"";if(co)switch(co){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag$1;case promiseCtorString:return promiseTag;case setCtorString:return setTag$1;case weakMapCtorString:return weakMapTag}return Pn});var mapTag="[object Map]",setTag="[object Set]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function isEmpty$1(Un){if(Un==null)return!0;if(isArrayLike$1(Un)&&(isArray(Un)||typeof Un=="string"||typeof Un.splice=="function"||isBuffer(Un)||isTypedArray(Un)||isArguments(Un)))return!Un.length;var Pn=getTag(Un);if(Pn==mapTag||Pn==setTag)return!Un.size;if(isPrototype(Un))return!baseKeys(Un).length;for(var ei in Un)if(hasOwnProperty.call(Un,ei))return!1;return!0}var id="c4",detector=__name(Un=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(Un),"detector"),loader=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./c4Diagram-AHTNJAMY-BQf9874A.js");return{diagram:Pn}},__vite__mapDeps([54,55]));return{id,diagram:Un}},"loader"),plugin$4={id,detector,loader},c4Detector_default=plugin$4,id2="flowchart",detector2=__name((Un,Pn)=>{var ei,co;return((ei=Pn==null?void 0:Pn.flowchart)==null?void 0:ei.defaultRenderer)==="dagre-wrapper"||((co=Pn==null?void 0:Pn.flowchart)==null?void 0:co.defaultRenderer)==="elk"?!1:/^\s*graph/.test(Un)},"detector"),loader2=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./flowDiagram-DWJPFMVM-DCq4RRIH.js");return{diagram:Pn}},__vite__mapDeps([56,57,55,58,59,60]));return{id:id2,diagram:Un}},"loader"),plugin2={id:id2,detector:detector2,loader:loader2},flowDetector_default=plugin2,id3="flowchart-v2",detector3=__name((Un,Pn)=>{var ei,co,xo;return((ei=Pn==null?void 0:Pn.flowchart)==null?void 0:ei.defaultRenderer)==="dagre-d3"?!1:(((co=Pn==null?void 0:Pn.flowchart)==null?void 0:co.defaultRenderer)==="elk"&&(Pn.layout="elk"),/^\s*graph/.test(Un)&&((xo=Pn==null?void 0:Pn.flowchart)==null?void 0:xo.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(Un))},"detector"),loader3=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./flowDiagram-DWJPFMVM-DCq4RRIH.js");return{diagram:Pn}},__vite__mapDeps([56,57,55,58,59,60]));return{id:id3,diagram:Un}},"loader"),plugin3={id:id3,detector:detector3,loader:loader3},flowDetector_v2_default=plugin3,id4="er",detector4=__name(Un=>/^\s*erDiagram/.test(Un),"detector"),loader4=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./erDiagram-SMLLAGMA-TYkyJdZq.js");return{diagram:Pn}},__vite__mapDeps([61,58,59,60]));return{id:id4,diagram:Un}},"loader"),plugin4={id:id4,detector:detector4,loader:loader4},erDetector_default=plugin4,id5="gitGraph",detector5=__name(Un=>/^\s*gitGraph/.test(Un),"detector"),loader5=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./gitGraphDiagram-UUTBAWPF-CS9cfxUA.js");return{diagram:Pn}},__vite__mapDeps([62,63,64,65,50,48]));return{id:id5,diagram:Un}},"loader"),plugin5={id:id5,detector:detector5,loader:loader5},gitGraphDetector_default=plugin5,id6="gantt",detector6=__name(Un=>/^\s*gantt/.test(Un),"detector"),loader6=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./ganttDiagram-T4ZO3ILL-BwOIx_Vs.js");return{diagram:Pn}},__vite__mapDeps([66,67,68]));return{id:id6,diagram:Un}},"loader"),plugin6={id:id6,detector:detector6,loader:loader6},ganttDetector_default=plugin6,id7="info",detector7=__name(Un=>/^\s*info/.test(Un),"detector"),loader7=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./infoDiagram-42DDH7IO-DFs9J8cW.js");return{diagram:Pn}},__vite__mapDeps([69,65,50,48]));return{id:id7,diagram:Un}},"loader"),info={id:id7,detector:detector7,loader:loader7},id8="pie",detector8=__name(Un=>/^\s*pie/.test(Un),"detector"),loader8=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./pieDiagram-DEJITSTG-DuaVu740.js");return{diagram:Pn}},__vite__mapDeps([70,63,65,50,48,71]));return{id:id8,diagram:Un}},"loader"),pie={id:id8,detector:detector8,loader:loader8},id9="quadrantChart",detector9=__name(Un=>/^\s*quadrantChart/.test(Un),"detector"),loader9=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./quadrantDiagram-34T5L4WZ-D9P6tcbK.js");return{diagram:Pn}},__vite__mapDeps([72,67,68]));return{id:id9,diagram:Un}},"loader"),plugin7={id:id9,detector:detector9,loader:loader9},quadrantDetector_default=plugin7,id10="xychart",detector10=__name(Un=>/^\s*xychart(-beta)?/.test(Un),"detector"),loader10=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./xychartDiagram-5P7HB3ND-BnxoasRp.js");return{diagram:Pn}},__vite__mapDeps([73,67,68]));return{id:id10,diagram:Un}},"loader"),plugin8={id:id10,detector:detector10,loader:loader10},xychartDetector_default=plugin8,id11="requirement",detector11=__name(Un=>/^\s*requirement(Diagram)?/.test(Un),"detector"),loader11=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./requirementDiagram-MS252O5E-B8v3RtvO.js");return{diagram:Pn}},__vite__mapDeps([74,58,59]));return{id:id11,diagram:Un}},"loader"),plugin9={id:id11,detector:detector11,loader:loader11},requirementDetector_default=plugin9,id12="sequence",detector12=__name(Un=>/^\s*sequenceDiagram/.test(Un),"detector"),loader12=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./sequenceDiagram-FGHM5R23-WgQSy-Eh.js");return{diagram:Pn}},__vite__mapDeps([75,55,64]));return{id:id12,diagram:Un}},"loader"),plugin10={id:id12,detector:detector12,loader:loader12},sequenceDetector_default=plugin10,id13="class",detector13=__name((Un,Pn)=>{var ei;return((ei=Pn==null?void 0:Pn.class)==null?void 0:ei.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(Un)},"detector"),loader13=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./classDiagram-6PBFFD2Q-DLatDrXa.js");return{diagram:Pn}},__vite__mapDeps([76,77,57,55,58,59]));return{id:id13,diagram:Un}},"loader"),plugin11={id:id13,detector:detector13,loader:loader13},classDetector_default=plugin11,id14="classDiagram",detector14=__name((Un,Pn)=>{var ei;return/^\s*classDiagram/.test(Un)&&((ei=Pn==null?void 0:Pn.class)==null?void 0:ei.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(Un)},"detector"),loader14=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./classDiagram-v2-HSJHXN6E-DLatDrXa.js");return{diagram:Pn}},__vite__mapDeps([78,77,57,55,58,59]));return{id:id14,diagram:Un}},"loader"),plugin12={id:id14,detector:detector14,loader:loader14},classDetector_V2_default=plugin12,id15="state",detector15=__name((Un,Pn)=>{var ei;return((ei=Pn==null?void 0:Pn.state)==null?void 0:ei.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(Un)},"detector"),loader15=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./stateDiagram-FHFEXIEX-Bg9XaNxo.js");return{diagram:Pn}},__vite__mapDeps([79,80,58,59,47,48,49,50]));return{id:id15,diagram:Un}},"loader"),plugin13={id:id15,detector:detector15,loader:loader15},stateDetector_default=plugin13,id16="stateDiagram",detector16=__name((Un,Pn)=>{var ei;return!!(/^\s*stateDiagram-v2/.test(Un)||/^\s*stateDiagram/.test(Un)&&((ei=Pn==null?void 0:Pn.state)==null?void 0:ei.defaultRenderer)==="dagre-wrapper")},"detector"),loader16=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./stateDiagram-v2-QKLJ7IA2-BZf_Cq1t.js");return{diagram:Pn}},__vite__mapDeps([81,80,58,59]));return{id:id16,diagram:Un}},"loader"),plugin14={id:id16,detector:detector16,loader:loader16},stateDetector_V2_default=plugin14,id17="journey",detector17=__name(Un=>/^\s*journey/.test(Un),"detector"),loader17=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./journeyDiagram-VCZTEJTY-CysvVjkr.js");return{diagram:Pn}},__vite__mapDeps([82,57,55,71]));return{id:id17,diagram:Un}},"loader"),plugin15={id:id17,detector:detector17,loader:loader17},journeyDetector_default=plugin15,draw$1=__name((Un,Pn,ei)=>{log.debug(`rendering svg for syntax error
4478
+ `);const co=selectSvgElement(Pn),xo=co.append("g");co.attr("viewBox","0 0 2412 512"),configureSvgSize(co,100,512,!0),xo.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),xo.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),xo.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),xo.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),xo.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),xo.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),xo.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),xo.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${ei}`)},"draw"),renderer={draw:draw$1},errorRenderer_default=renderer,diagram={db:{},renderer,parser:{parse:__name(()=>{},"parse")}},errorDiagram_default=diagram,id18="flowchart-elk",detector18=__name((Un,Pn={})=>{var ei;return/^\s*flowchart-elk/.test(Un)||/^\s*(flowchart|graph)/.test(Un)&&((ei=Pn==null?void 0:Pn.flowchart)==null?void 0:ei.defaultRenderer)==="elk"?(Pn.layout="elk",!0):!1},"detector"),loader18=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./flowDiagram-DWJPFMVM-DCq4RRIH.js");return{diagram:Pn}},__vite__mapDeps([56,57,55,58,59,60]));return{id:id18,diagram:Un}},"loader"),plugin16={id:id18,detector:detector18,loader:loader18},detector_default=plugin16,id19="timeline",detector19=__name(Un=>/^\s*timeline/.test(Un),"detector"),loader19=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./timeline-definition-GMOUNBTQ-2h7ZeLc6.js");return{diagram:Pn}},__vite__mapDeps([83,71]));return{id:id19,diagram:Un}},"loader"),plugin17={id:id19,detector:detector19,loader:loader19},detector_default2=plugin17,id20="mindmap",detector20=__name(Un=>/^\s*mindmap/.test(Un),"detector"),loader20=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./mindmap-definition-QFDTVHPH-D2Y8ZrN3.js");return{diagram:Pn}},__vite__mapDeps([84,58,59]));return{id:id20,diagram:Un}},"loader"),plugin18={id:id20,detector:detector20,loader:loader20},detector_default3=plugin18,id21="kanban",detector21=__name(Un=>/^\s*kanban/.test(Un),"detector"),loader21=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./kanban-definition-6JOO6SKY-DlGvCOou.js");return{diagram:Pn}},__vite__mapDeps([85,57]));return{id:id21,diagram:Un}},"loader"),plugin19={id:id21,detector:detector21,loader:loader21},detector_default4=plugin19,id22="sankey",detector22=__name(Un=>/^\s*sankey(-beta)?/.test(Un),"detector"),loader22=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./sankeyDiagram-XADWPNL6-CJIIvTEv.js");return{diagram:Pn}},[]);return{id:id22,diagram:Un}},"loader"),plugin20={id:id22,detector:detector22,loader:loader22},sankeyDetector_default=plugin20,id23="packet",detector23=__name(Un=>/^\s*packet(-beta)?/.test(Un),"detector"),loader23=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./diagram-TYMM5635-iVE2rLmi.js");return{diagram:Pn}},__vite__mapDeps([86,63,65,50,48]));return{id:id23,diagram:Un}},"loader"),packet={id:id23,detector:detector23,loader:loader23},id24="radar",detector24=__name(Un=>/^\s*radar-beta/.test(Un),"detector"),loader24=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./diagram-MMDJMWI5-CYIS8pup.js");return{diagram:Pn}},__vite__mapDeps([87,63,65,50,48]));return{id:id24,diagram:Un}},"loader"),radar={id:id24,detector:detector24,loader:loader24},id25="block",detector25=__name(Un=>/^\s*block(-beta)?/.test(Un),"detector"),loader25=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./blockDiagram-DXYQGD6D-C5DamiPe.js");return{diagram:Pn}},__vite__mapDeps([88,57,51,47,48,60]));return{id:id25,diagram:Un}},"loader"),plugin21={id:id25,detector:detector25,loader:loader25},blockDetector_default=plugin21,id26="treeView",detector26=__name(Un=>/^\s*treeView-beta/.test(Un),"detector"),loader26=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./diagram-5BDNPKRD-BZyIxgPb.js");return{diagram:Pn}},__vite__mapDeps([89,63,64,65,50,48]));return{id:id26,diagram:Un}},"loader"),plugin22={id:id26,detector:detector26,loader:loader26},detector_default5=plugin22,id27="architecture",detector27=__name(Un=>/^\s*architecture/.test(Un),"detector"),loader27=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./architectureDiagram-Q4EWVU46-C6FcFqys.js");return{diagram:Pn}},__vite__mapDeps([90,63,65,50,48,53]));return{id:id27,diagram:Un}},"loader"),architecture={id:id27,detector:detector27,loader:loader27},architectureDetector_default=architecture,id28="ishikawa",detector28=__name(Un=>/^\s*ishikawa(-beta)?\b/i.test(Un),"detector"),loader28=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./ishikawaDiagram-UXIWVN3A-ChYUj0ld.js");return{diagram:Pn}},[]);return{id:id28,diagram:Un}},"loader"),ishikawa={id:id28,detector:detector28,loader:loader28},id29="venn",detector29=__name(Un=>/^\s*venn-beta/.test(Un),"detector"),loader29=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./vennDiagram-DHZGUBPP-Ab3_6Oe9.js");return{diagram:Pn}},[]);return{id:id29,diagram:Un}},"loader"),plugin23={id:id29,detector:detector29,loader:loader29},vennDetector_default=plugin23,id30="treemap",detector30=__name(Un=>/^\s*treemap/.test(Un),"detector"),loader30=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./diagram-G4DWMVQ6-B7DIbmE6.js");return{diagram:Pn}},__vite__mapDeps([91,59,63,65,50,48,68]));return{id:id30,diagram:Un}},"loader"),treemap={id:id30,detector:detector30,loader:loader30},id31="wardley-beta",detector31=__name(Un=>/^\s*wardley-beta/i.test(Un),"detector"),loader31=__name(async()=>{const{diagram:Un}=await __vitePreload(async()=>{const{diagram:Pn}=await import("./wardleyDiagram-NUSXRM2D-rM9jo8v5.js");return{diagram:Pn}},__vite__mapDeps([92,63,65,50,48]));return{id:id31,diagram:Un}},"loader"),plugin24={id:id31,detector:detector31,loader:loader31},wardleyDetector_default=plugin24,hasLoadedDiagrams=!1,addDiagrams=__name(()=>{hasLoadedDiagrams||(hasLoadedDiagrams=!0,registerDiagram("error",errorDiagram_default,Un=>Un.toLowerCase().trim()==="error"),registerDiagram("---",{db:{clear:__name(()=>{},"clear")},styles:{},renderer:{draw:__name(()=>{},"draw")},parser:{parse:__name(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:__name(()=>null,"init")},Un=>Un.toLowerCase().trimStart().startsWith("---")),registerLazyLoadedDiagrams(detector_default,detector_default3,architectureDetector_default),registerLazyLoadedDiagrams(c4Detector_default,detector_default4,classDetector_V2_default,classDetector_default,erDetector_default,ganttDetector_default,info,pie,requirementDetector_default,sequenceDetector_default,flowDetector_v2_default,flowDetector_default,detector_default2,gitGraphDetector_default,stateDetector_V2_default,stateDetector_default,journeyDetector_default,quadrantDetector_default,sankeyDetector_default,packet,xychartDetector_default,blockDetector_default,detector_default5,radar,ishikawa,treemap,vennDetector_default,wardleyDetector_default))},"addDiagrams"),loadRegisteredDiagrams=__name(async()=>{log.debug("Loading registered diagrams");const Pn=(await Promise.allSettled(Object.entries(detectors).map(async([ei,{detector:co,loader:xo}])=>{if(xo)try{getDiagram(ei)}catch{try{const{diagram:os,id:hs}=await xo();registerDiagram(hs,os,co)}catch(os){throw log.error(`Failed to load external diagram with key ${ei}. Removing from detectors.`),delete detectors[ei],os}}}))).filter(ei=>ei.status==="rejected");if(Pn.length>0){log.error(`Failed to load ${Pn.length} external diagrams`);for(const ei of Pn)log.error(ei);throw new Error(`Failed to load ${Pn.length} external diagrams`)}},"loadRegisteredDiagrams"),SVG_ROLE="graphics-document document";function setA11yDiagramInfo(Un,Pn){Un.attr("role",SVG_ROLE),Pn!==""&&Un.attr("aria-roledescription",Pn)}__name(setA11yDiagramInfo,"setA11yDiagramInfo");function addSVGa11yTitleDescription(Un,Pn,ei,co){if(Un.insert!==void 0){if(ei){const xo=`chart-desc-${co}`;Un.attr("aria-describedby",xo),Un.insert("desc",":first-child").attr("id",xo).text(ei)}if(Pn){const xo=`chart-title-${co}`;Un.attr("aria-labelledby",xo),Un.insert("title",":first-child").attr("id",xo).text(Pn)}}}__name(addSVGa11yTitleDescription,"addSVGa11yTitleDescription");var Vd,Diagram=(Vd=class{constructor(Pn,ei,co,xo,os){this.type=Pn,this.text=ei,this.db=co,this.parser=xo,this.renderer=os}static async fromText(Pn,ei={}){var ta,ra;const co=getConfig(),xo=detectType$1(Pn,co);Pn=encodeEntities(Pn)+`
4464
4479
  `;try{getDiagram(xo)}catch{const na=getDiagramLoader(xo);if(!na)throw new UnknownDiagramError(`Diagram ${xo} not found.`);const{id:ia,diagram:oa}=await na();registerDiagram(ia,oa)}const{db:os,parser:hs,renderer:Ms,init:ea}=getDiagram(xo);return hs.parser&&(hs.parser.yy=os),(ta=os.clear)==null||ta.call(os),ea==null||ea(co),ei.title&&((ra=os.setDiagramTitle)==null||ra.call(os,ei.title)),await hs.parse(Pn),new Vd(xo,Pn,os,hs,Ms)}async render(Pn,ei){await this.renderer.draw(this.text,Pn,ei,this)}getParser(){return this.parser}getType(){return this.type}},__name(Vd,"Diagram"),Vd),interactionFunctions=[],attachFunctions=__name(()=>{interactionFunctions.forEach(Un=>{Un()}),interactionFunctions=[]},"attachFunctions"),cleanupComments=__name(Un=>Un.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function extractFrontMatter(Un){const Pn=Un.match(frontMatterRegex);if(!Pn)return{text:Un,metadata:{}};let ei=load$2(Pn[1],{schema:JSON_SCHEMA})??{};ei=typeof ei=="object"&&!Array.isArray(ei)?ei:{};const co={};return ei.displayMode&&(co.displayMode=ei.displayMode.toString()),ei.title&&(co.title=ei.title.toString()),ei.config&&(co.config=ei.config),{text:Un.slice(Pn[0].length),metadata:co}}__name(extractFrontMatter,"extractFrontMatter");var cleanupText=__name(Un=>Un.replace(/\r\n?/g,`
4465
4480
  `).replace(/<(\w+)([^>]*)>/g,(Pn,ei,co)=>"<"+ei+co.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),processFrontmatter=__name(Un=>{const{text:Pn,metadata:ei}=extractFrontMatter(Un),{displayMode:co,title:xo,config:os={}}=ei;return co&&(os.gantt||(os.gantt={}),os.gantt.displayMode=co),{title:xo,config:os,text:Pn}},"processFrontmatter"),processDirectives=__name(Un=>{const Pn=utils_default.detectInit(Un)??{},ei=utils_default.detectDirective(Un,"wrap");return Array.isArray(ei)?Pn.wrap=ei.some(({type:co})=>co==="wrap"):(ei==null?void 0:ei.type)==="wrap"&&(Pn.wrap=!0),{text:removeDirectives(Un),directive:Pn}},"processDirectives");function preprocessDiagram(Un){const Pn=cleanupText(Un),ei=processFrontmatter(Pn),co=processDirectives(ei.text),xo=cleanAndMerge(ei.config,co.directive);return Un=cleanupComments(co.text),{code:Un,title:ei.title,config:xo}}__name(preprocessDiagram,"preprocessDiagram");function toBase64(Un){const Pn=new TextEncoder().encode(Un),ei=Array.from(Pn,co=>String.fromCodePoint(co)).join("");return btoa(ei)}__name(toBase64,"toBase64");var MAX_TEXTLENGTH=5e4,MAX_TEXTLENGTH_EXCEEDED_MSG="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",SECURITY_LVL_SANDBOX="sandbox",SECURITY_LVL_LOOSE="loose",XMLNS_SVG_STD="http://www.w3.org/2000/svg",XMLNS_XLINK_STD="http://www.w3.org/1999/xlink",XMLNS_XHTML_STD="http://www.w3.org/1999/xhtml",IFRAME_WIDTH="100%",IFRAME_HEIGHT="100%",IFRAME_STYLES="border:0;margin:0;",IFRAME_BODY_STYLE="margin:0",IFRAME_SANDBOX_OPTS="allow-top-navigation-by-user-activation allow-popups",IFRAME_NOT_SUPPORTED_MSG='The "iframe" tag is not supported by your browser.',DOMPURIFY_TAGS=["foreignobject"],DOMPURIFY_ATTR=["dominant-baseline"];function processAndSetConfigs(Un){const Pn=preprocessDiagram(Un);return reset$1(),addDirective(Pn.config??{}),Pn}__name(processAndSetConfigs,"processAndSetConfigs");async function parse$4(Un,Pn){addDiagrams();try{const{code:ei,config:co}=processAndSetConfigs(Un);return{diagramType:(await getDiagramFromText(ei)).type,config:co}}catch(ei){if(Pn!=null&&Pn.suppressErrors)return!1;throw ei}}__name(parse$4,"parse");var cssImportantStyles=__name((Un,Pn,ei=[])=>`
4466
4481
  .${Un} ${Pn} { ${ei.join(" !important; ")} !important; }`,"cssImportantStyles"),createCssStyles=__name((Un,Pn=new Map)=>{let ei="";if(Un.themeCSS!==void 0&&(ei+=`
@@ -6217,8 +6232,8 @@ ${this.__diagram}
6217
6232
  height: var(--send-button-size, 32px);
6218
6233
  padding-inline: 0 !important;
6219
6234
  }
6220
- `}));function openFileSelector(Un,Pn="*/*"){if(typeof document>"u")return;const ei=document.createElement("input");ei.type="file",ei.accept=Pn,ei.multiple=!1;const co=setTimeout(()=>ei.remove(),5e3);ei.onchange=xo=>{var hs;clearTimeout(co);const os=(hs=xo.target)==null?void 0:hs.files;os&&os.length>0&&Un(os),ei.remove()},ei.oncancel=()=>{clearTimeout(co),ei.remove()},ei.click()}function getFormatItems(Un,Pn){return[{active:Un.isBold,icon:Bold,key:"bold",label:"Bold",onClick:Un.bold,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Bold).keys}},{active:Un.isItalic,icon:Italic,key:"italic",label:"Italic",onClick:Un.italic,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Italic).keys}},{active:Un.isUnderline,icon:Underline,key:"underline",label:"Underline",onClick:Un.underline,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Underline).keys}},{active:Un.isStrikethrough,icon:Strikethrough,key:"strikethrough",label:"Strikethrough",onClick:Un.strikethrough,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Strikethrough).keys}},{type:"divider"},{active:!!Un.textColor,editor:Pn,key:"textColor",label:"Text Color",onChange:Un.setTextColor,type:"colorPicker",value:Un.textColor},{active:!!Un.bgColor,defaultColor:"#ffffff",editor:Pn,icon:Highlighter,key:"bgColor",label:"Background Color",onChange:Un.setBgColor,type:"colorPicker",value:Un.bgColor}]}const Toolbar=({editor:Un,floating:Pn,outlineCollapseTitle:ei,outlineExpandTitle:co,outlineToggle:xo,style:os,className:hs})=>{const Ms=useEditorState(Un),ea=useOutlineActionItem({collapseTitle:ei,expandTitle:co}),ta=reactExports.useMemo(()=>[{disabled:!Ms.canUndo,icon:Undo2,key:"undo",label:"Undo",onClick:Ms.undo,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Undo).keys}},{disabled:!Ms.canRedo,icon:Redo2,key:"redo",label:"Redo",onClick:Ms.redo,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Redo).keys}},{type:"divider"},...getFormatItems(Ms,Un),{type:"divider"},{icon:List,key:"bulletList",label:"Bullet List",onClick:Ms.bulletList,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.BulletList).keys}},{icon:ListOrdered,key:"numberlist",label:"Number list",onClick:Ms.numberList,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.NumberList).keys}},{icon:ListTodo,key:"tasklist",label:"Task list",onClick:Ms.checkList},{type:"divider"},{active:Ms.isBlockquote,icon:MessageSquareQuote,key:"blockquote",label:"Blockquote",onClick:Ms.blockquote},{icon:Link,key:"link",label:"Link",onClick:Ms.insertLink,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Link).keys}},{icon:Sigma,key:"math",label:"TeX",onClick:Ms.insertMath},{type:"divider"},{active:Ms.isCode,icon:CodeXml,key:"code",label:"Code",onClick:Ms.code,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.CodeInline).keys}},{active:Ms.isCodeblock,icon:SquareDashedBottomCode,key:"codeblock",label:"Codeblock",onClick:Ms.codeblock},Ms.isCodeblock&&{children:jsxRuntimeExports.jsx(CodeLanguageSelect,{onSelect:na=>{console.log(na),Ms.updateCodeblockLang(na)},value:Ms.codeblockLang}),disabled:!Ms.isCodeblock,key:"codeblockLang"},{type:"divider"},{icon:Image$1,key:"image",label:"Image",onClick:()=>{openFileSelector(na=>{for(const ia of na)Un.dispatchCommand(INSERT_IMAGE_COMMAND,{file:ia})},"image/*")}},{icon:FileUp,key:"file",label:"File",onClick:()=>{openFileSelector(na=>{for(const ia of na)Un.dispatchCommand(INSERT_FILE_COMMAND,{file:ia})})}},...xo&&ea?[{type:"divider"},ea]:[]].filter(Boolean),[Un,Ms,ea,xo]),ra=reactExports.useMemo(()=>[...getFormatItems(Ms,Un),...xo&&ea?[{type:"divider"},ea]:[]],[Un,Ms,ea,xo]);return Pn?jsxRuntimeExports.jsx(FloatActions,{items:ra}):jsxRuntimeExports.jsx("div",{className:["mdocs-toolbar",hs].filter(Boolean).join(" "),style:os,children:jsxRuntimeExports.jsx(ChatInputActions,{items:ta})})};function DomainSelect({domains:Un,value:Pn,onChange:ei,ariaLabel:co,localizeName:xo,onDomainsChange:os}){const[hs,Ms]=reactExports.useState(!1),[ea,ta]=reactExports.useState(Un),ra=reactExports.useRef(null),na=reactExports.useRef(null);reactExports.useEffect(()=>{ta(Un)},[Un]);const ia=ea.find(la=>la.domainId===Pn),oa=(ia==null?void 0:ia.permission)==="private";reactExports.useEffect(()=>{if(!hs)return;const la=ca=>{var ua,da;!((ua=ra.current)!=null&&ua.contains(ca.target))&&!((da=na.current)!=null&&da.contains(ca.target))&&Ms(!1)};return document.addEventListener("mousedown",la),()=>document.removeEventListener("mousedown",la)},[hs]),reactExports.useEffect(()=>{if(!hs)return;const la=ca=>{var ua;ca.key==="Escape"&&(Ms(!1),(ua=ra.current)==null||ua.focus())};return document.addEventListener("keydown",la),()=>document.removeEventListener("keydown",la)},[hs]);function sa(la){ei(la),Ms(!1)}function aa(){if(hs){Ms(!1);return}Ms(!0),fetchDomainsSafe().then(la=>{ta(la),os==null||os(la)})}return jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-select-wrapper",children:[jsxRuntimeExports.jsxs("button",{ref:ra,type:"button",className:"mdocs-domain-select-trigger","aria-label":co,"aria-expanded":hs,"aria-haspopup":"listbox",onClick:aa,children:[jsxRuntimeExports.jsx("span",{className:"mdocs-domain-select-text",children:ia?xo(ia.domainName):""}),oa&&jsxRuntimeExports.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:[jsxRuntimeExports.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),jsxRuntimeExports.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),jsxRuntimeExports.jsx("svg",{className:"mdocs-domain-select-chevron"+(hs?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"1.5",children:jsxRuntimeExports.jsx("path",{d:"M1 1l4 4 4-4"})})]}),hs&&jsxRuntimeExports.jsx("div",{ref:na,className:"mdocs-domain-select-menu card",role:"listbox","aria-label":co,children:ea.map(la=>jsxRuntimeExports.jsxs("button",{type:"button",className:"mdocs-domain-select-option"+(la.domainId===Pn?" active":""),role:"option","aria-selected":la.domainId===Pn,onClick:()=>sa(la.domainId),children:[jsxRuntimeExports.jsx("span",{children:xo(la.domainName)}),la.permission==="private"&&jsxRuntimeExports.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"2",children:[jsxRuntimeExports.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),jsxRuntimeExports.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]},la.domainId))})]})}const MAX_DATASOURCE_WAIT_FRAMES=48;function safeGetMarkdown(Un){try{const Pn=Un.getDocument("markdown");return typeof Pn=="string"?Pn:""}catch{return null}}function safeGetJsonString(Un){try{return JSON.stringify(Un.getDocument("json"))}catch{return null}}function useAutoSave({editor:Un,documentId:Pn,displayName:ei,debounceMs:co=1e3,enabled:xo=!0,localBaseCommitIdAtEditStart:os,snapshotMeta:hs}){const[Ms,ea]=reactExports.useState(!1),[ta,ra]=reactExports.useState(!1),[na,ia]=reactExports.useState(null),oa=reactExports.useRef(null),sa=reactExports.useRef(null),aa=reactExports.useRef(!1),la=reactExports.useRef(""),ca=reactExports.useRef(!1),ua=reactExports.useRef(Pn),da=reactExports.useRef(ei),ha=reactExports.useRef(os),fa=reactExports.useRef(hs);ua.current=Pn,da.current=ei,ha.current=os,fa.current=hs;const pa=reactExports.useCallback(async()=>{if(!Un)return;if(!la.current){console.log("[useAutoSave] performSave blocked: lastContentRef is empty");return}const va=safeGetJsonString(Un);va!=null&&(console.log("[useAutoSave] performSave saving draft, documentId:",ua.current,"content preview:",va.slice(0,80)),await getDocumentTaskQueue(ua.current).execute(()=>upsertContentDraft({documentId:ua.current,content:va,displayName:da.current,localBaseCommitIdAtEditStart:ha.current,snapshotMeta:fa.current})),la.current=safeGetMarkdown(Un)??la.current,ra(!0),ea(!1),ia(Date.now()),aa.current=!0,ca.current=!1)},[Un]);reactExports.useEffect(()=>{let va=!1;return getDraft(Pn).then(ya=>{va||(ya?(ra(!0),ia(ya.updatedAt),aa.current=!0):(ra(!1),ia(null),aa.current=!1,ca.current=!1))}),()=>{va=!0}},[Pn]),reactExports.useEffect(()=>{var Ta,$a;if(!xo){(Ta=sa.current)==null||Ta.call(sa),sa.current=null;return}if(!Un)return;const va=Un.getLexicalEditor();if(!va)return;($a=sa.current)==null||$a.call(sa);let ya=!1,Ca=0,wa=0;const Ea=()=>{if(ya)return;const Oa=safeGetMarkdown(Un);if(Oa===null){if(wa+=1,wa>MAX_DATASOURCE_WAIT_FRAMES)return;Ca=requestAnimationFrame(Ea);return}la.current=Oa;const Aa=va.registerUpdateListener(()=>{const Da=safeGetMarkdown(Un);Da!==null&&Da!==la.current&&(console.log("[useAutoSave] updateListener dirty, documentId:",Pn,"oldLen:",la.current.length,"newLen:",Da.length),la.current=Da,ea(!0),ca.current=!0,aa.current=!1,oa.current&&clearTimeout(oa.current),oa.current=setTimeout(()=>{oa.current=null,pa()},co))});sa.current=()=>{Aa(),oa.current&&(clearTimeout(oa.current),oa.current=null)}};return queueMicrotask(()=>{ya||(Ca=requestAnimationFrame(Ea))}),()=>{var Oa;ya=!0,cancelAnimationFrame(Ca),(Oa=sa.current)==null||Oa.call(sa)}},[xo,Un,Pn,ei,co,os,hs,pa]),reactExports.useEffect(()=>{var Ca;if(!xo||!Un)return;const va=(Ca=Un.getLexicalEditor())==null?void 0:Ca.getRootElement();if(!va)return;const ya=()=>{oa.current&&(clearTimeout(oa.current),oa.current=null),ca.current&&pa()};return va.addEventListener("blur",ya),()=>va.removeEventListener("blur",ya)},[xo,Un,pa]),reactExports.useEffect(()=>{if(!xo)return;const va=()=>{document.visibilityState==="hidden"&&(oa.current&&(clearTimeout(oa.current),oa.current=null),ca.current&&pa())},ya=()=>{ca.current&&(oa.current&&(clearTimeout(oa.current),oa.current=null),pa())};return document.addEventListener("visibilitychange",va),window.addEventListener("beforeunload",ya),()=>{document.removeEventListener("visibilitychange",va),window.removeEventListener("beforeunload",ya)}},[xo,pa]);async function ma(){await deleteDraft(Pn),ra(!1),ea(!1),ca.current=!1,aa.current=!1,la.current=""}async function ga(){const va=await getDraft(Pn);return va?va.content:null}function xa(){ra(!0),ea(!1),ca.current=!1,ia(Date.now()),aa.current=!0,Un&&(la.current=safeGetMarkdown(Un)??"")}return{isDirty:Ms,draftExists:ta,lastSavedAt:na,clearDraft:ma,loadDraftContent:ga,markDraftSaved:xa}}function usePublishGuard({isDirty:Un,draftExists:Pn}){const ei=Un&&!Pn;reactExports.useEffect(()=>{if(!ei)return;const co=xo=>{xo.preventDefault()};return window.addEventListener("beforeunload",co),()=>window.removeEventListener("beforeunload",co)},[ei])}const PATH_ERROR_MESSAGE_MAP={"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"},STORAGE_ERROR_MESSAGE_MAP={"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 translateError(Un,Pn){if(Pn instanceof ApiRequestError)return Pn.message;if(Pn instanceof DocPathError){const ei=PATH_ERROR_MESSAGE_MAP[Pn.message];return ei?Un(ei):Pn.message}if(Pn instanceof Error){const ei=PATH_ERROR_MESSAGE_MAP[Pn.message]??STORAGE_ERROR_MESSAGE_MAP[Pn.message];return ei?Un(ei):Pn.message}return String(Pn)}function localizeDomainName(Un,Pn,ei){if(Un==="Default")return ei("defaultDomain");const co="个人域";return Un.endsWith(co)?Un.slice(0,-co.length)+ei("personalDomainSuffix"):Un}function domainPermissionLabel(Un,Pn){return Un==="public"?Pn("domainPublic"):Un==="restricted"?Pn("domainRestricted"):Un==="private"?Pn("domainPrivate"):Un}function parentDirForCreates(Un){const Pn=Un.lastIndexOf("/");return Pn===-1?"":Un.slice(0,Pn)}function MiniSelect({options:Un,value:Pn,onChange:ei}){const[co,xo]=reactExports.useState(!1),os=reactExports.useRef(null),hs=reactExports.useRef(null),Ms=Un.find(ta=>ta.value===Pn);reactExports.useEffect(()=>{if(!co)return;const ta=ra=>{var na,ia;!((na=os.current)!=null&&na.contains(ra.target))&&!((ia=hs.current)!=null&&ia.contains(ra.target))&&xo(!1)};return document.addEventListener("mousedown",ta),()=>document.removeEventListener("mousedown",ta)},[co]),reactExports.useEffect(()=>{if(!co)return;const ta=ra=>{var na;ra.key==="Escape"&&(xo(!1),(na=os.current)==null||na.focus())};return document.addEventListener("keydown",ta),()=>document.removeEventListener("keydown",ta)},[co]);function ea(ta){ei(ta),xo(!1)}return jsxRuntimeExports.jsxs("div",{className:"mdocs-mini-select",style:{position:"relative"},children:[jsxRuntimeExports.jsxs("button",{ref:os,type:"button",className:"mdocs-mini-select-trigger","aria-expanded":co,"aria-haspopup":"listbox",onClick:()=>xo(ta=>!ta),children:[jsxRuntimeExports.jsx("span",{children:Ms==null?void 0:Ms.label}),jsxRuntimeExports.jsx("svg",{className:"mdocs-mini-select-chevron"+(co?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntimeExports.jsx("path",{d:"M1 1l4 4 4-4"})})]}),co&&jsxRuntimeExports.jsx("div",{ref:hs,className:"mdocs-mini-select-menu card",role:"listbox",children:Un.map(ta=>jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-mini-select-option"+(ta.value===Pn?" active":""),role:"option","aria-selected":ta.value===Pn,onClick:()=>ea(ta.value),children:ta.label},ta.value))})]})}function idPrefix6$1(Un){return Un.length<=6?Un:`${Un.slice(0,6)}…`}function VisitorPickerContent(Un){const{visitors:Pn,loadState:ei,searchFilter:co,onSearchChange:xo,selectedIds:os,onToggle:hs,selectedRows:Ms,lockedIds:ea=new Set,myVisitorId:ta,showPermissionSelect:ra=!1,permissionOptions:na=[],onPermissionChange:ia}=Un,{t:oa}=useI18n(),sa=reactExports.useMemo(()=>{const aa=co.trim().toLowerCase();let la=aa?Pn.filter(ca=>ca.visitorName.toLowerCase().includes(aa)||ca.visitorId.toLowerCase().includes(aa)):Pn;return ta&&(la=[...la].sort((ca,ua)=>ca.visitorId===ta?-1:ua.visitorId===ta?1:0)),la},[Pn,co,ta]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{type:"search",className:"mdocs-visitor-picker-search",placeholder:oa("visitorPickerSearchPlaceholder"),value:co,onChange:aa=>xo(aa.target.value),disabled:ei!=="ok"}),ei==="loading"&&jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-loading",children:oa("loading")}),ei==="err"&&jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-error",children:oa("visitorPickerLoadError")}),ei==="ok"&&jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-columns",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-col",children:[jsxRuntimeExports.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:oa("visitorPickerColumnAll")}),jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:jsxRuntimeExports.jsxs("table",{className:"mdocs-visitor-picker-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{scope:"col",children:oa("visitorPickerColIdShort")}),jsxRuntimeExports.jsx("th",{scope:"col",children:oa("visitorPickerColName")}),jsxRuntimeExports.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col",children:oa("visitorPickerColPick")})]})}),jsxRuntimeExports.jsx("tbody",{children:sa.length===0?jsxRuntimeExports.jsx("tr",{children:jsxRuntimeExports.jsx("td",{colSpan:3,className:"mdocs-visitor-picker-empty-cell",children:Pn.length===0?oa("visitorPickerEmptyDirectory"):oa("domainNoMatch")})}):sa.map(aa=>{const la=ea.has(aa.visitorId),ca=os.has(aa.visitorId);return jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx("code",{className:"mdocs-visitor-picker-id-short",children:idPrefix6$1(aa.visitorId)})}),jsxRuntimeExports.jsxs("td",{children:[aa.visitorName,aa.visitorId===ta&&jsxRuntimeExports.jsx("span",{className:"mdocs-visitor-picker-self-marker",children:oa("visitorPickerSelfMarker")})]}),jsxRuntimeExports.jsx("td",{className:"mdocs-visitor-picker-check-col",children:jsxRuntimeExports.jsx("input",{type:"checkbox",checked:ca,disabled:la,onChange:()=>hs(aa.visitorId),"aria-label":aa.visitorName})})]},aa.visitorId)})})]})})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-col",children:[jsxRuntimeExports.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:oa("visitorPickerColumnSelected")}),jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:jsxRuntimeExports.jsxs("table",{className:"mdocs-visitor-picker-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{scope:"col",children:oa("visitorPickerColIdFull")}),jsxRuntimeExports.jsx("th",{scope:"col",children:oa("visitorPickerColName")}),ra&&jsxRuntimeExports.jsx("th",{scope:"col",children:oa("permissionLabel")}),jsxRuntimeExports.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col"})]})}),jsxRuntimeExports.jsx("tbody",{children:Ms.length===0?jsxRuntimeExports.jsx("tr",{children:jsxRuntimeExports.jsx("td",{colSpan:ra?4:3,className:"mdocs-visitor-picker-empty-cell",children:oa("visitorPickerNoSelection")})}):Ms.map(aa=>{const la=ea.has(aa.visitorId);return jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx("code",{className:"mdocs-visitor-picker-id-full",children:aa.visitorId})}),jsxRuntimeExports.jsx("td",{className:aa.muted?"mdocs-visitor-picker-name-muted":void 0,children:aa.name}),ra&&jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx(MiniSelect,{options:na,value:aa.permission??"read",onChange:ca=>ia==null?void 0:ia(aa.visitorId,ca)})}),jsxRuntimeExports.jsx("td",{className:"mdocs-visitor-picker-check-col",children:la?jsxRuntimeExports.jsx("span",{className:"mdocs-visitor-picker-locked",title:oa("visitorPickerLockedHint"),children:"—"}):jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-visitor-picker-remove",onClick:()=>hs(aa.visitorId),"aria-label":oa("visitorPickerRemove"),children:"×"})})]},aa.visitorId)})})]})})]})]})]})}function VisitorPickerModal(Un){var Ya;const{open:Pn,title:ei,initialSelectedIds:co,lockedIds:xo=[],seedMembers:os,excludeTemplateId:hs,templates:Ms,onClose:ea,onConfirm:ta,showPermissionSelect:ra=!1,permissionOptions:na=[],initialPermissions:ia}=Un,{t:oa}=useI18n(),sa=reactExports.useRef(oa);sa.current=oa;const aa=reactExports.useMemo(()=>new Set(xo),[xo]),la=getStoredVisitorId(),[ca,ua]=reactExports.useState([]),[da,ha]=reactExports.useState("idle"),[fa,pa]=reactExports.useState(()=>new Set),[ma,ga]=reactExports.useState(()=>new Map),[xa,va]=reactExports.useState(""),[ya,Ca]=reactExports.useState(""),[wa,Ea]=reactExports.useState(!1),Ta=reactExports.useRef(null),[$a,Oa]=reactExports.useState(!1),[Aa,Da]=reactExports.useState(null),Ia=reactExports.useMemo(()=>Ms.filter(Ja=>hs==null||Ja.id!==hs),[Ms,hs]),za=reactExports.useMemo(()=>new Map((os??[]).map(Ja=>[Ja.visitorId,Ja])),[os]);reactExports.useEffect(()=>{Pn&&(pa(new Set(co)),ga(ia?new Map(ia):new Map),va(""),Ca(""),Da(null))},[Pn,co,ia]),reactExports.useEffect(()=>{if(!Pn)return;let Ja=!1;return ha("loading"),fetchVisitorsDirectoryApi().then(Ra=>{Ja||(ua(Ra),ha("ok"))}).catch(Ra=>{Ja||(ha("err"),Da(translateError(sa.current,Ra)))}),()=>{Ja=!0}},[Pn]),reactExports.useEffect(()=>{if(!wa)return;const Ja=Ra=>{var Ma;(Ma=Ta.current)!=null&&Ma.contains(Ra.target)||Ea(!1)};return document.addEventListener("mousedown",Ja),()=>document.removeEventListener("mousedown",Ja)},[wa]);const La=reactExports.useMemo(()=>{const Ja=new Map(ca.map(Ma=>[Ma.visitorId,Ma])),Ra=[];for(const Ma of fa){const Fa=ma.get(Ma),Ha=Ja.get(Ma);if(Ha){Ra.push({visitorId:Ma,name:Ha.visitorName,muted:!1,permission:Fa});continue}const Ka=za.get(Ma);if(Ka){Ka.missing?Ra.push({visitorId:Ma,name:oa("visitorPickerMemberMissing"),muted:!0,permission:Fa}):Ka.disabled?Ra.push({visitorId:Ma,name:`${Ka.visitorName} · ${oa("visitorPickerDisabledTag")}`,muted:!0,permission:Fa}):Ra.push({visitorId:Ma,name:Ka.visitorName,muted:!1,permission:Fa});continue}Ra.push({visitorId:Ma,name:oa("visitorPickerUnknownVisitor"),muted:!0,permission:Fa})}return Ra.sort((Ma,Fa)=>Ma.name.localeCompare(Fa.name,void 0,{sensitivity:"base"})),Ra},[ca,fa,za,ma,oa]),Na=reactExports.useCallback(Ja=>{aa.has(Ja)||pa(Ra=>{const Ma=new Set(Ra);return Ma.has(Ja)?(Ma.delete(Ja),ga(Fa=>{const Ha=new Map(Fa);return Ha.delete(Ja),Ha})):(Ma.add(Ja),ga(Fa=>{const Ha=new Map(Fa);return Ha.set(Ja,"read"),Ha})),Ma})},[aa]),Wa=reactExports.useCallback((Ja,Ra)=>{ga(Ma=>{const Fa=new Map(Ma);return Fa.set(Ja,Ra),Fa})},[]),Ua=reactExports.useCallback(()=>{const Ja=Number(ya);if(!Number.isInteger(Ja)||Ja<1)return;const Ra=Ms.find(Fa=>Fa.id===Ja);if(!Ra)return;const Ma=new Set(ca.map(Fa=>Fa.visitorId));pa(Fa=>{const Ha=new Set(Fa);for(const Ka of Ra.visitorIds)Ma.has(Ka)&&Ha.add(Ka);return Ha})},[ya,Ms,ca]);async function Ga(){Da(null),Oa(!0);try{if(ra){const Ja=[...fa].sort().map(Ra=>({visitorId:Ra,permission:ma.get(Ra)??"read"}));await ta(Ja)}else{const Ja=[...fa].sort();await ta(Ja)}ea()}catch(Ja){Da(translateError(oa,Ja))}finally{Oa(!1)}}return Pn?jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-overlay",role:"presentation",onMouseDown:Ja=>Ja.target===Ja.currentTarget&&ea(),children:jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"mdocs-visitor-picker-title",children:[jsxRuntimeExports.jsxs("header",{className:"mdocs-visitor-picker-header",children:[jsxRuntimeExports.jsx("h2",{id:"mdocs-visitor-picker-title",className:"mdocs-visitor-picker-title",children:ei}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-visitor-picker-close",onClick:ea,"aria-label":oa("close"),children:"×"})]}),Ia.length>0&&jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-toolbar",children:jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-template-bar",children:[jsxRuntimeExports.jsxs("div",{ref:Ta,className:"mdocs-template-picker",children:[jsxRuntimeExports.jsxs("button",{type:"button",className:"mdocs-template-picker-trigger",onClick:()=>Ea(Ja=>!Ja),disabled:da!=="ok","aria-haspopup":"listbox","aria-expanded":wa,children:[jsxRuntimeExports.jsx("span",{className:"mdocs-template-picker-text",children:ya?(Ya=Ia.find(Ja=>String(Ja.id)===ya))==null?void 0:Ya.displayName:oa("visitorPickerPickTemplate")}),jsxRuntimeExports.jsx("svg",{className:"mdocs-template-picker-chevron"+(wa?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntimeExports.jsx("path",{d:"M1 1l4 4 4-4"})})]}),wa&&jsxRuntimeExports.jsx("div",{className:"mdocs-template-picker-menu card",role:"listbox",children:Ia.map(Ja=>jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-template-picker-option"+(String(Ja.id)===ya?" active":""),role:"option","aria-selected":String(Ja.id)===ya,onClick:()=>{Ca(String(Ja.id)),Ea(!1)},children:Ja.displayName},Ja.id))})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>{if(da!=="ok"){Da(oa("loading"));return}if(!ya){Da(oa("visitorPickerPickTemplate"));return}Ua()},children:oa("visitorPickerApplyTemplate")})]})}),Aa&&jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-error",role:"alert",children:Aa}),jsxRuntimeExports.jsx("div",{style:{padding:"8px 18px 12px"},children:jsxRuntimeExports.jsx(VisitorPickerContent,{visitors:ca,loadState:da,searchFilter:xa,onSearchChange:va,selectedIds:fa,onToggle:Na,selectedRows:La,lockedIds:aa,myVisitorId:la,showPermissionSelect:ra,permissionOptions:na,onPermissionChange:Wa})}),jsxRuntimeExports.jsxs("footer",{className:"mdocs-visitor-picker-footer",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:ea,children:oa("cancel")}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>{if(da!=="ok"){Da(oa("loading"));return}Ga()},children:oa($a?"saving":"visitorPickerConfirm")})]})]})}):null}function safeLexicalJsonString(Un){try{return JSON.stringify(Un.getDocument("json"))}catch{return null}}function OutlineSideRail({editor:Un}){const{visible:Pn}=useOutlineVisibility();return jsxRuntimeExports.jsx("div",{className:"mdocs-outline-siderail",style:{flexShrink:0,overflow:"hidden",transition:"width 0.2s ease",width:Pn?200:0},children:jsxRuntimeExports.jsx("div",{style:{width:200},children:jsxRuntimeExports.jsx(OutlinePanel,{editor:Un})})})}function DocumentEditor(Un){const{t:Pn,lang:ei}=useI18n(),[co,xo]=reactExports.useState(!1),os=reactExports.useRef(null),[hs,Ms]=reactExports.useState([]),[ea,ta]=reactExports.useState(!1),[ra,na]=reactExports.useState(Un.meta.permission),[ia,oa]=reactExports.useState(!1),[sa,aa]=reactExports.useState(!1),[la,ca]=reactExports.useState(!1),[ua,da]=reactExports.useState(new Map),[ha,fa]=reactExports.useState(!1);reactExports.useEffect(()=>{const Xl=vc=>{os.current&&!os.current.contains(vc.target)&&xo(!1)};return co&&document.addEventListener("mousedown",Xl),()=>document.removeEventListener("mousedown",Xl)},[co]),reactExports.useEffect(()=>{let Xl=!0;return fetchVisitorsDirectoryApi().then(vc=>{Xl&&Ms(vc)}).catch(()=>{}),()=>{Xl=!1}},[]);function pa(Xl){const vc=hs.find(xc=>xc.visitorId===Xl);return(vc==null?void 0:vc.visitorName)??Xl.slice(0,8)}const[ma,ga]=reactExports.useState(Un.initialDisplayName),[xa,va]=reactExports.useState(!1),[ya,Ca]=reactExports.useState(!1),[wa,Ea]=reactExports.useState(!1),[Ta,$a]=reactExports.useState(()=>localStorage.getItem("mdocs.autoEdit")!=="false"),Oa=Un.canEdit&&Ta,[Aa,Da]=reactExports.useState(null),[Ia,za]=reactExports.useState(!1),La=reactExports.useRef(null);reactExports.useLayoutEffect(()=>{za(!1),Da(null),La.current=null},[Un.meta.documentId]),reactExports.useEffect(()=>{const Xl=requestAnimationFrame(()=>za(!0));return()=>cancelAnimationFrame(Xl)},[Un.meta.documentId]);const Na=reactExports.useRef(Un.initialContent);reactExports.useEffect(()=>{Na.current=Un.initialContent},[Un.initialContent,Un.contentRevision]);const Wa=reactExports.useMemo(()=>{var Xl;if(!Un.initialContent)return"json";try{const vc=JSON.parse(Un.initialContent);return(Xl=vc==null?void 0:vc.root)!=null&&Xl.children?"json":"markdown"}catch{return"markdown"}},[Un.initialContent,Un.contentRevision]),{isDirty:Ua,draftExists:Ga,markDraftSaved:Ya}=useAutoSave({editor:Aa,documentId:Un.meta.documentId,displayName:ma,enabled:Un.canEdit,localBaseCommitIdAtEditStart:Un.meta.headCommitId??null,snapshotMeta:{relativePath:Un.meta.relativePath,permission:Un.meta.permission,ownerVisitorId:Un.meta.ownerVisitorId,domainId:Un.meta.domainId}});reactExports.useEffect(()=>{var Xl;(Xl=Un.onDraftExistsChange)==null||Xl.call(Un,Ga)},[Ga,Un.onDraftExistsChange]),usePublishGuard({isDirty:Ua,draftExists:Ga}),reactExports.useEffect(()=>{if(Aa)try{Aa.setDocument(Wa,Un.initialContent||"")}catch{}},[Aa,Un.meta.documentId,Un.contentRevision,Un.initialContent,Wa]),reactExports.useEffect(()=>{Aa==null||Aa.setLocale(ei==="zh"?zhCN:enUS)},[Aa,ei]),reactExports.useEffect(()=>{ga(Un.initialDisplayName)},[Un.initialDisplayName,Un.meta.documentId,Un.contentRevision]),reactExports.useEffect(()=>{na(Un.meta.permission)},[Un.meta.permission,Un.meta.documentId]),reactExports.useEffect(()=>{let Xl=!0;return(async()=>{try{const vc=await checkBookmarkApi(Un.meta.documentId);Xl&&Ca(vc.bookmarked)}catch{}})(),()=>{Xl=!1}},[Un.meta.documentId]);async function Ja(){var Xl,vc;if(!wa){Ea(!0);try{ya?(await removeBookmarkApi(Un.meta.documentId),Ca(!1),(Xl=Un.onShowToast)==null||Xl.call(Un,Pn("bookmarkRemoved"))):(await addBookmarkApi(Un.meta.documentId),Ca(!0),(vc=Un.onShowToast)==null||vc.call(Un,Pn("bookmarkAdded")))}finally{Ea(!1)}}}reactExports.useEffect(()=>(Un.saveBeforeNavRef&&(Un.saveBeforeNavRef.current=hc),()=>{Un.saveBeforeNavRef&&(Un.saveBeforeNavRef.current=void 0)}));function Ra(Xl){return Xl<1024?`${Xl} B`:Xl<1024*1024?`${(Xl/1024).toFixed(1)} KB`:`${(Xl/(1024*1024)).toFixed(1)} MB`}const Ma=reactExports.useCallback(Xl=>{La.current=Xl,Da(Xl);const vc=Na.current;if(!vc)return;const xc=()=>{try{Xl.setDocument(Wa,vc)}catch{requestAnimationFrame(()=>{try{Xl.setDocument(Wa,vc)}catch{}})}};queueMicrotask(()=>{queueMicrotask(xc)})},[Wa]);async function Fa(){if(!(!Aa||!Un.canEdit)){va(!0);try{const Xl=safeLexicalJsonString(Aa);if(!Xl)return;await Un.onPublish(Xl,ma,Un.meta.documentId)}catch(Xl){throw Xl}finally{va(!1)}}}async function Ha(){if(!Un.canEdit)return;const Xl=Un.initialDisplayName.trim();if(ma.trim()!==Xl)try{await Fa()}catch{}}const Ka=reactExports.useMemo(()=>Un.domains.find(Xl=>Xl.domainId===Un.meta.domainId),[Un.domains,Un.meta.domainId]),Sl=reactExports.useMemo(()=>{const Xl=(Ka==null?void 0:Ka.permission)??"public";return allowedPermissionsForDomain(Xl)},[Ka==null?void 0:Ka.permission]);function Za(Xl){return Xl===DocumentPermission.PRIVATE?Pn("permissionPrivate"):Xl===DocumentPermission.DOMAIN_READ?Pn("permissionInvite"):Xl===DocumentPermission.DOMAIN_WRITE?Pn("permissionDomainWrite"):Xl===DocumentPermission.PUBLIC_READ?Pn("permissionPublicRead"):Pn("permissionPublicEdit")}async function lc(){var Xl;if(ia||ra===Un.meta.permission){ta(!1);return}oa(!0);try{const xc=(Aa?safeLexicalJsonString(Aa):null)??Un.initialContent;await Un.onPublish(xc,ma,Un.meta.documentId,ra),ta(!1),(Xl=Un.onShowToast)==null||Xl.call(Un,Pn("docInfoPermissionUpdated"))}finally{oa(!1)}}async function oc(Xl){var vc;if(!ha){fa(!0);try{const xc=new Set(Xl.map(kc=>kc.visitorId)),Ac=new Map(Xl.map(kc=>[kc.visitorId,kc.permission]));for(const[kc]of ua)xc.has(kc)||await removeDocumentInviteApi(Un.meta.documentId,kc);for(const{visitorId:kc,permission:uc}of Xl){const fc=ua.get(kc);(!fc||fc!==uc)&&await addDocumentInviteApi(Un.meta.documentId,kc,uc)}aa(!1),(vc=Un.onShowToast)==null||vc.call(Un,Pn("docInfoInviteSuccess",{count:Xl.length}))}finally{fa(!1)}}}async function hc(){if(!Aa||!Un.canEdit)return;if(!Ua){console.log("[DocumentEditor.saveDraft] skipped: not dirty, documentId:",Un.meta.documentId);return}const Xl=safeLexicalJsonString(Aa);Xl&&(console.log("[DocumentEditor.saveDraft] saving draft, documentId:",Un.meta.documentId,"content preview:",Xl.slice(0,80)),Ya(),await getDocumentTaskQueue(Un.meta.documentId).execute(()=>upsertContentDraft({documentId:Un.meta.documentId,content:Xl,displayName:ma,localBaseCommitIdAtEditStart:Un.meta.headCommitId??null,snapshotMeta:{relativePath:Un.meta.relativePath,permission:Un.meta.permission,ownerVisitorId:Un.meta.ownerVisitorId,domainId:Un.meta.domainId}})))}const gc=reactExports.useMemo(()=>[{icon:Heading1,key:"h1",label:"Heading 1",onSelect:Xl=>{Xl.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h1"})}},{icon:Heading2,key:"h2",label:"Heading 2",onSelect:Xl=>{Xl.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h2"})}},{icon:Heading3,key:"h3",label:"Heading 3",onSelect:Xl=>{Xl.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h3"})}},{type:"divider"},{icon:Minus,key:"hr",label:"Hr",onSelect:Xl=>{Xl.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND,{})}},{icon:Table2,key:"table",label:"Table",onSelect:Xl=>{Xl.dispatchCommand(INSERT_TABLE_COMMAND,{columns:"3",rows:"3"})}},{icon:Sigma,key:"tex",label:"TeX",onSelect:Xl=>{Xl.dispatchCommand(INSERT_MATH_COMMAND,{code:"x^2 + y^2 = z^2"}),queueMicrotask(()=>Xl.focus())}},{type:"divider"},{key:"file",label:"File",onSelect:Xl=>{openFileSelector(vc=>{for(const xc of vc)Xl.dispatchCommand(INSERT_FILE_COMMAND,{file:xc})})}},{key:"insert-link",label:"Insert Link",onSelect:Xl=>{Xl.dispatchCommand(INSERT_LINK_COMMAND,{url:"https://example.com"}),queueMicrotask(()=>Xl.focus())}},{key:"insert-codeInline",label:"Inline Code",onSelect:Xl=>{Xl.dispatchCommand(INSERT_CODEINLINE_COMMAND,void 0),queueMicrotask(()=>Xl.focus())}},{key:"insert-codeBlock",label:"Code Block",onSelect:Xl=>{Xl.dispatchCommand(INSERT_CODEMIRROR_COMMAND,void 0),queueMicrotask(()=>Xl.focus())}},{icon:Workflow,key:"meta2d",label:"Meta2d",onSelect:Xl=>{Xl.dispatchCommand(INSERT_META2D_COMMAND,void 0),queueMicrotask(()=>Xl.focus())}}].map(Xl=>"type"in Xl&&Xl.type==="divider"?Xl:{...Xl,extra:jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted)",fontFamily:"monospace",fontSize:12},children:Xl.key})}),[]),Rc=reactExports.useMemo(()=>[ReactMarkdownPlugin,ReactListPlugin,ReactLinkPlugin,ReactImagePlugin,ReactCodemirrorPlugin,ReactHRPlugin,ReactTablePlugin,ReactMathPlugin,ReactMeta2dPlugin,ReactMarkmapPlugin,ReactCodePlugin,withProps(ReactToolbarPlugin,{children:Aa?jsxRuntimeExports.jsx(Toolbar,{editor:Aa,floating:!0,outlineCollapseTitle:Pn("outlineHide"),outlineExpandTitle:Pn("outlineShow"),outlineToggle:!0}):null}),withProps(ReactFilePlugin,{handleUpload:async Xl=>({url:await uploadAssetApi(Xl,Un.meta.documentId)})}),withProps(ReactImagePlugin,{defaultBlockImage:!0,needRehost:Xl=>Xl.startsWith("blob:"),handleRehost:async Xl=>{const xc=await(await fetch(Xl)).blob(),Ac=new File([xc],"image.png",{type:xc.type});return{url:await uploadAssetApi(Ac,Un.meta.documentId)}}})],[Aa,Pn]);return jsxRuntimeExports.jsxs("div",{className:"mdocs-editor",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-editor-toolbar",children:[jsxRuntimeExports.jsx("input",{className:"mdocs-editor-title-input",value:ma,onChange:Xl=>ga(Xl.target.value),onBlur:()=>void Ha(),placeholder:Pn("displayNamePlaceholder"),disabled:!Oa}),jsxRuntimeExports.jsx(DomainSelect,{domains:Un.domains.length?Un.domains:[FALLBACK_DOMAIN_SUMMARY],value:Un.currentDomainId,onChange:Un.onDomainChange,onDomainsChange:Un.onDomainsChange,ariaLabel:Pn("currentDomainAria"),localizeName:Xl=>localizeDomainName(Xl,ei,Pn)}),jsxRuntimeExports.jsxs("button",{type:"button",className:"secondary mdocs-tooltip mdocs-tooltip-bottom",onClick:()=>void Ja(),disabled:wa,"data-tooltip":ya?"取消收藏":"收藏",style:{padding:"4px 8px",minWidth:"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:4,opacity:wa?.5:1},children:[jsxRuntimeExports.jsx(Star,{size:18,strokeWidth:1.5,style:{color:ya?"#faad14":"var(--mdocs-text-secondary, #6b7280)",fill:ya?"#faad14":"none"}}),ya&&jsxRuntimeExports.jsx("span",{children:"已收藏"})]}),jsxRuntimeExports.jsx("span",{className:"mdocs-editor-toolbar-spacer","aria-hidden":!0}),jsxRuntimeExports.jsxs("div",{className:"mdocs-editor-toolbar-actions",children:[Un.onSyncClick&&jsxRuntimeExports.jsxs("button",{type:"button",className:"mdocs-sync-btn mdocs-tooltip mdocs-tooltip-bottom"+(Un.syncBehind?" behind":""),"data-tooltip":Un.syncBehind?Pn("syncBehindHint"):Pn("syncPull"),onClick:()=>{var Xl;return void((Xl=Un.onSyncClick)==null?void 0:Xl.call(Un))},style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntimeExports.jsx(RefreshCw,{size:16,strokeWidth:1.5}),jsxRuntimeExports.jsx("span",{children:Pn("syncPull")})]}),Oa?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[localStorage.getItem("mdocs.autoPublish")!=="true"&&jsxRuntimeExports.jsxs("span",{className:"mdocs-save-indicator",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-save-dot "+(xa?"saving":Ga?"unsaved":"saved")}),jsxRuntimeExports.jsx("span",{children:Pn(xa?"publishing":Ga?"unsaved":"published")})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",disabled:xa,onClick:()=>{Fa().catch(()=>{})},children:Pn(xa?"publishing":"publish")}),jsxRuntimeExports.jsx("button",{type:"button",className:"danger",disabled:xa,onClick:Un.onDelete,children:Pn("delete")})]}):Un.canEdit&&jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>$a(!0),children:Pn("edit")}),jsxRuntimeExports.jsxs("button",{type:"button",className:"secondary mdocs-tooltip mdocs-tooltip-bottom",onClick:Un.onToggleComments,"data-tooltip":"评论",style:{padding:"4px 8px",minWidth:"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:4,background:Un.commentPanelOpen?"var(--mdocs-hover-bg, #f0f0f0)":void 0},children:[jsxRuntimeExports.jsx(MessageSquare,{size:18,strokeWidth:1.5,style:{color:"var(--mdocs-text-secondary, #6b7280)"}}),Un.commentCount>0&&jsxRuntimeExports.jsx("span",{style:{fontSize:"0.85rem"},children:Un.commentCount})]}),jsxRuntimeExports.jsxs("div",{ref:os,className:"mdocs-tooltip mdocs-tooltip-bottom","data-tooltip":Pn("docInfo"),style:{position:"relative"},children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>xo(!co),style:{padding:"4px 8px",minWidth:"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntimeExports.jsx(TextAlignJustify,{size:18,strokeWidth:1.5,style:{color:"var(--mdocs-text-secondary, #6b7280)"}})}),co&&jsxRuntimeExports.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:"4px",background:"var(--mdocs-surface, #fff)",border:"1px solid var(--mdocs-border, #e5e5e5)",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",minWidth:"220px",zIndex:100,padding:"8px 0"},children:[jsxRuntimeExports.jsxs("div",{style:{padding:"4px 16px",fontSize:"13px"},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"6px"},children:[jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted, #888)"},children:Pn("docInfoCreator")}),jsxRuntimeExports.jsx("span",{children:pa(Un.meta.ownerVisitorId)})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"6px"},children:[jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted, #888)"},children:Pn("docInfoCreatedAt")}),jsxRuntimeExports.jsx("span",{children:new Date(Un.meta.createdAt).toLocaleString(ei==="zh"?"zh-CN":"en-US")})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"6px"},children:[jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted, #888)"},children:Pn("docInfoSize")}),jsxRuntimeExports.jsx("span",{children:Ra(new Blob([Un.initialContent]).size)})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted, #888)"},children:Pn("docInfoUpdatedAt")}),jsxRuntimeExports.jsx("span",{children:new Date(Un.meta.updatedAt).toLocaleString(ei==="zh"?"zh-CN":"en-US")})]})]}),jsxRuntimeExports.jsx("div",{style:{height:"1px",background:"var(--mdocs-border, #e5e5e5)",margin:"8px 0"}}),jsxRuntimeExports.jsxs("button",{type:"button",style:{width:"100%",textAlign:"left",padding:"8px 16px",background:"none",border:"none",cursor:"pointer",fontSize:"13px",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:Xl=>{Xl.currentTarget.style.background="var(--mdocs-hover-bg, #f5f5f5)"},onMouseLeave:Xl=>{Xl.currentTarget.style.background="none"},onClick:()=>{Ja()},children:[jsxRuntimeExports.jsx("span",{children:ya?"⭐":"☆"}),jsxRuntimeExports.jsx("span",{children:Pn(ya?"bookmarkRemove":"bookmarkAdd")})]}),Un.canManageInvites&&jsxRuntimeExports.jsxs("button",{type:"button",style:{width:"100%",textAlign:"left",padding:"8px 16px",background:"none",border:"none",cursor:"pointer",fontSize:"13px",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:Xl=>{Xl.currentTarget.style.background="var(--mdocs-hover-bg, #f5f5f5)"},onMouseLeave:Xl=>{Xl.currentTarget.style.background="none"},onClick:()=>{xo(!1),(async()=>{ca(!0);try{const Xl=await getDocumentInvitesApi(Un.meta.documentId),vc=new Map(Xl.map(xc=>[xc.visitorId,xc.permission]));da(vc),aa(!0)}finally{ca(!1)}})()},children:[jsxRuntimeExports.jsx(Users,{size:14}),jsxRuntimeExports.jsx("span",{children:Pn("docInfoInviteMember")})]}),jsxRuntimeExports.jsxs("button",{type:"button",style:{width:"100%",textAlign:"left",padding:"8px 16px",background:"none",border:"none",cursor:"pointer",fontSize:"13px",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:Xl=>{Xl.currentTarget.style.background="var(--mdocs-hover-bg, #f5f5f5)"},onMouseLeave:Xl=>{Xl.currentTarget.style.background="none"},onClick:()=>{xo(!1),na(Un.meta.permission),ta(!0)},children:[jsxRuntimeExports.jsx(ShieldUser,{size:14}),jsxRuntimeExports.jsx("span",{children:Pn("docInfoChangePermission")})]})]})]})]})]}),ea&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",style:{position:"fixed",zIndex:9999},onClick:Xl=>{Xl.target===Xl.currentTarget&&ta(!1)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:480},children:[jsxRuntimeExports.jsx("h1",{style:{fontSize:"1.1rem",marginBottom:12},children:Pn("docInfoChangePermission")}),jsxRuntimeExports.jsxs("div",{className:"muted",style:{marginBottom:12},children:[Pn("domainPermission"),":",Ka?localizeDomainName(Ka.domainName,ei,Pn):Un.meta.domainId]}),jsxRuntimeExports.jsx("div",{style:{display:"grid",gap:8},children:Sl.map(Xl=>jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[jsxRuntimeExports.jsx("input",{type:"radio",name:"doc-permission",value:Xl,checked:ra===Xl,onChange:()=>na(Xl)}),jsxRuntimeExports.jsx("span",{children:Za(Xl)})]},Xl))}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:16},children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ta(!1),children:Pn("cancel")}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",disabled:ia,onClick:()=>void lc(),children:Pn(ia?"publishing":"saveAndPublish")})]})]})}),Un.canManageInvites&&jsxRuntimeExports.jsx(VisitorPickerModal,{open:sa,title:Pn("docInfoInviteMember"),initialSelectedIds:[...ua.keys()],initialPermissions:ua,templates:[],showPermissionSelect:!0,permissionOptions:[{value:"read",label:Pn("invitePermissionRead")},{value:"edit",label:Pn("invitePermissionEdit")}],onClose:()=>aa(!1),onConfirm:Xl=>{oc(Xl)}}),jsxRuntimeExports.jsx(OutlineProvider,{children:jsxRuntimeExports.jsx(Block,{flex:1,style:{minHeight:0},children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[Oa&&Aa&&jsxRuntimeExports.jsx(Toolbar,{editor:Aa,outlineCollapseTitle:Pn("outlineHide"),outlineExpandTitle:Pn("outlineShow"),outlineToggle:!0}),jsxRuntimeExports.jsx("div",{className:"mdocs-editor-content-area",style:{flex:1,display:"flex",minHeight:0},children:jsxRuntimeExports.jsxs(Block,{variant:"outlined",horizontal:!0,style:{background:"var(--mdocs-surface)",flex:1,minHeight:0,minWidth:0,borderRadius:0,outline:"none"},children:[jsxRuntimeExports.jsx("div",{className:"mdocs-editor-scroll-host",children:Ia?jsxRuntimeExports.jsx(Editor,{content:Un.initialContent,type:Wa,confirmPasteMarkdown:!0,editable:Oa,onInit:Ma,plugins:Rc,lineEmptyPlaceholder:Pn("displayNamePlaceholder"),placeholder:Pn("displayNamePlaceholder"),slashOption:{items:gc},className:"mdocs-document-editor-root"},Un.meta.documentId):null}),Aa&&jsxRuntimeExports.jsx(OutlineSideRail,{editor:Aa})]})})]})})})]})}function ConfirmDialog({title:Un,message:Pn,confirmLabel:ei="确定",cancelLabel:co="取消",onConfirm:xo,onCancel:os,busy:hs=!1,danger:Ms=!1}){return jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:ea=>{ea.target===ea.currentTarget&&!hs&&os()},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[Un&&jsxRuntimeExports.jsx("h2",{className:"mdocs-message-dialog-title",children:Un}),jsxRuntimeExports.jsx("p",{className:"mdocs-message-dialog-body",children:Pn}),jsxRuntimeExports.jsxs("div",{className:"mdocs-message-dialog-actions",style:{gap:8},children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:os,disabled:hs,children:co}),jsxRuntimeExports.jsx("button",{type:"button",className:Ms?"danger":"primary",onClick:xo,disabled:hs,children:hs?"…":ei})]})]})})}class DraftPublishAborted extends Error{constructor(ei,co){super(ei);Ba(this,"code");Ba(this,"cause");this.name="DraftPublishAborted",this.code=ei,this.cause=co==null?void 0:co.cause}}function publishErrorCodeFrom(Un){return Un instanceof DraftPublishAborted?Un.code:Un instanceof ApiRequestError?Un.status===404?DRAFT_PUBLISH_ERROR.DOC_NOT_FOUND:Un.code||`HTTP_${Un.status}`:Un instanceof Error&&Un.message.trim()?Un.message.trim().slice(0,120):"UNKNOWN"}function formatDraftPublishFailureMessage(Un,Pn,ei,co){const xo=(Pn==null?void 0:Pn.displayName)||Un("unknownTitle");if(ei===DRAFT_PUBLISH_ERROR.SYNC_HEAD_MISSING)return Un("draftPublishFailedSyncHead",{name:xo});if(ei===DRAFT_PUBLISH_ERROR.DOC_NOT_FOUND)return Un("draftPublishFailedNotice",{name:xo});const os=co instanceof ApiRequestError||co instanceof Error&&co.message?co.message:ei;return Un("draftPublishFailedGeneric",{name:xo,reason:os})}async function failDraftPublish(Un,Pn,ei){const co=publishErrorCodeFrom(Pn);throw await markDraftPublishError(Un,co),Pn instanceof DraftPublishAborted?Pn:new DraftPublishAborted(co,{cause:Pn})}function RecoveryDialog({draft:Un,onClose:Pn,onSuccess:ei}){const{t:co,lang:xo}=useI18n(),[os,hs]=reactExports.useState([]),[Ms,ea]=reactExports.useState(Un.domainId??""),[ta,ra]=reactExports.useState([]),[na,ia]=reactExports.useState(""),[oa,sa]=reactExports.useState(`${Un.displayName||"untitled"}_recovered.md`),[aa,la]=reactExports.useState(!1),[ca,ua]=reactExports.useState(null),da=reactExports.useRef(null),ha=reactExports.useRef(!0);reactExports.useEffect(()=>(ha.current=!0,()=>{ha.current=!1}),[]),reactExports.useEffect(()=>{fetchDomainsSafe().then(ma=>{ha.current&&hs(ma)})},[]),reactExports.useEffect(()=>{Ms&&(ra([]),ia(""),fetchTreeApi(Ms).then(ma=>{ha.current&&ra(ma)}).catch(()=>{ha.current&&ra([])}))},[Ms]),reactExports.useEffect(()=>{const ma=window.setTimeout(()=>{var ga;return(ga=da.current)==null?void 0:ga.focus()},0);return()=>window.clearTimeout(ma)},[]),reactExports.useEffect(()=>{const ma=ga=>{ga.key==="Escape"&&Pn()};return window.addEventListener("keydown",ma),()=>window.removeEventListener("keydown",ma)},[Pn]);function fa(ma,ga){for(const xa of ma){if(xa.type==="folder"&&xa.path===ga)return xa.documentId;if(xa.type==="folder"){const va=fa(xa.children,ga);if(va)return va}}return null}async function pa(ma){ma.preventDefault(),la(!0),ua(null);const ga=oa.replace(/\s+/g,"_").replace(/[^a-zA-Z0-9_\-.]/g,""),xa=ga.endsWith(".md")?ga:ga+".md",va=xa.replace(/\.md$/i,"");try{const ya=na?`${na}/${xa}`:xa,Ca=na?fa(ta,na)??void 0:void 0;await createDocumentApi({fileName:xa,displayName:va,content:Un.content,domainId:Ms,parentId:Ca}),ei()}catch(ya){ua(translateError(co,ya))}finally{la(!1)}}return jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:ma=>{ma.target===ma.currentTarget&&!aa&&Pn()},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card mdocs-recovery-dialog",role:"dialog","aria-modal":"true",children:[jsxRuntimeExports.jsx("h1",{children:co("recoverDraft")}),jsxRuntimeExports.jsx("p",{className:"muted",children:co("recoverDraftDesc",{name:Un.displayName||co("unknownTitle")})}),jsxRuntimeExports.jsxs("form",{onSubmit:pa,className:"mdocs-dialog-form",children:[jsxRuntimeExports.jsxs("label",{className:"mdocs-dialog-label",children:[co("domainLabel"),os.length>0&&jsxRuntimeExports.jsx(DomainSelect,{domains:os,value:Ms,onChange:ea,onDomainsChange:hs,ariaLabel:co("domainLabel"),localizeName:ma=>localizeDomainName(ma,xo,co)})]}),jsxRuntimeExports.jsxs("label",{className:"mdocs-dialog-label mdocs-recovery-tree-label",children:[co("recoverTargetFolder"),jsxRuntimeExports.jsx("div",{className:"mdocs-recovery-tree",children:jsxRuntimeExports.jsx(DocumentTree,{nodes:ta,activeDocumentId:null,selectedParentPath:na,onOpen:()=>{},onOpenFolder:ma=>ia(ma),onContextMenu:()=>{},onDeselect:()=>ia("")})})]}),jsxRuntimeExports.jsxs("label",{className:"mdocs-dialog-label",children:[co("fileNameLabel"),jsxRuntimeExports.jsx("input",{ref:da,value:oa,onChange:ma=>sa(ma.target.value),placeholder:"recovered.md",maxLength:200,disabled:aa})]}),ca&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-error",children:ca}),jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>!aa&&Pn(),disabled:aa,children:co("cancel")}),jsxRuntimeExports.jsx("button",{type:"submit",className:"primary",disabled:aa,children:co(aa?"creating":"create")})]})]})]})})}function DraftListPage({onPublish:Un,onClose:Pn,onCountChange:ei,onRecover:co}){const{t:xo}=useI18n(),[os,hs]=reactExports.useState([]),[Ms,ea]=reactExports.useState(new Set),[ta,ra]=reactExports.useState(!1),[na,ia]=reactExports.useState(null),[oa,sa]=reactExports.useState(null),[aa,la]=reactExports.useState(null),ca=reactExports.useRef(null),ua=reactExports.useRef(!0);reactExports.useEffect(()=>(ua.current=!0,listAllDrafts().then(Ca=>{if(!ua.current)return;const wa=Ca.filter(Ea=>!Ea.published);hs(wa),ei==null||ei(wa.length)}),()=>{ua.current=!1,ca.current&&(clearTimeout(ca.current),ca.current=null)}),[]),reactExports.useEffect(()=>{const Ca=wa=>{wa.key==="Escape"&&Pn()};return window.addEventListener("keydown",Ca),()=>window.removeEventListener("keydown",Ca)},[Pn]);const da=reactExports.useCallback((Ca,wa)=>{la({message:Ca,type:wa}),ca.current&&clearTimeout(ca.current),ca.current=setTimeout(()=>la(null),3e3)},[]);async function ha(Ca){await clearDraftPublishError(Ca),ea(wa=>new Set(wa).add(Ca));try{await Un(Ca),hs(wa=>{const Ea=wa.filter(Ta=>Ta.documentId!==Ca);return ei==null||ei(Ea.length),Ea}),da(xo("published"),"success")}catch(wa){wa instanceof DraftPublishAborted||da(xo("publishFailed"),"error");const Ea=await getDraft(Ca);Ea&&hs(Ta=>Ta.map($a=>$a.documentId===Ca?Ea:$a))}finally{ea(wa=>{const Ea=new Set(wa);return Ea.delete(Ca),Ea})}}async function fa(Ca){ia(null),await deleteDraft(Ca),hs(wa=>{const Ea=wa.filter(Ta=>Ta.documentId!==Ca);return ei==null||ei(Ea.length),Ea}),da(xo("draftDeleted"),"success")}function pa(Ca){const wa=os.find(Ea=>Ea.documentId===Ca);wa&&sa(wa)}function ma(Ca){sa(null),deleteDraft(Ca),hs(wa=>{const Ea=wa.filter(Ta=>Ta.documentId!==Ca);return ei==null||ei(Ea.length),Ea}),co==null||co(os.find(wa=>wa.documentId===Ca)),da(xo("published"),"success")}async function ga(){ra(!0);let Ca=0,wa=0;for(const $a of os)try{await Un($a.documentId),Ca++}catch{wa++}const Ta=(await listAllDrafts()).filter($a=>!$a.published);hs(Ta),ei==null||ei(Ta.length),wa===0?da(xo("publishAll"),"success"):da(`${Ca} published, ${wa} failed`,"error"),ra(!1)}const xa=Ca=>new Date(Ca).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),va=Ca=>formatDraftPublishFailureMessage(xo,Ca,Ca.publishError??"UNKNOWN"),ya=os;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-overlay",onClick:Pn}),jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer",role:"dialog","aria-modal":"true",children:[jsxRuntimeExports.jsxs("header",{className:"mdocs-drawer-header",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer-header-text",children:[jsxRuntimeExports.jsxs("h2",{className:"mdocs-drawer-title",children:[xo("unpublishedDrafts"),ya.length>0&&jsxRuntimeExports.jsx("span",{className:"mdocs-drawer-count-badge",children:ya.length})]}),jsxRuntimeExports.jsx("span",{className:"mdocs-drawer-subtitle",children:xo("draftCount",{count:String(ya.length)})})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-drawer-close-btn",onClick:Pn,"aria-label":xo("close"),children:"×"})]}),jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-body",children:ya.length===0?jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer-empty",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-empty-icon","aria-hidden":"true",children:"✓"}),jsxRuntimeExports.jsx("p",{className:"mdocs-drawer-empty-text",children:xo("draftsEmptyState")})]}):jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-items",children:ya.map(Ca=>{const wa=!!Ca.publishError;return jsxRuntimeExports.jsxs("div",{className:wa?"mdocs-drawer-item mdocs-drawer-item-failed":"mdocs-drawer-item",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-item-icon","aria-hidden":"true",children:"📄"}),jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-drawer-item-name",children:Ca.displayName||xo("unknownTitle")}),wa?jsxRuntimeExports.jsxs("span",{className:"mdocs-drawer-item-error",children:[xa(Ca.publishErrorAt)," · ",va(Ca)]}):jsxRuntimeExports.jsxs("span",{className:"mdocs-drawer-item-meta",children:[xa(Ca.updatedAt)," · ",xo("localSnapshot")]})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer-item-actions",children:[wa?jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-btn-ghost mdocs-btn-ghost-primary",disabled:ta,onClick:()=>pa(Ca.documentId),children:xo("recoverDraft")}):jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-btn-ghost mdocs-btn-ghost-primary",disabled:Ms.has(Ca.documentId)||ta,onClick:()=>void ha(Ca.documentId),children:Ms.has(Ca.documentId)?xo("publishing"):xo("publish")}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-btn-ghost mdocs-btn-ghost-danger",disabled:ta,onClick:()=>ia(Ca.documentId),children:xo("delete")})]})]},Ca.documentId)})})}),jsxRuntimeExports.jsxs("footer",{className:"mdocs-drawer-footer",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:Pn,children:xo("close")}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",disabled:ya.length===0||ta,onClick:()=>void ga(),children:ta?xo("publishing"):`${xo("publishAll")} (${ya.length})`})]}),aa&&jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-toast mdocs-drawer-toast--"+aa.type,role:"status",children:aa.message})]}),na&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:Ca=>{Ca.target===Ca.currentTarget&&ia(null)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[jsxRuntimeExports.jsx("h1",{children:xo("delete")}),jsxRuntimeExports.jsx("p",{className:"muted",children:xo("confirmDeleteDraft")}),jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ia(null),children:xo("cancel")}),jsxRuntimeExports.jsx("button",{type:"button",className:"danger",onClick:()=>void fa(na),children:xo("delete")})]})]})}),oa&&jsxRuntimeExports.jsx(RecoveryDialog,{draft:oa,onClose:()=>sa(null),onSuccess:()=>ma(oa.documentId)})]})}function useDomainManagement(){const{t:Un,lang:Pn}=useI18n(),ei=getStoredVisitorId(),co=reactExports.useRef(!1),[xo,os]=reactExports.useState([]),[hs,Ms]=reactExports.useState(!1),[ea,ta]=reactExports.useState(""),[ra,na]=reactExports.useState("restricted"),[ia,oa]=reactExports.useState(!1),[sa,aa]=reactExports.useState(null),[la,ca]=reactExports.useState(null),[ua,da]=reactExports.useState(""),[ha,fa]=reactExports.useState(""),[pa,ma]=reactExports.useState("all"),[ga,xa]=reactExports.useState(null);reactExports.useEffect(()=>(co.current=!0,()=>{co.current=!1}),[]);const va=reactExports.useCallback(async()=>{Ms(!0),aa(null);try{const za=await fetchDomainsApi();if(!co.current)return;os(za)}catch(za){if(!co.current)return;aa(translateError(Un,za))}finally{co.current&&Ms(!1)}},[Un]);reactExports.useEffect(()=>{va()},[va]);async function ya(za){if(za.preventDefault(),!ea.trim()){aa(Un("domainNameRequired"));return}oa(!0),aa(null);try{if(await createDomainApi({domainName:ea.trim(),permission:ra}),!co.current)return;ta(""),na("restricted"),await va()}catch(La){if(!co.current)return;aa(translateError(Un,La))}finally{co.current&&oa(!1)}}async function Ca(za){if(ua.trim()){aa(null);try{if(await renameDomainApi(za,ua.trim()),!co.current)return;ca(null),xa(null),await va()}catch(La){if(!co.current)return;aa(translateError(Un,La))}}}function wa(za){ca(za.domainId),da(za.domainName),xa(null)}function Ea(){ca(null),xa(null)}async function Ta(za,La){aa(null);try{if(await updateDomainPermissionApi(za,La),!co.current)return;xa(null),await va()}catch(Na){if(!co.current)return;aa(translateError(Un,Na))}}async function $a(za){if(window.confirm(Un("deleteDomainConfirmDetail",{name:za.domainName,count:String(za.docCount)}))){aa(null);try{if(await deleteDomainApi(za.domainId),!co.current)return;await va()}catch(La){if(!co.current)return;aa(translateError(Un,La))}}}const Oa=reactExports.useCallback(za=>domainPermissionLabel(za,Un),[Un]),Aa=reactExports.useCallback(za=>localizeDomainName(za.domainName,Pn,Un),[Pn,Un]),Da=reactExports.useMemo(()=>{const za=ha.trim().toLowerCase();return xo.filter(La=>pa!=="all"&&La.permission!==pa?!1:za?localizeDomainName(La.domainName,Pn,Un).toLowerCase().includes(za)||La.domainName.toLowerCase().includes(za):!0)},[xo,ha,pa,Pn,Un]),Ia=reactExports.useCallback((za,La)=>{const Na=Oa(za.permission);return La?`${Na} ${Un("domainTypeBuiltinSuffix")}`:Na},[Oa,Un]);return{domains:xo,loadingDomains:hs,domainError:sa,newDomainName:ea,setNewDomainName:ta,newDomainPermission:ra,setNewDomainPermission:na,creating:ia,handleCreateDomain:ya,renamingId:la,setRenamingId:ca,renameDraft:ua,setRenameDraft:da,startRename:wa,cancelRename:Ea,handleRename:Ca,changeTypeForId:ga,setChangeTypeForId:xa,handlePermissionChange:Ta,handleDelete:$a,domainSearch:ha,setDomainSearch:fa,domainFilter:pa,setDomainFilter:ma,filteredDomains:Da,visitorId:ei,plabel:Oa,localizeDomain:Aa,domainTypeLabel:Ia}}function DomainManagementPanel(){const{t:Un}=useI18n(),Pn=useDomainManagement(),[ei,co]=reactExports.useState([]),[xo,os]=reactExports.useState(null),[hs,Ms]=reactExports.useState(null),ea=reactExports.useCallback(async()=>{try{const ra=await fetchDomainMemberTemplatesApi();co(ra)}catch{co([])}},[]);reactExports.useEffect(()=>{ea()},[ea]);async function ta(ra){os(null);try{const na=await fetchDomainMembersApi(ra.domainId);Ms({domainId:ra.domainId,creatorVisitorId:ra.creatorVisitorId,initialIds:na.map(ia=>ia.visitorId),memberRows:na})}catch(na){os({kind:"err",text:translateError(Un,na)})}}return jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-header",children:jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Un("domainManagement")})}),jsxRuntimeExports.jsx("p",{className:"mdocs-domain-mgmt-restricted-hint",children:Un("domainMgmtRestrictedMemberHint")}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-cards",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card mdocs-domain-mgmt-create",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card-title",children:Un("createDomain")}),jsxRuntimeExports.jsxs("form",{onSubmit:Pn.handleCreateDomain,className:"mdocs-domain-mgmt-create-form",children:[jsxRuntimeExports.jsxs("label",{className:"mdocs-domain-mgmt-field",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-domain-mgmt-label",children:Un("domainName")}),jsxRuntimeExports.jsx("input",{value:Pn.newDomainName,onChange:ra=>Pn.setNewDomainName(ra.target.value),placeholder:Un("domainName"),maxLength:100,disabled:Pn.creating,className:"mdocs-domain-name-input"})]}),jsxRuntimeExports.jsxs("fieldset",{className:"mdocs-domain-mgmt-fieldset",children:[jsxRuntimeExports.jsx("legend",{className:"mdocs-domain-mgmt-label",children:Un("domainPermission")}),jsxRuntimeExports.jsx("div",{className:"mdocs-domain-mgmt-type-radios",children:DOMAIN_PERMISSIONS.map(ra=>jsxRuntimeExports.jsxs("label",{className:"mdocs-domain-mgmt-radio",children:[jsxRuntimeExports.jsx("input",{type:"radio",name:"newDomainPermission",checked:Pn.newDomainPermission===ra,onChange:()=>Pn.setNewDomainPermission(ra),disabled:Pn.creating}),jsxRuntimeExports.jsx("span",{children:Pn.plabel(ra)})]},ra))})]}),jsxRuntimeExports.jsx("button",{type:"submit",className:"primary mdocs-domain-mgmt-submit",disabled:Pn.creating,children:Pn.creating?Un("creating"):Un("create")})]})]}),xo&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",style:{color:xo.kind==="ok"?"var(--mdocs-success, #0a7)":"var(--mdocs-danger)"},children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:xo.text})}),Pn.domainError&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-domain-error",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",style:{color:"var(--mdocs-danger)"},children:Pn.domainError})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card mdocs-domain-mgmt-toolbar",children:[jsxRuntimeExports.jsx("input",{type:"search",value:Pn.domainSearch,onChange:ra=>Pn.setDomainSearch(ra.target.value),placeholder:Un("domainSearchPlaceholder"),className:"mdocs-domain-mgmt-search","aria-label":Un("domainSearchPlaceholder")}),jsxRuntimeExports.jsx("div",{className:"mdocs-domain-mgmt-filters",role:"group","aria-label":Un("domainPermission"),children:["all",...DOMAIN_PERMISSIONS].map(ra=>jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-domain-mgmt-filter"+(Pn.domainFilter===ra?" active":""),"aria-pressed":Pn.domainFilter===ra,onClick:()=>Pn.setDomainFilter(ra),children:ra==="all"?Un("domainFilterAll"):Pn.plabel(ra)},ra))})]}),Pn.loadingDomains?jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("loading")})}):Pn.domains.length===0?jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-settings-draft-empty",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("noDomains")})}):Pn.filteredDomains.length===0?jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-settings-draft-empty",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("domainNoMatch")})}):jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-domain-table-wrap",children:jsxRuntimeExports.jsxs("table",{className:"mdocs-domain-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{scope:"col",children:Un("domainColName")}),jsxRuntimeExports.jsx("th",{scope:"col",children:Un("domainColType")}),jsxRuntimeExports.jsx("th",{scope:"col",className:"mdocs-domain-table-num",children:Un("domainColDocCount")}),jsxRuntimeExports.jsx("th",{scope:"col",children:Un("domainColActions")})]})}),jsxRuntimeExports.jsx("tbody",{children:Pn.filteredDomains.map(ra=>{const na=isDomainCreator(ra,Pn.visitorId),ia=isBuiltInDomainId(ra.domainId),oa=isDomainStructurallyLocked(ra),sa=oa?Un("domainTooltipTypeLocked",{count:String(ra.docCount)}):void 0;return jsxRuntimeExports.jsxs("tr",{className:ia?"mdocs-domain-table-row-builtin":void 0,children:[jsxRuntimeExports.jsx("td",{children:Pn.renamingId===ra.domainId?jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-table-rename",children:[jsxRuntimeExports.jsx("input",{value:Pn.renameDraft,onChange:aa=>Pn.setRenameDraft(aa.target.value),maxLength:100,autoFocus:!0,className:"mdocs-domain-name-input"}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>void Pn.handleRename(ra.domainId),children:Un("save")}),jsxRuntimeExports.jsx("button",{type:"button",onClick:Pn.cancelRename,children:Un("cancel")})]}):jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-table-name-cell",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-domain-table-name",children:Pn.localizeDomain(ra)}),ia&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-badge-builtin",children:Un("domainBuiltIn")}),!na&&!ia&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-badge-shared",children:Un("shared")})]})}),jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsxs("span",{className:"mdocs-domain-table-type",title:sa,children:[jsxRuntimeExports.jsx("span",{className:"mdocs-domain-permission-badge","data-permission":ra.permission,children:Pn.domainTypeLabel(ra,ia)}),oa&&!ia&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-type-lock","aria-hidden":"true",children:"🔒"})]})}),jsxRuntimeExports.jsx("td",{className:"mdocs-domain-table-num",children:ra.docCount}),jsxRuntimeExports.jsxs("td",{className:"mdocs-domain-table-actions",children:[ia&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-not-modifiable",children:Un("domainNotModifiable")}),!ia&&!na&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-not-creator-inline",children:Un("domainNotCreator")}),!ia&&na&&Pn.changeTypeForId===ra.domainId&&jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-change-type-panel",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-domain-permission-select",children:DOMAIN_PERMISSIONS.map(aa=>jsxRuntimeExports.jsx("button",{type:"button",className:ra.permission===aa?"active":"",onClick:()=>void Pn.handlePermissionChange(ra.domainId,aa),children:Pn.plabel(aa)},aa))}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>Pn.setChangeTypeForId(null),children:Un("cancel")})]}),!ia&&na&&Pn.renamingId!==ra.domainId&&Pn.changeTypeForId!==ra.domainId&&jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-action-buttons",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",title:oa?Un("domainLocked"):void 0,onClick:()=>{Pn.setChangeTypeForId(null),Pn.startRename(ra)},disabled:oa,children:Un("rename")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",title:oa?sa:void 0,onClick:()=>{Pn.setRenamingId(null),Pn.setChangeTypeForId(ra.domainId)},disabled:oa,children:Un("domainChangeType")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",title:oa?Un("domainLocked"):void 0,onClick:()=>void Pn.handleDelete(ra),disabled:oa,children:Un("deleteDomain")}),ra.permission==="restricted"&&!ia&&jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>void ta(ra),children:Un("domainMembersManageButton")})]})]})]},ra.domainId)})})]})})]}),jsxRuntimeExports.jsx(VisitorPickerModal,{open:hs!==null,title:Un("domainMembersPickerTitle"),initialSelectedIds:(hs==null?void 0:hs.initialIds)??[],lockedIds:hs?[hs.creatorVisitorId]:[],seedMembers:hs==null?void 0:hs.memberRows,templates:ei,onClose:()=>Ms(null),onConfirm:async ra=>{hs&&(await putDomainMembersApi(hs.domainId,ra),os({kind:"ok",text:Un("domainMembersSaved",{count:String(ra.length)})}))}})]})}function idPrefix6(Un){return Un.length<=6?Un:`${Un.slice(0,6)}…`}function MemberTemplatesPanel(){const{t:Un}=useI18n(),Pn=reactExports.useRef(!0),[ei,co]=reactExports.useState([]),[xo,os]=reactExports.useState(!0),[hs,Ms]=reactExports.useState(null),[ea,ta]=reactExports.useState(1),[ra,na]=reactExports.useState(null),[ia,oa]=reactExports.useState(""),[sa,aa]=reactExports.useState([]),[la,ca]=reactExports.useState(!1),[ua,da]=reactExports.useState(null),[ha,fa]=reactExports.useState(!1),pa=getStoredVisitorId(),[ma,ga]=reactExports.useState([]),[xa,va]=reactExports.useState("idle"),[ya,Ca]=reactExports.useState("");reactExports.useEffect(()=>(Pn.current=!0,()=>{Pn.current=!1}),[]),reactExports.useEffect(()=>{va("loading"),fetchVisitorsDirectoryApi().then(Ga=>{Pn.current&&(ga(Ga),va("ok"))}).catch(()=>{Pn.current&&va("err")})},[]);const wa=reactExports.useMemo(()=>{const Ga=new Map;for(const Ya of ma)Ga.set(Ya.visitorId,Ya.visitorName);return Ga},[ma]),Ea=reactExports.useCallback(async()=>{os(!0),da(null);try{const Ga=await fetchDomainMemberTemplatesApi();Pn.current&&co(Ga)}catch(Ga){Pn.current&&da(translateError(Un,Ga))}finally{Pn.current&&os(!1)}},[Un]);reactExports.useEffect(()=>{Ea()},[Ea]);const Ta=reactExports.useMemo(()=>sa.map(Ga=>{const Ya=ma.find(Ja=>Ja.visitorId===Ga);return{visitorId:Ga,name:Ya?Ya.visitorName:Un("visitorPickerUnknownVisitor"),muted:!Ya}}),[sa,ma,Un]);function $a(Ga){aa(Ya=>Ya.includes(Ga)?Ya.filter(Ja=>Ja!==Ga):[...Ya,Ga])}const Oa=ea===1?ia.trim().length>0:ea===2?sa.length>0:!0;function Aa(){if(!(ea>=3)){if(!Oa){fa(!0);return}fa(!1),ta(ea+1),Ca("")}}function Da(){ea<=1||(fa(!1),ta(ea-1))}function Ia(){Ms(null),na(null),oa(""),aa(pa?[pa]:[]),da(null),ta(1),Ca(""),fa(!1)}function za(Ga){Ms(null),na(Ga.id),oa(Ga.displayName);const Ya=pa&&!Ga.visitorIds.includes(pa)?[...Ga.visitorIds,pa]:[...Ga.visitorIds];aa(Ya),da(null),ta(1),Ca(""),fa(!1)}async function La(){if(!(!ia.trim()||sa.length===0)){ca(!0),da(null);try{if(ra===null?await createDomainMemberTemplateApi({displayName:ia.trim(),visitorIds:sa}):await updateDomainMemberTemplateApi(ra,{displayName:ia.trim(),visitorIds:sa}),!Pn.current)return;Ia(),await Ea()}catch(Ga){if(!Pn.current)return;da(translateError(Un,Ga))}finally{Pn.current&&ca(!1)}}}async function Na(Ga){ca(!0),da(null);try{if(await deleteDomainMemberTemplateApi(Ga),!Pn.current)return;Ms(null),ra===Ga&&Ia(),await Ea()}catch(Ya){if(!Pn.current)return;da(translateError(Un,Ya))}finally{Pn.current&&ca(!1)}}const Wa=[{key:1,label:Un("memberTemplateStepName")},{key:2,label:Un("memberTemplateStepMembers")},{key:3,label:Un("memberTemplateStepSave")}],Ua=`${(ea-1)/2*100}%`;return jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-header",children:[jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Un(ra!==null?"memberTemplateUpdate":"memberTemplateFormNew")}),ra!==null&&jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:Ia,style:{fontSize:12},children:Un("memberTemplateCancelEdit")})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-progress",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-wizard-progress-track",children:jsxRuntimeExports.jsx("div",{className:"mdocs-wizard-progress-fill",style:{width:Ua}})}),jsxRuntimeExports.jsx("div",{className:"mdocs-wizard-progress-steps",children:Wa.map(Ga=>{const Ya=ea===Ga.key,Ja=ea>Ga.key;return jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-step-indicator",children:[jsxRuntimeExports.jsx("div",{className:`mdocs-wizard-step-circle${Ya?" current":""}${Ja?" done":""}`,children:Ja?"✓":Ga.key}),jsxRuntimeExports.jsx("span",{className:`mdocs-wizard-step-label${Ya?" current":""}${Ja?" done":""}`,children:Ga.label})]},Ga.key)})})]}),ua&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-item-desc",style:{color:"var(--mdocs-danger)",marginBottom:12,marginTop:12},children:ua}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-cards",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card mdocs-wizard-card",children:[ea===1&&jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-step-content",children:[jsxRuntimeExports.jsx("input",{className:"mdocs-wizard-name-input",value:ia,onChange:Ga=>oa(Ga.target.value),placeholder:Un("memberTemplateNamePlaceholder"),maxLength:200,disabled:la,autoFocus:!0,"aria-invalid":ha&&!ia.trim()}),ha&&!ia.trim()&&jsxRuntimeExports.jsx("p",{className:"mdocs-wizard-hint",style:{color:"var(--mdocs-danger)"},children:Un("domainNameRequired")})]}),ea===2&&jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-step-content",children:[jsxRuntimeExports.jsx(VisitorPickerContent,{visitors:ma,loadState:xa,searchFilter:ya,onSearchChange:Ca,selectedIds:new Set(sa),onToggle:$a,selectedRows:Ta,myVisitorId:pa}),jsxRuntimeExports.jsx("p",{className:`mdocs-wizard-hint${ha&&sa.length===0?" danger":""}`,children:"💡 "+Un("memberTemplateStep2Hint")})]}),ea===3&&jsxRuntimeExports.jsx("div",{className:"mdocs-wizard-step-content",children:jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-preview-card",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-preview-row",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-label",children:Un("memberTemplateNameLabel")}),jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-value",children:ia})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-preview-row",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-label",children:Un("memberTemplateIdsLabel")}),jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-value",children:Un("memberTemplateSelectedSummary",{count:String(sa.length)})})]}),sa.length>0&&jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-preview-tags",children:[sa.slice(0,15).map(Ga=>jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-tag",children:idPrefix6(Ga)},Ga)),sa.length>15&&jsxRuntimeExports.jsxs("span",{className:"mdocs-wizard-preview-tag mdocs-wizard-preview-tag-more",children:["+",sa.length-15]})]})]})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-footer",children:[jsxRuntimeExports.jsxs("button",{type:"button",className:"secondary",onClick:Da,children:["← ",Un("memberTemplateWizardBack")]}),ea<3?jsxRuntimeExports.jsxs("button",{type:"button",className:"primary",onClick:Aa,children:[Un("memberTemplateWizardNext")," →"]}):jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>void La(),children:Un(la?"saving":ra===null?"memberTemplateCreate":"memberTemplateUpdate")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card-title",children:Un("memberTemplateSavedList")}),xo?jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("loading")}):ei.length===0?jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-empty",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("memberTemplateEmpty")}),ra===null&&jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:Ia,children:Un("memberTemplateEmptyAction")})]}):jsxRuntimeExports.jsx("ul",{className:"mdocs-member-template-list",children:ei.map(Ga=>jsxRuntimeExports.jsx("li",{className:"mdocs-member-template-row",children:hs===Ga.id?jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-confirm-row",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-member-template-confirm-text",children:Un("memberTemplateConfirmDeleteDesc",{name:Ga.displayName})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-confirm-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",style:{color:"var(--mdocs-danger)"},onClick:()=>void Na(Ga.id),children:Un(la?"saving":"memberTemplateConfirmDeleteSubmit")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>Ms(null),children:Un("memberTemplateConfirmDeleteCancel")})]})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-row-head",children:[jsxRuntimeExports.jsx("strong",{children:Ga.displayName}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("memberTemplateCount",{count:String(Ga.visitorIds.length)})}),Ga.visitorIds.length>0&&jsxRuntimeExports.jsx("div",{className:"mdocs-member-template-tags mdocs-member-template-tags-scroll",children:Ga.visitorIds.map(Ya=>jsxRuntimeExports.jsx("span",{className:"mdocs-member-template-tag",children:wa.get(Ya)??idPrefix6(Ya)},Ya))})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-row-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>za(Ga),children:Un("edit")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>Ms(Ga.id),children:Un("memberTemplateDelete")})]})]})},Ga.id))})]})]})]})}const mdocsLogo="/assets/mdocs-logo-Dsv_2t6v.svg";function getBool(Un,Pn){const ei=localStorage.getItem(Un);return ei===null?Pn:ei==="true"}function SettingsPage(Un){const{t:Pn,lang:ei,setLang:co}=useI18n(),{onBack:xo,onPublishDraft:os}=Un,hs=reactExports.useRef(!0);reactExports.useEffect(()=>(hs.current=!0,()=>{hs.current=!1}),[]);const[Ms,ea]=reactExports.useState(()=>getBool("mdocs.autoPublish",!1)),[ta,ra]=reactExports.useState(()=>getBool("mdocs.autoEdit",!0)),[na,ia]=reactExports.useState(!1),[oa,sa]=reactExports.useState("general"),[aa,la]=reactExports.useState([]),[ca,ua]=reactExports.useState(!0),[da,ha]=reactExports.useState(null),[fa,pa]=reactExports.useState(!1),[ma,ga]=reactExports.useState(!1),[xa,va]=reactExports.useState(!1),[ya,Ca]=reactExports.useState(!1),[wa,Ea]=reactExports.useState(null),[Ta,$a]=reactExports.useState(!1),[Oa,Aa]=reactExports.useState(!1),[Da,Ia]=reactExports.useState(!1),[za,La]=reactExports.useState(""),[Na,Wa]=reactExports.useState(!1),[Ua,Ga]=reactExports.useState(!1),[Ya,Ja]=reactExports.useState(0),[Ra,Ma]=reactExports.useState([]),[Fa,Ha]=reactExports.useState(!1),[Ka,Sl]=reactExports.useState(""),[Za,lc]=reactExports.useState([]),[oc,hc]=reactExports.useState(!1),[gc,Rc]=reactExports.useState(""),[Xl,vc]=reactExports.useState([]),[xc,Ac]=reactExports.useState(!1),[kc,uc]=reactExports.useState(null),[fc,Ec]=reactExports.useState(new Map);reactExports.useEffect(()=>{localStorage.setItem("mdocs.autoPublish",String(Ms))},[Ms]),reactExports.useEffect(()=>{localStorage.setItem("mdocs.autoEdit",String(ta))},[ta]),reactExports.useEffect(()=>{oa==="savePublish"&&listAllDrafts().then(Lc=>{hs.current&&Ja(Lc.filter(tu=>!tu.published).length)})},[oa]),reactExports.useEffect(()=>{oa==="bookmarks"&&$c(),oa==="myDocuments"&&jc()},[oa]),reactExports.useEffect(()=>{_c()},[]),reactExports.useEffect(()=>{fetchDomainsApi().then(Lc=>{hs.current&&vc(Lc)}).catch(()=>{})},[]);const Mc=new Map(Xl.map(Lc=>[Lc.domainId,Lc.domainName]));async function _c(){try{ua(!0);const Lc=await listCliTokensApi();if(!hs.current)return;la(Lc)}catch{}finally{hs.current&&ua(!1)}}async function $c(){try{Ha(!0);const Lc=await fetchBookmarksApi();if(!hs.current)return;Ma(Lc)}catch{}finally{hs.current&&Ha(!1)}}async function jc(){try{hc(!0);const Lc=await fetchMyDocumentsApi();if(!hs.current)return;lc(Lc)}catch{}finally{hs.current&&hc(!1)}}async function Vc(Lc){try{await removeBookmarkApi(Lc),Ma(tu=>tu.filter(hu=>hu.documentId!==Lc))}catch{}}function Oc(){if(aa.some(tu=>!tu.revoked)){ga(!0);return}Nc()}async function Nc(){try{pa(!0);const Lc=await createCliTokenApi();ha({token:Lc.token,name:Lc.name}),await _c()}finally{pa(!1)}}async function qc(){try{Ia(!0);const Lc=await generateRecoveryCodeApi();Ea(Lc.recoveryCode)}finally{Ia(!1)}}async function Zc(Lc){Lc.preventDefault();const tu=za.trim();if(!(tu&&tu.length<4))try{Wa(!0),await setPasswordApi(tu),La(""),Ga(!0),setTimeout(()=>Ga(!1),3e3)}finally{Wa(!1)}}async function Wc(Lc){uc(Lc);try{const tu=await getDocumentInvitesApi(Lc),hu=new Map;tu.forEach(Uc=>{hu.set(Uc.visitorId,Uc.permission)}),Ec(hu)}catch{Ec(new Map)}Ac(!0)}async function ou(Lc){if(kc)try{const tu=new Set(Lc.map(Uc=>Uc.visitorId)),hu=new Set(fc.keys());for(const Uc of hu)tu.has(Uc)||await removeDocumentInviteApi(kc,Uc);for(const Uc of Lc)await addDocumentInviteApi(kc,Uc.visitorId,Uc.permission);await jc()}finally{Ac(!1),uc(null)}}const eu=Ra.filter(Lc=>{if(!Ka.trim())return!0;const tu=Ka.toLowerCase();return(Lc.displayName||Lc.relativePath||"").toLowerCase().includes(tu)||(Lc.ownerVisitorName||"").toLowerCase().includes(tu)||(Lc.domainId||"").toLowerCase().includes(tu)}),du=Za.filter(Lc=>{if(!gc.trim())return!0;const tu=gc.toLowerCase();return(Lc.displayName||Lc.relativePath||"").toLowerCase().includes(tu)||(Lc.domainId||"").toLowerCase().includes(tu)});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("aside",{className:"mdocs-sidebar",children:[jsxRuntimeExports.jsx("header",{className:"mdocs-sidebar-header",children:jsxRuntimeExports.jsxs("div",{className:"mdocs-brand",children:[jsxRuntimeExports.jsx("img",{src:mdocsLogo,alt:Pn("brand"),className:"mdocs-brand-logo"}),jsxRuntimeExports.jsx("span",{children:Pn("brand")})]})}),jsxRuntimeExports.jsxs("nav",{className:"mdocs-config-tree",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="general"?" active":""),onClick:()=>sa("general"),children:Pn("general")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="bookmarks"?" active":""),onClick:()=>sa("bookmarks"),children:Pn("bookmarkTitle")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="myDocuments"?" active":""),onClick:()=>sa("myDocuments"),children:Pn("myDocuments")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="domainManagement"?" active":""),onClick:()=>sa("domainManagement"),children:Pn("domainManagement")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="memberTemplates"?" active":""),onClick:()=>sa("memberTemplates"),children:Pn("memberTemplates")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="savePublish"?" active":""),onClick:()=>sa("savePublish"),children:Pn("saveAndPublish")})]}),jsxRuntimeExports.jsx("footer",{className:"mdocs-settings-sidebar-footer",onClick:xo,children:Pn("backToDocs")})]}),jsxRuntimeExports.jsxs("main",{className:"mdocs-main",children:[isDemoMode(),oa==="general"?jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-header",children:jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Pn("general")})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-cards",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsxs("label",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-info",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("language")})}),jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-lang",children:[jsxRuntimeExports.jsx("button",{type:"button",className:ei==="en"?"active":"",onClick:()=>co("en"),children:"EN"}),jsxRuntimeExports.jsx("span",{children:"/"}),jsxRuntimeExports.jsx("button",{type:"button",className:ei==="zh"?"active":"",onClick:()=>co("zh"),children:"中"})]})]})}),jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsxs("label",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("autoEdit")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("autoEditDesc")})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-toggle"+(ta?" active":""),role:"switch","aria-checked":ta,onClick:()=>ra(Lc=>!Lc),children:jsxRuntimeExports.jsx("span",{className:"mdocs-toggle-knob"})})]})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("cliToken")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("cliTokenDesc")}),!ca&&aa.length>0&&jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",style:{marginTop:8,fontSize:"0.85em",opacity:.8},children:aa.map(Lc=>jsxRuntimeExports.jsxs("span",{style:{display:"block"},children:[Lc.name," — ",new Date(Lc.createdAt).toLocaleString()," ",Lc.revoked?`(${Pn("cliTokenRevoked")})`:`(${Pn("cliTokenActive")})`]},Lc.tokenId))})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:Oc,disabled:fa||ca,children:fa?"…":aa.some(Lc=>!Lc.revoked)?Pn("cliTokenReset"):Pn("cliTokenCreate")})]}),da&&jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result mdocs-settings-secret-result--ok",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result-head",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("cliTokenGenerated")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-secret-value",children:da.token})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>{(async()=>{try{await navigator.clipboard.writeText(da.token),Ca(!1),va(!0),window.setTimeout(()=>va(!1),2e3)}catch{va(!1),Ca(!0),window.setTimeout(()=>Ca(!1),3e3)}})()},children:Pn(xa?"cliTokenCopied":"cliTokenCopy")}),jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ha(null),children:Pn("close")})]}),xa&&jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--ok",role:"status",children:["✓ ",Pn("cliTokenCopied")]}),ya&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--err",role:"status",children:Pn("cliTokenCopyFailed")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:"🔑 恢复码"}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:"当 Token 丢失时,可用恢复码找回身份。生成后请立即保存,仅显示一次。"})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:qc,disabled:Da,children:Da?"…":"生成恢复码"})]}),wa&&jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result mdocs-settings-secret-result--warn",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result-head",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:"🔑 你的恢复码"}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",style:{marginTop:8},children:"请立即复制保存,关闭后不可再查看。"}),jsxRuntimeExports.jsx("div",{className:"mdocs-settings-secret-code",children:wa})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>{(async()=>{try{await navigator.clipboard.writeText(wa),Aa(!1),$a(!0),window.setTimeout(()=>$a(!1),2e3)}catch{$a(!1),Aa(!0),window.setTimeout(()=>Aa(!1),3e3)}})()},children:Ta?"已复制":"复制恢复码"}),jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>Ea(null),children:Pn("close")})]}),Ta&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--ok",role:"status",children:"✓ 已复制到剪贴板"}),Oa&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--err",role:"status",children:"复制失败,请手动选中上方内容复制"})]})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-item",children:jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:"🔐 登录密码"}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:"设置密码后,可在其他浏览器或设备用「用户名+密码」登录。"})]})}),jsxRuntimeExports.jsxs("form",{onSubmit:Zc,style:{marginTop:12},children:[jsxRuntimeExports.jsx("input",{type:"password",placeholder:"输入新密码(至少 4 位,留空则清除密码)",value:za,onChange:Lc=>La(Lc.target.value),minLength:0,style:{marginBottom:8}}),Ua&&jsxRuntimeExports.jsx("div",{style:{color:"#4caf50",marginBottom:8,fontSize:"0.875rem"},children:"✓ 密码设置成功"}),jsxRuntimeExports.jsx("button",{type:"submit",className:"secondary",disabled:Na,children:Na?"设置中…":"保存密码"})]})]})]})]}):oa==="bookmarks"?jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-header",children:jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Pn("bookmarkTitle")})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsx("input",{type:"text",className:"mdocs-settings-search",placeholder:Pn("bookmarkSearch"),value:Ka,onChange:Lc=>Sl(Lc.target.value)}),Fa?jsxRuntimeExports.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:Pn("loading")}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:eu.length===0?jsxRuntimeExports.jsx("div",{style:{textAlign:"center",padding:"40px 0",opacity:.6},children:Pn(Ka?"bookmarkNoMatch":"bookmarkEmpty")}):jsxRuntimeExports.jsxs("table",{className:"mdocs-settings-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{children:Pn("bookmarkColTitle")}),jsxRuntimeExports.jsx("th",{children:Pn("bookmarkColDomain")}),jsxRuntimeExports.jsx("th",{children:Pn("bookmarkColAuthor")}),jsxRuntimeExports.jsx("th",{children:Pn("bookmarkColTime")}),jsxRuntimeExports.jsx("th",{style:{textAlign:"right"}})]})}),jsxRuntimeExports.jsx("tbody",{children:eu.map(Lc=>jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{style:{cursor:"pointer",fontWeight:500},onClick:()=>Un.onOpenDocument(Lc.documentId),children:Lc.displayName||Lc.relativePath||"Untitled"}),jsxRuntimeExports.jsx("td",{children:Lc.isDeleted?jsxRuntimeExports.jsx("span",{style:{opacity:.5,fontStyle:"italic"},children:"已删除"}):Mc.get(Lc.domainId||"")||Lc.domainId||"—"}),jsxRuntimeExports.jsx("td",{children:Lc.ownerVisitorName||"—"}),jsxRuntimeExports.jsx("td",{children:new Date(Lc.bookmarkedAt).toLocaleDateString()}),jsxRuntimeExports.jsx("td",{style:{textAlign:"right"},children:jsxRuntimeExports.jsx("button",{type:"button",className:"secondary small",onClick:()=>Vc(Lc.documentId),children:Pn("bookmarkRemove")})})]},Lc.documentId))})]})})]})]}):oa==="myDocuments"?jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-header",children:jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Pn("myDocuments")})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsx("input",{type:"text",className:"mdocs-settings-search",placeholder:"搜索文章…",value:gc,onChange:Lc=>Rc(Lc.target.value)}),oc?jsxRuntimeExports.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:Pn("loading")}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:du.length===0?jsxRuntimeExports.jsx("div",{style:{textAlign:"center",padding:"40px 0",opacity:.6},children:Pn(gc?"myDocumentsNoMatch":"myDocumentsEmpty")}):jsxRuntimeExports.jsxs("table",{className:"mdocs-settings-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{children:Pn("myDocumentsColTitle")}),jsxRuntimeExports.jsx("th",{children:Pn("myDocumentsColDomain")}),jsxRuntimeExports.jsx("th",{children:Pn("myDocumentsColUpdated")}),jsxRuntimeExports.jsx("th",{children:Pn("myDocumentsColCreated")}),jsxRuntimeExports.jsx("th",{colSpan:2})]})}),jsxRuntimeExports.jsx("tbody",{children:du.map(Lc=>jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{style:{cursor:"pointer",fontWeight:500},onClick:()=>Un.onOpenDocument(Lc.documentId),children:Lc.displayName||Lc.relativePath||"Untitled"}),jsxRuntimeExports.jsx("td",{children:Mc.get(Lc.domainId||"")||Lc.domainId||"—"}),jsxRuntimeExports.jsx("td",{children:new Date(Lc.updatedAt).toLocaleDateString()}),jsxRuntimeExports.jsx("td",{children:new Date(Lc.createdAt).toLocaleDateString()}),jsxRuntimeExports.jsx("td",{style:{textAlign:"right"},children:jsxRuntimeExports.jsx("button",{type:"button",className:"secondary small",onClick:()=>Wc(Lc.documentId),children:Pn("docInfoInviteMember")})}),jsxRuntimeExports.jsx("td",{style:{textAlign:"right",paddingLeft:0},children:jsxRuntimeExports.jsx("button",{type:"button",className:"primary small",onClick:()=>Un.onOpenDocument(Lc.documentId),children:Pn("bookmarkOpen")})})]},Lc.documentId))})]})})]})]}):oa==="domainManagement"?jsxRuntimeExports.jsx(DomainManagementPanel,{}):oa==="memberTemplates"?jsxRuntimeExports.jsx(MemberTemplatesPanel,{}):jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-header",children:[jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Pn("saveAndPublish")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:xo,children:Pn("backToDocs")})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-cards",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsxs("label",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("autoSave")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("autoSaveAlwaysOnDesc")})]}),jsxRuntimeExports.jsx("span",{className:"mdocs-toggle active",role:"switch","aria-checked":"true","aria-disabled":"true",style:{opacity:.6,cursor:"not-allowed"},children:jsxRuntimeExports.jsx("span",{className:"mdocs-toggle-knob"})})]})}),jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsxs("label",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("autoPublish")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("autoPublishDesc")})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-toggle"+(Ms?" active":""),role:"switch","aria-checked":Ms,onClick:()=>ea(Lc=>!Lc),children:jsxRuntimeExports.jsx("span",{className:"mdocs-toggle-knob"})})]})}),Ya>0?jsxRuntimeExports.jsxs("button",{className:"mdocs-settings-card mdocs-settings-draft-link",onClick:()=>ia(!0),children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-draft-link-text",children:["📄 ",Pn("viewDrafts")," (",Ya,")"]}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-draft-arrow","aria-hidden":"true",children:"›"})]}):jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-settings-draft-empty",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("noDrafts")})})]})]}),na&&jsxRuntimeExports.jsx(DraftListPage,{onPublish:os,onClose:()=>ia(!1),onCountChange:Ja,onRecover:Un.onRecoverDraft})]}),ma&&jsxRuntimeExports.jsx(ConfirmDialog,{title:Pn("cliToken"),message:Pn("cliTokenResetConfirm"),confirmLabel:Pn("cliTokenReset"),cancelLabel:Pn("cancel"),busy:fa,onConfirm:()=>{ga(!1),Nc()},onCancel:()=>ga(!1)}),jsxRuntimeExports.jsx(VisitorPickerModal,{open:xc,title:Pn("docInfoInviteMember"),initialSelectedIds:[...fc.keys()],initialPermissions:fc,templates:[],showPermissionSelect:!0,permissionOptions:[{value:"read",label:Pn("invitePermissionRead")},{value:"edit",label:Pn("invitePermissionEdit")}],onClose:()=>Ac(!1),onConfirm:Lc=>{ou(Lc)}})]})}function MessageDialog({title:Un,message:Pn,onClose:ei}){const{t:co}=useI18n();return jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:xo=>{xo.target===xo.currentTarget&&ei()},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[Un&&jsxRuntimeExports.jsx("h2",{className:"mdocs-message-dialog-title",children:Un}),jsxRuntimeExports.jsx("p",{className:"mdocs-message-dialog-body",children:Pn}),jsxRuntimeExports.jsx("div",{className:"mdocs-message-dialog-actions",children:jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:ei,children:co("gotIt")})})]})})}function buildLexicalJsonHeading(Un){return JSON.stringify({root:{children:[{children:[{detail:0,format:0,mode:"normal",text:Un,type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"heading",tag:"h1",version:1}],direction:"ltr",type:"root",version:1}})}function joinDocPath(Un,Pn){const ei=Un.trim(),co=Pn.trim();return co?ei?`${ei}/${co}`:co:ei}function collectDocumentPaths(Un,Pn=new Set){for(const ei of Un)ei.type==="document"?Pn.add(ei.path):(ei.descDocumentId&&Pn.add(folderDescPathForFolder(ei.path)),collectDocumentPaths(ei.children,Pn));return Pn}function findFolderIdByPath(Un,Pn){for(const ei of Un){if(ei.type==="folder"&&ei.path===Pn)return ei.documentId;if(ei.type==="folder"){const co=findFolderIdByPath(ei.children,Pn);if(co)return co}}return null}function translateStorageError(Un,Pn){const ei=STORAGE_ERROR_MESSAGE_MAP[Pn];return ei?Un(ei):Pn}function useCreateModal(Un){const{tree:Pn,currentDomainId:ei,selectedCreateParentPath:co,t:xo,onDocCreated:os,refreshTree:hs}=Un,[Ms,ea]=reactExports.useState(null),[ta,ra]=reactExports.useState(null),[na,ia]=reactExports.useState(!1),oa=reactExports.useRef(null);reactExports.useEffect(()=>{if(!Ms)return;const ca=window.setTimeout(()=>{var ua;return(ua=oa.current)==null?void 0:ua.focus()},0);return()=>window.clearTimeout(ca)},[Ms]);function sa(ca){const ua=ca!==void 0;ra(null),ea({kind:"document",parentMode:ua?"fixed":"selection",parentPath:ua?ca:"",draft:"untitled.md"})}function aa(ca){const ua=ca!==void 0;ra(null),ea({kind:"folder",parentMode:ua?"fixed":"selection",parentPath:ua?ca:"",draft:""})}async function la(ca){if(ca.preventDefault(),!Ms)return;ia(!0),ra(null);const ua=collectDocumentPaths(Pn),da=Ms.parentMode==="selection"?co:Ms.parentPath;try{if(Ms.kind==="document"){const ga=parseDisplayNameMarkdownFile(Ms.draft);if(!ga.ok){ra(translateStorageError(xo,ga.message));return}const xa=ga.displayFile,va=xa.replace(/\.md$/i,"");let ya;try{ya=normaliseRelativePathForStorage(joinDocPath(da,xa))}catch(Ea){ra(translateError(xo,Ea));return}if(ua.has(ya)){ra(xo("pathExists"));return}const Ca=da?findFolderIdByPath(Pn,da)??void 0:void 0,wa=await createDocumentApi({fileName:xa,displayName:va,content:buildLexicalJsonHeading(va),domainId:ei,parentId:Ca});await hs(),os(wa),ea(null);return}const ha=parseDisplayNameFolder(Ms.draft);if(!ha.ok){ra(translateStorageError(xo,ha.message));return}const fa=normalisePathSegmentForStorage(ha.display);if(!fa){ra(xo("invalidFolderName"));return}const pa=joinDocPath(da,fa);if(ua.has(pa)){ra(xo("folderExists"));return}const ma=da?findFolderIdByPath(Pn,da)??void 0:void 0;await createFolderApi({name:fa,parentId:ma,domainId:ei}),await hs(),ea(null)}catch(ha){ra(translateError(xo,ha))}finally{ia(!1)}}return{createModal:Ms,setCreateModal:ea,createModalError:ta,createModalBusy:na,createModalInputRef:oa,openNewDocumentModal:sa,openNewFolderModal:aa,submitCreateModal:la}}function ConflictModal({open:Un,onClose:Pn,onResolve:ei}){const{t:co}=useI18n();return Un?jsxRuntimeExports.jsx("div",{className:"mdocs-conflict-modal-root",role:"alertdialog","aria-modal":"true",children:jsxRuntimeExports.jsxs("div",{className:"mdocs-conflict-modal-panel",children:[jsxRuntimeExports.jsx("h2",{className:"mdocs-conflict-modal-title",children:co("conflictTitle")}),jsxRuntimeExports.jsx("p",{className:"mdocs-conflict-modal-body",children:co("conflictBody")}),jsxRuntimeExports.jsxs("div",{className:"mdocs-conflict-modal-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:ei,children:co("conflictResolve")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:Pn,children:co("conflictClose")})]})]})}):null}function CommentsPanel({documentId:Un,visitorId:Pn,visitorName:ei,documentOwnerId:co,onClose:xo}){const[os,hs]=reactExports.useState([]),[Ms,ea]=reactExports.useState(""),[ta,ra]=reactExports.useState(null),[na,ia]=reactExports.useState(!0),[oa,sa]=reactExports.useState(!1),[aa,la]=reactExports.useState(null),[ca,ua]=reactExports.useState(null),[da,ha]=reactExports.useState(360),[fa,pa]=reactExports.useState(80),ma=reactExports.useRef(!1),ga=reactExports.useRef(!1),xa=300,va=80,ya=reactExports.useRef(null);function Ca(){const Wa=ya.current;if(!Wa)return;Wa.style.height="auto";const Ua=Wa.scrollHeight,Ga=Math.min(Math.max(Ua,va),xa);Wa.style.height=`${Ga}px`,pa(Ga)}reactExports.useEffect(()=>{setTimeout(()=>Ca(),0)},[ta]);function wa(Wa){return Pn?Wa.visitorId===Pn||co===Pn:!1}const{rootComments:Ea,repliesByParentId:Ta,totalCount:$a}=reactExports.useMemo(()=>{const Wa=[],Ua=new Map;let Ga=0;for(const Ya of os)Ya.isDeleted||(Ga++,Ya.parentId?(Ua.has(Ya.parentId)||Ua.set(Ya.parentId,[]),Ua.get(Ya.parentId).push(Ya)):Wa.push(Ya));return{rootComments:Wa,repliesByParentId:Ua,totalCount:Ga}},[os]),Oa=reactExports.useRef(Un);reactExports.useEffect(()=>{Oa.current=Un,ea(""),ra(null),ua(null),Aa()},[Un]);async function Aa(){const Wa=Oa.current;ia(!0);try{const Ua=await fetchCommentsApi(Un);if(Oa.current!==Wa)return;hs(Ua.comments)}catch(Ua){if(Oa.current!==Wa)return;ua("加载评论失败"),console.error("Failed to load comments:",Ua)}finally{Oa.current===Wa&&ia(!1)}}async function Da(){var Wa;if(!(!Ms.trim()||!Pn)){sa(!0),ua(null);try{await createCommentApi(Un,{content:Ms,parentId:(ta==null?void 0:ta.commentId)||null,replyToVisitorId:ta?((Wa=os.find(Ua=>Ua.commentId===ta.commentId))==null?void 0:Wa.visitorId)??null:null,replyToVisitorName:(ta==null?void 0:ta.visitorName)||null}),ea(""),ra(null),setTimeout(()=>Ca(),0),await Aa()}catch(Ua){ua(Ua.message||"发表失败,请重试")}finally{sa(!1)}}}async function Ia(Wa){ua(null);try{await deleteCommentApi(Un,Wa),await Aa()}catch(Ua){ua(Ua.message||"删除失败,请重试")}finally{la(null)}}function za(Wa){const Ua=Date.now()-new Date(Wa).getTime(),Ga=Math.floor(Ua/6e4),Ya=Math.floor(Ua/36e5),Ja=Math.floor(Ua/864e5);return Ga<1?"刚刚":Ga<60?`${Ga}分钟前`:Ya<24?`${Ya}小时前`:`${Ja}天前`}function La(Wa){ma.current=!0,Wa.preventDefault()}function Na(Wa){ga.current=!0,Wa.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="row-resize"}return reactExports.useEffect(()=>{function Wa(Ga){if(ma.current){const Ya=Math.max(280,Math.min(600,window.innerWidth-Ga.clientX));ha(Ya)}if(ga.current){const Ya=-Ga.movementY;pa(Ja=>Math.max(60,Math.min(600,Ja+Ya)))}}function Ua(){ma.current=!1,ga.current=!1,document.body.style.userSelect="",document.body.style.cursor=""}return window.addEventListener("mousemove",Wa),window.addEventListener("mouseup",Ua),()=>{window.removeEventListener("mousemove",Wa),window.removeEventListener("mouseup",Ua)}},[]),jsxRuntimeExports.jsxs("div",{className:"mdocs-comments-panel",style:{width:da},children:[jsxRuntimeExports.jsx("div",{className:"mdocs-comments-resize-handle",onMouseDown:La}),jsxRuntimeExports.jsxs("div",{className:"mdocs-comments-header",children:[jsxRuntimeExports.jsxs("h3",{style:{margin:0,fontSize:"1rem",display:"flex",alignItems:"center",gap:6},children:[jsxRuntimeExports.jsx(MessageSquare,{size:18}),"评论 (",$a,")"]}),jsxRuntimeExports.jsx("button",{type:"button",onClick:xo,className:"mdocs-comments-close-btn",children:jsxRuntimeExports.jsx(X$5,{size:18})})]}),ca&&jsxRuntimeExports.jsxs("div",{className:"mdocs-comments-error",children:[ca,jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ua(null),children:jsxRuntimeExports.jsx(X$5,{size:14})})]}),jsxRuntimeExports.jsx("div",{className:"mdocs-comments-list",children:na?jsxRuntimeExports.jsx("div",{className:"mdocs-comments-empty",children:"加载中..."}):Ea.length===0?jsxRuntimeExports.jsx("div",{className:"mdocs-comments-empty",children:"暂无评论,来发表第一条吧~"}):Ea.map(Wa=>jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-root",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-header",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-comment-avatar",children:Wa.visitorName.charAt(0).toUpperCase()}),jsxRuntimeExports.jsx("span",{className:"mdocs-comment-author",children:Wa.visitorName}),jsxRuntimeExports.jsx("span",{className:"mdocs-comment-time",children:za(Wa.createdAt)}),wa(Wa)&&jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>la(Wa.commentId),title:"删除",children:jsxRuntimeExports.jsx(X$5,{size:14})})]}),jsxRuntimeExports.jsx("div",{className:"mdocs-comment-content",children:Wa.content}),Pn&&jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>ra({commentId:Wa.commentId,visitorName:Wa.visitorName}),children:"回复"}),(Ta.get(Wa.commentId)??[]).length>0&&jsxRuntimeExports.jsx("div",{className:"mdocs-comment-replies",children:(Ta.get(Wa.commentId)??[]).map(Ua=>jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-reply",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-header",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-comment-avatar mdocs-comment-avatar-small",children:Ua.visitorName.charAt(0).toUpperCase()}),jsxRuntimeExports.jsx("span",{className:"mdocs-comment-author",children:Ua.visitorName}),Ua.replyToVisitorName&&jsxRuntimeExports.jsxs("span",{className:"mdocs-comment-reply-to",children:["回复 ",Ua.replyToVisitorName]}),jsxRuntimeExports.jsx("span",{className:"mdocs-comment-time",children:za(Ua.createdAt)}),wa(Ua)&&jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>la(Ua.commentId),title:"删除",children:jsxRuntimeExports.jsx(X$5,{size:12})})]}),jsxRuntimeExports.jsx("div",{className:"mdocs-comment-content",children:Ua.content}),Pn&&jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>ra({commentId:Wa.commentId,visitorName:Ua.visitorName}),children:"回复"})]},Ua.commentId))})]},Wa.commentId))}),Pn?jsxRuntimeExports.jsxs("div",{className:"mdocs-comments-input-wrapper",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-comments-input-drag-handle",onMouseDown:Na}),ta&&jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-reply-notice",children:[jsxRuntimeExports.jsxs("span",{children:["回复 ",jsxRuntimeExports.jsx("span",{className:"mdocs-comment-reply-to-name",children:ta.visitorName})]}),jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>ra(null),children:[jsxRuntimeExports.jsx(X$5,{size:14})," 取消"]})]}),jsxRuntimeExports.jsx("textarea",{ref:ya,value:Ms,onChange:Wa=>{ea(Wa.target.value.slice(0,512)),setTimeout(()=>Ca(),0)},placeholder:ta?`回复 ${ta.visitorName}...`:"发表评论...",className:"mdocs-comments-input",style:{height:fa},maxLength:512,onKeyDown:Wa=>{Wa.key==="Enter"&&(Wa.metaKey||Wa.ctrlKey)&&Da()}}),jsxRuntimeExports.jsxs("div",{className:`mdocs-comments-char-count${Ms.length>=460?" mdocs-char-count--warn":""}`,children:[Ms.length,"/512"]}),jsxRuntimeExports.jsx("div",{className:"mdocs-comments-input-actions",children:jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-btn-primary",onClick:Da,disabled:oa||!Ms.trim(),children:oa?"发表中...":"发表"})})]}):jsxRuntimeExports.jsx("div",{className:"mdocs-comments-input-wrapper",style:{textAlign:"center"},children:jsxRuntimeExports.jsx("div",{style:{color:"#666",fontSize:"0.9rem"},children:"请先创建访客身份以发表评论"})}),aa&&jsxRuntimeExports.jsx(ConfirmDialog,{title:"删除评论",message:"确定要删除这条评论吗?",confirmLabel:"删除",danger:!0,onConfirm:()=>Ia(aa),onCancel:()=>la(null)})]})}function useAutoPublish(Un,Pn){const ei=reactExports.useRef(Pn);ei.current=Pn,reactExports.useEffect(()=>{if(!Un)return;const co=3e4,xo=1e4,os=async()=>{const Ms=await listAllDrafts({skipFailed:!0}),ea=Date.now();for(const ta of Ms)if(!ta.published&&!(ea-ta.updatedAt<co))try{await ei.current(ta.documentId)}catch(ra){console.log("[autoPublish] scan publish failed:",ra)}};os();const hs=setInterval(os,xo);return()=>clearInterval(hs)},[Un])}const POLL_MS=1e4;function useDocumentVersion(Un,Pn){const[ei,co]=reactExports.useState(null),[xo,os]=reactExports.useState("up_to_date");return reactExports.useEffect(()=>{if(!Un){co(null),os("up_to_date");return}let Ms=!1;const ea=Un;async function ta(){try{const na=await getDocumentSyncStatusApi(ea,Pn??void 0);if(Ms)return;co(na.headCommitId),os(na.status)}catch{}}ta();const ra=window.setInterval(()=>void ta(),POLL_MS);return()=>{Ms=!0,window.clearInterval(ra)}},[Un,Pn]),{remoteCommitId:ei,syncStatus:xo,syncBehind:!!(Pn&&ei&&Pn!==ei)||xo==="behind"}}const MergeView=reactExports.lazy(()=>__vitePreload(()=>import("./MergeView-BBr64bam.js"),[]).then(Un=>({default:Un.MergeView})));function formatRelativeTime(Un,Pn){try{const ei=new Intl.RelativeTimeFormat(Pn,{numeric:"auto"}),co=Date.now()-new Date(Un).getTime(),xo=Math.floor(co/6e4),os=Math.floor(xo/60),hs=Math.floor(os/24);return hs>30?ei.format(-Math.floor(hs/30),"month"):hs>0?ei.format(-hs,"day"):os>0?ei.format(-os,"hour"):xo>0?ei.format(-xo,"minute"):ei.format(-Math.floor(co/1e3),"second")}catch{return Un.slice(0,10)}}async function initDomainsAndTree(Un,Pn,ei,co){const xo=await fetchDomainsSafe();Pn(xo);const os=localStorage.getItem("mdocs.currentDomainId"),Ms=os&&xo.some(ea=>ea.domainId===os)?os:pickInitialDomainId(xo,Un);ei(Ms),await co(Ms)}function App(){const{t:Un,lang:Pn,setLang:ei}=useI18n(),[co,xo]=reactExports.useState("loading"),[os,hs]=reactExports.useState(()=>localStorage.getItem("mdocs.sidebarCollapsed")==="true"),Ms=()=>{const dc=!os;hs(dc),localStorage.setItem("mdocs.sidebarCollapsed",String(dc))},[ea,ta]=reactExports.useState(!1),[ra,na]=reactExports.useState(0),ia=reactExports.useRef(null),[oa,sa]=reactExports.useState(null),[aa,la]=reactExports.useState(null),[ca,ua]=reactExports.useState(null),[da,ha]=reactExports.useState([]),[fa,pa]=reactExports.useState([]),[ma,ga]=reactExports.useState("default"),{documentId:xa}=useParams(),va=useNavigate(),[ya,Ca]=reactExports.useState(null),[wa,Ea]=reactExports.useState(null),Ta=reactExports.useRef(wa);Ta.current=wa;const[$a,Oa]=reactExports.useState(0),[Aa,Da]=reactExports.useState(null),[Ia,za]=reactExports.useState(!1),[La,Na]=reactExports.useState(!1),[Wa,Ua]=reactExports.useState(!1),Ga=(ya==null?void 0:ya.documentId)??null,{syncBehind:Ya,remoteCommitId:Ja}=useDocumentVersion(Ga,Aa),[Ra,Ma]=reactExports.useState(null);reactExports.useEffect(()=>{if(!La||!ya){Ma(null);return}(async()=>{const dc=await getDraft(ya.documentId);if(dc!=null&&dc.conflict){Ma(dc.conflict);return}if(dc&&Aa&&Ja){const cc=dc.localBaseCommitId??Aa;if(!cc)return;const bc={localBaseCommitId:cc,remoteCommitId:Ja,localSnapshotContent:dc.content};await saveDraftConflict(ya.documentId,{localBaseCommitId:bc.localBaseCommitId,conflictStatus:"diverged",conflict:bc}),Ma(bc)}})()},[La,ya,Aa,Ja]),reactExports.useEffect(()=>{!ya||!Ya||!Wa||getDraft(ya.documentId).then(async dc=>{!dc||dc.conflict||dc.conflictStatus==="publish_conflict"||dc.conflictStatus!=="diverged"&&await saveDraft({...dc,conflictStatus:"diverged"})})},[ya==null?void 0:ya.documentId,Ya,Wa]),reactExports.useEffect(()=>{if(!ya){Da(null);return}let dc=!1;return getDraft(ya.documentId).then(cc=>{dc||(cc&&!cc.published&&cc.localBaseCommitId?Da(cc.localBaseCommitId):Da(ya.headCommitId??null))}),()=>{dc=!0}},[ya==null?void 0:ya.documentId,ya==null?void 0:ya.headCommitId,Wa]);const[Fa,Ha]=reactExports.useState(null),[Ka,Sl]=reactExports.useState(null),[Za,lc]=reactExports.useState(null),[oc,hc]=reactExports.useState(null),[gc,Rc]=reactExports.useState(""),[Xl,vc]=reactExports.useState("docs"),xc=reactExports.useRef(void 0);useAutoPublish(localStorage.getItem("mdocs.autoPublish")==="true",au);async function Ac(dc){var cc;await((cc=xc.current)==null?void 0:cc.call(xc)),dc()}reactExports.useEffect(()=>{kc()},[]),reactExports.useEffect(()=>{if(!Fa)return;const dc=()=>{Ha(null)};return window.addEventListener("pointerdown",dc,!0),()=>window.removeEventListener("pointerdown",dc,!0)},[Fa]),reactExports.useEffect(()=>{const dc=cc=>{var mu,xu;const bc=cc;if(((mu=bc.detail)==null?void 0:mu.status)===409)return;const Hc=(xu=bc.detail)==null?void 0:xu.message;Hc&&Sl(Hc)};return window.addEventListener(MDOCS_API_ERROR_EVENT,dc),()=>window.removeEventListener(MDOCS_API_ERROR_EVENT,dc)},[]);async function kc(){try{const dc=await fetchMe();sa(dc),storeVisitorId(dc.visitorId),await initDomainsAndTree(dc.visitorId,pa,ga,Ec),xo("ready")}catch(dc){if(dc instanceof ApiRequestError&&dc.status===401){xo("needsRegister");return}Sl(translateError(Un,dc)),xo("needsRegister")}}async function uc(dc,cc){const bc=await registerVisitorApi(dc,cc);sa(bc.visitor),la(bc.visitor.visitorId),ua(bc.recoveryCode),storeVisitorId(bc.visitor.visitorId),await initDomainsAndTree(bc.visitor.visitorId,pa,ga,Ec),xo("ready")}async function fc(dc){const cc=await fetchMe();sa(cc),await initDomainsAndTree(cc.visitorId,pa,ga,Ec),xo("ready")}async function Ec(dc){const bc=await fetchTreeApi(dc??ma);ha(bc)}function Mc(dc){Ea({documentId:dc.documentId,content:dc.content,displayName:dc.displayName}),Oa(cc=>cc+1),Ua(!1)}function _c(dc,cc){Ea({documentId:dc,content:cc.content,displayName:cc.displayName}),Oa(bc=>bc+1),Ua(!0)}async function $c(dc,cc){await deleteDraft(dc);const bc=await getDocumentApi(dc);if((ya==null?void 0:ya.documentId)===dc&&ia.current===dc){Ca(documentDetailToMeta(bc)),Ua(!1);const Hc=Ta.current,mu=cc!==void 0&&bc.content===cc,xu=(Hc==null?void 0:Hc.documentId)===dc&&Hc.content===bc.content;mu||xu?(Hc==null?void 0:Hc.documentId)===dc&&Hc.displayName!==bc.displayName&&Ea({...Hc,displayName:bc.displayName}):Mc(bc)}return bc}async function jc(dc){ia.current=dc;try{const cc=await getDraft(dc);if(ia.current!==dc)return;const bc=await getDocumentApi(dc);if(ia.current!==dc||(bc.domainId!==ma&&(localStorage.setItem("mdocs.currentDomainId",bc.domainId),ga(bc.domainId),Ec(bc.domainId)),Rc(parentDirForCreates(bc.relativePath)),bc.headCommitId&&cc&&!cc.published&&(cc.publishError===DRAFT_PUBLISH_ERROR.SYNC_HEAD_MISSING&&await clearDraftPublishError(dc),cc.localBaseCommitId||await saveDraft({...cc,localBaseCommitId:bc.headCommitId})),Ca(documentDetailToMeta(bc)),ia.current!==dc))return;cc&&!cc.published?_c(dc,cc):Mc(bc)}catch(cc){if(ia.current!==dc)return;Sl(translateError(Un,cc))}}reactExports.useEffect(()=>{co==="ready"&&(xa?jc(xa):(Ca(null),Ea(null),Da(null)))},[co,xa]);const{createModal:Vc,setCreateModal:Oc,createModalError:Nc,createModalBusy:qc,createModalInputRef:Zc,openNewDocumentModal:Wc,openNewFolderModal:ou,submitCreateModal:eu}=useCreateModal({tree:da,currentDomainId:ma,selectedCreateParentPath:gc,t:Un,onDocCreated:dc=>{Ca(documentDetailToMeta(dc)),Mc(dc),Rc(parentDirForCreates(dc.relativePath)),va(`/doc/${dc.documentId}`)},refreshTree:Ec}),[du,Lc]=reactExports.useState(!1),[tu,hu]=reactExports.useState(!1),[Uc,Yc]=reactExports.useState([]),[Qc,Xc]=reactExports.useState(""),[ja,qa]=reactExports.useState(""),[Ic,Qa]=reactExports.useState(new Set);async function ac(){try{const dc=await fetchBookmarksApi();Yc(dc)}catch(dc){Sl(translateError(Un,dc))}}const Gc=reactExports.useMemo(()=>{const dc={};for(const cc of fa)dc[cc.domainId]=cc.domainName;return dc},[fa]),Bc=reactExports.useMemo(()=>{let dc=Uc;const cc=Qc.trim().toLowerCase();return cc&&(dc=dc.filter(bc=>{var Hc;return(Hc=bc.displayName)==null?void 0:Hc.toLowerCase().includes(cc)})),ja&&(dc=dc.filter(bc=>bc.domainId===ja)),dc},[Uc,Qc,ja]),iu=reactExports.useMemo(()=>{const dc=new Set,cc=[];for(const bc of Uc){const Hc=bc.domainId;Hc&&!dc.has(Hc)&&(dc.add(Hc),cc.push({id:Hc,name:Gc[Hc]??Hc}))}return cc},[Uc,Gc]);async function gu(dc,cc,bc,Hc,mu){let xu=await getDraft(dc);!xu&&(ya==null?void 0:ya.documentId)===dc&&(xu={documentId:dc,content:cc,displayName:bc,updatedAt:Date.now(),published:!1,localBaseCommitId:Hc,relativePath:ya.relativePath,permission:ya.permission,ownerVisitorId:ya.ownerVisitorId,domainId:ya.domainId},await saveDraft(xu)),xu&&await saveDraftConflict(dc,{localBaseCommitId:Hc,conflictStatus:"publish_conflict",conflict:{localBaseCommitId:Hc,remoteCommitId:mu.headCommitId,localSnapshotContent:cc}}),za(!0)}async function ru(dc,cc,bc,Hc){return getDocumentTaskQueue(bc).execute(async()=>{const mu=await getDraft(bc),xu=(mu==null?void 0:mu.localBaseCommitId)??(ya==null?void 0:ya.headCommitId);if(!xu)throw Sl(Un("syncHeadMissing")),new Error("missing localBaseCommitId");try{await updateDocumentApi(bc,{content:dc,displayName:cc,permission:Hc,version:{localBaseCommitId:xu}}),await clearDraftConflict(bc),await $c(bc,dc),await Ec(),za(!1),Ha(Un("published")),window.setTimeout(()=>Ha(null),1200)}catch(Cu){throw Cu instanceof ApiRequestError&&Cu.status===409&&Cu.code==="VERSION_CONFLICT"&&Cu.details&&typeof Cu.details=="object"&&await gu(bc,dc,cc,xu,Cu.details),Cu}})}async function uu(){if(!ya)return;const dc=await getDocumentApi(ya.documentId);dc.domainId!==ma&&(localStorage.setItem("mdocs.currentDomainId",dc.domainId),ga(dc.domainId),Ec(dc.domainId)),Rc(parentDirForCreates(dc.relativePath)),Ca(documentDetailToMeta(dc)),Mc(dc),Ha(Un("syncPullDone")),window.setTimeout(()=>Ha(null),1200)}async function bu(){if(!ya)return;const dc=await getDraft(ya.documentId);if(dc&&!dc.published)return;if((dc==null?void 0:dc.conflictStatus)==="publish_conflict"||(dc==null?void 0:dc.conflictStatus)==="diverged"||!!(dc!=null&&dc.conflict)){Na(!0);return}await uu()}async function Du(dc){await clearDraftConflict(dc.documentId),await deleteDraft(dc.documentId),Ua(!1),Na(!1),za(!1),await jc(dc.documentId),Ec(dc.domainId),Ha(Un("published")),window.setTimeout(()=>Ha(null),1200)}async function yc(dc,cc,bc){try{await failDraftPublish(dc,cc,bc)}catch(Hc){if(!(Hc instanceof DraftPublishAborted))throw Hc;const mu=bc??await getDraft(dc);throw Ha(formatDraftPublishFailureMessage(Un,mu,Hc.code,Hc.cause??cc)),window.setTimeout(()=>Ha(null),4e3),Hc}}async function au(dc){let cc;try{await getDocumentTaskQueue(dc).execute(async()=>{const bc=await getDraft(dc);if(!bc)return;cc=bc;let Hc=bc.localBaseCommitId;if(Hc||(Hc=(await getDocumentApi(dc)).headCommitId??void 0,Hc&&(await saveDraft({...bc,localBaseCommitId:Hc}),bc.publishError===DRAFT_PUBLISH_ERROR.SYNC_HEAD_MISSING&&await clearDraftPublishError(dc))),!Hc)throw new DraftPublishAborted(DRAFT_PUBLISH_ERROR.SYNC_HEAD_MISSING);const mu=await getDraft(dc);mu&&(await updateDocumentApi(dc,{content:mu.content,displayName:mu.displayName,version:{localBaseCommitId:Hc}}),await clearDraftConflict(dc),await clearDraftPublishError(dc),(ya==null?void 0:ya.documentId)===dc?await $c(dc,mu.content):await deleteDraft(dc),await Ec(),Ha(Un("published")),window.setTimeout(()=>Ha(null),1200))})}catch(bc){await yc(dc,bc,cc)}}function mc(dc,cc){lc({type:"document",id:dc,name:cc})}function yu(dc,cc){lc({type:"folder",id:dc,name:cc})}async function pu(){if(Za)try{Za.type==="document"?(await deleteDocumentApi(Za.id),(ya==null?void 0:ya.documentId)===Za.id&&(Ca(null),Ea(null),Rc(""),va("/"))):Za.type==="folder"&&(await deleteFolderApi(Za.id),ya&&(Ca(null),Ea(null),Rc(""),va("/"))),await Ec(),Ha(Za.type==="folder"?`已删除「${Za.name}」及其下所有内容`:`已删除「${Za.name}」`),window.setTimeout(()=>Ha(null),2e3)}catch(dc){Sl(translateError(Un,dc))}finally{lc(null)}}return co==="loading"?jsxRuntimeExports.jsx("div",{className:"mdocs-loading muted",children:Un("loading")}):co==="needsRegister"?jsxRuntimeExports.jsx(VisitorRegisterDialog,{onSubmit:uc,onRecover:fc,error:Fa}):jsxRuntimeExports.jsxs("div",{className:"mdocs-app-root",children:[isDemoMode(),jsxRuntimeExports.jsxs("div",{className:"mdocs-shell",children:[aa&&oa&&jsxRuntimeExports.jsx(VisitorIdNotice,{visitorId:aa,onDismiss:()=>la(null)}),ca&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",style:{position:"fixed",zIndex:9999},onClick:dc=>{dc.target===dc.currentTarget&&ua(null)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:480,textAlign:"center"},children:[jsxRuntimeExports.jsx("h1",{style:{fontSize:"1.25rem",marginBottom:8},children:"🔑 保存你的恢复码"}),jsxRuntimeExports.jsxs("p",{className:"muted",style:{marginBottom:16,lineHeight:1.5},children:["恢复码是你的唯一凭证,当 Token 丢失时可用它找回身份。",jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("strong",{children:"请立即复制保存,此弹窗关闭后不可再查看。"})]}),jsxRuntimeExports.jsx("div",{style:{background:"#f5f5f5",borderRadius:8,padding:"12px 16px",fontFamily:"monospace",fontSize:"1.25rem",letterSpacing:"0.1em",marginBottom:20,userSelect:"all"},children:ca}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:[jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>{navigator.clipboard.writeText(ca)},children:"复制恢复码"}),jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ua(null),children:"已保存,关闭"})]})]})}),Xl==="settings"?jsxRuntimeExports.jsx(SettingsPage,{onBack:()=>vc("docs"),onPublishDraft:au,onOpenDocument:jc,onRecoverDraft:()=>void Ec()}):jsxRuntimeExports.jsxs("div",{className:"mdocs-layout",children:[jsxRuntimeExports.jsxs("aside",{className:`mdocs-sidebar ${os?"mdocs-sidebar-collapsed":""}`,children:[jsxRuntimeExports.jsxs("header",{className:"mdocs-sidebar-header",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-brand",children:[jsxRuntimeExports.jsx("img",{src:mdocsLogo,alt:Un("brand"),className:"mdocs-brand-logo"}),jsxRuntimeExports.jsx("span",{children:Un("brand")})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-sidebar-toggle",onClick:Ms,"aria-label":Un(os?"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:dc=>{dc.currentTarget.style.background="var(--mdocs-hover-bg, #f0f0f0)"},onMouseLeave:dc=>{dc.currentTarget.style.background="none"},children:os?jsxRuntimeExports.jsx(PanelLeftOpen,{size:18}):jsxRuntimeExports.jsx(PanelLeftClose,{size:18})})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-sidebar-actions",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":Un("newDocument"),onClick:()=>Wc(),style:{color:"var(--mdocs-accent)"},children:jsxRuntimeExports.jsx(File$1,{size:20})}),jsxRuntimeExports.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":Un("newFolder"),onClick:()=>ou(),children:jsxRuntimeExports.jsx(Folder,{size:20})})]}),jsxRuntimeExports.jsx(DocumentTree,{nodes:da,activeDocumentId:xa??null,selectedParentPath:gc,onOpen:dc=>{Ac(()=>va(`/doc/${dc.documentId}`))},onOpenFolder:(dc,cc)=>{Ac(()=>{Rc(dc),cc&&va(`/doc/${cc}`)})},onContextMenu:hc,onDeselect:()=>{Ac(()=>{Rc(""),va("/")})}}),jsxRuntimeExports.jsxs("footer",{className:"mdocs-sidebar-footer",children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,cursor:"pointer"},onClick:()=>Ac(()=>vc("settings")),children:[jsxRuntimeExports.jsx("span",{className:"mdocs-visitor-avatar",children:oa?oa.visitorName.charAt(0).toUpperCase():"?"}),jsxRuntimeExports.jsx("span",{className:"mdocs-visitor-footer-name",children:oa?oa.visitorName:""})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-sidebar-bookmark mdocs-tooltip","data-tooltip":Un("bookmark"),onClick:()=>{hu(!0),Xc(""),qa(""),ac()},style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",fontSize:"1rem",lineHeight:1,borderRadius:4},children:jsxRuntimeExports.jsx(Star,{size:16,strokeWidth:1.5})}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-sidebar-logout mdocs-tooltip","data-tooltip":Un("logout"),onClick:()=>Lc(!0),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4},children:jsxRuntimeExports.jsx(LogOut,{size:16,strokeWidth:1.5})})]})]}),jsxRuntimeExports.jsxs("main",{className:"mdocs-main",children:[ya&&wa&&wa.documentId===ya.documentId?jsxRuntimeExports.jsxs("div",{className:"mdocs-editor-with-comments",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-editor-container",children:jsxRuntimeExports.jsx(DocumentEditor,{meta:ya,initialContent:wa.content,initialDisplayName:wa.displayName,contentRevision:$a,canEdit:!!(oa&&(ya.ownerVisitorId===oa.visitorId||isPublicWritePermission(ya.permission)||ya.invitedEdit===!0)),domains:fa,currentDomainId:ma,onDomainChange:dc=>{Ac(()=>{localStorage.setItem("mdocs.currentDomainId",dc),ga(dc),Ca(null),Ea(null),Rc(""),va("/"),Ec(dc)})},onDomainsChange:pa,onPublish:ru,syncBehind:Ya,onSyncClick:()=>void bu(),onDraftExistsChange:Ua,onConflictModalRequest:()=>za(!0),onMergeRequest:()=>Na(!0),canManageInvites:!!(oa&&oa.visitorId===ya.ownerVisitorId),onDelete:async()=>{if(ya.relativePath.endsWith("/___desc___.md")){const dc=ya.relativePath.replace(/\/___desc___\.md$/,"");yu(ya.documentId,dc)}else mc(ya.documentId,ya.relativePath)},saveBeforeNavRef:xc,onShowToast:Ha,onToggleComments:()=>ta(!ea),commentPanelOpen:ea,commentCount:ra},ya.documentId)}),ea&&jsxRuntimeExports.jsx(CommentsPanel,{documentId:ya.documentId,visitorId:oa==null?void 0:oa.visitorId,visitorName:oa==null?void 0:oa.visitorName,documentOwnerId:ya.ownerVisitorId,onClose:()=>ta(!1)})]}):jsxRuntimeExports.jsxs("div",{className:"mdocs-welcome",children:[jsxRuntimeExports.jsx("h1",{children:Un("brand")}),jsxRuntimeExports.jsx("p",{className:"muted mdocs-welcome-lead",children:da.length===0?Un("noDocsInDomain"):Un("createDocToStart")}),jsxRuntimeExports.jsxs("div",{className:"mdocs-welcome-domain",children:[jsxRuntimeExports.jsx("label",{className:"muted mdocs-welcome-domain-label",children:Un("domainLabel")}),jsxRuntimeExports.jsx(DomainSelect,{domains:fa.length?fa:[{domainId:"default",domainName:Un("defaultDomain"),permission:"",creatorVisitorId:"",docCount:0}],value:ma,onChange:dc=>{Ac(()=>{localStorage.setItem("mdocs.currentDomainId",dc),ga(dc),Ca(null),Ea(null),Rc(""),va("/"),Ec(dc)})},onDomainsChange:pa,ariaLabel:Un("domainLabel"),localizeName:dc=>localizeDomainName(dc,Pn,Un)})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-welcome-actions",children:[jsxRuntimeExports.jsxs("button",{type:"button",className:"primary",onClick:()=>Wc(),style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntimeExports.jsx(File$1,{size:16,strokeWidth:1.5}),Un("newDocument")]}),jsxRuntimeExports.jsxs("button",{type:"button",className:"secondary",onClick:()=>ou(),style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntimeExports.jsx(Folder,{size:16,strokeWidth:1.5}),Un("newFolder")]})]})]}),jsxRuntimeExports.jsx(ConflictModal,{open:Ia,onClose:()=>za(!1),onResolve:()=>{za(!1),Na(!0)}}),La&&ya&&Ra&&jsxRuntimeExports.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports.jsx("div",{className:"merge-view-loading",children:Un("mergeLoadingRemote")}),children:jsxRuntimeExports.jsx(MergeView,{documentId:ya.documentId,displayName:ya.displayName,conflict:Ra,onClose:()=>Na(!1),onSuccess:Du,onError:dc=>Sl(dc)})}),Fa&&jsxRuntimeExports.jsx("div",{className:"mdocs-toast",role:"status",children:Fa}),Ka&&jsxRuntimeExports.jsx(MessageDialog,{title:Un("error"),message:Ka,onClose:()=>Sl(null)})]}),du&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",onClick:dc=>{dc.target===dc.currentTarget&&Lc(!1)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:440},children:[jsxRuntimeExports.jsx("h1",{style:{fontSize:"1.125rem",marginBottom:8},children:"退出当前登录身份?"}),jsxRuntimeExports.jsx("p",{style:{lineHeight:1.6,color:"var(--mdocs-text-secondary, #666)",marginBottom:20},children:"这将会导致您无法修改以前的文章。如果想找回账号,需要恢复码或联系管理员执行合并用户脚本。"}),jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end"},children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>Lc(!1),children:"取消"}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",style:{background:"#d32f2f"},onClick:()=>{clearVisitorId(),Ca(null),Ea(null),sa(null),ha([]),Lc(!1),xo("needsRegister")},children:"确认退出"})]})]})}),tu&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",onClick:dc=>{dc.target===dc.currentTarget&&hu(!1)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:640,width:"min(640px, 100%)",maxHeight:"70vh",display:"flex",flexDirection:"column"},children:[jsxRuntimeExports.jsxs("h1",{style:{fontSize:"1.125rem",marginBottom:16},children:[Un("bookmarkTitle"),"(",Uc.length,")"]}),Uc.length>0&&jsxRuntimeExports.jsxs("div",{className:"mdocs-bookmark-filterbar",children:[jsxRuntimeExports.jsx("input",{type:"text",placeholder:Un("bookmarkSearch"),value:Qc,onChange:dc=>Xc(dc.target.value)}),jsxRuntimeExports.jsxs("select",{value:ja,onChange:dc=>qa(dc.target.value),children:[jsxRuntimeExports.jsx("option",{value:"",children:Un("bookmarkFilterAll")}),iu.map(dc=>jsxRuntimeExports.jsx("option",{value:dc.id,children:dc.name},dc.id))]})]}),Uc.length===0?jsxRuntimeExports.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:Un("bookmarkEmpty")}):Bc.length===0?jsxRuntimeExports.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:Un("bookmarkNoMatch")}):jsxRuntimeExports.jsx("div",{style:{overflowY:"auto",flex:1,margin:"0 -1rem",padding:"0 1rem"},children:jsxRuntimeExports.jsxs("table",{className:"mdocs-bookmark-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{children:Un("bookmarkColTitle")}),jsxRuntimeExports.jsx("th",{children:Un("bookmarkColDomain")}),jsxRuntimeExports.jsx("th",{children:Un("bookmarkColAuthor")}),jsxRuntimeExports.jsx("th",{children:Un("bookmarkColTime")}),jsxRuntimeExports.jsx("th",{className:"mdocs-bookmark-col-action"})]})}),jsxRuntimeExports.jsx("tbody",{children:Bc.map(dc=>{const cc=Ic.has(dc.documentId);return jsxRuntimeExports.jsxs("tr",{className:`${cc?"mdocs-bookmark-removing":""}`,style:{opacity:dc.isDeleted?.6:1},children:[jsxRuntimeExports.jsx("td",{className:"mdocs-bookmark-col-title",children:jsxRuntimeExports.jsxs("div",{style:{cursor:dc.isDeleted?"default":"pointer",display:"flex",alignItems:"center",gap:6,overflow:"hidden"},onClick:()=>{dc.isDeleted||Ac(()=>{hu(!1),va(`/doc/${dc.documentId}`)})},children:[jsxRuntimeExports.jsx("span",{ref:bc=>{if(bc){const Hc=bc.scrollWidth>bc.clientWidth;bc.title=Hc?dc.displayName??"":""}},style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:dc.displayName??"(无标题)"}),dc.isDeleted&&jsxRuntimeExports.jsx("span",{style:{fontSize:"0.7rem",color:"#d32f2f",background:"#ffebee",padding:"1px 6px",borderRadius:4,flexShrink:0},children:"已删除"})]})}),jsxRuntimeExports.jsx("td",{children:dc.isDeleted?"":Gc[dc.domainId??""]??dc.domainId??""}),jsxRuntimeExports.jsx("td",{children:dc.isDeleted?"":dc.ownerVisitorName??"-"}),jsxRuntimeExports.jsx("td",{children:dc.isDeleted?"":formatRelativeTime(dc.bookmarkedAt,Pn)}),jsxRuntimeExports.jsx("td",{className:"mdocs-bookmark-col-action",children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:2,alignItems:"center",justifyContent:"flex-end"},children:[jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":Un("bookmarkOpen"),onClick:()=>{dc.isDeleted||Ac(()=>{hu(!1),va(`/doc/${dc.documentId}`)})},style:{background:"none",border:"none",cursor:dc.isDeleted?"default":"pointer",padding:"4px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4,display:"inline-flex",alignItems:"center"},children:jsxRuntimeExports.jsx(BookOpen,{size:14,strokeWidth:1.5})}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":Un("bookmarkRemove"),onClick:async()=>{try{await removeBookmarkApi(dc.documentId),Qa(bc=>new Set(bc).add(dc.documentId)),setTimeout(()=>{Yc(bc=>bc.filter(Hc=>Hc.documentId!==dc.documentId)),Qa(bc=>{const Hc=new Set(bc);return Hc.delete(dc.documentId),Hc})},300)}catch(bc){Sl(translateError(Un,bc))}},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:bc=>{bc.currentTarget.style.color="#d32f2f"},onMouseLeave:bc=>{bc.currentTarget.style.color="var(--mdocs-text-muted, #999)"},children:"✕"})]})})]},dc.documentId)})})]})}),jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end",marginTop:16,paddingTop:16,borderTop:"1px solid var(--mdocs-border, #eee)"},children:jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>hu(!1),children:Un("close")})})]})}),oc&&jsxRuntimeExports.jsx(TreeContextMenu,{x:oc.x,y:oc.y,node:oc.node,parentPath:oc.parentPath,onClose:()=>hc(null),onCreateChild:dc=>Wc(dc),onCreateFolder:dc=>ou(dc),onDeleteDocument:dc=>mc(dc.documentId,dc.path),onDeleteFolder:dc=>yu(dc.documentId,dc.folderDisplayName||dc.name)}),Za&&jsxRuntimeExports.jsx(ConfirmDialog,{title:Za.type==="folder"?"删除文件夹":"删除文档",message:Za.type==="folder"?`确定要删除「${Za.name}」及其下的所有文档和子文件夹吗?此操作不可撤销。`:`确定要删除「${Za.name}」吗?`,confirmLabel:"删除",cancelLabel:"取消",onConfirm:pu,onCancel:()=>lc(null),danger:!0}),Vc&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:dc=>{dc.target===dc.currentTarget&&!qc&&Oc(null)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[jsxRuntimeExports.jsx("h1",{children:Vc.kind==="document"?Un("newDocumentTitle"):Un("newFolderTitle")}),jsxRuntimeExports.jsx("p",{className:"muted",children:Vc.kind==="document"?Un("fileNameHint"):Un("folderNameHint")}),jsxRuntimeExports.jsxs("form",{onSubmit:eu,className:"mdocs-dialog-form",children:[jsxRuntimeExports.jsxs("label",{className:"mdocs-dialog-label",children:[Vc.kind==="document"?Un("fileNameLabel"):Un("folderNameLabel"),jsxRuntimeExports.jsx("input",{ref:Zc,value:Vc.draft,onChange:dc=>Oc(cc=>cc&&{...cc,draft:dc.target.value}),placeholder:Vc.kind==="document"?Un("untitledPlaceholder"):Un("folderExamplePlaceholder"),maxLength:200,disabled:qc})]}),Nc&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-error",children:Nc}),jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>!qc&&Oc(null),disabled:qc,children:Un("cancel")}),jsxRuntimeExports.jsx("button",{type:"submit",className:"primary",disabled:qc,children:Un(qc?"creating":"create")})]})]})]})})]})]})]})}const PlaygroundContainer=({children:Un,json:Pn,markdown:ei,collapsible:co=!1,defaultActiveKey:xo=["editor","text","json"],onJSONChange:os})=>{const[hs,Ms]=reactExports.useState(Pn),ea=reactExports.useRef(Pn);reactExports.useEffect(()=>{Pn!==ea.current&&(Ms(Pn),ea.current=Pn)},[Pn]);const ta=reactExports.useCallback(ra=>{ea.current=ra,Ms(ra)},[]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ToastHost,{}),jsxRuntimeExports.jsx(Collapse$1,{collapsible:co,defaultActiveKey:xo,items:[{children:Un,key:"editor",label:"Playground"},{children:jsxRuntimeExports.jsx(Highlighter$1,{language:"markdown",style:{fontSize:12,padding:16},variant:"borderless",children:ei}),key:"text",label:"Text Output"},{children:jsxRuntimeExports.jsx(CodeEditor,{language:"json",onBlur:()=>{if(Pn!==ea.current)try{const ra=JSON.parse(ea.current||"");os==null||os(ra)}catch(ra){console.error("Invalid JSON:",ra)}},onValueChange:ta,value:hs,variant:"borderless"}),key:"json",label:"JSON Output"}],padding:{body:0},style:{border:"none",borderRadius:0,width:"100%"},variant:"outlined"})]})},root={children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"Welcome to the Lobe Editor Demo!",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h1"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"In case you were wondering what the black box at the bottom is – it's the debug view, showing the current state of the editor. You can disable it by pressing on the settings control in the bottom-left of your screen and toggling the debug view setting.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"quote",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"The playground is a demo environment built with ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"@lobehub/editor",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:". Try typing in ",type:"text",version:1},{detail:0,format:1,mode:"normal",style:"",text:"some text",type:"text",version:1},{detail:0,format:0,mode:"normal",style:"",text:" with ",type:"text",version:1},{detail:0,format:2,mode:"normal",style:"",text:"different formats",type:"text",version:1},{detail:0,format:0,mode:"normal",style:"",text:".",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"Visit the ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Lobe Editor website",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:"noreferrer",target:null,title:null,url:"https://editor.lobehub.com"},{detail:0,format:0,mode:"normal",style:"",text:" for documentation and more information.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Check out the code on our ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"GitHub repository",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:"https://github.com/lobehub/lobe-editor",url:"https://github.com/lobehub/lobe-editor"},{detail:0,format:0,mode:"normal",style:"",text:".",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:2},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Playground code ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Playground code",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:"noreferrer",target:null,title:null,url:"https://github.com/lobehub/lobe-editor/blob/master/src/react/Editor/demos/index.tsx"},{detail:0,format:0,mode:"normal",style:"",text:" can be found here.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:3},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Join our ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Discover Server",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:"https://discord.gg/AYFPHvv2jT",url:"https://discord.gg/AYFPHvv2jT"},{detail:0,format:0,mode:"normal",style:"",text:" and chat with the team.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:4}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"bullet",start:1,tag:"ul"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Lastly, we're constantly adding cool new features to this playground. So make sure you check back here when you next get a chance 🙂.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""},{children:[{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"import",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"{",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-error);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:"Editor",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-error);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"}",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"from",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"'",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-success);",text:"@lobehub/editor",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"'",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:";",type:"code-highlight",version:1}],direction:null,format:"",indent:0,type:"code",version:1,language:"typescript",theme:"lobe-theme"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""}],direction:"ltr",format:"",indent:0,type:"root",version:1},content={root};function debounce(Un,Pn){let ei;const co=(...xo)=>{ei!==void 0&&clearTimeout(ei),ei=setTimeout(()=>Un(...xo),Pn)};return co.cancel=()=>{ei!==void 0&&(clearTimeout(ei),ei=void 0)},co}window.__scrollIntoView=scrollIntoView;const PlaygroundEditor=Un=>{const Pn=useEditor(),ei=reactExports.useRef([]),[co,xo]=reactExports.useState(""),[os,hs]=reactExports.useState(""),Ms=reactExports.useMemo(()=>debounce(ia=>{const oa=ia.getDocument("markdown"),sa=ia.getDocument("json");hs(oa||""),xo(JSON.stringify(sa||{},null,2))},200),[]),ea=reactExports.useMemo(()=>debounce(ia=>{Pn&&(console.info("handleJSONChange",ia),Pn.setDocument("json",ia))},200),[Pn]),ta=ia=>{window.editor=ia,Ms(ia)};reactExports.useEffect(()=>()=>{for(const ia of ei.current)URL.revokeObjectURL(ia);ei.current=[],Ms.cancel(),ea.cancel(),delete window.editor,delete window.__scrollIntoView},[Ms,ea]);const ra=reactExports.useMemo(()=>[{icon:jsxRuntimeExports.jsx(Avatar,{avatar:"💻",size:24}),key:"bot1",label:"前端研发专家",metadata:{id:"bot1"}},{icon:jsxRuntimeExports.jsx(Avatar,{avatar:"🌍",size:24}),key:"bot2",label:"中英文互译助手",metadata:{id:"bot2"}},{icon:jsxRuntimeExports.jsx(Avatar,{avatar:"📖",size:24}),key:"bot3",label:"学术写作增强专家",metadata:{id:"bot3"}}],[]),na=reactExports.useMemo(()=>[{icon:Heading1,key:"h1",label:"Heading 1",onSelect:oa=>{oa.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h1"})}},{icon:Heading2,key:"h2",label:"Heading 2",onSelect:oa=>{oa.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h2"})}},{icon:Heading3,key:"h3",label:"Heading 3",onSelect:oa=>{oa.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h3"})}},{type:"divider"},{icon:Minus,key:"hr",label:"Hr",onSelect:oa=>{oa.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND,{})}},{icon:Table2,key:"table",label:"Table",onSelect:oa=>{oa.dispatchCommand(INSERT_TABLE_COMMAND,{columns:"3",rows:"3"})}},{icon:Sigma,key:"tex",label:"Tex",onSelect:oa=>{oa.dispatchCommand(INSERT_MATH_COMMAND,{code:"x^2 + y^2 = z^2"}),queueMicrotask(()=>{oa.focus()})}},{type:"divider"},{key:"file",label:"File",onSelect:oa=>{openFileSelector(sa=>{for(const aa of sa)oa.dispatchCommand(INSERT_FILE_COMMAND,{file:aa})})}},{key:"set-text-content",label:"SetTextContent",onSelect:oa=>{oa.setDocument("text",`123
6221
- 123`),queueMicrotask(()=>{oa.focus()})}},{key:"insert-link",label:"InsertLink",onSelect:oa=>{oa.dispatchCommand(INSERT_LINK_COMMAND,{url:"https://example.com"}),queueMicrotask(()=>{oa.focus()})}},{key:"insert-codeInline",label:"InsertCodeInline",onSelect:oa=>{oa.dispatchCommand(INSERT_CODEINLINE_COMMAND,void 0),queueMicrotask(()=>{oa.focus()})}},{key:"insert-codeBlock",label:"InsertCodeBlock",onSelect:oa=>{oa.dispatchCommand(INSERT_CODEMIRROR_COMMAND,void 0),queueMicrotask(()=>{oa.focus()})}},{icon:Workflow,key:"meta2d",label:"Meta2d",onSelect:oa=>{oa.dispatchCommand(INSERT_META2D_COMMAND,void 0),queueMicrotask(()=>{oa.focus()})}}].map(oa=>oa.type==="divider"?oa:{...oa,extra:jsxRuntimeExports.jsx(Text$3,{code:!0,fontSize:12,type:"secondary",children:oa.key})}),[]);return jsxRuntimeExports.jsxs(PlaygroundContainer,{json:co,markdown:os,onJSONChange:ea,...Un,children:[jsxRuntimeExports.jsx(Toolbar,{editor:Pn}),jsxRuntimeExports.jsx(Editor,{className:"mdocs-playground-editor",content,editor:Pn,lineEmptyPlaceholder:"Start typing here...",mentionOption:{items:ra,markdownWriter:ia=>{var oa;return`
6235
+ `}));function openFileSelector(Un,Pn="*/*"){if(typeof document>"u")return;const ei=document.createElement("input");ei.type="file",ei.accept=Pn,ei.multiple=!1;const co=setTimeout(()=>ei.remove(),5e3);ei.onchange=xo=>{var hs;clearTimeout(co);const os=(hs=xo.target)==null?void 0:hs.files;os&&os.length>0&&Un(os),ei.remove()},ei.oncancel=()=>{clearTimeout(co),ei.remove()},ei.click()}function insertParagraphAtStart(Un){const Pn=Un.getLexicalEditor();Pn&&(Pn.update(()=>{const ei=zo(),co=Vi(),xo=ei.getFirstChild();xo?xo.insertBefore(co):ei.append(co),co.selectStart()}),Un.focus())}function insertParagraphAtEnd(Un){const Pn=Un.getLexicalEditor();Pn&&(Pn.update(()=>{const ei=zo(),co=Vi();ei.append(co),co.selectStart()}),Un.focus())}function getFormatItems(Un,Pn){return[{active:Un.isBold,icon:Bold,key:"bold",label:"Bold",onClick:Un.bold,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Bold).keys}},{active:Un.isItalic,icon:Italic,key:"italic",label:"Italic",onClick:Un.italic,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Italic).keys}},{active:Un.isUnderline,icon:Underline,key:"underline",label:"Underline",onClick:Un.underline,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Underline).keys}},{active:Un.isStrikethrough,icon:Strikethrough,key:"strikethrough",label:"Strikethrough",onClick:Un.strikethrough,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Strikethrough).keys}},{type:"divider"},{active:!!Un.textColor,editor:Pn,key:"textColor",label:"Text Color",onChange:Un.setTextColor,type:"colorPicker",value:Un.textColor},{active:!!Un.bgColor,defaultColor:"#ffffff",editor:Pn,icon:Highlighter,key:"bgColor",label:"Background Color",onChange:Un.setBgColor,type:"colorPicker",value:Un.bgColor}]}const Toolbar=({editor:Un,floating:Pn,outlineCollapseTitle:ei,outlineExpandTitle:co,outlineToggle:xo,style:os,className:hs})=>{const Ms=useEditorState(Un),ea=useOutlineActionItem({collapseTitle:ei,expandTitle:co}),ta=reactExports.useMemo(()=>[{disabled:!Ms.canUndo,icon:Undo2,key:"undo",label:"Undo",onClick:Ms.undo,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Undo).keys}},{disabled:!Ms.canRedo,icon:Redo2,key:"redo",label:"Redo",onClick:Ms.redo,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Redo).keys}},{icon:ArrowUpToLine,key:"insertLineTop",label:"Insert line at top",onClick:()=>insertParagraphAtStart(Un)},{icon:ArrowDownToLine,key:"insertLineBottom",label:"Insert line at end",onClick:()=>insertParagraphAtEnd(Un)},{type:"divider"},...getFormatItems(Ms,Un),{type:"divider"},{icon:List,key:"bulletList",label:"Bullet List",onClick:Ms.bulletList,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.BulletList).keys}},{icon:ListOrdered,key:"numberlist",label:"Number list",onClick:Ms.numberList,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.NumberList).keys}},{icon:ListTodo,key:"tasklist",label:"Task list",onClick:Ms.checkList},{type:"divider"},{active:Ms.isBlockquote,icon:MessageSquareQuote,key:"blockquote",label:"Blockquote",onClick:Ms.blockquote},{icon:Link,key:"link",label:"Link",onClick:Ms.insertLink,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.Link).keys}},{icon:Sigma,key:"math",label:"TeX",onClick:Ms.insertMath},{type:"divider"},{active:Ms.isCode,icon:CodeXml,key:"code",label:"Code",onClick:Ms.code,tooltipProps:{hotkey:getHotkeyById(HotkeyEnum.CodeInline).keys}},{active:Ms.isCodeblock,icon:SquareDashedBottomCode,key:"codeblock",label:"Codeblock",onClick:Ms.codeblock},Ms.isCodeblock&&{children:jsxRuntimeExports.jsx(CodeLanguageSelect,{onSelect:na=>{console.log(na),Ms.updateCodeblockLang(na)},value:Ms.codeblockLang}),disabled:!Ms.isCodeblock,key:"codeblockLang"},{type:"divider"},{icon:Image$1,key:"image",label:"Image",onClick:()=>{openFileSelector(na=>{for(const ia of na)Un.dispatchCommand(INSERT_IMAGE_COMMAND,{file:ia})},"image/*")}},{icon:FileUp,key:"file",label:"File",onClick:()=>{openFileSelector(na=>{for(const ia of na)Un.dispatchCommand(INSERT_FILE_COMMAND,{file:ia})})}},...xo&&ea?[{type:"divider"},ea]:[]].filter(Boolean),[Un,Ms,ea,xo]),ra=reactExports.useMemo(()=>[...getFormatItems(Ms,Un),...xo&&ea?[{type:"divider"},ea]:[]],[Un,Ms,ea,xo]);return Pn?jsxRuntimeExports.jsx(FloatActions,{items:ra}):jsxRuntimeExports.jsx("div",{className:["mdocs-toolbar",hs].filter(Boolean).join(" "),style:os,children:jsxRuntimeExports.jsx(ChatInputActions,{items:ta})})};function DomainSelect({domains:Un,value:Pn,onChange:ei,ariaLabel:co,localizeName:xo,onDomainsChange:os}){const[hs,Ms]=reactExports.useState(!1),[ea,ta]=reactExports.useState(Un),ra=reactExports.useRef(null),na=reactExports.useRef(null);reactExports.useEffect(()=>{ta(Un)},[Un]);const ia=ea.find(la=>la.domainId===Pn),oa=(ia==null?void 0:ia.permission)==="private";reactExports.useEffect(()=>{if(!hs)return;const la=ca=>{var ua,da;!((ua=ra.current)!=null&&ua.contains(ca.target))&&!((da=na.current)!=null&&da.contains(ca.target))&&Ms(!1)};return document.addEventListener("mousedown",la),()=>document.removeEventListener("mousedown",la)},[hs]),reactExports.useEffect(()=>{if(!hs)return;const la=ca=>{var ua;ca.key==="Escape"&&(Ms(!1),(ua=ra.current)==null||ua.focus())};return document.addEventListener("keydown",la),()=>document.removeEventListener("keydown",la)},[hs]);function sa(la){ei(la),Ms(!1)}function aa(){if(hs){Ms(!1);return}Ms(!0),fetchDomainsSafe().then(la=>{ta(la),os==null||os(la)})}return jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-select-wrapper",children:[jsxRuntimeExports.jsxs("button",{ref:ra,type:"button",className:"mdocs-domain-select-trigger","aria-label":co,"aria-expanded":hs,"aria-haspopup":"listbox",onClick:aa,children:[jsxRuntimeExports.jsx("span",{className:"mdocs-domain-select-text",children:ia?xo(ia.domainName):""}),oa&&jsxRuntimeExports.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:[jsxRuntimeExports.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),jsxRuntimeExports.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),jsxRuntimeExports.jsx("svg",{className:"mdocs-domain-select-chevron"+(hs?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"1.5",children:jsxRuntimeExports.jsx("path",{d:"M1 1l4 4 4-4"})})]}),hs&&jsxRuntimeExports.jsx("div",{ref:na,className:"mdocs-domain-select-menu card",role:"listbox","aria-label":co,children:ea.map(la=>jsxRuntimeExports.jsxs("button",{type:"button",className:"mdocs-domain-select-option"+(la.domainId===Pn?" active":""),role:"option","aria-selected":la.domainId===Pn,onClick:()=>sa(la.domainId),children:[jsxRuntimeExports.jsx("span",{children:xo(la.domainName)}),la.permission==="private"&&jsxRuntimeExports.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdocs-text-muted)",strokeWidth:"2",children:[jsxRuntimeExports.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),jsxRuntimeExports.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})]},la.domainId))})]})}const MAX_DATASOURCE_WAIT_FRAMES=48;function safeGetMarkdown(Un){try{const Pn=Un.getDocument("markdown");return typeof Pn=="string"?Pn:""}catch{return null}}function safeGetJsonString(Un){try{return JSON.stringify(Un.getDocument("json"))}catch{return null}}function useAutoSave({editor:Un,documentId:Pn,displayName:ei,debounceMs:co=1e3,enabled:xo=!0,localBaseCommitIdAtEditStart:os,snapshotMeta:hs}){const[Ms,ea]=reactExports.useState(!1),[ta,ra]=reactExports.useState(!1),[na,ia]=reactExports.useState(null),oa=reactExports.useRef(null),sa=reactExports.useRef(null),aa=reactExports.useRef(!1),la=reactExports.useRef(""),ca=reactExports.useRef(!1),ua=reactExports.useRef(Pn),da=reactExports.useRef(ei),ha=reactExports.useRef(os),fa=reactExports.useRef(hs);ua.current=Pn,da.current=ei,ha.current=os,fa.current=hs;const pa=reactExports.useCallback(async()=>{if(!Un)return;if(!la.current){console.log("[useAutoSave] performSave blocked: lastContentRef is empty");return}const va=safeGetJsonString(Un);va!=null&&(console.log("[useAutoSave] performSave saving draft, documentId:",ua.current,"content preview:",va.slice(0,80)),await getDocumentTaskQueue(ua.current).execute(()=>upsertContentDraft({documentId:ua.current,content:va,displayName:da.current,localBaseCommitIdAtEditStart:ha.current,snapshotMeta:fa.current})),la.current=safeGetMarkdown(Un)??la.current,ra(!0),ea(!1),ia(Date.now()),aa.current=!0,ca.current=!1)},[Un]);reactExports.useEffect(()=>{let va=!1;return getDraft(Pn).then(ya=>{va||(ya?(ra(!0),ia(ya.updatedAt),aa.current=!0):(ra(!1),ia(null),aa.current=!1,ca.current=!1))}),()=>{va=!0}},[Pn]),reactExports.useEffect(()=>{var Ta,$a;if(!xo){(Ta=sa.current)==null||Ta.call(sa),sa.current=null;return}if(!Un)return;const va=Un.getLexicalEditor();if(!va)return;($a=sa.current)==null||$a.call(sa);let ya=!1,Ca=0,wa=0;const Ea=()=>{if(ya)return;const Oa=safeGetMarkdown(Un);if(Oa===null){if(wa+=1,wa>MAX_DATASOURCE_WAIT_FRAMES)return;Ca=requestAnimationFrame(Ea);return}la.current=Oa;const Aa=va.registerUpdateListener(()=>{const Da=safeGetMarkdown(Un);Da!==null&&Da!==la.current&&(console.log("[useAutoSave] updateListener dirty, documentId:",Pn,"oldLen:",la.current.length,"newLen:",Da.length),la.current=Da,ea(!0),ca.current=!0,aa.current=!1,oa.current&&clearTimeout(oa.current),oa.current=setTimeout(()=>{oa.current=null,pa()},co))});sa.current=()=>{Aa(),oa.current&&(clearTimeout(oa.current),oa.current=null)}};return queueMicrotask(()=>{ya||(Ca=requestAnimationFrame(Ea))}),()=>{var Oa;ya=!0,cancelAnimationFrame(Ca),(Oa=sa.current)==null||Oa.call(sa)}},[xo,Un,Pn,ei,co,os,hs,pa]),reactExports.useEffect(()=>{var Ca;if(!xo||!Un)return;const va=(Ca=Un.getLexicalEditor())==null?void 0:Ca.getRootElement();if(!va)return;const ya=()=>{oa.current&&(clearTimeout(oa.current),oa.current=null),ca.current&&pa()};return va.addEventListener("blur",ya),()=>va.removeEventListener("blur",ya)},[xo,Un,pa]),reactExports.useEffect(()=>{if(!xo)return;const va=()=>{document.visibilityState==="hidden"&&(oa.current&&(clearTimeout(oa.current),oa.current=null),ca.current&&pa())},ya=()=>{ca.current&&(oa.current&&(clearTimeout(oa.current),oa.current=null),pa())};return document.addEventListener("visibilitychange",va),window.addEventListener("beforeunload",ya),()=>{document.removeEventListener("visibilitychange",va),window.removeEventListener("beforeunload",ya)}},[xo,pa]);async function ma(){await deleteDraft(Pn),ra(!1),ea(!1),ca.current=!1,aa.current=!1,la.current=""}async function ga(){const va=await getDraft(Pn);return va?va.content:null}function xa(){ra(!0),ea(!1),ca.current=!1,ia(Date.now()),aa.current=!0,Un&&(la.current=safeGetMarkdown(Un)??"")}return{isDirty:Ms,draftExists:ta,lastSavedAt:na,clearDraft:ma,loadDraftContent:ga,markDraftSaved:xa}}function usePublishGuard({isDirty:Un,draftExists:Pn}){const ei=Un&&!Pn;reactExports.useEffect(()=>{if(!ei)return;const co=xo=>{xo.preventDefault()};return window.addEventListener("beforeunload",co),()=>window.removeEventListener("beforeunload",co)},[ei])}const PATH_ERROR_MESSAGE_MAP={"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"},STORAGE_ERROR_MESSAGE_MAP={"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 translateError(Un,Pn){if(Pn instanceof ApiRequestError)return Pn.message;if(Pn instanceof DocPathError){const ei=PATH_ERROR_MESSAGE_MAP[Pn.message];return ei?Un(ei):Pn.message}if(Pn instanceof Error){const ei=PATH_ERROR_MESSAGE_MAP[Pn.message]??STORAGE_ERROR_MESSAGE_MAP[Pn.message];return ei?Un(ei):Pn.message}return String(Pn)}function localizeDomainName(Un,Pn,ei){if(Un==="Default")return ei("defaultDomain");const co="个人域";return Un.endsWith(co)?Un.slice(0,-co.length)+ei("personalDomainSuffix"):Un}function domainPermissionLabel(Un,Pn){return Un==="public"?Pn("domainPublic"):Un==="restricted"?Pn("domainRestricted"):Un==="private"?Pn("domainPrivate"):Un}function parentDirForCreates(Un){const Pn=Un.lastIndexOf("/");return Pn===-1?"":Un.slice(0,Pn)}function MiniSelect({options:Un,value:Pn,onChange:ei}){const[co,xo]=reactExports.useState(!1),os=reactExports.useRef(null),hs=reactExports.useRef(null),Ms=Un.find(ta=>ta.value===Pn);reactExports.useEffect(()=>{if(!co)return;const ta=ra=>{var na,ia;!((na=os.current)!=null&&na.contains(ra.target))&&!((ia=hs.current)!=null&&ia.contains(ra.target))&&xo(!1)};return document.addEventListener("mousedown",ta),()=>document.removeEventListener("mousedown",ta)},[co]),reactExports.useEffect(()=>{if(!co)return;const ta=ra=>{var na;ra.key==="Escape"&&(xo(!1),(na=os.current)==null||na.focus())};return document.addEventListener("keydown",ta),()=>document.removeEventListener("keydown",ta)},[co]);function ea(ta){ei(ta),xo(!1)}return jsxRuntimeExports.jsxs("div",{className:"mdocs-mini-select",style:{position:"relative"},children:[jsxRuntimeExports.jsxs("button",{ref:os,type:"button",className:"mdocs-mini-select-trigger","aria-expanded":co,"aria-haspopup":"listbox",onClick:()=>xo(ta=>!ta),children:[jsxRuntimeExports.jsx("span",{children:Ms==null?void 0:Ms.label}),jsxRuntimeExports.jsx("svg",{className:"mdocs-mini-select-chevron"+(co?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntimeExports.jsx("path",{d:"M1 1l4 4 4-4"})})]}),co&&jsxRuntimeExports.jsx("div",{ref:hs,className:"mdocs-mini-select-menu card",role:"listbox",children:Un.map(ta=>jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-mini-select-option"+(ta.value===Pn?" active":""),role:"option","aria-selected":ta.value===Pn,onClick:()=>ea(ta.value),children:ta.label},ta.value))})]})}function idPrefix6$1(Un){return Un.length<=6?Un:`${Un.slice(0,6)}…`}function VisitorPickerContent(Un){const{visitors:Pn,loadState:ei,searchFilter:co,onSearchChange:xo,selectedIds:os,onToggle:hs,selectedRows:Ms,lockedIds:ea=new Set,myVisitorId:ta,showPermissionSelect:ra=!1,permissionOptions:na=[],onPermissionChange:ia}=Un,{t:oa}=useI18n(),sa=reactExports.useMemo(()=>{const aa=co.trim().toLowerCase();let la=aa?Pn.filter(ca=>ca.visitorName.toLowerCase().includes(aa)||ca.visitorId.toLowerCase().includes(aa)):Pn;return ta&&(la=[...la].sort((ca,ua)=>ca.visitorId===ta?-1:ua.visitorId===ta?1:0)),la},[Pn,co,ta]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("input",{type:"search",className:"mdocs-visitor-picker-search",placeholder:oa("visitorPickerSearchPlaceholder"),value:co,onChange:aa=>xo(aa.target.value),disabled:ei!=="ok"}),ei==="loading"&&jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-loading",children:oa("loading")}),ei==="err"&&jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-error",children:oa("visitorPickerLoadError")}),ei==="ok"&&jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-columns",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-col",children:[jsxRuntimeExports.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:oa("visitorPickerColumnAll")}),jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:jsxRuntimeExports.jsxs("table",{className:"mdocs-visitor-picker-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{scope:"col",children:oa("visitorPickerColIdShort")}),jsxRuntimeExports.jsx("th",{scope:"col",children:oa("visitorPickerColName")}),jsxRuntimeExports.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col",children:oa("visitorPickerColPick")})]})}),jsxRuntimeExports.jsx("tbody",{children:sa.length===0?jsxRuntimeExports.jsx("tr",{children:jsxRuntimeExports.jsx("td",{colSpan:3,className:"mdocs-visitor-picker-empty-cell",children:Pn.length===0?oa("visitorPickerEmptyDirectory"):oa("domainNoMatch")})}):sa.map(aa=>{const la=ea.has(aa.visitorId),ca=os.has(aa.visitorId);return jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx("code",{className:"mdocs-visitor-picker-id-short",children:idPrefix6$1(aa.visitorId)})}),jsxRuntimeExports.jsxs("td",{children:[aa.visitorName,aa.visitorId===ta&&jsxRuntimeExports.jsx("span",{className:"mdocs-visitor-picker-self-marker",children:oa("visitorPickerSelfMarker")})]}),jsxRuntimeExports.jsx("td",{className:"mdocs-visitor-picker-check-col",children:jsxRuntimeExports.jsx("input",{type:"checkbox",checked:ca,disabled:la,onChange:()=>hs(aa.visitorId),"aria-label":aa.visitorName})})]},aa.visitorId)})})]})})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-col",children:[jsxRuntimeExports.jsx("h3",{className:"mdocs-visitor-picker-col-title",children:oa("visitorPickerColumnSelected")}),jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-table-wrap",children:jsxRuntimeExports.jsxs("table",{className:"mdocs-visitor-picker-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{scope:"col",children:oa("visitorPickerColIdFull")}),jsxRuntimeExports.jsx("th",{scope:"col",children:oa("visitorPickerColName")}),ra&&jsxRuntimeExports.jsx("th",{scope:"col",children:oa("permissionLabel")}),jsxRuntimeExports.jsx("th",{scope:"col",className:"mdocs-visitor-picker-check-col"})]})}),jsxRuntimeExports.jsx("tbody",{children:Ms.length===0?jsxRuntimeExports.jsx("tr",{children:jsxRuntimeExports.jsx("td",{colSpan:ra?4:3,className:"mdocs-visitor-picker-empty-cell",children:oa("visitorPickerNoSelection")})}):Ms.map(aa=>{const la=ea.has(aa.visitorId);return jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx("code",{className:"mdocs-visitor-picker-id-full",children:aa.visitorId})}),jsxRuntimeExports.jsx("td",{className:aa.muted?"mdocs-visitor-picker-name-muted":void 0,children:aa.name}),ra&&jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsx(MiniSelect,{options:na,value:aa.permission??"read",onChange:ca=>ia==null?void 0:ia(aa.visitorId,ca)})}),jsxRuntimeExports.jsx("td",{className:"mdocs-visitor-picker-check-col",children:la?jsxRuntimeExports.jsx("span",{className:"mdocs-visitor-picker-locked",title:oa("visitorPickerLockedHint"),children:"—"}):jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-visitor-picker-remove",onClick:()=>hs(aa.visitorId),"aria-label":oa("visitorPickerRemove"),children:"×"})})]},aa.visitorId)})})]})})]})]})]})}function VisitorPickerModal(Un){var Ya;const{open:Pn,title:ei,initialSelectedIds:co,lockedIds:xo=[],seedMembers:os,excludeTemplateId:hs,templates:Ms,onClose:ea,onConfirm:ta,showPermissionSelect:ra=!1,permissionOptions:na=[],initialPermissions:ia}=Un,{t:oa}=useI18n(),sa=reactExports.useRef(oa);sa.current=oa;const aa=reactExports.useMemo(()=>new Set(xo),[xo]),la=getStoredVisitorId(),[ca,ua]=reactExports.useState([]),[da,ha]=reactExports.useState("idle"),[fa,pa]=reactExports.useState(()=>new Set),[ma,ga]=reactExports.useState(()=>new Map),[xa,va]=reactExports.useState(""),[ya,Ca]=reactExports.useState(""),[wa,Ea]=reactExports.useState(!1),Ta=reactExports.useRef(null),[$a,Oa]=reactExports.useState(!1),[Aa,Da]=reactExports.useState(null),Ia=reactExports.useMemo(()=>Ms.filter(Ja=>hs==null||Ja.id!==hs),[Ms,hs]),za=reactExports.useMemo(()=>new Map((os??[]).map(Ja=>[Ja.visitorId,Ja])),[os]);reactExports.useEffect(()=>{Pn&&(pa(new Set(co)),ga(ia?new Map(ia):new Map),va(""),Ca(""),Da(null))},[Pn,co,ia]),reactExports.useEffect(()=>{if(!Pn)return;let Ja=!1;return ha("loading"),fetchVisitorsDirectoryApi().then(Ra=>{Ja||(ua(Ra),ha("ok"))}).catch(Ra=>{Ja||(ha("err"),Da(translateError(sa.current,Ra)))}),()=>{Ja=!0}},[Pn]),reactExports.useEffect(()=>{if(!wa)return;const Ja=Ra=>{var Ma;(Ma=Ta.current)!=null&&Ma.contains(Ra.target)||Ea(!1)};return document.addEventListener("mousedown",Ja),()=>document.removeEventListener("mousedown",Ja)},[wa]);const La=reactExports.useMemo(()=>{const Ja=new Map(ca.map(Ma=>[Ma.visitorId,Ma])),Ra=[];for(const Ma of fa){const Fa=ma.get(Ma),Ha=Ja.get(Ma);if(Ha){Ra.push({visitorId:Ma,name:Ha.visitorName,muted:!1,permission:Fa});continue}const Ka=za.get(Ma);if(Ka){Ka.missing?Ra.push({visitorId:Ma,name:oa("visitorPickerMemberMissing"),muted:!0,permission:Fa}):Ka.disabled?Ra.push({visitorId:Ma,name:`${Ka.visitorName} · ${oa("visitorPickerDisabledTag")}`,muted:!0,permission:Fa}):Ra.push({visitorId:Ma,name:Ka.visitorName,muted:!1,permission:Fa});continue}Ra.push({visitorId:Ma,name:oa("visitorPickerUnknownVisitor"),muted:!0,permission:Fa})}return Ra.sort((Ma,Fa)=>Ma.name.localeCompare(Fa.name,void 0,{sensitivity:"base"})),Ra},[ca,fa,za,ma,oa]),Na=reactExports.useCallback(Ja=>{aa.has(Ja)||pa(Ra=>{const Ma=new Set(Ra);return Ma.has(Ja)?(Ma.delete(Ja),ga(Fa=>{const Ha=new Map(Fa);return Ha.delete(Ja),Ha})):(Ma.add(Ja),ga(Fa=>{const Ha=new Map(Fa);return Ha.set(Ja,"read"),Ha})),Ma})},[aa]),Wa=reactExports.useCallback((Ja,Ra)=>{ga(Ma=>{const Fa=new Map(Ma);return Fa.set(Ja,Ra),Fa})},[]),Ua=reactExports.useCallback(()=>{const Ja=Number(ya);if(!Number.isInteger(Ja)||Ja<1)return;const Ra=Ms.find(Fa=>Fa.id===Ja);if(!Ra)return;const Ma=new Set(ca.map(Fa=>Fa.visitorId));pa(Fa=>{const Ha=new Set(Fa);for(const Ka of Ra.visitorIds)Ma.has(Ka)&&Ha.add(Ka);return Ha})},[ya,Ms,ca]);async function Ga(){Da(null),Oa(!0);try{if(ra){const Ja=[...fa].sort().map(Ra=>({visitorId:Ra,permission:ma.get(Ra)??"read"}));await ta(Ja)}else{const Ja=[...fa].sort();await ta(Ja)}ea()}catch(Ja){Da(translateError(oa,Ja))}finally{Oa(!1)}}return Pn?jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-overlay",role:"presentation",onMouseDown:Ja=>Ja.target===Ja.currentTarget&&ea(),children:jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"mdocs-visitor-picker-title",children:[jsxRuntimeExports.jsxs("header",{className:"mdocs-visitor-picker-header",children:[jsxRuntimeExports.jsx("h2",{id:"mdocs-visitor-picker-title",className:"mdocs-visitor-picker-title",children:ei}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-visitor-picker-close",onClick:ea,"aria-label":oa("close"),children:"×"})]}),Ia.length>0&&jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-toolbar",children:jsxRuntimeExports.jsxs("div",{className:"mdocs-visitor-picker-template-bar",children:[jsxRuntimeExports.jsxs("div",{ref:Ta,className:"mdocs-template-picker",children:[jsxRuntimeExports.jsxs("button",{type:"button",className:"mdocs-template-picker-trigger",onClick:()=>Ea(Ja=>!Ja),disabled:da!=="ok","aria-haspopup":"listbox","aria-expanded":wa,children:[jsxRuntimeExports.jsx("span",{className:"mdocs-template-picker-text",children:ya?(Ya=Ia.find(Ja=>String(Ja.id)===ya))==null?void 0:Ya.displayName:oa("visitorPickerPickTemplate")}),jsxRuntimeExports.jsx("svg",{className:"mdocs-template-picker-chevron"+(wa?" open":""),width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsxRuntimeExports.jsx("path",{d:"M1 1l4 4 4-4"})})]}),wa&&jsxRuntimeExports.jsx("div",{className:"mdocs-template-picker-menu card",role:"listbox",children:Ia.map(Ja=>jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-template-picker-option"+(String(Ja.id)===ya?" active":""),role:"option","aria-selected":String(Ja.id)===ya,onClick:()=>{Ca(String(Ja.id)),Ea(!1)},children:Ja.displayName},Ja.id))})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>{if(da!=="ok"){Da(oa("loading"));return}if(!ya){Da(oa("visitorPickerPickTemplate"));return}Ua()},children:oa("visitorPickerApplyTemplate")})]})}),Aa&&jsxRuntimeExports.jsx("div",{className:"mdocs-visitor-picker-error",role:"alert",children:Aa}),jsxRuntimeExports.jsx("div",{style:{padding:"8px 18px 12px"},children:jsxRuntimeExports.jsx(VisitorPickerContent,{visitors:ca,loadState:da,searchFilter:xa,onSearchChange:va,selectedIds:fa,onToggle:Na,selectedRows:La,lockedIds:aa,myVisitorId:la,showPermissionSelect:ra,permissionOptions:na,onPermissionChange:Wa})}),jsxRuntimeExports.jsxs("footer",{className:"mdocs-visitor-picker-footer",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:ea,children:oa("cancel")}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>{if(da!=="ok"){Da(oa("loading"));return}Ga()},children:oa($a?"saving":"visitorPickerConfirm")})]})]})}):null}function safeLexicalJsonString(Un){try{return JSON.stringify(Un.getDocument("json"))}catch{return null}}function OutlineSideRail({editor:Un}){const{visible:Pn}=useOutlineVisibility();return jsxRuntimeExports.jsx("div",{className:"mdocs-outline-siderail",style:{flexShrink:0,overflow:"hidden",transition:"width 0.2s ease",width:Pn?200:0},children:jsxRuntimeExports.jsx("div",{style:{width:200},children:jsxRuntimeExports.jsx(OutlinePanel,{editor:Un})})})}function DocumentEditor(Un){const{t:Pn,lang:ei}=useI18n(),[co,xo]=reactExports.useState(!1),os=reactExports.useRef(null),[hs,Ms]=reactExports.useState([]),[ea,ta]=reactExports.useState(!1),[ra,na]=reactExports.useState(Un.meta.permission),[ia,oa]=reactExports.useState(!1),[sa,aa]=reactExports.useState(!1),[la,ca]=reactExports.useState(!1),[ua,da]=reactExports.useState(new Map),[ha,fa]=reactExports.useState(!1);reactExports.useEffect(()=>{const Xl=vc=>{os.current&&!os.current.contains(vc.target)&&xo(!1)};return co&&document.addEventListener("mousedown",Xl),()=>document.removeEventListener("mousedown",Xl)},[co]),reactExports.useEffect(()=>{let Xl=!0;return fetchVisitorsDirectoryApi().then(vc=>{Xl&&Ms(vc)}).catch(()=>{}),()=>{Xl=!1}},[]);function pa(Xl){const vc=hs.find(xc=>xc.visitorId===Xl);return(vc==null?void 0:vc.visitorName)??Xl.slice(0,8)}const[ma,ga]=reactExports.useState(Un.initialDisplayName),[xa,va]=reactExports.useState(!1),[ya,Ca]=reactExports.useState(!1),[wa,Ea]=reactExports.useState(!1),[Ta,$a]=reactExports.useState(()=>localStorage.getItem("mdocs.autoEdit")!=="false"),Oa=Un.canEdit&&Ta,[Aa,Da]=reactExports.useState(null),[Ia,za]=reactExports.useState(!1),La=reactExports.useRef(null);reactExports.useLayoutEffect(()=>{za(!1),Da(null),La.current=null},[Un.meta.documentId]),reactExports.useEffect(()=>{const Xl=requestAnimationFrame(()=>za(!0));return()=>cancelAnimationFrame(Xl)},[Un.meta.documentId]);const Na=reactExports.useRef(Un.initialContent);reactExports.useEffect(()=>{Na.current=Un.initialContent},[Un.initialContent,Un.contentRevision]);const Wa=reactExports.useMemo(()=>{var Xl;if(!Un.initialContent)return"json";try{const vc=JSON.parse(Un.initialContent);return(Xl=vc==null?void 0:vc.root)!=null&&Xl.children?"json":"markdown"}catch{return"markdown"}},[Un.initialContent,Un.contentRevision]),{isDirty:Ua,draftExists:Ga,markDraftSaved:Ya}=useAutoSave({editor:Aa,documentId:Un.meta.documentId,displayName:ma,enabled:Un.canEdit,localBaseCommitIdAtEditStart:Un.meta.headCommitId??null,snapshotMeta:{relativePath:Un.meta.relativePath,permission:Un.meta.permission,ownerVisitorId:Un.meta.ownerVisitorId,domainId:Un.meta.domainId}});reactExports.useEffect(()=>{var Xl;(Xl=Un.onDraftExistsChange)==null||Xl.call(Un,Ga)},[Ga,Un.onDraftExistsChange]),usePublishGuard({isDirty:Ua,draftExists:Ga}),reactExports.useEffect(()=>{if(Aa)try{Aa.setDocument(Wa,Un.initialContent||"")}catch{}},[Aa,Un.meta.documentId,Un.contentRevision,Un.initialContent,Wa]),reactExports.useEffect(()=>{Aa==null||Aa.setLocale(ei==="zh"?zhCN:enUS)},[Aa,ei]),reactExports.useEffect(()=>{ga(Un.initialDisplayName)},[Un.initialDisplayName,Un.meta.documentId,Un.contentRevision]),reactExports.useEffect(()=>{na(Un.meta.permission)},[Un.meta.permission,Un.meta.documentId]),reactExports.useEffect(()=>{let Xl=!0;return(async()=>{try{const vc=await checkBookmarkApi(Un.meta.documentId);Xl&&Ca(vc.bookmarked)}catch{}})(),()=>{Xl=!1}},[Un.meta.documentId]);async function Ja(){var Xl,vc;if(!wa){Ea(!0);try{ya?(await removeBookmarkApi(Un.meta.documentId),Ca(!1),(Xl=Un.onShowToast)==null||Xl.call(Un,Pn("bookmarkRemoved"))):(await addBookmarkApi(Un.meta.documentId),Ca(!0),(vc=Un.onShowToast)==null||vc.call(Un,Pn("bookmarkAdded")))}finally{Ea(!1)}}}reactExports.useEffect(()=>(Un.saveBeforeNavRef&&(Un.saveBeforeNavRef.current=hc),()=>{Un.saveBeforeNavRef&&(Un.saveBeforeNavRef.current=void 0)}));function Ra(Xl){return Xl<1024?`${Xl} B`:Xl<1024*1024?`${(Xl/1024).toFixed(1)} KB`:`${(Xl/(1024*1024)).toFixed(1)} MB`}const Ma=reactExports.useCallback(Xl=>{La.current=Xl,Da(Xl);const vc=Na.current;if(!vc)return;const xc=()=>{try{Xl.setDocument(Wa,vc)}catch{requestAnimationFrame(()=>{try{Xl.setDocument(Wa,vc)}catch{}})}};queueMicrotask(()=>{queueMicrotask(xc)})},[Wa]);async function Fa(){if(!(!Aa||!Un.canEdit)){va(!0);try{const Xl=safeLexicalJsonString(Aa);if(!Xl)return;await Un.onPublish(Xl,ma,Un.meta.documentId)}catch(Xl){throw Xl}finally{va(!1)}}}async function Ha(){if(!Un.canEdit)return;const Xl=Un.initialDisplayName.trim();if(ma.trim()!==Xl)try{await Fa()}catch{}}const Ka=reactExports.useMemo(()=>Un.domains.find(Xl=>Xl.domainId===Un.meta.domainId),[Un.domains,Un.meta.domainId]),Sl=reactExports.useMemo(()=>{const Xl=(Ka==null?void 0:Ka.permission)??"public";return allowedPermissionsForDomain(Xl)},[Ka==null?void 0:Ka.permission]);function Za(Xl){return Xl===DocumentPermission.PRIVATE?Pn("permissionPrivate"):Xl===DocumentPermission.DOMAIN_READ?Pn("permissionInvite"):Xl===DocumentPermission.DOMAIN_WRITE?Pn("permissionDomainWrite"):Xl===DocumentPermission.PUBLIC_READ?Pn("permissionPublicRead"):Pn("permissionPublicEdit")}async function lc(){var Xl;if(ia||ra===Un.meta.permission){ta(!1);return}oa(!0);try{const xc=(Aa?safeLexicalJsonString(Aa):null)??Un.initialContent;await Un.onPublish(xc,ma,Un.meta.documentId,ra),ta(!1),(Xl=Un.onShowToast)==null||Xl.call(Un,Pn("docInfoPermissionUpdated"))}finally{oa(!1)}}async function oc(Xl){var vc;if(!ha){fa(!0);try{const xc=new Set(Xl.map(kc=>kc.visitorId)),Ac=new Map(Xl.map(kc=>[kc.visitorId,kc.permission]));for(const[kc]of ua)xc.has(kc)||await removeDocumentInviteApi(Un.meta.documentId,kc);for(const{visitorId:kc,permission:uc}of Xl){const fc=ua.get(kc);(!fc||fc!==uc)&&await addDocumentInviteApi(Un.meta.documentId,kc,uc)}aa(!1),(vc=Un.onShowToast)==null||vc.call(Un,Pn("docInfoInviteSuccess",{count:Xl.length}))}finally{fa(!1)}}}async function hc(){if(!Aa||!Un.canEdit)return;if(!Ua){console.log("[DocumentEditor.saveDraft] skipped: not dirty, documentId:",Un.meta.documentId);return}const Xl=safeLexicalJsonString(Aa);Xl&&(console.log("[DocumentEditor.saveDraft] saving draft, documentId:",Un.meta.documentId,"content preview:",Xl.slice(0,80)),Ya(),await getDocumentTaskQueue(Un.meta.documentId).execute(()=>upsertContentDraft({documentId:Un.meta.documentId,content:Xl,displayName:ma,localBaseCommitIdAtEditStart:Un.meta.headCommitId??null,snapshotMeta:{relativePath:Un.meta.relativePath,permission:Un.meta.permission,ownerVisitorId:Un.meta.ownerVisitorId,domainId:Un.meta.domainId}})))}const gc=reactExports.useMemo(()=>[{icon:Heading1,key:"h1",label:"Heading 1",onSelect:Xl=>{Xl.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h1"})}},{icon:Heading2,key:"h2",label:"Heading 2",onSelect:Xl=>{Xl.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h2"})}},{icon:Heading3,key:"h3",label:"Heading 3",onSelect:Xl=>{Xl.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h3"})}},{type:"divider"},{icon:Minus,key:"hr",label:"Hr",onSelect:Xl=>{Xl.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND,{})}},{icon:Table2,key:"table",label:"Table",onSelect:Xl=>{Xl.dispatchCommand(INSERT_TABLE_COMMAND,{columns:"3",rows:"3"})}},{icon:Sigma,key:"tex",label:"TeX",onSelect:Xl=>{Xl.dispatchCommand(INSERT_MATH_COMMAND,{code:"x^2 + y^2 = z^2"}),queueMicrotask(()=>Xl.focus())}},{type:"divider"},{key:"file",label:"File",onSelect:Xl=>{openFileSelector(vc=>{for(const xc of vc)Xl.dispatchCommand(INSERT_FILE_COMMAND,{file:xc})})}},{key:"insert-link",label:"Insert Link",onSelect:Xl=>{Xl.dispatchCommand(INSERT_LINK_COMMAND,{url:"https://example.com"}),queueMicrotask(()=>Xl.focus())}},{key:"insert-codeInline",label:"Inline Code",onSelect:Xl=>{Xl.dispatchCommand(INSERT_CODEINLINE_COMMAND,void 0),queueMicrotask(()=>Xl.focus())}},{key:"insert-codeBlock",label:"Code Block",onSelect:Xl=>{Xl.dispatchCommand(INSERT_CODEMIRROR_COMMAND,void 0),queueMicrotask(()=>Xl.focus())}},{icon:Workflow,key:"meta2d",label:"Meta2d",onSelect:Xl=>{Xl.dispatchCommand(INSERT_META2D_COMMAND,void 0),queueMicrotask(()=>Xl.focus())}},{icon:Network,key:"markmap",label:"Markmap",onSelect:Xl=>{Xl.dispatchCommand(INSERT_MARKMAP_COMMAND,void 0),queueMicrotask(()=>Xl.focus())}}].map(Xl=>"type"in Xl&&Xl.type==="divider"?Xl:{...Xl,extra:jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted)",fontFamily:"monospace",fontSize:12},children:Xl.key})}),[]),Rc=reactExports.useMemo(()=>[ReactMarkdownPlugin,ReactListPlugin,ReactLinkPlugin,ReactImagePlugin,ReactCodemirrorPlugin,ReactHRPlugin,ReactTablePlugin,ReactMathPlugin,ReactMeta2dPlugin,ReactMarkmapPlugin,ReactCodePlugin,withProps(ReactToolbarPlugin,{children:Aa?jsxRuntimeExports.jsx(Toolbar,{editor:Aa,floating:!0,outlineCollapseTitle:Pn("outlineHide"),outlineExpandTitle:Pn("outlineShow"),outlineToggle:!0}):null}),withProps(ReactFilePlugin,{handleUpload:async Xl=>({url:await uploadAssetApi(Xl,Un.meta.documentId)})}),withProps(ReactImagePlugin,{defaultBlockImage:!0,needRehost:Xl=>Xl.startsWith("blob:"),handleRehost:async Xl=>{const xc=await(await fetch(Xl)).blob(),Ac=new File([xc],"image.png",{type:xc.type});return{url:await uploadAssetApi(Ac,Un.meta.documentId)}}})],[Aa,Pn]);return jsxRuntimeExports.jsxs("div",{className:"mdocs-editor",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-editor-toolbar",children:[jsxRuntimeExports.jsx("input",{className:"mdocs-editor-title-input",value:ma,onChange:Xl=>ga(Xl.target.value),onBlur:()=>void Ha(),placeholder:Pn("displayNamePlaceholder"),disabled:!Oa}),jsxRuntimeExports.jsx(DomainSelect,{domains:Un.domains.length?Un.domains:[FALLBACK_DOMAIN_SUMMARY],value:Un.currentDomainId,onChange:Un.onDomainChange,onDomainsChange:Un.onDomainsChange,ariaLabel:Pn("currentDomainAria"),localizeName:Xl=>localizeDomainName(Xl,ei,Pn)}),jsxRuntimeExports.jsxs("button",{type:"button",className:"secondary mdocs-tooltip mdocs-tooltip-bottom",onClick:()=>void Ja(),disabled:wa,"data-tooltip":ya?"取消收藏":"收藏",style:{padding:"4px 8px",minWidth:"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:4,opacity:wa?.5:1},children:[jsxRuntimeExports.jsx(Star,{size:18,strokeWidth:1.5,style:{color:ya?"#faad14":"var(--mdocs-text-secondary, #6b7280)",fill:ya?"#faad14":"none"}}),ya&&jsxRuntimeExports.jsx("span",{children:"已收藏"})]}),jsxRuntimeExports.jsx("span",{className:"mdocs-editor-toolbar-spacer","aria-hidden":!0}),jsxRuntimeExports.jsxs("div",{className:"mdocs-editor-toolbar-actions",children:[Un.onSyncClick&&jsxRuntimeExports.jsxs("button",{type:"button",className:"mdocs-sync-btn mdocs-tooltip mdocs-tooltip-bottom"+(Un.syncBehind?" behind":""),"data-tooltip":Un.syncBehind?Pn("syncBehindHint"):Pn("syncPull"),onClick:()=>{var Xl;return void((Xl=Un.onSyncClick)==null?void 0:Xl.call(Un))},style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntimeExports.jsx(RefreshCw,{size:16,strokeWidth:1.5}),jsxRuntimeExports.jsx("span",{children:Pn("syncPull")})]}),Oa?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[localStorage.getItem("mdocs.autoPublish")!=="true"&&jsxRuntimeExports.jsxs("span",{className:"mdocs-save-indicator",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-save-dot "+(xa?"saving":Ga?"unsaved":"saved")}),jsxRuntimeExports.jsx("span",{children:Pn(xa?"publishing":Ga?"unsaved":"published")})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",disabled:xa,onClick:()=>{Fa().catch(()=>{})},children:Pn(xa?"publishing":"publish")}),jsxRuntimeExports.jsx("button",{type:"button",className:"danger",disabled:xa,onClick:Un.onDelete,children:Pn("delete")})]}):Un.canEdit&&jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>$a(!0),children:Pn("edit")}),jsxRuntimeExports.jsxs("button",{type:"button",className:"secondary mdocs-tooltip mdocs-tooltip-bottom",onClick:Un.onToggleComments,"data-tooltip":"评论",style:{padding:"4px 8px",minWidth:"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:4,background:Un.commentPanelOpen?"var(--mdocs-hover-bg, #f0f0f0)":void 0},children:[jsxRuntimeExports.jsx(MessageSquare,{size:18,strokeWidth:1.5,style:{color:"var(--mdocs-text-secondary, #6b7280)"}}),Un.commentCount>0&&jsxRuntimeExports.jsx("span",{style:{fontSize:"0.85rem"},children:Un.commentCount})]}),jsxRuntimeExports.jsxs("div",{ref:os,className:"mdocs-tooltip mdocs-tooltip-bottom","data-tooltip":Pn("docInfo"),style:{position:"relative"},children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>xo(!co),style:{padding:"4px 8px",minWidth:"auto",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntimeExports.jsx(TextAlignJustify,{size:18,strokeWidth:1.5,style:{color:"var(--mdocs-text-secondary, #6b7280)"}})}),co&&jsxRuntimeExports.jsxs("div",{style:{position:"absolute",top:"100%",right:0,marginTop:"4px",background:"var(--mdocs-surface, #fff)",border:"1px solid var(--mdocs-border, #e5e5e5)",borderRadius:"8px",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",minWidth:"220px",zIndex:100,padding:"8px 0"},children:[jsxRuntimeExports.jsxs("div",{style:{padding:"4px 16px",fontSize:"13px"},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"6px"},children:[jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted, #888)"},children:Pn("docInfoCreator")}),jsxRuntimeExports.jsx("span",{children:pa(Un.meta.ownerVisitorId)})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"6px"},children:[jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted, #888)"},children:Pn("docInfoCreatedAt")}),jsxRuntimeExports.jsx("span",{children:new Date(Un.meta.createdAt).toLocaleString(ei==="zh"?"zh-CN":"en-US")})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"6px"},children:[jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted, #888)"},children:Pn("docInfoSize")}),jsxRuntimeExports.jsx("span",{children:Ra(new Blob([Un.initialContent]).size)})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[jsxRuntimeExports.jsx("span",{style:{color:"var(--mdocs-text-muted, #888)"},children:Pn("docInfoUpdatedAt")}),jsxRuntimeExports.jsx("span",{children:new Date(Un.meta.updatedAt).toLocaleString(ei==="zh"?"zh-CN":"en-US")})]})]}),jsxRuntimeExports.jsx("div",{style:{height:"1px",background:"var(--mdocs-border, #e5e5e5)",margin:"8px 0"}}),jsxRuntimeExports.jsxs("button",{type:"button",style:{width:"100%",textAlign:"left",padding:"8px 16px",background:"none",border:"none",cursor:"pointer",fontSize:"13px",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:Xl=>{Xl.currentTarget.style.background="var(--mdocs-hover-bg, #f5f5f5)"},onMouseLeave:Xl=>{Xl.currentTarget.style.background="none"},onClick:()=>{Ja()},children:[jsxRuntimeExports.jsx("span",{children:ya?"⭐":"☆"}),jsxRuntimeExports.jsx("span",{children:Pn(ya?"bookmarkRemove":"bookmarkAdd")})]}),Un.canManageInvites&&jsxRuntimeExports.jsxs("button",{type:"button",style:{width:"100%",textAlign:"left",padding:"8px 16px",background:"none",border:"none",cursor:"pointer",fontSize:"13px",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:Xl=>{Xl.currentTarget.style.background="var(--mdocs-hover-bg, #f5f5f5)"},onMouseLeave:Xl=>{Xl.currentTarget.style.background="none"},onClick:()=>{xo(!1),(async()=>{ca(!0);try{const Xl=await getDocumentInvitesApi(Un.meta.documentId),vc=new Map(Xl.map(xc=>[xc.visitorId,xc.permission]));da(vc),aa(!0)}finally{ca(!1)}})()},children:[jsxRuntimeExports.jsx(Users,{size:14}),jsxRuntimeExports.jsx("span",{children:Pn("docInfoInviteMember")})]}),jsxRuntimeExports.jsxs("button",{type:"button",style:{width:"100%",textAlign:"left",padding:"8px 16px",background:"none",border:"none",cursor:"pointer",fontSize:"13px",display:"flex",alignItems:"center",gap:"8px"},onMouseEnter:Xl=>{Xl.currentTarget.style.background="var(--mdocs-hover-bg, #f5f5f5)"},onMouseLeave:Xl=>{Xl.currentTarget.style.background="none"},onClick:()=>{xo(!1),na(Un.meta.permission),ta(!0)},children:[jsxRuntimeExports.jsx(ShieldUser,{size:14}),jsxRuntimeExports.jsx("span",{children:Pn("docInfoChangePermission")})]})]})]})]})]}),ea&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",style:{position:"fixed",zIndex:9999},onClick:Xl=>{Xl.target===Xl.currentTarget&&ta(!1)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:480},children:[jsxRuntimeExports.jsx("h1",{style:{fontSize:"1.1rem",marginBottom:12},children:Pn("docInfoChangePermission")}),jsxRuntimeExports.jsxs("div",{className:"muted",style:{marginBottom:12},children:[Pn("domainPermission"),":",Ka?localizeDomainName(Ka.domainName,ei,Pn):Un.meta.domainId]}),jsxRuntimeExports.jsx("div",{style:{display:"grid",gap:8},children:Sl.map(Xl=>jsxRuntimeExports.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[jsxRuntimeExports.jsx("input",{type:"radio",name:"doc-permission",value:Xl,checked:ra===Xl,onChange:()=>na(Xl)}),jsxRuntimeExports.jsx("span",{children:Za(Xl)})]},Xl))}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:16},children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ta(!1),children:Pn("cancel")}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",disabled:ia,onClick:()=>void lc(),children:Pn(ia?"publishing":"saveAndPublish")})]})]})}),Un.canManageInvites&&jsxRuntimeExports.jsx(VisitorPickerModal,{open:sa,title:Pn("docInfoInviteMember"),initialSelectedIds:[...ua.keys()],initialPermissions:ua,templates:[],showPermissionSelect:!0,permissionOptions:[{value:"read",label:Pn("invitePermissionRead")},{value:"edit",label:Pn("invitePermissionEdit")}],onClose:()=>aa(!1),onConfirm:Xl=>{oc(Xl)}}),jsxRuntimeExports.jsx(OutlineProvider,{children:jsxRuntimeExports.jsx(Block,{flex:1,style:{minHeight:0},children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},children:[Oa&&Aa&&jsxRuntimeExports.jsx(Toolbar,{editor:Aa,outlineCollapseTitle:Pn("outlineHide"),outlineExpandTitle:Pn("outlineShow"),outlineToggle:!0}),jsxRuntimeExports.jsx("div",{className:"mdocs-editor-content-area",style:{flex:1,display:"flex",minHeight:0},children:jsxRuntimeExports.jsxs(Block,{variant:"outlined",horizontal:!0,style:{background:"var(--mdocs-surface)",flex:1,minHeight:0,minWidth:0,borderRadius:0,outline:"none"},children:[jsxRuntimeExports.jsx("div",{className:"mdocs-editor-scroll-host",children:Ia?jsxRuntimeExports.jsx(Editor,{content:Un.initialContent,type:Wa,confirmPasteMarkdown:!0,editable:Oa,onInit:Ma,plugins:Rc,lineEmptyPlaceholder:Pn("displayNamePlaceholder"),placeholder:Pn("displayNamePlaceholder"),slashOption:{items:gc},className:"mdocs-document-editor-root"},Un.meta.documentId):null}),Aa&&jsxRuntimeExports.jsx(OutlineSideRail,{editor:Aa})]})})]})})})]})}function ConfirmDialog({title:Un,message:Pn,confirmLabel:ei="确定",cancelLabel:co="取消",onConfirm:xo,onCancel:os,busy:hs=!1,danger:Ms=!1}){return jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:ea=>{ea.target===ea.currentTarget&&!hs&&os()},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[Un&&jsxRuntimeExports.jsx("h2",{className:"mdocs-message-dialog-title",children:Un}),jsxRuntimeExports.jsx("p",{className:"mdocs-message-dialog-body",children:Pn}),jsxRuntimeExports.jsxs("div",{className:"mdocs-message-dialog-actions",style:{gap:8},children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:os,disabled:hs,children:co}),jsxRuntimeExports.jsx("button",{type:"button",className:Ms?"danger":"primary",onClick:xo,disabled:hs,children:hs?"…":ei})]})]})})}class DraftPublishAborted extends Error{constructor(ei,co){super(ei);Ba(this,"code");Ba(this,"cause");this.name="DraftPublishAborted",this.code=ei,this.cause=co==null?void 0:co.cause}}function publishErrorCodeFrom(Un){return Un instanceof DraftPublishAborted?Un.code:Un instanceof ApiRequestError?Un.status===404?DRAFT_PUBLISH_ERROR.DOC_NOT_FOUND:Un.code||`HTTP_${Un.status}`:Un instanceof Error&&Un.message.trim()?Un.message.trim().slice(0,120):"UNKNOWN"}function formatDraftPublishFailureMessage(Un,Pn,ei,co){const xo=(Pn==null?void 0:Pn.displayName)||Un("unknownTitle");if(ei===DRAFT_PUBLISH_ERROR.SYNC_HEAD_MISSING)return Un("draftPublishFailedSyncHead",{name:xo});if(ei===DRAFT_PUBLISH_ERROR.DOC_NOT_FOUND)return Un("draftPublishFailedNotice",{name:xo});const os=co instanceof ApiRequestError||co instanceof Error&&co.message?co.message:ei;return Un("draftPublishFailedGeneric",{name:xo,reason:os})}async function failDraftPublish(Un,Pn,ei){const co=publishErrorCodeFrom(Pn);throw await markDraftPublishError(Un,co),Pn instanceof DraftPublishAborted?Pn:new DraftPublishAborted(co,{cause:Pn})}function RecoveryDialog({draft:Un,onClose:Pn,onSuccess:ei}){const{t:co,lang:xo}=useI18n(),[os,hs]=reactExports.useState([]),[Ms,ea]=reactExports.useState(Un.domainId??""),[ta,ra]=reactExports.useState([]),[na,ia]=reactExports.useState(""),[oa,sa]=reactExports.useState(`${Un.displayName||"untitled"}_recovered.md`),[aa,la]=reactExports.useState(!1),[ca,ua]=reactExports.useState(null),da=reactExports.useRef(null),ha=reactExports.useRef(!0);reactExports.useEffect(()=>(ha.current=!0,()=>{ha.current=!1}),[]),reactExports.useEffect(()=>{fetchDomainsSafe().then(ma=>{ha.current&&hs(ma)})},[]),reactExports.useEffect(()=>{Ms&&(ra([]),ia(""),fetchTreeApi(Ms).then(ma=>{ha.current&&ra(ma)}).catch(()=>{ha.current&&ra([])}))},[Ms]),reactExports.useEffect(()=>{const ma=window.setTimeout(()=>{var ga;return(ga=da.current)==null?void 0:ga.focus()},0);return()=>window.clearTimeout(ma)},[]),reactExports.useEffect(()=>{const ma=ga=>{ga.key==="Escape"&&Pn()};return window.addEventListener("keydown",ma),()=>window.removeEventListener("keydown",ma)},[Pn]);function fa(ma,ga){for(const xa of ma){if(xa.type==="folder"&&xa.path===ga)return xa.documentId;if(xa.type==="folder"){const va=fa(xa.children,ga);if(va)return va}}return null}async function pa(ma){ma.preventDefault(),la(!0),ua(null);const ga=oa.replace(/\s+/g,"_").replace(/[^a-zA-Z0-9_\-.]/g,""),xa=ga.endsWith(".md")?ga:ga+".md",va=xa.replace(/\.md$/i,"");try{const ya=na?`${na}/${xa}`:xa,Ca=na?fa(ta,na)??void 0:void 0;await createDocumentApi({fileName:xa,displayName:va,content:Un.content,domainId:Ms,parentId:Ca}),ei()}catch(ya){ua(translateError(co,ya))}finally{la(!1)}}return jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:ma=>{ma.target===ma.currentTarget&&!aa&&Pn()},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card mdocs-recovery-dialog",role:"dialog","aria-modal":"true",children:[jsxRuntimeExports.jsx("h1",{children:co("recoverDraft")}),jsxRuntimeExports.jsx("p",{className:"muted",children:co("recoverDraftDesc",{name:Un.displayName||co("unknownTitle")})}),jsxRuntimeExports.jsxs("form",{onSubmit:pa,className:"mdocs-dialog-form",children:[jsxRuntimeExports.jsxs("label",{className:"mdocs-dialog-label",children:[co("domainLabel"),os.length>0&&jsxRuntimeExports.jsx(DomainSelect,{domains:os,value:Ms,onChange:ea,onDomainsChange:hs,ariaLabel:co("domainLabel"),localizeName:ma=>localizeDomainName(ma,xo,co)})]}),jsxRuntimeExports.jsxs("label",{className:"mdocs-dialog-label mdocs-recovery-tree-label",children:[co("recoverTargetFolder"),jsxRuntimeExports.jsx("div",{className:"mdocs-recovery-tree",children:jsxRuntimeExports.jsx(DocumentTree,{nodes:ta,activeDocumentId:null,selectedParentPath:na,onOpen:()=>{},onOpenFolder:ma=>ia(ma),onContextMenu:()=>{},onDeselect:()=>ia("")})})]}),jsxRuntimeExports.jsxs("label",{className:"mdocs-dialog-label",children:[co("fileNameLabel"),jsxRuntimeExports.jsx("input",{ref:da,value:oa,onChange:ma=>sa(ma.target.value),placeholder:"recovered.md",maxLength:200,disabled:aa})]}),ca&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-error",children:ca}),jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>!aa&&Pn(),disabled:aa,children:co("cancel")}),jsxRuntimeExports.jsx("button",{type:"submit",className:"primary",disabled:aa,children:co(aa?"creating":"create")})]})]})]})})}function DraftListPage({onPublish:Un,onClose:Pn,onCountChange:ei,onRecover:co}){const{t:xo}=useI18n(),[os,hs]=reactExports.useState([]),[Ms,ea]=reactExports.useState(new Set),[ta,ra]=reactExports.useState(!1),[na,ia]=reactExports.useState(null),[oa,sa]=reactExports.useState(null),[aa,la]=reactExports.useState(null),ca=reactExports.useRef(null),ua=reactExports.useRef(!0);reactExports.useEffect(()=>(ua.current=!0,listAllDrafts().then(Ca=>{if(!ua.current)return;const wa=Ca.filter(Ea=>!Ea.published);hs(wa),ei==null||ei(wa.length)}),()=>{ua.current=!1,ca.current&&(clearTimeout(ca.current),ca.current=null)}),[]),reactExports.useEffect(()=>{const Ca=wa=>{wa.key==="Escape"&&Pn()};return window.addEventListener("keydown",Ca),()=>window.removeEventListener("keydown",Ca)},[Pn]);const da=reactExports.useCallback((Ca,wa)=>{la({message:Ca,type:wa}),ca.current&&clearTimeout(ca.current),ca.current=setTimeout(()=>la(null),3e3)},[]);async function ha(Ca){await clearDraftPublishError(Ca),ea(wa=>new Set(wa).add(Ca));try{await Un(Ca),hs(wa=>{const Ea=wa.filter(Ta=>Ta.documentId!==Ca);return ei==null||ei(Ea.length),Ea}),da(xo("published"),"success")}catch(wa){wa instanceof DraftPublishAborted||da(xo("publishFailed"),"error");const Ea=await getDraft(Ca);Ea&&hs(Ta=>Ta.map($a=>$a.documentId===Ca?Ea:$a))}finally{ea(wa=>{const Ea=new Set(wa);return Ea.delete(Ca),Ea})}}async function fa(Ca){ia(null),await deleteDraft(Ca),hs(wa=>{const Ea=wa.filter(Ta=>Ta.documentId!==Ca);return ei==null||ei(Ea.length),Ea}),da(xo("draftDeleted"),"success")}function pa(Ca){const wa=os.find(Ea=>Ea.documentId===Ca);wa&&sa(wa)}function ma(Ca){sa(null),deleteDraft(Ca),hs(wa=>{const Ea=wa.filter(Ta=>Ta.documentId!==Ca);return ei==null||ei(Ea.length),Ea}),co==null||co(os.find(wa=>wa.documentId===Ca)),da(xo("published"),"success")}async function ga(){ra(!0);let Ca=0,wa=0;for(const $a of os)try{await Un($a.documentId),Ca++}catch{wa++}const Ta=(await listAllDrafts()).filter($a=>!$a.published);hs(Ta),ei==null||ei(Ta.length),wa===0?da(xo("publishAll"),"success"):da(`${Ca} published, ${wa} failed`,"error"),ra(!1)}const xa=Ca=>new Date(Ca).toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),va=Ca=>formatDraftPublishFailureMessage(xo,Ca,Ca.publishError??"UNKNOWN"),ya=os;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-overlay",onClick:Pn}),jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer",role:"dialog","aria-modal":"true",children:[jsxRuntimeExports.jsxs("header",{className:"mdocs-drawer-header",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer-header-text",children:[jsxRuntimeExports.jsxs("h2",{className:"mdocs-drawer-title",children:[xo("unpublishedDrafts"),ya.length>0&&jsxRuntimeExports.jsx("span",{className:"mdocs-drawer-count-badge",children:ya.length})]}),jsxRuntimeExports.jsx("span",{className:"mdocs-drawer-subtitle",children:xo("draftCount",{count:String(ya.length)})})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-drawer-close-btn",onClick:Pn,"aria-label":xo("close"),children:"×"})]}),jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-body",children:ya.length===0?jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer-empty",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-empty-icon","aria-hidden":"true",children:"✓"}),jsxRuntimeExports.jsx("p",{className:"mdocs-drawer-empty-text",children:xo("draftsEmptyState")})]}):jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-items",children:ya.map(Ca=>{const wa=!!Ca.publishError;return jsxRuntimeExports.jsxs("div",{className:wa?"mdocs-drawer-item mdocs-drawer-item-failed":"mdocs-drawer-item",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-item-icon","aria-hidden":"true",children:"📄"}),jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-drawer-item-name",children:Ca.displayName||xo("unknownTitle")}),wa?jsxRuntimeExports.jsxs("span",{className:"mdocs-drawer-item-error",children:[xa(Ca.publishErrorAt)," · ",va(Ca)]}):jsxRuntimeExports.jsxs("span",{className:"mdocs-drawer-item-meta",children:[xa(Ca.updatedAt)," · ",xo("localSnapshot")]})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-drawer-item-actions",children:[wa?jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-btn-ghost mdocs-btn-ghost-primary",disabled:ta,onClick:()=>pa(Ca.documentId),children:xo("recoverDraft")}):jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-btn-ghost mdocs-btn-ghost-primary",disabled:Ms.has(Ca.documentId)||ta,onClick:()=>void ha(Ca.documentId),children:Ms.has(Ca.documentId)?xo("publishing"):xo("publish")}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-btn-ghost mdocs-btn-ghost-danger",disabled:ta,onClick:()=>ia(Ca.documentId),children:xo("delete")})]})]},Ca.documentId)})})}),jsxRuntimeExports.jsxs("footer",{className:"mdocs-drawer-footer",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:Pn,children:xo("close")}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",disabled:ya.length===0||ta,onClick:()=>void ga(),children:ta?xo("publishing"):`${xo("publishAll")} (${ya.length})`})]}),aa&&jsxRuntimeExports.jsx("div",{className:"mdocs-drawer-toast mdocs-drawer-toast--"+aa.type,role:"status",children:aa.message})]}),na&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:Ca=>{Ca.target===Ca.currentTarget&&ia(null)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[jsxRuntimeExports.jsx("h1",{children:xo("delete")}),jsxRuntimeExports.jsx("p",{className:"muted",children:xo("confirmDeleteDraft")}),jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ia(null),children:xo("cancel")}),jsxRuntimeExports.jsx("button",{type:"button",className:"danger",onClick:()=>void fa(na),children:xo("delete")})]})]})}),oa&&jsxRuntimeExports.jsx(RecoveryDialog,{draft:oa,onClose:()=>sa(null),onSuccess:()=>ma(oa.documentId)})]})}function useDomainManagement(){const{t:Un,lang:Pn}=useI18n(),ei=getStoredVisitorId(),co=reactExports.useRef(!1),[xo,os]=reactExports.useState([]),[hs,Ms]=reactExports.useState(!1),[ea,ta]=reactExports.useState(""),[ra,na]=reactExports.useState("restricted"),[ia,oa]=reactExports.useState(!1),[sa,aa]=reactExports.useState(null),[la,ca]=reactExports.useState(null),[ua,da]=reactExports.useState(""),[ha,fa]=reactExports.useState(""),[pa,ma]=reactExports.useState("all"),[ga,xa]=reactExports.useState(null);reactExports.useEffect(()=>(co.current=!0,()=>{co.current=!1}),[]);const va=reactExports.useCallback(async()=>{Ms(!0),aa(null);try{const za=await fetchDomainsApi();if(!co.current)return;os(za)}catch(za){if(!co.current)return;aa(translateError(Un,za))}finally{co.current&&Ms(!1)}},[Un]);reactExports.useEffect(()=>{va()},[va]);async function ya(za){if(za.preventDefault(),!ea.trim()){aa(Un("domainNameRequired"));return}oa(!0),aa(null);try{if(await createDomainApi({domainName:ea.trim(),permission:ra}),!co.current)return;ta(""),na("restricted"),await va()}catch(La){if(!co.current)return;aa(translateError(Un,La))}finally{co.current&&oa(!1)}}async function Ca(za){if(ua.trim()){aa(null);try{if(await renameDomainApi(za,ua.trim()),!co.current)return;ca(null),xa(null),await va()}catch(La){if(!co.current)return;aa(translateError(Un,La))}}}function wa(za){ca(za.domainId),da(za.domainName),xa(null)}function Ea(){ca(null),xa(null)}async function Ta(za,La){aa(null);try{if(await updateDomainPermissionApi(za,La),!co.current)return;xa(null),await va()}catch(Na){if(!co.current)return;aa(translateError(Un,Na))}}async function $a(za){if(window.confirm(Un("deleteDomainConfirmDetail",{name:za.domainName,count:String(za.docCount)}))){aa(null);try{if(await deleteDomainApi(za.domainId),!co.current)return;await va()}catch(La){if(!co.current)return;aa(translateError(Un,La))}}}const Oa=reactExports.useCallback(za=>domainPermissionLabel(za,Un),[Un]),Aa=reactExports.useCallback(za=>localizeDomainName(za.domainName,Pn,Un),[Pn,Un]),Da=reactExports.useMemo(()=>{const za=ha.trim().toLowerCase();return xo.filter(La=>pa!=="all"&&La.permission!==pa?!1:za?localizeDomainName(La.domainName,Pn,Un).toLowerCase().includes(za)||La.domainName.toLowerCase().includes(za):!0)},[xo,ha,pa,Pn,Un]),Ia=reactExports.useCallback((za,La)=>{const Na=Oa(za.permission);return La?`${Na} ${Un("domainTypeBuiltinSuffix")}`:Na},[Oa,Un]);return{domains:xo,loadingDomains:hs,domainError:sa,newDomainName:ea,setNewDomainName:ta,newDomainPermission:ra,setNewDomainPermission:na,creating:ia,handleCreateDomain:ya,renamingId:la,setRenamingId:ca,renameDraft:ua,setRenameDraft:da,startRename:wa,cancelRename:Ea,handleRename:Ca,changeTypeForId:ga,setChangeTypeForId:xa,handlePermissionChange:Ta,handleDelete:$a,domainSearch:ha,setDomainSearch:fa,domainFilter:pa,setDomainFilter:ma,filteredDomains:Da,visitorId:ei,plabel:Oa,localizeDomain:Aa,domainTypeLabel:Ia}}function DomainManagementPanel(){const{t:Un}=useI18n(),Pn=useDomainManagement(),[ei,co]=reactExports.useState([]),[xo,os]=reactExports.useState(null),[hs,Ms]=reactExports.useState(null),ea=reactExports.useCallback(async()=>{try{const ra=await fetchDomainMemberTemplatesApi();co(ra)}catch{co([])}},[]);reactExports.useEffect(()=>{ea()},[ea]);async function ta(ra){os(null);try{const na=await fetchDomainMembersApi(ra.domainId);Ms({domainId:ra.domainId,creatorVisitorId:ra.creatorVisitorId,initialIds:na.map(ia=>ia.visitorId),memberRows:na})}catch(na){os({kind:"err",text:translateError(Un,na)})}}return jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-header",children:jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Un("domainManagement")})}),jsxRuntimeExports.jsx("p",{className:"mdocs-domain-mgmt-restricted-hint",children:Un("domainMgmtRestrictedMemberHint")}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-cards",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card mdocs-domain-mgmt-create",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card-title",children:Un("createDomain")}),jsxRuntimeExports.jsxs("form",{onSubmit:Pn.handleCreateDomain,className:"mdocs-domain-mgmt-create-form",children:[jsxRuntimeExports.jsxs("label",{className:"mdocs-domain-mgmt-field",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-domain-mgmt-label",children:Un("domainName")}),jsxRuntimeExports.jsx("input",{value:Pn.newDomainName,onChange:ra=>Pn.setNewDomainName(ra.target.value),placeholder:Un("domainName"),maxLength:100,disabled:Pn.creating,className:"mdocs-domain-name-input"})]}),jsxRuntimeExports.jsxs("fieldset",{className:"mdocs-domain-mgmt-fieldset",children:[jsxRuntimeExports.jsx("legend",{className:"mdocs-domain-mgmt-label",children:Un("domainPermission")}),jsxRuntimeExports.jsx("div",{className:"mdocs-domain-mgmt-type-radios",children:DOMAIN_PERMISSIONS.map(ra=>jsxRuntimeExports.jsxs("label",{className:"mdocs-domain-mgmt-radio",children:[jsxRuntimeExports.jsx("input",{type:"radio",name:"newDomainPermission",checked:Pn.newDomainPermission===ra,onChange:()=>Pn.setNewDomainPermission(ra),disabled:Pn.creating}),jsxRuntimeExports.jsx("span",{children:Pn.plabel(ra)})]},ra))})]}),jsxRuntimeExports.jsx("button",{type:"submit",className:"primary mdocs-domain-mgmt-submit",disabled:Pn.creating,children:Pn.creating?Un("creating"):Un("create")})]})]}),xo&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",style:{color:xo.kind==="ok"?"var(--mdocs-success, #0a7)":"var(--mdocs-danger)"},children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:xo.text})}),Pn.domainError&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-domain-error",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",style:{color:"var(--mdocs-danger)"},children:Pn.domainError})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card mdocs-domain-mgmt-toolbar",children:[jsxRuntimeExports.jsx("input",{type:"search",value:Pn.domainSearch,onChange:ra=>Pn.setDomainSearch(ra.target.value),placeholder:Un("domainSearchPlaceholder"),className:"mdocs-domain-mgmt-search","aria-label":Un("domainSearchPlaceholder")}),jsxRuntimeExports.jsx("div",{className:"mdocs-domain-mgmt-filters",role:"group","aria-label":Un("domainPermission"),children:["all",...DOMAIN_PERMISSIONS].map(ra=>jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-domain-mgmt-filter"+(Pn.domainFilter===ra?" active":""),"aria-pressed":Pn.domainFilter===ra,onClick:()=>Pn.setDomainFilter(ra),children:ra==="all"?Un("domainFilterAll"):Pn.plabel(ra)},ra))})]}),Pn.loadingDomains?jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("loading")})}):Pn.domains.length===0?jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-settings-draft-empty",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("noDomains")})}):Pn.filteredDomains.length===0?jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-settings-draft-empty",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("domainNoMatch")})}):jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-domain-table-wrap",children:jsxRuntimeExports.jsxs("table",{className:"mdocs-domain-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{scope:"col",children:Un("domainColName")}),jsxRuntimeExports.jsx("th",{scope:"col",children:Un("domainColType")}),jsxRuntimeExports.jsx("th",{scope:"col",className:"mdocs-domain-table-num",children:Un("domainColDocCount")}),jsxRuntimeExports.jsx("th",{scope:"col",children:Un("domainColActions")})]})}),jsxRuntimeExports.jsx("tbody",{children:Pn.filteredDomains.map(ra=>{const na=isDomainCreator(ra,Pn.visitorId),ia=isBuiltInDomainId(ra.domainId),oa=isDomainStructurallyLocked(ra),sa=oa?Un("domainTooltipTypeLocked",{count:String(ra.docCount)}):void 0;return jsxRuntimeExports.jsxs("tr",{className:ia?"mdocs-domain-table-row-builtin":void 0,children:[jsxRuntimeExports.jsx("td",{children:Pn.renamingId===ra.domainId?jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-table-rename",children:[jsxRuntimeExports.jsx("input",{value:Pn.renameDraft,onChange:aa=>Pn.setRenameDraft(aa.target.value),maxLength:100,autoFocus:!0,className:"mdocs-domain-name-input"}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>void Pn.handleRename(ra.domainId),children:Un("save")}),jsxRuntimeExports.jsx("button",{type:"button",onClick:Pn.cancelRename,children:Un("cancel")})]}):jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-table-name-cell",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-domain-table-name",children:Pn.localizeDomain(ra)}),ia&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-badge-builtin",children:Un("domainBuiltIn")}),!na&&!ia&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-badge-shared",children:Un("shared")})]})}),jsxRuntimeExports.jsx("td",{children:jsxRuntimeExports.jsxs("span",{className:"mdocs-domain-table-type",title:sa,children:[jsxRuntimeExports.jsx("span",{className:"mdocs-domain-permission-badge","data-permission":ra.permission,children:Pn.domainTypeLabel(ra,ia)}),oa&&!ia&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-type-lock","aria-hidden":"true",children:"🔒"})]})}),jsxRuntimeExports.jsx("td",{className:"mdocs-domain-table-num",children:ra.docCount}),jsxRuntimeExports.jsxs("td",{className:"mdocs-domain-table-actions",children:[ia&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-not-modifiable",children:Un("domainNotModifiable")}),!ia&&!na&&jsxRuntimeExports.jsx("span",{className:"mdocs-domain-not-creator-inline",children:Un("domainNotCreator")}),!ia&&na&&Pn.changeTypeForId===ra.domainId&&jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-change-type-panel",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-domain-permission-select",children:DOMAIN_PERMISSIONS.map(aa=>jsxRuntimeExports.jsx("button",{type:"button",className:ra.permission===aa?"active":"",onClick:()=>void Pn.handlePermissionChange(ra.domainId,aa),children:Pn.plabel(aa)},aa))}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>Pn.setChangeTypeForId(null),children:Un("cancel")})]}),!ia&&na&&Pn.renamingId!==ra.domainId&&Pn.changeTypeForId!==ra.domainId&&jsxRuntimeExports.jsxs("div",{className:"mdocs-domain-action-buttons",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",title:oa?Un("domainLocked"):void 0,onClick:()=>{Pn.setChangeTypeForId(null),Pn.startRename(ra)},disabled:oa,children:Un("rename")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",title:oa?sa:void 0,onClick:()=>{Pn.setRenamingId(null),Pn.setChangeTypeForId(ra.domainId)},disabled:oa,children:Un("domainChangeType")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",title:oa?Un("domainLocked"):void 0,onClick:()=>void Pn.handleDelete(ra),disabled:oa,children:Un("deleteDomain")}),ra.permission==="restricted"&&!ia&&jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>void ta(ra),children:Un("domainMembersManageButton")})]})]})]},ra.domainId)})})]})})]}),jsxRuntimeExports.jsx(VisitorPickerModal,{open:hs!==null,title:Un("domainMembersPickerTitle"),initialSelectedIds:(hs==null?void 0:hs.initialIds)??[],lockedIds:hs?[hs.creatorVisitorId]:[],seedMembers:hs==null?void 0:hs.memberRows,templates:ei,onClose:()=>Ms(null),onConfirm:async ra=>{hs&&(await putDomainMembersApi(hs.domainId,ra),os({kind:"ok",text:Un("domainMembersSaved",{count:String(ra.length)})}))}})]})}function idPrefix6(Un){return Un.length<=6?Un:`${Un.slice(0,6)}…`}function MemberTemplatesPanel(){const{t:Un}=useI18n(),Pn=reactExports.useRef(!0),[ei,co]=reactExports.useState([]),[xo,os]=reactExports.useState(!0),[hs,Ms]=reactExports.useState(null),[ea,ta]=reactExports.useState(1),[ra,na]=reactExports.useState(null),[ia,oa]=reactExports.useState(""),[sa,aa]=reactExports.useState([]),[la,ca]=reactExports.useState(!1),[ua,da]=reactExports.useState(null),[ha,fa]=reactExports.useState(!1),pa=getStoredVisitorId(),[ma,ga]=reactExports.useState([]),[xa,va]=reactExports.useState("idle"),[ya,Ca]=reactExports.useState("");reactExports.useEffect(()=>(Pn.current=!0,()=>{Pn.current=!1}),[]),reactExports.useEffect(()=>{va("loading"),fetchVisitorsDirectoryApi().then(Ga=>{Pn.current&&(ga(Ga),va("ok"))}).catch(()=>{Pn.current&&va("err")})},[]);const wa=reactExports.useMemo(()=>{const Ga=new Map;for(const Ya of ma)Ga.set(Ya.visitorId,Ya.visitorName);return Ga},[ma]),Ea=reactExports.useCallback(async()=>{os(!0),da(null);try{const Ga=await fetchDomainMemberTemplatesApi();Pn.current&&co(Ga)}catch(Ga){Pn.current&&da(translateError(Un,Ga))}finally{Pn.current&&os(!1)}},[Un]);reactExports.useEffect(()=>{Ea()},[Ea]);const Ta=reactExports.useMemo(()=>sa.map(Ga=>{const Ya=ma.find(Ja=>Ja.visitorId===Ga);return{visitorId:Ga,name:Ya?Ya.visitorName:Un("visitorPickerUnknownVisitor"),muted:!Ya}}),[sa,ma,Un]);function $a(Ga){aa(Ya=>Ya.includes(Ga)?Ya.filter(Ja=>Ja!==Ga):[...Ya,Ga])}const Oa=ea===1?ia.trim().length>0:ea===2?sa.length>0:!0;function Aa(){if(!(ea>=3)){if(!Oa){fa(!0);return}fa(!1),ta(ea+1),Ca("")}}function Da(){ea<=1||(fa(!1),ta(ea-1))}function Ia(){Ms(null),na(null),oa(""),aa(pa?[pa]:[]),da(null),ta(1),Ca(""),fa(!1)}function za(Ga){Ms(null),na(Ga.id),oa(Ga.displayName);const Ya=pa&&!Ga.visitorIds.includes(pa)?[...Ga.visitorIds,pa]:[...Ga.visitorIds];aa(Ya),da(null),ta(1),Ca(""),fa(!1)}async function La(){if(!(!ia.trim()||sa.length===0)){ca(!0),da(null);try{if(ra===null?await createDomainMemberTemplateApi({displayName:ia.trim(),visitorIds:sa}):await updateDomainMemberTemplateApi(ra,{displayName:ia.trim(),visitorIds:sa}),!Pn.current)return;Ia(),await Ea()}catch(Ga){if(!Pn.current)return;da(translateError(Un,Ga))}finally{Pn.current&&ca(!1)}}}async function Na(Ga){ca(!0),da(null);try{if(await deleteDomainMemberTemplateApi(Ga),!Pn.current)return;Ms(null),ra===Ga&&Ia(),await Ea()}catch(Ya){if(!Pn.current)return;da(translateError(Un,Ya))}finally{Pn.current&&ca(!1)}}const Wa=[{key:1,label:Un("memberTemplateStepName")},{key:2,label:Un("memberTemplateStepMembers")},{key:3,label:Un("memberTemplateStepSave")}],Ua=`${(ea-1)/2*100}%`;return jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-header",children:[jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Un(ra!==null?"memberTemplateUpdate":"memberTemplateFormNew")}),ra!==null&&jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:Ia,style:{fontSize:12},children:Un("memberTemplateCancelEdit")})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-progress",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-wizard-progress-track",children:jsxRuntimeExports.jsx("div",{className:"mdocs-wizard-progress-fill",style:{width:Ua}})}),jsxRuntimeExports.jsx("div",{className:"mdocs-wizard-progress-steps",children:Wa.map(Ga=>{const Ya=ea===Ga.key,Ja=ea>Ga.key;return jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-step-indicator",children:[jsxRuntimeExports.jsx("div",{className:`mdocs-wizard-step-circle${Ya?" current":""}${Ja?" done":""}`,children:Ja?"✓":Ga.key}),jsxRuntimeExports.jsx("span",{className:`mdocs-wizard-step-label${Ya?" current":""}${Ja?" done":""}`,children:Ga.label})]},Ga.key)})})]}),ua&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-item-desc",style:{color:"var(--mdocs-danger)",marginBottom:12,marginTop:12},children:ua}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-cards",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card mdocs-wizard-card",children:[ea===1&&jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-step-content",children:[jsxRuntimeExports.jsx("input",{className:"mdocs-wizard-name-input",value:ia,onChange:Ga=>oa(Ga.target.value),placeholder:Un("memberTemplateNamePlaceholder"),maxLength:200,disabled:la,autoFocus:!0,"aria-invalid":ha&&!ia.trim()}),ha&&!ia.trim()&&jsxRuntimeExports.jsx("p",{className:"mdocs-wizard-hint",style:{color:"var(--mdocs-danger)"},children:Un("domainNameRequired")})]}),ea===2&&jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-step-content",children:[jsxRuntimeExports.jsx(VisitorPickerContent,{visitors:ma,loadState:xa,searchFilter:ya,onSearchChange:Ca,selectedIds:new Set(sa),onToggle:$a,selectedRows:Ta,myVisitorId:pa}),jsxRuntimeExports.jsx("p",{className:`mdocs-wizard-hint${ha&&sa.length===0?" danger":""}`,children:"💡 "+Un("memberTemplateStep2Hint")})]}),ea===3&&jsxRuntimeExports.jsx("div",{className:"mdocs-wizard-step-content",children:jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-preview-card",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-preview-row",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-label",children:Un("memberTemplateNameLabel")}),jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-value",children:ia})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-preview-row",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-label",children:Un("memberTemplateIdsLabel")}),jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-value",children:Un("memberTemplateSelectedSummary",{count:String(sa.length)})})]}),sa.length>0&&jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-preview-tags",children:[sa.slice(0,15).map(Ga=>jsxRuntimeExports.jsx("span",{className:"mdocs-wizard-preview-tag",children:idPrefix6(Ga)},Ga)),sa.length>15&&jsxRuntimeExports.jsxs("span",{className:"mdocs-wizard-preview-tag mdocs-wizard-preview-tag-more",children:["+",sa.length-15]})]})]})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-wizard-footer",children:[jsxRuntimeExports.jsxs("button",{type:"button",className:"secondary",onClick:Da,children:["← ",Un("memberTemplateWizardBack")]}),ea<3?jsxRuntimeExports.jsxs("button",{type:"button",className:"primary",onClick:Aa,children:[Un("memberTemplateWizardNext")," →"]}):jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>void La(),children:Un(la?"saving":ra===null?"memberTemplateCreate":"memberTemplateUpdate")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card-title",children:Un("memberTemplateSavedList")}),xo?jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("loading")}):ei.length===0?jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-empty",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("memberTemplateEmpty")}),ra===null&&jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:Ia,children:Un("memberTemplateEmptyAction")})]}):jsxRuntimeExports.jsx("ul",{className:"mdocs-member-template-list",children:ei.map(Ga=>jsxRuntimeExports.jsx("li",{className:"mdocs-member-template-row",children:hs===Ga.id?jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-confirm-row",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-member-template-confirm-text",children:Un("memberTemplateConfirmDeleteDesc",{name:Ga.displayName})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-confirm-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",style:{color:"var(--mdocs-danger)"},onClick:()=>void Na(Ga.id),children:Un(la?"saving":"memberTemplateConfirmDeleteSubmit")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>Ms(null),children:Un("memberTemplateConfirmDeleteCancel")})]})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-row-head",children:[jsxRuntimeExports.jsx("strong",{children:Ga.displayName}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Un("memberTemplateCount",{count:String(Ga.visitorIds.length)})}),Ga.visitorIds.length>0&&jsxRuntimeExports.jsx("div",{className:"mdocs-member-template-tags mdocs-member-template-tags-scroll",children:Ga.visitorIds.map(Ya=>jsxRuntimeExports.jsx("span",{className:"mdocs-member-template-tag",children:wa.get(Ya)??idPrefix6(Ya)},Ya))})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-member-template-row-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>za(Ga),children:Un("edit")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>Ms(Ga.id),children:Un("memberTemplateDelete")})]})]})},Ga.id))})]})]})]})}const mdocsLogo="/assets/mdocs-logo-Dsv_2t6v.svg";function getBool(Un,Pn){const ei=localStorage.getItem(Un);return ei===null?Pn:ei==="true"}function SettingsPage(Un){const{t:Pn,lang:ei,setLang:co}=useI18n(),{onBack:xo,onPublishDraft:os}=Un,hs=reactExports.useRef(!0);reactExports.useEffect(()=>(hs.current=!0,()=>{hs.current=!1}),[]);const[Ms,ea]=reactExports.useState(()=>getBool("mdocs.autoPublish",!1)),[ta,ra]=reactExports.useState(()=>getBool("mdocs.autoEdit",!0)),[na,ia]=reactExports.useState(!1),[oa,sa]=reactExports.useState("general"),[aa,la]=reactExports.useState([]),[ca,ua]=reactExports.useState(!0),[da,ha]=reactExports.useState(null),[fa,pa]=reactExports.useState(!1),[ma,ga]=reactExports.useState(!1),[xa,va]=reactExports.useState(!1),[ya,Ca]=reactExports.useState(!1),[wa,Ea]=reactExports.useState(null),[Ta,$a]=reactExports.useState(!1),[Oa,Aa]=reactExports.useState(!1),[Da,Ia]=reactExports.useState(!1),[za,La]=reactExports.useState(""),[Na,Wa]=reactExports.useState(!1),[Ua,Ga]=reactExports.useState(!1),[Ya,Ja]=reactExports.useState(0),[Ra,Ma]=reactExports.useState([]),[Fa,Ha]=reactExports.useState(!1),[Ka,Sl]=reactExports.useState(""),[Za,lc]=reactExports.useState([]),[oc,hc]=reactExports.useState(!1),[gc,Rc]=reactExports.useState(""),[Xl,vc]=reactExports.useState([]),[xc,Ac]=reactExports.useState(!1),[kc,uc]=reactExports.useState(null),[fc,Ec]=reactExports.useState(new Map);reactExports.useEffect(()=>{localStorage.setItem("mdocs.autoPublish",String(Ms))},[Ms]),reactExports.useEffect(()=>{localStorage.setItem("mdocs.autoEdit",String(ta))},[ta]),reactExports.useEffect(()=>{oa==="savePublish"&&listAllDrafts().then(Lc=>{hs.current&&Ja(Lc.filter(tu=>!tu.published).length)})},[oa]),reactExports.useEffect(()=>{oa==="bookmarks"&&$c(),oa==="myDocuments"&&jc()},[oa]),reactExports.useEffect(()=>{_c()},[]),reactExports.useEffect(()=>{fetchDomainsApi().then(Lc=>{hs.current&&vc(Lc)}).catch(()=>{})},[]);const Mc=new Map(Xl.map(Lc=>[Lc.domainId,Lc.domainName]));async function _c(){try{ua(!0);const Lc=await listCliTokensApi();if(!hs.current)return;la(Lc)}catch{}finally{hs.current&&ua(!1)}}async function $c(){try{Ha(!0);const Lc=await fetchBookmarksApi();if(!hs.current)return;Ma(Lc)}catch{}finally{hs.current&&Ha(!1)}}async function jc(){try{hc(!0);const Lc=await fetchMyDocumentsApi();if(!hs.current)return;lc(Lc)}catch{}finally{hs.current&&hc(!1)}}async function Vc(Lc){try{await removeBookmarkApi(Lc),Ma(tu=>tu.filter(hu=>hu.documentId!==Lc))}catch{}}function Oc(){if(aa.some(tu=>!tu.revoked)){ga(!0);return}Nc()}async function Nc(){try{pa(!0);const Lc=await createCliTokenApi();ha({token:Lc.token,name:Lc.name}),await _c()}finally{pa(!1)}}async function qc(){try{Ia(!0);const Lc=await generateRecoveryCodeApi();Ea(Lc.recoveryCode)}finally{Ia(!1)}}async function Zc(Lc){Lc.preventDefault();const tu=za.trim();if(!(tu&&tu.length<4))try{Wa(!0),await setPasswordApi(tu),La(""),Ga(!0),setTimeout(()=>Ga(!1),3e3)}finally{Wa(!1)}}async function Wc(Lc){uc(Lc);try{const tu=await getDocumentInvitesApi(Lc),hu=new Map;tu.forEach(Uc=>{hu.set(Uc.visitorId,Uc.permission)}),Ec(hu)}catch{Ec(new Map)}Ac(!0)}async function ou(Lc){if(kc)try{const tu=new Set(Lc.map(Uc=>Uc.visitorId)),hu=new Set(fc.keys());for(const Uc of hu)tu.has(Uc)||await removeDocumentInviteApi(kc,Uc);for(const Uc of Lc)await addDocumentInviteApi(kc,Uc.visitorId,Uc.permission);await jc()}finally{Ac(!1),uc(null)}}const eu=Ra.filter(Lc=>{if(!Ka.trim())return!0;const tu=Ka.toLowerCase();return(Lc.displayName||Lc.relativePath||"").toLowerCase().includes(tu)||(Lc.ownerVisitorName||"").toLowerCase().includes(tu)||(Lc.domainId||"").toLowerCase().includes(tu)}),du=Za.filter(Lc=>{if(!gc.trim())return!0;const tu=gc.toLowerCase();return(Lc.displayName||Lc.relativePath||"").toLowerCase().includes(tu)||(Lc.domainId||"").toLowerCase().includes(tu)});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("aside",{className:"mdocs-sidebar",children:[jsxRuntimeExports.jsx("header",{className:"mdocs-sidebar-header",children:jsxRuntimeExports.jsxs("div",{className:"mdocs-brand",children:[jsxRuntimeExports.jsx("img",{src:mdocsLogo,alt:Pn("brand"),className:"mdocs-brand-logo"}),jsxRuntimeExports.jsx("span",{children:Pn("brand")})]})}),jsxRuntimeExports.jsxs("nav",{className:"mdocs-config-tree",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="general"?" active":""),onClick:()=>sa("general"),children:Pn("general")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="bookmarks"?" active":""),onClick:()=>sa("bookmarks"),children:Pn("bookmarkTitle")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="myDocuments"?" active":""),onClick:()=>sa("myDocuments"),children:Pn("myDocuments")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="domainManagement"?" active":""),onClick:()=>sa("domainManagement"),children:Pn("domainManagement")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="memberTemplates"?" active":""),onClick:()=>sa("memberTemplates"),children:Pn("memberTemplates")}),jsxRuntimeExports.jsx("div",{className:"mdocs-config-item"+(oa==="savePublish"?" active":""),onClick:()=>sa("savePublish"),children:Pn("saveAndPublish")})]}),jsxRuntimeExports.jsx("footer",{className:"mdocs-settings-sidebar-footer",onClick:xo,children:Pn("backToDocs")})]}),jsxRuntimeExports.jsxs("main",{className:"mdocs-main",children:[isDemoMode(),oa==="general"?jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-header",children:jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Pn("general")})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-cards",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsxs("label",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-info",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("language")})}),jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-lang",children:[jsxRuntimeExports.jsx("button",{type:"button",className:ei==="en"?"active":"",onClick:()=>co("en"),children:"EN"}),jsxRuntimeExports.jsx("span",{children:"/"}),jsxRuntimeExports.jsx("button",{type:"button",className:ei==="zh"?"active":"",onClick:()=>co("zh"),children:"中"})]})]})}),jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsxs("label",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("autoEdit")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("autoEditDesc")})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-toggle"+(ta?" active":""),role:"switch","aria-checked":ta,onClick:()=>ra(Lc=>!Lc),children:jsxRuntimeExports.jsx("span",{className:"mdocs-toggle-knob"})})]})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("cliToken")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("cliTokenDesc")}),!ca&&aa.length>0&&jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",style:{marginTop:8,fontSize:"0.85em",opacity:.8},children:aa.map(Lc=>jsxRuntimeExports.jsxs("span",{style:{display:"block"},children:[Lc.name," — ",new Date(Lc.createdAt).toLocaleString()," ",Lc.revoked?`(${Pn("cliTokenRevoked")})`:`(${Pn("cliTokenActive")})`]},Lc.tokenId))})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:Oc,disabled:fa||ca,children:fa?"…":aa.some(Lc=>!Lc.revoked)?Pn("cliTokenReset"):Pn("cliTokenCreate")})]}),da&&jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result mdocs-settings-secret-result--ok",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result-head",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("cliTokenGenerated")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-secret-value",children:da.token})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:()=>{(async()=>{try{await navigator.clipboard.writeText(da.token),Ca(!1),va(!0),window.setTimeout(()=>va(!1),2e3)}catch{va(!1),Ca(!0),window.setTimeout(()=>Ca(!1),3e3)}})()},children:Pn(xa?"cliTokenCopied":"cliTokenCopy")}),jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ha(null),children:Pn("close")})]}),xa&&jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--ok",role:"status",children:["✓ ",Pn("cliTokenCopied")]}),ya&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--err",role:"status",children:Pn("cliTokenCopyFailed")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:"🔑 恢复码"}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:"当 Token 丢失时,可用恢复码找回身份。生成后请立即保存,仅显示一次。"})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:qc,disabled:Da,children:Da?"…":"生成恢复码"})]}),wa&&jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result mdocs-settings-secret-result--warn",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result-head",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:"🔑 你的恢复码"}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",style:{marginTop:8},children:"请立即复制保存,关闭后不可再查看。"}),jsxRuntimeExports.jsx("div",{className:"mdocs-settings-secret-code",children:wa})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-secret-result-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>{(async()=>{try{await navigator.clipboard.writeText(wa),Aa(!1),$a(!0),window.setTimeout(()=>$a(!1),2e3)}catch{$a(!1),Aa(!0),window.setTimeout(()=>Aa(!1),3e3)}})()},children:Ta?"已复制":"复制恢复码"}),jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>Ea(null),children:Pn("close")})]}),Ta&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--ok",role:"status",children:"✓ 已复制到剪贴板"}),Oa&&jsxRuntimeExports.jsx("div",{className:"mdocs-settings-copy-feedback mdocs-settings-copy-feedback--err",role:"status",children:"复制失败,请手动选中上方内容复制"})]})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-item",children:jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:"🔐 登录密码"}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:"设置密码后,可在其他浏览器或设备用「用户名+密码」登录。"})]})}),jsxRuntimeExports.jsxs("form",{onSubmit:Zc,style:{marginTop:12},children:[jsxRuntimeExports.jsx("input",{type:"password",placeholder:"输入新密码(至少 4 位,留空则清除密码)",value:za,onChange:Lc=>La(Lc.target.value),minLength:0,style:{marginBottom:8}}),Ua&&jsxRuntimeExports.jsx("div",{style:{color:"#4caf50",marginBottom:8,fontSize:"0.875rem"},children:"✓ 密码设置成功"}),jsxRuntimeExports.jsx("button",{type:"submit",className:"secondary",disabled:Na,children:Na?"设置中…":"保存密码"})]})]})]})]}):oa==="bookmarks"?jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-header",children:jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Pn("bookmarkTitle")})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsx("input",{type:"text",className:"mdocs-settings-search",placeholder:Pn("bookmarkSearch"),value:Ka,onChange:Lc=>Sl(Lc.target.value)}),Fa?jsxRuntimeExports.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:Pn("loading")}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:eu.length===0?jsxRuntimeExports.jsx("div",{style:{textAlign:"center",padding:"40px 0",opacity:.6},children:Pn(Ka?"bookmarkNoMatch":"bookmarkEmpty")}):jsxRuntimeExports.jsxs("table",{className:"mdocs-settings-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{children:Pn("bookmarkColTitle")}),jsxRuntimeExports.jsx("th",{children:Pn("bookmarkColDomain")}),jsxRuntimeExports.jsx("th",{children:Pn("bookmarkColAuthor")}),jsxRuntimeExports.jsx("th",{children:Pn("bookmarkColTime")}),jsxRuntimeExports.jsx("th",{style:{textAlign:"right"}})]})}),jsxRuntimeExports.jsx("tbody",{children:eu.map(Lc=>jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{style:{cursor:"pointer",fontWeight:500},onClick:()=>Un.onOpenDocument(Lc.documentId),children:Lc.displayName||Lc.relativePath||"Untitled"}),jsxRuntimeExports.jsx("td",{children:Lc.isDeleted?jsxRuntimeExports.jsx("span",{style:{opacity:.5,fontStyle:"italic"},children:"已删除"}):Mc.get(Lc.domainId||"")||Lc.domainId||"—"}),jsxRuntimeExports.jsx("td",{children:Lc.ownerVisitorName||"—"}),jsxRuntimeExports.jsx("td",{children:new Date(Lc.bookmarkedAt).toLocaleDateString()}),jsxRuntimeExports.jsx("td",{style:{textAlign:"right"},children:jsxRuntimeExports.jsx("button",{type:"button",className:"secondary small",onClick:()=>Vc(Lc.documentId),children:Pn("bookmarkRemove")})})]},Lc.documentId))})]})})]})]}):oa==="myDocuments"?jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-header",children:jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Pn("myDocuments")})}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-card",children:[jsxRuntimeExports.jsx("input",{type:"text",className:"mdocs-settings-search",placeholder:"搜索文章…",value:gc,onChange:Lc=>Rc(Lc.target.value)}),oc?jsxRuntimeExports.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:Pn("loading")}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:du.length===0?jsxRuntimeExports.jsx("div",{style:{textAlign:"center",padding:"40px 0",opacity:.6},children:Pn(gc?"myDocumentsNoMatch":"myDocumentsEmpty")}):jsxRuntimeExports.jsxs("table",{className:"mdocs-settings-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{children:Pn("myDocumentsColTitle")}),jsxRuntimeExports.jsx("th",{children:Pn("myDocumentsColDomain")}),jsxRuntimeExports.jsx("th",{children:Pn("myDocumentsColUpdated")}),jsxRuntimeExports.jsx("th",{children:Pn("myDocumentsColCreated")}),jsxRuntimeExports.jsx("th",{colSpan:2})]})}),jsxRuntimeExports.jsx("tbody",{children:du.map(Lc=>jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("td",{style:{cursor:"pointer",fontWeight:500},onClick:()=>Un.onOpenDocument(Lc.documentId),children:Lc.displayName||Lc.relativePath||"Untitled"}),jsxRuntimeExports.jsx("td",{children:Mc.get(Lc.domainId||"")||Lc.domainId||"—"}),jsxRuntimeExports.jsx("td",{children:new Date(Lc.updatedAt).toLocaleDateString()}),jsxRuntimeExports.jsx("td",{children:new Date(Lc.createdAt).toLocaleDateString()}),jsxRuntimeExports.jsx("td",{style:{textAlign:"right"},children:jsxRuntimeExports.jsx("button",{type:"button",className:"secondary small",onClick:()=>Wc(Lc.documentId),children:Pn("docInfoInviteMember")})}),jsxRuntimeExports.jsx("td",{style:{textAlign:"right",paddingLeft:0},children:jsxRuntimeExports.jsx("button",{type:"button",className:"primary small",onClick:()=>Un.onOpenDocument(Lc.documentId),children:Pn("bookmarkOpen")})})]},Lc.documentId))})]})})]})]}):oa==="domainManagement"?jsxRuntimeExports.jsx(DomainManagementPanel,{}):oa==="memberTemplates"?jsxRuntimeExports.jsx(MemberTemplatesPanel,{}):jsxRuntimeExports.jsxs("div",{className:"mdocs-settings",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-header",children:[jsxRuntimeExports.jsx("h2",{className:"mdocs-settings-title",children:Pn("saveAndPublish")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:xo,children:Pn("backToDocs")})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-settings-cards",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsxs("label",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("autoSave")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("autoSaveAlwaysOnDesc")})]}),jsxRuntimeExports.jsx("span",{className:"mdocs-toggle active",role:"switch","aria-checked":"true","aria-disabled":"true",style:{opacity:.6,cursor:"not-allowed"},children:jsxRuntimeExports.jsx("span",{className:"mdocs-toggle-knob"})})]})}),jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card",children:jsxRuntimeExports.jsxs("label",{className:"mdocs-settings-item",children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-item-info",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-settings-card-title",children:Pn("autoPublish")}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("autoPublishDesc")})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-toggle"+(Ms?" active":""),role:"switch","aria-checked":Ms,onClick:()=>ea(Lc=>!Lc),children:jsxRuntimeExports.jsx("span",{className:"mdocs-toggle-knob"})})]})}),Ya>0?jsxRuntimeExports.jsxs("button",{className:"mdocs-settings-card mdocs-settings-draft-link",onClick:()=>ia(!0),children:[jsxRuntimeExports.jsxs("span",{className:"mdocs-settings-draft-link-text",children:["📄 ",Pn("viewDrafts")," (",Ya,")"]}),jsxRuntimeExports.jsx("span",{className:"mdocs-settings-draft-arrow","aria-hidden":"true",children:"›"})]}):jsxRuntimeExports.jsx("div",{className:"mdocs-settings-card mdocs-settings-draft-empty",children:jsxRuntimeExports.jsx("span",{className:"mdocs-settings-item-desc",children:Pn("noDrafts")})})]})]}),na&&jsxRuntimeExports.jsx(DraftListPage,{onPublish:os,onClose:()=>ia(!1),onCountChange:Ja,onRecover:Un.onRecoverDraft})]}),ma&&jsxRuntimeExports.jsx(ConfirmDialog,{title:Pn("cliToken"),message:Pn("cliTokenResetConfirm"),confirmLabel:Pn("cliTokenReset"),cancelLabel:Pn("cancel"),busy:fa,onConfirm:()=>{ga(!1),Nc()},onCancel:()=>ga(!1)}),jsxRuntimeExports.jsx(VisitorPickerModal,{open:xc,title:Pn("docInfoInviteMember"),initialSelectedIds:[...fc.keys()],initialPermissions:fc,templates:[],showPermissionSelect:!0,permissionOptions:[{value:"read",label:Pn("invitePermissionRead")},{value:"edit",label:Pn("invitePermissionEdit")}],onClose:()=>Ac(!1),onConfirm:Lc=>{ou(Lc)}})]})}function MessageDialog({title:Un,message:Pn,onClose:ei}){const{t:co}=useI18n();return jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:xo=>{xo.target===xo.currentTarget&&ei()},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card mdocs-message-dialog",role:"alertdialog","aria-modal":"true",children:[Un&&jsxRuntimeExports.jsx("h2",{className:"mdocs-message-dialog-title",children:Un}),jsxRuntimeExports.jsx("p",{className:"mdocs-message-dialog-body",children:Pn}),jsxRuntimeExports.jsx("div",{className:"mdocs-message-dialog-actions",children:jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:ei,children:co("gotIt")})})]})})}function buildLexicalJsonHeading(Un){return JSON.stringify({root:{children:[{children:[{detail:0,format:0,mode:"normal",text:Un,type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"heading",tag:"h1",version:1}],direction:"ltr",type:"root",version:1}})}function joinDocPath(Un,Pn){const ei=Un.trim(),co=Pn.trim();return co?ei?`${ei}/${co}`:co:ei}function collectDocumentPaths(Un,Pn=new Set){for(const ei of Un)ei.type==="document"?Pn.add(ei.path):(ei.descDocumentId&&Pn.add(folderDescPathForFolder(ei.path)),collectDocumentPaths(ei.children,Pn));return Pn}function findFolderIdByPath(Un,Pn){for(const ei of Un){if(ei.type==="folder"&&ei.path===Pn)return ei.documentId;if(ei.type==="folder"){const co=findFolderIdByPath(ei.children,Pn);if(co)return co}}return null}function translateStorageError(Un,Pn){const ei=STORAGE_ERROR_MESSAGE_MAP[Pn];return ei?Un(ei):Pn}function useCreateModal(Un){const{tree:Pn,currentDomainId:ei,selectedCreateParentPath:co,t:xo,onDocCreated:os,refreshTree:hs}=Un,[Ms,ea]=reactExports.useState(null),[ta,ra]=reactExports.useState(null),[na,ia]=reactExports.useState(!1),oa=reactExports.useRef(null);reactExports.useEffect(()=>{if(!Ms)return;const ca=window.setTimeout(()=>{var ua;return(ua=oa.current)==null?void 0:ua.focus()},0);return()=>window.clearTimeout(ca)},[Ms]);function sa(ca){const ua=ca!==void 0;ra(null),ea({kind:"document",parentMode:ua?"fixed":"selection",parentPath:ua?ca:"",draft:"untitled.md"})}function aa(ca){const ua=ca!==void 0;ra(null),ea({kind:"folder",parentMode:ua?"fixed":"selection",parentPath:ua?ca:"",draft:""})}async function la(ca){if(ca.preventDefault(),!Ms)return;ia(!0),ra(null);const ua=collectDocumentPaths(Pn),da=Ms.parentMode==="selection"?co:Ms.parentPath;try{if(Ms.kind==="document"){const ga=parseDisplayNameMarkdownFile(Ms.draft);if(!ga.ok){ra(translateStorageError(xo,ga.message));return}const xa=ga.displayFile,va=xa.replace(/\.md$/i,"");let ya;try{ya=normaliseRelativePathForStorage(joinDocPath(da,xa))}catch(Ea){ra(translateError(xo,Ea));return}if(ua.has(ya)){ra(xo("pathExists"));return}const Ca=da?findFolderIdByPath(Pn,da)??void 0:void 0,wa=await createDocumentApi({fileName:xa,displayName:va,content:buildLexicalJsonHeading(va),domainId:ei,parentId:Ca});await hs(),os(wa),ea(null);return}const ha=parseDisplayNameFolder(Ms.draft);if(!ha.ok){ra(translateStorageError(xo,ha.message));return}const fa=normalisePathSegmentForStorage(ha.display);if(!fa){ra(xo("invalidFolderName"));return}const pa=joinDocPath(da,fa);if(ua.has(pa)){ra(xo("folderExists"));return}const ma=da?findFolderIdByPath(Pn,da)??void 0:void 0;await createFolderApi({name:fa,parentId:ma,domainId:ei}),await hs(),ea(null)}catch(ha){ra(translateError(xo,ha))}finally{ia(!1)}}return{createModal:Ms,setCreateModal:ea,createModalError:ta,createModalBusy:na,createModalInputRef:oa,openNewDocumentModal:sa,openNewFolderModal:aa,submitCreateModal:la}}function ConflictModal({open:Un,onClose:Pn,onResolve:ei}){const{t:co}=useI18n();return Un?jsxRuntimeExports.jsx("div",{className:"mdocs-conflict-modal-root",role:"alertdialog","aria-modal":"true",children:jsxRuntimeExports.jsxs("div",{className:"mdocs-conflict-modal-panel",children:[jsxRuntimeExports.jsx("h2",{className:"mdocs-conflict-modal-title",children:co("conflictTitle")}),jsxRuntimeExports.jsx("p",{className:"mdocs-conflict-modal-body",children:co("conflictBody")}),jsxRuntimeExports.jsxs("div",{className:"mdocs-conflict-modal-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:ei,children:co("conflictResolve")}),jsxRuntimeExports.jsx("button",{type:"button",className:"secondary",onClick:Pn,children:co("conflictClose")})]})]})}):null}function CommentsPanel({documentId:Un,visitorId:Pn,visitorName:ei,documentOwnerId:co,onClose:xo}){const[os,hs]=reactExports.useState([]),[Ms,ea]=reactExports.useState(""),[ta,ra]=reactExports.useState(null),[na,ia]=reactExports.useState(!0),[oa,sa]=reactExports.useState(!1),[aa,la]=reactExports.useState(null),[ca,ua]=reactExports.useState(null),[da,ha]=reactExports.useState(360),[fa,pa]=reactExports.useState(80),ma=reactExports.useRef(!1),ga=reactExports.useRef(!1),xa=300,va=80,ya=reactExports.useRef(null);function Ca(){const Wa=ya.current;if(!Wa)return;Wa.style.height="auto";const Ua=Wa.scrollHeight,Ga=Math.min(Math.max(Ua,va),xa);Wa.style.height=`${Ga}px`,pa(Ga)}reactExports.useEffect(()=>{setTimeout(()=>Ca(),0)},[ta]);function wa(Wa){return Pn?Wa.visitorId===Pn||co===Pn:!1}const{rootComments:Ea,repliesByParentId:Ta,totalCount:$a}=reactExports.useMemo(()=>{const Wa=[],Ua=new Map;let Ga=0;for(const Ya of os)Ya.isDeleted||(Ga++,Ya.parentId?(Ua.has(Ya.parentId)||Ua.set(Ya.parentId,[]),Ua.get(Ya.parentId).push(Ya)):Wa.push(Ya));return{rootComments:Wa,repliesByParentId:Ua,totalCount:Ga}},[os]),Oa=reactExports.useRef(Un);reactExports.useEffect(()=>{Oa.current=Un,ea(""),ra(null),ua(null),Aa()},[Un]);async function Aa(){const Wa=Oa.current;ia(!0);try{const Ua=await fetchCommentsApi(Un);if(Oa.current!==Wa)return;hs(Ua.comments)}catch(Ua){if(Oa.current!==Wa)return;ua("加载评论失败"),console.error("Failed to load comments:",Ua)}finally{Oa.current===Wa&&ia(!1)}}async function Da(){var Wa;if(!(!Ms.trim()||!Pn)){sa(!0),ua(null);try{await createCommentApi(Un,{content:Ms,parentId:(ta==null?void 0:ta.commentId)||null,replyToVisitorId:ta?((Wa=os.find(Ua=>Ua.commentId===ta.commentId))==null?void 0:Wa.visitorId)??null:null,replyToVisitorName:(ta==null?void 0:ta.visitorName)||null}),ea(""),ra(null),setTimeout(()=>Ca(),0),await Aa()}catch(Ua){ua(Ua.message||"发表失败,请重试")}finally{sa(!1)}}}async function Ia(Wa){ua(null);try{await deleteCommentApi(Un,Wa),await Aa()}catch(Ua){ua(Ua.message||"删除失败,请重试")}finally{la(null)}}function za(Wa){const Ua=Date.now()-new Date(Wa).getTime(),Ga=Math.floor(Ua/6e4),Ya=Math.floor(Ua/36e5),Ja=Math.floor(Ua/864e5);return Ga<1?"刚刚":Ga<60?`${Ga}分钟前`:Ya<24?`${Ya}小时前`:`${Ja}天前`}function La(Wa){ma.current=!0,Wa.preventDefault()}function Na(Wa){ga.current=!0,Wa.preventDefault(),document.body.style.userSelect="none",document.body.style.cursor="row-resize"}return reactExports.useEffect(()=>{function Wa(Ga){if(ma.current){const Ya=Math.max(280,Math.min(600,window.innerWidth-Ga.clientX));ha(Ya)}if(ga.current){const Ya=-Ga.movementY;pa(Ja=>Math.max(60,Math.min(600,Ja+Ya)))}}function Ua(){ma.current=!1,ga.current=!1,document.body.style.userSelect="",document.body.style.cursor=""}return window.addEventListener("mousemove",Wa),window.addEventListener("mouseup",Ua),()=>{window.removeEventListener("mousemove",Wa),window.removeEventListener("mouseup",Ua)}},[]),jsxRuntimeExports.jsxs("div",{className:"mdocs-comments-panel",style:{width:da},children:[jsxRuntimeExports.jsx("div",{className:"mdocs-comments-resize-handle",onMouseDown:La}),jsxRuntimeExports.jsxs("div",{className:"mdocs-comments-header",children:[jsxRuntimeExports.jsxs("h3",{style:{margin:0,fontSize:"1rem",display:"flex",alignItems:"center",gap:6},children:[jsxRuntimeExports.jsx(MessageSquare,{size:18}),"评论 (",$a,")"]}),jsxRuntimeExports.jsx("button",{type:"button",onClick:xo,className:"mdocs-comments-close-btn",children:jsxRuntimeExports.jsx(X$5,{size:18})})]}),ca&&jsxRuntimeExports.jsxs("div",{className:"mdocs-comments-error",children:[ca,jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ua(null),children:jsxRuntimeExports.jsx(X$5,{size:14})})]}),jsxRuntimeExports.jsx("div",{className:"mdocs-comments-list",children:na?jsxRuntimeExports.jsx("div",{className:"mdocs-comments-empty",children:"加载中..."}):Ea.length===0?jsxRuntimeExports.jsx("div",{className:"mdocs-comments-empty",children:"暂无评论,来发表第一条吧~"}):Ea.map(Wa=>jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-root",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-header",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-comment-avatar",children:Wa.visitorName.charAt(0).toUpperCase()}),jsxRuntimeExports.jsx("span",{className:"mdocs-comment-author",children:Wa.visitorName}),jsxRuntimeExports.jsx("span",{className:"mdocs-comment-time",children:za(Wa.createdAt)}),wa(Wa)&&jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>la(Wa.commentId),title:"删除",children:jsxRuntimeExports.jsx(X$5,{size:14})})]}),jsxRuntimeExports.jsx("div",{className:"mdocs-comment-content",children:Wa.content}),Pn&&jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>ra({commentId:Wa.commentId,visitorName:Wa.visitorName}),children:"回复"}),(Ta.get(Wa.commentId)??[]).length>0&&jsxRuntimeExports.jsx("div",{className:"mdocs-comment-replies",children:(Ta.get(Wa.commentId)??[]).map(Ua=>jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-reply",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-header",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-comment-avatar mdocs-comment-avatar-small",children:Ua.visitorName.charAt(0).toUpperCase()}),jsxRuntimeExports.jsx("span",{className:"mdocs-comment-author",children:Ua.visitorName}),Ua.replyToVisitorName&&jsxRuntimeExports.jsxs("span",{className:"mdocs-comment-reply-to",children:["回复 ",Ua.replyToVisitorName]}),jsxRuntimeExports.jsx("span",{className:"mdocs-comment-time",children:za(Ua.createdAt)}),wa(Ua)&&jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-comment-delete",onClick:()=>la(Ua.commentId),title:"删除",children:jsxRuntimeExports.jsx(X$5,{size:12})})]}),jsxRuntimeExports.jsx("div",{className:"mdocs-comment-content",children:Ua.content}),Pn&&jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-comment-reply-btn",onClick:()=>ra({commentId:Wa.commentId,visitorName:Ua.visitorName}),children:"回复"})]},Ua.commentId))})]},Wa.commentId))}),Pn?jsxRuntimeExports.jsxs("div",{className:"mdocs-comments-input-wrapper",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-comments-input-drag-handle",onMouseDown:Na}),ta&&jsxRuntimeExports.jsxs("div",{className:"mdocs-comment-reply-notice",children:[jsxRuntimeExports.jsxs("span",{children:["回复 ",jsxRuntimeExports.jsx("span",{className:"mdocs-comment-reply-to-name",children:ta.visitorName})]}),jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>ra(null),children:[jsxRuntimeExports.jsx(X$5,{size:14})," 取消"]})]}),jsxRuntimeExports.jsx("textarea",{ref:ya,value:Ms,onChange:Wa=>{ea(Wa.target.value.slice(0,512)),setTimeout(()=>Ca(),0)},placeholder:ta?`回复 ${ta.visitorName}...`:"发表评论...",className:"mdocs-comments-input",style:{height:fa},maxLength:512,onKeyDown:Wa=>{Wa.key==="Enter"&&(Wa.metaKey||Wa.ctrlKey)&&Da()}}),jsxRuntimeExports.jsxs("div",{className:`mdocs-comments-char-count${Ms.length>=460?" mdocs-char-count--warn":""}`,children:[Ms.length,"/512"]}),jsxRuntimeExports.jsx("div",{className:"mdocs-comments-input-actions",children:jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-btn-primary",onClick:Da,disabled:oa||!Ms.trim(),children:oa?"发表中...":"发表"})})]}):jsxRuntimeExports.jsx("div",{className:"mdocs-comments-input-wrapper",style:{textAlign:"center"},children:jsxRuntimeExports.jsx("div",{style:{color:"#666",fontSize:"0.9rem"},children:"请先创建访客身份以发表评论"})}),aa&&jsxRuntimeExports.jsx(ConfirmDialog,{title:"删除评论",message:"确定要删除这条评论吗?",confirmLabel:"删除",danger:!0,onConfirm:()=>Ia(aa),onCancel:()=>la(null)})]})}function useAutoPublish(Un,Pn){const ei=reactExports.useRef(Pn);ei.current=Pn,reactExports.useEffect(()=>{if(!Un)return;const co=3e4,xo=1e4,os=async()=>{const Ms=await listAllDrafts({skipFailed:!0}),ea=Date.now();for(const ta of Ms)if(!ta.published&&!(ea-ta.updatedAt<co))try{await ei.current(ta.documentId)}catch(ra){console.log("[autoPublish] scan publish failed:",ra)}};os();const hs=setInterval(os,xo);return()=>clearInterval(hs)},[Un])}const POLL_MS=1e4;function useDocumentVersion(Un,Pn){const[ei,co]=reactExports.useState(null),[xo,os]=reactExports.useState("up_to_date");return reactExports.useEffect(()=>{if(!Un){co(null),os("up_to_date");return}let Ms=!1;const ea=Un;async function ta(){try{const na=await getDocumentSyncStatusApi(ea,Pn??void 0);if(Ms)return;co(na.headCommitId),os(na.status)}catch{}}ta();const ra=window.setInterval(()=>void ta(),POLL_MS);return()=>{Ms=!0,window.clearInterval(ra)}},[Un,Pn]),{remoteCommitId:ei,syncStatus:xo,syncBehind:!!(Pn&&ei&&Pn!==ei)||xo==="behind"}}const MergeView=reactExports.lazy(()=>__vitePreload(()=>import("./MergeView-CTeS5Pgb.js"),[]).then(Un=>({default:Un.MergeView})));function formatRelativeTime(Un,Pn){try{const ei=new Intl.RelativeTimeFormat(Pn,{numeric:"auto"}),co=Date.now()-new Date(Un).getTime(),xo=Math.floor(co/6e4),os=Math.floor(xo/60),hs=Math.floor(os/24);return hs>30?ei.format(-Math.floor(hs/30),"month"):hs>0?ei.format(-hs,"day"):os>0?ei.format(-os,"hour"):xo>0?ei.format(-xo,"minute"):ei.format(-Math.floor(co/1e3),"second")}catch{return Un.slice(0,10)}}async function initDomainsAndTree(Un,Pn,ei,co){const xo=await fetchDomainsSafe();Pn(xo);const os=localStorage.getItem("mdocs.currentDomainId"),Ms=os&&xo.some(ea=>ea.domainId===os)?os:pickInitialDomainId(xo,Un);ei(Ms),await co(Ms)}function App(){const{t:Un,lang:Pn,setLang:ei}=useI18n(),[co,xo]=reactExports.useState("loading"),[os,hs]=reactExports.useState(()=>localStorage.getItem("mdocs.sidebarCollapsed")==="true"),Ms=()=>{const dc=!os;hs(dc),localStorage.setItem("mdocs.sidebarCollapsed",String(dc))},[ea,ta]=reactExports.useState(!1),[ra,na]=reactExports.useState(0),ia=reactExports.useRef(null),[oa,sa]=reactExports.useState(null),[aa,la]=reactExports.useState(null),[ca,ua]=reactExports.useState(null),[da,ha]=reactExports.useState([]),[fa,pa]=reactExports.useState([]),[ma,ga]=reactExports.useState("default"),{documentId:xa}=useParams(),va=useNavigate(),[ya,Ca]=reactExports.useState(null),[wa,Ea]=reactExports.useState(null),Ta=reactExports.useRef(wa);Ta.current=wa;const[$a,Oa]=reactExports.useState(0),[Aa,Da]=reactExports.useState(null),[Ia,za]=reactExports.useState(!1),[La,Na]=reactExports.useState(!1),[Wa,Ua]=reactExports.useState(!1),Ga=(ya==null?void 0:ya.documentId)??null,{syncBehind:Ya,remoteCommitId:Ja}=useDocumentVersion(Ga,Aa),[Ra,Ma]=reactExports.useState(null);reactExports.useEffect(()=>{if(!La||!ya){Ma(null);return}(async()=>{const dc=await getDraft(ya.documentId);if(dc!=null&&dc.conflict){Ma(dc.conflict);return}if(dc&&Aa&&Ja){const cc=dc.localBaseCommitId??Aa;if(!cc)return;const bc={localBaseCommitId:cc,remoteCommitId:Ja,localSnapshotContent:dc.content};await saveDraftConflict(ya.documentId,{localBaseCommitId:bc.localBaseCommitId,conflictStatus:"diverged",conflict:bc}),Ma(bc)}})()},[La,ya,Aa,Ja]),reactExports.useEffect(()=>{!ya||!Ya||!Wa||getDraft(ya.documentId).then(async dc=>{!dc||dc.conflict||dc.conflictStatus==="publish_conflict"||dc.conflictStatus!=="diverged"&&await saveDraft({...dc,conflictStatus:"diverged"})})},[ya==null?void 0:ya.documentId,Ya,Wa]),reactExports.useEffect(()=>{if(!ya){Da(null);return}let dc=!1;return getDraft(ya.documentId).then(cc=>{dc||(cc&&!cc.published&&cc.localBaseCommitId?Da(cc.localBaseCommitId):Da(ya.headCommitId??null))}),()=>{dc=!0}},[ya==null?void 0:ya.documentId,ya==null?void 0:ya.headCommitId,Wa]);const[Fa,Ha]=reactExports.useState(null),[Ka,Sl]=reactExports.useState(null),[Za,lc]=reactExports.useState(null),[oc,hc]=reactExports.useState(null),[gc,Rc]=reactExports.useState(""),[Xl,vc]=reactExports.useState("docs"),xc=reactExports.useRef(void 0);useAutoPublish(localStorage.getItem("mdocs.autoPublish")==="true",au);async function Ac(dc){var cc;await((cc=xc.current)==null?void 0:cc.call(xc)),dc()}reactExports.useEffect(()=>{kc()},[]),reactExports.useEffect(()=>{if(!Fa)return;const dc=()=>{Ha(null)};return window.addEventListener("pointerdown",dc,!0),()=>window.removeEventListener("pointerdown",dc,!0)},[Fa]),reactExports.useEffect(()=>{const dc=cc=>{var mu,xu;const bc=cc;if(((mu=bc.detail)==null?void 0:mu.status)===409)return;const Hc=(xu=bc.detail)==null?void 0:xu.message;Hc&&Sl(Hc)};return window.addEventListener(MDOCS_API_ERROR_EVENT,dc),()=>window.removeEventListener(MDOCS_API_ERROR_EVENT,dc)},[]);async function kc(){try{const dc=await fetchMe();sa(dc),storeVisitorId(dc.visitorId),await initDomainsAndTree(dc.visitorId,pa,ga,Ec),xo("ready")}catch(dc){if(dc instanceof ApiRequestError&&dc.status===401){xo("needsRegister");return}Sl(translateError(Un,dc)),xo("needsRegister")}}async function uc(dc,cc){const bc=await registerVisitorApi(dc,cc);sa(bc.visitor),la(bc.visitor.visitorId),ua(bc.recoveryCode),storeVisitorId(bc.visitor.visitorId),await initDomainsAndTree(bc.visitor.visitorId,pa,ga,Ec),xo("ready")}async function fc(dc){const cc=await fetchMe();sa(cc),await initDomainsAndTree(cc.visitorId,pa,ga,Ec),xo("ready")}async function Ec(dc){const bc=await fetchTreeApi(dc??ma);ha(bc)}function Mc(dc){Ea({documentId:dc.documentId,content:dc.content,displayName:dc.displayName}),Oa(cc=>cc+1),Ua(!1)}function _c(dc,cc){Ea({documentId:dc,content:cc.content,displayName:cc.displayName}),Oa(bc=>bc+1),Ua(!0)}async function $c(dc,cc){await deleteDraft(dc);const bc=await getDocumentApi(dc);if((ya==null?void 0:ya.documentId)===dc&&ia.current===dc){Ca(documentDetailToMeta(bc)),Ua(!1);const Hc=Ta.current,mu=cc!==void 0&&bc.content===cc,xu=(Hc==null?void 0:Hc.documentId)===dc&&Hc.content===bc.content;mu||xu?(Hc==null?void 0:Hc.documentId)===dc&&Hc.displayName!==bc.displayName&&Ea({...Hc,displayName:bc.displayName}):Mc(bc)}return bc}async function jc(dc){ia.current=dc;try{const cc=await getDraft(dc);if(ia.current!==dc)return;const bc=await getDocumentApi(dc);if(ia.current!==dc||(bc.domainId!==ma&&(localStorage.setItem("mdocs.currentDomainId",bc.domainId),ga(bc.domainId),Ec(bc.domainId)),Rc(parentDirForCreates(bc.relativePath)),bc.headCommitId&&cc&&!cc.published&&(cc.publishError===DRAFT_PUBLISH_ERROR.SYNC_HEAD_MISSING&&await clearDraftPublishError(dc),cc.localBaseCommitId||await saveDraft({...cc,localBaseCommitId:bc.headCommitId})),Ca(documentDetailToMeta(bc)),ia.current!==dc))return;cc&&!cc.published?_c(dc,cc):Mc(bc)}catch(cc){if(ia.current!==dc)return;Sl(translateError(Un,cc))}}reactExports.useEffect(()=>{co==="ready"&&(xa?jc(xa):(Ca(null),Ea(null),Da(null)))},[co,xa]);const{createModal:Vc,setCreateModal:Oc,createModalError:Nc,createModalBusy:qc,createModalInputRef:Zc,openNewDocumentModal:Wc,openNewFolderModal:ou,submitCreateModal:eu}=useCreateModal({tree:da,currentDomainId:ma,selectedCreateParentPath:gc,t:Un,onDocCreated:dc=>{Ca(documentDetailToMeta(dc)),Mc(dc),Rc(parentDirForCreates(dc.relativePath)),va(`/doc/${dc.documentId}`)},refreshTree:Ec}),[du,Lc]=reactExports.useState(!1),[tu,hu]=reactExports.useState(!1),[Uc,Yc]=reactExports.useState([]),[Qc,Xc]=reactExports.useState(""),[ja,qa]=reactExports.useState(""),[Ic,Qa]=reactExports.useState(new Set);async function ac(){try{const dc=await fetchBookmarksApi();Yc(dc)}catch(dc){Sl(translateError(Un,dc))}}const Gc=reactExports.useMemo(()=>{const dc={};for(const cc of fa)dc[cc.domainId]=cc.domainName;return dc},[fa]),Bc=reactExports.useMemo(()=>{let dc=Uc;const cc=Qc.trim().toLowerCase();return cc&&(dc=dc.filter(bc=>{var Hc;return(Hc=bc.displayName)==null?void 0:Hc.toLowerCase().includes(cc)})),ja&&(dc=dc.filter(bc=>bc.domainId===ja)),dc},[Uc,Qc,ja]),iu=reactExports.useMemo(()=>{const dc=new Set,cc=[];for(const bc of Uc){const Hc=bc.domainId;Hc&&!dc.has(Hc)&&(dc.add(Hc),cc.push({id:Hc,name:Gc[Hc]??Hc}))}return cc},[Uc,Gc]);async function gu(dc,cc,bc,Hc,mu){let xu=await getDraft(dc);!xu&&(ya==null?void 0:ya.documentId)===dc&&(xu={documentId:dc,content:cc,displayName:bc,updatedAt:Date.now(),published:!1,localBaseCommitId:Hc,relativePath:ya.relativePath,permission:ya.permission,ownerVisitorId:ya.ownerVisitorId,domainId:ya.domainId},await saveDraft(xu)),xu&&await saveDraftConflict(dc,{localBaseCommitId:Hc,conflictStatus:"publish_conflict",conflict:{localBaseCommitId:Hc,remoteCommitId:mu.headCommitId,localSnapshotContent:cc}}),za(!0)}async function ru(dc,cc,bc,Hc){return getDocumentTaskQueue(bc).execute(async()=>{const mu=await getDraft(bc),xu=(mu==null?void 0:mu.localBaseCommitId)??(ya==null?void 0:ya.headCommitId);if(!xu)throw Sl(Un("syncHeadMissing")),new Error("missing localBaseCommitId");try{await updateDocumentApi(bc,{content:dc,displayName:cc,permission:Hc,version:{localBaseCommitId:xu}}),await clearDraftConflict(bc),await $c(bc,dc),await Ec(),za(!1),Ha(Un("published")),window.setTimeout(()=>Ha(null),1200)}catch(Cu){throw Cu instanceof ApiRequestError&&Cu.status===409&&Cu.code==="VERSION_CONFLICT"&&Cu.details&&typeof Cu.details=="object"&&await gu(bc,dc,cc,xu,Cu.details),Cu}})}async function uu(){if(!ya)return;const dc=await getDocumentApi(ya.documentId);dc.domainId!==ma&&(localStorage.setItem("mdocs.currentDomainId",dc.domainId),ga(dc.domainId),Ec(dc.domainId)),Rc(parentDirForCreates(dc.relativePath)),Ca(documentDetailToMeta(dc)),Mc(dc),Ha(Un("syncPullDone")),window.setTimeout(()=>Ha(null),1200)}async function bu(){if(!ya)return;const dc=await getDraft(ya.documentId);if(dc&&!dc.published)return;if((dc==null?void 0:dc.conflictStatus)==="publish_conflict"||(dc==null?void 0:dc.conflictStatus)==="diverged"||!!(dc!=null&&dc.conflict)){Na(!0);return}await uu()}async function Du(dc){await clearDraftConflict(dc.documentId),await deleteDraft(dc.documentId),Ua(!1),Na(!1),za(!1),await jc(dc.documentId),Ec(dc.domainId),Ha(Un("published")),window.setTimeout(()=>Ha(null),1200)}async function yc(dc,cc,bc){try{await failDraftPublish(dc,cc,bc)}catch(Hc){if(!(Hc instanceof DraftPublishAborted))throw Hc;const mu=bc??await getDraft(dc);throw Ha(formatDraftPublishFailureMessage(Un,mu,Hc.code,Hc.cause??cc)),window.setTimeout(()=>Ha(null),4e3),Hc}}async function au(dc){let cc;try{await getDocumentTaskQueue(dc).execute(async()=>{const bc=await getDraft(dc);if(!bc)return;cc=bc;let Hc=bc.localBaseCommitId;if(Hc||(Hc=(await getDocumentApi(dc)).headCommitId??void 0,Hc&&(await saveDraft({...bc,localBaseCommitId:Hc}),bc.publishError===DRAFT_PUBLISH_ERROR.SYNC_HEAD_MISSING&&await clearDraftPublishError(dc))),!Hc)throw new DraftPublishAborted(DRAFT_PUBLISH_ERROR.SYNC_HEAD_MISSING);const mu=await getDraft(dc);mu&&(await updateDocumentApi(dc,{content:mu.content,displayName:mu.displayName,version:{localBaseCommitId:Hc}}),await clearDraftConflict(dc),await clearDraftPublishError(dc),(ya==null?void 0:ya.documentId)===dc?await $c(dc,mu.content):await deleteDraft(dc),await Ec(),Ha(Un("published")),window.setTimeout(()=>Ha(null),1200))})}catch(bc){await yc(dc,bc,cc)}}function mc(dc,cc){lc({type:"document",id:dc,name:cc})}function yu(dc,cc){lc({type:"folder",id:dc,name:cc})}async function pu(){if(Za)try{Za.type==="document"?(await deleteDocumentApi(Za.id),(ya==null?void 0:ya.documentId)===Za.id&&(Ca(null),Ea(null),Rc(""),va("/"))):Za.type==="folder"&&(await deleteFolderApi(Za.id),ya&&(Ca(null),Ea(null),Rc(""),va("/"))),await Ec(),Ha(Za.type==="folder"?`已删除「${Za.name}」及其下所有内容`:`已删除「${Za.name}」`),window.setTimeout(()=>Ha(null),2e3)}catch(dc){Sl(translateError(Un,dc))}finally{lc(null)}}return co==="loading"?jsxRuntimeExports.jsx("div",{className:"mdocs-loading muted",children:Un("loading")}):co==="needsRegister"?jsxRuntimeExports.jsx(VisitorRegisterDialog,{onSubmit:uc,onRecover:fc,error:Fa}):jsxRuntimeExports.jsxs("div",{className:"mdocs-app-root",children:[isDemoMode(),jsxRuntimeExports.jsxs("div",{className:"mdocs-shell",children:[aa&&oa&&jsxRuntimeExports.jsx(VisitorIdNotice,{visitorId:aa,onDismiss:()=>la(null)}),ca&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",style:{position:"fixed",zIndex:9999},onClick:dc=>{dc.target===dc.currentTarget&&ua(null)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:480,textAlign:"center"},children:[jsxRuntimeExports.jsx("h1",{style:{fontSize:"1.25rem",marginBottom:8},children:"🔑 保存你的恢复码"}),jsxRuntimeExports.jsxs("p",{className:"muted",style:{marginBottom:16,lineHeight:1.5},children:["恢复码是你的唯一凭证,当 Token 丢失时可用它找回身份。",jsxRuntimeExports.jsx("br",{}),jsxRuntimeExports.jsx("strong",{children:"请立即复制保存,此弹窗关闭后不可再查看。"})]}),jsxRuntimeExports.jsx("div",{style:{background:"#f5f5f5",borderRadius:8,padding:"12px 16px",fontFamily:"monospace",fontSize:"1.25rem",letterSpacing:"0.1em",marginBottom:20,userSelect:"all"},children:ca}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center"},children:[jsxRuntimeExports.jsx("button",{type:"button",className:"primary",onClick:()=>{navigator.clipboard.writeText(ca)},children:"复制恢复码"}),jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>ua(null),children:"已保存,关闭"})]})]})}),Xl==="settings"?jsxRuntimeExports.jsx(SettingsPage,{onBack:()=>vc("docs"),onPublishDraft:au,onOpenDocument:jc,onRecoverDraft:()=>void Ec()}):jsxRuntimeExports.jsxs("div",{className:"mdocs-layout",children:[jsxRuntimeExports.jsxs("aside",{className:`mdocs-sidebar ${os?"mdocs-sidebar-collapsed":""}`,children:[jsxRuntimeExports.jsxs("header",{className:"mdocs-sidebar-header",children:[jsxRuntimeExports.jsxs("div",{className:"mdocs-brand",children:[jsxRuntimeExports.jsx("img",{src:mdocsLogo,alt:Un("brand"),className:"mdocs-brand-logo"}),jsxRuntimeExports.jsx("span",{children:Un("brand")})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-sidebar-toggle",onClick:Ms,"aria-label":Un(os?"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:dc=>{dc.currentTarget.style.background="var(--mdocs-hover-bg, #f0f0f0)"},onMouseLeave:dc=>{dc.currentTarget.style.background="none"},children:os?jsxRuntimeExports.jsx(PanelLeftOpen,{size:18}):jsxRuntimeExports.jsx(PanelLeftClose,{size:18})})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-sidebar-actions",children:[jsxRuntimeExports.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":Un("newDocument"),onClick:()=>Wc(),style:{color:"var(--mdocs-accent)"},children:jsxRuntimeExports.jsx(File$1,{size:20})}),jsxRuntimeExports.jsx("span",{className:"mdocs-sidebar-icon mdocs-tooltip","data-tooltip":Un("newFolder"),onClick:()=>ou(),children:jsxRuntimeExports.jsx(Folder,{size:20})})]}),jsxRuntimeExports.jsx(DocumentTree,{nodes:da,activeDocumentId:xa??null,selectedParentPath:gc,onOpen:dc=>{Ac(()=>va(`/doc/${dc.documentId}`))},onOpenFolder:(dc,cc)=>{Ac(()=>{Rc(dc),cc&&va(`/doc/${cc}`)})},onContextMenu:hc,onDeselect:()=>{Ac(()=>{Rc(""),va("/")})}}),jsxRuntimeExports.jsxs("footer",{className:"mdocs-sidebar-footer",children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flex:1,cursor:"pointer"},onClick:()=>Ac(()=>vc("settings")),children:[jsxRuntimeExports.jsx("span",{className:"mdocs-visitor-avatar",children:oa?oa.visitorName.charAt(0).toUpperCase():"?"}),jsxRuntimeExports.jsx("span",{className:"mdocs-visitor-footer-name",children:oa?oa.visitorName:""})]}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-sidebar-bookmark mdocs-tooltip","data-tooltip":Un("bookmark"),onClick:()=>{hu(!0),Xc(""),qa(""),ac()},style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",fontSize:"1rem",lineHeight:1,borderRadius:4},children:jsxRuntimeExports.jsx(Star,{size:16,strokeWidth:1.5})}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-sidebar-logout mdocs-tooltip","data-tooltip":Un("logout"),onClick:()=>Lc(!0),style:{background:"none",border:"none",cursor:"pointer",padding:"6px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4},children:jsxRuntimeExports.jsx(LogOut,{size:16,strokeWidth:1.5})})]})]}),jsxRuntimeExports.jsxs("main",{className:"mdocs-main",children:[ya&&wa&&wa.documentId===ya.documentId?jsxRuntimeExports.jsxs("div",{className:"mdocs-editor-with-comments",children:[jsxRuntimeExports.jsx("div",{className:"mdocs-editor-container",children:jsxRuntimeExports.jsx(DocumentEditor,{meta:ya,initialContent:wa.content,initialDisplayName:wa.displayName,contentRevision:$a,canEdit:!!(oa&&(ya.ownerVisitorId===oa.visitorId||isPublicWritePermission(ya.permission)||ya.invitedEdit===!0)),domains:fa,currentDomainId:ma,onDomainChange:dc=>{Ac(()=>{localStorage.setItem("mdocs.currentDomainId",dc),ga(dc),Ca(null),Ea(null),Rc(""),va("/"),Ec(dc)})},onDomainsChange:pa,onPublish:ru,syncBehind:Ya,onSyncClick:()=>void bu(),onDraftExistsChange:Ua,onConflictModalRequest:()=>za(!0),onMergeRequest:()=>Na(!0),canManageInvites:!!(oa&&oa.visitorId===ya.ownerVisitorId),onDelete:async()=>{if(ya.relativePath.endsWith("/___desc___.md")){const dc=ya.relativePath.replace(/\/___desc___\.md$/,"");yu(ya.documentId,dc)}else mc(ya.documentId,ya.relativePath)},saveBeforeNavRef:xc,onShowToast:Ha,onToggleComments:()=>ta(!ea),commentPanelOpen:ea,commentCount:ra},ya.documentId)}),ea&&jsxRuntimeExports.jsx(CommentsPanel,{documentId:ya.documentId,visitorId:oa==null?void 0:oa.visitorId,visitorName:oa==null?void 0:oa.visitorName,documentOwnerId:ya.ownerVisitorId,onClose:()=>ta(!1)})]}):jsxRuntimeExports.jsxs("div",{className:"mdocs-welcome",children:[jsxRuntimeExports.jsx("h1",{children:Un("brand")}),jsxRuntimeExports.jsx("p",{className:"muted mdocs-welcome-lead",children:da.length===0?Un("noDocsInDomain"):Un("createDocToStart")}),jsxRuntimeExports.jsxs("div",{className:"mdocs-welcome-domain",children:[jsxRuntimeExports.jsx("label",{className:"muted mdocs-welcome-domain-label",children:Un("domainLabel")}),jsxRuntimeExports.jsx(DomainSelect,{domains:fa.length?fa:[{domainId:"default",domainName:Un("defaultDomain"),permission:"",creatorVisitorId:"",docCount:0}],value:ma,onChange:dc=>{Ac(()=>{localStorage.setItem("mdocs.currentDomainId",dc),ga(dc),Ca(null),Ea(null),Rc(""),va("/"),Ec(dc)})},onDomainsChange:pa,ariaLabel:Un("domainLabel"),localizeName:dc=>localizeDomainName(dc,Pn,Un)})]}),jsxRuntimeExports.jsxs("div",{className:"mdocs-welcome-actions",children:[jsxRuntimeExports.jsxs("button",{type:"button",className:"primary",onClick:()=>Wc(),style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntimeExports.jsx(File$1,{size:16,strokeWidth:1.5}),Un("newDocument")]}),jsxRuntimeExports.jsxs("button",{type:"button",className:"secondary",onClick:()=>ou(),style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntimeExports.jsx(Folder,{size:16,strokeWidth:1.5}),Un("newFolder")]})]})]}),jsxRuntimeExports.jsx(ConflictModal,{open:Ia,onClose:()=>za(!1),onResolve:()=>{za(!1),Na(!0)}}),La&&ya&&Ra&&jsxRuntimeExports.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports.jsx("div",{className:"merge-view-loading",children:Un("mergeLoadingRemote")}),children:jsxRuntimeExports.jsx(MergeView,{documentId:ya.documentId,displayName:ya.displayName,conflict:Ra,onClose:()=>Na(!1),onSuccess:Du,onError:dc=>Sl(dc)})}),Fa&&jsxRuntimeExports.jsx("div",{className:"mdocs-toast",role:"status",children:Fa}),Ka&&jsxRuntimeExports.jsx(MessageDialog,{title:Un("error"),message:Ka,onClose:()=>Sl(null)})]}),du&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",onClick:dc=>{dc.target===dc.currentTarget&&Lc(!1)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:440},children:[jsxRuntimeExports.jsx("h1",{style:{fontSize:"1.125rem",marginBottom:8},children:"退出当前登录身份?"}),jsxRuntimeExports.jsx("p",{style:{lineHeight:1.6,color:"var(--mdocs-text-secondary, #666)",marginBottom:20},children:"这将会导致您无法修改以前的文章。如果想找回账号,需要恢复码或联系管理员执行合并用户脚本。"}),jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end"},children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>Lc(!1),children:"取消"}),jsxRuntimeExports.jsx("button",{type:"button",className:"primary",style:{background:"#d32f2f"},onClick:()=>{clearVisitorId(),Ca(null),Ea(null),sa(null),ha([]),Lc(!1),xo("needsRegister")},children:"确认退出"})]})]})}),tu&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",onClick:dc=>{dc.target===dc.currentTarget&&hu(!1)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",style:{maxWidth:640,width:"min(640px, 100%)",maxHeight:"70vh",display:"flex",flexDirection:"column"},children:[jsxRuntimeExports.jsxs("h1",{style:{fontSize:"1.125rem",marginBottom:16},children:[Un("bookmarkTitle"),"(",Uc.length,")"]}),Uc.length>0&&jsxRuntimeExports.jsxs("div",{className:"mdocs-bookmark-filterbar",children:[jsxRuntimeExports.jsx("input",{type:"text",placeholder:Un("bookmarkSearch"),value:Qc,onChange:dc=>Xc(dc.target.value)}),jsxRuntimeExports.jsxs("select",{value:ja,onChange:dc=>qa(dc.target.value),children:[jsxRuntimeExports.jsx("option",{value:"",children:Un("bookmarkFilterAll")}),iu.map(dc=>jsxRuntimeExports.jsx("option",{value:dc.id,children:dc.name},dc.id))]})]}),Uc.length===0?jsxRuntimeExports.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:Un("bookmarkEmpty")}):Bc.length===0?jsxRuntimeExports.jsx("p",{style:{color:"var(--mdocs-text-muted, #999)",textAlign:"center",padding:"2rem 0"},children:Un("bookmarkNoMatch")}):jsxRuntimeExports.jsx("div",{style:{overflowY:"auto",flex:1,margin:"0 -1rem",padding:"0 1rem"},children:jsxRuntimeExports.jsxs("table",{className:"mdocs-bookmark-table",children:[jsxRuntimeExports.jsx("thead",{children:jsxRuntimeExports.jsxs("tr",{children:[jsxRuntimeExports.jsx("th",{children:Un("bookmarkColTitle")}),jsxRuntimeExports.jsx("th",{children:Un("bookmarkColDomain")}),jsxRuntimeExports.jsx("th",{children:Un("bookmarkColAuthor")}),jsxRuntimeExports.jsx("th",{children:Un("bookmarkColTime")}),jsxRuntimeExports.jsx("th",{className:"mdocs-bookmark-col-action"})]})}),jsxRuntimeExports.jsx("tbody",{children:Bc.map(dc=>{const cc=Ic.has(dc.documentId);return jsxRuntimeExports.jsxs("tr",{className:`${cc?"mdocs-bookmark-removing":""}`,style:{opacity:dc.isDeleted?.6:1},children:[jsxRuntimeExports.jsx("td",{className:"mdocs-bookmark-col-title",children:jsxRuntimeExports.jsxs("div",{style:{cursor:dc.isDeleted?"default":"pointer",display:"flex",alignItems:"center",gap:6,overflow:"hidden"},onClick:()=>{dc.isDeleted||Ac(()=>{hu(!1),va(`/doc/${dc.documentId}`)})},children:[jsxRuntimeExports.jsx("span",{ref:bc=>{if(bc){const Hc=bc.scrollWidth>bc.clientWidth;bc.title=Hc?dc.displayName??"":""}},style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:dc.displayName??"(无标题)"}),dc.isDeleted&&jsxRuntimeExports.jsx("span",{style:{fontSize:"0.7rem",color:"#d32f2f",background:"#ffebee",padding:"1px 6px",borderRadius:4,flexShrink:0},children:"已删除"})]})}),jsxRuntimeExports.jsx("td",{children:dc.isDeleted?"":Gc[dc.domainId??""]??dc.domainId??""}),jsxRuntimeExports.jsx("td",{children:dc.isDeleted?"":dc.ownerVisitorName??"-"}),jsxRuntimeExports.jsx("td",{children:dc.isDeleted?"":formatRelativeTime(dc.bookmarkedAt,Pn)}),jsxRuntimeExports.jsx("td",{className:"mdocs-bookmark-col-action",children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:2,alignItems:"center",justifyContent:"flex-end"},children:[jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":Un("bookmarkOpen"),onClick:()=>{dc.isDeleted||Ac(()=>{hu(!1),va(`/doc/${dc.documentId}`)})},style:{background:"none",border:"none",cursor:dc.isDeleted?"default":"pointer",padding:"4px",color:"var(--mdocs-text-muted, #999)",lineHeight:1,borderRadius:4,display:"inline-flex",alignItems:"center"},children:jsxRuntimeExports.jsx(BookOpen,{size:14,strokeWidth:1.5})}),jsxRuntimeExports.jsx("button",{type:"button",className:"mdocs-tooltip","data-tooltip":Un("bookmarkRemove"),onClick:async()=>{try{await removeBookmarkApi(dc.documentId),Qa(bc=>new Set(bc).add(dc.documentId)),setTimeout(()=>{Yc(bc=>bc.filter(Hc=>Hc.documentId!==dc.documentId)),Qa(bc=>{const Hc=new Set(bc);return Hc.delete(dc.documentId),Hc})},300)}catch(bc){Sl(translateError(Un,bc))}},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:bc=>{bc.currentTarget.style.color="#d32f2f"},onMouseLeave:bc=>{bc.currentTarget.style.color="var(--mdocs-text-muted, #999)"},children:"✕"})]})})]},dc.documentId)})})]})}),jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-actions",style:{justifyContent:"flex-end",marginTop:16,paddingTop:16,borderTop:"1px solid var(--mdocs-border, #eee)"},children:jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>hu(!1),children:Un("close")})})]})}),oc&&jsxRuntimeExports.jsx(TreeContextMenu,{x:oc.x,y:oc.y,node:oc.node,parentPath:oc.parentPath,onClose:()=>hc(null),onCreateChild:dc=>Wc(dc),onCreateFolder:dc=>ou(dc),onDeleteDocument:dc=>mc(dc.documentId,dc.path),onDeleteFolder:dc=>yu(dc.documentId,dc.folderDisplayName||dc.name)}),Za&&jsxRuntimeExports.jsx(ConfirmDialog,{title:Za.type==="folder"?"删除文件夹":"删除文档",message:Za.type==="folder"?`确定要删除「${Za.name}」及其下的所有文档和子文件夹吗?此操作不可撤销。`:`确定要删除「${Za.name}」吗?`,confirmLabel:"删除",cancelLabel:"取消",onConfirm:pu,onCancel:()=>lc(null),danger:!0}),Vc&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-backdrop",role:"presentation",onMouseDown:dc=>{dc.target===dc.currentTarget&&!qc&&Oc(null)},children:jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog card",role:"dialog","aria-modal":"true",children:[jsxRuntimeExports.jsx("h1",{children:Vc.kind==="document"?Un("newDocumentTitle"):Un("newFolderTitle")}),jsxRuntimeExports.jsx("p",{className:"muted",children:Vc.kind==="document"?Un("fileNameHint"):Un("folderNameHint")}),jsxRuntimeExports.jsxs("form",{onSubmit:eu,className:"mdocs-dialog-form",children:[jsxRuntimeExports.jsxs("label",{className:"mdocs-dialog-label",children:[Vc.kind==="document"?Un("fileNameLabel"):Un("folderNameLabel"),jsxRuntimeExports.jsx("input",{ref:Zc,value:Vc.draft,onChange:dc=>Oc(cc=>cc&&{...cc,draft:dc.target.value}),placeholder:Vc.kind==="document"?Un("untitledPlaceholder"):Un("folderExamplePlaceholder"),maxLength:200,disabled:qc})]}),Nc&&jsxRuntimeExports.jsx("div",{className:"mdocs-dialog-error",children:Nc}),jsxRuntimeExports.jsxs("div",{className:"mdocs-dialog-actions",children:[jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>!qc&&Oc(null),disabled:qc,children:Un("cancel")}),jsxRuntimeExports.jsx("button",{type:"submit",className:"primary",disabled:qc,children:Un(qc?"creating":"create")})]})]})]})})]})]})]})}const PlaygroundContainer=({children:Un,json:Pn,markdown:ei,collapsible:co=!1,defaultActiveKey:xo=["editor","text","json"],onJSONChange:os})=>{const[hs,Ms]=reactExports.useState(Pn),ea=reactExports.useRef(Pn);reactExports.useEffect(()=>{Pn!==ea.current&&(Ms(Pn),ea.current=Pn)},[Pn]);const ta=reactExports.useCallback(ra=>{ea.current=ra,Ms(ra)},[]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ToastHost,{}),jsxRuntimeExports.jsx(Collapse$1,{collapsible:co,defaultActiveKey:xo,items:[{children:Un,key:"editor",label:"Playground"},{children:jsxRuntimeExports.jsx(Highlighter$1,{language:"markdown",style:{fontSize:12,padding:16},variant:"borderless",children:ei}),key:"text",label:"Text Output"},{children:jsxRuntimeExports.jsx(CodeEditor,{language:"json",onBlur:()=>{if(Pn!==ea.current)try{const ra=JSON.parse(ea.current||"");os==null||os(ra)}catch(ra){console.error("Invalid JSON:",ra)}},onValueChange:ta,value:hs,variant:"borderless"}),key:"json",label:"JSON Output"}],padding:{body:0},style:{border:"none",borderRadius:0,width:"100%"},variant:"outlined"})]})},root={children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"Welcome to the Lobe Editor Demo!",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h1"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"In case you were wondering what the black box at the bottom is – it's the debug view, showing the current state of the editor. You can disable it by pressing on the settings control in the bottom-left of your screen and toggling the debug view setting.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"quote",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"The playground is a demo environment built with ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"@lobehub/editor",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:". Try typing in ",type:"text",version:1},{detail:0,format:1,mode:"normal",style:"",text:"some text",type:"text",version:1},{detail:0,format:0,mode:"normal",style:"",text:" with ",type:"text",version:1},{detail:0,format:2,mode:"normal",style:"",text:"different formats",type:"text",version:1},{detail:0,format:0,mode:"normal",style:"",text:".",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"Visit the ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Lobe Editor website",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:"noreferrer",target:null,title:null,url:"https://editor.lobehub.com"},{detail:0,format:0,mode:"normal",style:"",text:" for documentation and more information.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Check out the code on our ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"GitHub repository",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:"https://github.com/lobehub/lobe-editor",url:"https://github.com/lobehub/lobe-editor"},{detail:0,format:0,mode:"normal",style:"",text:".",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:2},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Playground code ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Playground code",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:"noreferrer",target:null,title:null,url:"https://github.com/lobehub/lobe-editor/blob/master/src/react/Editor/demos/index.tsx"},{detail:0,format:0,mode:"normal",style:"",text:" can be found here.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:3},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Join our ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Discover Server",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:"https://discord.gg/AYFPHvv2jT",url:"https://discord.gg/AYFPHvv2jT"},{detail:0,format:0,mode:"normal",style:"",text:" and chat with the team.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:4}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"bullet",start:1,tag:"ul"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Lastly, we're constantly adding cool new features to this playground. So make sure you check back here when you next get a chance 🙂.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""},{children:[{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"import",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"{",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-error);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:"Editor",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-error);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"}",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"from",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"'",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-success);",text:"@lobehub/editor",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"'",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:";",type:"code-highlight",version:1}],direction:null,format:"",indent:0,type:"code",version:1,language:"typescript",theme:"lobe-theme"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""}],direction:"ltr",format:"",indent:0,type:"root",version:1},content={root};function debounce(Un,Pn){let ei;const co=(...xo)=>{ei!==void 0&&clearTimeout(ei),ei=setTimeout(()=>Un(...xo),Pn)};return co.cancel=()=>{ei!==void 0&&(clearTimeout(ei),ei=void 0)},co}window.__scrollIntoView=scrollIntoView;const PlaygroundEditor=Un=>{const Pn=useEditor(),ei=reactExports.useRef([]),[co,xo]=reactExports.useState(""),[os,hs]=reactExports.useState(""),Ms=reactExports.useMemo(()=>debounce(ia=>{const oa=ia.getDocument("markdown"),sa=ia.getDocument("json");hs(oa||""),xo(JSON.stringify(sa||{},null,2))},200),[]),ea=reactExports.useMemo(()=>debounce(ia=>{Pn&&(console.info("handleJSONChange",ia),Pn.setDocument("json",ia))},200),[Pn]),ta=ia=>{window.editor=ia,Ms(ia)};reactExports.useEffect(()=>()=>{for(const ia of ei.current)URL.revokeObjectURL(ia);ei.current=[],Ms.cancel(),ea.cancel(),delete window.editor,delete window.__scrollIntoView},[Ms,ea]);const ra=reactExports.useMemo(()=>[{icon:jsxRuntimeExports.jsx(Avatar,{avatar:"💻",size:24}),key:"bot1",label:"前端研发专家",metadata:{id:"bot1"}},{icon:jsxRuntimeExports.jsx(Avatar,{avatar:"🌍",size:24}),key:"bot2",label:"中英文互译助手",metadata:{id:"bot2"}},{icon:jsxRuntimeExports.jsx(Avatar,{avatar:"📖",size:24}),key:"bot3",label:"学术写作增强专家",metadata:{id:"bot3"}}],[]),na=reactExports.useMemo(()=>[{icon:Heading1,key:"h1",label:"Heading 1",onSelect:oa=>{oa.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h1"})}},{icon:Heading2,key:"h2",label:"Heading 2",onSelect:oa=>{oa.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h2"})}},{icon:Heading3,key:"h3",label:"Heading 3",onSelect:oa=>{oa.dispatchCommand(INSERT_HEADING_COMMAND,{tag:"h3"})}},{type:"divider"},{icon:Minus,key:"hr",label:"Hr",onSelect:oa=>{oa.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND,{})}},{icon:Table2,key:"table",label:"Table",onSelect:oa=>{oa.dispatchCommand(INSERT_TABLE_COMMAND,{columns:"3",rows:"3"})}},{icon:Sigma,key:"tex",label:"Tex",onSelect:oa=>{oa.dispatchCommand(INSERT_MATH_COMMAND,{code:"x^2 + y^2 = z^2"}),queueMicrotask(()=>{oa.focus()})}},{type:"divider"},{key:"file",label:"File",onSelect:oa=>{openFileSelector(sa=>{for(const aa of sa)oa.dispatchCommand(INSERT_FILE_COMMAND,{file:aa})})}},{key:"set-text-content",label:"SetTextContent",onSelect:oa=>{oa.setDocument("text",`123
6236
+ 123`),queueMicrotask(()=>{oa.focus()})}},{key:"insert-link",label:"InsertLink",onSelect:oa=>{oa.dispatchCommand(INSERT_LINK_COMMAND,{url:"https://example.com"}),queueMicrotask(()=>{oa.focus()})}},{key:"insert-codeInline",label:"InsertCodeInline",onSelect:oa=>{oa.dispatchCommand(INSERT_CODEINLINE_COMMAND,void 0),queueMicrotask(()=>{oa.focus()})}},{key:"insert-codeBlock",label:"InsertCodeBlock",onSelect:oa=>{oa.dispatchCommand(INSERT_CODEMIRROR_COMMAND,void 0),queueMicrotask(()=>{oa.focus()})}},{icon:Workflow,key:"meta2d",label:"Meta2d",onSelect:oa=>{oa.dispatchCommand(INSERT_META2D_COMMAND,void 0),queueMicrotask(()=>{oa.focus()})}},{icon:Network,key:"markmap",label:"Markmap",onSelect:oa=>{oa.dispatchCommand(INSERT_MARKMAP_COMMAND,void 0),queueMicrotask(()=>{oa.focus()})}}].map(oa=>oa.type==="divider"?oa:{...oa,extra:jsxRuntimeExports.jsx(Text$3,{code:!0,fontSize:12,type:"secondary",children:oa.key})}),[]);return jsxRuntimeExports.jsxs(PlaygroundContainer,{json:co,markdown:os,onJSONChange:ea,...Un,children:[jsxRuntimeExports.jsx(Toolbar,{editor:Pn}),jsxRuntimeExports.jsx(Editor,{className:"mdocs-playground-editor",content,editor:Pn,lineEmptyPlaceholder:"Start typing here...",mentionOption:{items:ra,markdownWriter:ia=>{var oa;return`
6222
6237
  <mention>${ia.label}[${((oa=ia.metadata)==null?void 0:oa.id)||ia.label}]</mention>
6223
6238
  `},onSelect:(ia,oa)=>{ia.dispatchCommand(INSERT_MENTION_COMMAND,{label:String(oa.label),metadata:{id:oa.key}})},searchKeys:["label"]},onInit:ta,onTextChange:Ms,pasteVSCodeAsCodeBlock:!0,placeholder:"Type something...",plugins:[ReactListPlugin,ReactLinkPlugin,ReactImagePlugin,ReactCodemirrorPlugin,ReactHRPlugin,ReactTablePlugin,ReactMathPlugin,ReactMeta2dPlugin,ReactMarkmapPlugin,ReactCodePlugin,withProps(ReactToolbarPlugin,{children:jsxRuntimeExports.jsx(Toolbar,{editor:Pn,floating:!0})}),withProps(ReactAutoCompletePlugin,{delay:1e3,onAutoComplete:async({input:ia,afterText:oa,selectionType:sa,abortSignal:aa})=>{console.log("Auto-complete triggered:",{afterText:oa,input:ia,selectionType:sa});try{const la=await fetch(`${location.origin}/nodeserver/completion`,{body:JSON.stringify({prompt:`Please complete the following text:
6224
6239