@fgbg/mdocs 0.8.7 → 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.
- package/dist/web/assets/{MergeView-NmysnZX7.js → MergeView-CTeS5Pgb.js} +1 -1
- package/dist/web/assets/{_baseUniq-CikAWBtZ.js → _baseUniq-BEyyLo4a.js} +1 -1
- package/dist/web/assets/{arc-tgRIM1PH.js → arc-DRyJIB49.js} +1 -1
- package/dist/web/assets/{architectureDiagram-Q4EWVU46-B2OW7FMH.js → architectureDiagram-Q4EWVU46-C6FcFqys.js} +1 -1
- package/dist/web/assets/{blockDiagram-DXYQGD6D-DD_itpIN.js → blockDiagram-DXYQGD6D-C5DamiPe.js} +1 -1
- package/dist/web/assets/{c4Diagram-AHTNJAMY-D07jFtVS.js → c4Diagram-AHTNJAMY-BQf9874A.js} +1 -1
- package/dist/web/assets/channel-CiCXcXC3.js +1 -0
- package/dist/web/assets/{chunk-4BX2VUAB-D_JgmlRP.js → chunk-4BX2VUAB-CvLXGWM9.js} +1 -1
- package/dist/web/assets/{chunk-4TB4RGXK-Cb3XM_WX.js → chunk-4TB4RGXK-C2B5cSFk.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-BGDOpDsS.js → chunk-55IACEB6-C-va7Y5a.js} +1 -1
- package/dist/web/assets/{chunk-EDXVE4YY-u6kM_hk2.js → chunk-EDXVE4YY-NG3zjl2t.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-CObUxfOg.js → chunk-FMBD7UC4-A2P0ciLw.js} +1 -1
- package/dist/web/assets/{chunk-OYMX7WX6-gyIuxmXh.js → chunk-OYMX7WX6-Cto0U3kG.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-EzNkdSlQ.js → chunk-QZHKN3VN-DNdWRP-4.js} +1 -1
- package/dist/web/assets/{chunk-YZCP3GAM-DR6_5Bil.js → chunk-YZCP3GAM-B7BWetQd.js} +1 -1
- package/dist/web/assets/classDiagram-6PBFFD2Q-DLatDrXa.js +1 -0
- package/dist/web/assets/classDiagram-v2-HSJHXN6E-DLatDrXa.js +1 -0
- package/dist/web/assets/clone-CSlMEjIx.js +1 -0
- package/dist/web/assets/{cose-bilkent-S5V4N54A-CzezG6ox.js → cose-bilkent-S5V4N54A-DAp6XOTI.js} +1 -1
- package/dist/web/assets/{dagre-KV5264BT-ktgh-bL6.js → dagre-KV5264BT-bXw64vAF.js} +1 -1
- package/dist/web/assets/{diagram-5BDNPKRD-BVFJ-ljp.js → diagram-5BDNPKRD-BZyIxgPb.js} +1 -1
- package/dist/web/assets/{diagram-G4DWMVQ6-fsU2XEkt.js → diagram-G4DWMVQ6-B7DIbmE6.js} +1 -1
- package/dist/web/assets/{diagram-MMDJMWI5-DAbMEFAt.js → diagram-MMDJMWI5-CYIS8pup.js} +1 -1
- package/dist/web/assets/{diagram-TYMM5635-Cwfec9cw.js → diagram-TYMM5635-iVE2rLmi.js} +1 -1
- package/dist/web/assets/{erDiagram-SMLLAGMA-jk5-d5KI.js → erDiagram-SMLLAGMA-TYkyJdZq.js} +1 -1
- package/dist/web/assets/{flowDiagram-DWJPFMVM-QzBk2wAw.js → flowDiagram-DWJPFMVM-DCq4RRIH.js} +1 -1
- package/dist/web/assets/{ganttDiagram-T4ZO3ILL-CKP3IWTH.js → ganttDiagram-T4ZO3ILL-BwOIx_Vs.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-UUTBAWPF-C5V73rrQ.js → gitGraphDiagram-UUTBAWPF-CS9cfxUA.js} +1 -1
- package/dist/web/assets/{graph-Bop-GFKO.js → graph-K8x8ab-D.js} +1 -1
- package/dist/web/assets/{index-BPtysZRo.js → index-DRsX6c0H.js} +115 -95
- package/dist/web/assets/{infoDiagram-42DDH7IO-Iz6EhDIH.js → infoDiagram-42DDH7IO-DFs9J8cW.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-UXIWVN3A-BjxYzJXV.js → ishikawaDiagram-UXIWVN3A-ChYUj0ld.js} +1 -1
- package/dist/web/assets/{journeyDiagram-VCZTEJTY-iVGgUemP.js → journeyDiagram-VCZTEJTY-CysvVjkr.js} +1 -1
- package/dist/web/assets/{kanban-definition-6JOO6SKY-DRYpEnUc.js → kanban-definition-6JOO6SKY-DlGvCOou.js} +1 -1
- package/dist/web/assets/{layout-zs0uCYVs.js → layout-DDk1jHzS.js} +1 -1
- package/dist/web/assets/{linear-2zzgztll.js → linear-CCo9IeHT.js} +1 -1
- package/dist/web/assets/{min-C0hAdo49.js → min-BTxfBtS6.js} +1 -1
- package/dist/web/assets/{mindmap-definition-QFDTVHPH-BdBw10wC.js → mindmap-definition-QFDTVHPH-D2Y8ZrN3.js} +1 -1
- package/dist/web/assets/{pieDiagram-DEJITSTG-Ddui9GA1.js → pieDiagram-DEJITSTG-DuaVu740.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-34T5L4WZ-D6B2qntC.js → quadrantDiagram-34T5L4WZ-D9P6tcbK.js} +1 -1
- package/dist/web/assets/{requirementDiagram-MS252O5E-CHCPO4Zb.js → requirementDiagram-MS252O5E-B8v3RtvO.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-XADWPNL6-SN8PjrKG.js → sankeyDiagram-XADWPNL6-CJIIvTEv.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-FGHM5R23-CwB9ZgYA.js → sequenceDiagram-FGHM5R23-WgQSy-Eh.js} +1 -1
- package/dist/web/assets/{stateDiagram-FHFEXIEX-hTSwgeqm.js → stateDiagram-FHFEXIEX-Bg9XaNxo.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-QKLJ7IA2-BZf_Cq1t.js +1 -0
- package/dist/web/assets/{timeline-definition-GMOUNBTQ-DJy3db-p.js → timeline-definition-GMOUNBTQ-2h7ZeLc6.js} +1 -1
- package/dist/web/assets/{vennDiagram-DHZGUBPP-CO2M7rf8.js → vennDiagram-DHZGUBPP-Ab3_6Oe9.js} +1 -1
- package/dist/web/assets/{wardley-RL74JXVD-7yhDc5er.js → wardley-RL74JXVD-DVPCK5Ky.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-NUSXRM2D-772gQl8M.js → wardleyDiagram-NUSXRM2D-rM9jo8v5.js} +1 -1
- package/dist/web/assets/{xychartDiagram-5P7HB3ND-BfFfwWeH.js → xychartDiagram-5P7HB3ND-BnxoasRp.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +2 -2
- package/dist/web/assets/channel-CAjhw_22.js +0 -1
- package/dist/web/assets/classDiagram-6PBFFD2Q-Bm7_oEd3.js +0 -1
- package/dist/web/assets/classDiagram-v2-HSJHXN6E-Bm7_oEd3.js +0 -1
- package/dist/web/assets/clone-BtDAovKX.js +0 -1
- package/dist/web/assets/stateDiagram-v2-QKLJ7IA2-D7hsviRi.js +0 -1
|
@@ -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-
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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
|
|
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$
|
|
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$
|
|
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$
|
|
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
|
|
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$
|
|
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$
|
|
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,282 +3367,302 @@ 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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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
3531
|
* @license lucide-react v0.562.0 - ISC
|
|
3532
3532
|
*
|
|
3533
3533
|
* This source code is licensed under the ISC license.
|
|
3534
3534
|
* See the LICENSE file in the root directory of this source tree.
|
|
3535
|
-
*/const __iconNode$
|
|
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
3536
|
* @license lucide-react v0.562.0 - ISC
|
|
3537
3537
|
*
|
|
3538
3538
|
* This source code is licensed under the ISC license.
|
|
3539
3539
|
* See the LICENSE file in the root directory of this source tree.
|
|
3540
|
-
*/const __iconNode$
|
|
3540
|
+
*/const __iconNode$q=[["path",{d:"M5 12h14",key:"1ays0h"}]],Minus=createLucideIcon("minus",__iconNode$q);/**
|
|
3541
3541
|
* @license lucide-react v0.562.0 - ISC
|
|
3542
3542
|
*
|
|
3543
3543
|
* This source code is licensed under the ISC license.
|
|
3544
3544
|
* See the LICENSE file in the root directory of this source tree.
|
|
3545
|
-
*/const __iconNode$
|
|
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);/**
|
|
3546
3546
|
* @license lucide-react v0.562.0 - ISC
|
|
3547
3547
|
*
|
|
3548
3548
|
* This source code is licensed under the ISC license.
|
|
3549
3549
|
* See the LICENSE file in the root directory of this source tree.
|
|
3550
|
-
*/const __iconNode$
|
|
3550
|
+
*/const __iconNode$o=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m15 8-3 3-3-3",key:"1oxy1z"}]],PanelBottomClose=createLucideIcon("panel-bottom-close",__iconNode$o);/**
|
|
3551
3551
|
* @license lucide-react v0.562.0 - ISC
|
|
3552
3552
|
*
|
|
3553
3553
|
* This source code is licensed under the ISC license.
|
|
3554
3554
|
* See the LICENSE file in the root directory of this source tree.
|
|
3555
|
-
*/const __iconNode$
|
|
3555
|
+
*/const __iconNode$n=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],PanelLeftClose=createLucideIcon("panel-left-close",__iconNode$n);/**
|
|
3556
3556
|
* @license lucide-react v0.562.0 - ISC
|
|
3557
3557
|
*
|
|
3558
3558
|
* This source code is licensed under the ISC license.
|
|
3559
3559
|
* See the LICENSE file in the root directory of this source tree.
|
|
3560
|
-
*/const __iconNode$
|
|
3560
|
+
*/const __iconNode$m=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],PanelLeftOpen=createLucideIcon("panel-left-open",__iconNode$m);/**
|
|
3561
3561
|
* @license lucide-react v0.562.0 - ISC
|
|
3562
3562
|
*
|
|
3563
3563
|
* This source code is licensed under the ISC license.
|
|
3564
3564
|
* See the LICENSE file in the root directory of this source tree.
|
|
3565
|
-
*/const __iconNode$
|
|
3565
|
+
*/const __iconNode$l=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],PanelRightClose=createLucideIcon("panel-right-close",__iconNode$l);/**
|
|
3566
3566
|
* @license lucide-react v0.562.0 - ISC
|
|
3567
3567
|
*
|
|
3568
3568
|
* This source code is licensed under the ISC license.
|
|
3569
3569
|
* See the LICENSE file in the root directory of this source tree.
|
|
3570
|
-
*/const __iconNode$
|
|
3570
|
+
*/const __iconNode$k=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]],PanelTopClose=createLucideIcon("panel-top-close",__iconNode$k);/**
|
|
3571
3571
|
* @license lucide-react v0.562.0 - ISC
|
|
3572
3572
|
*
|
|
3573
3573
|
* This source code is licensed under the ISC license.
|
|
3574
3574
|
* See the LICENSE file in the root directory of this source tree.
|
|
3575
|
-
*/const __iconNode$
|
|
3575
|
+
*/const __iconNode$j=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Plus=createLucideIcon("plus",__iconNode$j);/**
|
|
3576
3576
|
* @license lucide-react v0.562.0 - ISC
|
|
3577
3577
|
*
|
|
3578
3578
|
* This source code is licensed under the ISC license.
|
|
3579
3579
|
* See the LICENSE file in the root directory of this source tree.
|
|
3580
|
-
*/const __iconNode$
|
|
3580
|
+
*/const __iconNode$i=[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]],Redo2=createLucideIcon("redo-2",__iconNode$i);/**
|
|
3581
3581
|
* @license lucide-react v0.562.0 - ISC
|
|
3582
3582
|
*
|
|
3583
3583
|
* This source code is licensed under the ISC license.
|
|
3584
3584
|
* See the LICENSE file in the root directory of this source tree.
|
|
3585
|
-
*/const __iconNode$
|
|
3585
|
+
*/const __iconNode$h=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],RefreshCw=createLucideIcon("refresh-cw",__iconNode$h);/**
|
|
3586
3586
|
* @license lucide-react v0.562.0 - ISC
|
|
3587
3587
|
*
|
|
3588
3588
|
* This source code is licensed under the ISC license.
|
|
3589
3589
|
* See the LICENSE file in the root directory of this source tree.
|
|
3590
|
-
*/const __iconNode$
|
|
3590
|
+
*/const __iconNode$g=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M6.376 18.91a6 6 0 0 1 11.249.003",key:"hnjrf2"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}]],ShieldUser=createLucideIcon("shield-user",__iconNode$g);/**
|
|
3591
3591
|
* @license lucide-react v0.562.0 - ISC
|
|
3592
3592
|
*
|
|
3593
3593
|
* This source code is licensed under the ISC license.
|
|
3594
3594
|
* See the LICENSE file in the root directory of this source tree.
|
|
3595
|
-
*/const __iconNode$
|
|
3595
|
+
*/const __iconNode$f=[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]],Sigma=createLucideIcon("sigma",__iconNode$f);/**
|
|
3596
3596
|
* @license lucide-react v0.562.0 - ISC
|
|
3597
3597
|
*
|
|
3598
3598
|
* This source code is licensed under the ISC license.
|
|
3599
3599
|
* See the LICENSE file in the root directory of this source tree.
|
|
3600
|
-
*/const __iconNode$
|
|
3600
|
+
*/const __iconNode$e=[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]],SquareDashedBottomCode=createLucideIcon("square-dashed-bottom-code",__iconNode$e);/**
|
|
3601
3601
|
* @license lucide-react v0.562.0 - ISC
|
|
3602
3602
|
*
|
|
3603
3603
|
* This source code is licensed under the ISC license.
|
|
3604
3604
|
* See the LICENSE file in the root directory of this source tree.
|
|
3605
|
-
*/const __iconNode$
|
|
3605
|
+
*/const __iconNode$d=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],SquarePen=createLucideIcon("square-pen",__iconNode$d);/**
|
|
3606
3606
|
* @license lucide-react v0.562.0 - ISC
|
|
3607
3607
|
*
|
|
3608
3608
|
* This source code is licensed under the ISC license.
|
|
3609
3609
|
* See the LICENSE file in the root directory of this source tree.
|
|
3610
|
-
*/const __iconNode$
|
|
3610
|
+
*/const __iconNode$c=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Star=createLucideIcon("star",__iconNode$c);/**
|
|
3611
3611
|
* @license lucide-react v0.562.0 - ISC
|
|
3612
3612
|
*
|
|
3613
3613
|
* This source code is licensed under the ISC license.
|
|
3614
3614
|
* See the LICENSE file in the root directory of this source tree.
|
|
3615
|
-
*/const __iconNode$
|
|
3615
|
+
*/const __iconNode$b=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],Strikethrough=createLucideIcon("strikethrough",__iconNode$b);/**
|
|
3616
3616
|
* @license lucide-react v0.562.0 - ISC
|
|
3617
3617
|
*
|
|
3618
3618
|
* This source code is licensed under the ISC license.
|
|
3619
3619
|
* See the LICENSE file in the root directory of this source tree.
|
|
3620
|
-
*/const __iconNode$
|
|
3620
|
+
*/const __iconNode$a=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],Table2=createLucideIcon("table-2",__iconNode$a);/**
|
|
3621
3621
|
* @license lucide-react v0.562.0 - ISC
|
|
3622
3622
|
*
|
|
3623
3623
|
* This source code is licensed under the ISC license.
|
|
3624
3624
|
* See the LICENSE file in the root directory of this source tree.
|
|
3625
|
-
*/const __iconNode$
|
|
3625
|
+
*/const __iconNode$9=[["path",{d:"M14 14v2",key:"w2a1xv"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M14 8v2",key:"i67w9a"}],["path",{d:"M2 15h8",key:"82wtch"}],["path",{d:"M2 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2",key:"up0l64"}],["path",{d:"M2 9h8",key:"yelfik"}],["path",{d:"M22 15h-4",key:"1es58f"}],["path",{d:"M22 3h-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2",key:"pdjoqf"}],["path",{d:"M22 9h-4",key:"1luja7"}],["path",{d:"M5 3v18",key:"14hmio"}]],TableColumnsSplit=createLucideIcon("table-columns-split",__iconNode$9);/**
|
|
3626
3626
|
* @license lucide-react v0.562.0 - ISC
|
|
3627
3627
|
*
|
|
3628
3628
|
* This source code is licensed under the ISC license.
|
|
3629
3629
|
* See the LICENSE file in the root directory of this source tree.
|
|
3630
|
-
*/const __iconNode$
|
|
3630
|
+
*/const __iconNode$8=[["path",{d:"M14 10h2",key:"1lstlu"}],["path",{d:"M15 22v-8",key:"1fwwgm"}],["path",{d:"M15 2v4",key:"1044rn"}],["path",{d:"M2 10h2",key:"1r8dkt"}],["path",{d:"M20 10h2",key:"1ug425"}],["path",{d:"M3 19h18",key:"awlh7x"}],["path",{d:"M3 22v-6a2 2 135 0 1 2-2h14a2 2 45 0 1 2 2v6",key:"ibqhof"}],["path",{d:"M3 2v2a2 2 45 0 0 2 2h14a2 2 135 0 0 2-2V2",key:"1uenja"}],["path",{d:"M8 10h2",key:"66od0"}],["path",{d:"M9 22v-8",key:"fmnu31"}],["path",{d:"M9 2v4",key:"j1yeou"}]],TableRowsSplit=createLucideIcon("table-rows-split",__iconNode$8);/**
|
|
3631
3631
|
* @license lucide-react v0.562.0 - ISC
|
|
3632
3632
|
*
|
|
3633
3633
|
* This source code is licensed under the ISC license.
|
|
3634
3634
|
* See the LICENSE file in the root directory of this source tree.
|
|
3635
|
-
*/const __iconNode$
|
|
3635
|
+
*/const __iconNode$7=[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],TextAlignJustify=createLucideIcon("text-align-justify",__iconNode$7);/**
|
|
3636
3636
|
* @license lucide-react v0.562.0 - ISC
|
|
3637
3637
|
*
|
|
3638
3638
|
* This source code is licensed under the ISC license.
|
|
3639
3639
|
* See the LICENSE file in the root directory of this source tree.
|
|
3640
|
-
*/const __iconNode$
|
|
3640
|
+
*/const __iconNode$6=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],Underline=createLucideIcon("underline",__iconNode$6);/**
|
|
3641
3641
|
* @license lucide-react v0.562.0 - ISC
|
|
3642
3642
|
*
|
|
3643
3643
|
* This source code is licensed under the ISC license.
|
|
3644
3644
|
* See the LICENSE file in the root directory of this source tree.
|
|
3645
|
-
*/const __iconNode$
|
|
3645
|
+
*/const __iconNode$5=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],Undo2=createLucideIcon("undo-2",__iconNode$5);/**
|
|
3646
|
+
* @license lucide-react v0.562.0 - ISC
|
|
3647
|
+
*
|
|
3648
|
+
* This source code is licensed under the ISC license.
|
|
3649
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
3650
|
+
*/const __iconNode$4=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],Unlink=createLucideIcon("unlink",__iconNode$4);/**
|
|
3651
|
+
* @license lucide-react v0.562.0 - ISC
|
|
3652
|
+
*
|
|
3653
|
+
* This source code is licensed under the ISC license.
|
|
3654
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
3655
|
+
*/const __iconNode$3=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Upload=createLucideIcon("upload",__iconNode$3);/**
|
|
3656
|
+
* @license lucide-react v0.562.0 - ISC
|
|
3657
|
+
*
|
|
3658
|
+
* This source code is licensed under the ISC license.
|
|
3659
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
3660
|
+
*/const __iconNode$2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Users=createLucideIcon("users",__iconNode$2);/**
|
|
3661
|
+
* @license lucide-react v0.562.0 - ISC
|
|
3662
|
+
*
|
|
3663
|
+
* This source code is licensed under the ISC license.
|
|
3664
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
3665
|
+
*/const __iconNode$1=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Workflow=createLucideIcon("workflow",__iconNode$1);/**
|
|
3646
3666
|
* @license lucide-react v0.562.0 - ISC
|
|
3647
3667
|
*
|
|
3648
3668
|
* This source code is licensed under the ISC license.
|
|
@@ -4044,7 +4064,7 @@ $$
|
|
|
4044
4064
|
`,inConstruct:"mathFlowMeta"},{character:"$",after:Pn?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:ei,inlineMath:co}};function ei(os,hs,Ms,ea){const ta=os.value||"",ra=Ms.createTracker(ea),na="$".repeat(Math.max(longestStreak(ta,"$")+1,2)),ia=Ms.enter("mathFlow");let oa=ra.move(na);if(os.meta){const sa=Ms.enter("mathFlowMeta");oa+=ra.move(Ms.safe(os.meta,{after:`
|
|
4045
4065
|
`,before:oa,encode:["$"],...ra.current()})),sa()}return oa+=ra.move(`
|
|
4046
4066
|
`),ta&&(oa+=ra.move(ta+`
|
|
4047
|
-
`)),oa+=ra.move(na),ia(),oa}function co(os,hs,Ms){let ea=os.value||"",ta=1;for(Pn||ta++;new RegExp("(^|[^$])"+"\\$".repeat(ta)+"([^$]|$)").test(ea);)ta++;const ra="$".repeat(ta);/[^ \r\n]/.test(ea)&&(/^[ \r\n]/.test(ea)&&/[ \r\n]$/.test(ea)||/^\$|\$$/.test(ea))&&(ea=" "+ea+" ");let na=-1;for(;++na<Ms.unsafe.length;){const ia=Ms.unsafe[na];if(!ia.atBreak)continue;const oa=Ms.compilePattern(ia);let sa;for(;sa=oa.exec(ea);){let aa=sa.index;ea.codePointAt(aa)===10&&ea.codePointAt(aa-1)===13&&aa--,ea=ea.slice(0,aa)+" "+ea.slice(sa.index+1)}}return ra+ea+ra}function xo(){return"$"}}const mathFlow={tokenize:tokenizeMathFenced,concrete:!0,name:"mathFlow"},nonLazyContinuation={tokenize:tokenizeNonLazyContinuation,partial:!0};function tokenizeMathFenced(Un,Pn,ei){const co=this,xo=co.events[co.events.length-1],os=xo&&xo[1].type==="linePrefix"?xo[2].sliceSerialize(xo[1],!0).length:0;let hs=0;return Ms;function Ms(ua){return Un.enter("mathFlow"),Un.enter("mathFlowFence"),Un.enter("mathFlowFenceSequence"),ea(ua)}function ea(ua){return ua===36?(Un.consume(ua),hs++,ea):hs<2?ei(ua):(Un.exit("mathFlowFenceSequence"),factorySpace(Un,ta,"whitespace")(ua))}function ta(ua){return ua===null||markdownLineEnding(ua)?na(ua):(Un.enter("mathFlowFenceMeta"),Un.enter("chunkString",{contentType:"string"}),ra(ua))}function ra(ua){return ua===null||markdownLineEnding(ua)?(Un.exit("chunkString"),Un.exit("mathFlowFenceMeta"),na(ua)):ua===36?ei(ua):(Un.consume(ua),ra)}function na(ua){return Un.exit("mathFlowFence"),co.interrupt?Pn(ua):Un.attempt(nonLazyContinuation,ia,la)(ua)}function ia(ua){return Un.attempt({tokenize:ca,partial:!0},la,oa)(ua)}function oa(ua){return(os?factorySpace(Un,sa,"linePrefix",os+1):sa)(ua)}function sa(ua){return ua===null?la(ua):markdownLineEnding(ua)?Un.attempt(nonLazyContinuation,ia,la)(ua):(Un.enter("mathFlowValue"),aa(ua))}function aa(ua){return ua===null||markdownLineEnding(ua)?(Un.exit("mathFlowValue"),sa(ua)):(Un.consume(ua),aa)}function la(ua){return Un.exit("mathFlow"),Pn(ua)}function ca(ua,da,ha){let fa=0;return factorySpace(ua,pa,"linePrefix",co.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function pa(xa){return ua.enter("mathFlowFence"),ua.enter("mathFlowFenceSequence"),ma(xa)}function ma(xa){return xa===36?(fa++,ua.consume(xa),ma):fa<hs?ha(xa):(ua.exit("mathFlowFenceSequence"),factorySpace(ua,ga,"whitespace")(xa))}function ga(xa){return xa===null||markdownLineEnding(xa)?(ua.exit("mathFlowFence"),da(xa)):ha(xa)}}}function tokenizeNonLazyContinuation(Un,Pn,ei){const co=this;return xo;function xo(hs){return hs===null?Pn(hs):(Un.enter("lineEnding"),Un.consume(hs),Un.exit("lineEnding"),os)}function os(hs){return co.parser.lazy[co.now().line]?ei(hs):Pn(hs)}}function mathText(Un){let Pn=(Un||{}).singleDollarTextMath;return Pn==null&&(Pn=!0),{tokenize:ei,resolve:resolveMathText,previous,name:"mathText"};function ei(co,xo,os){let hs=0,Ms,ea;return ta;function ta(sa){return co.enter("mathText"),co.enter("mathTextSequence"),ra(sa)}function ra(sa){return sa===36?(co.consume(sa),hs++,ra):hs<2&&!Pn?os(sa):(co.exit("mathTextSequence"),na(sa))}function na(sa){return sa===null?os(sa):sa===36?(ea=co.enter("mathTextSequence"),Ms=0,oa(sa)):sa===32?(co.enter("space"),co.consume(sa),co.exit("space"),na):markdownLineEnding(sa)?(co.enter("lineEnding"),co.consume(sa),co.exit("lineEnding"),na):(co.enter("mathTextData"),ia(sa))}function ia(sa){return sa===null||sa===32||sa===36||markdownLineEnding(sa)?(co.exit("mathTextData"),na(sa)):(co.consume(sa),ia)}function oa(sa){return sa===36?(co.consume(sa),Ms++,oa):Ms===hs?(co.exit("mathTextSequence"),co.exit("mathText"),xo(sa)):(ea.type="mathTextData",ia(sa))}}}function resolveMathText(Un){let Pn=Un.length-4,ei=3,co,xo;if((Un[ei][1].type==="lineEnding"||Un[ei][1].type==="space")&&(Un[Pn][1].type==="lineEnding"||Un[Pn][1].type==="space")){for(co=ei;++co<Pn;)if(Un[co][1].type==="mathTextData"){Un[Pn][1].type="mathTextPadding",Un[ei][1].type="mathTextPadding",ei+=2,Pn-=2;break}}for(co=ei-1,Pn++;++co<=Pn;)xo===void 0?co!==Pn&&Un[co][1].type!=="lineEnding"&&(xo=co):(co===Pn||Un[co][1].type==="lineEnding")&&(Un[xo][1].type="mathTextData",co!==xo+2&&(Un[xo][1].end=Un[co-1][1].end,Un.splice(xo+2,co-xo-2),Pn-=co-xo-2,co=xo+2),xo=void 0);return Un}function previous(Un){return Un!==36||this.events[this.events.length-1][1].type==="characterEscape"}function math(Un){return{flow:{36:mathFlow},text:{36:mathText(Un)}}}const emptyOptions={};function remarkMath(Un){const Pn=this,ei=Un||emptyOptions,co=Pn.data(),xo=co.micromarkExtensions||(co.micromarkExtensions=[]),os=co.fromMarkdownExtensions||(co.fromMarkdownExtensions=[]),hs=co.toMarkdownExtensions||(co.toMarkdownExtensions=[]);xo.push(math(ei)),os.push(mathFromMarkdown()),hs.push(mathToMarkdown(ei))}const logger$2$1=createDebugLogger("plugin","markdown"),selfClosingHtmlTags=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);var MarkdownContext=class{constructor(Un){this.root=Un,this.stack=[]}push(Un){this.stack.push(Un)}get isReadingHTML(){return this.stack.length>0}get last(){return this.stack.at(-1)}pop(){return this.stack.pop()}};function convertMdastToLexical(Un,Pn,ei,co={}){switch(Un.type){case"text":return INodeHelper.createTextNode(Un.value);default:{let xo=[];if("children"in Un&&Array.isArray(Un.children)){let os=[];for(xo=Un.children.reduce((hs,Ms,ea)=>{if(Ms.type==="html"){if(Ms.value.startsWith("<!--")&&Ms.value.endsWith("-->"))return hs;const ta=Ms.value.replaceAll(/^<\/?|>$/g,""),ra=Ms.value.startsWith("</");if(selfClosingHtmlTags.has(ta)){const ia=co.html;if(Array.isArray(ia))for(const oa of ia){const sa=oa(Ms,[],ea);if(sa)return hs.push(sa),hs}else if(typeof ia=="function"){const oa=ia(Ms,[],ea);if(oa)return hs.push(oa),hs}return hs}if(ra){const ia=ei.pop();if(os.pop(),(ia==null?void 0:ia.tag)!==ta)return logger$2$1.warn("HTML tag mismatch:",ta),hs.push(...(ia==null?void 0:ia.children)||[]),hs;const oa=co.html,sa=ia.children.flat().filter(Boolean)||[];if(Array.isArray(oa))for(const aa of oa){const la=aa(ia.node,sa,ea);if(la)return hs.push(la),hs}else if(typeof oa=="function"){const aa=oa(ia.node,sa,ea);if(aa)return hs.push(aa),hs}return ia&&hs.push(...ia.children),hs}const na={children:[],index:ea,isEndTag:ra,node:Ms,tag:ta};return os.push(na),ei.push(na),hs}if(os.length>0){const ta=ei.last;return ta&&ta.children.push(convertMdastToLexical(Ms,ea,ei,co)),hs}return hs.push(convertMdastToLexical(Ms,ea,ei,co)),hs},[]).filter(Boolean).flat();os.length>0;){const hs=os.shift();ei.pop(),xo.push(INodeHelper.createTextNode(hs==null?void 0:hs.node.value),...hs.children.flat()),xo=xo.flat()}}if(co[Un.type]){const os=co[Un.type];if(Array.isArray(os))for(const hs of os){const Ms=hs(Un,xo,Pn);if(Ms)return Ms}else if(typeof os=="function"){const hs=os(Un,xo,Pn);if(hs)return hs}}return xo||null}}}function registerDefaultReaders(Un){Un.root||(Un.root=(Pn,ei)=>({...INodeHelper.createRootNode(),children:ei})),Un.paragraph||(Un.paragraph=(Pn,ei)=>({...INodeHelper.createParagraph(),children:ei})),Un.heading||(Un.heading=(Pn,ei)=>{const co=`h${Math.min(Math.max(Pn.depth,1),6)}`;return INodeHelper.createElementNode("heading",{children:ei,direction:"ltr",format:"",indent:0,tag:co})})}function parseMarkdownToLexical(Un,Pn={}){const ei=[];let co=Un;const xo=/---markmap---(\n?)([\s\S]*?)\n?---\/markmap---/g;let os,hs=0;for(;(os=xo.exec(Un))!==null;){const na=`|||MARKMAP_BLOCK_${hs}|||`;ei.push({type:"markmap",content:os[2]||"",placeholder:na}),co=co.replace(os[0],na),hs++}const Ms=/---meta2d---(\n?)([\s\S]*?)\n?---\/meta2d---/g;for(;(os=Ms.exec(Un))!==null;){const na=`|||META2D_BLOCK_${hs}|||`;ei.push({type:"meta2d",content:os[2]||"",placeholder:na}),co=co.replace(os[0],na),hs++}const ea=remark().use(remarkCjkFriendly).use(remarkMath).use([[remarkGfm,{singleTilde:!1}]]).parse(co);logger$2$1.debug("Parsed MDAST:",ea);const ta=new MarkdownContext(ea);registerDefaultReaders(Pn);const ra=convertMdastToLexical(ea,0,ta,Pn);if(ei.length>0){const na=oa=>{if(oa.type==="text"&&typeof oa.text=="string"){const sa=[];let aa=oa.text,la=!1;for(const ca of ei){const ua=aa.indexOf(ca.placeholder);if(ua!==-1){la=!0,ua>0&&sa.push({...oa,text:aa.substring(0,ua)}),sa.push({type:ca.type,[ca.type==="markmap"?"markdown":"diagram"]:ca.content,version:1});const da=aa.substring(ua+ca.placeholder.length);if(da){const ha=na({...oa,text:da});Array.isArray(ha)?sa.push(...ha):sa.push(ha)}break}}return la?sa:oa}if(oa.children&&Array.isArray(oa.children)){const sa=[];for(const aa of oa.children){const la=na(aa);Array.isArray(la)?sa.push(...la):sa.push(la)}if(oa.children=sa.filter(Boolean),oa.type==="paragraph"&&oa.children.length===1&&(oa.children[0].type==="markmap"||oa.children[0].type==="meta2d"))return oa.children[0]}return oa},ia=[];for(const oa of ra.children){const sa=na(oa);Array.isArray(sa)?ia.push(...sa):ia.push(sa)}ra.children=ia.filter(Boolean)}return ra}function canContainTransformableMarkdown(Un){return yr(Un)&&!Un.hasFormat("code")}function isEqualSubString(Un,Pn,ei,co,xo){for(let os=0;os<xo;os++)if(Un[Pn+os]!==ei[co+os])return!1;return!0}const PUNCTUATION_OR_SPACE=/[!-/:-@[-`{-~\s]/;function getOpenTagStartIndex(Un,Pn,ei){const co=ei.length;for(let xo=Pn;xo>=co;xo--){const os=xo-co;if(isEqualSubString(Un,os,ei,0,co)&&Un[os+co]!==" ")return os}return-1}function indexBy(Un,Pn){const ei={};for(const co of Un){const xo=Pn(co);xo&&(ei[xo]?ei[xo].push(co):ei[xo]=[co])}return ei}let Punctuation=/[!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~\u00A1\u2010-\u2027-]/;try{Punctuation=new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]","u")}catch{}function isPunctuationChar(Un){return Punctuation.test(Un)}function $updateSelectionOnInsert(Un){if(wr(Un)&&Un.isCollapsed()){const Pn=Un.anchor;let ei=null;const co=Al(Pn,"previous");if(co)if(ol(co))ei=co.origin;else{const xo=Tl(co,pl(zo(),"next").getFlipped());for(const os of xo)if(yr(os.origin)){ei=os.origin;break}else if(Pi(os.origin)&&!os.origin.isInline())break}if(ei&&yr(ei)){const xo=ei.getFormat(),os=ei.getStyle();(Un.format!==xo||Un.style!==os)&&(Un.format=xo,Un.style=os,Un.dirty=!0)}}}function $insertGeneratedNodes(Un,Pn,ei){Un.dispatchCommand(ie$3,{nodes:Pn,selection:ei})||(ei.insertNodes(Pn),$updateSelectionOnInsert(ei))}function getStyleObjectFromRawCSS(Un){const Pn={};if(!Un)return Pn;const ei=Un.split(";");for(const co of ei)if(co!==""){const[xo,os]=co.split(/:([^]+)/);xo&&os&&(Pn[xo.trim()]=os.trim())}return Pn}const CSS_TO_STYLES=new Map;function $addNodeStyle(Un){const Pn=Un.getStyle(),ei=getStyleObjectFromRawCSS(Pn);CSS_TO_STYLES.set(Pn,ei)}function $generateNodesFromSerializedNodes(Un){const Pn=[];for(const ei of Un){const co=Si(ei);yr(co)&&$addNodeStyle(co),Pn.push(co)}return Pn}function insertIRootNode(Un,Pn,ei){$insertGeneratedNodes(Un,$generateNodesFromSerializedNodes(Pn.children),ei)}function isSupportedBlockContainerParent(Un){return Un===null?!1:Ss(Un)||ue$1(Un)||Ot$1(Un)}function testElementTransformers(Un,Pn,ei,co,xo){if(!isSupportedBlockContainerParent(Un.getParent())||Un.getFirstChild()!==Pn)return!1;const os=Pn.getTextContent();if(xo!=="enter"&&os[ei-1]!==" ")return!1;for(const{regExp:hs,trigger:Ms}of co){const ea=os.match(hs);if(xo===Ms&&ea&&ea[0].length===(xo==="enter"||ea[0].endsWith(" ")?ei:ei-1))return!0}return!1}function runElementTransformers(Un,Pn,ei,co,xo){if(!isSupportedBlockContainerParent(Un.getParent())||Un.getFirstChild()!==Pn)return!1;const os=Pn.getTextContent();if(xo!=="enter"&&os[ei-1]!==" ")return!1;for(const{regExp:hs,replace:Ms,trigger:ea}of co){const ta=os.match(hs);if(xo===ea&&ta&&ta[0].length===(xo==="enter"||ta[0].endsWith(" ")?ei:ei-1)){const ra=Pn.getNextSiblings(),[na,ia]=Pn.splitText(ei);if(Ms(Un,ia?[ia,...ra]:ra,ta,!1)!==!1)return na.remove(),!0}}return!1}function runTextMatchTransformers(Un,Pn,ei){let co=Un.getTextContent();const xo=ei[co[Pn-1]];if(!xo)return!1;Pn<co.length&&(co=co.slice(0,Pn));for(const os of xo){if(!os.replace||!os.regExp)continue;const hs=co.match(os.regExp);if(hs===null)continue;const Ms=hs.index||0,ea=Ms+hs[0].length;let ta;return Ms===0?[ta]=Un.splitText(ea):[,ta]=Un.splitText(Ms,ea),ta.selectNext(0,0),os.replace(ta,hs),!0}return!1}function $runTextFormatTransformers(Un,Pn,ei){const co=Un.getTextContent(),xo=Pn-1,os=co[xo],hs=ei[os];if(!hs)return!1;for(const Ms of hs){const{tag:ea}=Ms,ta=ea.length,ra=xo-ta+1;if(ta>1&&!isEqualSubString(co,ra,ea,0,ta)||co[ra-1]===" ")continue;const na=co[xo+1];if(Ms.intraword===!1&&na&&!PUNCTUATION_OR_SPACE.test(na))continue;const ia=Un;let oa=ia,sa=getOpenTagStartIndex(co,ra,ea),aa=oa;for(;sa<0&&(aa=aa.getPreviousSibling())&&!Zn(aa);)if(yr(aa)){if(aa.hasFormat("code"))continue;const ga=aa.getTextContent();oa=aa,sa=getOpenTagStartIndex(ga,ga.length,ea)}if(sa<0||oa===ia&&sa+ta===ra&&ea!=="`")continue;const la=oa.getTextContent();if(sa>0&&la[sa-1]===os)continue;const ca=la[sa-1];if(Ms.intraword===!1&&ca&&!PUNCTUATION_OR_SPACE.test(ca))continue;const ua=ia.getTextContent(),da=ua.slice(0,ra)+ua.slice(xo+1);ia.setTextContent(da);const ha=oa===ia?da:la;oa.setTextContent(ha.slice(0,sa)+ha.slice(sa+ta));const fa=$r(),pa=Wr();Bo(pa);const ma=xo-ta*(oa===ia?2:1)+1;if(pa.anchor.set(oa.__key,sa,"text"),pa.focus.set(ia.__key,ma,"text"),Ms.process){if(Ms.process(pa)===!1){const ga=Po(oa.__key),xa=Po(ia.__key);yr(ga)&&ga.setTextContent(la),xa!==ga&&yr(xa)&&xa.setTextContent(ua),Bo(Un.selectEnd());continue}return!0}else if(Ms.format){for(const ga of Ms.format)pa.hasFormat(ga)||pa.formatText(ga);pa.anchor.set(pa.focus.key,pa.focus.offset,pa.focus.type);for(const ga of Ms.format)pa.hasFormat(ga)&&pa.toggleFormat(ga);wr(fa)&&(pa.format=fa.format)}else{Bo(fa);continue}return!0}return!1}init_debug();const IMarkdownShortCutService=genServiceId("MarkdownShortCutService");var MarkdownShortCutService=class{constructor(Un){this.kernel=Un,this.elementTransformers=[],this.textFormatTransformers=[],this.textMatchTransformers=[],this.logger=createDebugLogger("service","markdown"),this._markdownWriters={},this._markdownReaders=[{},{},{}],this._textFormatTransformersByTrigger=null,this._textMatchTransformersByTrigger=null}get markdownWriters(){return this._markdownWriters}get markdownReaders(){return this._markdownReaders.reduce((Un,Pn)=>(Object.keys(Pn).forEach(ei=>{Un[ei]||(Un[ei]=[]);const co=Un[ei],xo=Pn[ei];co.push(...xo)}),Un),{})}get textMatchTransformersByTrigger(){return this._textMatchTransformersByTrigger||(this._textMatchTransformersByTrigger=indexBy(this.textMatchTransformers,({trigger:Un})=>Un)),this._textMatchTransformersByTrigger}get textFormatTransformersByTrigger(){return this._textFormatTransformersByTrigger||(this._textFormatTransformersByTrigger=indexBy(this.textFormatTransformers,({tag:Un})=>Un.at(-1))),this._textFormatTransformersByTrigger}registerMarkdownShortCut(Un){switch(Un.type){case"element":this.elementTransformers.push(Un);break;case"text-format":this.textFormatTransformers.push(Un);break;case"text-match":this.textMatchTransformers.push(Un);break;default:throw new Error(`Unknown transformer type: ${Un}`)}}registerMarkdownShortCuts(Un){for(const Pn of Un)this.registerMarkdownShortCut(Pn)}testTransformers(Un,Pn,ei,co){if(testElementTransformers(Un,Pn,ei,this.elementTransformers,co))return!0;if(co==="enter"){const xo=Pn.getTextContent(),os=xo[ei-1],hs=this.textMatchTransformersByTrigger[os];if(hs){const Ms=ei<xo.length?xo.slice(0,ei):xo;for(const ea of hs)if(ea.regExp&&ea.regExp.test(Ms))return!0}}return!1}runTransformers(Un,Pn,ei,co){return!!(runElementTransformers(Un,Pn,ei,this.elementTransformers,co)||runTextMatchTransformers(Pn,ei,this.textMatchTransformersByTrigger)||$runTextFormatTransformers(Pn,ei,this.textFormatTransformersByTrigger))}registerMarkdownWriter(Un,Pn){var ei;if(!this._markdownWriters[Un]){this._markdownWriters[Un]=Pn;return}if((ei=this.kernel)!=null&&ei.isHotReloadMode()){this.logger.warn(`🔄 Hot reload: markdown writer "${Un}"`),this._markdownWriters[Un]=Pn;return}throw new Error(`Markdown writer for type "${Un}" is already registered.`)}registerMarkdownReader(Un,Pn,ei=2){var co;this._markdownReaders[ei][Un]||(this._markdownReaders[ei][Un]=[]),this._markdownReaders[ei]&&((co=this._markdownReaders[ei][Un])==null||co.push(Pn))}parseMarkdownToLexical(Un){return parseMarkdownToLexical(Un,this.markdownReaders)}insertIRootNode(Un,Pn,ei){insertIRootNode(Un,Pn,ei)}};init_utils$1();var JSONDataSource=class extends DataSource{read(Un,Pn,ei){let co;typeof Pn=="string"?co=JSON.parse(Pn):co=Pn;const xo=os=>{for(let hs=0;hs<os.children.length;hs++){const Ms=os.children[hs];"children"in Ms&&Array.isArray(Ms.children)&&xo(Ms),Ms.type==="text"&&"format"in Ms&&typeof Ms.format=="number"&&(Ms.format&C$5)>0&&(os.children[hs]={children:[{...Ms,format:Ms.format&~C$5}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1},os.children.splice(hs+1,0,cursorNodeSerialized))}};xo(co.root),Un.setEditorState(Un.parseEditorState({root:co.root}))}write(Un,Pn){return Pn!=null&&Pn.selection?Un.getEditorState().read(()=>{var co,xo,os;const ei=$r();if(!ei)return null;if(wr(ei)){const hs=ei.getNodes(),Ms=hs.length-1,ea=ei.anchor,ta=ei.focus,ra=ea.isBefore(ta),na=hs[0],ia=hs[Ms],[oa,sa]=Ar(ei);let aa=[];const la=[];for(let ca=0;ca<hs.length;ca++){const ua=hs[ca];if(Pi(ua)){const da={...ua.exportJSON(),$key:ua.getKey()};for(let fa=0;fa<la.length;fa++){const pa=la[fa],ma=Po(pa.$key);ua.isParentOf(ma)&&(da.children.push(pa),la.splice(fa,1),fa--)}let ha=!1;for(let fa=aa.length-1;fa>=0;fa--)if((co=Po(aa[fa].$key))!=null&&co.isParentOf(ua)){aa[fa].children.push(da),ha=!0;break}else aa.pop();ha||la.push(da),aa.push(da)}else if(yr(ua)){const da={...ua.exportJSON(),$key:ua.getKey()};ua===na?ua===ia?(ea.type!=="element"||ta.type!=="element"||ta.offset===ea.offset)&&(da.text=oa<sa?da.text.slice(oa,sa):da.text.slice(sa,oa)):da.text=ra?da.text.slice(oa):da.text.slice(sa):ua===ia&&(da.text=ra?da.text.slice(0,sa):da.text.slice(0,oa));let ha=!1;for(let fa=aa.length-1;fa>=0;fa--)if((xo=Po(aa[fa].$key))!=null&&xo.isParentOf(ua)){aa[fa].children.push(da),ha=!0;break}else aa.pop();ha||la.push(da)}else{const da={...ua.exportJSON(),$key:ua.getKey()};let ha=!1;for(let fa=aa.length-1;fa>=0;fa--)if((os=Po(aa[fa].$key))!=null&&os.isParentOf(ua)){aa[fa].children.push(da),ha=!0;break}else aa.pop();ha||la.push(da)}}return la}return ei.getNodes().map(hs=>exportNodeToJSON(hs))}):Un.read(()=>({root:exportNodeToJSON(zo())}))}};init_helper();var TextDataSource=class extends DataSource{read(Un,Pn){if(typeof Pn!="string")throw new Error("Invalid data type "+typeof Pn);const ei=Pn.split(/\n/g),co=INodeHelper.createRootNode();ei.forEach(xo=>{const os=INodeHelper.createParagraph();if(xo){const hs=INodeHelper.createTextNode(xo);INodeHelper.appendChild(os,hs)}INodeHelper.appendChild(co,os)}),Un.setEditorState(Un.parseEditorState({root:co}))}write(Un,Pn){return Pn!=null&&Pn.selection?Un.getEditorState().read(()=>{const ei=$r();return ei?ei.getTextContent().replaceAll("\uFEFF",""):null}):Un.getEditorState().read(()=>zo().getTextContent().replaceAll("\uFEFF",""))}};init_utils();function getElement(Un){return Un.nodeType===Node.ELEMENT_NODE?Un:Un.parentElement}function registerBreakLineClick(Un){return rc(Un.registerCommand(re$3,()=>{if(et$4){const Pn=document.getSelection();if(Pn!=null&&Pn.anchorNode){const ei=getElement(Pn.anchorNode);if(ei!=null&&ei.hasAttribute("data-lexical-linebreak")&&ei.parentElement){const co=ei.parentElement;return Un.update(()=>{const xo=$getNodeFromDOMNode(co,Un);xo&&xo.selectEnd()}),!0}}}return!1},Xi))}init_helper();function registerMDReader(Un){Un.registerMarkdownReader("blockquote",(Pn,ei)=>INodeHelper.createElementNode("quote",{children:ei,direction:"ltr",format:"",indent:0,version:1})),Un.registerMarkdownReader("strong",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|p$1),co))),Un.registerMarkdownReader("emphasis",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|y$5),co))),Un.registerMarkdownReader("delete",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|m$4),co))),Un.registerMarkdownReader("subscript",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|S$4),co))),Un.registerMarkdownReader("superscript",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|v$5),co))),Un.registerMarkdownReader("html",(Pn,ei)=>["<ins>","<u>"].includes(Pn.value.toLocaleLowerCase())?ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|x$5),co)):["<em>"].includes(Pn.value.toLocaleLowerCase())?ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|y$5),co)):["<strong>"].includes(Pn.value.toLocaleLowerCase())?ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|p$1),co)):!1)}function isPasteTargetNativeFormControl(Un){const Pn=Un.target;if(!(Pn instanceof Node))return!1;const ei=Pn.nodeType===Node.TEXT_NODE?Pn.parentElement:Pn;return ei!=null&&ei.closest?!!ei.closest('textarea, input:not([type="hidden"]), select'):!1}const handleFilePaste=({clipboardData:Un})=>{const Pn=Un.items;for(const ei of Pn)if(ei.kind==="file")return"skip";return"next"},handleVSCodePaste=({clipboardData:Un,config:Pn,editor:ei,event:co})=>{if(!Pn.pasteVSCodeAsCodeBlock)return"next";const xo=Un.getData("vscode-editor-data");if(!xo)return"next";try{const os=JSON.parse(xo),hs=os.mode||os.language||"plaintext",Ms=Un.getData("text/plain");return Ms?(co.preventDefault(),ei.update(()=>{if(!wr($r()))return;const ea=$createCodeMirrorNode(hs,Ms);ti([ea]);const ta=Jr();ta.add(ea.getKey()),Bo(ta)}),"handled"):"next"}catch{return"next"}},handlePlainTextPaste=({clipboardData:Un,editor:Pn,event:ei})=>{const co=Un.getData("text/plain");return co?(ei.preventDefault(),Pn.dispatchCommand(he$2,co),"handled"):"skip"};function runPasteHandlers(Un,Pn){for(const ei of Pn){const co=ei(Un);if(co==="handled")return!0;if(co==="skip")return!1}return!1}init_hotkey$1();init_debug();const logger$1$1=createDebugLogger("plugin","common");function resolveElement(Un,Pn,ei){const co=Un.getParent();let xo=ei,os=Un;return co!==null&&(Pn&&ei===0?(xo=os.getIndexWithinParent(),os=co):!Pn&&ei===os.getChildrenSize()&&(xo=os.getIndexWithinParent()+1,os=co)),os.getChildAtIndex(Pn?xo-1:xo)}function isCodeNodeLastLine(Un){if(!R$1(Un))return!1;const Pn=Un.getParent();if(!k$2(Pn))return!1;let ei=Pn.getLastChild();do{if(Zn(ei))return!1;if(ei===Un)return Pn;ei=ei==null?void 0:ei.getPreviousSibling()}while(ei!==Un&&ei);return ei===Un?Pn:!1}function $getAdjacentNode(Un,Pn){var co;const ei=Un.offset;if(Un.type==="element")return resolveElement(Un.getNode(),Pn,ei);{const xo=Un.getNode();if(Pn&&ei===0||!Pn&&ei===xo.getTextContentSize()){const os=Pn?xo.getPreviousSibling():xo.getNextSibling();return os===null?resolveElement(xo.getParentOrThrow(),Pn,xo.getIndexWithinParent()+(Pn?0:1)):os}else if(!Pn&&isCodeNodeLastLine(xo))return((co=xo.getParent())==null?void 0:co.getNextSibling())||null}return null}function $getDownUpNode(Un,Pn){let ei=Un.getNode();for(;ei!==null&&ei.isInline();)ei=ei.getParent();if(!ei)return null;let co=Pn?ei.getPreviousSibling():ei.getNextSibling();for(;!co&&!Ss(ei);){if(ei=ei.getParent(),!ei)return null;co=Pn?ei.getPreviousSibling():ei.getNextSibling()}return co||null}function $isSelectionAtEndOfRoot(Un){const Pn=Un.focus;return Pn.key==="root"&&Pn.offset===zo().getChildrenSize()}function registerHeaderBackspace(Un){return Un.registerCommand(Me$2,Pn=>{const ei=Un.getEditorState().read(()=>{const co=$r();if(!wr(co)||!co.isCollapsed())return!1;const xo=co.anchor;if(xo.offset!==0)return!1;const os=xo.getNode();if(yr(os)){if(os.getPreviousSibling())return!1;const hs=os.getParentOrThrow();return It$1(hs)?hs:!1}return It$1(os)?os:!1});return ei?(Pn.stopImmediatePropagation(),Pn.preventDefault(),Pn.stopPropagation(),Un.update(()=>{const co=Vi();ei.replace(co,!0),co.select(0,0)}),!0):!1},Gi)}function registerRichKeydown(Un,Pn,ei){const{enableHotkey:co=!0}=ei||{};return rc(Pn.registerHotkey(HotkeyEnum.PasteAsPlainText,async()=>{try{const xo=await navigator.clipboard.readText();Un.update(()=>{const os=$r();wr(os)&&os.insertText(xo)})}catch(xo){logger$1$1.error("❌ Failed to paste as plain text:",xo)}},{enabled:co,preventDefault:!0,stopPropagation:!0}),Pn.registerHotkey(HotkeyEnum.Bold,()=>Un.dispatchCommand(me$2,"bold"),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Italic,()=>Un.dispatchCommand(me$2,"italic"),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Underline,()=>Un.dispatchCommand(me$2,"underline"),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Strikethrough,()=>Un.dispatchCommand(me$2,"strikethrough"),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Undo,()=>Un.dispatchCommand(xe$1,void 0),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Redo,()=>Un.dispatchCommand(Ce$1,void 0),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHighCommand(be$2,xo=>{const os=$r();if(Or(os)){const hs=os.getNodes();if(hs.length>0)return hs[0].selectPrevious(),xo.preventDefault(),!0}else if(wr(os)){const hs=$getAdjacentNode(os.focus,!0),Ms=hs||$getDownUpNode(os.focus,!0);if(!xo.shiftKey&&Li(hs)){const ea=Jr();return ea.add(hs.getKey()),Un.update(()=>{Bo(ea)}),xo.preventDefault(),!0}else if(!xo.shiftKey&&Li(Ms)){const ea=Jr();return ea.add(Ms.getKey()),Un.update(()=>{Bo(ea)}),xo.preventDefault(),!0}else if(hs&&hs.getType()!=="linebreak")return hs==null||hs.selectEnd(),xo.preventDefault(),!0}return!1},qi),Pn.registerHighCommand(we$1,xo=>{const os=$r();if(wr(os)){if(!os.isCollapsed())return!1;const hs=os.focus.getNode(),Ms=$closest(hs,ta=>ta.getType()===Et$1.getType());if(!Ms||Ms.getNextSibling())return!1;const ea=Ms.getLastChild();return!ea||!$closest(hs,ta=>ta===ea)?!1:(xo.preventDefault(),Un.update(()=>{const ta=Vi();Ms.insertAfter(ta),ta.select()}),!0)}return!1},Hi),Pn.registerHighCommand(we$1,xo=>{const os=$r();if(Or(os)){const hs=os.getNodes();if(hs.length>0){const Ms=hs[0].getNextSibling();if(Ss(Ms)){const ea=Ms.getParent();if(ea){const ta=Ms.getIndexWithinParent();return ea.select(ta,ta),xo.preventDefault(),!0}}return Ms==null||Ms.selectStart(),xo.preventDefault(),!0}}else if(wr(os)){if($isSelectionAtEndOfRoot(os))return xo.preventDefault(),!0;const hs=$getAdjacentNode(os.focus,!1),Ms=hs||$getDownUpNode(os.focus,!1);if(!xo.shiftKey&&Li(hs)){const ea=Jr();return ea.add(hs.getKey()),Un.update(()=>{Bo(ea)}),xo.preventDefault(),!0}else if(!xo.shiftKey&&Li(Ms)){const ea=Jr();return ea.add(Ms.getKey()),Un.update(()=>{Bo(ea)}),xo.preventDefault(),!0}else if(hs&&hs.getType()!=="linebreak")return hs==null||hs.selectStart(),xo.preventDefault(),!0}return!1},qi),Pn.registerHighCommand(ve$1,xo=>{var hs,Ms;const os=$r();if(wr(os)){const ea=os.focus.getNode();if(Pi(ea)&&((hs=ea.getChildAtIndex(os.focus.offset))==null?void 0:hs.getType())==="table")return(Ms=ea.getChildAtIndex(os.focus.offset))==null||Ms.selectStart(),xo.preventDefault(),!0}else if(Or(os)){const ea=os.getNodes();if(ea.length>0){const ta=ea[0].getNextSibling();if(Ss(ta)){const ra=ta.getParent();if(ra){const na=ta.getIndexWithinParent();return ra.select(na,na),xo.preventDefault(),!0}}}}return!1},qi))}const NEEDS_FOLLOWING_PARAGRAPH_TYPES=new Set(["code","table","block-image","meta2d"]);function registerLastElement(Un){let Pn=!1;return Un.registerUpdateListener(({dirtyElements:ei})=>{Un.isEditable()&&(!ei.has("root")&&!Array.from(ei.keys()).some(co=>{var xo,os;return((os=(xo=Un.getEditorState()._nodeMap.get(co))==null?void 0:xo.getParent())==null?void 0:os.getKey())==="root"})||Pn||Un.getEditorState().read(()=>{const co=zo().getLastChild();return NEEDS_FOLLOWING_PARAGRAPH_TYPES.has(co==null?void 0:co.getType())})&&(Pn=!0,queueMicrotask(()=>{Un.update(()=>{const co=zo(),xo=co.getLastChild();if(NEEDS_FOLLOWING_PARAGRAPH_TYPES.has(xo==null?void 0:xo.getType())){const os=Vi();co.append(os)}Pn=!1})})))})}init_utils$1();var Qd;const CommonPlugin=(Qd=class extends KernelPlugin{constructor(Pn,ei={}){super(),this.kernel=Pn,this.config=ei,this.formats={bold:!0,header:!0,italic:!0,quote:!0,strikethrough:!0,subscript:!1,superscript:!1};const co=ei.markdownOption??!0;typeof co=="object"?(this.formats.bold=co.bold??!0,this.formats.header=co.header??!0,this.formats.italic=co.italic??!0,this.formats.quote=co.quote??!0,this.formats.strikethrough=co.strikethrough??!0,this.formats.subscript=co.subscript??!1,this.formats.superscript=co.superscript??!1):co===!1&&(this.formats.bold=!1,this.formats.header=!1,this.formats.italic=!1,this.formats.quote=!1,this.formats.strikethrough=!1,this.formats.subscript=!1,this.formats.superscript=!1),Pn.registerDataSource(new JSONDataSource("json")),Pn.registerDataSource(new TextDataSource("text")),Pn.registerNodes([Pt$1,Et$1,CursorNode]),ei!=null&&ei.theme&&Pn.registerThemes({quote:ei.theme.quote,text:{bold:ei.theme.textBold,code:ei.theme.textCode,highlight:ei.theme.textHighlight,italic:ei.theme.textItalic,strikethrough:ei.theme.textStrikethrough,subscript:ei.theme.textSubscript,superscript:ei.theme.textSuperscript,underline:ei.theme.textUnderline,underlineStrikethrough:ei.theme.textUnderlineStrikethrough}})}registerMarkdown(Pn){var hs;const ei=Pn.requireService(IMarkdownShortCutService);if(!ei)return;const co=(((hs=this.config)==null?void 0:hs.markdownOption)??!0)!==!1?`
|
|
4067
|
+
`)),oa+=ra.move(na),ia(),oa}function co(os,hs,Ms){let ea=os.value||"",ta=1;for(Pn||ta++;new RegExp("(^|[^$])"+"\\$".repeat(ta)+"([^$]|$)").test(ea);)ta++;const ra="$".repeat(ta);/[^ \r\n]/.test(ea)&&(/^[ \r\n]/.test(ea)&&/[ \r\n]$/.test(ea)||/^\$|\$$/.test(ea))&&(ea=" "+ea+" ");let na=-1;for(;++na<Ms.unsafe.length;){const ia=Ms.unsafe[na];if(!ia.atBreak)continue;const oa=Ms.compilePattern(ia);let sa;for(;sa=oa.exec(ea);){let aa=sa.index;ea.codePointAt(aa)===10&&ea.codePointAt(aa-1)===13&&aa--,ea=ea.slice(0,aa)+" "+ea.slice(sa.index+1)}}return ra+ea+ra}function xo(){return"$"}}const mathFlow={tokenize:tokenizeMathFenced,concrete:!0,name:"mathFlow"},nonLazyContinuation={tokenize:tokenizeNonLazyContinuation,partial:!0};function tokenizeMathFenced(Un,Pn,ei){const co=this,xo=co.events[co.events.length-1],os=xo&&xo[1].type==="linePrefix"?xo[2].sliceSerialize(xo[1],!0).length:0;let hs=0;return Ms;function Ms(ua){return Un.enter("mathFlow"),Un.enter("mathFlowFence"),Un.enter("mathFlowFenceSequence"),ea(ua)}function ea(ua){return ua===36?(Un.consume(ua),hs++,ea):hs<2?ei(ua):(Un.exit("mathFlowFenceSequence"),factorySpace(Un,ta,"whitespace")(ua))}function ta(ua){return ua===null||markdownLineEnding(ua)?na(ua):(Un.enter("mathFlowFenceMeta"),Un.enter("chunkString",{contentType:"string"}),ra(ua))}function ra(ua){return ua===null||markdownLineEnding(ua)?(Un.exit("chunkString"),Un.exit("mathFlowFenceMeta"),na(ua)):ua===36?ei(ua):(Un.consume(ua),ra)}function na(ua){return Un.exit("mathFlowFence"),co.interrupt?Pn(ua):Un.attempt(nonLazyContinuation,ia,la)(ua)}function ia(ua){return Un.attempt({tokenize:ca,partial:!0},la,oa)(ua)}function oa(ua){return(os?factorySpace(Un,sa,"linePrefix",os+1):sa)(ua)}function sa(ua){return ua===null?la(ua):markdownLineEnding(ua)?Un.attempt(nonLazyContinuation,ia,la)(ua):(Un.enter("mathFlowValue"),aa(ua))}function aa(ua){return ua===null||markdownLineEnding(ua)?(Un.exit("mathFlowValue"),sa(ua)):(Un.consume(ua),aa)}function la(ua){return Un.exit("mathFlow"),Pn(ua)}function ca(ua,da,ha){let fa=0;return factorySpace(ua,pa,"linePrefix",co.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function pa(xa){return ua.enter("mathFlowFence"),ua.enter("mathFlowFenceSequence"),ma(xa)}function ma(xa){return xa===36?(fa++,ua.consume(xa),ma):fa<hs?ha(xa):(ua.exit("mathFlowFenceSequence"),factorySpace(ua,ga,"whitespace")(xa))}function ga(xa){return xa===null||markdownLineEnding(xa)?(ua.exit("mathFlowFence"),da(xa)):ha(xa)}}}function tokenizeNonLazyContinuation(Un,Pn,ei){const co=this;return xo;function xo(hs){return hs===null?Pn(hs):(Un.enter("lineEnding"),Un.consume(hs),Un.exit("lineEnding"),os)}function os(hs){return co.parser.lazy[co.now().line]?ei(hs):Pn(hs)}}function mathText(Un){let Pn=(Un||{}).singleDollarTextMath;return Pn==null&&(Pn=!0),{tokenize:ei,resolve:resolveMathText,previous,name:"mathText"};function ei(co,xo,os){let hs=0,Ms,ea;return ta;function ta(sa){return co.enter("mathText"),co.enter("mathTextSequence"),ra(sa)}function ra(sa){return sa===36?(co.consume(sa),hs++,ra):hs<2&&!Pn?os(sa):(co.exit("mathTextSequence"),na(sa))}function na(sa){return sa===null?os(sa):sa===36?(ea=co.enter("mathTextSequence"),Ms=0,oa(sa)):sa===32?(co.enter("space"),co.consume(sa),co.exit("space"),na):markdownLineEnding(sa)?(co.enter("lineEnding"),co.consume(sa),co.exit("lineEnding"),na):(co.enter("mathTextData"),ia(sa))}function ia(sa){return sa===null||sa===32||sa===36||markdownLineEnding(sa)?(co.exit("mathTextData"),na(sa)):(co.consume(sa),ia)}function oa(sa){return sa===36?(co.consume(sa),Ms++,oa):Ms===hs?(co.exit("mathTextSequence"),co.exit("mathText"),xo(sa)):(ea.type="mathTextData",ia(sa))}}}function resolveMathText(Un){let Pn=Un.length-4,ei=3,co,xo;if((Un[ei][1].type==="lineEnding"||Un[ei][1].type==="space")&&(Un[Pn][1].type==="lineEnding"||Un[Pn][1].type==="space")){for(co=ei;++co<Pn;)if(Un[co][1].type==="mathTextData"){Un[Pn][1].type="mathTextPadding",Un[ei][1].type="mathTextPadding",ei+=2,Pn-=2;break}}for(co=ei-1,Pn++;++co<=Pn;)xo===void 0?co!==Pn&&Un[co][1].type!=="lineEnding"&&(xo=co):(co===Pn||Un[co][1].type==="lineEnding")&&(Un[xo][1].type="mathTextData",co!==xo+2&&(Un[xo][1].end=Un[co-1][1].end,Un.splice(xo+2,co-xo-2),Pn-=co-xo-2,co=xo+2),xo=void 0);return Un}function previous(Un){return Un!==36||this.events[this.events.length-1][1].type==="characterEscape"}function math(Un){return{flow:{36:mathFlow},text:{36:mathText(Un)}}}const emptyOptions={};function remarkMath(Un){const Pn=this,ei=Un||emptyOptions,co=Pn.data(),xo=co.micromarkExtensions||(co.micromarkExtensions=[]),os=co.fromMarkdownExtensions||(co.fromMarkdownExtensions=[]),hs=co.toMarkdownExtensions||(co.toMarkdownExtensions=[]);xo.push(math(ei)),os.push(mathFromMarkdown()),hs.push(mathToMarkdown(ei))}const logger$2$1=createDebugLogger("plugin","markdown"),selfClosingHtmlTags=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);var MarkdownContext=class{constructor(Un){this.root=Un,this.stack=[]}push(Un){this.stack.push(Un)}get isReadingHTML(){return this.stack.length>0}get last(){return this.stack.at(-1)}pop(){return this.stack.pop()}};function convertMdastToLexical(Un,Pn,ei,co={}){switch(Un.type){case"text":return INodeHelper.createTextNode(Un.value);default:{let xo=[];if("children"in Un&&Array.isArray(Un.children)){let os=[];for(xo=Un.children.reduce((hs,Ms,ea)=>{if(Ms.type==="html"){if(Ms.value.startsWith("<!--")&&Ms.value.endsWith("-->"))return hs;const ta=Ms.value.replaceAll(/^<\/?|>$/g,""),ra=Ms.value.startsWith("</");if(selfClosingHtmlTags.has(ta)){const ia=co.html;if(Array.isArray(ia))for(const oa of ia){const sa=oa(Ms,[],ea);if(sa)return hs.push(sa),hs}else if(typeof ia=="function"){const oa=ia(Ms,[],ea);if(oa)return hs.push(oa),hs}return hs}if(ra){const ia=ei.pop();if(os.pop(),(ia==null?void 0:ia.tag)!==ta)return logger$2$1.warn("HTML tag mismatch:",ta),hs.push(...(ia==null?void 0:ia.children)||[]),hs;const oa=co.html,sa=ia.children.flat().filter(Boolean)||[];if(Array.isArray(oa))for(const aa of oa){const la=aa(ia.node,sa,ea);if(la)return hs.push(la),hs}else if(typeof oa=="function"){const aa=oa(ia.node,sa,ea);if(aa)return hs.push(aa),hs}return ia&&hs.push(...ia.children),hs}const na={children:[],index:ea,isEndTag:ra,node:Ms,tag:ta};return os.push(na),ei.push(na),hs}if(os.length>0){const ta=ei.last;return ta&&ta.children.push(convertMdastToLexical(Ms,ea,ei,co)),hs}return hs.push(convertMdastToLexical(Ms,ea,ei,co)),hs},[]).filter(Boolean).flat();os.length>0;){const hs=os.shift();ei.pop(),xo.push(INodeHelper.createTextNode(hs==null?void 0:hs.node.value),...hs.children.flat()),xo=xo.flat()}}if(co[Un.type]){const os=co[Un.type];if(Array.isArray(os))for(const hs of os){const Ms=hs(Un,xo,Pn);if(Ms)return Ms}else if(typeof os=="function"){const hs=os(Un,xo,Pn);if(hs)return hs}}return xo||null}}}function registerDefaultReaders(Un){Un.root||(Un.root=(Pn,ei)=>({...INodeHelper.createRootNode(),children:ei})),Un.paragraph||(Un.paragraph=(Pn,ei)=>({...INodeHelper.createParagraph(),children:ei})),Un.heading||(Un.heading=(Pn,ei)=>{const co=`h${Math.min(Math.max(Pn.depth,1),6)}`;return INodeHelper.createElementNode("heading",{children:ei,direction:"ltr",format:"",indent:0,tag:co})})}function parseMarkdownToLexical(Un,Pn={}){const ei=[];let co=Un;const xo=/---markmap---(\n?)([\s\S]*?)\n?---\/markmap---/g;let os,hs=0;for(;(os=xo.exec(Un))!==null;){const na=`|||MARKMAP_BLOCK_${hs}|||`;ei.push({type:"markmap",content:os[2]||"",placeholder:na}),co=co.replace(os[0],na),hs++}const Ms=/---meta2d---(\n?)([\s\S]*?)\n?---\/meta2d---/g;for(;(os=Ms.exec(Un))!==null;){const na=`|||META2D_BLOCK_${hs}|||`;ei.push({type:"meta2d",content:os[2]||"",placeholder:na}),co=co.replace(os[0],na),hs++}const ea=remark().use(remarkCjkFriendly).use(remarkMath).use([[remarkGfm,{singleTilde:!1}]]).parse(co);logger$2$1.debug("Parsed MDAST:",ea);const ta=new MarkdownContext(ea);registerDefaultReaders(Pn);const ra=convertMdastToLexical(ea,0,ta,Pn);if(ei.length>0){const na=oa=>{if(oa.type==="text"&&typeof oa.text=="string"){const sa=[];let aa=oa.text,la=!1;for(const ca of ei){const ua=aa.indexOf(ca.placeholder);if(ua!==-1){la=!0,ua>0&&sa.push({...oa,text:aa.substring(0,ua)}),sa.push({type:ca.type,[ca.type==="markmap"?"markdown":"diagram"]:ca.content,version:1});const da=aa.substring(ua+ca.placeholder.length);if(da){const ha=na({...oa,text:da});Array.isArray(ha)?sa.push(...ha):sa.push(ha)}break}}return la?sa:oa}if(oa.children&&Array.isArray(oa.children)){const sa=[];for(const aa of oa.children){const la=na(aa);Array.isArray(la)?sa.push(...la):sa.push(la)}if(oa.children=sa.filter(Boolean),oa.type==="paragraph"&&oa.children.length===1&&(oa.children[0].type==="markmap"||oa.children[0].type==="meta2d"))return oa.children[0]}return oa},ia=[];for(const oa of ra.children){const sa=na(oa);Array.isArray(sa)?ia.push(...sa):ia.push(sa)}ra.children=ia.filter(Boolean)}return ra}function canContainTransformableMarkdown(Un){return yr(Un)&&!Un.hasFormat("code")}function isEqualSubString(Un,Pn,ei,co,xo){for(let os=0;os<xo;os++)if(Un[Pn+os]!==ei[co+os])return!1;return!0}const PUNCTUATION_OR_SPACE=/[!-/:-@[-`{-~\s]/;function getOpenTagStartIndex(Un,Pn,ei){const co=ei.length;for(let xo=Pn;xo>=co;xo--){const os=xo-co;if(isEqualSubString(Un,os,ei,0,co)&&Un[os+co]!==" ")return os}return-1}function indexBy(Un,Pn){const ei={};for(const co of Un){const xo=Pn(co);xo&&(ei[xo]?ei[xo].push(co):ei[xo]=[co])}return ei}let Punctuation=/[!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~\u00A1\u2010-\u2027-]/;try{Punctuation=new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]","u")}catch{}function isPunctuationChar(Un){return Punctuation.test(Un)}function $updateSelectionOnInsert(Un){if(wr(Un)&&Un.isCollapsed()){const Pn=Un.anchor;let ei=null;const co=Al(Pn,"previous");if(co)if(ol(co))ei=co.origin;else{const xo=Tl(co,pl(zo(),"next").getFlipped());for(const os of xo)if(yr(os.origin)){ei=os.origin;break}else if(Pi(os.origin)&&!os.origin.isInline())break}if(ei&&yr(ei)){const xo=ei.getFormat(),os=ei.getStyle();(Un.format!==xo||Un.style!==os)&&(Un.format=xo,Un.style=os,Un.dirty=!0)}}}function $insertGeneratedNodes(Un,Pn,ei){Un.dispatchCommand(ie$3,{nodes:Pn,selection:ei})||(ei.insertNodes(Pn),$updateSelectionOnInsert(ei))}function getStyleObjectFromRawCSS(Un){const Pn={};if(!Un)return Pn;const ei=Un.split(";");for(const co of ei)if(co!==""){const[xo,os]=co.split(/:([^]+)/);xo&&os&&(Pn[xo.trim()]=os.trim())}return Pn}const CSS_TO_STYLES=new Map;function $addNodeStyle(Un){const Pn=Un.getStyle(),ei=getStyleObjectFromRawCSS(Pn);CSS_TO_STYLES.set(Pn,ei)}function $generateNodesFromSerializedNodes(Un){const Pn=[];for(const ei of Un){const co=Si(ei);yr(co)&&$addNodeStyle(co),Pn.push(co)}return Pn}function insertIRootNode(Un,Pn,ei){$insertGeneratedNodes(Un,$generateNodesFromSerializedNodes(Pn.children),ei)}function isSupportedBlockContainerParent(Un){return Un===null?!1:Ss(Un)||ue$1(Un)||Ot$1(Un)}function testElementTransformers(Un,Pn,ei,co,xo){if(!isSupportedBlockContainerParent(Un.getParent())||Un.getFirstChild()!==Pn)return!1;const os=Pn.getTextContent();if(xo!=="enter"&&os[ei-1]!==" ")return!1;for(const{regExp:hs,trigger:Ms}of co){const ea=os.match(hs);if(xo===Ms&&ea&&ea[0].length===(xo==="enter"||ea[0].endsWith(" ")?ei:ei-1))return!0}return!1}function runElementTransformers(Un,Pn,ei,co,xo){if(!isSupportedBlockContainerParent(Un.getParent())||Un.getFirstChild()!==Pn)return!1;const os=Pn.getTextContent();if(xo!=="enter"&&os[ei-1]!==" ")return!1;for(const{regExp:hs,replace:Ms,trigger:ea}of co){const ta=os.match(hs);if(xo===ea&&ta&&ta[0].length===(xo==="enter"||ta[0].endsWith(" ")?ei:ei-1)){const ra=Pn.getNextSiblings(),[na,ia]=Pn.splitText(ei);if(Ms(Un,ia?[ia,...ra]:ra,ta,!1)!==!1)return na.remove(),!0}}return!1}function runTextMatchTransformers(Un,Pn,ei){let co=Un.getTextContent();const xo=ei[co[Pn-1]];if(!xo)return!1;Pn<co.length&&(co=co.slice(0,Pn));for(const os of xo){if(!os.replace||!os.regExp)continue;const hs=co.match(os.regExp);if(hs===null)continue;const Ms=hs.index||0,ea=Ms+hs[0].length;let ta;return Ms===0?[ta]=Un.splitText(ea):[,ta]=Un.splitText(Ms,ea),ta.selectNext(0,0),os.replace(ta,hs),!0}return!1}function $runTextFormatTransformers(Un,Pn,ei){const co=Un.getTextContent(),xo=Pn-1,os=co[xo],hs=ei[os];if(!hs)return!1;for(const Ms of hs){const{tag:ea}=Ms,ta=ea.length,ra=xo-ta+1;if(ta>1&&!isEqualSubString(co,ra,ea,0,ta)||co[ra-1]===" ")continue;const na=co[xo+1];if(Ms.intraword===!1&&na&&!PUNCTUATION_OR_SPACE.test(na))continue;const ia=Un;let oa=ia,sa=getOpenTagStartIndex(co,ra,ea),aa=oa;for(;sa<0&&(aa=aa.getPreviousSibling())&&!Zn(aa);)if(yr(aa)){if(aa.hasFormat("code"))continue;const ga=aa.getTextContent();oa=aa,sa=getOpenTagStartIndex(ga,ga.length,ea)}if(sa<0||oa===ia&&sa+ta===ra)continue;const la=oa.getTextContent();if(sa>0&&la[sa-1]===os)continue;const ca=la[sa-1];if(Ms.intraword===!1&&ca&&!PUNCTUATION_OR_SPACE.test(ca))continue;const ua=ia.getTextContent(),da=ua.slice(0,ra)+ua.slice(xo+1);ia.setTextContent(da);const ha=oa===ia?da:la;oa.setTextContent(ha.slice(0,sa)+ha.slice(sa+ta));const fa=$r(),pa=Wr();Bo(pa);const ma=xo-ta*(oa===ia?2:1)+1;if(pa.anchor.set(oa.__key,sa,"text"),pa.focus.set(ia.__key,ma,"text"),Ms.process){if(Ms.process(pa)===!1){const ga=Po(oa.__key),xa=Po(ia.__key);yr(ga)&&ga.setTextContent(la),xa!==ga&&yr(xa)&&xa.setTextContent(ua),Bo(Un.selectEnd());continue}return!0}else if(Ms.format){for(const ga of Ms.format)pa.hasFormat(ga)||pa.formatText(ga);pa.anchor.set(pa.focus.key,pa.focus.offset,pa.focus.type);for(const ga of Ms.format)pa.hasFormat(ga)&&pa.toggleFormat(ga);wr(fa)&&(pa.format=fa.format)}else{Bo(fa);continue}return!0}return!1}init_debug();const IMarkdownShortCutService=genServiceId("MarkdownShortCutService");var MarkdownShortCutService=class{constructor(Un){this.kernel=Un,this.elementTransformers=[],this.textFormatTransformers=[],this.textMatchTransformers=[],this.logger=createDebugLogger("service","markdown"),this._markdownWriters={},this._markdownReaders=[{},{},{}],this._textFormatTransformersByTrigger=null,this._textMatchTransformersByTrigger=null}get markdownWriters(){return this._markdownWriters}get markdownReaders(){return this._markdownReaders.reduce((Un,Pn)=>(Object.keys(Pn).forEach(ei=>{Un[ei]||(Un[ei]=[]);const co=Un[ei],xo=Pn[ei];co.push(...xo)}),Un),{})}get textMatchTransformersByTrigger(){return this._textMatchTransformersByTrigger||(this._textMatchTransformersByTrigger=indexBy(this.textMatchTransformers,({trigger:Un})=>Un)),this._textMatchTransformersByTrigger}get textFormatTransformersByTrigger(){return this._textFormatTransformersByTrigger||(this._textFormatTransformersByTrigger=indexBy(this.textFormatTransformers,({tag:Un})=>Un.at(-1))),this._textFormatTransformersByTrigger}registerMarkdownShortCut(Un){switch(Un.type){case"element":this.elementTransformers.push(Un);break;case"text-format":this.textFormatTransformers.push(Un);break;case"text-match":this.textMatchTransformers.push(Un);break;default:throw new Error(`Unknown transformer type: ${Un}`)}}registerMarkdownShortCuts(Un){for(const Pn of Un)this.registerMarkdownShortCut(Pn)}testTransformers(Un,Pn,ei,co){if(testElementTransformers(Un,Pn,ei,this.elementTransformers,co))return!0;if(co==="enter"){const xo=Pn.getTextContent(),os=xo[ei-1],hs=this.textMatchTransformersByTrigger[os];if(hs){const Ms=ei<xo.length?xo.slice(0,ei):xo;for(const ea of hs)if(ea.regExp&&ea.regExp.test(Ms))return!0}}return!1}runTransformers(Un,Pn,ei,co){return!!(runElementTransformers(Un,Pn,ei,this.elementTransformers,co)||runTextMatchTransformers(Pn,ei,this.textMatchTransformersByTrigger)||$runTextFormatTransformers(Pn,ei,this.textFormatTransformersByTrigger))}registerMarkdownWriter(Un,Pn){var ei;if(!this._markdownWriters[Un]){this._markdownWriters[Un]=Pn;return}if((ei=this.kernel)!=null&&ei.isHotReloadMode()){this.logger.warn(`🔄 Hot reload: markdown writer "${Un}"`),this._markdownWriters[Un]=Pn;return}throw new Error(`Markdown writer for type "${Un}" is already registered.`)}registerMarkdownReader(Un,Pn,ei=2){var co;this._markdownReaders[ei][Un]||(this._markdownReaders[ei][Un]=[]),this._markdownReaders[ei]&&((co=this._markdownReaders[ei][Un])==null||co.push(Pn))}parseMarkdownToLexical(Un){return parseMarkdownToLexical(Un,this.markdownReaders)}insertIRootNode(Un,Pn,ei){insertIRootNode(Un,Pn,ei)}};init_utils$1();var JSONDataSource=class extends DataSource{read(Un,Pn,ei){let co;typeof Pn=="string"?co=JSON.parse(Pn):co=Pn;const xo=os=>{for(let hs=0;hs<os.children.length;hs++){const Ms=os.children[hs];"children"in Ms&&Array.isArray(Ms.children)&&xo(Ms),Ms.type==="text"&&"format"in Ms&&typeof Ms.format=="number"&&(Ms.format&C$5)>0&&(os.children[hs]={children:[{...Ms,format:Ms.format&~C$5}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1},os.children.splice(hs+1,0,cursorNodeSerialized))}};xo(co.root),Un.setEditorState(Un.parseEditorState({root:co.root}))}write(Un,Pn){return Pn!=null&&Pn.selection?Un.getEditorState().read(()=>{var co,xo,os;const ei=$r();if(!ei)return null;if(wr(ei)){const hs=ei.getNodes(),Ms=hs.length-1,ea=ei.anchor,ta=ei.focus,ra=ea.isBefore(ta),na=hs[0],ia=hs[Ms],[oa,sa]=Ar(ei);let aa=[];const la=[];for(let ca=0;ca<hs.length;ca++){const ua=hs[ca];if(Pi(ua)){const da={...ua.exportJSON(),$key:ua.getKey()};for(let fa=0;fa<la.length;fa++){const pa=la[fa],ma=Po(pa.$key);ua.isParentOf(ma)&&(da.children.push(pa),la.splice(fa,1),fa--)}let ha=!1;for(let fa=aa.length-1;fa>=0;fa--)if((co=Po(aa[fa].$key))!=null&&co.isParentOf(ua)){aa[fa].children.push(da),ha=!0;break}else aa.pop();ha||la.push(da),aa.push(da)}else if(yr(ua)){const da={...ua.exportJSON(),$key:ua.getKey()};ua===na?ua===ia?(ea.type!=="element"||ta.type!=="element"||ta.offset===ea.offset)&&(da.text=oa<sa?da.text.slice(oa,sa):da.text.slice(sa,oa)):da.text=ra?da.text.slice(oa):da.text.slice(sa):ua===ia&&(da.text=ra?da.text.slice(0,sa):da.text.slice(0,oa));let ha=!1;for(let fa=aa.length-1;fa>=0;fa--)if((xo=Po(aa[fa].$key))!=null&&xo.isParentOf(ua)){aa[fa].children.push(da),ha=!0;break}else aa.pop();ha||la.push(da)}else{const da={...ua.exportJSON(),$key:ua.getKey()};let ha=!1;for(let fa=aa.length-1;fa>=0;fa--)if((os=Po(aa[fa].$key))!=null&&os.isParentOf(ua)){aa[fa].children.push(da),ha=!0;break}else aa.pop();ha||la.push(da)}}return la}return ei.getNodes().map(hs=>exportNodeToJSON(hs))}):Un.read(()=>({root:exportNodeToJSON(zo())}))}};init_helper();var TextDataSource=class extends DataSource{read(Un,Pn){if(typeof Pn!="string")throw new Error("Invalid data type "+typeof Pn);const ei=Pn.split(/\n/g),co=INodeHelper.createRootNode();ei.forEach(xo=>{const os=INodeHelper.createParagraph();if(xo){const hs=INodeHelper.createTextNode(xo);INodeHelper.appendChild(os,hs)}INodeHelper.appendChild(co,os)}),Un.setEditorState(Un.parseEditorState({root:co}))}write(Un,Pn){return Pn!=null&&Pn.selection?Un.getEditorState().read(()=>{const ei=$r();return ei?ei.getTextContent().replaceAll("\uFEFF",""):null}):Un.getEditorState().read(()=>zo().getTextContent().replaceAll("\uFEFF",""))}};init_utils();function getElement(Un){return Un.nodeType===Node.ELEMENT_NODE?Un:Un.parentElement}function registerBreakLineClick(Un){return rc(Un.registerCommand(re$3,()=>{if(et$4){const Pn=document.getSelection();if(Pn!=null&&Pn.anchorNode){const ei=getElement(Pn.anchorNode);if(ei!=null&&ei.hasAttribute("data-lexical-linebreak")&&ei.parentElement){const co=ei.parentElement;return Un.update(()=>{const xo=$getNodeFromDOMNode(co,Un);xo&&xo.selectEnd()}),!0}}}return!1},Xi))}init_helper();function registerMDReader(Un){Un.registerMarkdownReader("blockquote",(Pn,ei)=>INodeHelper.createElementNode("quote",{children:ei,direction:"ltr",format:"",indent:0,version:1})),Un.registerMarkdownReader("strong",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|p$1),co))),Un.registerMarkdownReader("emphasis",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|y$5),co))),Un.registerMarkdownReader("delete",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|m$4),co))),Un.registerMarkdownReader("subscript",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|S$4),co))),Un.registerMarkdownReader("superscript",(Pn,ei)=>ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|v$5),co))),Un.registerMarkdownReader("html",(Pn,ei)=>["<ins>","<u>"].includes(Pn.value.toLocaleLowerCase())?ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|x$5),co)):["<em>"].includes(Pn.value.toLocaleLowerCase())?ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|y$5),co)):["<strong>"].includes(Pn.value.toLocaleLowerCase())?ei.map(co=>(INodeHelper.isTextNode(co)&&(co.format=(co.format||0)|p$1),co)):!1)}function isPasteTargetNativeFormControl(Un){const Pn=Un.target;if(!(Pn instanceof Node))return!1;const ei=Pn.nodeType===Node.TEXT_NODE?Pn.parentElement:Pn;return ei!=null&&ei.closest?!!ei.closest('textarea, input:not([type="hidden"]), select'):!1}const handleFilePaste=({clipboardData:Un})=>{const Pn=Un.items;for(const ei of Pn)if(ei.kind==="file")return"skip";return"next"},handleVSCodePaste=({clipboardData:Un,config:Pn,editor:ei,event:co})=>{if(!Pn.pasteVSCodeAsCodeBlock)return"next";const xo=Un.getData("vscode-editor-data");if(!xo)return"next";try{const os=JSON.parse(xo),hs=os.mode||os.language||"plaintext",Ms=Un.getData("text/plain");return Ms?(co.preventDefault(),ei.update(()=>{if(!wr($r()))return;const ea=$createCodeMirrorNode(hs,Ms);ti([ea]);const ta=Jr();ta.add(ea.getKey()),Bo(ta)}),"handled"):"next"}catch{return"next"}},handlePlainTextPaste=({clipboardData:Un,editor:Pn,event:ei})=>{const co=Un.getData("text/plain");return co?(ei.preventDefault(),Pn.dispatchCommand(he$2,co),"handled"):"skip"};function runPasteHandlers(Un,Pn){for(const ei of Pn){const co=ei(Un);if(co==="handled")return!0;if(co==="skip")return!1}return!1}init_hotkey$1();init_debug();const logger$1$1=createDebugLogger("plugin","common");function resolveElement(Un,Pn,ei){const co=Un.getParent();let xo=ei,os=Un;return co!==null&&(Pn&&ei===0?(xo=os.getIndexWithinParent(),os=co):!Pn&&ei===os.getChildrenSize()&&(xo=os.getIndexWithinParent()+1,os=co)),os.getChildAtIndex(Pn?xo-1:xo)}function isCodeNodeLastLine(Un){if(!R$1(Un))return!1;const Pn=Un.getParent();if(!k$2(Pn))return!1;let ei=Pn.getLastChild();do{if(Zn(ei))return!1;if(ei===Un)return Pn;ei=ei==null?void 0:ei.getPreviousSibling()}while(ei!==Un&&ei);return ei===Un?Pn:!1}function $getAdjacentNode(Un,Pn){var co;const ei=Un.offset;if(Un.type==="element")return resolveElement(Un.getNode(),Pn,ei);{const xo=Un.getNode();if(Pn&&ei===0||!Pn&&ei===xo.getTextContentSize()){const os=Pn?xo.getPreviousSibling():xo.getNextSibling();return os===null?resolveElement(xo.getParentOrThrow(),Pn,xo.getIndexWithinParent()+(Pn?0:1)):os}else if(!Pn&&isCodeNodeLastLine(xo))return((co=xo.getParent())==null?void 0:co.getNextSibling())||null}return null}function $getDownUpNode(Un,Pn){let ei=Un.getNode();for(;ei!==null&&ei.isInline();)ei=ei.getParent();if(!ei)return null;let co=Pn?ei.getPreviousSibling():ei.getNextSibling();for(;!co&&!Ss(ei);){if(ei=ei.getParent(),!ei)return null;co=Pn?ei.getPreviousSibling():ei.getNextSibling()}return co||null}function $isSelectionAtEndOfRoot(Un){const Pn=Un.focus;return Pn.key==="root"&&Pn.offset===zo().getChildrenSize()}function registerHeaderBackspace(Un){return Un.registerCommand(Me$2,Pn=>{const ei=Un.getEditorState().read(()=>{const co=$r();if(!wr(co)||!co.isCollapsed())return!1;const xo=co.anchor;if(xo.offset!==0)return!1;const os=xo.getNode();if(yr(os)){if(os.getPreviousSibling())return!1;const hs=os.getParentOrThrow();return It$1(hs)?hs:!1}return It$1(os)?os:!1});return ei?(Pn.stopImmediatePropagation(),Pn.preventDefault(),Pn.stopPropagation(),Un.update(()=>{const co=Vi();ei.replace(co,!0),co.select(0,0)}),!0):!1},Gi)}function registerRichKeydown(Un,Pn,ei){const{enableHotkey:co=!0}=ei||{};return rc(Pn.registerHotkey(HotkeyEnum.PasteAsPlainText,async()=>{try{const xo=await navigator.clipboard.readText();Un.update(()=>{const os=$r();wr(os)&&os.insertText(xo)})}catch(xo){logger$1$1.error("❌ Failed to paste as plain text:",xo)}},{enabled:co,preventDefault:!0,stopPropagation:!0}),Pn.registerHotkey(HotkeyEnum.Bold,()=>Un.dispatchCommand(me$2,"bold"),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Italic,()=>Un.dispatchCommand(me$2,"italic"),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Underline,()=>Un.dispatchCommand(me$2,"underline"),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Strikethrough,()=>Un.dispatchCommand(me$2,"strikethrough"),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Undo,()=>Un.dispatchCommand(xe$1,void 0),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHotkey(HotkeyEnum.Redo,()=>Un.dispatchCommand(Ce$1,void 0),{enabled:co,preventDefault:!0,stopImmediatePropagation:!0}),Pn.registerHighCommand(be$2,xo=>{const os=$r();if(Or(os)){const hs=os.getNodes();if(hs.length>0)return hs[0].selectPrevious(),xo.preventDefault(),!0}else if(wr(os)){const hs=$getAdjacentNode(os.focus,!0),Ms=hs||$getDownUpNode(os.focus,!0);if(!xo.shiftKey&&Li(hs)){const ea=Jr();return ea.add(hs.getKey()),Un.update(()=>{Bo(ea)}),xo.preventDefault(),!0}else if(!xo.shiftKey&&Li(Ms)){const ea=Jr();return ea.add(Ms.getKey()),Un.update(()=>{Bo(ea)}),xo.preventDefault(),!0}else if(hs&&hs.getType()!=="linebreak")return hs==null||hs.selectEnd(),xo.preventDefault(),!0}return!1},qi),Pn.registerHighCommand(we$1,xo=>{const os=$r();if(wr(os)){if(!os.isCollapsed())return!1;const hs=os.focus.getNode(),Ms=$closest(hs,ta=>ta.getType()===Et$1.getType());if(!Ms||Ms.getNextSibling())return!1;const ea=Ms.getLastChild();return!ea||!$closest(hs,ta=>ta===ea)?!1:(xo.preventDefault(),Un.update(()=>{const ta=Vi();Ms.insertAfter(ta),ta.select()}),!0)}return!1},Hi),Pn.registerHighCommand(we$1,xo=>{const os=$r();if(Or(os)){const hs=os.getNodes();if(hs.length>0){const Ms=hs[0].getNextSibling();if(Ss(Ms)){const ea=Ms.getParent();if(ea){const ta=Ms.getIndexWithinParent();return ea.select(ta,ta),xo.preventDefault(),!0}}return Ms==null||Ms.selectStart(),xo.preventDefault(),!0}}else if(wr(os)){if($isSelectionAtEndOfRoot(os))return xo.preventDefault(),!0;const hs=$getAdjacentNode(os.focus,!1),Ms=hs||$getDownUpNode(os.focus,!1);if(!xo.shiftKey&&Li(hs)){const ea=Jr();return ea.add(hs.getKey()),Un.update(()=>{Bo(ea)}),xo.preventDefault(),!0}else if(!xo.shiftKey&&Li(Ms)){const ea=Jr();return ea.add(Ms.getKey()),Un.update(()=>{Bo(ea)}),xo.preventDefault(),!0}else if(hs&&hs.getType()!=="linebreak")return hs==null||hs.selectStart(),xo.preventDefault(),!0}return!1},qi),Pn.registerHighCommand(ve$1,xo=>{var hs,Ms;const os=$r();if(wr(os)){const ea=os.focus.getNode();if(Pi(ea)&&((hs=ea.getChildAtIndex(os.focus.offset))==null?void 0:hs.getType())==="table")return(Ms=ea.getChildAtIndex(os.focus.offset))==null||Ms.selectStart(),xo.preventDefault(),!0}else if(Or(os)){const ea=os.getNodes();if(ea.length>0){const ta=ea[0].getNextSibling();if(Ss(ta)){const ra=ta.getParent();if(ra){const na=ta.getIndexWithinParent();return ra.select(na,na),xo.preventDefault(),!0}}}}return!1},qi))}const NEEDS_FOLLOWING_PARAGRAPH_TYPES=new Set(["code","table","block-image","meta2d"]);function registerLastElement(Un){let Pn=!1;return Un.registerUpdateListener(({dirtyElements:ei})=>{Un.isEditable()&&(!ei.has("root")&&!Array.from(ei.keys()).some(co=>{var xo,os;return((os=(xo=Un.getEditorState()._nodeMap.get(co))==null?void 0:xo.getParent())==null?void 0:os.getKey())==="root"})||Pn||Un.getEditorState().read(()=>{const co=zo().getLastChild();return NEEDS_FOLLOWING_PARAGRAPH_TYPES.has(co==null?void 0:co.getType())})&&(Pn=!0,queueMicrotask(()=>{Un.update(()=>{const co=zo(),xo=co.getLastChild();if(NEEDS_FOLLOWING_PARAGRAPH_TYPES.has(xo==null?void 0:xo.getType())){const os=Vi();co.append(os)}Pn=!1})})))})}init_utils$1();var Qd;const CommonPlugin=(Qd=class extends KernelPlugin{constructor(Pn,ei={}){super(),this.kernel=Pn,this.config=ei,this.formats={bold:!0,header:!0,italic:!0,quote:!0,strikethrough:!0,subscript:!1,superscript:!1};const co=ei.markdownOption??!0;typeof co=="object"?(this.formats.bold=co.bold??!0,this.formats.header=co.header??!0,this.formats.italic=co.italic??!0,this.formats.quote=co.quote??!0,this.formats.strikethrough=co.strikethrough??!0,this.formats.subscript=co.subscript??!1,this.formats.superscript=co.superscript??!1):co===!1&&(this.formats.bold=!1,this.formats.header=!1,this.formats.italic=!1,this.formats.quote=!1,this.formats.strikethrough=!1,this.formats.subscript=!1,this.formats.superscript=!1),Pn.registerDataSource(new JSONDataSource("json")),Pn.registerDataSource(new TextDataSource("text")),Pn.registerNodes([Pt$1,Et$1,CursorNode]),ei!=null&&ei.theme&&Pn.registerThemes({quote:ei.theme.quote,text:{bold:ei.theme.textBold,code:ei.theme.textCode,highlight:ei.theme.textHighlight,italic:ei.theme.textItalic,strikethrough:ei.theme.textStrikethrough,subscript:ei.theme.textSubscript,superscript:ei.theme.textSuperscript,underline:ei.theme.textUnderline,underlineStrikethrough:ei.theme.textUnderlineStrikethrough}})}registerMarkdown(Pn){var hs;const ei=Pn.requireService(IMarkdownShortCutService);if(!ei)return;const co=(((hs=this.config)==null?void 0:hs.markdownOption)??!0)!==!1?`
|
|
4048
4068
|
|
|
4049
4069
|
`:`
|
|
4050
4070
|
`,xo=this.formats;xo.quote&&ei.registerMarkdownShortCut({regExp:/^>\s/,replace:(Ms,ea,ta,ra)=>{if(ra){const ia=Ms.getPreviousSibling();if(Ot$1(ia)){ia.splice(ia.getChildrenSize(),0,[Qn(),...ea]),Ms.remove();return}}const na=Ft$1();na.append(...ea),Ms.replace(na),ra||na.select(0,0)},type:"element"}),xo.header&&ei.registerMarkdownShortCut({regExp:/^(#{1,6})\s/,replace:createBlockNode((Ms,ea)=>{const ta="h"+Ms[1].length;return It$1(ea)&&ea.getTag()===ta?Vi():Mt$1(ta)}),type:"element"});const os=[];xo.bold&&os.push({format:["bold"],tag:"**",type:"text-format"},{format:["bold"],intraword:!1,tag:"__",type:"text-format"}),xo.strikethrough&&os.push({format:["strikethrough"],tag:"~~",type:"text-format"}),xo.italic&&os.push({format:["italic"],tag:"*",type:"text-format"},{format:["italic"],intraword:!1,tag:"_",type:"text-format"}),xo.superscript&&os.push({format:["superscript"],tag:"^",type:"text-format"}),xo.subscript&&os.push({format:["subscript"],tag:"~",type:"text-format"}),os.length>0&&ei.registerMarkdownShortCuts(os),ei.registerMarkdownWriter("paragraph",Ms=>{Ms.wrap("",co)}),xo.quote&&ei.registerMarkdownWriter("quote",(Ms,ea)=>{Ot$1(ea)&&Ms.wrap("> ",co)}),xo.header&&ei.registerMarkdownWriter("heading",(Ms,ea)=>{if(It$1(ea))switch(ea.getTag()){case"h1":Ms.wrap("# ",`
|
|
@@ -4454,8 +4474,8 @@ Please report this to https://github.com/markedjs/marked.`,Pn){let xo="<p>An err
|
|
|
4454
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
|
|
4455
4475
|
L20,10
|
|
4456
4476
|
M20,10
|
|
4457
|
-
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-ktgh-bL6.js"),__vite__mapDeps([46,47,48,49,50,51])),"loader")},{name:"cose-bilkent",loader:__name(async()=>await __vitePreload(()=>import("./cose-bilkent-S5V4N54A-CzezG6ox.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-D07jFtVS.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-QzBk2wAw.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-QzBk2wAw.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-jk5-d5KI.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-C5V73rrQ.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-CKP3IWTH.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-Iz6EhDIH.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-Ddui9GA1.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-D6B2qntC.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-BfFfwWeH.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-CHCPO4Zb.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-CwB9ZgYA.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-Bm7_oEd3.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-Bm7_oEd3.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-hTSwgeqm.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-D7hsviRi.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-iVGgUemP.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
|
|
4458
|
-
`);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-QzBk2wAw.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-DJy3db-p.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-BdBw10wC.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-DRYpEnUc.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-SN8PjrKG.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-Cwfec9cw.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-DAbMEFAt.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-DD_itpIN.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-BVFJ-ljp.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-B2OW7FMH.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-BjxYzJXV.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-CO2M7rf8.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-fsU2XEkt.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-772gQl8M.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)+`
|
|
4459
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,`
|
|
4460
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=[])=>`
|
|
4461
4481
|
.${Un} ${Pn} { ${ei.join(" !important; ")} !important; }`,"cssImportantStyles"),createCssStyles=__name((Un,Pn=new Map)=>{let ei="";if(Un.themeCSS!==void 0&&(ei+=`
|
|
@@ -5828,7 +5848,7 @@ ${this.__markdown}
|
|
|
5828
5848
|
## 分支 2`,style:{border:"none",flex:1,fontFamily:"monospace",fontSize:14,lineHeight:1.6,outline:"none",padding:16,resize:"none"},value:co})]}),jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",width:"50%"},children:jsxRuntimeExports.jsx(MarkmapPreview,{markdown:co})})]})]})}function MarkmapDecorator({className:Un,editor:Pn,node:ei}){const[co,xo]=reactExports.useState(!1),os=ei.__markdown;reactExports.useLayoutEffect(()=>{const ea=ei.getKey();let ta=!1;Pn.getEditorState().read(()=>{const ra=Po(ea);ra&&$isMarkmapNode(ra)&&ra.__autoOpenEditor&&(ta=!0)}),ta&&(xo(!0),Pn.update(()=>{const ra=Po(ea);ra&&$isMarkmapNode(ra)&&ra.__autoOpenEditor&&ra.clearAutoOpenEditor()}))},[Pn,ei.getKey()]);const hs=reactExports.useCallback(()=>{Pn.update(()=>{const ea=ei.getLatest(),ta=ea.getNextSibling(),ra=ea.getPreviousSibling();if(ea.remove(),ta){ta.selectStart();return}ra&&ra.selectEnd()})},[Pn,ei]),Ms=reactExports.useCallback(ea=>{Pn.update(()=>{ei.updateMarkdown(ea)}),xo(!1)},[Pn,ei]);return co?jsxRuntimeExports.jsx("div",{className:Un,children:jsxRuntimeExports.jsx(MarkmapEditor,{markdown:os,onClose:()=>xo(!1),onSave:Ms})}):jsxRuntimeExports.jsxs("div",{className:Un,style:{margin:"8px 0",position:"relative"},children:[jsxRuntimeExports.jsxs("div",{style:{bottom:8,display:"flex",gap:4,position:"absolute",right:8,zIndex:10},children:[jsxRuntimeExports.jsx("button",{onClick:()=>xo(!0),style:{background:"rgba(0,0,0,0.5)",border:"none",borderRadius:4,color:"#fff",cursor:"pointer",fontSize:12,padding:"4px 8px"},type:"button",children:"编辑"}),jsxRuntimeExports.jsx("button",{onClick:hs,style:{background:"rgba(255,77,79,0.7)",border:"none",borderRadius:4,color:"#fff",cursor:"pointer",fontSize:12,padding:"4px 8px"},type:"button",children:"删除"})]}),jsxRuntimeExports.jsx("div",{style:{border:"1px solid #f0f0f0",borderRadius:8,height:350},children:jsxRuntimeExports.jsx(MarkmapPreview,{markdown:os})})]})}function ReactMarkmapPlugin({className:Un,theme:Pn}){const[ei]=useLexicalComposerContext(),co=reactExports.useCallback((os,hs)=>jsxRuntimeExports.jsx(MarkmapDecorator,{className:Un,editor:hs,node:os}),[Un]),xo=reactExports.useRef(!1);return xo.current||(xo.current=!0,ei.registerPlugin(MarkmapPlugin,{decorator:co,theme:Pn})),null}const INSERT_MATH_COMMAND=ne$3("INSERT_MATH_COMMAND"),UPDATE_MATH_COMMAND=ne$3("UPDATE_MATH_COMMAND"),SELECT_MATH_SIDE_COMMAND=ne$3("SELECT_MATH_SIDE_COMMAND");function registerMathCommand(Un){return rc(Un.registerCommand(INSERT_MATH_COMMAND,Pn=>{const{code:ei}=Pn;return Un.update(()=>{const co=$createMathInlineNode(ei);ti([co]),Ss(co.getParentOrThrow())&&Rt$2(co,Vi).selectEnd()}),!0},Xi),Un.registerCommand(UPDATE_MATH_COMMAND,Pn=>{const{code:ei,key:co}=Pn;return Un.update(()=>{const xo=Po(co);xo&&(xo.updateCode(ei),xo.selectNext())}),!0},Xi),Un.registerCommand(SELECT_MATH_SIDE_COMMAND,Pn=>{const{key:ei,prev:co}=Pn;return Un.update(()=>{const xo=Po(ei);xo&&(co?xo.selectPrevious():xo.selectNext())}),!0},Xi))}function isLikelyMathContent(Un){const Pn=Un.trim();return Pn?!!(/\\[A-Za-z]/.test(Pn)||/[\d!()*+,/<=>^_{|}-]/.test(Pn)||/^[A-Za-z]$/.test(Pn)):!1}init_helper();init_plugin();init_debug();var Ih;const MathPlugin=(Ih=class extends KernelPlugin{constructor(Pn,ei){super(),this.kernel=Pn,this.config=ei,this.logger=createDebugLogger("plugin","math"),Pn.registerNodes([MathInlineNode,MathBlockNode]),ei!=null&&ei.theme&&Pn.registerThemes(ei==null?void 0:ei.theme),this.registerDecorator(Pn,MathInlineNode.getType(),(co,xo)=>ei!=null&&ei.decorator?ei.decorator(co,xo):null),this.registerDecorator(Pn,MathBlockNode.getType(),(co,xo)=>ei!=null&&ei.decorator?ei.decorator(co,xo):null)}onInit(Pn){this.register(registerMathCommand(Pn)),this.registerMarkdown()}registerMarkdown(){const Pn=this.kernel.requireService(IMarkdownShortCutService);Pn==null||Pn.registerMarkdownShortCut({regExp:/\$([^\s$](?:[^$]*[^\s$])?)\$\s?$/,replace:(ei,co)=>{const[,xo]=co;if(!isLikelyMathContent(xo))return;const os=$createMathInlineNode(xo);this.logger.debug("Math node inserted:",os),ei.insertBefore(os),ei.setTextContent(""),ei.select()},trigger:"$",type:"text-match"}),Pn==null||Pn.registerMarkdownShortCut({regExp:/^(\$\$)$/,replace:(ei,co,xo,os)=>{const hs=$createMathBlockNode();os||ei.getNextSibling()?ei.replace(hs):ei.insertBefore(hs);const Ms=Jr();Ms.add(hs.getKey()),Bo(Ms)},trigger:"enter",type:"element"}),Pn==null||Pn.registerMarkdownWriter(MathInlineNode.getType(),(ei,co)=>(ei.appendLine(co.getTextContent()),!0)),Pn==null||Pn.registerMarkdownWriter(MathBlockNode.getType(),(ei,co)=>(ei.appendLine(co.getTextContent()),!0)),Pn==null||Pn.registerMarkdownReader("inlineMath",ei=>INodeHelper.createElementNode("math",{code:ei.value,version:1})),Pn==null||Pn.registerMarkdownReader("math",ei=>INodeHelper.createElementNode("mathBlock",{code:ei.value,version:1}))}},Ih.pluginName="MathPlugin",Ih),MathEditorContainer=reactExports.memo(({children:Un,isBlockMode:Pn,mathDOM:ei,onFocus:co,prev:xo})=>{const os=reactExports.useRef(null),[hs,Ms]=reactExports.useState(void 0),ea=reactExports.useRef(void 0),ta=reactExports.useCallback(oa=>{const sa=typeof oa=="number"?Math.round(oa):void 0;ea.current!==sa&&(ea.current=sa,Ms(sa))},[]),ra=reactExports.useCallback(()=>{if(!Pn){ta(void 0);return}const oa=ei==null?void 0:ei.closest('[contenteditable="true"]');oa&&ta(oa.getBoundingClientRect().width)},[Pn,ei,ta]),na=reactExports.useCallback(()=>updatePosition({callback:()=>{!os.current||!ei||(co==null||co(),ra())},floating:os.current,placement:Pn?"bottom-start":"bottom",reference:ei}),[Pn,ei,co,ra]),ia=reactExports.useCallback(()=>{ei&&na()},[ei,na]);return reactExports.useEffect(()=>{if(!ei||!os.current)return;const oa=os.current,sa=new ResizeObserver(()=>{ra()});sa.observe(oa);let aa=null;return Pn&&(aa=ei.closest('[contenteditable="true"]'),aa&&sa.observe(aa)),na(),window.addEventListener("resize",na),()=>{sa.disconnect(),window.removeEventListener("resize",na)}},[ei,xo,Pn,na]),reactExports.useEffect(()=>{ei||!os.current||cleanPosition(os.current)},[ei]),jsxRuntimeExports.jsx(Popover,{arrow:!1,content:jsxRuntimeExports.jsx(FlexBasic_default,{className:styles$1$2.mathEditor,"data-math-editor-container":!0,style:hs?{width:hs}:void 0,children:Un}),open:!!ei,placement:Pn?"bottomLeft":"bottom",styles:{content:{borderRadius:"6px",padding:0}},children:jsxRuntimeExports.jsx("span",{className:styles$1$2.mathEditorAnchor,onClick:ia,ref:os})})});MathEditorContainer.displayName="MathEditorContainer";init_sys();const MathEditorContent=reactExports.memo(({focusRef:Un,mathNode:Pn,onArrowLeft:ei,onArrowRight:co,onCancel:xo,onDelete:os,onSubmit:hs,onValidationChange:Ms,onValueChange:ea,value:ta})=>{const ra=useTranslation(),na=reactExports.useRef(null),[ia,oa]=reactExports.useState("");reactExports.useEffect(()=>{Un==null||Un(na.current)},[Un]),reactExports.useEffect(()=>{if(!Pn)return;if(!ta.trim()){oa(""),Ms==null||Ms(!0);return}const aa=setTimeout(()=>{try{renderToString(ta,{displayMode:!0,throwOnError:!0}),oa(""),Ms==null||Ms(!0)}catch(la){oa(la instanceof Error?la.message:"LaTeX Parse Error"),Ms==null||Ms(!1)}},50);return()=>clearTimeout(aa)},[ta,Pn,Ms]);const sa=reactExports.useCallback(aa=>{if(Pn){if(Go(aa,CONTROL_OR_META)&&aa.key==="Enter"){aa.preventDefault(),hs();return}if(aa.key==="Escape"){aa.preventDefault(),xo();return}if(aa.key==="Backspace"&&!ta.trim()){aa.preventDefault(),os();return}aa.key==="ArrowLeft"&&aa.currentTarget.selectionStart===0&&(aa.preventDefault(),ei()),aa.key==="ArrowRight"&&aa.currentTarget.selectionStart===aa.currentTarget.value.length&&(aa.preventDefault(),co())}},[Pn,hs,xo,os,ei,co,ta]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TextArea,{autoFocus:!0,autoSize:{maxRows:6,minRows:1},className:styles$1$2.mathEditorTextArea,onChange:aa=>{ea(aa.target.value)},onKeyDown:sa,placeholder:`${ra("math.placeholder")}...`,ref:na,resize:!1,value:ta,variant:"borderless"}),ia&&jsxRuntimeExports.jsx(FlexBasic_default,{className:styles$1$2.mathEditorFooter,horizontal:!0,paddingBlock:4,paddingInline:12,width:"100%",children:jsxRuntimeExports.jsx(Text$3,{fontSize:13,type:"danger",children:ia})}),jsxRuntimeExports.jsx(FlexBasic_default,{className:styles$1$2.mathEditorFooter,horizontal:!0,justify:"flex-end",padding:4,width:"100%",children:jsxRuntimeExports.jsxs(Button$1,{onClick:aa=>{aa.preventDefault(),hs()},size:"small",type:"text",variant:"filled",children:[ra("confirm"),jsxRuntimeExports.jsx(Hotkey,{compact:!0,keys:"mod+enter",variant:"borderless"})]})})]})});MathEditorContent.displayName="MathEditorContent";init_utils();const MathEdit=reactExports.memo(({renderComp:Un})=>{const Pn=reactExports.useRef(null),ei=reactExports.useRef(!1),[co,xo]=reactExports.useState(null),[os,hs]=reactExports.useState(""),Ms=reactExports.useRef(""),ea=reactExports.useRef(!0),[ta,ra]=reactExports.useState(null),[na,ia]=reactExports.useState(!1),[oa,sa]=reactExports.useState(!1),[aa,la]=reactExports.useState(!1),[ca]=useLexicalComposerContext();reactExports.useEffect(()=>{if(!co||!ea.current)return;const va=setTimeout(()=>{const ya=ca.getLexicalEditor();if(ya&&!ei.current){const Ca=co.code;if(os&&Ca&&Ca===os)return;ei.current=!0,ya.update(()=>{if(ya.getEditorState().read(()=>ya.getElementByKey(co.getKey()))){const wa=co.getWritable();wa.__code=os}}),setTimeout(()=>{ei.current=!1},50)}},50);return()=>clearTimeout(va)},[os,co,ca]);const ua=reactExports.useCallback(()=>{if(!co)return;const va=ca.getLexicalEditor();if(va){const ya=ea.current?os:Ms.current;va.dispatchCommand(UPDATE_MATH_COMMAND,{code:ya,key:co.getKey()})}},[ca,co,os]),da=reactExports.useCallback(()=>{if(!co)return;const va=ca.getLexicalEditor();va&&(va.dispatchCommand(SELECT_MATH_SIDE_COMMAND,{key:co.getKey(),prev:!1}),va.focus())},[co,ca]),ha=reactExports.useCallback(()=>{if(!co)return;const va=ca.getLexicalEditor();va&&va.update(()=>{co.remove()})},[co,ca]),fa=reactExports.useCallback(()=>{co&&ca.dispatchCommand(SELECT_MATH_SIDE_COMMAND,{key:co.getKey(),prev:!0})},[co,ca]),pa=reactExports.useCallback(()=>{co&&ca.dispatchCommand(SELECT_MATH_SIDE_COMMAND,{key:co.getKey(),prev:!1})},[co,ca]),ma=reactExports.useCallback(()=>{var va,ya,Ca,wa;(va=Pn.current)==null||va.focus(),na&&((wa=(Ca=(ya=Pn.current)==null?void 0:ya.resizableTextArea)==null?void 0:Ca.textArea)==null||wa.setSelectionRange(0,0))},[na]),ga=reactExports.useCallback(va=>{Pn.current=va},[]);useLexicalEditor(va=>rc(va.registerUpdateListener(({prevEditorState:ya})=>{if(ei.current)return;const Ca=va.getEditorState().read(()=>{const wa=$r();if(!Or(wa))return!1;const Ea=wa.getNodes()[0];if(!$isMathNode(Ea))return!1;const Ta=co&&co.getKey()===Ea.getKey();return xo(Ea),!Ta&&Ea.code!==os&&(hs(Ea.code),Ms.current=Ea.code,ea.current=!0),ra(va.getElementByKey(Ea.getKey())),sa(Ea instanceof MathBlockNode),Ea});if(Ca){const wa=ya.read(()=>{const Ea=ya._selection;return wr(Ea)?Ea.anchor.key:!1});va.getEditorState().read(()=>{const Ea=wa?Po(wa):null;Ea&&compareNodeOrder(Ea,Ca)<0?ia(!0):ia(!1)}),la(!0)}Ca||(xo(null),ra(null),hs(""),Ms.current="",ea.current=!0,sa(!1),la(!1))})),[co,os]);const xa=jsxRuntimeExports.jsx(MathEditorContent,{focusRef:ga,mathNode:co,onArrowLeft:fa,onArrowRight:pa,onCancel:da,onDelete:ha,onSubmit:ua,onValidationChange:va=>{ea.current=va,va&&(Ms.current=os)},onValueChange:hs,value:os});return reactExports.useEffect(()=>{if(!aa)return;const va=ya=>{const Ca=ya.target;Ca&&(Array.from(document.querySelectorAll("[data-math-editor-container]")).some(wa=>wa&&wa.contains(Ca))||da())};return document.addEventListener("mousedown",va),document.addEventListener("touchstart",va),()=>{document.removeEventListener("mousedown",va),document.removeEventListener("touchstart",va)}},[aa,da]),Un?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:Un({children:jsxRuntimeExports.jsx("div",{"data-math-editor-container":!0,children:xa}),open:aa})}):jsxRuntimeExports.jsx(PortalAnchor,{children:jsxRuntimeExports.jsx(MathEditorContainer,{isBlockMode:oa,mathDOM:ta,onFocus:ma,prev:na,children:xa})})}),Placeholder=({mathBlock:Un})=>{const Pn=useTranslation(),ei=jsxRuntimeExports.jsx(Text$3,{as:"span",className:cx$2("katex",styles$1$2.mathPlaceholder),fontSize:Un?"1.2em":"1em",type:"secondary",children:Pn("math.placeholder")});return Un?jsxRuntimeExports.jsx(Center,{padding:18,width:"100%",children:ei}):ei};init_debug();const logger=createDebugLogger("plugin","math"),MathInline=({editor:Un,node:Pn,className:ei})=>{const co=reactExports.useRef(null),[xo,os,hs]=useLexicalNodeSelection(Pn.getKey()),[Ms,ea]=reactExports.useState(!1),ta=Pn instanceof MathBlockNode;return reactExports.useEffect(()=>{co.current&&Pn.code&&katex$1.render(Pn.code,co.current,{displayMode:Pn instanceof MathBlockNode,throwOnError:!1})},[Pn.code]),reactExports.useEffect(()=>{const ra=Un.getElementByKey(Pn.getKey());if(ra){const na=setTimeout(()=>{Ms?(ec(ra,"editing"),nc(ra,"selected")):xo?(ec(ra,"selected"),nc(ra,"editing")):(nc(ra,"selected"),nc(ra,"editing"))},10);return()=>clearTimeout(na)}},[xo,Ms,Un,Pn]),useLexicalEditor(ra=>ra.registerUpdateListener(()=>{ra.getEditorState().read(()=>{const na=$r();if(!Or(na)){ea(!1);return}const ia=na.getNodes()[0];if(!$isMathNode(ia)){ea(!1);return}ia.getKey()===Pn.getKey()?ea(!0):ea(!1)})}),[Pn]),jsxRuntimeExports.jsx("span",{className:ei,onClick:reactExports.useCallback(ra=>{logger.debug("📊 Math click event:",ra.target===co.current),ra.preventDefault(),ra.stopPropagation(),xo&&hs(),os(!0),Un.focus()},[hs,Un,xo,os]),ref:co,children:Pn.code?Pn.code:jsxRuntimeExports.jsx(Placeholder,{mathBlock:ta})})},ReactMathPlugin=({className:Un,renderComp:Pn,theme:ei})=>{const[co]=useLexicalComposerContext();return reactExports.useLayoutEffect(()=>{co.registerPlugin(MarkdownPlugin),co.registerPlugin(MathPlugin,{decorator:(xo,os)=>jsxRuntimeExports.jsx(MathInline,{className:Un,editor:os,node:xo}),theme:ei||styles$1$2})},[co,Un,ei,styles$1$2]),jsxRuntimeExports.jsx(MathEdit,{renderComp:Pn})};ReactMathPlugin.displayName="ReactMathPlugin";var Meta2dNode=class ff extends Fi{static getType(){return"meta2d"}static clone(Pn){return new ff(Pn.__diagram,Pn.__svg,Pn.__key,Pn.__autoOpenEditor)}static importJSON(Pn){return new ff(Pn.diagram,Pn.svg)}constructor(Pn="",ei="",co,xo=!1){super(co),this.__diagram=Pn,this.__svg=ei,this.__autoOpenEditor=xo}clearAutoOpenEditor(){const Pn=this.getWritable();Pn.__autoOpenEditor=!1}createDOM(Pn){const ei=document.createElement("div");return ec(ei,Pn.theme.meta2d??"editor-meta2d"),ei}decorate(Pn){var co;const ei=(co=getKernelFromEditor(Pn))==null?void 0:co.getDecorator(ff.getType());return ei?typeof ei=="function"?ei(this,Pn):{queryDOM:ei.queryDOM,render:ei.render(this,Pn)}:null}exportJSON(){return{...super.exportJSON(),diagram:this.__diagram,svg:this.__svg}}getTextContent(){return`---meta2d---
|
|
5829
5849
|
${this.__diagram}
|
|
5830
5850
|
---/meta2d---
|
|
5831
|
-
`}isInline(){return!1}updateDiagram(Pn,ei){const co=this.getWritable();co.__diagram=Pn,co.__svg=ei}updateDOM(){return!1}};function $createMeta2dNode(Un="",Pn="",ei){return ks(new Meta2dNode(Un,Pn,void 0,(ei==null?void 0:ei.autoOpenEditor)??!1))}function $isMeta2dNode(Un){return Un instanceof Meta2dNode}let registered=!1;function registerAllShapeLibraries(){registered||(register$1(flowPens()),registerAnchors(flowAnchors()),register$1(activityDiagram()),registerCanvasDraw(activityDiagramByCtx()),register$1(classPens()),register$1(sequencePens()),registerCanvasDraw(sequencePensbyCtx()),register(),registerCanvasDraw(formPens()),registerCanvasDraw(chartsPens()),register$1(ftaPens()),registerCanvasDraw(ftaPensbyCtx()),registerAnchors(ftaAnchors()),registered=!0)}let shapesReady=!1;const DEFAULT_STROKE_COLOR="#1f1f1f",DEFAULT_LINE_WIDTH=1,NO_DEFAULT_STROKE_NAMES=new Set(["text"]);function createEmptyMeta2dData(){return{pens:[]}}const EMPTY_META2D_DIAGRAM_JSON=JSON.stringify(createEmptyMeta2dData()),EMPTY_META2D_PLACEHOLDER_SVG='<svg xmlns="http://www.w3.org/2000/svg" width="320" height="180" viewBox="0 0 320 180"><rect width="100%" height="100%" fill="#fafafa" stroke="#eee"/></svg>';function initialSvgForDiagram(Un){if(!Un.trim())return EMPTY_META2D_PLACEHOLDER_SVG;try{const Pn=JSON.parse(Un);if(Pn&&Array.isArray(Pn.pens)&&Pn.pens.length===0)return EMPTY_META2D_PLACEHOLDER_SVG}catch{}return""}function ensureMeta2dShapes(){shapesReady||(registerAllShapeLibraries(),shapesReady=!0)}function isRecord(Un){return!!Un&&typeof Un=="object"&&!Array.isArray(Un)}function shouldApplyDefaultStroke(Un){return!NO_DEFAULT_STROKE_NAMES.has(String(Un.name??""))}function normalizeMeta2dPen(Un){return shouldApplyDefaultStroke(Un)&&(Un.color===void 0&&Un.strokeStyle===void 0&&(Un.color=DEFAULT_STROKE_COLOR),Un.lineWidth===void 0&&Un.strokeStyle!=="transparent"&&(Un.lineWidth=DEFAULT_LINE_WIDTH)),Un.text&&Un.textColor===void 0&&(Un.textColor=DEFAULT_STROKE_COLOR),Un}function normalizeMeta2dData(Un){return!isRecord(Un)||!Array.isArray(Un.pens)||Un.pens.forEach(Pn=>{isRecord(Pn)&&normalizeMeta2dPen(Pn)}),Un}function sanitizeMeta2dData(Un){return JSON.parse(JSON.stringify(Un,(Pn,ei)=>{if(!(Pn==="__meta__"||Pn==="calculative"))return ei}))}function destroyEngine(Un,Pn){try{Un==null||Un.destroy()}catch{}try{Pn.remove()}catch{}}function patchCanvas2SvgFont(Un){let Pn=Un.font;Object.defineProperty(Un,"font",{configurable:!0,get:()=>Pn,set:ei=>{Pn=typeof ei=="string"?ei.replace(/(\d+(?:\.\d+)?(?:px|pt|pc|em|ex|%|in|cm|mm))\s*\/\s*(\d+(?:\.\d+)?)(?=\s|$)/,"$1/normal"):ei,Un.__ctx&&(Un.__ctx.font=Pn)}})}function patchCanvas2SvgEllipse(Un){typeof Un.ellipse!="function"&&(Un.ellipse=(Pn,ei,co,xo,os=0,hs=0,Ms=Math.PI*2,ea=!1)=>{var ua;if(co<0||xo<0)throw new Error("IndexSizeError: The radius provided is negative.");((ua=Un.__currentElement)==null?void 0:ua.nodeName)!=="path"&&Un.beginPath();const ta=Math.PI*2,ra=Math.abs(Ms-hs),na=ra>=ta-1e-4||ra===0,ia=os*180/Math.PI,oa=ea?0:1,sa=da=>{const ha=Math.cos(da),fa=Math.sin(da),pa=Math.cos(os),ma=Math.sin(os);return{x:Pn+co*ha*pa-xo*fa*ma,y:ei+co*ha*ma+xo*fa*pa}},aa=(da,ha)=>{Un.__addPathCommand(`A ${co} ${xo} ${ia} ${da} ${oa} ${ha.x} ${ha.y}`),Un.__currentPosition=ha},la=sa(hs);if(Un.moveTo(la.x,la.y),na){aa(1,sa(hs+Math.PI)),aa(1,la);return}const ca=sa(Ms);aa(ra>Math.PI?1:0,ca)})}function waitFrame(){return new Promise(Un=>{requestAnimationFrame(()=>Un())})}async function waitForMeta2dRender(){await waitFrame(),await waitFrame()}function resolveCanvas2SvgCtor(){const Un=C2S.default??C2S.C2S??C2S;if(typeof Un=="function")return Un;const Pn=window.C2S;return typeof Pn=="function"?Pn:null}async function generateSvgFromMeta2d(Un,Pn=resolveCanvas2SvgCtor()){var ra,na,ia,oa;if(!Pn)return console.error("[meta2d] preview failed: canvas2svg constructor missing"),"";normalizeMeta2dData(Un.data()),Un.render(!0),await waitForMeta2dRender();const ei=Un.store,co=(ra=ei==null?void 0:ei.data)==null?void 0:ra.pens,xo=Array.isArray(co)?co.length:0,os=10,hs=Un.getRect();if(!hs||!Number.isFinite(hs.width)||!Number.isFinite(hs.height)||hs.width<=0||hs.height<=0)return xo===0?EMPTY_META2D_PLACEHOLDER_SVG:(console.error("[meta2d] preview failed: invalid bounds",hs),"");const Ms={...hs,x:hs.x-os,y:hs.y-os},ea=new Pn(Math.ceil(hs.width+os*2),Math.ceil(hs.height+os*2));if(ea.textBaseline="middle",ea.strokeStyle=((na=ei==null?void 0:ei.styles)==null?void 0:na.color)||DEFAULT_STROKE_COLOR,patchCanvas2SvgFont(ea),patchCanvas2SvgEllipse(ea),Array.isArray(co)&&ei){for(const sa of co)if(!((sa==null?void 0:sa.visible)===!1||!isShowChild(sa,ei)))try{Un.renderPenRaw(ea,sa,Ms,!0)}catch(aa){console.error("[meta2d] preview failed: render pen",sa,aa)}}const ta=((oa=(ia=ea.getSerializedSvg)==null?void 0:ia.call(ea))==null?void 0:oa.replace(/--le5le--/g,"&#x"))??"";return ta.trim()?ta:xo===0?EMPTY_META2D_PLACEHOLDER_SVG:(console.error("[meta2d] preview failed: serialized SVG is empty",{pensCount:xo}),"")}async function generateSvgFromDiagram(Un){const Pn=resolveCanvas2SvgCtor();if(!Pn)return console.error("[meta2d] preview failed: canvas2svg constructor missing"),"";ensureMeta2dShapes();const ei=document.createElement("div");ei.style.cssText="position:fixed;left:-20000px;top:0;width:1200px;height:800px;pointer-events:none;z-index:-1;",document.body.append(ei);let co=null;try{let xo;try{xo=JSON.parse(Un)}catch(os){return console.error("[meta2d] preview failed: invalid diagram JSON",os,Un),""}return co=new Meta2d(ei,{background:"#fff",grid:!1,rule:!1}),normalizeMeta2dData(xo),co.open(xo),co.render(!0),await waitForMeta2dRender(),generateSvgFromMeta2d(co,Pn)}catch(xo){return console.error("[meta2d] preview failed: unexpected error",xo),""}finally{destroyEngine(co,ei)}}const INSERT_META2D_COMMAND=ne$3("INSERT_META2D_COMMAND");function registerMeta2dCommand(Un){return Un.registerCommand(INSERT_META2D_COMMAND,Pn=>(Un.update(()=>{var ei;ti([$createMeta2dNode(((ei=Pn==null?void 0:Pn.diagram)==null?void 0:ei.trim())||EMPTY_META2D_DIAGRAM_JSON,(Pn==null?void 0:Pn.svg)!==void 0&&Pn.svg.trim()!==""?Pn.svg:EMPTY_META2D_PLACEHOLDER_SVG)])}),!0),qi)}init_helper();init_plugin();const META2D_SHORTCUT=/^---meta2d---$/i,META2D_BLOCK=/---meta2d---(\\n?)([\S\s]*?)\n?---\/meta2d---/i;function extractParagraphText(Un){return(Un.children||[]).map(Pn=>"value"in Pn&&typeof Pn.value=="string"?Pn.value:"").join("")}var Dh;const Meta2dPlugin=(Dh=class extends KernelPlugin{constructor(Pn,ei){super(),this.kernel=Pn,this.config=ei,Pn.registerNodes([Meta2dNode]),ei!=null&&ei.theme&&Pn.registerThemes(ei.theme),this.registerDecorator(Pn,Meta2dNode.getType(),(co,xo)=>ei!=null&&ei.decorator?ei.decorator(co,xo):null)}onInit(Pn){this.register(registerMeta2dCommand(Pn)),this.registerMarkdown()}registerMarkdown(){const Pn=this.kernel.requireService(IMarkdownShortCutService);Pn&&(Pn.registerMarkdownShortCut({regExp:META2D_SHORTCUT,replace:ei=>{const co=$createMeta2dNode(EMPTY_META2D_DIAGRAM_JSON,EMPTY_META2D_PLACEHOLDER_SVG,{autoOpenEditor:!0});ei.replace(co);const xo=Jr();xo.add(co.getKey()),Bo(xo)},trigger:"enter",type:"element"}),Pn.registerMarkdownWriter(Meta2dNode.getType(),(ei,co)=>{const xo=co;return ei.appendLine("---meta2d---"),ei.appendLine(xo.__diagram||EMPTY_META2D_DIAGRAM_JSON),ei.appendLine("---/meta2d---"),!0}),Pn.registerMarkdownReader("paragraph",ei=>{var os;const co=extractParagraphText(ei).match(META2D_BLOCK);if(!co)return!1;const xo=((os=co[2])==null?void 0:os.trim())||EMPTY_META2D_DIAGRAM_JSON;return INodeHelper.createTypeNode(Meta2dNode.getType(),{diagram:xo,svg:initialSvgForDiagram(xo)})},1))}},Dh.pluginName="Meta2dPlugin",Dh),GROUP_LOCALE_MAP={Activity:"meta2d.palette.groups.activity",Basic:"meta2d.palette.groups.basic","Fault tree":"meta2d.palette.groups.faultTree",Flow:"meta2d.palette.groups.flow","Sequence & class":"meta2d.palette.groups.sequenceClass"};function itemLabelLocaleKey(Un){return`meta2d.palette.${Un}`}const baseShape={background:"#fff",color:"#1f1f1f",height:60,lineWidth:1,textColor:"#1f1f1f",width:120};function getPalette(){return[{group:"Basic",key:"square",label:"Square",pen:{...baseShape,height:100,name:"square",text:"",width:100}},{group:"Basic",key:"rect",label:"Rectangle",pen:{...baseShape,name:"rectangle",text:"Rectangle"}},{group:"Basic",key:"roundRect",label:"Rounded",pen:{...baseShape,borderRadius:.2,name:"rectangle",text:"Rounded"}},{group:"Basic",key:"circle",label:"Circle",pen:{...baseShape,height:80,name:"circle",text:"Circle",width:80}},{group:"Basic",key:"triangle",label:"Triangle",pen:{...baseShape,height:90,name:"triangle",text:"Triangle",width:100}},{group:"Basic",key:"diamond",label:"Diamond",pen:{...baseShape,height:100,name:"diamond",text:"Decision",width:100}},{group:"Basic",key:"pentagon",label:"Pentagon",pen:{...baseShape,height:100,name:"pentagon",text:"Pentagon",width:100}},{group:"Basic",key:"hexagon",label:"Hexagon",pen:{...baseShape,height:100,name:"hexagon",text:"Hexagon",width:100}},{group:"Basic",key:"pentagram",label:"Star",pen:{...baseShape,height:100,name:"pentagram",text:"",width:100}},{group:"Basic",key:"leftArrow",label:"Left arrow",pen:{height:60,name:"leftArrow",width:120}},{group:"Basic",key:"rightArrow",label:"Right arrow",pen:{height:60,name:"rightArrow",width:120}},{group:"Basic",key:"twowayArrow",label:"Two-way",pen:{height:60,name:"twowayArrow",width:150}},{group:"Basic",key:"cloud",label:"Cloud",pen:{height:100,name:"cloud",width:100}},{group:"Basic",key:"message",label:"Message",pen:{height:100,name:"message",textTop:-.1,width:100}},{group:"Basic",key:"file",label:"File",pen:{height:100,name:"file",width:80}},{group:"Basic",key:"cube",label:"Cube",pen:{height:100,name:"cube",width:60,z:.25}},{group:"Basic",key:"people",label:"Actor",pen:{height:100,name:"people",width:70}},{group:"Basic",key:"text",label:"Text",pen:{...baseShape,background:"transparent",color:"transparent",height:32,name:"text",text:"text",width:120}},{group:"Basic",key:"line",label:"Line",pen:{color:"#1f1f1f",height:1,lineWidth:1,name:"line",width:160}},{group:"Flow",key:"flowTerminal",label:"Terminal",pen:{...baseShape,borderRadius:.5,height:40,name:"rectangle",text:"Start / End",width:120}},{group:"Flow",key:"flowProcess",label:"Process",pen:{...baseShape,height:40,name:"rectangle",text:"Process",width:120}},{group:"Flow",key:"flowDecision",label:"Decision",pen:{...baseShape,height:60,name:"diamond",text:"Decision",width:120}},{group:"Flow",key:"flowData",label:"Data",pen:{...baseShape,name:"flowData",offsetX:.14,text:"Data"}},{group:"Flow",key:"flowPrepare",label:"Prepare",pen:{...baseShape,height:50,name:"hexagon",text:"Prepare",width:120}},{group:"Flow",key:"flowSubprocess",label:"Subprocess",pen:{...baseShape,height:50,name:"flowSubprocess",text:"Subprocess",width:120}},{group:"Flow",key:"flowDb",label:"Database",pen:{...baseShape,height:100,name:"flowDb",text:"DB",width:80}},{group:"Flow",key:"flowDocument",label:"Document",pen:{...baseShape,height:100,name:"flowDocument",text:"Document",width:120}},{group:"Flow",key:"flowInternalStorage",label:"Int. storage",pen:{...baseShape,height:80,name:"flowInternalStorage",text:"Internal",width:120}},{group:"Flow",key:"flowExternStorage",label:"Ext. storage",pen:{...baseShape,height:80,name:"flowExternStorage",text:"External",width:120}},{group:"Flow",key:"flowQueue",label:"Queue",pen:{...baseShape,height:100,name:"flowQueue",text:"Queue",width:100}},{group:"Flow",key:"flowManually",label:"Manual input",pen:{...baseShape,height:80,name:"flowManually",text:"Manual",width:120}},{group:"Flow",key:"flowDisplay",label:"Display",pen:{...baseShape,height:80,name:"flowDisplay",text:"Display",width:120}},{group:"Flow",key:"flowParallel",label:"Parallel",pen:{...baseShape,height:50,name:"flowParallel",text:"Parallel",width:120}},{group:"Flow",key:"flowComment",label:"Comment",pen:{...baseShape,height:100,name:"flowComment",text:"Note",width:100}},{group:"Activity",key:"actStart",label:"Start",pen:{background:"#555",height:30,lineWidth:0,name:"circle",text:"",width:30}},{group:"Activity",key:"actFinal",label:"Final",pen:{height:30,name:"activityFinal",width:30}},{group:"Activity",key:"actStep",label:"Action",pen:{...baseShape,borderRadius:.25,height:50,name:"rectangle",text:"Action",width:120}},{group:"Activity",key:"actMerge",label:"Merge",pen:{...baseShape,height:50,name:"diamond",text:"Merge",width:120}},{group:"Activity",key:"swimlaneV",label:"Swimlane V",pen:{height:500,lineTop:.08,name:"swimlaneV",text:"Swimlane",textBaseline:"top",textTop:20,width:200}},{group:"Activity",key:"swimlaneH",label:"Swimlane H",pen:{height:200,lineLeft:.08,name:"swimlaneH",text:"Swimlane",textAlign:"left",textLeft:.04,textWidth:.01,width:500}},{group:"Activity",key:"forkV",label:"Fork V",pen:{fillStyle:"#555",height:150,name:"forkV",strokeStyle:"transparent",text:"",width:10}},{group:"Activity",key:"forkH",label:"Fork H",pen:{fillStyle:"#555",height:10,name:"forkH",strokeStyle:"transparent",text:"",width:150}},{group:"Sequence & class",key:"lifeline",label:"Lifeline",pen:{height:400,name:"lifeline",text:"Object",textHeight:50,width:150}},{group:"Sequence & class",key:"sequenceFocus",label:"Activation",pen:{height:200,name:"sequenceFocus",text:"",width:12}},{group:"Sequence & class",key:"simpleClass",label:"Simple class",pen:{height:200,list:[{text:`- name: string
|
|
5851
|
+
`}isInline(){return!1}updateDiagram(Pn,ei){const co=this.getWritable();co.__diagram=Pn,co.__svg=ei}updateDOM(){return!1}};function $createMeta2dNode(Un="",Pn="",ei){return ks(new Meta2dNode(Un,Pn,void 0,(ei==null?void 0:ei.autoOpenEditor)??!1))}function $isMeta2dNode(Un){return Un instanceof Meta2dNode}let registered=!1;function registerAllShapeLibraries(){registered||(register$1(flowPens()),registerAnchors(flowAnchors()),register$1(activityDiagram()),registerCanvasDraw(activityDiagramByCtx()),register$1(classPens()),register$1(sequencePens()),registerCanvasDraw(sequencePensbyCtx()),register(),registerCanvasDraw(formPens()),registerCanvasDraw(chartsPens()),register$1(ftaPens()),registerCanvasDraw(ftaPensbyCtx()),registerAnchors(ftaAnchors()),registered=!0)}let shapesReady=!1;const DEFAULT_STROKE_COLOR="#1f1f1f",DEFAULT_LINE_WIDTH=1,NO_DEFAULT_STROKE_NAMES=new Set(["text"]);function createEmptyMeta2dData(){return{pens:[]}}const EMPTY_META2D_DIAGRAM_JSON=JSON.stringify(createEmptyMeta2dData()),EMPTY_META2D_PLACEHOLDER_SVG='<svg xmlns="http://www.w3.org/2000/svg" width="320" height="180" viewBox="0 0 320 180"><rect width="100%" height="100%" fill="#fafafa" stroke="#eee"/></svg>';function initialSvgForDiagram(Un){if(!Un.trim())return EMPTY_META2D_PLACEHOLDER_SVG;try{const Pn=JSON.parse(Un);if(Pn&&Array.isArray(Pn.pens)&&Pn.pens.length===0)return EMPTY_META2D_PLACEHOLDER_SVG}catch{}return""}function ensureMeta2dShapes(){shapesReady||(registerAllShapeLibraries(),shapesReady=!0)}function isRecord(Un){return!!Un&&typeof Un=="object"&&!Array.isArray(Un)}function shouldApplyDefaultStroke(Un){return!NO_DEFAULT_STROKE_NAMES.has(String(Un.name??""))}function normalizeMeta2dPen(Un){return shouldApplyDefaultStroke(Un)&&(Un.color===void 0&&Un.strokeStyle===void 0&&(Un.color=DEFAULT_STROKE_COLOR),Un.lineWidth===void 0&&Un.strokeStyle!=="transparent"&&(Un.lineWidth=DEFAULT_LINE_WIDTH)),Un.text&&Un.textColor===void 0&&(Un.textColor=DEFAULT_STROKE_COLOR),Un}function normalizeMeta2dData(Un){return!isRecord(Un)||!Array.isArray(Un.pens)||Un.pens.forEach(Pn=>{isRecord(Pn)&&normalizeMeta2dPen(Pn)}),Un}function sanitizeMeta2dData(Un){return JSON.parse(JSON.stringify(Un,(Pn,ei)=>{if(!(Pn==="__meta__"||Pn==="calculative"))return ei}))}function destroyEngine(Un,Pn){try{Un==null||Un.destroy()}catch{}try{Pn.remove()}catch{}}function patchCanvas2SvgFont(Un){let Pn=Un.font;Object.defineProperty(Un,"font",{configurable:!0,get:()=>Pn,set:ei=>{Pn=typeof ei=="string"?ei.replace(/(\d+(?:\.\d+)?(?:px|pt|pc|em|ex|%|in|cm|mm))\s*\/\s*(\d+(?:\.\d+)?)(?=\s|$)/,"$1/normal"):ei,Un.__ctx&&(Un.__ctx.font=Pn)}})}function patchCanvas2SvgEllipse(Un){typeof Un.ellipse!="function"&&(Un.ellipse=(Pn,ei,co,xo,os=0,hs=0,Ms=Math.PI*2,ea=!1)=>{var ua;if(co<0||xo<0)throw new Error("IndexSizeError: The radius provided is negative.");((ua=Un.__currentElement)==null?void 0:ua.nodeName)!=="path"&&Un.beginPath();const ta=Math.PI*2,ra=Math.abs(Ms-hs),na=ra>=ta-1e-4||ra===0,ia=os*180/Math.PI,oa=ea?0:1,sa=da=>{const ha=Math.cos(da),fa=Math.sin(da),pa=Math.cos(os),ma=Math.sin(os);return{x:Pn+co*ha*pa-xo*fa*ma,y:ei+co*ha*ma+xo*fa*pa}},aa=(da,ha)=>{Un.__addPathCommand(`A ${co} ${xo} ${ia} ${da} ${oa} ${ha.x} ${ha.y}`),Un.__currentPosition=ha},la=sa(hs);if(Un.moveTo(la.x,la.y),na){aa(1,sa(hs+Math.PI)),aa(1,la);return}const ca=sa(Ms);aa(ra>Math.PI?1:0,ca)})}function waitFrame(){return new Promise(Un=>{requestAnimationFrame(()=>Un())})}async function waitForMeta2dRender(){await waitFrame(),await waitFrame()}function resolveCanvas2SvgCtor(){const Un=C2S.default??C2S.C2S??C2S;if(typeof Un=="function")return Un;const Pn=window.C2S;return typeof Pn=="function"?Pn:null}async function generateSvgFromMeta2d(Un,Pn=resolveCanvas2SvgCtor()){var ra,na,ia,oa;if(!Pn)return console.error("[meta2d] preview failed: canvas2svg constructor missing"),"";normalizeMeta2dData(Un.data()),Un.render(!0),await waitForMeta2dRender();const ei=Un.store,co=(ra=ei==null?void 0:ei.data)==null?void 0:ra.pens,xo=Array.isArray(co)?co.length:0,os=10,hs=Un.getRect();if(!hs||!Number.isFinite(hs.width)||!Number.isFinite(hs.height)||hs.width<=0||hs.height<=0)return xo===0?EMPTY_META2D_PLACEHOLDER_SVG:(console.error("[meta2d] preview failed: invalid bounds",hs),"");const Ms={...hs,x:hs.x-os,y:hs.y-os},ea=new Pn(Math.ceil(hs.width+os*2),Math.ceil(hs.height+os*2));if(ea.textBaseline="middle",ea.strokeStyle=((na=ei==null?void 0:ei.styles)==null?void 0:na.color)||DEFAULT_STROKE_COLOR,patchCanvas2SvgFont(ea),patchCanvas2SvgEllipse(ea),Array.isArray(co)&&ei){for(const sa of co)if(!((sa==null?void 0:sa.visible)===!1||!isShowChild(sa,ei)))try{Un.renderPenRaw(ea,sa,Ms,!0)}catch(aa){console.error("[meta2d] preview failed: render pen",sa,aa)}}const ta=((oa=(ia=ea.getSerializedSvg)==null?void 0:ia.call(ea))==null?void 0:oa.replace(/--le5le--/g,"&#x"))??"";return ta.trim()?ta:xo===0?EMPTY_META2D_PLACEHOLDER_SVG:(console.error("[meta2d] preview failed: serialized SVG is empty",{pensCount:xo}),"")}async function generateSvgFromDiagram(Un){const Pn=resolveCanvas2SvgCtor();if(!Pn)return console.error("[meta2d] preview failed: canvas2svg constructor missing"),"";ensureMeta2dShapes();const ei=document.createElement("div");ei.style.cssText="position:fixed;left:-20000px;top:0;width:1200px;height:800px;pointer-events:none;z-index:-1;",document.body.append(ei);let co=null;try{let xo;try{xo=JSON.parse(Un)}catch(os){return console.error("[meta2d] preview failed: invalid diagram JSON",os,Un),""}return co=new Meta2d(ei,{background:"#fff",grid:!1,rule:!1}),normalizeMeta2dData(xo),co.open(xo),co.render(!0),await waitForMeta2dRender(),generateSvgFromMeta2d(co,Pn)}catch(xo){return console.error("[meta2d] preview failed: unexpected error",xo),""}finally{destroyEngine(co,ei)}}const INSERT_META2D_COMMAND=ne$3("INSERT_META2D_COMMAND");function registerMeta2dCommand(Un){return Un.registerCommand(INSERT_META2D_COMMAND,Pn=>(Un.update(()=>{var ei;ti([$createMeta2dNode(((ei=Pn==null?void 0:Pn.diagram)==null?void 0:ei.trim())||EMPTY_META2D_DIAGRAM_JSON,(Pn==null?void 0:Pn.svg)!==void 0&&Pn.svg.trim()!==""?Pn.svg:EMPTY_META2D_PLACEHOLDER_SVG,{autoOpenEditor:(Pn==null?void 0:Pn.autoOpenEditor)??!0})])}),!0),qi)}init_helper();init_plugin();const META2D_SHORTCUT=/^---meta2d---$/i,META2D_BLOCK=/---meta2d---(\\n?)([\S\s]*?)\n?---\/meta2d---/i;function extractParagraphText(Un){return(Un.children||[]).map(Pn=>"value"in Pn&&typeof Pn.value=="string"?Pn.value:"").join("")}var Dh;const Meta2dPlugin=(Dh=class extends KernelPlugin{constructor(Pn,ei){super(),this.kernel=Pn,this.config=ei,Pn.registerNodes([Meta2dNode]),ei!=null&&ei.theme&&Pn.registerThemes(ei.theme),this.registerDecorator(Pn,Meta2dNode.getType(),(co,xo)=>ei!=null&&ei.decorator?ei.decorator(co,xo):null)}onInit(Pn){this.register(registerMeta2dCommand(Pn)),this.registerMarkdown()}registerMarkdown(){const Pn=this.kernel.requireService(IMarkdownShortCutService);Pn&&(Pn.registerMarkdownShortCut({regExp:META2D_SHORTCUT,replace:ei=>{const co=$createMeta2dNode(EMPTY_META2D_DIAGRAM_JSON,EMPTY_META2D_PLACEHOLDER_SVG,{autoOpenEditor:!0});ei.replace(co);const xo=Jr();xo.add(co.getKey()),Bo(xo)},trigger:"enter",type:"element"}),Pn.registerMarkdownWriter(Meta2dNode.getType(),(ei,co)=>{const xo=co;return ei.appendLine("---meta2d---"),ei.appendLine(xo.__diagram||EMPTY_META2D_DIAGRAM_JSON),ei.appendLine("---/meta2d---"),!0}),Pn.registerMarkdownReader("paragraph",ei=>{var os;const co=extractParagraphText(ei).match(META2D_BLOCK);if(!co)return!1;const xo=((os=co[2])==null?void 0:os.trim())||EMPTY_META2D_DIAGRAM_JSON;return INodeHelper.createTypeNode(Meta2dNode.getType(),{diagram:xo,svg:initialSvgForDiagram(xo)})},1))}},Dh.pluginName="Meta2dPlugin",Dh),GROUP_LOCALE_MAP={Activity:"meta2d.palette.groups.activity",Basic:"meta2d.palette.groups.basic","Fault tree":"meta2d.palette.groups.faultTree",Flow:"meta2d.palette.groups.flow","Sequence & class":"meta2d.palette.groups.sequenceClass"};function itemLabelLocaleKey(Un){return`meta2d.palette.${Un}`}const baseShape={background:"#fff",color:"#1f1f1f",height:60,lineWidth:1,textColor:"#1f1f1f",width:120};function getPalette(){return[{group:"Basic",key:"square",label:"Square",pen:{...baseShape,height:100,name:"square",text:"",width:100}},{group:"Basic",key:"rect",label:"Rectangle",pen:{...baseShape,name:"rectangle",text:"Rectangle"}},{group:"Basic",key:"roundRect",label:"Rounded",pen:{...baseShape,borderRadius:.2,name:"rectangle",text:"Rounded"}},{group:"Basic",key:"circle",label:"Circle",pen:{...baseShape,height:80,name:"circle",text:"Circle",width:80}},{group:"Basic",key:"triangle",label:"Triangle",pen:{...baseShape,height:90,name:"triangle",text:"Triangle",width:100}},{group:"Basic",key:"diamond",label:"Diamond",pen:{...baseShape,height:100,name:"diamond",text:"Decision",width:100}},{group:"Basic",key:"pentagon",label:"Pentagon",pen:{...baseShape,height:100,name:"pentagon",text:"Pentagon",width:100}},{group:"Basic",key:"hexagon",label:"Hexagon",pen:{...baseShape,height:100,name:"hexagon",text:"Hexagon",width:100}},{group:"Basic",key:"pentagram",label:"Star",pen:{...baseShape,height:100,name:"pentagram",text:"",width:100}},{group:"Basic",key:"leftArrow",label:"Left arrow",pen:{height:60,name:"leftArrow",width:120}},{group:"Basic",key:"rightArrow",label:"Right arrow",pen:{height:60,name:"rightArrow",width:120}},{group:"Basic",key:"twowayArrow",label:"Two-way",pen:{height:60,name:"twowayArrow",width:150}},{group:"Basic",key:"cloud",label:"Cloud",pen:{height:100,name:"cloud",width:100}},{group:"Basic",key:"message",label:"Message",pen:{height:100,name:"message",textTop:-.1,width:100}},{group:"Basic",key:"file",label:"File",pen:{height:100,name:"file",width:80}},{group:"Basic",key:"cube",label:"Cube",pen:{height:100,name:"cube",width:60,z:.25}},{group:"Basic",key:"people",label:"Actor",pen:{height:100,name:"people",width:70}},{group:"Basic",key:"text",label:"Text",pen:{...baseShape,background:"transparent",color:"transparent",height:32,name:"text",text:"text",width:120}},{group:"Basic",key:"line",label:"Line",pen:{color:"#1f1f1f",height:1,lineWidth:1,name:"line",width:160}},{group:"Flow",key:"flowTerminal",label:"Terminal",pen:{...baseShape,borderRadius:.5,height:40,name:"rectangle",text:"Start / End",width:120}},{group:"Flow",key:"flowProcess",label:"Process",pen:{...baseShape,height:40,name:"rectangle",text:"Process",width:120}},{group:"Flow",key:"flowDecision",label:"Decision",pen:{...baseShape,height:60,name:"diamond",text:"Decision",width:120}},{group:"Flow",key:"flowData",label:"Data",pen:{...baseShape,name:"flowData",offsetX:.14,text:"Data"}},{group:"Flow",key:"flowPrepare",label:"Prepare",pen:{...baseShape,height:50,name:"hexagon",text:"Prepare",width:120}},{group:"Flow",key:"flowSubprocess",label:"Subprocess",pen:{...baseShape,height:50,name:"flowSubprocess",text:"Subprocess",width:120}},{group:"Flow",key:"flowDb",label:"Database",pen:{...baseShape,height:100,name:"flowDb",text:"DB",width:80}},{group:"Flow",key:"flowDocument",label:"Document",pen:{...baseShape,height:100,name:"flowDocument",text:"Document",width:120}},{group:"Flow",key:"flowInternalStorage",label:"Int. storage",pen:{...baseShape,height:80,name:"flowInternalStorage",text:"Internal",width:120}},{group:"Flow",key:"flowExternStorage",label:"Ext. storage",pen:{...baseShape,height:80,name:"flowExternStorage",text:"External",width:120}},{group:"Flow",key:"flowQueue",label:"Queue",pen:{...baseShape,height:100,name:"flowQueue",text:"Queue",width:100}},{group:"Flow",key:"flowManually",label:"Manual input",pen:{...baseShape,height:80,name:"flowManually",text:"Manual",width:120}},{group:"Flow",key:"flowDisplay",label:"Display",pen:{...baseShape,height:80,name:"flowDisplay",text:"Display",width:120}},{group:"Flow",key:"flowParallel",label:"Parallel",pen:{...baseShape,height:50,name:"flowParallel",text:"Parallel",width:120}},{group:"Flow",key:"flowComment",label:"Comment",pen:{...baseShape,height:100,name:"flowComment",text:"Note",width:100}},{group:"Activity",key:"actStart",label:"Start",pen:{background:"#555",height:30,lineWidth:0,name:"circle",text:"",width:30}},{group:"Activity",key:"actFinal",label:"Final",pen:{height:30,name:"activityFinal",width:30}},{group:"Activity",key:"actStep",label:"Action",pen:{...baseShape,borderRadius:.25,height:50,name:"rectangle",text:"Action",width:120}},{group:"Activity",key:"actMerge",label:"Merge",pen:{...baseShape,height:50,name:"diamond",text:"Merge",width:120}},{group:"Activity",key:"swimlaneV",label:"Swimlane V",pen:{height:500,lineTop:.08,name:"swimlaneV",text:"Swimlane",textBaseline:"top",textTop:20,width:200}},{group:"Activity",key:"swimlaneH",label:"Swimlane H",pen:{height:200,lineLeft:.08,name:"swimlaneH",text:"Swimlane",textAlign:"left",textLeft:.04,textWidth:.01,width:500}},{group:"Activity",key:"forkV",label:"Fork V",pen:{fillStyle:"#555",height:150,name:"forkV",strokeStyle:"transparent",text:"",width:10}},{group:"Activity",key:"forkH",label:"Fork H",pen:{fillStyle:"#555",height:10,name:"forkH",strokeStyle:"transparent",text:"",width:150}},{group:"Sequence & class",key:"lifeline",label:"Lifeline",pen:{height:400,name:"lifeline",text:"Object",textHeight:50,width:150}},{group:"Sequence & class",key:"sequenceFocus",label:"Activation",pen:{height:200,name:"sequenceFocus",text:"",width:12}},{group:"Sequence & class",key:"simpleClass",label:"Simple class",pen:{height:200,list:[{text:`- name: string
|
|
5832
5852
|
+ setName(name: string): void`}],name:"simpleClass",text:"ClassName",textAlign:"center",textBaseline:"top",textHeight:200,textTop:10,width:270}},{group:"Sequence & class",key:"interfaceClass",label:"Class",pen:{height:200,list:[{text:"- name: string"},{text:"+ setName(name: string): void"}],name:"interfaceClass",text:"ClassName",textAlign:"center",textBaseline:"top",textHeight:200,textTop:10,width:270}},{group:"Fault tree",key:"andGate",label:"AND gate",pen:{height:150,name:"andGate",width:100}},{group:"Fault tree",key:"orGate",label:"OR gate",pen:{height:150,name:"orGate",width:100}},{group:"Fault tree",key:"basicEvent",label:"Basic event",pen:{height:150,name:"basicEvent",width:100}},{group:"Fault tree",key:"xorGate",label:"XOR gate",pen:{height:150,name:"xorGate",width:100}},{group:"Fault tree",key:"votingGate",label:"Voting gate",pen:{height:150,name:"votingGate",width:100}}]}function clonePen(Un){return normalizeMeta2dPen(structuredClone(Un))}function groupPalette(Un){const Pn=new Map;for(const ei of Un){const co=Pn.get(ei.group)??[];co.push(ei),Pn.set(ei.group,co)}return Array.from(Pn.entries())}function ShapePreview({name:Un}){const Pn={fill:"#fff",stroke:"#1f1f1f",strokeWidth:1.2};return Un==="circle"?jsxRuntimeExports.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:jsxRuntimeExports.jsx("circle",{cx:"14",cy:"14",r:"10",...Pn})}):Un==="diamond"?jsxRuntimeExports.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:jsxRuntimeExports.jsx("polygon",{points:"14,3 25,14 14,25 3,14",...Pn})}):Un==="triangle"?jsxRuntimeExports.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:jsxRuntimeExports.jsx("polygon",{points:"14,4 25,24 3,24",...Pn})}):Un==="pentagon"?jsxRuntimeExports.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:jsxRuntimeExports.jsx("polygon",{points:"14,3 25,12 21,25 7,25 3,12",...Pn})}):Un==="hexagon"?jsxRuntimeExports.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:jsxRuntimeExports.jsx("polygon",{points:"8,4 20,4 25,14 20,24 8,24 3,14",...Pn})}):Un==="pentagram"?jsxRuntimeExports.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:jsxRuntimeExports.jsx("polygon",{points:"14,3 17,11 26,11 18,16 21,25 14,20 7,25 10,16 2,11 11,11",...Pn})}):Un==="line"?jsxRuntimeExports.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:jsxRuntimeExports.jsx("line",{x1:"4",x2:"24",y1:"14",y2:"14",...Pn})}):Un==="text"?jsxRuntimeExports.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:jsxRuntimeExports.jsx("text",{dominantBaseline:"middle",fill:"#1f1f1f",fontSize:"14",textAnchor:"middle",x:"14",y:"15",children:"T"})}):jsxRuntimeExports.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:jsxRuntimeExports.jsx("rect",{height:"14",rx:"2",width:"20",x:"4",y:"7",...Pn})})}function PaletteTile({disabled:Un,engineRef:Pn,item:ei,t:co}){const xo=()=>{const os=Pn.current;if(!(!os||Un))try{os.canvas.addCaches=[clonePen(ei.pen)]}catch{}};return jsxRuntimeExports.jsxs("div",{draggable:!Un,onClick:os=>{os.stopPropagation(),xo()},onDragStart:os=>{if(Un){os.preventDefault();return}const hs=JSON.stringify(clonePen(ei.pen));os.dataTransfer.setData("Meta2d",hs),os.dataTransfer.setData("Text",hs),os.dataTransfer.effectAllowed="copy"},onKeyDown:os=>{(os.key==="Enter"||os.key===" ")&&(os.preventDefault(),xo())},role:"button",style:{alignItems:"center",border:"1px solid #efefef",borderRadius:6,cursor:Un?"not-allowed":"grab",display:"flex",flexDirection:"column",gap:4,justifyContent:"center",minHeight:56,opacity:Un?.5:1,outline:"none",padding:6},tabIndex:Un?-1:0,title:`${co(itemLabelLocaleKey(ei.key))||ei.label} — drag or click to add`,children:[jsxRuntimeExports.jsx(ShapePreview,{name:String(ei.pen.name??"rectangle")}),jsxRuntimeExports.jsx("span",{style:{fontSize:11},children:co(itemLabelLocaleKey(ei.key))||ei.label})]})}function DiagramPalette({disabled:Un,engineRef:Pn}){const{t:ei}=useEditorLocale(),co=reactExports.useMemo(()=>groupPalette(getPalette()),[]);return jsxRuntimeExports.jsxs("aside",{style:{borderRight:"1px solid #f0f0f0",flexShrink:0,maxHeight:"100%",overflowX:"hidden",overflowY:"auto",overscrollBehavior:"contain",padding:12,touchAction:"pan-y",width:240},children:[jsxRuntimeExports.jsx("div",{style:{fontSize:13,fontWeight:600,marginBottom:4},children:ei("meta2d.palette.title")}),jsxRuntimeExports.jsx("div",{style:{color:"#8c8c8c",fontSize:12,marginBottom:12},children:ei("meta2d.palette.hint")}),co.map(([xo,os])=>jsxRuntimeExports.jsxs("div",{style:{marginBottom:12},children:[jsxRuntimeExports.jsx("div",{style:{color:"#8c8c8c",fontSize:12,marginBottom:6},children:ei(GROUP_LOCALE_MAP[xo]||xo)}),jsxRuntimeExports.jsx("div",{style:{display:"grid",gap:8,gridTemplateColumns:"repeat(2, minmax(0, 1fr))"},children:os.map(hs=>jsxRuntimeExports.jsx(PaletteTile,{disabled:Un,engineRef:Pn,item:hs,t:ei},hs.key))})]},xo))]})}const panelStyle={borderLeft:"1px solid #f0f0f0",flexShrink:0,maxHeight:"100%",overflowX:"hidden",overflowY:"auto",overscrollBehavior:"contain",touchAction:"pan-y",width:220},labelStyle={color:"#8c8c8c",fontSize:12,marginBottom:4},sectionStyle={borderBottom:"1px solid #f0f0f0",padding:"10px 12px"},rowStyle={alignItems:"center",display:"flex",gap:6,marginBottom:6},inputStyle={background:"#fafafa",border:"1px solid #e5e5e5",borderRadius:4,fontSize:12,height:28,outline:"none",padding:"0 6px"},fieldLabel={color:"#8c8c8c",fontSize:11,minWidth:22},layerBtn={background:"#fff",border:"1px solid #d9d9d9",borderRadius:4,cursor:"pointer",fontSize:11,minWidth:48,padding:"4px 8px"};function PenProps({engine:Un}){const{t:Pn}=useEditorLocale(),[ei,co]=reactExports.useState(null),[xo,os]=reactExports.useState(null),hs=reactExports.useRef({}),Ms=reactExports.useCallback(ia=>{if(!ia||ia.length!==1){co(null),os(null);return}const oa=ia[0];if((oa.globalAlpha===null||oa.globalAlpha===void 0)&&(oa.globalAlpha=1),co(oa),Un)try{os(Un.getPenRect(oa))}catch{os(null)}},[Un]),ea=reactExports.useCallback(()=>{co(null),os(null)},[]);if(reactExports.useEffect(()=>{if(Un)return Un.on("active",Ms),Un.on("inactive",ea),()=>{Un.off("active",Ms),Un.off("inactive",ea)}},[Un,Ms,ea]),!ei||!Un)return jsxRuntimeExports.jsx("aside",{style:panelStyle,children:jsxRuntimeExports.jsx("div",{style:{color:"#bbb",fontSize:12,padding:16,textAlign:"center"},children:Pn("meta2d.props.empty")})});const ta=(ia,oa)=>{hs.current[ia]=oa;const sa={id:ei.id};sa[ia]=oa,ia==="dash"&&(sa.lineDash=[void 0,[5,5]][oa]),Un.setValue(sa,{render:!0})},ra=(ia,oa)=>{if(!xo)return;const sa={id:ei.id};sa[ia]=oa,Un.setValue(sa,{render:!0}),os(aa=>aa?{...aa,[ia]:oa}:null)},na=ia=>{ia(Un),Un.render(!0)};return jsxRuntimeExports.jsxs("aside",{style:panelStyle,children:[jsxRuntimeExports.jsxs("div",{style:sectionStyle,children:[jsxRuntimeExports.jsx("div",{style:labelStyle,children:Pn("meta2d.props.text")}),jsxRuntimeExports.jsx("div",{style:rowStyle,children:jsxRuntimeExports.jsx("input",{onChange:ia=>ta("text",ia.target.value),style:inputStyle,type:"text",value:ei.text??""})})]}),jsxRuntimeExports.jsxs("div",{style:sectionStyle,children:[jsxRuntimeExports.jsx("div",{style:{...labelStyle,marginBottom:6},children:Pn("meta2d.props.appearance")}),jsxRuntimeExports.jsxs("div",{style:rowStyle,children:[jsxRuntimeExports.jsx("span",{style:fieldLabel,children:Pn("meta2d.props.color")}),jsxRuntimeExports.jsx("input",{onChange:ia=>ta("color",ia.target.value),style:{...inputStyle,flex:1},type:"color",value:ei.color||"#1f1f1f"})]}),jsxRuntimeExports.jsxs("div",{style:rowStyle,children:[jsxRuntimeExports.jsx("span",{style:fieldLabel,children:Pn("meta2d.props.bg")}),jsxRuntimeExports.jsx("input",{onChange:ia=>ta("background",ia.target.value),style:{...inputStyle,flex:1},type:"color",value:ei.background||"#ffffff"})]}),jsxRuntimeExports.jsxs("div",{style:rowStyle,children:[jsxRuntimeExports.jsx("span",{style:fieldLabel,children:Pn("meta2d.props.dash")}),jsxRuntimeExports.jsxs("select",{onChange:ia=>ta("dash",Number(ia.target.value)),style:{...inputStyle,flex:1},value:String(ei.dash??0),children:[jsxRuntimeExports.jsx("option",{value:"0",children:Pn("meta2d.props.solid")}),jsxRuntimeExports.jsx("option",{value:"1",children:Pn("meta2d.props.dashLine")})]})]}),jsxRuntimeExports.jsxs("div",{style:rowStyle,children:[jsxRuntimeExports.jsx("span",{style:fieldLabel,children:Pn("meta2d.props.radius")}),jsxRuntimeExports.jsx("input",{max:1,min:0,onChange:ia=>ta("borderRadius",Number(ia.target.value)),step:.01,style:{...inputStyle,flex:1},type:"range",value:String(ei.borderRadius??0)}),jsxRuntimeExports.jsx("span",{style:{color:"#8c8c8c",fontSize:11,width:32},children:ei.borderRadius??0})]}),jsxRuntimeExports.jsxs("div",{style:rowStyle,children:[jsxRuntimeExports.jsx("span",{style:fieldLabel,children:Pn("meta2d.props.alpha")}),jsxRuntimeExports.jsx("input",{max:1,min:0,onChange:ia=>ta("globalAlpha",Number(ia.target.value)),step:.01,style:{...inputStyle,flex:1},type:"range",value:String(ei.globalAlpha??1)}),jsxRuntimeExports.jsx("span",{style:{color:"#8c8c8c",fontSize:11,width:32},children:(ei.globalAlpha??1).toFixed(2)})]})]}),jsxRuntimeExports.jsxs("div",{style:sectionStyle,children:[jsxRuntimeExports.jsx("div",{style:{...labelStyle,marginBottom:6},children:Pn("meta2d.props.position")}),[["X","x"],["Y","y"],["W","width"],["H","height"]].map(([ia,oa])=>jsxRuntimeExports.jsxs("div",{style:rowStyle,children:[jsxRuntimeExports.jsx("span",{style:fieldLabel,children:ia}),jsxRuntimeExports.jsx("input",{onChange:sa=>ra(oa,Number(sa.target.value)),style:{...inputStyle,flex:1},type:"number",value:xo?xo[oa]:0})]},oa))]}),jsxRuntimeExports.jsxs("div",{style:sectionStyle,children:[jsxRuntimeExports.jsx("div",{style:{...labelStyle,marginBottom:6},children:Pn("meta2d.props.textAlign")}),jsxRuntimeExports.jsxs("div",{style:rowStyle,children:[jsxRuntimeExports.jsx("span",{style:fieldLabel,children:Pn("meta2d.props.h")}),jsxRuntimeExports.jsxs("select",{onChange:ia=>ta("textAlign",ia.target.value),style:{...inputStyle,flex:1},value:ei.textAlign||"center",children:[jsxRuntimeExports.jsx("option",{value:"left",children:Pn("meta2d.props.left")}),jsxRuntimeExports.jsx("option",{value:"center",children:Pn("meta2d.props.center")}),jsxRuntimeExports.jsx("option",{value:"right",children:Pn("meta2d.props.right")})]})]}),jsxRuntimeExports.jsxs("div",{style:rowStyle,children:[jsxRuntimeExports.jsx("span",{style:fieldLabel,children:Pn("meta2d.props.v")}),jsxRuntimeExports.jsxs("select",{onChange:ia=>ta("textBaseline",ia.target.value),style:{...inputStyle,flex:1},value:ei.textBaseline||"middle",children:[jsxRuntimeExports.jsx("option",{value:"top",children:Pn("meta2d.props.topAlign")}),jsxRuntimeExports.jsx("option",{value:"middle",children:Pn("meta2d.props.middle")}),jsxRuntimeExports.jsx("option",{value:"bottom",children:Pn("meta2d.props.bottomAlign")})]})]})]}),jsxRuntimeExports.jsxs("div",{style:sectionStyle,children:[jsxRuntimeExports.jsx("div",{style:{...labelStyle,marginBottom:6},children:Pn("meta2d.props.layer")}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[jsxRuntimeExports.jsx("button",{onClick:()=>na(ia=>ia.top()),style:layerBtn,type:"button",children:Pn("meta2d.props.top")}),jsxRuntimeExports.jsx("button",{onClick:()=>na(ia=>ia.up()),style:layerBtn,type:"button",children:Pn("meta2d.props.up")}),jsxRuntimeExports.jsx("button",{onClick:()=>na(ia=>ia.down()),style:layerBtn,type:"button",children:Pn("meta2d.props.down")}),jsxRuntimeExports.jsx("button",{onClick:()=>na(ia=>ia.bottom()),style:layerBtn,type:"button",children:Pn("meta2d.props.bottom")})]})]})]})}const buttonStyle={background:"#fff",border:"1px solid #d9d9d9",borderRadius:6,cursor:"pointer",minWidth:68,padding:"6px 12px"},toolBtnStyle={...buttonStyle,fontSize:12,minWidth:52,padding:"4px 10px"};function useBodyScrollLock(Un){reactExports.useEffect(()=>{const Pn=document.documentElement,ei=document.body,co=Pn.style.overflow,xo=ei.style.overflow;return Pn.style.overflow="hidden",ei.style.overflow="hidden",()=>{Pn.style.overflow=co,ei.style.overflow=xo}},[Un])}function DiagramEditor({diagram:Un,onClose:Pn,onSave:ei}){const{t:co}=useEditorLocale(),xo=reactExports.useRef(null),os=reactExports.useRef(null),hs=reactExports.useRef(Un),Ms=reactExports.useRef(Pn),[ea,ta]=reactExports.useState(null),[ra,na]=reactExports.useState(!1);useBodyScrollLock(!0),reactExports.useLayoutEffect(()=>{Ms.current=Pn}),reactExports.useEffect(()=>{if(!xo.current)return;ensureMeta2dShapes();const sa=new Meta2d(xo.current,{grid:!0,rule:!1});os.current=sa,ta(sa);try{const la=hs.current;la!=null&&la.trim()?sa.open(JSON.parse(la)):sa.open(createEmptyMeta2dData()),normalizeMeta2dData(sa.data()),sa.render(!0)}catch{sa.open(createEmptyMeta2dData()),normalizeMeta2dData(sa.data()),sa.render(!0)}const aa=la=>{la.key==="Escape"&&Ms.current()};return window.addEventListener("keydown",aa),()=>{window.removeEventListener("keydown",aa);try{sa.destroy()}catch{}os.current=null}},[]);const ia=async()=>{const sa=os.current;if(sa){na(!0);try{normalizeMeta2dData(sa.data()),sa.render(!0);const aa=sanitizeMeta2dData(sa.data()),la=JSON.stringify(aa);ei(la,await generateSvgFromMeta2d(sa)||await generateSvgFromDiagram(la)||'<svg xmlns="http://www.w3.org/2000/svg" width="320" height="180" viewBox="0 0 320 180"><rect width="100%" height="100%" fill="#fafafa" stroke="#eee"/></svg>')}finally{na(!1)}}},oa=sa=>{const aa=os.current;aa&&sa(aa)};return jsxRuntimeExports.jsx("div",{onClick:Pn,style:{alignItems:"center",background:"rgb(0 0 0 / 35%)",display:"flex",inset:0,justifyContent:"center",overflow:"hidden",position:"fixed",zIndex:1e3},children:jsxRuntimeExports.jsxs("div",{onClick:sa=>sa.stopPropagation(),onWheel:sa=>sa.stopPropagation(),style:{background:"#fff",borderRadius:10,boxShadow:"0 12px 30px rgb(0 0 0 / 20%)",display:"flex",flexDirection:"column",height:"86vh",maxHeight:"100%",maxWidth:"1200px",overflow:"hidden",width:"92vw"},children:[jsxRuntimeExports.jsxs("div",{style:{alignItems:"center",borderBottom:"1px solid #f0f0f0",display:"flex",flexWrap:"wrap",gap:8,justifyContent:"space-between",padding:"10px 14px"},children:[jsxRuntimeExports.jsx("span",{style:{fontWeight:600},children:co("meta2d.editor.title")}),jsxRuntimeExports.jsxs("div",{style:{alignItems:"center",display:"flex",flexWrap:"wrap",gap:8},children:[jsxRuntimeExports.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[jsxRuntimeExports.jsx("button",{onClick:()=>oa(sa=>sa.undo()),style:toolBtnStyle,title:`${co("meta2d.editor.undo")} (Ctrl+Z)`,type:"button",children:co("meta2d.editor.undo")}),jsxRuntimeExports.jsx("button",{onClick:()=>oa(sa=>sa.redo()),style:toolBtnStyle,title:`${co("meta2d.editor.redo")} (Ctrl+Y)`,type:"button",children:co("meta2d.editor.redo")}),jsxRuntimeExports.jsx("button",{onClick:()=>oa(sa=>sa.delete()),style:toolBtnStyle,title:co("meta2d.editor.delete"),type:"button",children:co("meta2d.editor.delete")}),jsxRuntimeExports.jsx("button",{onClick:()=>oa(sa=>sa.fitView(!0)),style:toolBtnStyle,title:co("meta2d.editor.fit"),type:"button",children:co("meta2d.editor.fit")}),jsxRuntimeExports.jsx("button",{onClick:()=>oa(sa=>{sa.scale(1),sa.centerView()}),style:toolBtnStyle,title:co("meta2d.editor.zoom100"),type:"button",children:co("meta2d.editor.zoom100")})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:8},children:[jsxRuntimeExports.jsx("button",{onClick:Pn,style:buttonStyle,type:"button",children:co("meta2d.editor.close")}),jsxRuntimeExports.jsx("button",{disabled:ra,onClick:()=>void ia(),style:{...buttonStyle,background:"#1677ff",border:"none",color:"#fff"},type:"button",children:co(ra?"meta2d.editor.saving":"meta2d.editor.save")})]})]})]}),jsxRuntimeExports.jsxs("div",{style:{display:"flex",flex:1,minHeight:0,overflow:"hidden"},children:[jsxRuntimeExports.jsx(DiagramPalette,{engineRef:os}),jsxRuntimeExports.jsx("div",{ref:xo,style:{flex:1,minHeight:0,minWidth:0}}),jsxRuntimeExports.jsx(PenProps,{engine:ea})]})]})})}function injectPreviewSvgLayout(Un){const Pn=Un.trimStart();return Pn.startsWith("<svg")?Pn.replace(/^<svg\b/,'<svg style="max-width:100%;height:auto;display:block;margin:0 auto" '):Un}function HudButton({color:Un,label:Pn,onClick:ei,title:co}){return jsxRuntimeExports.jsx("button",{onClick:xo=>{xo.preventDefault(),xo.stopPropagation(),ei()},style:{alignItems:"center",background:"#fff",border:"1px solid #e5e5e5",borderRadius:6,color:Un,cursor:"pointer",display:"inline-flex",height:28,justifyContent:"center",width:28},title:co,type:"button",children:Pn})}function DiagramPreviewInner({diagram:Un,onDelete:Pn,onEdit:ei,onSvgReady:co,svg:xo}){const[os,hs]=reactExports.useState(!1),[Ms,ea]=reactExports.useState(null),[ta,ra]=reactExports.useState(!1),[na,ia]=reactExports.useState(!1),oa=reactExports.useRef(null);return reactExports.useEffect(()=>{ea(null),ia(!1)},[Un]),reactExports.useEffect(()=>{if(!Un||na||os)return;if(xo){oa.current=Un;return}let sa=!0;const aa=window.setTimeout(()=>{sa&&(ea("Preview timeout (still loading). Double-click to open editor."),ia(!0),hs(!1))},5e3);return hs(!0),generateSvgFromDiagram(Un).then(la=>{if(sa){if(window.clearTimeout(aa),la){oa.current=Un,co(la);return}ea("Preview generation failed. Double-click to open editor."),ia(!0)}}).finally(()=>{sa&&hs(!1)}),()=>{sa=!1,window.clearTimeout(aa)}},[Un,na,co,xo]),jsxRuntimeExports.jsxs("div",{onDoubleClick:sa=>{sa.stopPropagation(),ei()},onMouseEnter:()=>ra(!0),onMouseLeave:()=>ra(!1),style:{background:"#fff",border:"1px solid #efefef",borderRadius:10,cursor:"pointer",minHeight:140,overflow:"hidden",padding:10,position:"relative"},children:[ta&&!!xo&&jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:8,position:"absolute",right:10,top:10,zIndex:1},children:[jsxRuntimeExports.jsx(HudButton,{color:"#1677ff",label:"✎",onClick:ei,title:"Edit diagram"}),jsxRuntimeExports.jsx(HudButton,{color:"#ff4d4f",label:"🗑",onClick:Pn,title:"Delete diagram"})]}),xo?jsxRuntimeExports.jsx("div",{style:{alignItems:"center",display:"flex",justifyContent:"center",maxHeight:400,overflow:"auto",width:"100%"},children:jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:injectPreviewSvgLayout(xo)},style:{lineHeight:0,maxWidth:"100%",width:"100%"}})}):jsxRuntimeExports.jsx("div",{style:{alignItems:"center",color:Ms?"#cf1322":"#999",display:"flex",justifyContent:"center",minHeight:120,textAlign:"center"},children:os?"Generating preview...":Ms||"Double-click to edit diagram"})]})}const DiagramPreview=reactExports.memo(DiagramPreviewInner);function Meta2dDecorator({className:Un,editor:Pn,node:ei}){const[co,xo]=reactExports.useState(!1),os=ei.__diagram,hs=ei.__svg;reactExports.useLayoutEffect(()=>{const ta=ei.getKey();let ra=!1;Pn.getEditorState().read(()=>{const na=Po(ta);na&&$isMeta2dNode(na)&&na.__autoOpenEditor&&(ra=!0)}),ra&&xo(!0),ra&&Pn.update(()=>{const na=Po(ta);na&&$isMeta2dNode(na)&&na.__autoOpenEditor&&na.clearAutoOpenEditor()})},[Pn,ei.getKey()]);const Ms=reactExports.useCallback(()=>{Pn.update(()=>{const ta=ei.getLatest(),ra=ta.getNextSibling(),na=ta.getPreviousSibling();if(ta.remove(),ra){ra.selectStart();return}na&&na.selectEnd()})},[Pn,ei]),ea=reactExports.useCallback((ta,ra)=>{Pn.update(()=>{ei.updateDiagram(ta,ra)}),xo(!1)},[Pn,ei]);return jsxRuntimeExports.jsxs("div",{className:Un,style:{margin:0},children:[jsxRuntimeExports.jsx(DiagramPreview,{diagram:os,onDelete:Ms,onEdit:()=>xo(!0),onSvgReady:reactExports.useCallback(ta=>{Pn.update(()=>{ei.updateDiagram(ei.__diagram,ta)})},[Pn,ei]),svg:hs}),co&&jsxRuntimeExports.jsx(DiagramEditor,{diagram:os,onClose:()=>xo(!1),onSave:ea})]})}function ReactMeta2dPlugin({className:Un,theme:Pn}){const[ei]=useLexicalComposerContext(),co=reactExports.useCallback((xo,os)=>jsxRuntimeExports.jsx(Meta2dDecorator,{className:Un,editor:os,node:xo}),[Un]);return reactExports.useLayoutEffect(()=>{ei.registerPlugin(Meta2dPlugin,{decorator:co,theme:Pn})},[co,ei,Pn]),null}const OutlineVisibilityContext=reactExports.createContext(null),OutlineProvider=({children:Un,defaultVisible:Pn=!0})=>{const[ei,co]=reactExports.useState(Pn),xo=reactExports.useCallback(()=>co(hs=>!hs),[]),os=reactExports.useMemo(()=>({setVisible:co,toggle:xo,visible:ei}),[xo,ei]);return jsxRuntimeExports.jsx(OutlineVisibilityContext.Provider,{value:os,children:Un})};OutlineProvider.displayName="OutlineProvider";function useOutlineVisibilityContext(){return reactExports.useContext(OutlineVisibilityContext)}function useOutlineVisibility(){const Un=useOutlineVisibilityContext();if(!Un)throw new Error("useOutlineVisibility must be used within <OutlineProvider>.");return Un}function useOutlineVisibilityToggle(Un){const Pn=useOutlineVisibilityContext(),ei=(Un==null?void 0:Un.visible)!==void 0&&(Un==null?void 0:Un.onVisibleChange)!==void 0;return reactExports.useMemo(()=>ei&&(Un!=null&&Un.onVisibleChange)?{ready:!0,toggle:()=>Un.onVisibleChange(!Un.visible),visible:Un.visible}:Pn?{ready:!0,toggle:Pn.toggle,visible:Pn.visible}:{ready:!1},[Un==null?void 0:Un.onVisibleChange,Un==null?void 0:Un.visible,Pn,ei])}init_utils();const OutlinePanel=({editor:Un,visible:Pn})=>{const ei=useOutlineVisibilityContext(),co=reactExports.useMemo(()=>Pn!==void 0?Pn:(ei==null?void 0:ei.visible)??!0,[Pn,ei==null?void 0:ei.visible]),[xo,os]=reactExports.useState([]),hs=reactExports.useCallback(()=>{const ea=[],ta=zo(),ra=na=>{for(const ia of na){if(It$1(ia)){const oa=ia.getTextContent().trim();oa&&ea.push({key:ia.getKey(),level:parseInt(ia.getTag()[1],10),text:oa})}if(Pi(ia)){const oa=ia.getChildren();oa.length>0&&ra(oa)}}};ra(ta.getChildren()),os(ea)},[]);reactExports.useEffect(()=>{const ea=Un.getLexicalEditor();let ta=noop$4;const ra=na=>(ta=na.registerUpdateListener(({editorState:ia})=>{ia.read(hs)}),na.getEditorState().read(hs),ta);return ea?ra(ea):(Un.on("initialized",ra),()=>{ta(),Un.off("initialized",ra)})},[Un,hs]);const Ms=reactExports.useCallback(ea=>{const ta=Un.getLexicalEditor();ta&&(ta.update(()=>{const ra=Jr();ra.add(ea),Bo(ra)}),requestAnimationFrame(()=>{const ra=ta.getElementByKey(ea);ra&&ra.scrollIntoView({behavior:"smooth",block:"center"})}))},[Un]);return!co||xo.length===0?null:jsxRuntimeExports.jsxs("div",{style:{borderLeft:"1px solid rgba(0, 0, 0, 0.08)",paddingLeft:12},children:[jsxRuntimeExports.jsx("div",{style:{color:"rgba(0,0,0,0.45)",fontSize:12,fontWeight:600,marginBottom:8},children:"OUTLINE"}),xo.map(ea=>jsxRuntimeExports.jsx("div",{onClick:()=>Ms(ea.key),onMouseEnter:ta=>{ta.currentTarget.style.background="rgba(0,0,0,0.04)"},onMouseLeave:ta=>{ta.currentTarget.style.background="transparent"},style:{borderRadius:4,color:"rgba(0,0,0,0.75)",cursor:"pointer",fontSize:13,lineHeight:"28px",overflow:"hidden",paddingLeft:(ea.level-1)*16+8,textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ea.text},ea.key))]})},defaultCollapseTitle="Hide outline",defaultExpandTitle="Show outline",outlineActionKey="outline";function useOutlineActionItem(Un){const{collapseTitle:Pn=defaultCollapseTitle,expandTitle:ei=defaultExpandTitle,onVisibleChange:co,visible:xo}=Un??{},os=useOutlineVisibilityToggle(xo!==void 0&&co!==void 0?{onVisibleChange:co,visible:xo}:void 0);return reactExports.useMemo(()=>{if(!os.ready)return null;const{toggle:hs,visible:Ms}=os;return{active:Ms,icon:Ms?PanelRightClose:ListTree,key:outlineActionKey,label:Ms?Pn:ei,onClick:hs}},[Pn,ei,os])}init_utils();function $forEachTableCell(Un,Pn){const{domRows:ei}=Un;for(const[co,xo]of ei.entries())if(xo)for(const[os,hs]of xo.entries()){if(!hs)continue;const Ms=Lo(hs.elem);Ms!==null&&Pn(hs,Ms,{x:os,y:co})}}function $addHighlightToDOM(Un,Pn){const ei=Pn.elem,co=Un._config.theme;assert($e$1(Lo(ei)),"Expected to find LexicalNode from Table Cell DOMNode"),ec(ei,co.tableCellSelected)}function $removeHighlightFromDOM(Un,Pn){const ei=Pn.elem;assert($e$1(Lo(ei)),"Expected to find LexicalNode from Table Cell DOMNode");const co=Un._config.theme;nc(ei,co.tableCellSelected)}function $updateDOMForSelection(Un,Pn,ei){const co=new Set(ei?ei.getNodes():[]);$forEachTableCell(Pn,(xo,os)=>{const hs=xo.elem;co.has(os)?(xo.highlighted=!0,$addHighlightToDOM(Un,xo)):(xo.highlighted=!1,$removeHighlightFromDOM(Un,xo),hs.getAttribute("style")||hs.removeAttribute("style"))})}function computeSelectionCount(Un){const Pn=Un.getShape();return{columns:Pn.toX-Pn.fromX+1,rows:Pn.toY-Pn.fromY+1}}function $canUnmerge(){const Un=$r();if(wr(Un)&&!Un.isCollapsed()||Rt$1(Un)&&!Un.anchor.is(Un.focus)||!wr(Un)&&!Rt$1(Un))return!1;const[Pn]=bt$2(Un.anchor);return Pn.__colSpan>1||Pn.__rowSpan>1}function $selectLastDescendant(Un){const Pn=Un.getLastDescendant();yr(Pn)?Pn.select():Pi(Pn)?Pn.selectEnd():Pn!==null&&Pn.selectNext()}function currentCellBackgroundColor(Un){return Un.getEditorState().read(()=>{const Pn=$r();if(wr(Pn)||Rt$1(Pn)){const[ei]=bt$2(Pn.anchor);if($e$1(ei))return ei.getBackgroundColor()}return null})}const TableActionMenu$1=reactExports.memo(({editor:Un,tableCellNode:Pn,cellMerge:ei,children:co})=>{const[xo,os]=reactExports.useState(Pn),[hs,Ms]=reactExports.useState({columns:1,rows:1}),[ea,ta]=reactExports.useState(!1),[ra,na]=reactExports.useState(!1),[,ia]=reactExports.useState(()=>currentCellBackgroundColor(Un)||""),oa=useTranslation();reactExports.useEffect(()=>Un.registerMutationListener(Ke$1,ga=>{ga.get(xo.getKey())==="updated"&&(Un.getEditorState().read(()=>{os(xo.getLatest())}),ia(currentCellBackgroundColor(Un)||""))},{skipInitialization:!0}),[Un,xo]),reactExports.useEffect(()=>{Un.getEditorState().read(()=>{const ga=$r();if(Rt$1(ga)){const xa=computeSelectionCount(ga);Ms(computeSelectionCount(ga)),ta(xa.columns>1||xa.rows>1)}na($canUnmerge())})},[Un]);const sa=reactExports.useCallback(()=>{Un.update(()=>{if(xo.isAttached()){const ga=qe$1(xo),xa=zt$1(ga,Un.getElementByKey(ga.getKey()));if(xa===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");const va=Xt$1(xa);va!==null&&va.$clearHighlight(),ga.markDirty(),os(xo.getLatest())}Bo(null)})},[Un,xo]),aa=()=>{Un.update(()=>{const ga=$r();if(!Rt$1(ga))return;const xa=mt(ga.getNodes().filter($e$1));xa&&$selectLastDescendant(xa)})},la=()=>{Un.update(()=>{Ct$2()})},ca=reactExports.useCallback(ga=>{Un.update(()=>{for(let xa=0;xa<hs.rows;xa++)tt$2(ga)})},[Un,hs.rows]),ua=reactExports.useCallback(ga=>{Un.update(()=>{for(let xa=0;xa<hs.columns;xa++)lt(ga)})},[Un,hs.columns]),da=reactExports.useCallback(()=>{Un.update(()=>{at$1()})},[Un]),ha=reactExports.useCallback(()=>{Un.update(()=>{qe$1(xo).remove(),sa()})},[Un,xo,sa]),fa=reactExports.useCallback(()=>{Un.update(()=>{ht$1()})},[Un]),pa=reactExports.useCallback(()=>{Un.update(()=>{const ga=qe$1(xo),xa=je$1(xo),[va]=wt$2(ga,null,null),ya=new Set,Ca=xo.getHeaderStyles()^Ae$1.ROW;for(let wa=0;wa<va[xa].length;wa++){const Ea=va[xa][wa];Ea!=null&&Ea.cell&&(ya.has(Ea.cell)||(ya.add(Ea.cell),Ea.cell.setHeaderStyles(Ca,Ae$1.ROW)))}sa()})},[Un,xo,sa]),ma=reactExports.useCallback(()=>{Un.update(()=>{const ga=qe$1(xo),xa=Ve$1(xo),[va]=wt$2(ga,null,null),ya=new Set,Ca=xo.getHeaderStyles()^Ae$1.COLUMN;for(const wa of va){const Ea=wa[xa];Ea!=null&&Ea.cell&&(ya.has(Ea.cell)||(ya.add(Ea.cell),Ea.cell.setHeaderStyles(Ca,Ae$1.COLUMN)))}sa()})},[Un,xo,sa]);return jsxRuntimeExports.jsx(Dropdown$1,{menu:{items:reactExports.useMemo(()=>[{icon:PanelTopClose,key:"table-insert-row-above",label:oa("table.insertRowAbove",{count:hs.rows}),onClick:()=>ca(!1)},{icon:PanelBottomClose,key:"table-insert-row-below",label:oa("table.insertRowBelow",{count:hs.rows}),onClick:()=>ca(!0)},{type:"divider"},{icon:PanelLeftClose,key:"table-insert-column-before",label:oa("table.insertColumnLeft",{count:hs.columns}),onClick:()=>ua(!1)},{icon:PanelRightClose,key:"table-insert-column-after",label:oa("table.insertColumnRight",{count:hs.columns}),onClick:()=>ua(!0)},{type:"divider"},{icon:TableColumnsSplit,key:"table-delete-columns",label:oa("table.deleteColumn"),onClick:()=>fa()},{icon:TableRowsSplit,key:"table-delete-rows",label:oa("table.deleteRow"),onClick:()=>da()},{type:"divider"},{icon:Grid2x2X,key:"table-delete",label:oa("table.delete"),onClick:()=>ha()}],[ei,ea,ra,hs.rows,hs.columns,xo.__headerState,aa,la,ca,ua,fa,da,ha,pa,ma])},children:co})});TableActionMenu$1.displayName="TableActionMenu";const styles$3=createStaticStyles(({css:Un})=>({actionIcon:Un`
|
|
5833
5853
|
transform: translateX(2px);
|
|
5834
5854
|
`,root:Un`
|
|
@@ -6212,8 +6232,8 @@ ${this.__diagram}
|
|
|
6212
6232
|
height: var(--send-button-size, 32px);
|
|
6213
6233
|
padding-inline: 0 !important;
|
|
6214
6234
|
}
|
|
6215
|
-
`}));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())}}].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-NmysnZX7.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
|
|
6216
|
-
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()})}}].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`
|
|
6217
6237
|
<mention>${ia.label}[${((oa=ia.metadata)==null?void 0:oa.id)||ia.label}]</mention>
|
|
6218
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:
|
|
6219
6239
|
|