@tequila99/githuman 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +39 -3
  2. package/dist/server/app.js +1 -0
  3. package/dist/server/db/migrations.js +6 -0
  4. package/dist/server/errors/note-assets.js +3 -0
  5. package/dist/server/repositories/notes-catalog.repo.js +4 -3
  6. package/dist/server/repositories/notes.repo.js +69 -27
  7. package/dist/server/routes/agent.js +1 -0
  8. package/dist/server/routes/notes.js +48 -2
  9. package/dist/server/services/agent/context-builder.js +13 -0
  10. package/dist/server/services/notes-external-assets.service.js +177 -0
  11. package/dist/server/services/notes-identity.service.js +112 -27
  12. package/dist/server/services/notes-operations.service.js +3 -5
  13. package/dist/server/services/notes.service.js +29 -4
  14. package/dist/server/utils/note-asset-format.js +1 -1
  15. package/dist/server/utils/remote-asset-request.js +193 -0
  16. package/dist/server/utils/request-abort.js +20 -0
  17. package/dist/shared/agents/schemas.js +14 -0
  18. package/dist/shared/notes/asset-formats.js +19 -1
  19. package/dist/shared/notes/constants.js +5 -0
  20. package/dist/shared/notes/external-assets.js +153 -0
  21. package/dist/shared/notes/note-path.js +17 -0
  22. package/dist/shared/notes/reference-path.js +2 -1
  23. package/dist/shared/notes/references.js +1 -1
  24. package/dist/shared/notes/schemas.js +60 -2
  25. package/dist/shared/utils/web-url.js +15 -0
  26. package/dist/web/assets/AppPage-DdmqiV2R.js +1 -0
  27. package/dist/web/assets/{ClosePopup-D2_HzWXW.js → ClosePopup-DhjIPp8s.js} +1 -1
  28. package/dist/web/assets/{CreateButton-pmDRGwna.js → CreateButton-BoxoJ7Jr.js} +2 -2
  29. package/dist/web/assets/{CreateReviewFabButton-CcXWnmSN.js → CreateReviewFabButton-CA5OsG7d.js} +1 -1
  30. package/dist/web/assets/IndexPage-CROp8XNF.js +1 -0
  31. package/dist/web/assets/IndexPage-F8MMAAkn.css +1 -0
  32. package/dist/web/assets/{MainLayout-DOGoQ-1m.js → MainLayout-DvfVDB2G.js} +4 -4
  33. package/dist/web/assets/{NoteVisualEditor-CClIKW0X.css → NoteVisualEditor-IH3s3d3W.css} +1 -1
  34. package/dist/web/assets/NoteVisualEditor-VfLNFzsD.js +1054 -0
  35. package/dist/web/assets/NotesPage-D_NiwDh8.js +4 -0
  36. package/dist/web/assets/NotesPage-KaCEnfdz.css +1 -0
  37. package/dist/web/assets/PanelResize-9uljPbE4.js +1 -0
  38. package/dist/web/assets/PanelResize-C51WwwLD.css +1 -0
  39. package/dist/web/assets/{PdfPreview-CdgeqqEv.js → PdfPreview-DgwnGJ2E.js} +1 -1
  40. package/dist/web/assets/{QFab-DyUFgj0W.js → QFab-D1X33Wdk.js} +1 -1
  41. package/dist/web/assets/{QForm-BiRkV9BY.js → QForm-BQMj3m1W.js} +1 -1
  42. package/dist/web/assets/QResizeObserver-D-9MeQ9q.js +1 -0
  43. package/dist/web/assets/{QScrollArea-DfPW35JQ.js → QScrollArea-DlLel0SO.js} +1 -1
  44. package/dist/web/assets/{QSelect-BpZ5KfWP.js → QSelect-mw3iS4Cp.js} +1 -1
  45. package/dist/web/assets/QSpace-BbB0w38T.js +1 -0
  46. package/dist/web/assets/QVirtualScroll-FtQn3PJj.js +1 -0
  47. package/dist/web/assets/ReviewDetailPage-D7x0R_2N.js +1 -0
  48. package/dist/web/assets/{ReviewsPage-BaxUZzUZ.js → ReviewsPage-C317IA1b.js} +1 -1
  49. package/dist/web/assets/StatusSwitcher-BQXo4sss.js +1 -0
  50. package/dist/web/assets/{TerminalView-DMJTXE-G.js → TerminalView-CTsFWvWm.js} +2 -2
  51. package/dist/web/assets/{abnfDiagram-O67JEVCF-CiOkMSRz.js → abnfDiagram-O67JEVCF-BYlDf7LI.js} +1 -1
  52. package/dist/web/assets/agent-store-ByB1OrjP.js +113 -0
  53. package/dist/web/assets/app-info-store-Gn-SNU3Y.js +1 -0
  54. package/dist/web/assets/architecture-7GRP2DOG-DNWQGMIX.js +1 -0
  55. package/dist/web/assets/{architectureDiagram-NJMV4G6O-BexHJffj.js → architectureDiagram-NJMV4G6O-CC0SmfK_.js} +1 -1
  56. package/dist/web/assets/{blockDiagram-BEXU5L5S-CEyB_5a1.js → blockDiagram-BEXU5L5S-C1Ny76Gc.js} +1 -1
  57. package/dist/web/assets/{c4Diagram-YGBWAQC7-BRNWA7xI.js → c4Diagram-YGBWAQC7-CP2if62Y.js} +1 -1
  58. package/dist/web/assets/channel-DW-wL7ua.js +1 -0
  59. package/dist/web/assets/{chunk-3FUC2YCW-BcQR1JDF.js → chunk-3FUC2YCW-cjM6hj3T.js} +1 -1
  60. package/dist/web/assets/{chunk-5DYCD2WN-D6aQ1hFt.js → chunk-5DYCD2WN-DAW_EwWQ.js} +1 -1
  61. package/dist/web/assets/{chunk-742MDFTN-BRgrFtkf.js → chunk-742MDFTN-nkStFRF-.js} +1 -1
  62. package/dist/web/assets/{chunk-7INBJB4K-3RBjXeq6.js → chunk-7INBJB4K-EQQsEy8I.js} +1 -1
  63. package/dist/web/assets/{chunk-7M6MHVWA-Malugc_N.js → chunk-7M6MHVWA-DUJ2C21w.js} +1 -1
  64. package/dist/web/assets/{chunk-7PRAP22T-Bb3gaISA.js → chunk-7PRAP22T-C1Bj5-NO.js} +1 -1
  65. package/dist/web/assets/{chunk-GTNCS2PH-Cps7XhUC.js → chunk-GTNCS2PH-DW39t1bj.js} +1 -1
  66. package/dist/web/assets/{chunk-GWA4HPMP-Bfp2Tg3_.js → chunk-GWA4HPMP-i49YwHnS.js} +1 -1
  67. package/dist/web/assets/{chunk-MBY4JIJT-IfXbX1Ur.js → chunk-MBY4JIJT-C4mXlV61.js} +1 -1
  68. package/dist/web/assets/{chunk-NETBCI7D-r2fmahwk.js → chunk-NETBCI7D-DoRSO-kq.js} +1 -1
  69. package/dist/web/assets/{chunk-O7XYJQB3-sadsiWmA.js → chunk-O7XYJQB3-D38ZePQT.js} +1 -1
  70. package/dist/web/assets/{chunk-UA2S7LBM-DibfwtDn.js → chunk-UA2S7LBM-DmOI-u6c.js} +1 -1
  71. package/dist/web/assets/{chunk-WEXAMYUT-DBouMgEO.js → chunk-WEXAMYUT-Dv710fF3.js} +1 -1
  72. package/dist/web/assets/{chunk-Z7XXMR3K-fAHToON5.js → chunk-Z7XXMR3K-CWHlAHIu.js} +1 -1
  73. package/dist/web/assets/{chunk-ZIGJFQKS-CJG1UIHO.js → chunk-ZIGJFQKS-Bid5tGRk.js} +1 -1
  74. package/dist/web/assets/{classDiagram-v2-NBCMYWYE-CPHP5ynj.js → classDiagram-v2-NBCMYWYE-C1770G1t.js} +1 -1
  75. package/dist/web/assets/{cynefin-OW5HDTMX-BU7_LYGR.js → cynefin-OW5HDTMX-CWxF4ZIN.js} +1 -1
  76. package/dist/web/assets/{cynefinDiagram-VND7K2PF-BXFEy9Io.js → cynefinDiagram-VND7K2PF-DcFBTI6m.js} +1 -1
  77. package/dist/web/assets/{dagre-6A5THRUB-aKpdpQ18.js → dagre-6A5THRUB-CP5wTvgN.js} +1 -1
  78. package/dist/web/assets/{diagram-22UHCM2B-ddbRgIQ9.js → diagram-22UHCM2B-mLUm1v32.js} +1 -1
  79. package/dist/web/assets/{diagram-3UASUU5V-vNYy6WP_.js → diagram-3UASUU5V-CP0OFpuS.js} +1 -1
  80. package/dist/web/assets/{diagram-ATOU4E4O-B9Z3zFfp.js → diagram-ATOU4E4O-DolFulHH.js} +1 -1
  81. package/dist/web/assets/{diagram-CDSNMT55-D3TaDPXU.js → diagram-CDSNMT55-Bs17AhwI.js} +1 -1
  82. package/dist/web/assets/{diagram-MLGK6HIB-DOXcXm2Y.js → diagram-MLGK6HIB-BfhsJwV7.js} +1 -1
  83. package/dist/web/assets/{diagram-MPIPVDR6-B5E2J8pO.js → diagram-MPIPVDR6-B1c-Ikp-.js} +1 -1
  84. package/dist/web/assets/{dist-Kd0W7Y_b.js → dist-Bm8OAr9J.js} +1 -1
  85. package/dist/web/assets/{dist-C9STut2J.js → dist-BsjKEQwP.js} +1 -1
  86. package/dist/web/assets/{dist-BFbA030x.js → dist-C6YiC_nY.js} +1 -1
  87. package/dist/web/assets/{dist-BXUopzfH.js → dist-CyyHluOV.js} +1 -1
  88. package/dist/web/assets/{dist-C9cJQvJH.js → dist-D6WXR3TF.js} +1 -1
  89. package/dist/web/assets/{dist-PDsGXJi3.js → dist-DkKvAWYi.js} +1 -1
  90. package/dist/web/assets/{dist-BGzvKGEu.js → dist-DuW-c5so.js} +1 -1
  91. package/dist/web/assets/{dist-DSPzgfNo.js → dist-d8yBJi6g.js} +1 -1
  92. package/dist/web/assets/{dist-Cxd9qKh7.js → dist-g0NXSFab.js} +1 -1
  93. package/dist/web/assets/{dist-BX8UA0fl.js → dist-yQ-fH4og.js} +1 -1
  94. package/dist/web/assets/{dist-CRoJr3t6.js → dist-zqKz9Qrf.js} +1 -1
  95. package/dist/web/assets/{ebnfDiagram-ZINNZB2B-D-OCB_ud.js → ebnfDiagram-ZINNZB2B-BvQ60ZD9.js} +1 -1
  96. package/dist/web/assets/{elk-276RUBZZ-CzjP8RHy.js → elk-276RUBZZ-C27WMGnY.js} +1 -1
  97. package/dist/web/assets/{erDiagram-OPXOYQCR-Clohps7p.js → erDiagram-OPXOYQCR-CdfkOXb9.js} +1 -1
  98. package/dist/web/assets/eventmodeling-NTZA5JFV-C1sONJTj.js +1 -0
  99. package/dist/web/assets/flowDiagram-KWPJA3E3-CU2TsxFx.js +1 -0
  100. package/dist/web/assets/{ganttDiagram-FUAMR5RP-ZWH4HYq5.js → ganttDiagram-FUAMR5RP-CuKNmNbv.js} +1 -1
  101. package/dist/web/assets/{gitGraph-4MIJSDKK-C3AfRnC8.js → gitGraph-4MIJSDKK-DBGr6EfP.js} +1 -1
  102. package/dist/web/assets/{gitGraphDiagram-X574FWY7-BobkQARX.js → gitGraphDiagram-X574FWY7-BUZgiyYd.js} +1 -1
  103. package/dist/web/assets/i18n-Cxfq3B8n.js +1 -0
  104. package/dist/web/assets/index-DKirIJG5.js +2 -0
  105. package/dist/web/assets/{info-A6RAGUB7-Dh_SAe09.js → info-A6RAGUB7-CjnEima-.js} +1 -1
  106. package/dist/web/assets/{infoDiagram-VRGFBTTK-izDlhNTw.js → infoDiagram-VRGFBTTK-D91sa8do.js} +1 -1
  107. package/dist/web/assets/{init-app-C1a6BWWN.js → init-app-B6mIRN6f.js} +1 -1
  108. package/dist/web/assets/{ishikawaDiagram-OU5B5YK6-BJ89XzVJ.js → ishikawaDiagram-OU5B5YK6-2K-kH65E.js} +1 -1
  109. package/dist/web/assets/{journeyDiagram-ZHPQQLJL-poV-f08K.js → journeyDiagram-ZHPQQLJL-CkENPVJA.js} +1 -1
  110. package/dist/web/assets/{kanban-definition-PNTS6WVX-Cn3FEnH7.js → kanban-definition-PNTS6WVX-BHJODz7s.js} +1 -1
  111. package/dist/web/assets/{line-bE9Mqcqy.js → line-C6VvIL_x.js} +1 -1
  112. package/dist/web/assets/markdown-192Ev3_O.js +15 -0
  113. package/dist/web/assets/{mermaid-parser.core-Cua7H5pF.js → mermaid-parser.core-DMJg-lnr.js} +3 -3
  114. package/dist/web/assets/{mermaid.core-BMPOA8T-.js → mermaid.core-Dd40xnyQ.js} +4 -4
  115. package/dist/web/assets/{mindmap-definition-NLK3R4M7-DaTGr8Fs.js → mindmap-definition-NLK3R4M7-DhfAMSga.js} +1 -1
  116. package/dist/web/assets/{packet-AYTQ26CC-DmLfghd9.js → packet-AYTQ26CC-DZUk7rEw.js} +1 -1
  117. package/dist/web/assets/{pegDiagram-GJSIUBJH-CTlxXcbf.js → pegDiagram-GJSIUBJH-W22cBCh2.js} +1 -1
  118. package/dist/web/assets/{pie-WAS4IAKB-52oNsEtc.js → pie-WAS4IAKB-BMvwPiHK.js} +1 -1
  119. package/dist/web/assets/{pieDiagram-5QR66LMP-CbJtB1te.js → pieDiagram-5QR66LMP-CZ2EVCmx.js} +1 -1
  120. package/dist/web/assets/pinia-Cp_DCu4m.js +1 -0
  121. package/dist/web/assets/{quadrantDiagram-O4NWA36T-DCg-uD08.js → quadrantDiagram-O4NWA36T-DBS45bbr.js} +1 -1
  122. package/dist/web/assets/{radar-RG4KPBEZ-9uA3AOZR.js → radar-RG4KPBEZ-BDkD2JF1.js} +1 -1
  123. package/dist/web/assets/{railroad-74A4TZTK-BPxQfpxv.js → railroad-74A4TZTK-BH_sA5bU.js} +1 -1
  124. package/dist/web/assets/railroad-abnf-HS5TGJTU-D6lX11kj.js +1 -0
  125. package/dist/web/assets/railroad-ebnf-LZEXJU2U-D3N0Z6uV.js +1 -0
  126. package/dist/web/assets/railroad-peg-WCYAUIDC-DOaenw8H.js +1 -0
  127. package/dist/web/assets/{railroadDiagram-XR7U4H2S-CwBNr6fr.js → railroadDiagram-XR7U4H2S-CrI1TIG1.js} +1 -1
  128. package/dist/web/assets/{requirementDiagram-PLB6GJNP-BbtZt0St.js → requirementDiagram-PLB6GJNP-BbtaFtGn.js} +1 -1
  129. package/dist/web/assets/{safe-storage-Bn-sHAYw.js → safe-storage-DekXHbgc.js} +1 -1
  130. package/dist/web/assets/{sankeyDiagram-IPEJSGJF-DRWdMnFl.js → sankeyDiagram-IPEJSGJF-DRU9tLf3.js} +1 -1
  131. package/dist/web/assets/{sequenceDiagram-PO4LG4MO-C4tWeWpt.js → sequenceDiagram-PO4LG4MO-RquVuniP.js} +1 -1
  132. package/dist/web/assets/{stateDiagram-v2-GCMORJYK-pE0T1U5E.js → stateDiagram-v2-GCMORJYK-CKjC8JTS.js} +1 -1
  133. package/dist/web/assets/{swimlanes-2SLR337P-DKky6E3p.js → swimlanes-2SLR337P-B-5FN1NY.js} +1 -1
  134. package/dist/web/assets/swimlanesDiagram-TC7HE7FX-B5SL6iu0.js +8 -0
  135. package/dist/web/assets/theme-C1B2V2RV.js +1 -0
  136. package/dist/web/assets/{timeline-definition-EJHVYXUP-CsRzcMLr.js → timeline-definition-EJHVYXUP-DbG_YVkW.js} +1 -1
  137. package/dist/web/assets/{treeView-Q6P3EWNA-CQYqoPG3.js → treeView-Q6P3EWNA-BgkrW_FP.js} +1 -1
  138. package/dist/web/assets/{treemap-WGGIJYW6-BzFw4gFs.js → treemap-WGGIJYW6-Dp8ISpo7.js} +1 -1
  139. package/dist/web/assets/use-add-agent-context-3-KB2D10.js +1 -0
  140. package/dist/web/assets/{use-app-theme-9qFZUBqz.js → use-app-theme-D_HR0B3W.js} +1 -1
  141. package/dist/web/assets/use-panel-width-DIzwb-yt.js +1 -0
  142. package/dist/web/assets/use-server-events-C13Sw-rU.js +1 -0
  143. package/dist/web/assets/{usecaseDiagram-POWQR4AR-IMfiBw6h.js → usecaseDiagram-POWQR4AR-DwRXMhnD.js} +1 -1
  144. package/dist/web/assets/{vennDiagram-UO4OBE2U-JKdzpNy2.js → vennDiagram-UO4OBE2U-CxdeHvjU.js} +1 -1
  145. package/dist/web/assets/{wardley-WFR3VGLG-B9Yiwlp8.js → wardley-WFR3VGLG-C8gq8AfM.js} +1 -1
  146. package/dist/web/assets/{wardleyDiagram-VNRHLVJA-BVoc2hGS.js → wardleyDiagram-VNRHLVJA-C9Jo2KAj.js} +1 -1
  147. package/dist/web/assets/window-store-CnPjWx6-.js +1 -0
  148. package/dist/web/assets/{xychartDiagram-PMCCYNJV-B_XV1aim.js → xychartDiagram-PMCCYNJV-D3tp7hdU.js} +1 -1
  149. package/dist/web/index.html +1 -1
  150. package/package.json +3 -1
  151. package/dist/web/assets/AppPage-cl-3VfAl.js +0 -1
  152. package/dist/web/assets/IndexPage-CYFIGWy9.css +0 -1
  153. package/dist/web/assets/IndexPage-CmBmgu4A.js +0 -1
  154. package/dist/web/assets/NoteVisualEditor-zjZr9aod.js +0 -1056
  155. package/dist/web/assets/NotesPage-C5VXA9Bb.css +0 -1
  156. package/dist/web/assets/NotesPage-Jeva3Jta.js +0 -114
  157. package/dist/web/assets/QSpace-BRLIXkHB.js +0 -1
  158. package/dist/web/assets/ReviewDetailPage-CpJPrSKO.js +0 -1
  159. package/dist/web/assets/StatusSwitcher-D5UG_YWP.js +0 -1
  160. package/dist/web/assets/agent-icon-Dx8WBYX_.js +0 -1
  161. package/dist/web/assets/agent-store-B1VK6S0D.js +0 -1
  162. package/dist/web/assets/app-info-store-D76h_OdJ.js +0 -1
  163. package/dist/web/assets/architecture-7GRP2DOG-Byc4Oz95.js +0 -1
  164. package/dist/web/assets/channel-DbRAFIx1.js +0 -1
  165. package/dist/web/assets/equal-arrays-GA_7ZCAb.js +0 -1
  166. package/dist/web/assets/eventmodeling-NTZA5JFV-FWK4tnN_.js +0 -1
  167. package/dist/web/assets/flowDiagram-KWPJA3E3-C10B5_6J.js +0 -1
  168. package/dist/web/assets/i18n-CC_rvfan.js +0 -1
  169. package/dist/web/assets/index-Ic8yFbJg.js +0 -2
  170. package/dist/web/assets/markdown-D85iiL_9.js +0 -15
  171. package/dist/web/assets/pinia-BlCzIRX-.js +0 -1
  172. package/dist/web/assets/railroad-abnf-HS5TGJTU-CPVHNg05.js +0 -1
  173. package/dist/web/assets/railroad-ebnf-LZEXJU2U-DAjTaOUg.js +0 -1
  174. package/dist/web/assets/railroad-peg-WCYAUIDC-DkxyKsj4.js +0 -1
  175. package/dist/web/assets/swimlanesDiagram-TC7HE7FX-CPhibEqM.js +0 -8
  176. package/dist/web/assets/theme-B-g7wQEs.js +0 -1
  177. package/dist/web/assets/use-panel-width-Dyh49bod.js +0 -1
  178. package/dist/web/assets/use-server-events-24_soFuj.js +0 -1
@@ -1,1056 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-BXUopzfH.js","assets/dist-D2Ce45aH.js","assets/dist-3B0OaUZ-.js","assets/dist-BY24_62d.js","assets/dist-C3sBgvRy.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/dist-BX8UA0fl.js","assets/dist-DSPzgfNo.js","assets/dist-C9cJQvJH.js","assets/dist-DpKJcdvz.js","assets/dist-C9STut2J.js","assets/dist-D7Llw4iH.js","assets/dist-CqGqStPp.js","assets/dist-PDsGXJi3.js","assets/dist-CRoJr3t6.js","assets/dist-Cxd9qKh7.js","assets/dist-Kd0W7Y_b.js","assets/dist-DZQ2IsS9.js","assets/dist-DUt0feNB.js","assets/dist-LFPPEX39.js","assets/dist-DuZv0LJj.js","assets/dist-lC0EKTFH.js","assets/dockerfile-DJkHQgkl.js","assets/simple-mode-DXiLM1-G.js","assets/factor-LKH5gN8L.js","assets/nsis-viPvXFiq.js","assets/pug-3K-JMW4g.js","assets/javascript-Bu8mWwtz.js","assets/dist-BGzvKGEu.js","assets/dist-BFbA030x.js"])))=>i.map(i=>d[i]);
2
- import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{J as r,K as i,M as a,O as o,Ot as s,P as c,T as l,W as u,_ as d,b as f,c as p,ct as m,d as h,ft as g,i as _,j as v,kt as y,l as b,m as x,ot as S,pt as ee,q as te,r as C,s as w,u as ne}from"./runtime-core.esm-bundler-BKFI1w28.js";import{E as re}from"./use-router-link-BGc0noIO.js";import{O as T}from"./index-Ic8yFbJg.js";import{$ as ie,A as ae,At as oe,B as se,Ct as ce,Dt as le,E as ue,Et as de,F as fe,G as pe,H as me,I as he,J as ge,K as _e,L as ve,Nt as ye,O as be,Ot as xe,P as E,Q as Se,R as Ce,S as we,St as Te,T as Ee,Tt as De,U as Oe,V as ke,W as Ae,X as je,Y as Me,Z as Ne,_t as Pe,a as D,at as Fe,bt as Ie,c as Le,ct as Re,dt as ze,et as Be,f as Ve,ft as He,g as Ue,gt as We,ht as Ge,it as Ke,j as qe,kt as Je,l as Ye,lt as Xe,mt as Ze,n as Qe,nt as $e,o as et,ot as tt,pt as O,q as nt,rt,st as it,t as at,tt as ot,ut as st,v as ct,vt as lt,w as ut,wt as dt,x as ft,xt as pt,yt as mt,z as ht}from"./dist-D2Ce45aH.js";import{t as gt}from"./purify.es--06brOip.js";import{_ as _t,k as vt,w as yt}from"./isArrayLikeObject-BbaDyxId.js";import{h as bt,l as xt,n as St,t as Ct}from"./_baseMerge-BzZFQ6mI.js";import{n as wt,t as Tt}from"./ccount-CcG1m-Yh.js";import{s as Et}from"./use-server-events-24_soFuj.js";import{c as Dt}from"./QSpace-BRLIXkHB.js";import{a as Ot,n as kt,r as At}from"./markdown-D85iiL_9.js";import{i as jt}from"./QForm-BiRkV9BY.js";import{t as Mt}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{a as Nt,i as Pt,n as Ft,r as It}from"./NotesPage-Jeva3Jta.js";var Lt=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=qe(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(Wt(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Rt(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function zt(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=Rt(t)+Rt(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function Bt(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:zt(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function Vt(e,t){return n=>{for(let t=qe(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var Ht=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function Ut(e){return e.selection.main.from}function Wt(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var Gt=Re.define();function Kt(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:O.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var qt=new WeakMap;function Jt(e){if(!Array.isArray(e))return e;let t=qt.get(e);return t||qt.set(e,t=Bt(e)),t}var Yt=pt.define(),Xt=pt.define(),Zt=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=De(e,t),r=de(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(De(a==i?i.toLowerCase():a,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:a}=this;if(t.length==1){let r=De(e,0),i=de(r),a=i==e.length?0:-100;if(r!=t[0]){if(r==n[0])a+=-200;else return null}return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=De(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=de(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),g=!0;for(let r=0,c=Math.min(e.length,200),_=0;r<c&&u<s;){let c=De(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let v,y=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(v=oe(c))==v.toLowerCase()?v==v.toUpperCase()?0:2:1;(!r||y==1&&h||_==0&&y!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(g=!1)),_=y,r+=de(c)}return u==s&&a[0]==0&&g?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(g?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?de(De(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},Qt=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},$t=Ge.define({combine(e){return le(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:tn,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>en(e(n),t(n)),optionClass:(e,t)=>n=>en(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function en(e,t){return e?t?e+` `+t:e:t}function tn(e,t,n,r,i,a){let o=e.textDirection==he.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var nn=pt.define();function rn(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function an(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var on=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet($t);this.optionContent=rn(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=an(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:nn.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet($t).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:Xt.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=an(r.length,i,e.state.facet($t).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=an(t.options.length,t.selected,this.view.state.facet($t).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>ie(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&cn(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet($t).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function sn(e,t){return n=>new on(n,e,t)}function cn(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function ln(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function un(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet($t);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new Ht(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new Qt(n):new Zt(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new Ht(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):ln(e.completion)>ln(c)&&(s[s.length-1]=e),c=e.completion}return s}var dn=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,gn(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=un(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet($t).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,gn(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Tn,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},fn=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(_n,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet($t),i=(r.override||n.languageDataAt(`autocomplete`,Ut(n)).map(Jt)).map(e=>(this.active.find(t=>t.source==e)||new yn(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(Sn));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!pn(i,this.active)||o?a=dn.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new yn(e.source,0):e));for(let e of t.effects)e.is(nn)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?mn:hn}};function pn(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var mn={"aria-autocomplete":`list`},hn={};function gn(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var _n=[];function vn(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(Gt);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var yn=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=vn(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(Yt))i=new e(i.source,1,n.value);else if(n.is(Xt))i=new e(i.source,0);else if(n.is(Sn))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Ut(e.state))}},bn=class e extends yn{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=Ut(t.state);if(o>a||!r||n&2&&(Ut(t.startState)==this.from||o<this.limit))return new yn(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return xn(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new Lt(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??Ut(t.state)):new yn(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new yn(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function xn(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):Wt(e,!0).test(i)}var Sn=pt.define({map(e,t){return e.map(e=>e.map(t))}}),Cn=Te.define({create(){return fn.start()},update(e,t){return e.update(t)},provide:e=>[Ke.from(e,e=>e.tooltip),ve.contentAttributes.from(e,e=>e.attrs)]});function wn(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(Cn).active.find(e=>e.source==t.source);return r instanceof bn&&(typeof n==`string`?e.dispatch({...Kt(e.state,n,r.from,r.to),annotations:Gt.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var Tn=sn(Cn,wn);function En(e,t=`option`){return n=>{let r=n.state.field(Cn,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet($t).interactionDelay)return!1;let i=1,a;t==`page`&&(a=_e(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:nn.of(s)}),!0}}var Dn=e=>{let t=e.state.field(Cn,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet($t).interactionDelay?!1:wn(e,t.open.options[t.open.selected])},On=e=>e.state.field(Cn,!1)?(e.dispatch({effects:Yt.of(!0)}),!0):!1,kn=e=>{let t=e.state.field(Cn,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:Xt.of(null)}),!0)},An=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},jn=50,Mn=1e3,Nn=Ce.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Cn).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Cn),n=e.state.facet($t);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Cn)==t)return;let r=e.transactions.some(e=>{let t=vn(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>jn&&Date.now()-n.time>Mn){for(let e of n.context.abortListeners)try{e()}catch(e){ie(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(Yt)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Cn);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet($t).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new Lt(t,Ut(t),e.explicit,this.view),r=new An(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:Xt.of(null)}),ie(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet($t).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet($t),n=this.view.state.field(Cn);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=Ut(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new bn(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending){if(i.done==null){let n=new yn(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:Sn.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Cn,!1);if(t&&t.tooltip&&this.view.state.facet($t).closeOnBlur){let n=t.open&&_e(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Xt.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Yt.of(!1)}),20),this.composing=0}}}),Pn=typeof navigator==`object`&&/Win/.test(navigator.platform),Fn=Pe.highest(ve.domEventHandlers({keydown(e,t){let n=t.state.field(Cn,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Pn&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&wn(t,r),!1}})),In=ve.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Ln=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},Rn=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,We.TrackDel),r=t.mapPos(this.to,1,We.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},zn=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(ue);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new Rn(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Ln(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},Bn=fe.widget({widget:new class extends ht{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),Vn=fe.mark({class:`cm-snippetField`}),Hn=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=fe.set(e.map(e=>(e.from==e.to?Bn:Vn).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},Un=pt.define({map(e,t){return e&&e.map(t)}}),Wn=pt.define(),Gn=Te.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Un))return n.value;if(n.is(Wn)&&e)return new Hn(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>ve.decorations.from(e,e=>e?e.deco:fe.none)});function Kn(e,t){return O.create(e.filter(e=>e.field==t).map(e=>O.range(e.from,e.to)))}function qn(e){let t=zn.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:ce.of(a)},scrollIntoView:!0,annotations:n?[Gt.of(n),dt.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=Kn(o,0)),o.some(e=>e.field>0)){let t=new Hn(o,0),n=c.effects=[Un.of(t)];e.state.field(Gn,!1)===void 0&&n.push(pt.appendConfig.of([Gn,Zn,$n,In]))}e.dispatch(e.state.update(c))}}function Jn(e){return({state:t,dispatch:n})=>{let r=t.field(Gn,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:Kn(r.ranges,i),effects:Un.of(a?null:new Hn(r.ranges,i)),scrollIntoView:!0})),!0}}var Yn=[{key:`Tab`,run:Jn(1),shift:Jn(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(Gn,!1)?(t(e.update({effects:Un.of(null)})),!0):!1}],Xn=Ge.define({combine(e){return e.length?e[0]:Yn}}),Zn=Pe.highest(Ne.compute([Xn],e=>e.facet(Xn)));function Qn(e,t){return{...t,apply:qn(e)}}var $n=ve.domEventHandlers({mousedown(e,t){let n=t.state.field(Gn,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:Kn(n.ranges,i.field),effects:Un.of(n.ranges.some(e=>e.field>i.field)?new Hn(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),er={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},tr=pt.define({map(e,t){return t.mapPos(e,-1,We.TrackAfter)??void 0}}),nr=new class extends Ie{};nr.startSide=1,nr.endSide=-1;var rr=Te.define({create(){return lt.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(tr)&&(e=e.update({add:[nr.range(n.value,n.value+1)]}));return e}});function ir(){return[lr,rr]}var ar=`()[]{}<>«»»«[]{}`;function or(e){for(let t=0;t<16;t+=2)if(ar.charCodeAt(t)==e)return ar.charAt(t+1);return oe(e<128?e:e+1)}function sr(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||er}var cr=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),lr=ve.inputHandler.of((e,t,n,r)=>{if((cr?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&de(De(r,0))==1||t!=i.from||n!=i.to)return!1;let a=dr(e.state,r);return a?(e.dispatch(a),!0):!1}),ur=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=sr(e,e.selection.main.head).brackets||er.brackets,r=null,i=e.changeByRange(t=>{if(t.empty){let r=mr(e.doc,t.head);for(let i of n)if(i==r&&pr(e.doc,t.head)==or(De(i,0)))return{changes:{from:t.head-i.length,to:t.head+i.length},range:O.cursor(t.head-i.length)}}return{range:r=t}});return r||t(e.update(i,{scrollIntoView:!0,userEvent:`delete.backward`})),!r}}];function dr(e,t){let n=sr(e,e.selection.main.head),r=n.brackets||er.brackets;for(let i of r){let a=or(De(i,0));if(t==i)return a==i?_r(e,i,r.indexOf(i+i+i)>-1,n):hr(e,i,a,n.before||er.before);if(t==a&&fr(e,e.selection.main.from))return gr(e,i,a)}return null}function fr(e,t){let n=!1;return e.field(rr).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function pr(e,t){let n=e.sliceString(t,t+2);return n.slice(0,de(De(n,0)))}function mr(e,t){let n=e.sliceString(t-2,t);return de(De(n,0))==n.length?n:n.slice(1)}function hr(e,t,n,r){let i=null,a=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:tr.of(a.to+t.length),range:O.range(a.anchor+t.length,a.head+t.length)};let o=pr(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:tr.of(a.head+t.length),range:O.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function gr(e,t,n){let r=null,i=e.changeByRange(t=>t.empty&&pr(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:O.cursor(t.head+n.length)}:r={range:t});return r?null:e.update(i,{scrollIntoView:!0,userEvent:`input.type`})}function _r(e,t,n,r){let i=r.stringPrefixes||er.stringPrefixes,a=null,o=e.changeByRange(r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:t,from:r.to}],effects:tr.of(r.to+t.length),range:O.range(r.anchor+t.length,r.head+t.length)};let o=r.head,s=pr(e.doc,o),c;if(s==t){if(vr(e,o))return{changes:{insert:t+t,from:o},effects:tr.of(o+t.length),range:O.cursor(o+t.length)};if(fr(e,o)){let r=n&&e.sliceDoc(o,o+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:o,to:o+r.length,insert:r},range:O.cursor(o+r.length)}}}else if(n&&e.sliceDoc(o-2*t.length,o)==t+t&&(c=br(e,o-2*t.length,i))>-1&&vr(e,c))return{changes:{insert:t+t+t+t,from:o},effects:tr.of(o+t.length),range:O.cursor(o+t.length)};else if(e.charCategorizer(o)(s)!=ze.Word&&br(e,o,i)>-1&&!yr(e,o,t,i))return{changes:{insert:t+t,from:o},effects:tr.of(o+t.length),range:O.cursor(o+t.length)};return{range:a=r}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function vr(e,t){let n=qe(e).resolveInner(t+1);return n.parent&&n.from==t}function yr(e,t,n,r){let i=qe(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function br(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=ze.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=ze.Word)return n}return-1}function xr(e={}){return[Fn,Cn,$t.of(e),Nn,Cr,In]}var Sr=[{key:`Ctrl-Space`,run:On},{mac:"Alt-`",run:On},{mac:`Alt-i`,run:On},{key:`Escape`,run:kn},{key:`ArrowDown`,run:En(!0)},{key:`ArrowUp`,run:En(!1)},{key:`PageDown`,run:En(!0,`page`)},{key:`PageUp`,run:En(!1,`page`)},{key:`Enter`,run:Dn}],Cr=Pe.highest(Ne.computeN([$t],e=>e.facet($t).defaultKeymap?[Sr]:[])),wr=`Expected a function`,Tr=Math.max,Er=Math.min;function Dr(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0;if(typeof e!=`function`)throw TypeError(wr);t=bt(t)||0,vt(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?Tr(bt(n.maxWait)||0,t):a,f=`trailing`in n?!!n.trailing:f);function p(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function m(e){return l=e,s=setTimeout(_,t),u?p(e):o}function h(e){var n=e-c,r=e-l,i=t-n;return d?Er(i,a-r):i}function g(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function _(){var e=St();if(g(e))return v(e);s=setTimeout(_,h(e))}function v(e){return s=void 0,f&&r?p(e):(r=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:v(St())}function x(){var e=St(),n=g(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return m(c);if(d)return clearTimeout(s),s=setTimeout(_,t),p(c)}return s===void 0&&(s=setTimeout(_,t)),o}return x.cancel=y,x.flush=b,x}function Or(e,t,n,r,i,a){return vt(e)&&vt(t)&&(a.set(t,e),Ct(e,t,void 0,Or,a),a.delete(t)),e}var kr=xt(function(e,t,n,r){Ct(e,t,n,r)}),Ar=_t(function(e){return e.push(void 0,Or),yt(kr,void 0,e)}),jr=`Expected a function`;function Mr(e,t,n){var r=!0,i=!0;if(typeof e!=`function`)throw TypeError(jr);return vt(n)&&(r=`leading`in n?!!n.leading:r,i=`trailing`in n?!!n.trailing:i),Dr(e,t,{leading:r,maxWait:t,trailing:i})}function k(e){return new et(Le.define(e))}function Nr(e){return T(()=>import(`./dist-BXUopzfH.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([0,1,2]))}var Pr=[D.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return T(()=>import(`./dist-BY24_62d.js`).then(e=>e.cpp()),__vite__mapDeps([3,1,2]))}}),D.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return T(()=>import(`./dist-BY24_62d.js`).then(e=>e.cpp()),__vite__mapDeps([3,1,2]))}}),D.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return Nr(`Cassandra`)}}),D.of({name:`CSS`,extensions:[`css`],load(){return T(()=>import(`./dist-C3sBgvRy.js`).then(e=>e.i).then(e=>e.css()),__vite__mapDeps([4,5,1,2]))}}),D.of({name:`Go`,extensions:[`go`],load(){return T(()=>import(`./dist-BX8UA0fl.js`).then(e=>e.go()),__vite__mapDeps([6,1,2]))}}),D.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return T(()=>import(`./dist-DSPzgfNo.js`).then(e=>e.html()),__vite__mapDeps([7,1,2,4,5,8]))}}),D.of({name:`Java`,extensions:[`java`],load(){return T(()=>import(`./dist-DpKJcdvz.js`).then(e=>e.java()),__vite__mapDeps([9,1,2]))}}),D.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return T(()=>import(`./dist-C9cJQvJH.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([8,5,1,2]))}}),D.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return T(()=>import(`./dist-C9STut2J.js`).then(e=>e.jinja()),__vite__mapDeps([10,1,2,7,4,5,8]))}}),D.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return T(()=>import(`./dist-D7Llw4iH.js`).then(e=>e.json()),__vite__mapDeps([11,1,2]))}}),D.of({name:`JSX`,extensions:[`jsx`],load(){return T(()=>import(`./dist-C9cJQvJH.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([8,5,1,2]))}}),D.of({name:`LESS`,extensions:[`less`],load(){return T(()=>import(`./dist-CqGqStPp.js`).then(e=>e.less()),__vite__mapDeps([12,1,2,4,5]))}}),D.of({name:`Liquid`,extensions:[`liquid`],load(){return T(()=>import(`./dist-PDsGXJi3.js`).then(e=>e.liquid()),__vite__mapDeps([13,1,2,7,4,5,8]))}}),D.of({name:`MariaDB SQL`,load(){return Nr(`MariaSQL`)}}),D.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return T(()=>import(`./dist-CRoJr3t6.js`).then(e=>e.markdown()),__vite__mapDeps([14,1,7,2,4,5,8]))}}),D.of({name:`MS SQL`,load(){return Nr(`MSSQL`)}}),D.of({name:`MySQL`,load(){return Nr(`MySQL`)}}),D.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return T(()=>import(`./dist-Cxd9qKh7.js`).then(e=>e.php()),__vite__mapDeps([15,1,2,7,4,5,8]))}}),D.of({name:`PLSQL`,extensions:[`pls`],load(){return Nr(`PLSQL`)}}),D.of({name:`PostgreSQL`,load(){return Nr(`PostgreSQL`)}}),D.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return T(()=>import(`./dist-Kd0W7Y_b.js`).then(e=>e.python()),__vite__mapDeps([16,1,2]))}}),D.of({name:`Rust`,extensions:[`rs`],load(){return T(()=>import(`./dist-DZQ2IsS9.js`).then(e=>e.rust()),__vite__mapDeps([17,1,2]))}}),D.of({name:`Sass`,extensions:[`sass`],load(){return T(()=>import(`./dist-DUt0feNB.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([18,1,2,4,5]))}}),D.of({name:`SCSS`,extensions:[`scss`],load(){return T(()=>import(`./dist-DUt0feNB.js`).then(e=>e.sass()),__vite__mapDeps([18,1,2,4,5]))}}),D.of({name:`SQL`,extensions:[`sql`],load(){return Nr(`StandardSQL`)}}),D.of({name:`SQLite`,load(){return Nr(`SQLite`)}}),D.of({name:`TSX`,extensions:[`tsx`],load(){return T(()=>import(`./dist-C9cJQvJH.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([8,5,1,2]))}}),D.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return T(()=>import(`./dist-C9cJQvJH.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([8,5,1,2]))}}),D.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return T(()=>import(`./dist-LFPPEX39.js`).then(e=>e.wast()),__vite__mapDeps([19,1,2]))}}),D.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return T(()=>import(`./dist-DuZv0LJj.js`).then(e=>e.xml()),__vite__mapDeps([20,1,2]))}}),D.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return T(()=>import(`./dist-lC0EKTFH.js`).then(e=>e.yaml()),__vite__mapDeps([21,1,2]))}}),D.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return T(()=>import(`./apl-gfMMiTNf.js`).then(e=>k(e.apl)),[])}}),D.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return T(()=>import(`./asciiarmor-C_eisQCp.js`).then(e=>k(e.asciiArmor)),[])}}),D.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return T(()=>import(`./asn1-DCl_8MCW.js`).then(e=>k(e.asn1({}))),[])}}),D.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return T(()=>import(`./asterisk-BEn0Cwpx.js`).then(e=>k(e.asterisk)),[])}}),D.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return T(()=>import(`./brainfuck-D5EjA2JK.js`).then(e=>k(e.brainfuck)),[])}}),D.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return T(()=>import(`./cobol-DHLQUbN7.js`).then(e=>k(e.cobol)),[])}}),D.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return T(()=>import(`./clike-D_6L3tnO.js`).then(e=>k(e.csharp)),[])}}),D.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return T(()=>import(`./clojure-BflJGmDX.js`).then(e=>k(e.clojure)),[])}}),D.of({name:`ClojureScript`,extensions:[`cljs`],load(){return T(()=>import(`./clojure-BflJGmDX.js`).then(e=>k(e.clojure)),[])}}),D.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return T(()=>import(`./css-CnaYoQib.js`).then(e=>k(e.gss)),[])}}),D.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return T(()=>import(`./cmake-84nbDH0I.js`).then(e=>k(e.cmake)),[])}}),D.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return T(()=>import(`./coffeescript-De_zI4J0.js`).then(e=>k(e.coffeeScript)),[])}}),D.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return T(()=>import(`./commonlisp-DgAKBe0r.js`).then(e=>k(e.commonLisp)),[])}}),D.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return T(()=>import(`./cypher-p9eYesGn.js`).then(e=>k(e.cypher)),[])}}),D.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return T(()=>import(`./python-B_1Jd8HM.js`).then(e=>k(e.cython)),[])}}),D.of({name:`Crystal`,extensions:[`cr`],load(){return T(()=>import(`./crystal-Bsdphhtm.js`).then(e=>k(e.crystal)),[])}}),D.of({name:`D`,extensions:[`d`],load(){return T(()=>import(`./d-DWkQyNnU.js`).then(e=>k(e.d)),[])}}),D.of({name:`Dart`,extensions:[`dart`],load(){return T(()=>import(`./clike-D_6L3tnO.js`).then(e=>k(e.dart)),[])}}),D.of({name:`diff`,extensions:[`diff`,`patch`],load(){return T(()=>import(`./diff-ChtP43wD.js`).then(e=>k(e.diff)),[])}}),D.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return T(()=>import(`./dockerfile-DJkHQgkl.js`).then(e=>k(e.dockerFile)),__vite__mapDeps([22,23]))}}),D.of({name:`DTD`,extensions:[`dtd`],load(){return T(()=>import(`./dtd-DTF72YNO.js`).then(e=>k(e.dtd)),[])}}),D.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return T(()=>import(`./dylan-BCDoL_-p.js`).then(e=>k(e.dylan)),[])}}),D.of({name:`EBNF`,load(){return T(()=>import(`./ebnf-D4c0_ac3.js`).then(e=>k(e.ebnf)),[])}}),D.of({name:`ECL`,extensions:[`ecl`],load(){return T(()=>import(`./ecl-BVIeWmwY.js`).then(e=>k(e.ecl)),[])}}),D.of({name:`edn`,extensions:[`edn`],load(){return T(()=>import(`./clojure-BflJGmDX.js`).then(e=>k(e.clojure)),[])}}),D.of({name:`Eiffel`,extensions:[`e`],load(){return T(()=>import(`./eiffel-BEjRio4Q.js`).then(e=>k(e.eiffel)),[])}}),D.of({name:`Elm`,extensions:[`elm`],load(){return T(()=>import(`./elm-Cshzl8qu.js`).then(e=>k(e.elm)),[])}}),D.of({name:`Erlang`,extensions:[`erl`],load(){return T(()=>import(`./erlang-BV0c4Hdn.js`).then(e=>k(e.erlang)),[])}}),D.of({name:`Esper`,load(){return T(()=>import(`./sql-DuQMFDvy.js`).then(e=>k(e.esper)),[])}}),D.of({name:`Factor`,extensions:[`factor`],load(){return T(()=>import(`./factor-LKH5gN8L.js`).then(e=>k(e.factor)),__vite__mapDeps([24,23]))}}),D.of({name:`FCL`,load(){return T(()=>import(`./fcl-ClOhbFR7.js`).then(e=>k(e.fcl)),[])}}),D.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return T(()=>import(`./forth-D6RzAl64.js`).then(e=>k(e.forth)),[])}}),D.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return T(()=>import(`./fortran-Bt6PBEDR.js`).then(e=>k(e.fortran)),[])}}),D.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return T(()=>import(`./mllike-B45xgp2S.js`).then(e=>k(e.fSharp)),[])}}),D.of({name:`Gas`,extensions:[`s`],load(){return T(()=>import(`./gas-BHEdbvp9.js`).then(e=>k(e.gas)),[])}}),D.of({name:`Gherkin`,extensions:[`feature`],load(){return T(()=>import(`./gherkin-oBAE_ms0.js`).then(e=>k(e.gherkin)),[])}}),D.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return T(()=>import(`./groovy-CUpZ7dEl.js`).then(e=>k(e.groovy)),[])}}),D.of({name:`Haskell`,extensions:[`hs`],load(){return T(()=>import(`./haskell-BRsoo5mP.js`).then(e=>k(e.haskell)),[])}}),D.of({name:`Haxe`,extensions:[`hx`],load(){return T(()=>import(`./haxe-DjVOVvNP.js`).then(e=>k(e.haxe)),[])}}),D.of({name:`HXML`,extensions:[`hxml`],load(){return T(()=>import(`./haxe-DjVOVvNP.js`).then(e=>k(e.hxml)),[])}}),D.of({name:`HTTP`,load(){return T(()=>import(`./http-CLVgA2GD.js`).then(e=>k(e.http)),[])}}),D.of({name:`IDL`,extensions:[`pro`],load(){return T(()=>import(`./idl-BUZw3wgd.js`).then(e=>k(e.idl)),[])}}),D.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return T(()=>import(`./javascript-Bu8mWwtz.js`).then(e=>k(e.jsonld)),[])}}),D.of({name:`Julia`,extensions:[`jl`],load(){return T(()=>import(`./julia-CQfgDRfP.js`).then(e=>k(e.julia)),[])}}),D.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return T(()=>import(`./clike-D_6L3tnO.js`).then(e=>k(e.kotlin)),[])}}),D.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return T(()=>import(`./livescript-BXxG0Yva.js`).then(e=>k(e.liveScript)),[])}}),D.of({name:`Lua`,extensions:[`lua`],load(){return T(()=>import(`./lua-DPCEkfD_.js`).then(e=>k(e.lua)),[])}}),D.of({name:`mIRC`,extensions:[`mrc`],load(){return T(()=>import(`./mirc-C9zpzAZU.js`).then(e=>k(e.mirc)),[])}}),D.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return T(()=>import(`./mathematica-u8YMmbU0.js`).then(e=>k(e.mathematica)),[])}}),D.of({name:`Modelica`,extensions:[`mo`],load(){return T(()=>import(`./modelica-CqHI_q-D.js`).then(e=>k(e.modelica)),[])}}),D.of({name:`MUMPS`,extensions:[`mps`],load(){return T(()=>import(`./mumps-BSzj6Xyz.js`).then(e=>k(e.mumps)),[])}}),D.of({name:`Mbox`,extensions:[`mbox`],load(){return T(()=>import(`./mbox-BEMVcqjs.js`).then(e=>k(e.mbox)),[])}}),D.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return T(()=>import(`./nginx-8H7HVH4w.js`).then(e=>k(e.nginx)),[])}}),D.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return T(()=>import(`./nsis-viPvXFiq.js`).then(e=>k(e.nsis)),__vite__mapDeps([25,23]))}}),D.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return T(()=>import(`./ntriples-B9h1VB_g.js`).then(e=>k(e.ntriples)),[])}}),D.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return T(()=>import(`./clike-D_6L3tnO.js`).then(e=>k(e.objectiveC)),[])}}),D.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return T(()=>import(`./clike-D_6L3tnO.js`).then(e=>k(e.objectiveCpp)),[])}}),D.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return T(()=>import(`./mllike-B45xgp2S.js`).then(e=>k(e.oCaml)),[])}}),D.of({name:`Octave`,extensions:[`m`],load(){return T(()=>import(`./octave-D2Q8cUp1.js`).then(e=>k(e.octave)),[])}}),D.of({name:`Oz`,extensions:[`oz`],load(){return T(()=>import(`./oz-BwTct_5T.js`).then(e=>k(e.oz)),[])}}),D.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return T(()=>import(`./pascal-Dp_KdFgX.js`).then(e=>k(e.pascal)),[])}}),D.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return T(()=>import(`./perl-BkSkiI9m.js`).then(e=>k(e.perl)),[])}}),D.of({name:`Pig`,extensions:[`pig`],load(){return T(()=>import(`./pig-AF4Hwhju.js`).then(e=>k(e.pig)),[])}}),D.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return T(()=>import(`./powershell-BcIto6Sf.js`).then(e=>k(e.powerShell)),[])}}),D.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return T(()=>import(`./properties-C357ku5U.js`).then(e=>k(e.properties)),[])}}),D.of({name:`ProtoBuf`,extensions:[`proto`],load(){return T(()=>import(`./protobuf-D1ij_kNL.js`).then(e=>k(e.protobuf)),[])}}),D.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return T(()=>import(`./pug-3K-JMW4g.js`).then(e=>k(e.pug)),__vite__mapDeps([26,27]))}}),D.of({name:`Puppet`,extensions:[`pp`],load(){return T(()=>import(`./puppet-BZyAS7I4.js`).then(e=>k(e.puppet)),[])}}),D.of({name:`Q`,extensions:[`q`],load(){return T(()=>import(`./q-B9NhS7L_.js`).then(e=>k(e.q)),[])}}),D.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return T(()=>import(`./r-CxDmU1I4.js`).then(e=>k(e.r)),[])}}),D.of({name:`RPM Changes`,load(){return T(()=>import(`./rpm-gpDK5sbt.js`).then(e=>k(e.rpmChanges)),[])}}),D.of({name:`RPM Spec`,extensions:[`spec`],load(){return T(()=>import(`./rpm-gpDK5sbt.js`).then(e=>k(e.rpmSpec)),[])}}),D.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return T(()=>import(`./ruby-ChfNwlCY.js`).then(e=>k(e.ruby)),[])}}),D.of({name:`SAS`,extensions:[`sas`],load(){return T(()=>import(`./sas-C2OyD2Y6.js`).then(e=>k(e.sas)),[])}}),D.of({name:`Scala`,extensions:[`scala`],load(){return T(()=>import(`./clike-D_6L3tnO.js`).then(e=>k(e.scala)),[])}}),D.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return T(()=>import(`./scheme-D9qYN0V5.js`).then(e=>k(e.scheme)),[])}}),D.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return T(()=>import(`./shell-DwuoZtxw.js`).then(e=>k(e.shell)),[])}}),D.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return T(()=>import(`./sieve-tLWDfEkZ.js`).then(e=>k(e.sieve)),[])}}),D.of({name:`Smalltalk`,extensions:[`st`],load(){return T(()=>import(`./smalltalk-BLp5-jwC.js`).then(e=>k(e.smalltalk)),[])}}),D.of({name:`Solr`,load(){return T(()=>import(`./solr-B78wSQJQ.js`).then(e=>k(e.solr)),[])}}),D.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return T(()=>import(`./mllike-B45xgp2S.js`).then(e=>k(e.sml)),[])}}),D.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return T(()=>import(`./sparql-Dz-mlCAC.js`).then(e=>k(e.sparql)),[])}}),D.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return T(()=>import(`./spreadsheet-CTIncYxj.js`).then(e=>k(e.spreadsheet)),[])}}),D.of({name:`Squirrel`,extensions:[`nut`],load(){return T(()=>import(`./clike-D_6L3tnO.js`).then(e=>k(e.squirrel)),[])}}),D.of({name:`Stylus`,extensions:[`styl`],load(){return T(()=>import(`./stylus-BOVgKnng.js`).then(e=>k(e.stylus)),[])}}),D.of({name:`Swift`,extensions:[`swift`],load(){return T(()=>import(`./swift-DKB6_1j6.js`).then(e=>k(e.swift)),[])}}),D.of({name:`sTeX`,load(){return T(()=>import(`./stex-DNzd62Q_.js`).then(e=>k(e.stex)),[])}}),D.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return T(()=>import(`./stex-DNzd62Q_.js`).then(e=>k(e.stex)),[])}}),D.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return T(()=>import(`./verilog-CjI9Y6RI.js`).then(e=>k(e.verilog)),[])}}),D.of({name:`Tcl`,extensions:[`tcl`],load(){return T(()=>import(`./tcl-BGfruO1u.js`).then(e=>k(e.tcl)),[])}}),D.of({name:`Textile`,extensions:[`textile`],load(){return T(()=>import(`./textile-C4jVoHG1.js`).then(e=>k(e.textile)),[])}}),D.of({name:`TiddlyWiki`,load(){return T(()=>import(`./tiddlywiki-VlUiK86J.js`).then(e=>k(e.tiddlyWiki)),[])}}),D.of({name:`Tiki wiki`,load(){return T(()=>import(`./tiki-AK6FwT8q.js`).then(e=>k(e.tiki)),[])}}),D.of({name:`TOML`,extensions:[`toml`],load(){return T(()=>import(`./toml-BPTmHmyx.js`).then(e=>k(e.toml)),[])}}),D.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return T(()=>import(`./troff-C2dAgh7P.js`).then(e=>k(e.troff)),[])}}),D.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return T(()=>import(`./ttcn-PPSTk1ow.js`).then(e=>k(e.ttcn)),[])}}),D.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return T(()=>import(`./ttcn-cfg-2b4Gb5sE.js`).then(e=>k(e.ttcnCfg)),[])}}),D.of({name:`Turtle`,extensions:[`ttl`],load(){return T(()=>import(`./turtle-Cx3rYX2g.js`).then(e=>k(e.turtle)),[])}}),D.of({name:`Web IDL`,extensions:[`webidl`],load(){return T(()=>import(`./webidl-D5jiJvOU.js`).then(e=>k(e.webIDL)),[])}}),D.of({name:`VB.NET`,extensions:[`vb`],load(){return T(()=>import(`./vb-BthdM_4N.js`).then(e=>k(e.vb)),[])}}),D.of({name:`VBScript`,extensions:[`vbs`],load(){return T(()=>import(`./vbscript-D9f6rSsU.js`).then(e=>k(e.vbScript)),[])}}),D.of({name:`Velocity`,extensions:[`vtl`],load(){return T(()=>import(`./velocity-CqftRsjg.js`).then(e=>k(e.velocity)),[])}}),D.of({name:`Verilog`,extensions:[`v`],load(){return T(()=>import(`./verilog-CjI9Y6RI.js`).then(e=>k(e.verilog)),[])}}),D.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return T(()=>import(`./vhdl-kS471soi.js`).then(e=>k(e.vhdl)),[])}}),D.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return T(()=>import(`./xquery-BKJx4mf9.js`).then(e=>k(e.xQuery)),[])}}),D.of({name:`Yacas`,extensions:[`ys`],load(){return T(()=>import(`./yacas-CXXgtw0p.js`).then(e=>k(e.yacas)),[])}}),D.of({name:`Z80`,extensions:[`z80`],load(){return T(()=>import(`./z80-Co3PbHdE.js`).then(e=>k(e.z80)),[])}}),D.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return T(()=>import(`./mscgen-qgSLujhx.js`).then(e=>k(e.mscgen)),[])}}),D.of({name:`Xù`,extensions:[`xu`],load(){return T(()=>import(`./mscgen-qgSLujhx.js`).then(e=>k(e.xu)),[])}}),D.of({name:`MsGenny`,extensions:[`msgenny`],load(){return T(()=>import(`./mscgen-qgSLujhx.js`).then(e=>k(e.msgenny)),[])}}),D.of({name:`Vue`,extensions:[`vue`],load(){return T(()=>import(`./dist-BGzvKGEu.js`).then(e=>e.vue()),__vite__mapDeps([28,1,2,8,5,7,4]))}}),D.of({name:`Angular Template`,load(){return T(()=>import(`./dist-BFbA030x.js`).then(e=>e.angular()),__vite__mapDeps([29,1,2,8,5,7,4]))}})],Fr=`#e5c07b`,Ir=`#e06c75`,Lr=`#56b6c2`,Rr=`#ffffff`,zr=`#abb2bf`,Br=`#7d8799`,Vr=`#61afef`,Hr=`#98c379`,Ur=`#d19a66`,Wr=`#c678dd`,Gr=`#21252b`,Kr=`#2c313a`,qr=`#282c34`,Jr=`#353a42`,Yr=`#3E4451`,Xr=`#528bff`,Zr=ve.theme({"&":{color:zr,backgroundColor:qr},".cm-content":{caretColor:Xr},".cm-cursor, .cm-dropCursor":{borderLeftColor:Xr},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Yr},".cm-panels":{backgroundColor:Gr,color:zr},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:qr,color:Br,border:`none`},".cm-activeLineGutter":{backgroundColor:Kr},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:Jr},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Jr,borderBottomColor:Jr},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Kr,color:zr}}},{dark:!0}),Qr=at.define([{tag:E.keyword,color:Wr},{tag:[E.name,E.deleted,E.character,E.propertyName,E.macroName],color:Ir},{tag:[E.function(E.variableName),E.labelName],color:Vr},{tag:[E.color,E.constant(E.name),E.standard(E.name)],color:Ur},{tag:[E.definition(E.name),E.separator],color:zr},{tag:[E.typeName,E.className,E.number,E.changed,E.annotation,E.modifier,E.self,E.namespace],color:Fr},{tag:[E.operator,E.operatorKeyword,E.url,E.escape,E.regexp,E.link,E.special(E.string)],color:Lr},{tag:[E.meta,E.comment],color:Br},{tag:E.strong,fontWeight:`bold`},{tag:E.emphasis,fontStyle:`italic`},{tag:E.strikethrough,textDecoration:`line-through`},{tag:E.link,color:Br,textDecoration:`underline`},{tag:E.heading,fontWeight:`bold`,color:Ir},{tag:[E.atom,E.bool,E.special(E.variableName)],color:Ur},{tag:[E.processingInstruction,E.string,E.inserted],color:Hr},{tag:E.invalid,color:Rr}]),$r=[Zr,ae(Qr)],ei=function(e){return e.docTypeError=`docTypeError`,e.contextNotFound=`contextNotFound`,e.timerNotFound=`timerNotFound`,e.ctxCallOutOfScope=`ctxCallOutOfScope`,e.createNodeInParserFail=`createNodeInParserFail`,e.stackOverFlow=`stackOverFlow`,e.parserMatchError=`parserMatchError`,e.serializerMatchError=`serializerMatchError`,e.getAtomFromSchemaFail=`getAtomFromSchemaFail`,e.expectDomTypeError=`expectDomTypeError`,e.callCommandBeforeEditorView=`callCommandBeforeEditorView`,e.missingRootElement=`missingRootElement`,e.missingNodeInSchema=`missingNodeInSchema`,e.missingMarkInSchema=`missingMarkInSchema`,e.ctxNotBind=`ctxNotBind`,e.missingYjsDoc=`missingYjsDoc`,e.aiProviderError=`aiProviderError`,e.aiBuildContextError=`aiBuildContextError`,e}({}),ti=class extends Error{constructor(e,t,n){super(t,n),this.name=`MilkdownError`,this.code=e,n?.cause!==void 0&&(this.cause=n.cause)}},ni=(e,t)=>typeof t==`function`?`[Function]`:t,ri=e=>JSON.stringify(e,ni);function ii(e){return new ti(ei.docTypeError,`Doc type error, unsupported type: ${ri(e)}`)}function ai(e){return new ti(ei.contextNotFound,`Context "${e}" not found, do you forget to inject it?`)}function oi(e){return new ti(ei.timerNotFound,`Timer "${e}" not found, do you forget to record it?`)}function si(){return new ti(ei.ctxCallOutOfScope,`Should not call a context out of the plugin.`)}function ci(e,t,n){let r=`Cannot create node for ${`name`in e?e.name:e}`,i=e=>{if(e==null)return`null`;if(Array.isArray(e))return`[${e.map(i).join(`, `)}]`;if(typeof e==`object`)return`toJSON`in e&&typeof e.toJSON==`function`?JSON.stringify(e.toJSON()):`spec`in e?JSON.stringify(e.spec):JSON.stringify(e);if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return JSON.stringify(e);if(typeof e==`function`)return`[Function: ${e.name||`anonymous`}]`;try{return String(e)}catch{return`[Unserializable]`}},a=[[`[Description]`,r],[`[Attributes]`,t],[`[Content]`,(n??[]).map(e=>e?typeof e==`object`&&`type`in e?`${e}`:i(e):`null`)]].reduce((e,[t,n])=>{let r=`${t}: ${i(n)}.`;return e.concat(r)},[]);return new ti(ei.createNodeInParserFail,a.join(`
3
- `))}function li(){return new ti(ei.stackOverFlow,`Stack over flow, cannot pop on an empty stack.`)}function ui(e){return new ti(ei.parserMatchError,`Cannot match target parser for node: ${ri(e)}.`)}function di(e){return new ti(ei.serializerMatchError,`Cannot match target serializer for node: ${ri(e)}.`)}function fi(e,t){return new ti(ei.getAtomFromSchemaFail,`Cannot get ${e}: ${t} from schema.`)}function pi(e){return new ti(ei.expectDomTypeError,`Expect to be a dom, but get: ${ri(e)}.`)}function mi(){return new ti(ei.callCommandBeforeEditorView,`You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized`)}function hi(e){return new ti(ei.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${e}" in schema.`)}function gi(e){return new ti(ei.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${e}" in schema.`)}function _i(e){try{return ri(e)}catch{return`[Unserializable]`}}function vi(e){let t=e instanceof Error?e.message:_i(e);return new ti(ei.aiProviderError,`AI provider error: ${t}`,{cause:e})}function yi(e){let t=e instanceof Error?e.message:_i(e);return new ti(ei.aiBuildContextError,`AI buildContext failed: ${t}`,{cause:e})}var bi=class{constructor(){this.sliceMap=new Map,this.get=e=>{let t=typeof e==`string`?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);if(!t)throw ai(typeof e==`string`?e:e.name);return t},this.remove=e=>{let t=typeof e==`string`?[...this.sliceMap.values()].find(t=>t.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>typeof e==`string`?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}},xi=class{#e;#t;#n;constructor(e,t,n){this.#e=[],this.#n=()=>{this.#e.forEach(e=>e(this.#t))},this.set=e=>{this.#t=e,this.#n()},this.get=()=>this.#t,this.update=e=>{this.#t=e(this.#t),this.#n()},this.type=n,this.#t=t,e.set(n.id,this)}on(e){return this.#e.push(e),()=>{this.#e=this.#e.filter(t=>t!==e)}}once(e){let t=this.on(n=>{e(n),t()});return t}off(e){this.#e=this.#e.filter(t=>t!==e)}offAll(){this.#e=[]}},Si=class{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw si()}}create(e,t=this._defaultValue){return new xi(e,t,this)}},Ci=(e,t)=>new Si(e,t),wi=class{#e;#t;#n;#r;#i;#a;#o;constructor(e,t,n){this.#r=new Set,this.#i=new Set,this.#a=new Map,this.#o=new Map,this.read=()=>({metadata:this.#e,injectedSlices:[...this.#r].map(e=>({name:typeof e==`string`?e:e.name,value:this.#s(e)})),consumedSlices:[...this.#i].map(e=>({name:typeof e==`string`?e:e.name,value:this.#s(e)})),recordedTimers:[...this.#a].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#c(e)})),waitTimers:[...this.#o].map(([e,{duration:t}])=>({name:e.name,duration:t,status:this.#c(e)}))}),this.onRecord=e=>{this.#a.set(e,{start:Date.now(),duration:0})},this.onClear=e=>{this.#a.delete(e)},this.onDone=e=>{let t=this.#a.get(e);t&&(t.duration=Date.now()-t.start)},this.onWait=(e,t)=>{let n=Date.now();t.finally(()=>{this.#o.set(e,{duration:Date.now()-n})}).catch(console.error)},this.onInject=e=>{this.#r.add(e)},this.onRemove=e=>{this.#r.delete(e)},this.onUse=e=>{this.#i.add(e)},this.#s=e=>this.#t.get(e).get(),this.#c=e=>this.#n.get(e).status,this.#t=e,this.#n=t,this.#e=n}#s;#c},Ti=class e{#e;#t;#n;#r;constructor(t,n,r){this.produce=t=>t&&Object.keys(t).length?new e(this.#e,this.#t,{...t}):this,this.inject=(e,t)=>{let n=e.create(this.#e.sliceMap);return t!=null&&n.set(t),this.#r?.onInject(e),this},this.remove=e=>(this.#e.remove(e),this.#r?.onRemove(e),this),this.record=e=>(e.create(this.#t.store),this.#r?.onRecord(e),this),this.clearTimer=e=>(this.#t.remove(e),this.#r?.onClear(e),this),this.isInjected=e=>this.#e.has(e),this.isRecorded=e=>this.#t.has(e),this.use=e=>(this.#r?.onUse(e),this.#e.get(e)),this.get=e=>this.use(e).get(),this.set=(e,t)=>this.use(e).set(t),this.update=(e,t)=>this.use(e).update(t),this.timer=e=>this.#t.get(e),this.done=e=>{this.timer(e).done(),this.#r?.onDone(e)},this.wait=e=>{let t=this.timer(e).start();return this.#r?.onWait(e,t),t},this.waitTimers=async e=>{await Promise.all(this.get(e).map(e=>this.wait(e)))},this.#e=t,this.#t=n,this.#n=r,r&&(this.#r=new wi(t,n,r))}get meta(){return this.#n}get inspector(){return this.#r}},Ei=class{constructor(){this.store=new Map,this.get=e=>{let t=this.store.get(e.id);if(!t)throw oi(e.name);return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}},Di=class{#e;#t;#n;#r;#i;constructor(e,t){this.#e=null,this.#t=null,this.#r=`pending`,this.#i=null,this.start=()=>(this.#e??=new Promise((e,t)=>{this.#t=t=>{t instanceof CustomEvent&&t.detail.id===this.#n&&(this.#r=`resolved`,this.#a(),t.stopImmediatePropagation(),e())},this.#o(()=>{this.#r===`pending`&&(this.#r=`rejected`),this.#a(),t(Error(`Timing ${this.type.name} timeout.`))}),this.#r=`pending`,addEventListener(this.type.name,this.#t)}),this.#e),this.done=()=>{let e=new CustomEvent(this.type.name,{detail:{id:this.#n}});dispatchEvent(e)},this.#a=()=>{this.#i!==null&&(clearTimeout(this.#i),this.#i=null),this.#t&&removeEventListener(this.type.name,this.#t)},this.#o=e=>{this.#i=setTimeout(()=>{this.#i=null,e()},this.type.timeout)},this.#n=Symbol(t.name),this.type=t,e.set(t.id,this)}get status(){return this.#r}#a;#o},Oi=class{constructor(e,t=3e3){this.create=e=>new Di(e,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}},ki=(e,t=3e3)=>new Oi(e,t),Ai={};function ji(e,t){let n=t||Ai;return Mi(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function Mi(e,t,n){if(Pi(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Ni(e.children,t,n)}return Array.isArray(e)?Ni(e,t,n):``}function Ni(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Mi(e[i],t,n);return r.join(``)}function Pi(e){return!!(e&&typeof e==`object`)}var Fi=document.createElement(`i`);function Ii(e){let t=`&`+e+`;`;Fi.innerHTML=t;let n=Fi.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Li(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Ri(e,t){return e.length>0?(Li(e,e.length,0,t),e):t}var zi={}.hasOwnProperty;function Bi(e){let t={},n=-1;for(;++n<e.length;)Vi(t,e[n]);return t}function Vi(e,t){let n;for(n in t){let r=(zi.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){zi.call(r,a)||(r[a]=[]);let e=i[a];Hi(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Hi(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Li(e,0,0,r)}function Ui(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Wi(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Gi=na(/[A-Za-z]/),Ki=na(/[\dA-Za-z]/),qi=na(/[#-'*+\--9=?A-Z^-~]/);function Ji(e){return e!==null&&(e<32||e===127)}var Yi=na(/\d/),Xi=na(/[\dA-Fa-f]/),Zi=na(/[!-/:-@[-`{-~]/);function A(e){return e!==null&&e<-2}function Qi(e){return e!==null&&(e<0||e===32)}function $i(e){return e===-2||e===-1||e===32}var ea=na(/\p{P}|\p{S}/u),ta=na(/\s/);function na(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ra(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return $i(r)?(e.enter(n),s(r)):t(r)}function s(r){return $i(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}function ia(e,t,n,r,i,a){let o=0;return s;function s(t){return a>0&&$i(t)?(e.enter(r),c(t)):l(t)}function c(t){return $i(t)&&o<a?(e.consume(t),o++,c):(e.exit(r),l(t))}function l(e){return o>=i?t(e):n(e)}}var aa={tokenize:oa};function oa(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),ra(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return A(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var sa=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){ca(this,e,t,n,!1)}addBefore(e,t,n){ca(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function ca(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var la={tokenize:da},ua={tokenize:fa};function da(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;let c=new sa;return c.add(a+1,0,t.events.slice(n)),c.add(n,s-n,[]),c.consume(t.events),l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ua,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(ua,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return A(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;let l=new sa;l.add(a+1,0,t.events.slice(n)),l.add(n,e-n,[]),l.consume(t.events)}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function fa(e,t,n){return ra(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function pa(e){if(e===null||Qi(e)||ta(e))return 1;if(ea(e))return 2}function ma(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var ha={name:`attention`,resolveAll:ga,tokenize:_a};function ga(e,t){let n=-1,r;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){let i=n;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`attentionSequence`&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;let a=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};va(o,-a),va(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=Ri(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=Ri(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=Ri(r,ma(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=Ri(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=Ri(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),Li(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function _a(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=pa(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=pa(o),u=!l||l===2&&i||n.includes(o)&&o!==42&&o!==95,d=!i||i===2&&l||n.includes(r)&&r!==42&&r!==95;return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function va(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var ya={name:`autolink`,tokenize:ba};function ba(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return Gi(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Ki(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||Ki(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Ji(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):qi(t)?(e.consume(t),l):n(t)}function u(e){return Ki(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||Ki(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var xa={partial:!0,tokenize:Sa};function Sa(e,t,n){return r;function r(t){return $i(t)?ra(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||A(e)?t(e):n(e)}}var Ca={continuation:{tokenize:Ta},exit:Ea,name:`blockQuote`,tokenize:wa};function wa(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return $i(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Ta(e,t,n){let r=this;return i;function i(t){return $i(t)?ra(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Ca,t,n)(r)}}function Ea(e){e.exit(`blockQuote`)}var Da={name:`characterEscape`,tokenize:Oa};function Oa(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Zi(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var ka={name:`characterReference`,tokenize:Aa};function Aa(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=Ki,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Xi,u):(e.enter(`characterReferenceValue`),a=7,o=Yi,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Ki&&!Ii(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var ja={partial:!0,tokenize:Ma};function Ma(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Na={concrete:!0,name:`codeFenced`,tokenize:Pa};function Pa(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),$i(t)?ra(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||A(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(ja,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||A(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):$i(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),ra(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||A(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||A(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&$i(t)?ra(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||A(t)?e.check(ja,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||A(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),$i(t)?ra(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),$i(t)?ra(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||A(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var Fa={name:`codeIndented`,tokenize:La},Ia={partial:!0,tokenize:Ra};function La(e,t,n){return r;function r(t){return e.enter(`codeIndented`),ia(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):A(t)?e.attempt(Ia,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||A(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function Ra(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):A(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):ia(e,t,a,`linePrefix`,4,4)(o)}function a(e){return A(e)?i(e):n(e)}}var za={name:`codeText`,previous:Va,resolve:Ba,tokenize:Ha};function Ba(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Va(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Ha(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):A(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||A(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Ua=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Wa(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Wa(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Wa(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);Wa(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Wa(this.left,t.reverse())}}}};function Wa(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Ga(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Ua(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Ka(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Li(e,0,1/0,u.slice(0)),!l}function Ka(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var qa={resolve:Ya,tokenize:Xa},Ja={partial:!0,tokenize:Za};function Ya(e){return Ga(e),e}function Xa(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):A(t)?e.check(Ja,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Za(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ra(e,a,`linePrefix`)}function a(i){if(i===null||A(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Qa(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Ji(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||A(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Qi(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Ji(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function $a(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):A(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||A(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!$i(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function eo(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):A(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ra(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||A(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function to(e,t){let n;return r;function r(i){return A(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):$i(i)?ra(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var no={name:`definition`,tokenize:io},ro={partial:!0,tokenize:ao};function io(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return $a.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Wi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Qi(t)?to(e,l)(t):l(t)}function l(t){return Qa(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(ro,d,d)(t)}function d(t){return $i(t)?ra(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||A(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function ao(e,t,n){return r;function r(t){return Qi(t)?to(e,i)(t):n(t)}function i(t){return eo(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return $i(t)?ra(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||A(e)?t(e):n(e)}}var oo={name:`hardBreakEscape`,tokenize:so};function so(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return A(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var co={name:`headingAtx`,resolve:lo,tokenize:uo};function lo(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};Li(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function uo(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Qi(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||A(n)?(e.exit(`atxHeading`),t(n)):$i(n)?ra(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Qi(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var fo=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),po=[`pre`,`script`,`style`,`textarea`],mo={concrete:!0,name:`htmlFlow`,resolveTo:go,tokenize:_o},ho={partial:!0,tokenize:vo};function go(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function _o(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ue):Gi(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Gi(a)?(e.consume(a),i=4,r.interrupt?t:ue):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ue):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:re:m):n(i)}function h(t){return Gi(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Qi(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&po.includes(l)?(i=1,r.interrupt?t(s):re(s)):fo.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):re(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Ki(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:re):n(i)}function v(t){return $i(t)?(e.consume(t),v):w(t)}function y(t){return t===47?(e.consume(t),w):t===58||t===95||Gi(t)?(e.consume(t),b):$i(t)?(e.consume(t),y):w(t)}function b(t){return t===45||t===46||t===58||t===95||Ki(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):$i(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,ee):$i(t)?(e.consume(t),S):te(t)}function ee(t){return t===c?(e.consume(t),c=null,C):t===null||A(t)?n(t):(e.consume(t),ee)}function te(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Qi(t)?x(t):(e.consume(t),te)}function C(e){return e===47||e===62||$i(e)?y(e):n(e)}function w(t){return t===62?(e.consume(t),ne):n(t)}function ne(t){return t===null||A(t)?re(t):$i(t)?(e.consume(t),ne):n(t)}function re(t){return t===45&&i===2?(e.consume(t),oe):t===60&&i===1?(e.consume(t),se):t===62&&i===4?(e.consume(t),de):t===63&&i===3?(e.consume(t),ue):t===93&&i===5?(e.consume(t),le):A(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(ho,fe,T)(t)):t===null||A(t)?(e.exit(`htmlFlowData`),T(t)):(e.consume(t),re)}function T(t){return e.check(ja,ie,fe)(t)}function ie(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ae}function ae(t){return t===null||A(t)?T(t):(e.enter(`htmlFlowData`),re(t))}function oe(t){return t===45?(e.consume(t),ue):re(t)}function se(t){return t===47?(e.consume(t),o=``,ce):re(t)}function ce(t){if(t===62){let n=o.toLowerCase();return po.includes(n)?(e.consume(t),de):re(t)}return Gi(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ce):re(t)}function le(t){return t===93?(e.consume(t),ue):re(t)}function ue(t){return t===62?(e.consume(t),de):t===45&&i===2?(e.consume(t),ue):re(t)}function de(t){return t===null||A(t)?(e.exit(`htmlFlowData`),fe(t)):(e.consume(t),de)}function fe(n){return e.exit(`htmlFlow`),t(n)}}function vo(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(xa,t,n)}}var yo={name:`htmlText`,tokenize:bo};function bo(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Gi(t)?(e.consume(t),te):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Gi(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):A(t)?(o=d,se(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?oe(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):A(t)?(o=h,se(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?oe(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?oe(t):A(t)?(o=v,se(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):A(t)?(o=y,se(t)):(e.consume(t),y)}function b(e){return e===62?oe(e):y(e)}function x(t){return Gi(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Ki(t)?(e.consume(t),S):ee(t)}function ee(t){return A(t)?(o=ee,se(t)):$i(t)?(e.consume(t),ee):oe(t)}function te(t){return t===45||Ki(t)?(e.consume(t),te):t===47||t===62||Qi(t)?C(t):n(t)}function C(t){return t===47?(e.consume(t),oe):t===58||t===95||Gi(t)?(e.consume(t),w):A(t)?(o=C,se(t)):$i(t)?(e.consume(t),C):oe(t)}function w(t){return t===45||t===46||t===58||t===95||Ki(t)?(e.consume(t),w):ne(t)}function ne(t){return t===61?(e.consume(t),re):A(t)?(o=ne,se(t)):$i(t)?(e.consume(t),ne):C(t)}function re(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,T):A(t)?(o=re,se(t)):$i(t)?(e.consume(t),re):(e.consume(t),ie)}function T(t){return t===i?(e.consume(t),i=void 0,ae):t===null?n(t):A(t)?(o=T,se(t)):(e.consume(t),T)}function ie(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Qi(t)?C(t):(e.consume(t),ie)}function ae(e){return e===47||e===62||Qi(e)?C(e):n(e)}function oe(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function se(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ce}function ce(t){return $i(t)?ra(e,le,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):le(t)}function le(t){return e.enter(`htmlTextData`),o(t)}}var xo={name:`labelEnd`,resolveAll:To,resolveTo:Eo,tokenize:Do},So={tokenize:Oo},Co={tokenize:ko},wo={tokenize:Ao};function To(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Li(e,0,e.length,n),e}function Eo(e,t){let n=e.length,r=0,i,a,o;for(;n--;){let t=e[n][1];if(i){if(t.type===`link`||t.type===`labelLink`&&t._inactive)break;e[n][0]===`enter`&&t.type===`labelLink`&&(t._inactive=!0)}else if(a){if(e[n][0]===`enter`&&(t.type===`labelImage`||t.type===`labelLink`)&&!t._balanced&&(i=n,t.type!==`labelLink`)){r=2;break}}else t.type===`labelEnd`&&(a=n)}let s={type:e[i][1].type===`labelLink`?`link`:`image`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:`label`,start:{...e[i][1].start},end:{...e[a][1].end}},l={type:`labelText`,start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return o=[[`enter`,s,t],[`enter`,c,t]],o=Ri(o,e.slice(i+1,i+r+3)),o=Ri(o,[[`enter`,l,t]]),o=Ri(o,ma(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),o=Ri(o,[[`exit`,l,t],e[a-2],e[a-1],[`exit`,c,t]]),o=Ri(o,e.slice(a+1)),o=Ri(o,[[`exit`,s,t]]),Li(e,i,e.length,o),e}function Do(e,t,n){let r=this,i=r._labelStarts,a,o;if(i){for(;i.length>0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(Wi(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(So,u,o?u:d)(t):t===91?e.attempt(Co,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(wo,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function Oo(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Qi(t)?to(e,a)(t):a(t)}function a(t){return t===41?u(t):Qa(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Qi(t)?to(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?eo(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Qi(t)?to(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function ko(e,t,n){let r=this;return i;function i(t){return $a.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Wi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Ao(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var jo={name:`labelStartImage`,resolveAll:xo.resolveAll,tokenize:Mo};function Mo(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var No={name:`labelStartLink`,resolveAll:xo.resolveAll,tokenize:Po};function Po(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Fo={name:`lineEnding`,tokenize:Io};function Io(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),ra(e,t,`linePrefix`)}}var Lo={name:`thematicBreak`,tokenize:Ro};function Ro(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||A(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),$i(t)?ra(e,s,`whitespace`)(t):s(t))}}var zo={continuation:{tokenize:Uo},exit:Go,name:`list`,tokenize:Ho},Bo={partial:!0,tokenize:Ko},Vo={partial:!0,tokenize:Wo};function Ho(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Yi(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Lo,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Yi(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(xa,r.interrupt?n:u,e.attempt(Bo,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return $i(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Uo(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(xa,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ra(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!$i(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Vo,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,ra(e,e.attempt(zo,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Wo(e,t,n){let r=this;return ra(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Go(e){e.exit(this.containerState.type)}function Ko(e,t,n){let r=this;return ra(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!$i(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var qo={name:`setextUnderline`,resolveTo:Jo,tokenize:Yo};function Jo(e,t){let n=new sa,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function Yo(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),$i(t)?ra(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||A(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Xo={tokenize:Zo};function Zo(e){let t=this,n=e.attempt(xa,r,e.attempt(this.parser.constructs.flowInitial,i,ra(e,e.attempt(this.parser.constructs.flow,i,e.attempt(qa,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Qo={resolveAll:ns()},$o=ts(`string`),es=ts(`text`);function ts(e){return{resolveAll:ns(e===`text`?rs:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function ns(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function rs(e,t){let n=new sa,r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type===`lineEnding`)&&e[r-1][1].type===`data`){let i=e[r-1][1],a=t.sliceStream(i),o=a.length,s=-1,c=0,l;for(;o--;){let e=a[o];if(typeof e==`string`){for(s=e.length;e.charCodeAt(s-1)===32;)c++,s--;if(s)break;s=-1}else if(e===-2)l=!0,c++;else if(e!==-1){o++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(c=0),c){let a={type:r===e.length||l||c<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:o?s:i.start._bufferIndex+s,_index:i.start._index+o,line:i.end.line,column:i.end.column-c,offset:i.end.offset-c},end:{...i.end}};i.end={...a.start},i.start.offset===i.end.offset?Object.assign(i,a):n.add(r,0,[[`enter`,a,t],[`exit`,a,t]])}r++}return n.consume(e),e}var is=t({attentionMarkers:()=>ps,contentInitial:()=>ss,disable:()=>ms,document:()=>as,flow:()=>ls,flowInitial:()=>cs,insideSpan:()=>fs,string:()=>us,text:()=>ds}),as={42:zo,43:zo,45:zo,48:zo,49:zo,50:zo,51:zo,52:zo,53:zo,54:zo,55:zo,56:zo,57:zo,62:Ca},ss={91:no},cs={[-2]:Fa,[-1]:Fa,32:Fa},ls={35:co,42:Lo,45:[qo,Lo],60:mo,61:qo,95:Lo,96:Na,126:Na},us={38:ka,92:Da},ds={[-5]:Fo,[-4]:Fo,[-3]:Fo,33:jo,38:ka,42:ha,60:[ya,yo],91:No,92:[oo,Da],93:xo,95:ha,96:za},fs={null:[ha,Qo]},ps={null:[42,95]},ms={null:[]};function hs(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:ee(x),check:ee(S),consume:v,enter:y,exit:b,interrupt:ee(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Ri(o,e),g(),o[o.length-1]===null?(te(t,0),l.events=ma(a,l.events,l),l.events):[]}function f(e,t){return _s(p(e),t)}function p(e){return gs(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,w()}function g(){for(;r._index<o.length;){let e=o[r._index];if(typeof e==`string`){let t=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===t&&r._bufferIndex<e.length;)_(e.charCodeAt(r._bufferIndex))}else _(e)}}function _(e){u=u(e)}function v(e){A(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,w()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){te(e,t.from)}function S(e,t){t.restore()}function ee(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=C(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function te(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Li(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function C(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,w()}}function w(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function gs(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function _s(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
4
- `;break;case-3:o=`\r
5
- `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function vs(e){let t={constructs:Bi([is,...(e||{}).extensions||[]]),content:n(aa),defined:[],document:n(la),flow:n(Xo),lazy:{},string:n($o),text:n(es)};return t;function n(e){return n;function n(n){return hs(t,e,n)}}}function ys(e){for(;!Ga(e););return e}var bs=/[\0\t\n\r]/g;function xs(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i));let s=[],c=0;for(t=``,n&&=(i.charCodeAt(0)===65279&&c++,void 0);c<i.length;){bs.lastIndex=c;let n=bs.exec(i),a=n&&n.index!==void 0?n.index:i.length,o=i.charCodeAt(a);if(!n){t=i.slice(c);break}if(o===10&&c===a&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),c<a&&(s.push(i.slice(c,a)),e+=a-c),o){case 0:s.push(65533),e++;break;case 9:{let t=Math.ceil(e/4)*4;for(s.push(-2);e++<t;)s.push(-1);break}case 10:s.push(-4),e=1;break;default:r=!0,e=1}c=a+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Ss=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Cs(e){return e.replace(Ss,ws)}function ws(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return Ui(n.slice(t?2:1),t?16:10)}return Ii(n)||e}function Ts(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ds(e.position):`start`in e||`end`in e?Ds(e):`line`in e||`column`in e?Es(e):``}function Es(e){return Os(e&&e.line)+`:`+Os(e&&e.column)}function Ds(e){return Es(e&&e.start)+`-`+Es(e&&e.end)}function Os(e){return e&&typeof e==`number`?e:1}var ks={}.hasOwnProperty;function As(e,t,n){return typeof t!=`string`&&(n=t,t=void 0),js(n)(ys(vs(n).document().write(xs()(e,t,!0))))}function js(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Oe),autolinkProtocol:C,autolinkEmail:C,atxHeading:a(we),blockQuote:a(be),characterEscape:C,characterReference:C,codeFenced:a(xe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(xe,o),codeText:a(E,o),codeTextData:C,data:C,codeFlowValue:C,definition:a(Se),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Ce),hardBreakEscape:a(Te),hardBreakTrailing:a(Te),htmlFlow:a(Ee,o),htmlFlowData:C,htmlText:a(Ee,o),htmlTextData:C,image:a(De),label:o,link:a(Oe),listItem:a(Ae),listItemValue:f,listOrdered:a(ke,d),listUnordered:a(ke),paragraph:a(je),reference:pe,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(we),strong:a(Me),thematicBreak:a(Pe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ye,autolinkProtocol:ve,blockQuote:c(),characterEscapeValue:w,characterReferenceMarkerHexadecimal:he,characterReferenceMarkerNumeric:he,characterReferenceValue:ge,characterReference:_e,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:w,codeIndented:c(_),codeText:c(ae),codeTextData:w,data:w,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(re),hardBreakTrailing:c(re),htmlFlow:c(T),htmlFlowData:w,htmlText:c(ie),htmlTextData:w,image:c(se),label:le,labelText:ce,lineEnding:ne,link:c(oe),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:me,resourceDestinationString:ue,resourceTitleString:de,resource:fe,setextHeading:c(te),setextHeadingLineSequence:ee,setextHeadingText:S,strong:c(),thematicBreak:c()}};Ns(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];ks.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Fs).call(a,void 0,e[0])}for(r.position={start:Ms(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Ms(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Ms(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Fs).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Ts({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Ms(e.end)}function u(){return ji(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Wi(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function ee(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function te(){this.data.setextHeadingSlurpLineEnding=void 0}function C(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ne(),n.position={start:Ms(e.start),end:void 0},t.push(n)),this.stack.push(n)}function w(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Ms(e.end)}function ne(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Ms(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(C.call(this,e),w.call(this,e))}function re(){this.data.atHardBreak=!0}function T(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ie(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ae(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function oe(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function se(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ce(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Cs(t),n.identifier=Wi(t).toLowerCase()}function le(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ue(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function de(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function fe(){this.data.inReference=void 0}function pe(){this.data.referenceType=`collapsed`}function me(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Wi(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function he(e){this.data.characterReferenceType=e.type}function ge(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=Ui(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Ii(t);let i=this.stack[this.stack.length-1];i.value+=r}function _e(e){let t=this.stack.pop();t.position.end=Ms(e.end)}function ve(e){w.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ye(e){w.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function be(){return{type:`blockquote`,children:[]}}function xe(){return{type:`code`,lang:null,meta:null,value:``}}function E(){return{type:`inlineCode`,value:``}}function Se(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function Ce(){return{type:`emphasis`,children:[]}}function we(){return{type:`heading`,depth:0,children:[]}}function Te(){return{type:`break`}}function Ee(){return{type:`html`,value:``}}function De(){return{type:`image`,title:null,url:``,alt:null}}function Oe(){return{type:`link`,title:null,url:``,children:[]}}function ke(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Ae(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function je(){return{type:`paragraph`,children:[]}}function Me(){return{type:`strong`,children:[]}}function Ne(){return{type:`text`,value:``}}function Pe(){return{type:`thematicBreak`}}}function Ms(e){return{line:e.line,column:e.column,offset:e.offset}}function Ns(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Ns(e,r):Ps(e,r)}}function Ps(e,t){let n;for(n in t)if(ks.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Fs(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Ts({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ts({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Ts({start:t.start,end:t.end})+`) is still open`)}function Is(e){let t=this;t.parser=n;function n(n){return As(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}var Ls=(function(e){if(e==null)return Hs;if(typeof e==`function`)return Vs(e);if(typeof e==`object`)return Array.isArray(e)?Rs(e):zs(e);if(typeof e==`string`)return Bs(e);throw Error(`Expected function, string, or object as test`)});function Rs(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Ls(e[n]);return Vs(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function zs(e){let t=e;return Vs(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Bs(e){return Vs(t);function t(t){return t&&t.type===e}}function Vs(e){return t;function t(t,n,r){return!!(Us(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Hs(){return!0}function Us(e){return typeof e==`object`&&!!e&&`type`in e}var Ws=Ls([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]),Gs={}.hasOwnProperty;function Ks(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)Ks(e,t.extensions[n]);for(r in t)if(Gs.call(t,r))switch(r){case`extensions`:break;case`unsafe`:qs(e[r],t[r]);break;case`join`:qs(e[r],t[r]);break;case`handlers`:Js(e[r],t[r]);break;default:e.options[r]=t[r]}return e}function qs(e,t){t&&e.push(...t)}function Js(e,t){t&&Object.assign(e,t)}function Ys(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),Xs);return i(),o}function Xs(e,t,n){return`>`+(n?``:` `)+e}function Zs(e,t){return Qs(e,t.inConstruct,!0)&&!Qs(e,t.notInConstruct,!1)}function Qs(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function $s(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;){let e=n.unsafe[i];if(e.character===`
6
- `&&!e.before&&!e.after&&Zs(n.stack,e))return/[\t ]/.test(r.before)?``:` `}return`\\
7
- `}function ec(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function tc(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^\n\r ]/.test(e.value)||/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function nc(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function rc(e,t,n,r){let i=nc(n),a=e.value||``;if(tc(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,ic);return e(),t}let o=n.createTracker(r),s=i.repeat(Math.max(ec(a,i)+1,3)),c=n.enter(`codeFenced`),l=i==="`"?`GraveAccent`:`Tilde`,u=o.move(s);if(e.lang){let t=n.enter(`codeFencedLang${l}`);u+=o.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...o.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${l}`);u+=o.move(` `),u+=o.move(n.safe(e.meta,{before:u,after:`
8
- `,encode:["`"],...o.current()})),t()}return u+=o.move(`
9
- `),a&&(u+=o.move(a+`
10
- `)),u+=o.move(s),c(),u}function ic(e,t,n){return(n?``:` `)+e}function ac(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function oc(e,t,n,r){let i=ac(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
11
- `,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function sc(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}cc.attention=lc,cc.peek=uc;function cc(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function lc(e,t){return{construct:`emphasis`,markers:sc(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[1]}}function uc(e,t,n){return n.options.emphasis||`*`}function dc(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function fc(e){return e}var pc=[],mc=`skip`;function hc(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Ls(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+fc(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=pc,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=gc(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function gc(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?pc:[e]}function _c(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),hc(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}function vc(e,t){let n=!1;return _c(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&ji(e)&&(t.options.setext||n))}function yc(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(vc(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
12
- `,after:`
13
- `});return r(),t(),o+`
14
- `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
15
- `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
16
- `,...a.current()}),u=l.charCodeAt(0);return(u===9||u===32)&&(l=dc(u)+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}bc.peek=xc;function bc(e){return e.value||``}function xc(){return`<`}Sc.peek=Cc;function Sc(e,t,n,r){let i=ac(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function Cc(){return`!`}wc.peek=Tc;function wc(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Tc(){return`!`}Ec.peek=Dc;function Ec(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e);if(!e.atBreak)continue;let i;for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Dc(){return"`"}function Oc(e,t){let n=ji(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][+\-.a-z]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}kc.peek=Ac;function kc(e,t,n,r){let i=ac(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r);if(Oc(e,n)){let t=n.stack;n.stack=t.filter(function(e){return e!==`phrasing`});let r=n.enter(`autolink`),i=o.move(`<`);return i+=o.move(n.containerPhrasing(e,{before:i,after:`>`,...o.current()})),i+=o.move(`>`),r(),n.stack=t,i}let s=n.enter(`link`),c=n.enter(`label`),l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Ac(e,t,n){return Oc(e,n)?`<`:`[`}jc.peek=Mc;function jc(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=u.filter(function(e){return e!==`phrasing`}),o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Mc(){return`[`}function Nc(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Pc(e){let t=Nc(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Fc(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Ic(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Lc(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Fc(n):Nc(n),s=e.ordered?o===`.`?`)`:`.`:Pc(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Ic(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function Rc(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function zc(e,t,n,r){let i=Rc(n),a=n.bulletCurrent||Nc(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Bc(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}function Vc(e,t,n,r){if(!e.children.some(function(e){return Ws(e)}))return n.containerFlow(e,r);let i=n.enter(`phrasing`),a=n.containerPhrasing(e,r);return i(),a}function Hc(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Uc.attention=Wc,Uc.peek=Gc;function Uc(e,t,n,r){let i=n.enter(`phrasing`),a=n.containerPhrasing({type:`root`,children:[e]},r);return i(),a}function Wc(e,t){return{construct:`strong`,markers:Hc(t)===`*`?[`*`,`_`]:[`_`,`*`],sizes:[2]}}function Gc(e,t,n){return n.options.strong||`*`}function Kc(e,t,n,r){let i=t?t.children:[],a=i.indexOf(e);return n.safe(e.value,{...r,afterNode:i[a+1],beforeNode:i[a-1]})}function qc(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Jc(e,t,n){let r=(Ic(n)+(n.options.ruleSpaces?` `:``)).repeat(qc(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Yc={blockquote:Ys,break:$s,code:rc,definition:oc,emphasis:cc,hardBreak:$s,heading:yc,html:bc,image:Sc,imageReference:wc,inlineCode:Ec,link:kc,linkReference:jc,list:Lc,listItem:zc,paragraph:Bc,root:Vc,strong:Uc,text:Kc,thematicBreak:Jc};function Xc(e){if(e.charCodeAt(0)!==60)return;let t=e.charCodeAt(1);if(t===33){let t=e.charCodeAt(2);return t===45?2:t===91?5:Gi(t)?4:void 0}if(t===63)return 3;let n=t===47,r=n?2:1,i=r,a=e.charCodeAt(i);if(!Gi(a))return;for(;a===45||Ki(a);)a=e.charCodeAt(++i);let o=e.slice(r,i).toLowerCase();return!n&&a!==47&&po.includes(o)?1:fo.includes(o)?6:7}var Zc=[Qc];function Qc(e,t,n,r){if(t.type===`code`&&tc(t,r)&&(e.type===`list`||e.type===t.type&&tc(e,r)))return!1;if(`spread`in n&&typeof n.spread==`boolean`){if(e.type===`paragraph`&&(e.type===t.type||t.type===`definition`||t.type===`heading`&&vc(t,r)))return;if(e.type===`html`){let t=Xc(e.value);if(t===void 0||t===6||t===7)return 1}if(e.type===`paragraph`&&t.type===`html`){let e=Xc(t.value);if(e===void 0||e===7)return 1}return+!!n.spread}}for(var $c=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],el=[{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`\r`,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:`
17
- `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:`\r`,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:`\r`,after:`\\r`,inConstruct:`phrasing`},{character:`
18
- `,before:`\\n`,inConstruct:`phrasing`},{character:`
19
- `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`!`,after:`\\[`,inConstruct:`phrasing`,notInConstruct:$c},{character:`"`,inConstruct:`titleQuote`},{atBreak:!0,character:`#`},{character:`#`,inConstruct:`headingAtx`,after:`(?:[\r
20
- ]|$)`},{character:`&`,after:`[#A-Za-z]`,inConstruct:`phrasing`},{character:`'`,inConstruct:`titleApostrophe`},{character:`(`,inConstruct:`destinationRaw`},{before:`\\]`,character:`(`,inConstruct:`phrasing`,notInConstruct:$c},{atBreak:!0,before:`\\d+`,character:`)`},{character:`)`,inConstruct:`destinationRaw`},{atBreak:!0,character:`*`,after:`(?:[ \r
21
- *])`},{character:`*`,inConstruct:`phrasing`,notInConstruct:$c},{atBreak:!0,character:`+`,after:`(?:[ \r
22
- ])`},{atBreak:!0,character:`-`,after:`(?:[ \r
23
- -])`},{atBreak:!0,before:`\\d+`,character:`.`,after:`(?:[ \r
24
- ]|$)`},{atBreak:!0,character:`<`,after:`[!/?A-Za-z]`},{character:`<`,after:`[!/?A-Za-z]`,inConstruct:`phrasing`,notInConstruct:$c},{character:`<`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`=`},{atBreak:!0,character:`>`},{character:`>`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`[`},{character:`[`,inConstruct:`phrasing`,notInConstruct:$c},{character:`[`,inConstruct:[`label`,`reference`]},{character:`\\`,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:`]`,inConstruct:[`label`,`reference`]},{atBreak:!0,character:`_`},{character:`_`,inConstruct:`phrasing`,notInConstruct:$c},{atBreak:!0,character:"`"},{character:"`",inConstruct:[`codeFencedLangGraveAccent`,`codeFencedMetaGraveAccent`]},{character:"`",inConstruct:`phrasing`,notInConstruct:$c},{atBreak:!0,character:`~`},{character:`<`,inConstruct:`autolink`},{character:`>`,inConstruct:`autolink`},{character:``,inConstruct:`autolink`}],tl=-1;++tl<33;)el.push({character:String.fromCharCode(tl),inConstruct:`autolink`});function nl(e){return e.label||!e.identifier?e.label||``:Cs(e.identifier)}function rl(e){if(!e._compiled){let t=(e.atBreak?`[\\r\\n][\\t ]*`:``)+(e.before?`(?:`+e.before+`)`:``);e._compiled=RegExp((e.beforeNode?`^`:t?`(`+t+`)`:``)+(/[$()*+.?[\\\]^{|}]/.test(e.character)?`\\`:``)+e.character+(e.afterNode?`$`:e.after?`(?:`+e.after+`)`:``),e.unicode?`gu`:`g`)}return e._compiled}function il(e){let t=e.codePointAt(0);return t===void 0?``:String.fromCodePoint(t)}function al(e){let t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function ol(e,t,n){let r=pa(e),i=pa(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}var sl=new Map([[`*`,!1],[`_`,!0]]);function cl(e,t,n){let r=new Set;for(let i of e){let e=n.get(i);if(e&&i.attention&&t.some(e=>e.attention===i.attention))for(let t of e.tokens)r.add(t.attention)}let i=[];for(let t of e)t.attention&&r.delete(t.attention)&&i.push(t.attention);return i.reverse(),i}function ll(e,t,n){let r=[],i=new Map,a=new Map,o=0;for(;o<e.length;){if(!e[o].attention){o++;continue}let s=e[o].value.charAt(0),c=sl.get(s),l=o+1;for(;l<e.length&&e[l].attention&&e[l].value.charAt(0)===s;)l++;let u=o?e[o-1].value:t,d=pa(u.charCodeAt(u.length-1)),f=pa((l<e.length?e[l].value:n).charCodeAt(0)),p=!f||f===2&&!!d,m=!d||d===2&&!!f,h={tokens:e.slice(o,l),markers:[],start:0,end:0,open:c?p&&(!!d||!m):p,close:c?m&&(!!f||!p):m,split:c!==void 0};for(let e of h.tokens){i.set(e,[...h.tokens]),a.set(e,h);let t=e.value.length;for(;t--;)h.markers.push(e)}h.end=h.markers.length,r.push(h),o=l}for(pl(r,i),o=-1;++o<e.length;){let t=i.get(e[o]);if(t)return{attention:cl(e,t,a),index:o}}}function ul(e,t,n){return _l(hl(e,t,n),n.before,n.after)}function dl(e,t){let n=e[t?0:e.length-1];if(!n||n.attention)return;let r=t?il(n.value):al(n.value),i=dc(r.codePointAt(0));n.value=t?i+n.value.slice(r.length):n.value.slice(0,n.value.length-r.length)+i}function fl(e,t,n,r,i){for(let a of n.attention){let o=t.get(a)||a.sequences[0];for(let s of a.sequences){if(s===o)continue;let c=new Map(t);c.set(a,s);let l=gl(e,c,r,i),u=ll(l,r,i);if(!u||u.index>n.index)return{chosen:c,mistake:u,tokens:l}}}}function pl(e,t){let n=0;for(;n<e.length;){let r=e[n],i=r.tokens[0].value.charAt(0),a=r.end-r.start,o=r.close&&a?n:0;for(;o--;){let n=e[o],s=n.end-n.start;if(n.tokens[0].value.charAt(0)===i&&n.open&&s&&(r.split?!((n.close||r.open)&&a%3)||(s+a)%3:s===n.markers.length&&s===a)){let e=r.split?s>1&&a>1?2:1:a,i=n.markers.slice(n.end-e,n.end),o=r.markers.slice(r.start,r.start+e),c=i[0],l=o[0];if(c===i[e-1]&&c.value.length===e&&l===o[e-1]&&l.value.length===e&&c.attention===l.attention)t.delete(c),t.delete(l);else{let e=[...new Set([...i,...o])];for(let n of e){let r=t.get(n);r&&r.push(...e)}}n.end-=e,r.start+=e;break}}(o===-1||r.start===r.end)&&n++}}function ml(e,t,n){if(t.length===0)throw Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(n.length===0)throw Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(let t of n)if(!Number.isSafeInteger(t)||t<1)throw Error("Cannot serialize `"+e+"` as attention with `"+t+"` as size, expected positive integer");let r=[];for(let i of t){if(i.length!==1)throw Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected a single ascii character");if(!Zi(i.charCodeAt(0)))throw Error("Cannot serialize `"+e+"` as attention with `"+i+"` as marker, expected ascii punctuation");for(let e of n)r.push(i.repeat(e))}return r}function hl(e,t,n){let r=t.indexStack,i=e.children||[],a=[],o=-1,s=n.before;r.push(-1);let c=t.createTracker(n);for(;++o<i.length;){let l=i[o],u;if(r[r.length-1]=o,o+1<i.length){let n=t.handle.handlers[i[o+1].type];n&&n.peek&&(n=n.peek),u=n?il(n(i[o+1],e,t,{before:``,after:``,...c.current()})):``}else u=n.after;let d=a[a.length-1];typeof d==`string`&&(s===`\r`||s===`
25
- `)&&l.type===`html`&&Xc(l.value)!==7&&(a[a.length-1]=d.replace(/(\r?\n|\r)$/,` `),s=` `,c=t.createTracker(n),c.move(_l(a,n.before,n.after)));let f=t.handle.handlers[l.type];if(f&&f.attention){let{construct:e,markers:n,sizes:r}=f.attention(l,t),i=ml(l.type,n,r),o=i[0],u=t.enter(e);c.move(o);let d=hl(l,t,{...c.current(),before:o,after:o});c.move(_l(d,o,o)),c.move(o),u(),a.push({children:d,sequences:i}),s=o.charAt(o.length-1)}else{let n=t.handle(l,e,t,{...c.current(),after:u,before:s});if(!n)continue;c.move(n),a.push(n),s=al(n)}}return r.pop(),a}function gl(e,t,n,r){let i=[],a,o=al(n),s=-1;for(;++s<e.length;){let n=e[s];if(typeof n==`string`){let e={value:n,attention:void 0};a&&a===il(n)&&dl([e],!0),a=void 0,i.push(e),e.value&&(o=al(e.value));continue}let c=t.get(n)||n.sequences[0],l=c.charAt(0),u=e[s+1],d=o,f=il(u===void 0?r:typeof u==`string`?u:t.get(u)||u.sequences[0]),p=gl(n.children,t,c,c),m=p.length>0?p[0].value:``,h=ol(d.charCodeAt(d.length-1),m.charCodeAt(0),l);h.inside&&dl(p,!0);let g=p.length>0?al(p[p.length-1].value):``,_=ol(f.charCodeAt(0),g.charCodeAt(g.length-1),l);_.inside&&dl(p,!1),h.outside&&d!==`
26
- `&&d!==`\r`&&dl(i,!1),_.outside&&(a=f),i.push({value:c,attention:n},...p,{value:c,attention:n}),o=c.charAt(c.length-1)}return i}function _l(e,t,n){let r=new Map,i=gl(e,r,t,n),a=i,o=ll(a,t,n);for(;o;){let s=fl(e,r,o,t,n);if(!s){a=i;break}r=s.chosen,a=s.tokens,o=s.mistake}let s=``;for(let e of a)s+=e.value;return s}function vl(e,t,n){let r=t.indexStack,i=e.children||[],a=t.createTracker(n),o=[],s=-1;for(r.push(-1);++s<i.length;){let n=i[s];r[r.length-1]=s,o.push(a.move(t.handle(n,e,t,{before:`
27
- `,after:`
28
- `,...a.current()}))),n.type!==`list`&&(t.bulletLastUsed=void 0),s<i.length-1&&o.push(a.move(yl(n,i[s+1],e,t)))}return r.pop(),o.join(``)}function yl(e,t,n,r){let i=r.join.length;for(;i--;){let a=r.join[i](e,t,n,r);if(a===!0||a===1)break;if(typeof a==`number`)return`
29
- `.repeat(1+a);if(a===!1)return`
30
-
31
- <!---->
32
-
33
- `}return`
34
-
35
- `}var bl=/\r?\n|\r/g;function xl(e,t){let n=[],r=0,i=0,a;for(;a=bl.exec(e);)o(e.slice(r,a.index)),n.push(a[0]),r=a.index+a[0].length,i++;return o(e.slice(r)),n.join(``);function o(e){n.push(t(e,i,!e))}}var Sl={}.hasOwnProperty;function Cl(e,t,n){let r=(n.before||``)+(t||``)+(n.after||``),i=[],a=[],o={},s=e.stack.includes(`autolink`),c=n.before?n.before.length:0,l=r.length-(n.after?n.after.length:0),u=-1;for(;++u<e.unsafe.length;){let t=e.unsafe[u];if(!Zs(e.stack,t)||!wl(t.beforeNode,n.beforeNode)||!wl(t.afterNode,n.afterNode))continue;let a=e.compilePattern(t),s=t.beforeNode?c:0,d=r.slice(s,t.afterNode?l:void 0),f;for(;f=a.exec(d);){let e=`before`in t||!!t.atBreak,n=`after`in t,r=s+f.index+(e?f[1].length:0);Sl.call(o,r)?(o[r].before&&!e&&(o[r].before=!1),o[r].after&&!n&&(o[r].after=!1)):(i.push(r),o[r]={before:e,after:n})}}i.sort(Tl);let d=c;for(u=-1;++u<i.length;){let e=i[u];if(!(e<d||e>=l)){if(r.charAt(e)===`_`&&e>0&&pa(r.charCodeAt(e-1))===void 0&&!Sl.call(o,e-1)&&!(e-1===c&&/[*_]/.test(r.charAt(c-1)))){let t=e+1;for(;t<l&&r.charAt(t)===`_`;)t++;let n=t-e-1;if(i[u+n]===t-1&&t<r.length&&pa(r.charCodeAt(t))===void 0&&!Sl.call(o,t)&&!(t===l-1&&/[*_]/.test(r.charAt(l)))){u+=n;continue}}if(!(e+1<l&&i[u+1]===e+1&&o[e].after&&!o[e+1].before&&!o[e+1].after||i[u-1]===e-1&&o[e].before&&!o[e-1].before&&!o[e-1].after)){if(d!==e){let t=r.slice(d,e);a.push(s?t:El(t,`\\`))}d=e,s?(a.push(`%`+r.charCodeAt(e).toString(16).toUpperCase().padStart(2,`0`)),d++):/[!-/:-@[-`{-~]/.test(r.charAt(e))&&(!n.encode||!n.encode.includes(r.charAt(e)))?a.push(`\\`):(a.push(dc(r.charCodeAt(e))),d++)}}}let f=r.slice(d,l);return a.push(s?f:El(f,n.after)),a.join(``)}function wl(e,t){return e?t?typeof e==`string`?e===t.type:e.includes(t.type):!1:!0}function Tl(e,t){return e-t}function El(e,t){let n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],a=e+t,o=-1,s=0,c;for(;c=n.exec(a);)r.push(c.index);for(;++o<r.length;)s!==r[o]&&i.push(e.slice(s,r[o])),i.push(`\\`),s=r[o];return i.push(e.slice(s)),i.join(``)}function Dl(e){let t=e||{},n=t.now||{},r=t.lineShift||0,i=n.line||1,a=n.column||1;return{move:c,current:o,shift:s};function o(){return{now:{line:i,column:a},lineShift:r}}function s(e){r+=e}function c(e){let t=e||``,n=t.split(/\r?\n|\r/g),o=n[n.length-1];return i+=n.length-1,a=n.length===1?a+o.length:1+o.length+r,t}}function Ol(e,t){let n=t||{},r={associationId:nl,bulletCurrent:void 0,bulletLastUsed:void 0,containerPhrasing:Ml,containerFlow:Nl,createTracker:Dl,compilePattern:rl,enter:a,handlers:{...Yc},handle:void 0,indentLines:xl,indexStack:[],join:[...Zc],options:{},safe:Pl,stack:[],unsafe:[...el]};Ks(r,n),r.options.tightDefinitions&&r.join.push(jl),r.handle=wt(`type`,{invalid:kl,unknown:Al,handlers:r.handlers});let i=r.handle(Ws(e)?{type:`root`,children:[e]}:e,void 0,r,{before:`
36
- `,after:`
37
- `,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
38
- `),i;function a(e){return r.stack.push(e),t;function t(){r.stack.pop()}}}function kl(e){throw Error("Cannot handle value `"+e+"`, expected node")}function Al(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function jl(e,t){if(e.type===`definition`&&e.type===t.type)return 0}function Ml(e,t){return ul(e,this,t)}function Nl(e,t){return vl(e,this,t)}function Pl(e,t){return Cl(this,e,t)}function Fl(e){let t=this;t.compiler=n;function n(n){return Ol(n,{...t.data(`settings`),...e,extensions:t.data(`toMarkdownExtensions`)||[]})}}function Il(e){if(e)throw e}var Ll=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function Rl(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function zl(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Bl(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Bl(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Vl=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ts(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Vl.prototype.file=``,Vl.prototype.name=``,Vl.prototype.reason=``,Vl.prototype.message=``,Vl.prototype.stack=``,Vl.prototype.column=void 0,Vl.prototype.line=void 0,Vl.prototype.ancestors=void 0,Vl.prototype.cause=void 0,Vl.prototype.fatal=void 0,Vl.prototype.place=void 0,Vl.prototype.ruleId=void 0,Vl.prototype.source=void 0;var Hl={basename:Ul,dirname:Wl,extname:Gl,join:Kl,sep:`/`};function Ul(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Yl(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Wl(e){if(Yl(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Gl(e){Yl(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Kl(...e){let t=-1,n;for(;++t<e.length;)Yl(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:ql(n)}function ql(e){Yl(e);let t=e.codePointAt(0)===47,n=Jl(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Jl(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Yl(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Xl={cwd:Zl};function Zl(){return`/`}function Ql(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function $l(e){if(typeof e==`string`)e=new URL(e);else if(!Ql(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return eu(e)}function eu(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var tu=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],nu=class{constructor(e){let t;t=e?Ql(e)?{path:e}:typeof e==`string`||ou(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Xl.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<tu.length;){let e=tu[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)tu.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Hl.basename(this.path):void 0}set basename(e){iu(e,`basename`),ru(e,`basename`),this.path=Hl.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Hl.dirname(this.path):void 0}set dirname(e){au(this.basename,`dirname`),this.path=Hl.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Hl.extname(this.path):void 0}set extname(e){if(ru(e,`extname`),au(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Hl.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Ql(e)&&(e=$l(e)),iu(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Hl.basename(this.path,this.extname):void 0}set stem(e){iu(e,`stem`),ru(e,`stem`),this.path=Hl.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Vl(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function ru(e,t){if(e&&e.includes(Hl.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Hl.sep+"`")}function iu(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function au(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function ou(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var su=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),cu=e(Ll(),1),lu={}.hasOwnProperty,uu=new class e extends su{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=zl()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,cu.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(pu(`data`,this.frozen),this.namespace[e]=t,this):lu.call(this.namespace,e)&&this.namespace[e]||void 0:e?(pu(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=gu(e),n=this.parser||this.Parser;return du(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),du(`process`,this.parser||this.Parser),fu(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=gu(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);vu(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),du(`processSync`,this.parser||this.Parser),fu(`processSync`,this.compiler||this.Compiler),this.process(e,r),hu(`processSync`,`process`,t),n;function r(e,r){t=!0,Il(e),n=r}}run(e,t,n){mu(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=gu(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),hu(`runSync`,`run`,n),r;function i(e,t){Il(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=gu(t),r=this.compiler||this.Compiler;return fu(`stringify`,r),mu(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(pu(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,cu.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];Rl(o)&&Rl(r)&&(r=(0,cu.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function du(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function fu(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function pu(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function mu(e){if(!Rl(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function hu(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function gu(e){return _u(e)?e:new nu(e)}function _u(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function vu(e){return typeof e==`string`||yu(e)}function yu(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function bu(e){this.content=e}bu.prototype={constructor:bu,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new bu(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new bu(n)},addToStart:function(e,t){return new bu([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new bu(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new bu(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=bu.from(e),e.size?new bu(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=bu.from(e),e.size?new bu(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=bu.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},bu.from=function(e){if(e instanceof bu)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new bu(t)};function xu(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&wu(e.charCodeAt(r-1))&&Cu(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=xu(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Su(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&wu(e.charCodeAt(i-1))&&Cu(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Su(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Cu(e){return e>=56320&&e<57344}function wu(e){return e>=55296&&e<56320}var j=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return xu(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Su(this,e,t,n)}findIndex(e){if(e==0)return Eu(0,e);if(e==this.size)return Eu(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Eu(t+1,i):Eu(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};j.empty=new j([],0);var Tu={index:0,offset:0};function Eu(e,t){return Tu.index=e,Tu.offset=t,Tu}function Du(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Du(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Du(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Ou=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Du(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);return n.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Ou.none=[];var ku=class extends Error{},M=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=ju(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Au(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(j.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};M.empty=new M(j.empty,0,0);function Au(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Au(a.content,t-i-1,n-i-1)))}function ju(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=ju(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function Mu(e,t,n){if(n.openStart>e.depth)throw new ku(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ku(`Inconsistent open depths`);return Nu(e,t,n,0)}function Nu(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=Nu(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}if(!n.content.size)return Ru(a,Bu(e,t,r));if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return Ru(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}{let{start:i,end:o}=Vu(n,e);return Ru(a,zu(e,i,o,t,r))}}function Pu(e,t){if(!t.type.compatibleContent(e.type))throw new ku(`Cannot join `+t.type.name+` onto `+e.type.name)}function Fu(e,t,n){let r=e.node(n);return Pu(r,t.node(n)),r}function Iu(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Lu(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(Iu(e.nodeAfter,r),a++));for(let e=a;e<o;e++)Iu(i.child(e),r);t&&t.depth==n&&t.textOffset&&Iu(t.nodeBefore,r)}function Ru(e,t){if(!e.type.validContent(t))throw new ku(`Invalid content for node `+e.type.name);return e.copy(t)}function zu(e,t,n,r,i){let a=e.depth>i&&Fu(e,t,i+1),o=r.depth>i&&Fu(n,r,i+1),s=[];return Lu(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(Pu(a,o),Iu(Ru(a,zu(e,t,n,r,i+1)),s)):(a&&Iu(Ru(a,Bu(e,t,i+1)),s),Lu(t,n,i,s),o&&Iu(Ru(o,Bu(n,r,i+1)),s)),Lu(r,null,i,s),new j(s)}function Bu(e,t,n){let r=[];return Lu(null,e,n,r),e.depth>n&&Iu(Ru(Fu(e,t,n+1),Bu(e,t,n+1)),r),Lu(t,null,n,r),new j(r)}function Vu(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(j.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Hu=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ou.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Ku(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Gu.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Gu.set(t,r=new Uu);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Wu,i}},Uu=class{constructor(){this.elts=[],this.i=0}},Wu=12,Gu=new WeakMap,Ku=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},qu=Object.create(null),Ju=class e{constructor(e,t,n,r=Ou.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||j.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Du(this.attrs,t||e.defaultAttrs||qu)&&Ou.sameSet(this.marks,n||Ou.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return M.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new M(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Mu(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Hu.resolveCached(this,e)}resolveNoCache(e){return Hu.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),Xu(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=j.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),Zu(this.type.attrs,this.attrs,`node`,this.type.name);let e=Ou.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];Zu(n.type.attrs,n.attrs,`mark`,n.type.name),e=n.addToSet(e)}if(!Ou.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=j.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,r,n)}};Ju.prototype.text=void 0;var Yu=class e extends Ju{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function Xu(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}function Zu(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}var Qu=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new $u(t,n);if(r.next==null)return e.empty;let i=ed(r);r.next&&r.err(`Unexpected trailing text`);let a=ud(sd(i));return dd(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return j.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
39
- `)}};Qu.empty=new Qu(!0);var $u=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function ed(e){let t=[];do t.push(td(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function td(e){let t=[];do t.push(nd(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function nd(e){let t=od(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=id(e,t);else break;return t}function rd(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function id(e,t){let n=rd(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:rd(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function ad(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function od(e){if(e.eat(`(`)){let t=ed(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=ad(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function sd(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function cd(e,t){return t-e}function ld(e,t){let n=[];return r(t),n.sort(cd);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function ud(e){let t=Object.create(null);return n(ld(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);ld(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Qu(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(cd);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function dd(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function fd(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function pd(e,t){let n=Object.create(null);for(let r in e){let i=e[r],a=t&&t[r];if(a===void 0){if(i.hasDefault)a=i.default;else throw RangeError(`No value supplied for attribute `+r)}else i.validate&&i.validate(a);n[r]=a}return n}function md(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new _d(e,r,t[r]);return n}var hd=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=md(e,n.attrs),this.defaultAttrs=fd(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Qu.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:pd(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new Ju(this,this.computeAttrs(e),j.from(t),Ou.setFrom(n))}createChecked(e=null,t,n){return t=j.from(t),this.checkContent(t),new Ju(this,this.computeAttrs(e),t,Ou.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=j.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(j.empty,!0);return i?new Ju(this,e,t.append(i),Ou.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:Ou.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function gd(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var _d=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?gd(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},vd=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=md(e,r.attrs),this.excluded=null;let i=fd(this.attrs);this.instance=i?new Ou(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ou(this,pd(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}},yd=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=bu.from(e.nodes),t.marks=bu.from(e.marks||{}),this.nodes=hd.compile(this.spec.nodes,this),this.marks=vd.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Qu.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?bd(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:bd(this,n.split(` `))}this.nodeFromJSON=e=>Ju.fromJSON(this,e),this.markFromJSON=e=>Ou.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof hd))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Yu(n,n.defaultAttrs,e,Ou.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function bd(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function xd(e){return e.tag!=null}function Sd(e){return e.style!=null}var Cd=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(xd(e))this.tags.push(e);else if(Sd(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Md(this,t,!1);return n.addAll(e,Ou.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Md(this,t,!0);return n.addAll(e,Ou.none,t.from,t.to),M.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Pd(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Fd(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Fd(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},wd={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Td={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ed={ol:!0,ul:!0},Dd=1,Od=2,kd=4;function Ad(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Dd:0)|(t===`full`?Od:0)}var jd=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=Ou.none,this.match=i||(a&kd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(j.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Dd)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=j.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(j.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!wd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Md=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Ad(null,t.preserveWhitespace,0)|(n?kd:0);i=r?new jd(r.type,r.attrs,Ou.none,!0,t.topMatch||r.type.contentMatch,a):n?new jd(null,null,Ou.none,!0,null,a):new jd(e.schema.topNodeType,null,Ou.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Od?`full`:this.localPreserveWS||(r.options&Dd)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
40
- `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Ed.hasOwnProperty(a)&&this.parser.normalizeLists&&Nd(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Td.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(wd.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
41
- `),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node){if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=Ou.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Id(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Ad(e,i,a.options);a.options&kd&&a.content.length==0&&(o|=kd);let s=Ou.none;return n=n.filter(t=>!(a.type?a.type.allowsMarkType(t.type):Id(t.type,e))||(s=t.addToSet(s),!1)),this.nodes.push(new jd(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Dd);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Nd(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Ed.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Pd(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Fd(e){let t={};for(let n in e)t[n]=e[n];return t}function Id(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Ld=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=zd(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return zd(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Ud(zd(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Ud(zd(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Ud(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=Rd(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return Rd(e.marks)}};function Rd(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function zd(e){return e.document||window.document}var Bd=new WeakMap;function Vd(e){let t=Bd.get(e);return t===void 0&&Bd.set(e,t=Hd(e)),t}function Hd(e){let t=null;function n(e){if(e&&typeof e==`object`){if(Array.isArray(e)){if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t])}else for(let t in e)n(e[t])}}return n(e),t}function Ud(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=Vd(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Ud(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Wd=65535,Gd=2**16;function Kd(e,t){return e+t*Gd}function qd(e){return e&Wd}function Jd(e){return(e-(e&Wd))/Gd}var Yd=1,Xd=2,Zd=4,Qd=8,$d=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Qd)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&Zd)>0}},ef=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=qd(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+Jd(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:Kd(o/3,e-s),f=0;return c&&(f|=e==s?Xd:e==u?Yd:Zd,(t<0?e!=s:e!=u)&&(f|=Qd)),new $d(a,f,d)}r+=l-c}return n?e+r:new $d(e+r,0,null)}touches(e,t){let n=0,r=qd(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};ef.empty=new ef([]);var tf=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new $d(e,r,null)}},nf=Object.create(null),rf=class{getMap(){return ef.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=nf[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in nf)throw RangeError(`Duplicate use of step JSON ID `+e);return nf[e]=t,t.prototype.jsonID=e,t}},af=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof ku)return e.fail(t.message);throw t}}};function of(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(of(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return j.fromArray(r)}var sf=class e extends rf{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new M(of(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return af.fromReplace(e,this.from,this.to,i)}invert(){return new cf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};rf.jsonID(`addMark`,sf);var cf=class e extends rf{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new M(of(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return af.fromReplace(e,this.from,this.to,n)}invert(){return new sf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};rf.jsonID(`removeMark`,cf);var lf=class e extends rf{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return af.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return af.fromReplace(e,this.pos,this.pos+1,new M(j.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new uf(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};rf.jsonID(`addNodeMark`,lf);var uf=class e extends rf{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return af.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return af.fromReplace(e,this.pos,this.pos+1,new M(j.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new lf(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};rf.jsonID(`removeNodeMark`,uf);var df=class e extends rf{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&pf(e,this.from,this.to)?af.fail(`Structure replace would overwrite content`):af.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ef([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?M.empty:new M(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?M.empty:new M(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,M.fromJSON(t,n.slice),!!n.structure)}};df.MAP_BIAS=1,rf.jsonID(`replace`,df);var ff=class e extends rf{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(pf(e,this.from,this.gapFrom)||pf(e,this.gapTo,this.to)))return af.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return af.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?af.fromReplace(e,this.from,this.to,n):af.fail(`Content does not fit in gap`)}getMap(){return new ef([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,M.fromJSON(t,n.slice),n.insert,!!n.structure)}};rf.jsonID(`replaceAround`,ff);function pf(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function mf(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new cf(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new sf(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function hf(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof vd){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new cf(t.from,t.to,t.style)))}function gf(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new df(s,l,M.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new cf(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new M(j.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new df(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(j.empty,!0);e.replace(s,s,new M(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function _f(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function vf(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!_f(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function yf(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=j.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=j.from(r.node(e).copy(u)),d++):c--;let f=j.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=j.from(i.node(e).copy(f)),p++):l++;e.step(new ff(c,l,o,s,new M(u.append(f),d,p),u.size-d,!0))}function bf(e,t,n=null,r=e){let i=Sf(e,t),a=i&&Cf(r,t);return a?i.map(xf).concat({type:t,attrs:n}).concat(a.map(xf)):null}function xf(e){return{type:e,attrs:null}}function Sf(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function Cf(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function wf(e,t,n){let r=j.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=j.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new ff(i,a,i,a,new M(r,0,0),n.length,!0))}function Tf(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Of(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&Df(e,t,n,a),gf(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new ff(c,l,c+1,l-1,new M(j.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Ef(e,t,n,a),!1}})}function Ef(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function Df(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
42
- `))}})}function Of(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function kf(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new ff(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new M(j.from(o),0,0),1,!0))}function Af(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function jf(e,t,n=1,r){let i=e.doc.resolve(t),a=j.empty,o=j.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=j.from(i.node(e).copy(a));let t=r&&r[s];o=j.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new df(t,t,new M(a.append(o),n,n),!0))}function Mf(e,t){let n=e.resolve(t),r=n.index();return Pf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Nf(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Pf(e,t){return!!(e&&t&&!e.isLeaf&&Nf(e,t))}function Ff(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);Df(e,r.node(),r.before(),s)}o.inlineContent&&gf(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new df(l,c.map(t+n,-1),M.empty,!0)),r===!0){let t=e.doc.resolve(l);Ef(e,t.node(),t.before(),e.steps.length)}return e}function If(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Lf(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Rf(e,t,n=t,r=M.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return zf(i,a,r)?new df(t,n,r):new Bf(i,a,r).fit()}function zf(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var Bf=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=j.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=j.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new M(i,a,o);return e>-1?new ff(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new df(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Uf(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(j.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced;return Jf(e,-1)<=t?!1:(this.unplaced.size>1&&Jf(e,1)>n&&n++,this.unplaced=new M(e,t+1,n),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Uf(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new M(Vf(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new M(Vf(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(Wf(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=Hf(this.placed,t,j.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?M.empty:new M(Vf(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new M(Vf(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Gf(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Gf(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Gf(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Hf(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Hf(this.placed,this.depth,j.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(j.empty,!0);e.childCount&&(this.placed=Hf(this.placed,this.frontier.length,e))}};function Vf(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Vf(e.firstChild.content,t-1,n)))}function Hf(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Hf(e.lastChild.content,t-1,n)))}function Uf(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Wf(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Wf(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(j.empty,!0)))),e.copy(r)}function Gf(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!Kf(n,a.content,o)?s:null}function Kf(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function qf(e){return e.spec.defining||e.spec.definingForContent}function Jf(e,t){for(let n=0;;n++){let r=t<0?e.firstChild:e.lastChild;if(!r||r.isAtom)return n;e=r.content}}function Yf(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(zf(i,a,r))return e.step(new df(t,n,r));let o=$f(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=qf(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new M(Xf(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function Xf(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Xf(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(j.empty,!0))}return e}function Zf(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=If(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new M(j.from(r),0,0))}function Qf(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=$f(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function $f(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var ep=class e extends rf{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return af.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return af.fromReplace(e,this.pos,this.pos+1,new M(j.from(r),0,+!t.isLeaf))}getMap(){return ef.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};rf.jsonID(`attr`,ep);var tp=class e extends rf{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return af.ok(n)}getMap(){return ef.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};rf.jsonID(`docAttr`,tp);var np=class extends Error{};np=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},np.prototype=Object.create(Error.prototype),np.prototype.constructor=np,np.prototype.name=`TransformError`;var rp=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new tf}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new np(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=M.empty){let r=Rf(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new M(j.from(n),0,0))}delete(e,t){return this.replace(e,t,M.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Yf(this,e,t,n),this}replaceRangeWith(e,t,n){return Zf(this,e,t,n),this}deleteRange(e,t){return Qf(this,e,t),this}lift(e,t){return yf(this,e,t),this}join(e,t=1){return Ff(this,e,t),this}wrap(e,t){return wf(this,e,t),this}setBlockType(e,t=e,n,r=null){return Tf(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return kf(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new ep(e,t,n)),this}setDocAttribute(e,t){return this.step(new tp(e,t)),this}addNodeMark(e,t){return this.step(new lf(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof Ou)t.isInSet(n.marks)&&this.step(new uf(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new uf(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return jf(this,e,t,n),this}addMark(e,t,n){return mf(this,e,t,n),this}removeMark(e,t,n){return hf(this,e,t,n),this}clearIncompatible(e,t,n){return gf(this,e,t,n),this}},ip=Object.create(null),ap=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new op(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=M.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?M.empty:t),o==0&&mp(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),mp(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new N(e):pp(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?pp(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):pp(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new dp(e.node(0))}static atStart(e){return pp(e,e,0,0,1)||new dp(e)}static atEnd(e){return pp(e,e,e.content.size,e.childCount,-1)||new dp(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=ip[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ip)throw RangeError(`Duplicate use of selection JSON ID `+e);return ip[e]=t,t.prototype.jsonID=e,t}getBookmark(){return N.between(this.$anchor,this.$head).getBookmark()}};ap.prototype.visible=!0;var op=class{constructor(e,t){this.$from=e,this.$to=t}},sp=!1;function cp(e){!sp&&!e.parent.inlineContent&&(sp=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var N=class e extends ap{constructor(e,t=e){cp(e),cp(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return ap.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=M.empty){if(super.replace(e,t),t==M.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new lp(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=ap.findFrom(n,r,!0)||ap.findFrom(n,-r,!0);if(e)n=e.$head;else return ap.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(ap.findFrom(t,-r,!0)||ap.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};ap.jsonID(`text`,N);var lp=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return N.between(e.resolve(this.anchor),e.resolve(this.head))}},P=class e extends ap{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?ap.near(a):new e(a)}content(){return new M(j.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new up(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};P.prototype.visible=!1,ap.jsonID(`node`,P);var up=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new lp(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&P.isSelectable(n)?new P(t):ap.near(t)}},dp=class e extends ap{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=M.empty){if(t==M.empty){e.delete(0,e.doc.content.size);let t=ap.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return fp}};ap.jsonID(`all`,dp);var fp={map(){return this},resolve(e){return new dp(e)}};function pp(e,t,n,r,i,a=!1){if(t.inlineContent)return N.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=pp(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&P.isSelectable(r))return P.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function mp(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof df||i instanceof ff))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(ap.near(e.doc.resolve(o),n))}var hp=1,gp=2,_p=4,vp=class extends rp{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|hp)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&hp)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=gp,this}ensureMarks(e){return Ou.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&gp)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Ou.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(ap.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=_p,this}get scrolledIntoView(){return(this.updated&_p)>0}};function yp(e,t){return!t||!e?e:e.bind(t)}var bp=class{constructor(e,t,n){this.name=e,this.init=yp(t.init,n),this.apply=yp(t.apply,n)}},xp=[new bp(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new bp(`selection`,{init(e,t){return e.selection||ap.atStart(t.doc)},apply(e){return e.selection}}),new bp(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new bp(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Sp=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=xp.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new bp(e.key,e.spec.state,e))})}},Cp=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new vp(this)}static create(t){let n=new Sp(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new Sp(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new Sp(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=Ju.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=ap.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function wp(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=wp(i,t,{})),n[r]=i}return n}var Tp=class{constructor(e){this.spec=e,this.props={},e.props&&wp(e.props,this,this.props),this.key=e.key?e.key.key:Dp(`plugin`)}getState(e){return e[this.key]}},Ep=Object.create(null);function Dp(e){return e in Ep?e+`$`+ ++Ep[e]:(Ep[e]=0,e+`$`)}var Op=class{constructor(e=`key`){this.key=Dp(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},kp=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Ap(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var jp=(e,t,n)=>{let r=Ap(e,n);if(!r)return!1;let i=Ip(r);if(!i){let n=r.blockRange(),i=n&&vf(n);return i!=null&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(Xp(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Pp(a,`end`)||P.isSelectable(a)))for(let n=r.depth;;n--){let o=Rf(e.doc,r.before(n),r.after(n),M.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(Pp(a,`end`)?ap.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):P.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Mp=(e,t,n)=>{let r=Ap(e,n);if(!r)return!1;let i=Ip(r);return i?Np(e,i,t):!1};function Np(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Rf(e.doc,i,o,M.empty);if(!s||s.from!=i||s instanceof df&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(N.create(t.doc,i)),n(t.scrollIntoView())}return!0}function Pp(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Fp=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Ip(r)}let o=a&&a.nodeBefore;return!o||!P.isSelectable(o)?!1:(t&&t(e.tr.setSelection(P.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Ip(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Lp(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var Rp=(e,t,n)=>{let r=Lp(e,n);if(!r)return!1;let i=Bp(r);if(!i)return!1;let a=i.nodeAfter;if(Xp(e,i,t,1))return!0;if(r.parent.content.size==0&&(Pp(a,`start`)||P.isSelectable(a))){let n=Rf(e.doc,r.before(),r.after(),M.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Pp(a,`start`)?ap.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):P.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},zp=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Bp(r)}let o=a&&a.nodeAfter;return!o||!P.isSelectable(o)?!1:(t&&t(e.tr.setSelection(P.create(e.doc,a.pos)).scrollIntoView()),!0)};function Bp(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Vp=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
43
- `).scrollIntoView()),!0)};function Hp(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var Up=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=Hp(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(ap.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},Wp=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof dp||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=Hp(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(N.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},Gp=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Af(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&vf(r);return i!=null&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function Kp(e){return(t,n)=>{if(t.selection instanceof P&&t.selection.node.isBlock){let{$from:e}=t.selection;return!e.parentOffset||!Af(t.doc,e.pos)?!1:(n&&n(t.tr.split(e.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof N||t.selection instanceof dp)&&r.deleteSelection();let{$from:i}=r.selection,a=r.steps.length,o=[],s,c,l=!1,u=!1;for(let t=i.depth;;t--)if(i.node(t).isBlock){l=i.end(t)==i.pos+(i.depth-t),u=i.start(t)==i.pos-(i.depth-t),c=Hp(i.node(t-1).contentMatchAt(i.indexAfter(t-1)));let n=e&&e(i.parent,l,i);o.unshift(n||(l&&c?{type:c}:null)),s=t;break}else{if(t==1)return!1;o.unshift(null)}let d=i.pos,f=Af(r.doc,d,o.length,o);if(f||=(o[0]=c?{type:c}:null,Af(r.doc,d,o.length,o)),!f)return!1;if(r.split(d,o.length,o),!l&&u&&i.node(s).type!=c){let e=r.mapping.slice(a),t=e.map(i.before(s)),n=r.doc.resolve(t);c&&i.node(s-1).canReplaceWith(n.index(),n.index()+1,c)&&r.setNodeMarkup(e.map(i.before(s)),c)}return n&&n(r.scrollIntoView()),!0}}var qp=Kp(),Jp=(e,t)=>(t&&t(e.tr.setSelection(new dp(e.doc))),!0);function Yp(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||Mf(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Xp(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&Yp(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=j.empty;for(let e=o.length-1;e>=0;e--)s=j.from(o[e].create(null,s));s=j.from(i.copy(s));let c=e.tr.step(new ff(t.pos-1,r,t.pos,r,new M(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&Mf(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:ap.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&vf(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&Pp(a,`start`,!0)&&Pp(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=j.empty;for(let e=o.length-1;e>=0;e--)r=j.from(o[e].copy(r));n(e.tr.step(new ff(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new M(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Zp(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(N.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var Qp=Zp(-1),$p=Zp(1);function em(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&bf(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function tm(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t)){if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function nm(e,t,n,r){for(let i=0;i<t.length;i++){let{$from:a,$to:o}=t[i],s=a.depth==0&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(a.pos,o.pos,(e,t)=>{if(s||!r&&e.isAtom&&e.isInline&&t>=a.pos&&t+e.nodeSize<=o.pos)return!1;s=e.inlineContent&&e.type.allowsMarkType(n)}),s)return!0}return!1}function rm(e){let t=[];for(let n=0;n<e.length;n++){let{$from:r,$to:i}=e[n];r.doc.nodesBetween(r.pos,i.pos,(e,n)=>{if(e.isAtom&&e.content.size&&e.isInline&&n>=r.pos&&n+e.nodeSize<=i.pos)return n+1>r.pos&&t.push(new op(r,r.doc.resolve(n+1))),r=r.doc.resolve(n+1+e.content.size),!1}),r.pos<i.pos&&t.push(new op(r,i))}return t}function im(e,t=null,n){let r=(n&&n.removeWhenPresent)!==!1,i=(n&&n.enterInlineAtoms)!==!1,a=!(n&&n.includeWhitespace);return function(n,o){let{empty:s,$cursor:c,ranges:l}=n.selection;if(s&&!c||!nm(n.doc,l,e,i))return!1;if(o){if(c)e.isInSet(n.storedMarks||c.marks())?o(n.tr.removeStoredMark(e)):o(n.tr.addStoredMark(e.create(t)));else{let s,c=n.tr;i||(l=rm(l)),s=r?!l.some(t=>n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e)):!l.every(t=>{let n=!1;return c.doc.nodesBetween(t.$from.pos,t.$to.pos,(r,i,a)=>{if(n)return!1;n=!e.isInSet(r.marks)&&!!a&&a.type.allowsMarkType(e)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,t.$from.pos-i),Math.min(r.nodeSize,t.$to.pos-i))))}),!n});for(let n=0;n<l.length;n++){let{$from:r,$to:i}=l[n];if(!s)c.removeMark(r.pos,i.pos,e);else{let n=r.pos,o=i.pos,s=r.nodeAfter,l=i.nodeBefore,u=a&&s&&s.isText?/^\s*/.exec(s.text)[0].length:0,d=a&&l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+u<o&&(n+=u,o-=d),c.addMark(n,o,e.create(t))}}o(c.scrollIntoView())}}return!0}}function am(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var om=am(kp,jp,Fp),sm=am(kp,Rp,zp),cm={Enter:am(Vp,Wp,Gp,qp),"Mod-Enter":Up,Backspace:om,"Mod-Backspace":om,"Shift-Backspace":om,Delete:sm,"Mod-Delete":sm,"Mod-a":Jp},lm={"Ctrl-h":cm.Backspace,"Alt-Backspace":cm[`Mod-Backspace`],"Ctrl-d":cm.Delete,"Ctrl-Alt-Backspace":cm[`Mod-Delete`],"Alt-Delete":cm[`Mod-Delete`],"Alt-d":cm[`Mod-Delete`],"Ctrl-a":Qp,"Ctrl-e":$p};for(let e in cm)lm[e]=cm[e];var um=(typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform()==`darwin`)?lm:cm,dm=class{constructor(e,t,n={}){this.match=e,this.match=e,this.handler=typeof t==`string`?fm(t):t,this.undoable=n.undoable!==!1,this.inCode=n.inCode||!1,this.inCodeMark=n.inCodeMark!==!1}};function fm(e){return function(t,n,r,i){let a=e;if(n[1]){let e=n[0].lastIndexOf(n[1]);a+=n[0].slice(e+n[1].length),r+=e;let t=r-i;t>0&&(a=n[0].slice(e-t,e)+a,r=i)}return t.tr.insertText(a,r,i)}}var pm=(e,t)=>{let n=e.plugins;for(let r=0;r<n.length;r++){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let n=e.tr,r=a.transform;for(let e=r.steps.length-1;e>=0;e--)n.step(r.steps[e].invert(r.docs[e]));if(a.text){let t=n.doc.resolve(a.from).marks();n.replaceWith(a.from,a.to,e.schema.text(a.text,t))}else n.delete(a.from,a.to);t(n)}return!0}}return!1};new dm(/--$/,`—`,{inCodeMark:!1}),new dm(/\.\.\.$/,`…`,{inCodeMark:!1}),new dm(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,`“`,{inCodeMark:!1}),new dm(/"$/,`”`,{inCodeMark:!1}),new dm(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,`‘`,{inCodeMark:!1}),new dm(/'$/,`’`,{inCodeMark:!1});function mm(e,t,n=null,r){return new dm(e,(e,i,a,o)=>{let s=n instanceof Function?n(i):n,c=e.tr.delete(a,o),l=c.doc.resolve(a).blockRange(),u=l&&bf(l,t,s);if(!u)return null;c.wrap(l,u);let d=c.doc.resolve(a-1).nodeBefore;return d&&d.type==t&&Mf(c.doc,a-1)&&(!r||r(i,d))&&c.join(a-1),c})}function hm(e,t,n=null){return new dm(e,(e,r,i,a)=>{let o=e.doc.resolve(i),s=n instanceof Function?n(r):n;return o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t)?e.tr.delete(i,a).setBlockType(i,i,t,s):null})}var gm=typeof navigator<`u`?navigator:null,_m=typeof document<`u`?document:null,vm=gm&&gm.userAgent||``,ym=/Edge\/(\d+)/.exec(vm),bm=/MSIE \d/.exec(vm),xm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vm),Sm=!!(bm||xm||ym),Cm=bm?document.documentMode:xm?+xm[1]:ym?+ym[1]:0,wm=!Sm&&/gecko\/(\d+)/i.test(vm),Tm=wm&&+(/Firefox\/(\d+)/.exec(vm)||[0,0])[1],Em=!Sm&&/Chrome\/(\d+)/.exec(vm),Dm=!!Em,Om=Em?+Em[1]:0,km=!Sm&&!!gm&&/Apple Computer/.test(gm.vendor),Am=km&&(/Mobile\/\w+/.test(vm)||!!gm&&gm.maxTouchPoints>2),jm=Am||(gm?/Mac/.test(gm.platform):!1),Mm=/Android \d/.test(vm),Nm=!!_m&&`webkitFontSmoothing`in _m.documentElement.style,Pm=Nm?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,Fm=Object.freeze({__proto__:null,android:Mm,chrome:Dm,chrome_version:Om,gecko:wm,gecko_version:Tm,ie:Sm,ie_version:Cm,ios:Am,mac:jm,safari:km,webkit:Nm,webkit_version:Pm});function Im(e,t,n,r,i,a){if(e.composing)return!1;let o=e.state,s=o.doc.resolve(t);if(s.parent.type.spec.code)return!1;let c=s.parent.textBetween(Math.max(0,s.parentOffset-500),s.parentOffset,void 0,``)+r;for(let s of i){let i=s,l=i.match.exec(c),u=l&&l[0]&&i.handler(o,l,t-(l[0].length-r.length),n);if(u)return i.undoable!==!1&&u.setMeta(a,{transform:u,from:t,to:n,text:r}),e.dispatch(u),!0}return!1}var Lm=new Op(`MILKDOWN_CUSTOM_INPUTRULES`);function Rm({rules:e}){let t=new Tp({key:Lm,isInputRules:!0,state:{init(){return null},apply(e,t){return e.getMeta(this)||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput(n,r,i,a){return Im(n,r,i,a,e,t)},handleDOMEvents:{compositionend:n=>(setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&Im(n,r.pos,r.pos,``,e,t)}),!1),keydown:(e,t)=>!(Mm&&Dm&&t.key===`Enter`)||e.composing?!1:e.someProp(`handleKeyDown`,n=>n(e,t))?(t.preventDefault(),!0):!1},handleKeyDown(n,r){if(r.key!==`Enter`)return!1;let{$cursor:i}=n.state.selection;return i?Im(n,i.pos,i.pos,`
44
- `,e,t):!1}}});return t}function zm(e){return e.some(e=>e.type.spec.code)}function Bm(e,t,n){if(t>=n)return!1;let r=!1;return e.doc.nodesBetween(t,n,e=>(e.isInline&&zm(e.marks)&&(r=!0),!r)),r}function Vm(e,t){return zm(e.storedMarks??e.doc.resolve(t).marks())}function Hm(e,t,n={}){return new dm(e,(e,r,i,a)=>{var o;let{tr:s}=e,c=r[r.length-1],l=r[0],u=[],d,f={group:c,fullMatch:l,start:i,end:a},p=n.updateCaptured?.call(n,f);if(Object.assign(f,p),{group:c,fullMatch:l,start:i,end:a}=f,l===null||c?.trim()===``)return null;if(c){let f=l.search(/\S/),p=i+l.indexOf(c),m=p+c.length,h=Bm(e,i+f,p),g=m<a&&Bm(e,m,a);if(h||g||Vm(e,a))return null;u=s.storedMarks??[],m<a&&s.delete(m,a),p>i&&s.delete(i+f,p),d=i+f+c.length;let _=n.getAttr?.call(n,r);s.addMark(i,d,t.create(_)),s.setStoredMarks(u),(o=n.beforeDispatch)==null||o.call(n,{match:r,start:i,end:a,tr:s})}return s})}function Um(e,t,n={}){return new dm(e,(e,r,i,a)=>{var o;let{tr:s}=e,c=r[1],l=r[0],u={group:c,fullMatch:l,start:i,end:a},d=n.updateCaptured?.call(n,u);if(Object.assign(u,d),{group:c,fullMatch:l,start:i,end:a}=u,l===null||!c||c.trim()===``)return null;let f=n.getAttr?.call(n,r),p=t.createAndFill(f);return p&&(s.replaceRangeWith(t.isBlock?s.doc.resolve(i).before():i,a,p),(o=n.beforeDispatch)==null||o.call(n,{match:[l,c],start:i,end:a,tr:s})),s})}var Wm=Object.defineProperty,Gm=Object.defineProperties,Km=Object.getOwnPropertyDescriptors,qm=Object.getOwnPropertySymbols,Jm=Object.prototype.hasOwnProperty,Ym=Object.prototype.propertyIsEnumerable,Xm=(e,t,n)=>t in e?Wm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zm=(e,t)=>{for(var n in t||={})Jm.call(t,n)&&Xm(e,n,t[n]);if(qm)for(var n of qm(t))Ym.call(t,n)&&Xm(e,n,t[n]);return e},Qm=(e,t)=>Gm(e,Km(t));function $m(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function eh(e,t,n){let r=e.state.doc.content.size,i=$m(t,0,r),a=$m(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return Qm(Zm({},f),{toJSON:()=>f})}function th(e){return Object.assign(Object.create(e),e).setTime(Date.now())}function nh(e,t){return Array.isArray(e)&&e.includes(t.type)||t.type===e}function rh(e){if(e.content.childCount===1){let t=e.content.firstChild;if(t?.type.name===`text`&&t.marks.length===0)return t;if(t?.type.name===`paragraph`&&t.childCount===1){let e=t.firstChild;if(e?.type.name===`text`&&e.marks.length===0)return e}}return!1}function ih(e){return t=>{for(let n=t.depth;n>0;--n){let r=t.node(n);if(e(r))return{from:t.before(n),to:t.after(n),node:r}}}}function ah(e,t){return ih(e=>e.type===t)(e)}function oh(e,t){let n=t.nodes[e];if(!n)throw fi(`node`,e);return n}function sh(e){return t=>{for(let n=t.depth;n>0;n--){let r=t.node(n);if(e(r))return{pos:t.before(n),start:t.start(n),depth:n,node:r}}}}function ch(e){return t=>sh(e)(t.$from)}function lh(e,t){if(!(e instanceof P))return;let{node:n,$from:r}=e;if(nh(t,n))return{node:n,pos:r.pos,start:r.start(r.depth),depth:r.depth}}var uh=(e,t)=>{let{selection:n,doc:r}=e;if(n instanceof P)return{hasNode:n.node.type===t,pos:n.from,target:n.node};let{from:i,to:a}=n,o=!1,s=-1,c=null;return r.nodesBetween(i,a,(e,n)=>c?!1:e.type!==t||(o=!0,s=n,c=e,!1)),{hasNode:o,pos:s,target:c}},dh=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),fh=typeof navigator<`u`&&/Win/.test(navigator.platform);function ph(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))dh?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function mh(e){let t=Object.create(null);for(let n in e)t[ph(n)]=e[n];return t}function hh(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function gh(e){return new Tp({props:{handleKeyDown:_h(e)}})}function _h(e){let t=mh(e);return function(e,n){let r=it(n),i,a=t[hh(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[hh(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(fh&&n.ctrlKey&&n.altKey)&&(i=tt[n.keyCode])&&i!=r){let r=t[hh(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var vh=class{},yh=class{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{this.top()?.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{let e=this.elements.pop();if(!e)throw li();return e}}},bh=class e extends vh{constructor(e,t,n){super(),this.type=e,this.content=t,this.attrs=n}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(t,n,r){return new e(t,n,r)}},xh=class extends yh{#e;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(t,e),n.toDoc())}}constructor(e){super(),this.#e=Ou.none,this.#t=e=>e.isText,this.#n=(e,t)=>{if(this.#t(e)&&this.#t(t)&&Ou.sameSet(e.marks,t.marks))return this.schema.text(e.text+t.text,e.marks)},this.#r=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.parseMarkdown.match(e));if(!t)throw ui(e);return t},this.#i=e=>{let t=this.#r(e);t.spec.parseMarkdown.runner(this,e,t)},this.injectRoot=(e,t,n)=>(this.openNode(t,n),this.next(e.children),this),this.openNode=(e,t)=>(this.open(bh.create(e,[],t)),this),this.#a=()=>{this.#e=Ou.none;let e=this.close();return this.#o(e.type,e.attrs,e.content)},this.closeNode=()=>{try{this.#a()}catch(e){console.error(e)}return this},this.#o=(e,t,n)=>{let r=e.createAndFill(t,n,this.#e);if(!r)throw ci(e,t,n);return this.push(r),r},this.addNode=(e,t,n)=>{try{this.#o(e,t,n)}catch(e){console.error(e)}return this},this.openMark=(e,t)=>{let n=e.create(t);return this.#e=n.addToSet(this.#e),this},this.closeMark=e=>(this.#e=e.removeFromSet(this.#e),this),this.addText=e=>{try{let t=this.top();if(!t)throw li();let n=t.pop(),r=this.schema.text(e,this.#e);if(!n)return t.push(r),this;let i=this.#n(n,r);return i?(t.push(i),this):(t.push(n,r),this)}catch(e){return console.error(e),this}},this.build=()=>{let e;do e=this.#a();while(this.size());return e},this.next=(e=[])=>([e].flat().forEach(e=>this.#i(e)),this),this.toDoc=()=>this.build(),this.run=(e,t)=>{let n=e.runSync(e.parse(t),t);return this.next(n),this},this.schema=e}#t;#n;#r;#i;#a;#o},Sh=class e extends vh{constructor(e,t,n,r={}){super(),this.type=e,this.children=t,this.value=n,this.props=r,this.push=(e,...t)=>{this.children||=[],this.children.push(e,...t)},this.pop=()=>this.children?.pop()}static{this.create=(t,n,r,i={})=>new e(t,n,r,i)}},Ch=e=>Object.prototype.hasOwnProperty.call(e,`size`),wh=class extends yh{#e;static{this.create=(e,t)=>{let n=new this(e);return e=>(n.run(e),n.toString(t))}}constructor(e){super(),this.#e=[],this.#t=e=>{let t=Object.values({...this.schema.nodes,...this.schema.marks}).find(t=>t.spec.toMarkdown.match(e));if(!t)throw di(e.type);return t},this.#n=e=>this.#t(e).spec.toMarkdown.runner(this,e),this.#r=(e,t)=>this.#t(e).spec.toMarkdown.runner(this,e,t),this.#i=e=>{let t=e=>e.type.spec.priority??50,n=[...e].sort((e,n)=>t(e)-t(n)),r=[];return this.#e.forEach(({mark:e})=>{let t=n.findIndex(t=>t.eq(e));t>=0&&r.push(...n.splice(t,1))}),r.concat(n)},this.#a=e=>{let t=e?.marks,n=0;for(;n<this.#e.length;){let{mark:e,spanning:r}=this.#e[n];if(r&&t?.some(t=>t.eq(e)))n++;else break}for(let e=this.#e.length-1;e>=n;e--)this.#p(this.#e[e].mark)},this.#o=(e,t)=>{this.#i(e.marks).every(t=>!this.#r(t,e))&&this.#n(e),this.#a(t)},this.#s=e=>{let{children:t}=e;return t&&(e.children=t.reduce((e,t,n)=>{if(n===0)return[t];let r=e.at(-1);if(r&&r.isMark&&t.isMark){let{children:n,...i}=t,{children:a,...o}=r;if(t.type===r.type&&n&&a&&JSON.stringify(i)===JSON.stringify(o)){let t={...o,children:[...a,...n]};return e.slice(0,-1).concat(this.#s(t))}}return e.concat(t)},[])),e},this.#c=e=>{let t={...e.props,type:e.type};return e.children&&(t.children=e.children),e.value&&(t.value=e.value),t},this.openNode=(e,t,n)=>(this.open(Sh.create(e,void 0,t,n)),this),this.#l=(e,t)=>{let n=``,r=``,i=e.children;if(i){let e=i[0],t=i.at(-1);if(t&&t.type===`text`&&t.value.endsWith(` `)){let e=t.value,n=e.trimEnd();r=e.slice(n.length),t.value=n}if(e&&e.type===`text`&&e.value.startsWith(` `)){let t=e.value,r=t.trimStart();n=t.slice(0,t.length-r.length),e.value=r}}n.length&&this.#d(`text`,void 0,n);let a=t();return r.length&&this.#d(`text`,void 0,r),a},this.#u=(e=!1)=>{let t=this.close(),n=()=>this.#d(t.type,t.children,t.value,t.props);return e?this.#l(t,n):n()},this.closeNode=()=>(this.#u(),this),this.#d=(e,t,n,r)=>{let i=Sh.create(e,t,n,r),a=this.#s(this.#c(i));return this.push(a),a},this.addNode=(e,t,n,r)=>(this.#d(e,t,n,r),this),this.#f=(e,t,n,r)=>this.#e.some(t=>t.mark.eq(e))?this:(this.#e.push({mark:e,spanning:n==null}),this.openNode(t,n,{...r,isMark:!0})),this.#p=e=>{let t=-1;for(let n=this.#e.length-1;n>=0;n--)if(this.#e[n].mark.eq(e)){t=n;break}t<0||(this.#e.splice(t,1),this.#u(!0))},this.withMark=(e,t,n,r)=>(this.#f(e,t,n,r),this),this.closeMark=e=>(this.#p(e),this),this.build=()=>{let e=null;do e=this.#u();while(this.size());return e.children||(e.children=[]),e},this.next=e=>Ch(e)?(e.forEach((t,n,r)=>{this.#o(t,e.maybeChild(r+1)??void 0)}),this):(this.#o(e),this),this.toString=e=>e.stringify(this.build()),this.run=e=>(this.#e=[],this.next(e),this),this.schema=e}#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p},Th=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Eh=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},Dh=null,Oh=function(e,t,n){let r=Dh||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},kh=function(){Dh=null},Ah=function(e,t,n,r){return n&&(Mh(e,t,n,r,-1)||Mh(e,t,n,r,1))},jh=/^(img|br|input|textarea|hr)$/i;function Mh(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Nh(e))){let n=e.parentNode;if(!n||!F(n)||zh(e)||jh.test(e.nodeName)||e.contentEditable==`false`)return!1;t=Th(e)+(i<0?0:1),e=n}else if(F(e)){let n=e.childNodes[t+(i<0?-1:0)];if(F(n)&&n.contentEditable==`false`){if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1}else e=n,t=i<0?Nh(e):0}else return!1}}function Nh(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function F(e){return e.nodeType==1}function Ph(e){return e.nodeType==3}function Fh(e,t){return t?e.contains(F(t)?t:t.parentNode):!1}function Ih(e,t){for(;;){if(Ph(e)&&t)return e;if(F(e)&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Nh(e)}else if(e.parentNode&&!zh(e))t=Th(e),e=e.parentNode;else return null}}function Lh(e,t){for(;;){if(Ph(e)&&t<e.nodeValue.length)return e;if(F(e)&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!zh(e))t=Th(e)+1,e=e.parentNode;else return null}}function Rh(e,t,n){for(let r=t==0,i=t==Nh(e);r||i;){if(e==n)return!0;let t=Th(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Nh(e)}}function zh(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Bh=function(e){return e.focusNode&&Ah(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Vh(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function Hh(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Uh(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Nh(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Nh(r.startContainer),r.startOffset)}}}var Wh=typeof navigator<`u`?navigator:null,Gh=typeof document<`u`?document:null,Kh=Wh&&Wh.userAgent||``,qh=/Edge\/(\d+)/.exec(Kh),Jh=/MSIE \d/.exec(Kh),Yh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Kh),Xh=!!(Jh||Yh||qh),Zh=Jh?document.documentMode:Yh?+Yh[1]:qh?+qh[1]:0,Qh=!Xh&&/gecko\/(\d+)/i.test(Kh);Qh&&+(/Firefox\/(\d+)/.exec(Kh)||[0,0])[1];var $h=!Xh&&/Chrome\/(\d+)/.exec(Kh),eg=!!$h,tg=$h?+$h[1]:0,ng=!Xh&&!!Wh&&/Apple Computer/.test(Wh.vendor),rg=ng&&(/Mobile\/\w+/.test(Kh)||!!Wh&&Wh.maxTouchPoints>2),ig=rg||(Wh?/Mac/.test(Wh.platform):!1),ag=Wh?/Win/.test(Wh.platform):!1,og=/Android \d/.test(Kh),sg=!!Gh&&`webkitFontSmoothing`in Gh.documentElement.style,cg=sg?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function lg(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function ug(e,t){return typeof e==`number`?e:e[t]}function dg(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function fg(e,t,n){if(!Dg(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(!F(o)){o=Eh(o);continue}let e=o==a.body,n=e?lg(a):dg(o),s=0,c=0;if(t.top<n.top+ug(r,`top`)?c=-(n.top-t.top+ug(i,`top`)):t.bottom>n.bottom-ug(r,`bottom`)&&(c=t.bottom-t.top>n.bottom-n.top?t.top+ug(i,`top`)-n.top:t.bottom-n.bottom+ug(i,`bottom`)),t.left<n.left+ug(r,`left`)?s=-(n.left-t.left+ug(i,`left`)):t.right>n.right-ug(r,`right`)&&(s=t.right-n.right+ug(i,`right`)),s||c){if(e)a.defaultView.scrollBy(s,c);else{let e=o.scrollLeft,n=o.scrollTop;c&&(o.scrollTop+=c),s&&(o.scrollLeft+=s);let r=o.scrollLeft-e,i=o.scrollTop-n;t={left:t.left-r,top:t.top-i,right:t.right-r,bottom:t.bottom-i}}}let l=e?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(l))break;o=l==`absolute`?o.offsetParent:Eh(o)}}function pg(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:mg(e.dom)}}function mg(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Eh(r));return t}function hg({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;gg(n,r==0?0:r-t)}function gg(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var _g=null;function vg(e){if(e.setActive)return e.setActive();if(_g)return e.focus(_g);let t=mg(e);e.focus(_g==null?{get preventScroll(){return _g={preventScroll:!0},!0}}:void 0),_g||(_g=!1,gg(t,0))}function yg(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(F(u))e=u.getClientRects();else if(Ph(u))e=Oh(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&Ph(n)?{left:p.right<t.left?p.right:p.left,top:t.top}:t,F(u)&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&Ph(n)?bg(n,i):!n||r?{node:e,offset:a}:yg(n,i)}function bg(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=Og(r,1);if(n.top!=n.bottom&&xg(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function xg(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Sg(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Cg(e,t,n){let{node:r,offset:i}=yg(t,n),a=-1;if(F(r)&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function wg(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(F(t.dom)&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Tg(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(F(n)){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(xg(t,i))return Tg(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Eg(e,t){let n=e.dom.ownerDocument,r,i=0,a=Uh(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o)){let n=e.dom.getBoundingClientRect();if(!xg(t,n)||(o=Tg(e.dom,t,n),!o))return null}if(ng)for(let e=o;r&&e;e=Eh(e))e.draggable&&(r=void 0);if(o=Sg(o,t),r){if(Qh&&F(r)&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;sg&&i&&F(r)&&F(n=r.childNodes[i-1])&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&F(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||!F(r)||r.childNodes[i-1].nodeName!=`BR`)&&(s=wg(e,r,i,t))}s??=Cg(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Dg(e){return e.top<e.bottom||e.left<e.right}function Og(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Dg(e))return e}return Array.prototype.find.call(n,Dg)||e.getBoundingClientRect()}var kg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ag(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=sg||Qh;if(Ph(r)){if(o&&(kg.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Og(Oh(r,i,i),n);if(Qh&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Og(Oh(r,i-1,i-1),-1);if(t.top==e.top){let n=Og(Oh(r,i,i+1),-1);if(n.top!=e.top)return jg(n,n.left<t.left)}}return e}{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,jg(Og(Oh(r,e,t),a),a<0)}}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Nh(r))){let e=r.childNodes[i-1];if(F(e))return Mg(e.getBoundingClientRect(),!1)}if(a==null&&i<Nh(r)){let e=r.childNodes[i];if(F(e))return Mg(e.getBoundingClientRect(),!0)}return Mg(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Nh(r))){let e=r.childNodes[i-1],t=Ph(e)?Oh(e,Nh(e)-+!o):F(e)&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return jg(Og(t,1),!1)}if(a==null&&i<Nh(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?Ph(e)?Oh(e,0,+!o):F(e)?e:null:null;if(t)return jg(Og(t,-1),!0)}return jg(Og(Ph(r)?Oh(r):r,-n),n>=0)}function jg(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Mg(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Ng(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Pg(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Ng(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Ag(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(F(e))t=e.getClientRects();else if(Ph(e))t=Oh(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Fg=/[\u0590-\u08ac]/;function Ig(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Fg.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Ng(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!Fh(l,u)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Lg=null,Rg=null,zg=!1;function Bg(e,t,n){return Lg==t&&Rg==n?zg:(Lg=t,Rg=n,zg=n==`up`||n==`down`?Pg(e,t,n):Ig(e,t,n))}var Vg=0,Hg=1,Ug=2,Wg=3,Gg=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Vg,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&Fh(this.contentDOM,e)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>Th(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node)){if(n&&(a=i.nodeDOM)&&!(F(a)?Fh(a,e):a==e))n=!1;else return i}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(;n>0;n--){let e=this.children[n-1];if(e.size||!(e instanceof Qg||e instanceof Kg&&e.side>=0))break}if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Th(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Th(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Th(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Th(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(!F(t)||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((Qh||ng)&&e==t){let{node:e,offset:t}=o;if(Ph(e)){if(u=!!(t&&e.nodeValue[t-1]==`
45
- `),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:Th(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(Qh&&l.focusNode&&l.focusNode!=s.node&&F(l.focusNode)){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&ng)&&Ah(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Ah(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&Qh)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Ug:Hg,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Wg:i.markDirty(e-r,t-r);return}i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ug:Wg}n=a}this.dirty=Ug}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Ug:Hg;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Kg=class extends Gg{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let e=F(a)?a:document.createElement(`span`);e!=a&&e.appendChild(a),e.hasAttribute(`contenteditable`)||(e.contentEditable=`false`),e.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Vg&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},qg=class extends Gg{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Jg=class e extends Gg{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Ld.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Wg||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Wg&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Vg){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Vg}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=h_(a,n,o,r)),t>0&&(a=h_(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Yg=class e extends Gg{constructor(e,t,n,r,i,a,o){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(!Ph(u))throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Ld.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=o_(u,r,n),l?c=new $g(t,n,r,i,u,d||null,f,l):n.isText?new Zg(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>F(t)&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>j.empty}}return t}matchesNode(e,t,n){return this.dirty==Vg&&e.eq(this.node)&&s_(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new l_(this,a&&a.node,e),c=this.node.inlineContent,l=c&&this.node.isBlock;f_(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?Ou.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,u,d)=>{s.syncToMarks(t.marks,n,e,d),l&&t.isAtom&&!t.isText&&s.addHackNode(`IMG`,s.top);let f;s.findNodeMatch(t,a,u,d)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(f=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,u,f,e)||s.updateNextNode(t,a,u,e,d,r)||s.addNode(t,a,u,e,r),r+=t.nodeSize,c&&(l=t.isAtom&&!t.isText)}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Ug)&&(a&&this.protectLocalComposition(e,a),e_(this.contentDOM,this.children,e),rg&&p_(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof N)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=m_(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let a=new qg(this,i,t,r);e.input.compositionNodes.push(a),this.children=h_(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Wg||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Vg}updateOuterDeco(e){if(s_(e,this.outerDeco))return;let t=!F(this.nodeDOM),n=this.dom;this.dom=i_(this.dom,this.nodeDOM,r_(this.outerDeco,this.node,t),r_(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){F(this.nodeDOM)&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){F(this.nodeDOM)&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function Xg(e,t,n,r,i){o_(r,t,e);let a=new Yg(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var Zg=class e extends Yg{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Wg||this.dirty!=Vg&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Vg||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Vg,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Wg)}get domAtom(){return!1}isText(e){return this.node.text==e}},Qg=class extends Gg{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Vg&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},$g=class extends Yg{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==Wg)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function e_(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=c_(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Jg){let t=r?r.previousSibling:e.lastChild;e_(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=c_(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var t_=function(e){e&&(this.nodeName=e)};t_.prototype=Object.create(null);var n_=[new t_];function r_(e,t,n){if(e.length==0)return n_;let r=n?n_[0]:new t_,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new t_(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new t_(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function i_(e,t,n,r){if(n==n_&&r==n_)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=n_[0],i=t)}a_(i,o||n_[0],a)}return i}function a_(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function o_(e,t,n){return i_(e,e,n_,r_(t,n,!F(e)))}function s_(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function c_(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var l_=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=u_(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Vg,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof Jg&&t.dirty!=Wg&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Jg.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Wg&&a.dom==a.contentDOM&&(a.dirty=Ug),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof Yg){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Wg&&s_(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Ug,u.updateChildren(r,a+1),u.dirty=Vg),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!s_(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Yg.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=Yg.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Kg(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Jg;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Zg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ng||eg)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new Qg(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||F(e)&&e.contains(this.lock.parentNode))}};function u_(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Jg)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function d_(e,t){return e.type.side-t.type.side}function f_(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u){if(d){d.sort(d_);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c)}let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function p_(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function m_(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function h_(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function g_(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Bh(n)){for(c=o;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&P.isSelectable(i.node)&&i.parent&&!(i.node.isInline&&Rh(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new P(o==e?s:r.resolve(e))}else if(Qh&&t==`key`&&o>e.state.selection.to&&F(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&i&&i.posAtStart>e.state.selection.to)for(let e=n.focusNode;;e=e.parentNode){if(getComputedStyle(e).overflow!=`visible`){l=ap.findFrom(r.resolve(i.posAtStart),1);break}if(e==i.dom||e.nextSibling||!e.parentNode||!F(e.parentNode))break}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=D_(e,u,s,n)}return l}function __(e){return e.editable?e.hasFocus():k_(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function v_(e,t=!1){let n=e.state.selection;if(T_(e,n),!__(e))return;let r=e.input.mouseDown;if(!t&&eg&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Ah(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)w_(e);else{let{anchor:r,head:i}=n,a,o;y_&&!(n instanceof N)&&(n.$from.parent.inlineContent||(a=b_(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=b_(e,n.to))),e.docView.setSelection(r,i,e,t),y_&&(a&&S_(a),o&&S_(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&C_(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var y_=ng||eg&&tg<63;function b_(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(ng&&i&&i.contentEditable==`false`)return x_(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return x_(i);if(a)return x_(a)}}function x_(e){return e.contentEditable=`true`,ng&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function S_(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function C_(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!__(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function w_(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,Th(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Xh&&Zh<=11&&(n.disabled=!0,n.disabled=!1)}function T_(e,t){if(t instanceof P){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(E_(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else E_(e)}function E_(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function D_(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||N.between(t,n,r)}function O_(e){return e.editable&&!e.hasFocus()?!1:k_(e)}function k_(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return Fh(e.dom,t.anchorNode)&&(e.editable||Fh(e.dom,t.focusNode))}catch{return!1}}function A_(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Ah(t.node,t.offset,n.anchorNode,n.anchorOffset)}function j_(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&ap.findFrom(a,t)}function M_(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function N_(e,t,n){let r=e.state.selection;if(r instanceof N){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return M_(e,new N(r.$anchor,a))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=j_(e.state,t);return n&&n instanceof P?M_(e,n):!1}if(!(ig&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?P.isSelectable(i)?M_(e,new P(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):M_(e,new N(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1}}else if(r instanceof P&&r.node.isInline)return M_(e,new N(t>0?r.$to:r.$from));else{let n=j_(e.state,t);return n?M_(e,n):!1}}function P_(e,t){let n=e.pmViewDesc;return n?n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`):F(e)&&e.contentEditable==`false`}function F_(e,t){return t<0?I_(e):L_(e)}function I_(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(Qh&&F(n)&&r<Nh(n)&&P_(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!F(n))break;let e=n.childNodes[r-1];if(P_(e,-1))i=n,a=--r;else if(Ph(e))n=e,r=n.nodeValue.length;else break}else if(R_(n))break;else{let t=n.previousSibling;for(;t&&P_(t,-1);)i=n.parentNode,a=Th(t),t=t.previousSibling;if(t)n=t,r=Nh(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?V_(e,n,r):i&&V_(e,i,a)}function L_(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=Nh(n),a,o;for(;;)if(r<i){if(!F(n))break;let e=n.childNodes[r];if(P_(e,1))a=n,o=++r;else break}else if(R_(n))break;else{let t=n.nextSibling;for(;t&&P_(t,1);)a=t.parentNode,o=Th(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=Nh(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&V_(e,a,o)}function R_(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function z_(e,t){for(;e&&t==e.childNodes.length&&!zh(e);)t=Th(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(Ph(n))return n;if(F(n)&&n.contentEditable==`false`)break;e=n,t=0}}function B_(e,t){for(;e&&!t&&!zh(e);)t=Th(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(Ph(n))return n;if(F(n)&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function V_(e,t,n){if(!Ph(t)){let e,r;(r=z_(t,n))?(t=r,n=0):(e=B_(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Bh(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&v_(e)},50)}function H_(e,t){let n=e.state.doc.resolve(t);if(!(eg||ag)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function U_(e,t,n){let r=e.state.selection;if(r instanceof N&&!r.empty||n.indexOf(`s`)>-1||ig&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=j_(e.state,t);if(n&&n instanceof P)return M_(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof dp?ap.near(n,t):ap.findFrom(n,t);return o?M_(e,o):!1}return!1}function W_(e,t){if(!(e.state.selection instanceof N))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function G_(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function K_(e){if(!ng||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&F(t)&&n==0&&t.firstChild&&F(t.firstChild)&&t.firstChild.contentEditable==`false`){let n=t.firstChild;G_(e,n,`true`),setTimeout(()=>G_(e,n,`false`),20)}return!1}function q_(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function J_(e,t){let n=t.keyCode,r=q_(t);if(n==8||ig&&n==72&&r==`c`)return W_(e,-1)||F_(e,-1);if(n==46&&!t.shiftKey||ig&&n==68&&r==`c`)return W_(e,1)||F_(e,1);if(n==13||n==27)return!0;if(n==37||ig&&n==66&&r==`c`){let t=n==37?H_(e,e.state.selection.from)==`ltr`?-1:1:-1;return N_(e,t,r)||F_(e,t)}if(n==39||ig&&n==70&&r==`c`){let t=n==39?H_(e,e.state.selection.from)==`ltr`?1:-1:1;return N_(e,t,r)||F_(e,t)}return n==38||ig&&n==80&&r==`c`?U_(e,-1,r)||F_(e,-1):n==40||ig&&n==78&&r==`c`?K_(e)||U_(e,1,r)||F_(e,1):!(r!=(ig?`m`:`c`)||n!=66&&n!=73&&n!=89&&n!=90)}function Y_(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Ld.fromSchema(e.state.schema),s=av(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&F(l)&&(u=iv[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&F(l)&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
46
-
47
- `),slice:t}}function X_(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new M(j.from(e.state.schema.text(t.replace(/\r\n?/g,`
48
- `))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Ld.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=cv(n),sg&&lv(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&!F(e);)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Cd.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!Z_.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=uv(rv(s,+u[1],+u[2]),u[4]);else if(s=M.maxOpen(Q_(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=rv(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var Z_=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Q_(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&ev(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=tv(a[a.length-1],i.length));let n=$_(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return j.from(a)}return e}function $_(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,j.from(e));return e}function ev(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=ev(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(j.from($_(n,e,i+1))))}}function tv(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,tv(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(j.empty,!0);return e.copy(n.append(r))}function nv(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=nv(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(j.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function rv(e,t,n){return t<e.openStart&&(e=new M(nv(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new M(nv(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var iv={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]};function av(){return document.implementation.createHTMLDocument(`title`)}var ov=null;function sv(e){let t=window.trustedTypes;if(!t)return e;if(!ov){if(ov=t.defaultPolicy)try{return ov.createHTML(e)}catch{}ov=t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e})}return ov.createHTML(e)}function cv(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=av(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&iv[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>`</`+e+`>`).reverse().join(``)),r.innerHTML=sv(e),a)for(let e=0;e<a.length;e++)r=r.querySelector(a[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}function lv(e){let t=e.querySelectorAll(eg?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function uv(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{i=j.from(t.create(r[e+1],i))}catch{break}a++,o++}return new M(i,a,o)}var dv={},fv={},pv={touchstart:!0,touchmove:!0},mv=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function hv(e){for(let t in dv){let n=dv[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{bv(e,t)&&!yv(e,t)&&(e.editable||!(t.type in fv))&&n(e,t)},pv[t]?{passive:!0}:void 0)}ng&&e.dom.addEventListener(`input`,()=>null),vv(e)}function gv(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function _v(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function vv(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>yv(e,t))})}function yv(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function bv(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function xv(e,t){!yv(e,t)&&dv[t.type]&&(e.editable||!(t.type in fv))&&dv[t.type](e,t)}fv.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!Rv(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(og&&eg&&n.keyCode==13))){if(n.keyCode!=229&&e.domObserver.forceFlush(),rg&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Vh(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||J_(e,n)?n.preventDefault():gv(e,`key`)}},fv.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},fv.keypress=(e,t)=>{let n=t;if(Rv(e)||!n.charCode||n.ctrlKey&&!n.altKey||ig&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof N)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function Sv(e){return{left:e.clientX,top:e.clientY}}function Cv(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function wv(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function Tv(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta(`pointer`,!0),e.dispatch(r)}function Ev(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&P.isSelectable(r)?(Tv(e,new P(n)),!0):!1}function Dv(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof P&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(P.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i!=null&&(Tv(e,P.create(e.state.doc,i)),!0)}function Ov(e,t,n,r,i){return wv(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Dv(e,n):Ev(e,n))}function kv(e,t,n,r){return wv(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function Av(e,t,n,r){return wv(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||jv(e,n,r)}function jv(e,t,n){if(n.button!=0)return!1;let r=Mv(e,t,!0),i=e.state.doc;return r?(Tv(e,r),r instanceof N&&i.eq(e.state.doc)&&(e.input.mouseDown=new Lv(e,r)),!0):!1}function Mv(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?N.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return N.create(r,a+1,a+1+t.content.size);if(n&&P.isSelectable(t))return P.create(r,a)}return null}function Nv(e){return Wv(e)}var Pv=ig?`metaKey`:`ctrlKey`;dv.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Nv(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&Cv(n,e.input.lastClick)&&!n[Pv]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(Sv(n));o&&(a==`singleClick`?e.input.mouseDown=new Iv(e,o,n,!!r):(a==`doubleClick`?kv:Av)(e,o.pos,o.inside,n)?n.preventDefault():gv(e,`pointer`))};var Fv=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},Iv=class extends Fv{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[Pv],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&F(s.nodeDOM)?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof P&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!(!this.target||this.target.draggable),setUneditable:!!(this.target&&Qh&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),gv(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||v_(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Sv(e))),this.updateAllowDefault(e),this.allowDefault||!t?gv(this.view,`pointer`):Ov(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ng&&this.mightDrag&&!this.mightDrag.node.isAtom||eg&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Tv(this.view,ap.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):gv(this.view,`pointer`)}move(e){this.updateAllowDefault(e),gv(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},Lv=class extends Fv{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),gv(this.view,`pointer`);let t=this.view.posAtCoords(Sv(e)),n=t&&Mv(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];Tv(this.view,N.create(r,a,o))}};dv.touchstart=e=>{e.input.lastTouch=Date.now(),Nv(e),gv(e,`pointer`)},dv.touchmove=e=>{e.input.lastTouch=Date.now(),gv(e,`pointer`)},dv.contextmenu=e=>Nv(e);function Rv(e,t){return e.composing?!0:ng&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var zv=og?5e3:-1;fv.compositionstart=fv.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof N&&t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||eg&&ag&&Bv(e)))e.markCursor=e.state.storedMarks||n.marks(),Wv(e,!0),e.markCursor=null;else if(Wv(e,!t.selection.empty),Qh&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&F(n)&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(Ph(t)){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Vv(e,zv)};function Bv(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||!F(t)||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return F(r)&&r.contentEditable==`false`}fv.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Vv(e,20))};function Vv(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Wv(e),t))}function Hv(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Uv(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Ih(t.focusNode,t.focusOffset),r=Lh(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function Wv(e,t=!1){if(!(og&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Hv(e),t||e.docView&&e.docView.dirty){let n=g_(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Gv(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var Kv=Xh&&Zh<15||rg&&cg<604;dv.copy=fv.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Kv?null:n.clipboardData,{dom:o,text:s}=Y_(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):Gv(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function qv(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Jv(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Yv(e,r.value,null,i,t):Yv(e,r.textContent,r.innerHTML,i,t)},50)}function Yv(e,t,n,r,i){let a=X_(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||M.empty)))return!0;if(!a)return!1;let o=qv(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Xv(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}fv.paste=(e,t)=>{let n=t;if(e.composing&&!og)return;let r=Kv?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Yv(e,Xv(r),r.getData(`text/html`),i,n)?n.preventDefault():Jv(e,n)};var Zv=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},Qv=ig?`altKey`:`ctrlKey`;function $v(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[Qv]:!n}dv.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(Sv(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof P?i.to-1:i.to))){if(r&&r.mightDrag)o=P.create(e.state.doc,r.mightDrag.pos);else if(n.target&&F(n.target)){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=P.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=Y_(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!eg||tg>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Kv?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Kv||n.dataTransfer.setData(`text/plain`,c),e.dragging=new Zv(l,$v(e,n),o)},dv.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},fv.dragover=fv.dragenter=(e,t)=>t.preventDefault(),fv.drop=(e,t)=>{try{ey(e,t,e.dragging)}finally{e.dragging=null}};function ey(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Sv(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=X_(e,Xv(t.dataTransfer),Kv?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&$v(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||M.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Lf(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&P.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new P(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(D_(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}dv.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&v_(e)},20))},dv.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},dv.beforeinput=(e,t)=>{if(og&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Vh(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in fv)dv[e]=fv[e];function ty(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var ny=class e{constructor(e,t){this.toDOM=e,this.spec=t||sy,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new ay(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&ty(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},ry=class e{constructor(e,t){this.attrs=e,this.spec=t||sy}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new ay(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&ty(this.attrs,t.attrs)&&ty(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},iy=class e{constructor(e,t){this.attrs=e,this.spec=t||sy}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new ay(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&ty(this.attrs,t.attrs)&&ty(this.spec,t.spec)}destroy(){}},ay=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new ny(n,r))}static inline(t,n,r,i){return new e(t,n,new ry(r,i))}static node(t,n,r,i){return new e(t,n,new iy(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ry}get widget(){return this.type instanceof ny}},oy=[],sy={},cy=class e{constructor(e,t){this.local=e.length?e:oy,this.children=t.length?t:oy}static create(e,t){return t.length?gy(t,e,0,sy):ly}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==ly||e.maps.length==0?this:this.mapInner(e,t,0,0,n||sy)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?dy(this.children,o||[],t,n,r,i,a):o?new e(o.sort(_y),oy):ly}add(t,n){return n.length?this==ly?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=my(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,gy(s,e,o+1,sy)),a+=3}});let o=fy(a?hy(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(_y):this.local,i||this.children)}remove(e){return e.length==0||this==ly?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==ly?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):ly}forChild(t,n){if(this==ly)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof ry){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(_y),oy);return r?new uy([t,r]):t}return r||ly}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return vy(this.localsInner(e))}localsInner(e){if(this==ly)return oy;if(e.inlineContent||!this.local.some(ry.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof ry||t.push(this.local[e]);return t}forEachSet(e){e(this)}};cy.empty=new cy([],[]),cy.removeOverlap=vy;var ly=cy.empty,uy=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,sy));return e.from(r)}forChild(t,n){if(n.isLeaf)return cy.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=ly&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length){if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}}return t?vy(n?t:t.sort(_y)):oy}static from(t){switch(t.length){case 0:return ly;case 1:return t[0];default:return new e(t.every(e=>e instanceof cy)?t:t.reduce((e,t)=>e.concat(t instanceof cy?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function dy(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==ly?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=gy(py(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new cy(t.sort(_y),s)}function fy(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new ay(i.from+t,i.to+t,i.type))}return n}function py(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function my(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function hy(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function gy(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=my(e,t,o+n);if(s){a=!0;let e=gy(s,t,n+o+1,r);e!=ly&&i.push(o,o+t.nodeSize,e)}});let o=fy(a?hy(e):e,-n).sort(_y);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new cy(o,i):ly}function _y(e,t){return e.from-t.from||e.to-t.to}function vy(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),yy(t,i+1,a.copy(r.to,a.to)));continue}a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),yy(t,i,r.copy(a.from,r.to)));break}}return t}function yy(e,t,n){for(;t<e.length&&_y(n,e[t])>0;)t++;e.splice(t,0,n)}function by(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=ly&&t.push(r)}),e.cursorWrapper&&t.push(cy.create(e.state.doc,[e.cursorWrapper.deco])),uy.from(t)}var xy={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Sy=Xh&&Zh<=11,Cy=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},wy=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Cy,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Xh&&Zh<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():ng&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Sy&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,xy)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(O_(this.view)){if(this.suppressingSelectionUpdates)return v_(this.view);if(Xh&&Zh<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ah(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=Eh(n))t.add(n);for(let r=e.anchorNode;r;r=Eh(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:Ph(n)?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&O_(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||eg&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&F(t);){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(Qh&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||Ay(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Bh(n)&&(c=g_(e))&&c.eq(ap.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,v_(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Dy(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,jy(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||v_(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),Ph(r)&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Xh&&Zh<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?Th(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?Th(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}return e.type==`attributes`?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},Ty=new WeakMap,Ey=!1;function Dy(e){if(!Ty.has(e)&&(Ty.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Qh,Ey)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),Ey=!0}}function Oy(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Ah(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function ky(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Oy(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?Oy(e,n):null}function Ay(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function jy(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||!F(e)||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function My(e,t,n,r){let{node:i,fromOffset:a,toOffset:o,from:s,to:c}=e.docView.parseRange(t,n),l=e.domSelectionRange(),u,d=l.anchorNode;if(d&&Fh(e.dom,d)&&(u=[{node:d,offset:l.anchorOffset}],Bh(l)||u.push({node:l.focusNode,offset:l.focusOffset})),eg&&e.input.lastKeyCode===8)for(let e=o;e>a;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){o=e;break}if(!n||n.size)break}let f=e.state.doc,p=e.someProp(`domParser`)||Cd.fromSchema(e.state.schema),m=f.resolve(s),h=null,g=p.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:a,to:o,preserveWhitespace:m.parent.type.whitespace!=`pre`||`full`,findPositions:u,ruleFromNode:Ny(r),context:m});if(u&&u[0].pos!=null){let e=u[0].pos,t=u[1]&&u[1].pos;t??=e,h={anchor:e+s,head:t+s}}return{doc:g,sel:h,from:s,to:c}}var Ny=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName==`BR`&&t.parentNode){if(ng&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}if(t.parentNode.lastChild==t||ng&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName==`IMG`&&t.getAttribute(`mark-placeholder`))return{ignore:!0};return null},Py=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Fy(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=g_(e,t);if(n&&!e.state.selection.eq(n)){if(eg&&og&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,Vh(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=My(e,t,n,i),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=Vy(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(rg&&e.input.lastIOSEnter>Date.now()-225||og)&&i.some(e=>F(e)&&!Py.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Vh(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m){if(r&&c instanceof N&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Iy(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof N&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Xh&&Zh<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((rg&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&zy(l.doc,h.pos,g.pos))&&e.someProp(`handleKeyDown`,t=>t(e,Vh(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&Ry(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Vh(8,`Backspace`)))){og&&eg&&e.domObserver.suppressSelectionUpdates();return}eg&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),og&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Vh(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Iy(e,n.doc,l.sel);t&&!(eg&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||Xh&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v){if(h.pos==g.pos){Xh&&Zh<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>v_(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=Ly(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x())}else e.dispatch(x())}function Iy(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:D_(e,t.resolve(n.anchor),t.resolve(n.head))}function Ly(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(j.from(l).eq(e))return{mark:s,type:o}}function Ry(e,t,n,r,i){if(n-t<=i.pos-r.pos||By(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(By(a,!0,!0));return!o.parent.isTextblock||o.pos>n||By(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function zy(e,t,n){let r=0,i=0;return e.nodesBetween(t,n,(e,a)=>{e.isTextblock&&a>=t&&a<n?r++:(e.isText?/\S/.test(e.text.slice(Math.max(0,t-a),Math.min(e.nodeSize,n-a))):e.isLeaf)&&i++}),i==0&&r==1}function By(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Vy(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var Hy=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new mv,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Yy),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Gy(this),Wy(this),this.nodeViews=qy(this),this.docView=Xg(this.state.doc,Uy(this),by(this),this.dom,this),this.domObserver=new wy(this,(e,t,n,r)=>Fy(this,e,t,n,r)),this.domObserver.start(),hv(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&vv(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Yy),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(Hv(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=qy(this);Jy(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&vv(this),this.editable=Gy(this),Wy(this);let o=by(this),s=Uy(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&pg(this);if(i){this.domObserver.stop();let t=l&&(Xh||eg)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&Ky(n.selection,e.selection);if(l){let n=eg?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Uv(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=Xg(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&A_(this)&&i.delaySelUpdate())?v_(this,t):(T_(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&hg(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&Fh(this.dom,e)&&!this.someProp(`handleScrollToSelection`,e=>e(this))){if(this.state.selection instanceof P){let t=this.docView.domAfterPos(this.state.selection.from);F(t)&&fg(this,t.getBoundingClientRect(),e)}else fg(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Zv(e.slice,e.move,r<0?void 0:P.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(Xh){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&vg(this.dom),v_(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Eg(this,e)}coordsAtPos(e,t=1){return Ag(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Bg(this,t||this.state,e)}pasteHTML(e,t){return Yv(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return Yv(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return Y_(this,e)}destroy(){this.docView&&(_v(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],by(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,kh())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xv(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?ng&&this.root.nodeType===11&&Hh(this.dom.ownerDocument)==this.dom&&ky(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Hy.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Uy(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[ay.node(0,e.state.doc.content.size,t)]}function Wy(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:ay.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Gy(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function Ky(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function qy(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function Jy(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function Yy(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}function Xy(e,t){return e.meta={package:`@milkdown/core`,group:`System`,...t},e}var Zy={text:(e,t,n,r)=>{let i=e.value;return/^[^*_\\]*\s+$/.test(i)?i:n.safe(i,{...r,encode:[]})},strong:(e,t,n,r)=>{let i=e.marker||n.options.strong||`*`,a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i);return s+=o.move(n.containerPhrasing(e,{before:s,after:i,...o.current()})),s+=o.move(i+i),a(),s},emphasis:(e,t,n,r)=>{let i=e.marker||n.options.emphasis||`*`,a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i);return s+=o.move(n.containerPhrasing(e,{before:s,after:i,...o.current()})),s+=o.move(i),a(),s}},Qy=Ci({},`editorView`),$y=Ci({},`editorState`),eb=Ci([],`initTimer`),tb=Ci({},`editor`),nb=Ci([],`inputRules`),rb=Ci([],`prosePlugins`),ib=Ci([],`remarkPlugins`),ab=Ci([],`nodeView`),ob=Ci([],`markView`),sb=Ci(uu().use(Is).use(Fl),`remark`),cb=Ci({handlers:Zy,encode:[]},`remarkStringifyOptions`),lb=ki(`ConfigReady`);function ub(e){let t=t=>(t.record(lb),async()=>(await e(t),t.done(lb),()=>{t.clearTimer(lb)}));return Xy(t,{displayName:`Config`}),t}var db=ki(`InitReady`);function fb(e){let t=t=>(t.inject(tb,e).inject(rb,[]).inject(ib,[]).inject(nb,[]).inject(ab,[]).inject(ob,[]).inject(cb,{handlers:Zy,encode:[]}).inject(sb,uu().use(Is).use(Fl)).inject(eb,[lb]).record(db),async()=>{await t.waitTimers(eb);let e=t.get(cb);return t.set(sb,uu().use(Is).use(Fl,e)),t.done(db),()=>{t.remove(tb).remove(rb).remove(ib).remove(nb).remove(ab).remove(ob).remove(cb).remove(sb).remove(eb).clearTimer(db)}});return Xy(t,{displayName:`Init`}),t}var pb=ki(`SchemaReady`),mb=Ci([],`schemaTimer`),hb=Ci({},`schema`),gb=Ci([],`nodes`),_b=Ci([],`marks`);function vb(e){return{...e,parseDOM:e.parseDOM?.map(t=>({priority:e.priority,...t}))}}var yb=e=>(e.inject(hb,{}).inject(gb,[]).inject(_b,[]).inject(mb,[db]).record(pb),async()=>{await e.waitTimers(mb);let t=e.get(sb),n=e.get(ib).reduce((e,t)=>e.use(t.plugin,t.options),t);e.set(sb,n);let r=new yd({nodes:Object.fromEntries(e.get(gb).map(([e,t])=>[e,vb(t)])),marks:Object.fromEntries(e.get(_b).map(([e,t])=>[e,vb(t)]))});return e.set(hb,r),e.done(pb),()=>{e.remove(hb).remove(gb).remove(_b).remove(mb).clearTimer(pb)}});Xy(yb,{displayName:`Schema`});var bb=class{constructor(){this.#e=new bi,this.#t=null,this.setCtx=e=>{this.#t=e},this.chain=()=>{if(this.#t==null)throw mi();let e=this.#t,t=[],n=this.get.bind(this),r={run:()=>{let n=am(...t),r=e.get(Qy);return n(r.state,r.dispatch,r)},inline:e=>(t.push(e),r),pipe:i.bind(this)};function i(e,i){let a=n(e);return t.push(a(i)),r}return r}}#e;#t;get ctx(){return this.#t}create(e,t){let n=e.create(this.#e.sliceMap);return n.set(t),n}get(e){return this.#e.get(e).get()}remove(e){return this.#e.remove(e)}call(e,t){if(this.#t==null)throw mi();let n=this.get(e)(t),r=this.#t.get(Qy);return n(r.state,r.dispatch,r)}inline(e){if(this.#t==null)throw mi();let t=this.#t.get(Qy);return e(t.state,t.dispatch,t)}};function xb(e=`cmdKey`){return Ci((()=>()=>!1),e)}var I=Ci(new bb,`commands`),Sb=Ci([pb],`commandsTimer`),Cb=ki(`CommandsReady`),wb=e=>{let t=new bb;return t.setCtx(e),e.inject(I,t).inject(Sb,[pb]).record(Cb),async()=>(await e.waitTimers(Sb),e.done(Cb),()=>{e.remove(I).remove(Sb).clearTimer(Cb)})};Xy(wb,{displayName:`Commands`});function Tb(e){return e.Backspace=am(pm,kp,Mp,Fp),e}var Eb=class{constructor(){this.#e=null,this.#t=[],this.setCtx=e=>{this.#e=e},this.add=e=>(this.#t.push(e),()=>{this.#t=this.#t.filter(t=>t!==e)}),this.addObjectKeymap=e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{if(typeof n==`function`){let r={key:e,onRun:()=>n};this.#t.push(r),t.push(()=>{this.#t=this.#t.filter(e=>e!==r)})}else this.#t.push(n),t.push(()=>{this.#t=this.#t.filter(e=>e!==n)})}),()=>{t.forEach(e=>e())}},this.addBaseKeymap=()=>{let e=Tb(um);return this.addObjectKeymap(e)},this.build=()=>{let e={};return this.#t.forEach(t=>{e[t.key]=[...e[t.key]||[],t]}),Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=t.sort((e,t)=>(t.priority??50)-(e.priority??50));return[e,(e,t,r)=>{let i=this.#e;if(i==null)throw si();return am(...n.map(e=>e.onRun(i)))(e,t,r)}]}))}}#e;#t;get ctx(){return this.#e}},Db=Ci(new Eb,`keymap`),Ob=Ci([pb],`keymapTimer`),kb=ki(`KeymapReady`),Ab=e=>{let t=new Eb;return t.setCtx(e),e.inject(Db,t).inject(Ob,[pb]).record(kb),async()=>(await e.waitTimers(Ob),e.done(kb),()=>{e.remove(Db).remove(Ob).clearTimer(kb)})},jb=ki(`ParserReady`),Mb=(()=>{throw si()}),Nb=Ci(Mb,`parser`),Pb=Ci([],`parserTimer`),Fb=e=>(e.inject(Nb,Mb).inject(Pb,[pb]).record(jb),async()=>{await e.waitTimers(Pb);let t=e.get(sb),n=e.get(hb);return e.set(Nb,xh.create(n,t)),e.done(jb),()=>{e.remove(Nb).remove(Pb).clearTimer(jb)}});Xy(Fb,{displayName:`Parser`});var Ib=ki(`SerializerReady`),Lb=Ci([],`serializerTimer`),Rb=(()=>{throw si()}),zb=Ci(Rb,`serializer`),Bb=e=>(e.inject(zb,Rb).inject(Lb,[pb]).record(Ib),async()=>{await e.waitTimers(Lb);let t=e.get(sb),n=e.get(hb);return e.set(zb,wh.create(n,t)),e.done(Ib),()=>{e.remove(zb).remove(Lb).clearTimer(Ib)}});Xy(Bb,{displayName:`Serializer`});var Vb=Ci(``,`defaultValue`),Hb=Ci(e=>e,`stateOptions`),Ub=Ci([],`editorStateTimer`),Wb=ki(`EditorStateReady`);function Gb(e,t,n){if(typeof e==`string`)return t(e);if(e.type===`html`)return Cd.fromSchema(n).parse(e.dom);if(e.type===`json`)return Ju.fromJSON(n,e.value);throw ii(e)}var Kb=new Op(`MILKDOWN_STATE_TRACKER`),qb=e=>(e.inject(Vb,``).inject($y,{}).inject(Hb,e=>e).inject(Ub,[jb,Ib,Cb,kb]).record(Wb),async()=>{await e.waitTimers(Ub);let t=e.get(hb),n=e.get(Nb),r=e.get(nb),i=e.get(Hb),a=e.get(rb),o=Gb(e.get(Vb),n,t),s=e.get(Db),c=s.addBaseKeymap(),l=[...a,new Tp({key:Kb,state:{init:()=>{},apply:(t,n,r,i)=>{e.set($y,i)}}}),Rm({rules:r}),gh(s.build())];e.set(rb,l);let u=i({schema:t,doc:o,plugins:l}),d=Cp.create(u);return e.set($y,d),e.done(Wb),()=>{c(),e.remove(Vb).remove($y).remove(Hb).remove(Ub).clearTimer(Wb)}});Xy(qb,{displayName:`EditorState`});var Jb=Ci([],`pasteRule`),Yb=Ci([pb],`pasteRuleTimer`),Xb=ki(`PasteRuleReady`),Zb=e=>(e.inject(Jb,[]).inject(Yb,[pb]).record(Xb),async()=>(await e.waitTimers(Yb),e.done(Xb),()=>{e.remove(Jb).remove(Yb).clearTimer(Xb)}));Xy(Zb,{displayName:`PasteRule`});var Qb=ki(`EditorViewReady`),$b=Ci([],`editorViewTimer`),ex=Ci({},`editorViewOptions`),tx=Ci(null,`root`),nx=Ci(null,`rootDOM`),rx=Ci({},`rootAttrs`);function ix(e,t){let n=document.createElement(`div`);n.className=`milkdown`,e.appendChild(n),t.set(nx,n);let r=t.get(rx);return Object.entries(r).forEach(([e,t])=>n.setAttribute(e,t)),n}function ax(e){e.classList.add(`editor`),e.setAttribute(`role`,`textbox`)}var ox=new Op(`MILKDOWN_VIEW_CLEAR`),sx=e=>(e.inject(tx,document.body).inject(Qy,{}).inject(ex,{}).inject(nx,null).inject(rx,{}).inject($b,[Wb,Xb]).record(Qb),async()=>{await e.wait(db);let t=e.get(tx)||document.body,n=typeof t==`string`?document.querySelector(t):t;e.update(rb,t=>[new Tp({key:ox,view:t=>{let r=n?ix(n,e):void 0;return(()=>{if(r&&n){let e=t.dom;n.replaceChild(r,e),r.appendChild(e)}})(),{destroy:()=>{r?.parentNode&&r?.parentNode.replaceChild(t.dom,r),r?.remove()}}}}),...t]),await e.waitTimers($b);let r=e.get($y),i=e.get(ex),a=new Hy(n,{state:r,nodeViews:Object.fromEntries(e.get(ab)),markViews:Object.fromEntries(e.get(ob)),transformPasted:(t,n,r)=>(e.get(Jb).sort((e,t)=>(t.priority??50)-(e.priority??50)).map(e=>e.run).forEach(e=>{t=e(t,n,r)}),t),...i});return ax(a.dom),e.set(Qy,a),e.done(Qb),()=>{a?.destroy(),e.remove(tx).remove(Qy).remove(ex).remove(nx).remove(rx).remove($b).clearTimer(Qb)}});Xy(sx,{displayName:`EditorView`});var cx=function(e){return e.Idle=`Idle`,e.OnCreate=`OnCreate`,e.Created=`Created`,e.OnDestroy=`OnDestroy`,e.Destroyed=`Destroyed`,e}({}),lx=class e{constructor(){this.#e=!1,this.#t=`Idle`,this.#n=[],this.#r=()=>void 0,this.#i=new bi,this.#a=new Ei,this.#o=new Map,this.#s=new Map,this.#c=new Ti(this.#i,this.#a),this.#l=()=>{let e=ub(async e=>{await Promise.all(this.#n.map(t=>Promise.resolve(t(e))))}),t=[yb,Fb,Bb,wb,Ab,Zb,qb,sx,fb(this),e];this.#u(t,this.#s)},this.#u=(e,t)=>{e.forEach(e=>{let n=this.#c.produce(this.#e?e.meta:void 0),r=e(n);t.set(e,{ctx:n,handler:r,cleanup:void 0})})},this.#d=(e,t=!1)=>Promise.all([e].flat().map(async e=>{let n=this.#o.get(e)?.cleanup;return t?this.#o.delete(e):this.#o.set(e,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof n==`function`?n():n})),this.#f=async()=>{await Promise.all([...this.#s.entries()].map(async([e,{cleanup:t}])=>typeof t==`function`?t():t)),this.#s.clear()},this.#p=e=>{this.#t=e,this.#r(e)},this.#m=e=>[...e.entries()].map(async([t,n])=>{let{ctx:r,handler:i}=n;if(!i)return;let a=await i();e.set(t,{ctx:r,handler:i,cleanup:a})}),this.enableInspector=(e=!0)=>(this.#e=e,this),this.onStatusChange=e=>(this.#r=e,this),this.config=e=>(this.#n.push(e),this),this.removeConfig=e=>(this.#n=this.#n.filter(t=>t!==e),this),this.use=e=>{let t=[e].flat();return t.flat().forEach(e=>{this.#o.set(e,{ctx:void 0,handler:void 0,cleanup:void 0})}),this.#t===`Created`&&this.#u(t,this.#o),this},this.remove=async e=>this.#t===`OnCreate`?(console.warn(`[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code.`),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await this.#d([e].flat(),!0),this),this.create=async()=>this.#t===`OnCreate`?this:(this.#t===`Created`&&await this.destroy(),this.#p(`OnCreate`),this.#l(),this.#u([...this.#o.keys()],this.#o),await Promise.all([this.#m(this.#s),this.#m(this.#o)].flat()),this.#p(`Created`),this),this.destroy=async(e=!1)=>this.#t===`Destroyed`||this.#t===`OnDestroy`?this:this.#t===`OnCreate`?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&(this.#n=[]),this.#p(`OnDestroy`),await this.#d([...this.#o.keys()],e),await this.#f(),this.#p(`Destroyed`),this),this.action=e=>e(this.#c),this.inspect=()=>this.#e?[...this.#s.values(),...this.#o.values()].map(({ctx:e})=>e?.inspector?.read()).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new e}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;get ctx(){return this.#c}get status(){return this.#t}},ux=e=>crypto.getRandomValues(new Uint8Array(e)),dx=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i|=0;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}return(i=t)=>{if(!i)return``;let a=``,o=Math.ceil(409.6*i/r);for(;;){let t=n(o),s=o;for(;s--;)if(t[s]<r&&(a+=e[t[s]%e.length],a.length>=i))return a}}},fx=(e,t=21)=>dx(e,t|0,ux);fx(`abcedfghicklmn`,10);function px(e,t,n){let r=e.findIndex(([e])=>e===t);if(r===-1)return[...e,n];let i=e.slice();return i[r]=n,i}function L(e,t){let n=xb(e),r=i=>async()=>{r.key=n,await i.wait(Cb);let a=t(i);return i.get(I).create(n,a),r.run=t=>i.get(I).call(e,t),()=>{i.get(I).remove(n)}};return r}function mx(e){let t=n=>async()=>{await n.wait(pb);let r=e(n);return n.update(nb,e=>[...e,r]),t.inputRule=r,()=>{n.update(nb,e=>e.filter(e=>e!==r))}};return t}function hx(e){let t=n=>async()=>{await n.wait(pb);let r=e(n);return n.update(Jb,e=>[...e,r]),t.pasteRule=r,()=>{n.update(Jb,e=>e.filter(e=>e!==r))}};return t}function gx(e,t){let n=r=>async()=>{let i=t(r);return r.update(_b,t=>px(t,e,[e,i])),n.id=e,n.schema=i,()=>{r.update(_b,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{let n=t.get(hb).marks[e];if(!n)throw gi(e);return n},n}function _x(e,t){let n=r=>async()=>{let i=t(r);return r.update(gb,t=>px(t,e,[e,i])),n.id=e,n.schema=i,()=>{r.update(gb,t=>t.filter(([t])=>t!==e))}};return n.type=t=>{let n=t.get(hb).nodes[e];if(!n)throw hi(e);return n},n}function vx(e){let t,n=n=>async()=>(await n.wait(pb),t=e(n),n.update(rb,e=>[...e,t]),()=>{n.update(rb,e=>e.filter(e=>e!==t))});return n.plugin=()=>t,n.key=()=>t.spec.key,n}function yx(e){let t=n=>async()=>{await n.wait(kb);let r=n.get(Db),i=e(n),a=r.addObjectKeymap(i);return t.keymap=i,()=>{a()}};return t}function bx(e,t){let n=r=>async()=>{await r.wait(pb);let i=t(r);return e.type(r)instanceof hd?r.update(ab,t=>[...t,[e.id,i]]):r.update(ob,t=>[...t,[e.id,i]]),n.view=i,n.type=e,()=>{e.type(r)instanceof hd?r.update(ab,t=>t.filter(t=>t[0]!==e.id)):r.update(ob,t=>t.filter(t=>t[0]!==e.id))}};return n}function xx(e,t){let n=Ci(e,t),r=e=>(e.inject(n),()=>()=>{e.remove(n)});return r.key=n,r}function Sx(e,t){let n=xx(t,e),r=_x(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.node=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>Sx(e,n(t)),i}function Cx(e,t){let n=xx(t,e),r=gx(e,e=>e.get(n.key)(e)),i=[n,r];return i.id=r.id,i.mark=r,i.type=e=>r.type(e),i.ctx=n,i.key=n.key,i.extendSchema=n=>Cx(e,n(t)),i}function wx(e,t){let n=xx(Object.fromEntries(Object.entries(t).map(([e,{shortcuts:t,priority:n}])=>[e,{shortcuts:t,priority:n}])),`${e}Keymap`),r=yx(e=>{let r=e.get(n.key),i=Object.entries(t).flatMap(([e,{command:t}])=>{let n=r[e],i=[n.shortcuts].flat(),a=n.priority;return i.map(e=>[e,{key:e,onRun:t,priority:a}])});return Object.fromEntries(i)}),i=[n,r];return i.ctx=n,i.shortcuts=r,i.key=n.key,i.keymap=r.keymap,i}var Tx=(e,t=()=>({}))=>xx(t,`${e}Attr`),Ex=(e,t=()=>({}))=>xx(t,`${e}Attr`);function Dx(e,t,n){let r=xx(n??{},e),i=e=>async()=>{await e.wait(db);let n={plugin:t(e),options:e.get(r.key)};return e.update(ib,e=>[...e,n]),()=>{e.update(ib,e=>e.filter(e=>e!==n))}},a=[r,i];return a.id=e,a.plugin=i,a.options=r,a}function Ox(e){return t=>{let n=t.get(Qy),r=t.get(hb),i=t.get(zb);if(!e)return i(n.state.doc);let a=n.state.doc.slice(e.from,e.to,!0),o=r.topNodeType.createAndFill(null,a.content);return o?i(o):(console.error(`No document found`),``)}}function kx(e){let t=e.schema.cached.changeSetIDs||(e.schema.cached.changeSetIDs=Object.create(null)),n=t[e.name];return n??(t[e.name]=n=Object.keys(e.schema.nodes).indexOf(e.name)+1),n}var Ax={encodeCharacter:e=>e,encodeNodeStart:e=>e.type.name,encodeNodeEnd:e=>-kx(e.type),compareTokens:(e,t)=>e===t};function jx(e,t,n,r,i){for(let a=0,o=0;a<e.childCount;a++){let s=e.child(a),c=o+s.nodeSize,l=Math.max(o,n),u=Math.min(c,r);if(l<u){if(s.isText)for(let e=l;e<u;e++)i.push(t.encodeCharacter(s.text.charCodeAt(e-o),s.marks));else s.isLeaf?i.push(t.encodeNodeStart(s)):(l==o&&i.push(t.encodeNodeStart(s)),jx(s.content,t,Math.max(o+1,l)-o-1,Math.min(c-1,u)-o-1,i),u==c&&i.push(t.encodeNodeEnd(s)))}o=c}return i}var Mx=2500,Nx=1e4;function Px(e,t){return Math.min(15,Math.max(2,Math.floor(Math.max(e,t)/10)))}function Fx(e,t,n,r=Ax){return Math.max(n.toA-n.fromA,n.toB-n.fromB)>Nx?[n]:Ix(jx(e,r,n.fromA,n.toA,[]),jx(t,r,n.fromB,n.toB,[]),n,r.compareTokens)}function Ix(e,t,n,r){let i=0,a=e.length,o=t.length;for(;i<e.length&&i<t.length&&r(e[i],t[i]);)i++;if(i==e.length&&i==t.length)return[];for(;a>i&&o>i&&r(e[a-1],t[o-1]);)a--,o--;if(a==i&&o==i)return[];if(a==i||o==i||a==o&&a==i+1||Math.max(a,o)-i>Mx)return[n.slice(i,a,i,o)];let s=a-i,c=o-i,l=Math.min(Mx,s+c),u=[],d=new Int16Array((l+1)*2).fill(-1);for(let f=0;f<=l;f++){for(let p=-f;p<=f;p+=2){let m=d[p+1+l],h=d[p-1+l],g=m<h?h:m+1,_=g+p;for(;g<s&&_<c&&r(e[i+g],t[i+_]);)g++,_++;if(d[p+l]=g,g>=s&&_>=c){let e=[],t=Px(a-i,o-i),r=-1,s=-1,c=-1,m=-1,h=(i,a,o,l)=>{r>-1&&r<a+t?(r=i,c=o):(r>-1&&e.push(n.slice(r,s,c,m)),r=i,s=a,c=o,m=l)};for(let e=f-1;e>=0;e--){let t=d[p+1+l],n=d[p-1+l];t<n?(p--,g=n+i,_=g+p,h(g,g,_,_+1)):(p++,g=t+i,_=g+p,h(g,g+1,_,_)),d=u[e>>1]}return r>-1&&e.push(n.slice(r,s,c,m)),e.reverse()}}f%2==0&&u.push(d.slice())}return[n.slice(i,a,i,o)]}var Lx=class e{constructor(e,t){this.length=e,this.data=t}cut(t){return t==this.length?this:new e(t,this.data)}static slice(t,n,r){if(n==r)return e.none;if(n==0&&r==e.len(t))return t;let i=[];for(let e=0,a=0;a<r;e++){let o=t[e],s=a+o.length,c=Math.min(r,s)-Math.max(n,a);c>0&&i.push(o.cut(c)),a=s}return i}static join(t,n,r){if(t.length==0)return n;if(n.length==0)return t;let i=r(t[t.length-1].data,n[0].data);if(i==null)return t.concat(n);let a=t.slice(0,t.length-1);a.push(new e(t[t.length-1].length+n[0].length,i));for(let e=1;e<n.length;e++)a.push(n[e]);return a}static len(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;return t}};Lx.none=[];var Rx=class e{constructor(e,t,n,r,i,a){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r,this.deleted=i,this.inserted=a}get lenA(){return this.toA-this.fromA}get lenB(){return this.toB-this.fromB}slice(t,n,r,i){return t==0&&r==0&&n==this.toA-this.fromA&&i==this.toB-this.fromB?this:new e(this.fromA+t,this.fromA+n,this.fromB+r,this.fromB+i,Lx.slice(this.deleted,t,n),Lx.slice(this.inserted,r,i))}static merge(t,n,r){if(t.length==0)return n;if(n.length==0)return t;let i=[];for(let a=0,o=0,s=t[0],c=n[0];;)if(!s&&!c)return i;else if(s&&(!c||s.toB<c.fromA)){let r=o?n[o-1].toB-n[o-1].toA:0;i.push(r==0?s:new e(s.fromA,s.toA,s.fromB+r,s.toB+r,s.deleted,s.inserted)),s=a++==t.length?null:t[a]}else if(c&&(!s||c.toA<s.fromB)){let r=a?t[a-1].toB-t[a-1].toA:0;i.push(r==0?c:new e(c.fromA-r,c.toA-r,c.fromB,c.toB,c.deleted,c.inserted)),c=o++==n.length?null:n[o]}else{let l=Math.min(s.fromB,c.fromA),u=Math.min(s.fromA,c.fromA-(a?t[a-1].toB-t[a-1].toA:0)),d=u,f=Math.min(c.fromB,s.fromB+(o?n[o-1].toB-n[o-1].toA:0)),p=f,m=Lx.none,h=Lx.none,g=!1,_=!1;for(;;){let e=s?l>=s.fromB?s.toB:s.fromB:2e8,i=c?l>=c.fromA?c.toA:c.fromA:2e8,u=Math.min(e,i),f=s&&l>=s.fromB,v=c&&l>=c.fromA;if(!f&&!v)break;f&&l==s.fromB&&!g&&(m=Lx.join(m,s.deleted,r),d+=s.lenA,g=!0),f&&!v&&(h=Lx.join(h,Lx.slice(s.inserted,l-s.fromB,u-s.fromB),r),p+=u-l),v&&l==c.fromA&&!_&&(h=Lx.join(h,c.inserted,r),p+=c.lenB,_=!0),v&&!f&&(m=Lx.join(m,Lx.slice(c.deleted,l-c.fromA,u-c.fromA),r),d+=u-l),f&&u==s.toB&&(s=a++==t.length?null:t[a],g=!1),v&&u==c.toA&&(c=o++==n.length?null:n[o],_=!1),l=u}(u<d||f<p)&&i.push(new e(u,d,f,p,m,h))}}static fromJSON(t){return new e(t.fromA,t.toA,t.fromB,t.toB,t.deleted.map(e=>new Lx(e.length,e.data)),t.inserted.map(e=>new Lx(e.length,e.data)))}toJSON(){return this}},zx=class e{constructor(e,t){this.config=e,this.changes=t}addSteps(t,n,r){let i=[];for(let e=0;e<n.length;e++){let t=Array.isArray(r)?r[e]:r,a=0;n[e].forEach((e,n,r,o)=>{i.push(new Rx(e+a,n+a,r,o,e==n?Lx.none:[new Lx(n-e,t)],r==o?Lx.none:[new Lx(o-r,t)])),a=o-r-(n-e)})}if(i.length==0)return this;let a=Bx(i,this.config.combine),o=Rx.merge(this.changes,a,this.config.combine),s=o;for(let e=0;e<s.length;e++){let n=s[e];if(n.fromA==n.toA||n.fromB==n.toB||!a.some(e=>e.toB>n.fromB&&e.fromB<n.toB))continue;let r=Fx(this.config.doc.content,t.content,n,this.config.encoder);(r.length!=1||r[0].fromB!=0||r[0].toB!=n.toB-n.fromB)&&(s==o&&(s=o.slice()),r.length==1?s[e]=r[0]:(s.splice(e,1,...r),e+=r.length-1))}return new e(this.config,s)}get startDoc(){return this.config.doc}map(t){let n=e=>{let n=t(e);return n===e.data?e:new Lx(e.length,n)};return new e(this.config,this.changes.map(e=>new Rx(e.fromA,e.toA,e.fromB,e.toB,e.deleted.map(n),e.inserted.map(n))))}changedRange(e,t){if(e==this)return null;let n=t&&Hx(t),r=n?n.toB-n.fromB-(n.toA-n.fromA):0;function i(e){return!n||e<=n.fromA?e:e+r}let a=n?n.fromB:2e8,o=n?n.toB:-2e8;function s(e,t=e){a=Math.min(e,a),o=Math.max(t,o)}let c=this.changes,l=e.changes;for(let e=0,t=0;e<c.length&&t<l.length;){let n=c[e],r=l[t];n&&r&&Ux(n,r,i)?(e++,t++):r&&(!n||i(n.fromB)>=r.fromB)?(s(r.fromB,r.toB),t++):(s(i(n.fromB),i(n.toB)),e++)}return a<=o?{from:a,to:o}:null}static create(t,n=(e,t)=>e===t?e:null,r=Ax,i=[]){return new e({combine:n,doc:t,encoder:r},i)}};zx.computeDiff=Fx;function Bx(e,t,n=0,r=e.length){if(r==n+1)return[e[n]];let i=n+r>>1;return Rx.merge(Bx(e,t,n,i),Bx(e,t,i,r),t)}function Vx(e){let t=2e8,n=-2e8;for(let r=0;r<e.length;r++){let i=e[r];t!=2e8&&(t=i.map(t,-1),n=i.map(n,1)),i.forEach((e,r,i,a)=>{t=Math.min(t,i),n=Math.max(n,a)})}return t==2e8?null:{from:t,to:n}}function Hx(e){let t=Vx(e);if(!t)return null;let n=Vx(e.map(e=>e.invert()).reverse());return{fromA:n.from,toA:n.to,fromB:t.from,toB:t.to}}function Ux(e,t,n){return n(e.fromB)==t.fromB&&n(e.toB)==t.toB&&Wx(e.deleted,t.deleted)&&Wx(e.inserted,t.inserted)}function Wx(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].length!=t[n].length||e[n].data!==t[n].data)return!1;return!0}function Gx(e,t){return Object.assign(e,{meta:{package:`@milkdown/plugin-diff`,...t}}),e}var Kx=500;function qx(e={}){let t=new WeakMap,n=new WeakMap;function r(e){let n=t.get(e);if(n!=null)return n;let r=e.attrs,i=r?Object.keys(r).filter(e=>r[e]!=null).sort():[];if(i.length===0)n=e.type.name;else{let t={};for(let e of i)t[e]=r[e];n=`${e.type.name}:${JSON.stringify(t)}`}return t.set(e,n),n}return{encodeCharacter:(e,t)=>{if(t.length===0)return e;let i=n.get(t);return i??(i=t.map(r).join(`,`),n.set(t,i)),`${e}:${i}`},encodeNodeStart:t=>{let n=t.attrs;if(n&&Object.keys(n).length>0){let r=e[t.type.name]??[],i=Object.keys(n).filter(e=>{if(r.includes(e))return!1;let i=t.type.spec.attrs?.[e]?.default;return n[e]!==i});if(i.length>0){let e={};for(let t of i.sort())e[t]=n[t];return`${t.type.name}:${JSON.stringify(e)}`}}return t.type.name},encodeNodeEnd:e=>{let t=e.type.schema,n=t.cached.changeSetIDs||(t.cached.changeSetIDs=Object.create(null)),r=n[e.type.name];return r??(n[e.type.name]=r=Object.keys(t.nodes).indexOf(e.type.name)+1),-r},compareTokens:(e,t)=>e===t}}function Jx(e,t,n){let r=n.get(e);if(r!=null)return r;let i=[String(t.encodeNodeStart(e))];if(e.isText){let n=e.text;for(let r=0;r<n.length;r++)i.push(`:`+String(t.encodeCharacter(n.charCodeAt(r),e.marks)))}else e.content.forEach(e=>{i.push(`/`+Jx(e,t,n))});i.push(`\\`+String(t.encodeNodeEnd(e)));let a=i.join(``);return n.set(e,a),a}function Yx(e,t,n){let r=[],i=0;return e.content.forEach(e=>{r.push({node:e,offset:i,size:e.nodeSize,signature:Jx(e,n.encoder,n.sigCache)}),i+=e.nodeSize}),{node:e,contentStart:t,content:r}}function Xx(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array.from({length:r+1},()=>0));for(let a=n-1;a>=0;a--)for(let n=r-1;n>=0;n--)e[a].signature===t[n].signature?i[a][n]=i[a+1][n+1]+1:i[a][n]=Math.max(i[a+1][n],i[a][n+1]);let a=[],o=0,s=0;for(;o<n&&s<r;)e[o].signature===t[s].signature?(a.push([o,s]),o++,s++):i[o+1][s]>=i[o][s+1]?o++:s++;return a}function Zx(e,t){if(e.type!==t.type)return!1;let n=e.type;return!(n.isTextblock||n.isAtom||n.spec.code===!0||!n.isBlock)}function Qx(e,t,n){return Rx.fromJSON({fromA:e.fromA+t,toA:e.toA+t,fromB:e.fromB+n,toB:e.toB+n,deleted:e.deleted.map(e=>({length:e.length,data:e.data})),inserted:e.inserted.map(e=>({length:e.length,data:e.data}))})}function $x(e,t,n){let r=e.parent.copy(j.from(e.node)),i=t.parent.copy(j.from(t.node)),a=new df(0,r.content.size,new M(i.content,0,0));return zx.create(r,void 0,n.encoder).addSteps(i,[a.getMap()],null).changes.map(n=>Qx(n,e.abs,t.abs))}function eS(e,t){let n=e.content;if(t<n.length)return e.contentStart+n[t].offset;if(t>0){let r=n[t-1];return e.contentStart+r.offset+r.size}return e.contentStart+e.node.content.size}function tS(e,t,n){return Rx.fromJSON({fromA:t,toA:t+e.size,fromB:n,toB:n,deleted:[{length:e.size,data:null}],inserted:[]})}function nS(e,t,n){return Rx.fromJSON({fromA:t,toA:t,fromB:n,toB:n+e.size,deleted:[],inserted:[{length:e.size,data:null}]})}function rS(e,t,n,r,i){let a=new df(0,e.content.size,new M(t.content,0,0));return zx.create(e,void 0,i.encoder).addSteps(t,[a.getMap()],null).changes.map(e=>Qx(e,n,r))}function iS(e,t,n,r,i){if(e.childCount>Kx||t.childCount>Kx)return rS(e,t,n,r,i);let a=Yx(e,n,i),o=Yx(t,r,i),s=Xx(a.content,o.content),c=[],l=0,u=0;for(let[e,t]of s)aS(a,o,{oldStart:l,oldEnd:e,newStart:u,newEnd:t},i,c),l=e+1,u=t+1;return aS(a,o,{oldStart:l,oldEnd:a.content.length,newStart:u,newEnd:o.content.length},i,c),c}function aS(e,t,n,r,i){let a=e.content,o=t.content,s=n.oldStart,c=n.newStart;for(;s<n.oldEnd||c<n.newEnd;){let l=s<n.oldEnd?a[s]:null,u=c<n.newEnd?o[c]:null,d=l&&u&&l.node.type===u.node.type;if(l&&u&&d){i.push(...oS(e,t,l,u,r)),s++,c++;continue}if(l&&(!u||!d)){let n=e.contentStart+l.offset;i.push(tS(l,n,eS(t,c))),s++;continue}if(u){let n=t.contentStart+u.offset;i.push(nS(u,eS(e,s),n)),c++}}}function oS(e,t,n,r,i){let a=e.contentStart+n.offset,o=t.contentStart+r.offset;return Zx(n.node,r.node)&&sS(n.node,r.node,i.encoder)?iS(n.node,r.node,a+1,o+1,i):$x({node:n.node,parent:e.node,abs:a},{node:r.node,parent:t.node,abs:o},i)}function sS(e,t,n){return n.encodeNodeStart(e)===n.encodeNodeStart(t)}function cS(e,t,n,r,i){let a=e.resolve(n),o=e.resolve(r),s=t.resolve(n),c=t.resolve(r),l=a.sharedDepth(r);if(s.sharedDepth(r)!==l)throw RangeError(`computeDocDiff: range [${n}, ${r}) resolves to different sharedDepth in old and new docs`);for(let e=0;e<=l;e++){if(i.encodeNodeStart(a.node(e))!==i.encodeNodeStart(s.node(e)))throw RangeError(`computeDocDiff: ancestor at depth ${e} differs in type or non-ignored attrs along the path to the shared ancestor`);if(a.start(e)!==s.start(e))throw RangeError(`computeDocDiff: ancestor at depth ${e} starts at different absolute positions in old and new docs (content before the range differs in size)`)}let u=a.node(l);if(u.isTextblock)throw RangeError(`computeDocDiff: range [${n}, ${r}) lands inside a textblock; widen the range to a block boundary`);if(a.depth!==l||o.depth!==l||s.depth!==l||c.depth!==l)throw RangeError(`computeDocDiff: range [${n}, ${r}) endpoints must be aligned to child boundaries of the shared ancestor`);let d=s.node(l),f=a.start(l),p=n-f,m=r-f;return{oldCut:u.copy(u.content.cut(p,m)),newCut:d.copy(d.content.cut(p,m)),cutAbsStart:n}}function lS(e,t,n){let r=qx(n?.ignoreAttrs),i={encoder:r,sigCache:new WeakMap},a=e.content.size,o=t.content.size,s=n?.range;if(s==null)return iS(e,t,0,0,i);let c=Math.min(a,o),l=Math.max(0,Math.min(s.from??0,c)),u=Math.max(l,Math.min(s.to??c,c));if(l===u)return[];if(l===0&&u===c&&a===o)return iS(e,t,0,0,i);let d=cS(e,t,l,u,r);return iS(d.oldCut,d.newCut,d.cutAbsStart,d.cutAbsStart,i)}var uS=xx({ignoreAttrs:{heading:[`id`]}},`diffConfig`);Gx(uS,{displayName:`Ctx<diffConfig>`,group:`Diff`});var dS=new Op(`MILKDOWN_DIFF`);function fS(e,t,n){let r=lS(e,t.newDoc,n);return{...t,changes:r}}function pS(e,t){return t.some(t=>e.fromB<t.toB&&e.toB>t.fromB)}function mS(e){return e.changes.filter(t=>!pS(t,e.rejectedRanges))}var hS=vx(e=>{let t=e.get(uS.key);return new Tp({key:dS,state:{init:()=>null,apply(e,n,r,i){let a=e.getMeta(dS);if(!n){if(a?.type===`start`){let e=lS(i.doc,a.newDoc,{ignoreAttrs:t.ignoreAttrs});return{newDoc:a.newDoc,changes:e,rejectedRanges:[],active:!0}}return null}let o=n;if(e.docChanged&&o.active&&(o=fS(i.doc,o,{ignoreAttrs:t.ignoreAttrs})),!a)return o;let s;switch(a.type){case`start`:{let e=lS(i.doc,a.newDoc,{ignoreAttrs:t.ignoreAttrs});return{newDoc:a.newDoc,changes:e,rejectedRanges:[],active:!0}}case`accept`:case`acceptRange`:s=o;break;case`reject`:s={...o,rejectedRanges:[...o.rejectedRanges,{fromB:a.fromB,toB:a.toB}]};break;case`rejectRange`:s={...o,rejectedRanges:[...o.rejectedRanges,{fromB:a.range.fromB,toB:a.range.toB}]};break;case`acceptAll`:case`clear`:return null;default:return o}return s.active&&mS(s).length===0?null:s}},filterTransaction(e,t){return!dS.getState(t)?.active||e.getMeta(dS)?!0:!e.docChanged}})});Gx(hS,{displayName:`Prose<diff>`,group:`Diff`});function gS(e,t){let n=mS(t);for(let r=n.length-1;r>=0;r--){let i=n[r],a=t.newDoc.slice(i.fromB,i.toB);e=e.replace(i.fromA,i.toA,a)}return e}var _S=L(`StartDiffReview`,e=>t=>(n,r)=>{if(t==null)return!1;let i=e.get(Nb)(t);return i?(r&&r(n.tr.setMeta(dS,{type:`start`,newDoc:i})),!0):!1});Gx(_S,{displayName:`Command<startDiffReview>`,group:`Diff`});var vS=L(`StartDiffReviewFromDoc`,()=>e=>(t,n)=>!e||e.type!==t.doc.type?!1:(n&&n(t.tr.setMeta(dS,{type:`start`,newDoc:e})),!0));Gx(vS,{displayName:`Command<startDiffReviewFromDoc>`,group:`Diff`});var yS=L(`AcceptDiffChunk`,()=>e=>(t,n)=>{if(e==null)return!1;let r=dS.getState(t);if(!r)return!1;let i=mS(r)[e];if(!i)return!1;if(n){let a=r.newDoc.slice(i.fromB,i.toB),o=t.tr.replace(i.fromA,i.toA,a);o=o.setMeta(dS,{type:`accept`,changeIndex:e}),n(o)}return!0});Gx(yS,{displayName:`Command<acceptDiffChunk>`,group:`Diff`});var bS=L(`RejectDiffChunk`,()=>e=>(t,n)=>{if(e==null)return!1;let r=dS.getState(t);if(!r)return!1;let i=mS(r)[e];return i?(n&&n(t.tr.setMeta(dS,{type:`reject`,fromB:i.fromB,toB:i.toB})),!0):!1});Gx(bS,{displayName:`Command<rejectDiffChunk>`,group:`Diff`});var xS=L(`AcceptDiffRange`,()=>e=>(t,n)=>{if(!e)return!1;let r=dS.getState(t);if(!r)return!1;if(n){let i=r.newDoc.slice(e.fromB,e.toB),a=t.tr.replace(e.fromA,e.toA,i);a=a.setMeta(dS,{type:`acceptRange`,range:e}),n(a)}return!0});Gx(xS,{displayName:`Command<acceptDiffRange>`,group:`Diff`});var SS=L(`RejectDiffRange`,()=>e=>(t,n)=>!e||!dS.getState(t)?!1:(n&&n(t.tr.setMeta(dS,{type:`rejectRange`,range:e})),!0));Gx(SS,{displayName:`Command<rejectDiffRange>`,group:`Diff`});var CS=L(`AcceptAllDiffs`,()=>()=>(e,t)=>{let n=dS.getState(e);return n?(t&&t((n.rejectedRanges.length===0?e.tr.replaceWith(0,e.doc.content.size,n.newDoc.content):gS(e.tr,n)).setMeta(dS,{type:`acceptAll`})),!0):!1});Gx(CS,{displayName:`Command<acceptAllDiffs>`,group:`Diff`});var wS=L(`ClearDiffReview`,()=>()=>(e,t)=>dS.getState(e)?(t&&t(e.tr.setMeta(dS,{type:`clear`})),!0):!1);Gx(wS,{displayName:`Command<clearDiffReview>`,group:`Diff`});var TS=[uS,hS,_S,vS,yS,xS,bS,SS,CS,wS],ES=Object.defineProperty,DS=Object.getOwnPropertySymbols,OS=Object.prototype.hasOwnProperty,kS=Object.prototype.propertyIsEnumerable,AS=(e,t,n)=>t in e?ES(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jS=(e,t)=>{for(var n in t||={})OS.call(t,n)&&AS(e,n,t[n]);if(DS)for(var n of DS(t))kS.call(t,n)&&AS(e,n,t[n]);return e};function MS(e,t){return Object.assign(e,{meta:jS({package:`@milkdown/components`},t)}),e}var NS=`milkdown-diff`,PS=xx({acceptLabel:`Accept`,rejectLabel:`Reject`,customBlockTypes:[]},`diffComponentConfig`);MS(PS,{displayName:`Ctx<diffComponentConfig>`,group:`DiffComponent`});function FS(e,t,n){if(t===n)return!1;let r=e.resolve(t),i=e.resolve(n);return r.index(0)!==(i.depth===0?Math.max(0,i.index(0)-1):i.index(0))}function IS(e,t,n){if(t>=n)return!1;let r=e.resolve(t),i=e.resolve(n);if(r.sameParent(i)&&r.parent.isTextblock)return!1;let a=!1;return e.nodesBetween(t,n,(e,r)=>{if(a)return!1;if(!e.isBlock)return!0;let i=r+e.nodeSize;return r>=t&&i<=n?(a=!0,!1):!0}),a}function LS(e,t,n){if(n!==e.content.size)return!1;let r=e.resolve(t);if(r.depth!==0)return!1;for(let t=r.index(0);t<e.childCount;t++){let n=e.child(t);if(n.type.name!==`paragraph`||n.content.size>0)return!1}return!0}function RS(e){let t=e.content.size;for(let n=e.childCount-1;n>=0;n--){let r=e.child(n);if(r.type.name!==`paragraph`||r.content.size>0)break;t-=r.nodeSize}return t}function zS(e,t){let n=e.resolve(t);for(let e=n.depth;e>=1;e--)if(n.node(e).isTextblock)return n.before(e);return t}function BS(e,t,n,r){let i=0;for(let a=0;a<e.childCount;a++){let o=e.child(a),s=i+o.nodeSize;if(i>=n)break;s>t&&i<n&&r(o,i,s),i=s}}function VS(e,t,n,r){BS(e,t,n,(t,n,i)=>{(i!==e.content.size||t.type.name!==`paragraph`||t.content.size!==0)&&r.push(ay.node(n,i,{class:`${NS}-removed-block`}))})}function HS(e,t,n=!1){if(t<0||t>e.content.size)return null;let r=e.resolve(Math.min(t,e.content.size));if(r.depth>=1)return{from:r.before(1),to:r.after(1)};if(n){let e=r.nodeBefore;if(e)return{from:t-e.nodeSize,to:t};let n=r.nodeAfter;if(n)return{from:t,to:t+n.nodeSize}}else{let e=r.nodeAfter;if(e)return{from:t,to:t+e.nodeSize};let n=r.nodeBefore;if(n)return{from:t-n.nodeSize,to:t}}return null}function US(e,t,n){if(t<0||t>e.content.size)return null;let r=e.resolve(Math.min(t,e.content.size));for(let e=r.depth;e>=0;e--){let t=r.node(e).type.name;if(n.has(t))return t}return null}function WS(e,t,n,r=!1){let i=US(e,t,n);if(i)return i;let a=e.resolve(Math.min(Math.max(t,0),e.content.size)),o=r?a.nodeBefore:a.nodeAfter;return o&&n.has(o.type.name)?o.type.name:null}function GS(e,t,n){let r=[],i=!0,a=-1,o=-1;return BS(e,t,n,(e,t,n)=>{a===-1&&(a=t),o=n,r.push(e)}),(r.length===0||a!==t||o!==n)&&(i=!1),i?r:[]}function KS(e,t,n,r){return e<r&&t>n}function qS(e,t,n,r){return t===n?US(e,t,r)!=null:WS(e,t,r)!=null||WS(e,n,r,!0)!=null}function JS(e,t,n){let r=e.resolve(n.fromA);if(!r.parent.isTextblock||r.depth<1||!r.node(1).isTextblock)return null;let i=r.after(1),a=t.resolve(n.fromB),o;if(a.depth>=1&&a.node(1).isTextblock?(o=a.after(1),o>n.toB&&(o=n.toB)):o=n.fromB,i>=n.toA&&o>=n.toB)return null;let s=[];return(i>n.fromA||o>n.fromB)&&s.push({fromA:n.fromA,toA:Math.min(i,n.toA),fromB:n.fromB,toB:o,isBlock:!1}),(n.toA>i||n.toB>o)&&s.push({fromA:i,toA:Math.max(i,n.toA),fromB:o,toB:n.toB,isBlock:!0}),s.length>1?s:null}function YS(e,t,n,r){return qS(t,e.fromA,e.toA,r)||qS(n,e.fromB,e.toB,r)}function XS(e,t,n,r){let i=[],a=new Set;for(let o=0;o<e.length;o++){if(a.has(o))continue;let s=e[o];if(!YS(s,t,n,r)){i.push({fromA:s.fromA,toA:s.toA,fromB:s.fromB,toB:s.toB,isCustomBlock:!1});continue}let c=QS(t,s.fromA,s.toA,r),l=QS(n,s.fromB,s.toB,r),u={fromA:Math.min(c?.from??s.fromA,s.fromA),toA:Math.max(c?.to??s.toA,s.toA),fromB:Math.min(l?.from??s.fromB,s.fromB),toB:Math.max(l?.to??s.toB,s.toB),isCustomBlock:!0};a.add(o);for(let t=o+1;t<e.length;t++){if(a.has(t))continue;let n=e[t],r=c&&KS(n.fromA,n.toA,c.from,c.to),i=l&&KS(n.fromB,n.toB,l.from,l.to);(r||i)&&(a.add(t),u.fromA=Math.min(u.fromA,n.fromA),u.toA=Math.max(u.toA,n.toA),u.fromB=Math.min(u.fromB,n.fromB),u.toB=Math.max(u.toB,n.toB))}let d=[];for(let e=0;e<i.length;e++){let t=i[e];if(!t.isCustomBlock)continue;let n=KS(u.fromA,u.toA,t.fromA,t.toA),r=KS(u.fromB,u.toB,t.fromB,t.toB);(n||r)&&(u.fromA=Math.min(u.fromA,t.fromA),u.toA=Math.max(u.toA,t.toA),u.fromB=Math.min(u.fromB,t.fromB),u.toB=Math.max(u.toB,t.toB),d.push(e))}for(let e=d.length-1;e>=0;e--)i.splice(d[e],1);i.push(u)}return i}function ZS(e,t){let n=RS(t);if(n!==t.content.size)for(let t of e)t.fromA===t.toA&&t.fromB<t.toB&&t.fromA>=n&&(t.fromA=n,t.toA=n)}function QS(e,t,n,r){return t===n?US(e,t,r)==null?null:HS(e,t):WS(e,t,r)==null?WS(e,n,r,!0)==null?null:HS(e,n,!0):HS(e,t)}var $S=new Op(`MILKDOWN_DIFF_DECORATION`),eC=vx(e=>{let t=e.get(PS.key);return new Tp({key:$S,state:{init:()=>cy.empty,apply(n,r,i,a){let o=dS.getState(a);return o?.active?n.getMeta(dS)||n.docChanged?nC(e,a.doc,o,t):r.map(n.mapping,n.doc):cy.empty}},props:{decorations(e){return $S.getState(e)??cy.empty}}})});MS(eC,{displayName:`Prose<diffDecoration>`,group:`DiffComponent`});function tC({doc:e,newDoc:t,segments:n,change:r,changeIndex:i,commands:a,acceptLabel:o,rejectLabel:s,decorations:c}){for(let r=0;r<n.length;r++){let a=n[r],o=a.fromA<a.toA,s=a.fromB<a.toB;if(o&&(a.isBlock?VS(e,a.fromA,a.toA,c):c.push(ay.inline(a.fromA,a.toA,{class:`${NS}-removed`}))),s){let n=a.isBlock?zS(e,o?a.toA:a.fromA):o?a.toA:a.fromA,s=rC(t,a,a.isBlock);c.push(ay.widget(n,s,{side:-1,key:`added-${i}-${r}`}))}}let l=n[n.length-1],u=zS(e,l.isBlock?l.fromA<l.toA?l.toA:l.fromA:r.toA),d=iC({commands:a,isBlockLevel:!0,change:r,acceptLabel:o,rejectLabel:s});c.push(ay.widget(u,d,{side:-1,key:`controls-${i}`}))}function nC(e,t,n,r){let i=[],a=e.get(I),o=new Set(r.customBlockTypes),s=XS(mS(n),t,n.newDoc,o);ZS(s,t);for(let e=0;e<s.length;e++){let o=s[e],c=o.fromA<o.toA,l=o.fromB<o.toB;if(c&&!l&&LS(t,o.fromA,o.toA))continue;let u=c&&FS(t,o.fromA,o.toA),d=c&&IS(t,o.fromA,o.toA),f=l&&IS(n.newDoc,o.fromB,o.toB),p=c&&!u&&!d&&!o.isCustomBlock&&!f,m=(u||d||f)&&!p;if(m&&!o.isCustomBlock){let s=JS(t,n.newDoc,o);if(s){tC({doc:t,newDoc:n.newDoc,segments:s,change:o,changeIndex:e,commands:a,acceptLabel:r.acceptLabel,rejectLabel:r.rejectLabel,decorations:i});continue}}c&&(o.isCustomBlock||m?VS(t,o.fromA,o.toA,i):i.push(ay.inline(o.fromA,o.toA,{class:`${NS}-removed`})));let h=c?o.toA:o.fromA,g=m?zS(t,h):h;if(l){let t=rC(n.newDoc,o,m);i.push(ay.widget(g,t,{side:-1,key:`added-${e}`}))}let _=iC({commands:a,isBlockLevel:m,change:o,acceptLabel:r.acceptLabel,rejectLabel:r.rejectLabel});i.push(ay.widget(g,_,{side:m?-1:1,key:`controls-${e}`}))}return cy.create(t,i)}function rC(e,t,n){let r=document.createElement(n?`div`:`span`);r.className=`${NS}-added`,r.contentEditable=`false`,n&&r.classList.add(`${NS}-added-block`);let i=Ld.fromSchema(e.type.schema);if(n){let n=GS(e,t.fromB,t.toB);if(n.length>0){let e=document.createDocumentFragment();for(let t of n)e.appendChild(i.serializeNode(t));return r.appendChild(e),r}}let a=e.slice(t.fromB,t.toB),o=i.serializeFragment(a.content);if(r.appendChild(o),!r.textContent?.trim()&&!r.querySelector(`img, video, audio, canvas, svg`)){let n=e.textBetween(t.fromB,t.toB,`
49
- `,`
50
- `);n.trim()&&(r.textContent=n)}return r}function iC({commands:e,isBlockLevel:t,change:n,acceptLabel:r,rejectLabel:i}){let a=document.createElement(t?`div`:`span`);a.className=`${NS}-controls`,a.contentEditable=`false`,t&&a.classList.add(`${NS}-controls-block`);let o=t=>r=>{r.preventDefault(),r.stopPropagation();let i={fromA:n.fromA,toA:n.toA,fromB:n.fromB,toB:n.toB},a=t===`accept`?xS.key:SS.key;e.call(a,i)},s=document.createElement(`button`);s.className=`${NS}-accept`,s.textContent=r,s.addEventListener(`click`,o(`accept`));let c=document.createElement(`button`);return c.className=`${NS}-reject`,c.textContent=i,c.addEventListener(`click`,o(`reject`)),a.appendChild(s),a.appendChild(c),a}var aC=[PS,eC];function oC(e,t){return Object.assign(e,{meta:{package:`@milkdown/plugin-streaming`,...t}}),e}var sC=xx({throttleMs:100,scrollFollow:!0,diffReviewOnEnd:!1,ignoreAttrs:{heading:[`id`]}},`streamingConfig`);oC(sC,{displayName:`Ctx<streamingConfig>`,group:`Streaming`});function cC(e,t,n){let r=_C(e.get(Nb),n);if(!r)return{tr:t,newDoc:null};let i=e.get(sC.key).ignoreAttrs,a=lS(t.doc,r,i?{ignoreAttrs:i}:void 0);for(let e=a.length-1;e>=0;e--){let n=a[e],i=r.slice(n.fromB,n.toB);t=t.replace(n.fromA,n.toA,i)}return{tr:t,newDoc:r}}function lC(e){if(e.parent.type.spec.code)return{type:`plain-text`,preserveNewlines:!0};for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`table`)return{type:`plain-text`,preserveNewlines:!1};return e.depth>=1?{type:`split-block`}:{type:`block`}}function uC(e){if(e.childCount===0)return e;let t=e.lastChild;return t.type.name===`paragraph`&&t.content.size===0?e.cut(0,e.size-t.nodeSize):e}function dC(e,t,n){let{insertPos:r,currentEndPos:i}=n,a=n.buffer.replace(/\r\n?/g,`
51
- `);if(!a)return{tr:t,applied:!1,insertEndPos:i};let o=t.doc.content.size,s=Math.max(0,Math.min(r,o)),c=Math.max(s,Math.min(i,o)),l=t.doc.resolve(s),u=(e.get(sC.key).insertStrategy??lC)(l),d={ctx:e,tr:t,buffer:a,from:s,to:c,resolved:l};switch(u.type){case`plain-text`:return fC(d,u.preserveNewlines??!1);case`split-block`:return yC(d);case`block`:return bC(d)}}function fC({tr:e,buffer:t,from:n,to:r},i){let a=i?t:t.replace(/\n/g,` `),o=e.doc.type.schema.text(a);return e=e.replaceWith(n,r,o),{tr:e,applied:!0,insertEndPos:n+a.length}}var pC=/[*_~`[\\<]|https?:\/\/|www\.|[\w.+-]@\w|&[a-zA-Z#]/,mC=/\$(?!\s)(?:[^$\n]*[^\s$])?\$(?!\d)/,hC=/:[\w+-]+:/;function gC(e,t){return!!(pC.test(t)||e.nodes.math_inline&&mC.test(t)||e.nodes.emoji&&hC.test(t))}function _C(e,t){try{return e(t)??null}catch{return null}}function vC(e,t,n){if(!n)return j.empty;if(!gC(t,n))return j.from(t.text(n));let r=_C(e.get(Nb),n)?.firstChild;if(r?.type.name!==`paragraph`||r.content.size===0)return j.from(t.text(n));let i=r.content,a=/^[ \t]+/.exec(n)?.[0];a&&(i=j.from(t.text(a)).append(i));let o=/[ \t]+$/.exec(n)?.[0];return o&&(i=i.append(j.from(t.text(o)))),i}function yC({ctx:e,tr:t,buffer:n,from:r,to:i,resolved:a}){let o=t.doc.type.schema,s=n.indexOf(`
52
- `);if(s<0){let a=vC(e,o,n);return t=t.replaceWith(r,i,a),{tr:t,applied:!0,insertEndPos:r+a.size}}let c=n.substring(0,s),l=n.substring(s+1),u=e.get(Nb),d=l.trim()?_C(u,l):null,f=d?uC(d.content):j.empty;if(f.childCount===0){let a=vC(e,o,n.replace(/\n/g,` `));return t=t.replaceWith(r,i,a),{tr:t,applied:!0,insertEndPos:r+a.size}}let p=a.depth,m=vC(e,o,c);for(let e=p;e>0;e--)m=j.from(a.node(e).copy(m));let h=m.append(f),g=new M(h,p,0),_=t.doc.content.size,v=t.doc.resolve(Math.min(i,_)),y=i;p>0&&v.depth===p&&v.parentOffset===v.parent.content.size&&(y=v.after(p)),t=t.replace(r,y,g);let b=h.size-p;return{tr:t,applied:!0,insertEndPos:r+b}}function bC({ctx:e,tr:t,buffer:n,from:r,to:i}){let a=_C(e.get(Nb),n);if(!a)return{tr:t,applied:!1,insertEndPos:i};let o=uC(a.content);return o.size===0?{tr:t,applied:!1,insertEndPos:i}:(t=t.replace(r,i,new M(o,0,0)),{tr:t,applied:!0,insertEndPos:r+o.size})}function xC(e,t,n){if(n.insertPos!=null){let r=n.insertPos,i=dC(e,t,{buffer:n.buffer,insertPos:r,currentEndPos:n.insertEndPos??r});return{tr:i.tr,newDoc:i.applied?i.tr.doc:null,insertEndPos:i.insertEndPos}}return cC(e,t,n.buffer)}var SC=new Op(`MILKDOWN_STREAMING`);function CC(e,t){if(!e&&t?.type!==`start`)return null;if(!t)return e;switch(t.type){case`start`:return{buffer:``,originalDoc:t.originalDoc,active:!0,lastApplyTime:t.lastApplyTime,insertPos:t.insertPos??null,insertEndPos:t.insertEndPos??t.insertPos??null};case`push`:return e?{...e,buffer:e.buffer+t.token}:null;case`apply`:return e?{...e,lastApplyTime:t.lastApplyTime,insertEndPos:t.insertEndPos??e.insertEndPos}:null;case`end`:case`abort`:return null;default:return e}}var wC=vx(e=>{let t=e.get(sC.key);return new Tp({key:SC,state:{init:()=>null,apply(e,t){return CC(t,e.getMeta(SC))}},filterTransaction(e,t){return!SC.getState(t)?.active||e.getMeta(SC)?!0:!e.docChanged},view(){return TC(e,t)}})});oC(wC,{displayName:`Prose<streaming>`,group:`Streaming`});function TC(e,t){let n=null,r=-1,i=null;function a(){if(!i)return;let n=SC.getState(i.state);if(!n?.active||n.buffer.length===r)return;r=n.buffer.length;let a=xC(e,i.state.tr,n);if(!a.newDoc)return;let o=a.tr;(o.docChanged||a.insertEndPos!=null)&&(o=o.setMeta(SC,{type:`apply`,lastApplyTime:Date.now(),insertEndPos:a.insertEndPos}),t.scrollFollow&&(o=o.scrollIntoView()),i.dispatch(o))}function o(){n!=null&&clearTimeout(n),n=setTimeout(a,t.throttleMs)}return{update(e){i=e;let s=SC.getState(e.state);if(!s?.active){n!=null&&(clearTimeout(n),n=null),r=-1;return}s.buffer.length!==r&&(Date.now()-s.lastApplyTime>=t.throttleMs?a():o())},destroy(){n!=null&&(clearTimeout(n),n=null),i=null}}}var EC=L(`StartStreaming`,()=>e=>(t,n)=>{if(SC.getState(t)?.active)return!1;if(n){let r,i;if(e?.insertAt!=null){if(e.insertAt===`selection`){if(r=t.selection.from,i=t.selection.to,t.selection.empty){let e=t.doc.resolve(r);e.parent.isTextblock&&!e.parent.type.spec.code&&e.parent.content.size===0&&e.depth===1&&(r=e.before(e.depth),i=e.after(e.depth))}}else{let n=e.insertAt===`cursor`?t.selection.head:e.insertAt;if(!Number.isFinite(n))return!1;r=Math.max(0,Math.min(Math.round(n),t.doc.content.size));let a=t.doc.resolve(r);a.parent.isTextblock&&!a.parent.type.spec.code&&a.parent.content.size===0&&a.depth===1&&(r=a.before(a.depth),i=a.after(a.depth))}}n(t.tr.setMeta(SC,{type:`start`,originalDoc:t.doc,insertPos:r,insertEndPos:i,lastApplyTime:Date.now()}))}return!0});oC(EC,{displayName:`Command<startStreaming>`,group:`Streaming`});var DC=L(`PushChunk`,()=>e=>(t,n)=>e==null||!SC.getState(t)?.active?!1:(n&&n(t.tr.setMeta(SC,{type:`push`,token:e})),!0));oC(DC,{displayName:`Command<pushChunk>`,group:`Streaming`});var OC=L(`EndStreaming`,e=>t=>(n,r)=>{let i=SC.getState(n);if(!i?.active)return!1;if(r){let a=e.get(sC.key),o=t?.diffReview??a.diffReviewOnEnd,s=xC(e,n.tr,i),c=s.tr;if(c=c.setMeta(SC,{type:`end`}),o&&s.newDoc){let t=c.doc;c=c.replace(0,c.doc.content.size,new M(i.originalDoc.content,0,0)),r(c);try{e.get(I).call(vS.key,t)}catch(e){console.warn(`[milkdown/streaming] diff review handoff skipped:`,e)}return!0}r(c)}return!0});oC(OC,{displayName:`Command<endStreaming>`,group:`Streaming`});var kC=L(`AbortStreaming`,e=>t=>(n,r)=>{let i=SC.getState(n);if(!i?.active)return!1;if(r){let a=t?.keep??!1,o=n.tr;o=a?xC(e,o,i).tr:o.replace(0,n.doc.content.size,new M(i.originalDoc.content,0,0)),o=o.setMeta(SC,{type:`abort`}),r(o)}return!0});oC(kC,{displayName:`Command<abortStreaming>`,group:`Streaming`});var AC=[sC,wC,EC,DC,OC,kC],jC=Math.min,MC=Math.max,NC=Math.round,PC=Math.floor,FC=e=>({x:e,y:e}),IC={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function LC(e,t,n){return MC(e,jC(t,n))}function RC(e,t){return typeof e==`function`?e(t):e}function zC(e){return e.split(`-`)[0]}function BC(e){return e.split(`-`)[1]}function VC(e){return e===`x`?`y`:`x`}function HC(e){return e===`y`?`height`:`width`}function UC(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function WC(e){return VC(UC(e))}function GC(e,t,n){n===void 0&&(n=!1);let r=BC(e),i=WC(e),a=HC(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ew(o)),[o,ew(o)]}function KC(e){let t=ew(e);return[qC(e),t,qC(t)]}function qC(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var JC=[`left`,`right`],YC=[`right`,`left`],XC=[`top`,`bottom`],ZC=[`bottom`,`top`];function QC(e,t,n){switch(e){case`top`:case`bottom`:return n?t?YC:JC:t?JC:YC;case`left`:case`right`:return t?XC:ZC;default:return[]}}function $C(e,t,n,r){let i=BC(e),a=QC(zC(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(qC)))),a}function ew(e){let t=zC(e);return IC[t]+e.slice(t.length)}function tw(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function nw(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:tw(e)}function rw(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function iw(e,t,n){let{reference:r,floating:i}=e,a=UC(t),o=WC(t),s=HC(o),c=zC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=BC(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function aw(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=RC(t,e),p=nw(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=rw(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=rw(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ow=50,sw=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:aw},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=iw(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ow&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=iw(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},cw=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=RC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=zC(r),_=UC(o),v=zC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ew(o)]:KC(o)),x=p!==`none`;!d&&x&&b.push(...$C(o,m,p,y));let S=[o,...b],ee=await s.detectOverflow(t,h),te=[],C=i.flip?.overflows||[];if(l&&te.push(ee[g]),u){let e=GC(r,a,y);te.push(ee[e[0]],ee[e[1]])}if(C=[...C,{placement:r,overflows:te}],!te.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===UC(t)||C.every(e=>UC(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:C},reset:{placement:t}};let n=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=C.filter(e=>{if(x){let t=UC(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},lw=new Set([`left`,`top`]);async function uw(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=zC(n),s=BC(n),c=UC(n)===`y`,l=lw.has(o)?-1:1,u=a&&c?-1:1,d=RC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var dw=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await uw(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},fw=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=RC(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=UC(i),p=VC(f),m=u[p],h=u[f],g=(e,t)=>LC(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}};function pw(){return typeof window<`u`}function mw(e){return _w(e)?(e.nodeName||``).toLowerCase():`#document`}function hw(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function gw(e){return((_w(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function _w(e){return pw()?e instanceof Node||e instanceof hw(e).Node:!1}function vw(e){return pw()?e instanceof Element||e instanceof hw(e).Element:!1}function yw(e){return pw()?e instanceof HTMLElement||e instanceof hw(e).HTMLElement:!1}function bw(e){return!pw()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof hw(e).ShadowRoot}function xw(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Mw(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Sw(e){return/^(table|td|th)$/.test(mw(e))}function Cw(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ww=/transform|translate|scale|rotate|perspective|filter/,Tw=/paint|layout|strict|content/,Ew=e=>!!e&&e!==`none`,Dw;function Ow(e){let t=vw(e)?Mw(e):e;return Ew(t.transform)||Ew(t.translate)||Ew(t.scale)||Ew(t.rotate)||Ew(t.perspective)||!Aw()&&(Ew(t.backdropFilter)||Ew(t.filter))||ww.test(t.willChange||``)||Tw.test(t.contain||``)}function kw(e){let t=Pw(e);for(;yw(t)&&!jw(t);){if(Ow(t))return t;if(Cw(t))return null;t=Pw(t)}return null}function Aw(){return Dw??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Dw}function jw(e){return/^(html|body|#document)$/.test(mw(e))}function Mw(e){return hw(e).getComputedStyle(e)}function Nw(e){return vw(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pw(e){if(mw(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||bw(e)&&e.host||gw(e);return bw(t)?t.host:t}function Fw(e){let t=Pw(e);return jw(t)?(e.ownerDocument||e).body:yw(t)&&xw(t)?t:Fw(t)}function Iw(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Fw(e),i=r===e.ownerDocument?.body,a=hw(r);if(i){let e=Lw(a);return t.concat(a,a.visualViewport||[],xw(r)?r:[],e&&n?Iw(e):[])}return t.concat(r,Iw(r,[],n))}function Lw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Rw(e){let t=Mw(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=yw(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=NC(n)!==a||NC(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function zw(e){return vw(e)?e:e.contextElement}function Bw(e){let t=zw(e);if(!yw(t))return FC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Rw(t),o=(a?NC(n.width):n.width)/r,s=(a?NC(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Vw=FC(0);function Hw(e){let t=hw(e);return!Aw()||!t.visualViewport?Vw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uw(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===hw(e)}function Ww(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=zw(e),o=FC(1);t&&(r?vw(r)&&(o=Bw(r)):o=Bw(e));let s=Uw(a,n,r)?Hw(a):FC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=hw(a),t=vw(r)?hw(r):r,n=e,i=Lw(n);for(;i&&t!==n;){let e=Bw(i),t=i.getBoundingClientRect(),r=Mw(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=hw(i),i=Lw(n)}}return rw({width:u,height:d,x:c,y:l})}function Gw(e,t){let n=Nw(e).scrollLeft;return t?t.left+n:Ww(gw(e)).left+n}function Kw(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Gw(e,n),y:n.top+t.scrollTop}}function qw(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=gw(r),s=t?Cw(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=FC(1),u=FC(0),d=yw(r);if((d||!a)&&((mw(r)!==`body`||xw(o))&&(c=Nw(r)),d)){let e=Ww(r);l=Bw(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Kw(o,c):FC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Jw(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Yw(e){let t=Nw(e),n=e.ownerDocument.body,r=MC(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=MC(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Gw(e),o=-t.scrollTop;return Mw(n).direction===`rtl`&&(a+=MC(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Xw=25;function Zw(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=hw(e),a=gw(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Aw()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Gw(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=Xw&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Qw(e,t){let n=Ww(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Bw(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function $w(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Zw(e,n,t);else if(t===`document`)r=Yw(gw(e));else if(vw(t))r=Qw(t,n);else{let n=Hw(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return rw(r)}function eT(e,t){let n=t.get(e);if(n)return n;let r=Iw(e,[],!1).filter(e=>vw(e)&&mw(e)!==`body`),i=null,a=Mw(e).position===`fixed`,o=a?Pw(e):e;for(;vw(o)&&!jw(o);){let e=Mw(o),t=Ow(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Pw(o)}return t.set(e,r),r}function tT(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Cw(t)?[]:eT(t,this._c):[].concat(n),r],o=$w(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=$w(t,a[e],i);s=MC(n.top,s),c=jC(n.right,c),l=jC(n.bottom,l),u=MC(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function nT(e){let{width:t,height:n}=Rw(e);return{width:t,height:n}}function rT(e,t,n){let r=yw(t),i=gw(t),a=n===`fixed`,o=Ww(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=FC(0);if((r||!a)&&((mw(t)!==`body`||xw(i))&&(s=Nw(t)),r)){let e=Ww(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Gw(i));let l=i&&!r&&!a?Kw(i,s):FC(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function iT(e){return Mw(e).position===`static`}function aT(e,t){if(!yw(e)||Mw(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return gw(e)===n&&(n=n.ownerDocument.body),n}function oT(e,t){let n=hw(e);if(Cw(e))return n;if(!yw(e)){let t=Pw(e);for(;t&&!jw(t);){if(vw(t)&&!iT(t))return t;t=Pw(t)}return n}let r=aT(e,t);for(;r&&Sw(r)&&iT(r);)r=aT(r,t);return r&&jw(r)&&iT(r)&&!Ow(r)?n:r||kw(e)||n}var sT=async function(e){let t=this.getOffsetParent||oT,n=this.getDimensions,r=await n(e.floating);return{reference:rT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function cT(e){return Mw(e).direction===`rtl`}var lT={convertOffsetParentRelativeRectToViewportRelativeRect:qw,getDocumentElement:gw,getClippingRect:tT,getOffsetParent:oT,getElementRects:sT,getClientRects:Jw,getDimensions:nT,getScale:Bw,isElement:vw,isRTL:cT};function uT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function dT(e,t,n){let r=null,i,a=gw(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=PC(d),h=PC(a.clientWidth-(u+f)),g=PC(a.clientHeight-(d+p)),_=PC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:MC(0,jC(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!uT(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=hw(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function fT(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=zw(e),u=i||a?[...l?Iw(l):[],...t?Iw(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?dT(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Ww(e):null;c&&g();function g(){let t=Ww(e);h&&!uT(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var pT=dw,mT=fw,hT=cw,gT=(e,t,n)=>{let r=new Map,i=n??{},a={...lT,...i.platform,_c:r};return sw(e,t,{...i,platform:a})},_T=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;constructor(e){this.#a=!1,this.onShow=()=>{},this.onHide=()=>{},this.#d=e=>{gT(e,this.element,{placement:this.#r.placement??`top`,middleware:[hT(),pT(this.#c),mT(this.#l),...this.#n],...this.#r}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error)},this.#f=e=>this.#i!==e.dom.parentElement,this.#p=(e,t)=>{let{state:n,composing:r}=e,{selection:i,doc:a}=n,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),c=Math.max(...o.map(e=>e.$to.pos)),l=e=>!!e&&e.doc.eq(a)&&e.selection.eq(i),u=l(t)&&l(this.#s);if(this.#a||=((this.#i??e.dom.parentElement??document.body).appendChild(this.element),!0),r||u)return;if(this.#s=n,this.#o?.(),this.#o=void 0,!this.#t(e,t)){this.hide();return}let d={getBoundingClientRect:()=>eh(e,s,c),contextElement:e.dom};this.#f(e)?this.#o=fT(d,this.element,()=>this.#d(d)):this.#d(d),this.show()},this.update=(e,t)=>{this.#u(e,t)},this.#m=e=>{let{doc:t,selection:n}=e.state,{empty:r,from:i,to:a}=n,o=!t.textBetween(i,a).length&&e.state.selection instanceof N,s=this.element.contains(document.activeElement),c=!e.hasFocus()&&!s,l=!e.editable;return!(c||r||o||l)},this.destroy=()=>{this.#o?.(),this.#u.cancel()},this.show=(e,t)=>{if(this.element.dataset.show=`true`,e){this.#o?.(),this.#o=void 0;let n={...e,contextElement:t?.dom};t&&this.#f(t)?this.#o=fT(n,this.element,()=>this.#d(n)):this.#d(n)}this.onShow()},this.hide=()=>{this.element.dataset.show!==`false`&&(this.element.dataset.show=`false`,this.onHide())},this.element=e.content,this.#e=e.debounce??200,this.#t=e.shouldShow??this.#m,this.#c=e.offset,this.#l=e.shift,this.#n=e.middleware??[],this.#r=e.floatingUIOptions??{},this.#i=e.root,this.element.dataset.show=`false`,this.#u=Mr(this.#p,this.#e)}#d;#f;#p;#m};function vT(e){let t=xx({},`${e}_TOOLTIP_SPEC`),n=vx(n=>{let r=n.get(t.key);return new Tp({key:new Op(`${e}_TOOLTIP`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:`@milkdown/plugin-tooltip`,displayName:`Ctx<tooltipSpec>|${e}`},n.meta={package:`@milkdown/plugin-tooltip`,displayName:`Prose<tooltip>|${e}`},r}function yT(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=yT(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function bT(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=yT(e))&&(r&&(r+=` `),r+=t);return r}function xT({icon:e,class:t,onClick:n}){return f(`span`,{class:bT(`milkdown-icon`,t),onPointerdown:n,innerHTML:e?gt.sanitize(e.trim()):void 0})}xT.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function ST(e,t){return Object.assign(e,{meta:{package:`@milkdown/plugin-block`,...t}}),e}var CT=xx({filterNodes:e=>!ih(e=>e.type.name===`table`)(e)},`blockConfig`);ST(CT,{displayName:`Ctx<blockConfig>`});function wT(e,t,n){if(!e.dom.parentElement)return null;try{let r=e.posAtCoords({left:t.x,top:t.y})?.inside;if(r==null||r<0)return null;let i=e.state.doc.resolve(r),a=e.state.doc.nodeAt(r),o=e.nodeDOM(r),s=t=>{let r=i.depth>=1&&i.index(i.depth)===0;if(!(t||r))return;let c=i.before(i.depth);a=e.state.doc.nodeAt(c),o=e.nodeDOM(c),i=e.state.doc.resolve(c),n(i,a)||s(!0)};return s(!n(i,a)),!o||!a?null:{node:a,$pos:i,el:o}}catch{return null}}var TT=Fm.ie&&Fm.ie_version<15||Fm.ios&&Fm.webkit_version<604,ET=20,DT=class{constructor(){this.#t=()=>{if(!this.#r)return null;let e=this.#r,t=this.#s;if(this.#n=null,t&&P.isSelectable(e.node)){let n=P.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(n)),t.focus(),this.#n=n,n}return null},this.#n=null,this.#r=null,this.#i=void 0,this.#a=!1,this.#l=()=>{this.#c?.({type:`hide`}),this.#r=null},this.#u=e=>{this.#r=e,this.#c?.({type:`show`,active:e})},this.bind=(e,t)=>{this.#e=e,this.#c=t},this.addEvent=e=>{e.addEventListener(`mousedown`,this.#d),e.addEventListener(`mouseup`,this.#f),e.addEventListener(`dragstart`,this.#p),e.addEventListener(`dragend`,this.#m)},this.removeEvent=e=>{e.removeEventListener(`mousedown`,this.#d),e.removeEventListener(`mouseup`,this.#f),e.removeEventListener(`dragstart`,this.#p),e.removeEventListener(`dragend`,this.#m)},this.unBind=()=>{this.#c=void 0},this.#d=()=>{this.#i=this.#r?.el.getBoundingClientRect(),this.#t()},this.#f=()=>{if(!this.#a){requestAnimationFrame(()=>{this.#i&&this.#s?.focus()});return}this.#a=!1,this.#n=null},this.#p=e=>{this.#a=!0;let t=this.#s;if(!t)return;t.dom.dataset.dragging=`true`;let n=this.#n;if(e.dataTransfer&&n){let r=n.content();e.dataTransfer.effectAllowed=`copyMove`;let{dom:i,text:a}=t.serializeForClipboard(r);e.dataTransfer.clearData(),e.dataTransfer.setData(TT?`Text`:`text/html`,i.innerHTML),TT||e.dataTransfer.setData(`text/plain`,a);let o=this.#r?.el;o&&e.dataTransfer.setDragImage(o,0,0),t.dragging={slice:r,move:!0,node:n}}},this.#m=()=>{let e=this.#s;if(!e)return;this.#g(e);let t=e.dragging;window.setTimeout(()=>{e.dragging===t&&(e.dragging=null)},50)},this.keydownCallback=e=>(this.#l(),this.#a=!1,e.dom.dataset.dragging=`false`,!1),this.#h=Mr((e,t)=>{if(!e.editable)return;let n=e.dom.getBoundingClientRect(),r=n.left+n.width/2;if(!(e.root.elementFromPoint(r,t.clientY)instanceof Element)){this.#l();return}let i=this.#o;if(!i)return;let a=wT(e,{x:r,y:t.clientY},i);if(!a){this.#l();return}this.#u(a)},200),this.mousemoveCallback=(e,t)=>(e.composing||!e.editable||this.#h(e,t),!1),this.dragoverCallback=(e,t)=>{if(this.#a){let n=this.#s?.dom.parentElement;if(!n)return!1;let r=n.scrollHeight>n.clientHeight,i=n.getBoundingClientRect();if(r){if(n.scrollTop>0&&Math.abs(t.y-i.y)<ET)return n.scrollTop=n.scrollTop>10?n.scrollTop-10:0,!1;let r=Math.round(e.dom.getBoundingClientRect().height);if(Math.round(n.scrollTop+i.height)<r&&Math.abs(t.y-(i.height+i.y))<ET)return n.scrollTop+=10,!1}}return!1},this.dragenterCallback=e=>{e.dragging&&(this.#a=!0,e.dom.dataset.dragging=`true`)},this.dragleaveCallback=(e,t)=>{let n=t.clientX,r=t.clientY;(n<0||r<0||n>window.innerWidth||r>window.innerHeight)&&(this.#r=null,this.#g(e))},this.dropCallback=e=>(this.#g(e),!1),this.dragendCallback=e=>{this.#g(e)},this.#g=e=>{this.#a=!1,e.dom.dataset.dragging=`false`}}#e;#t;#n;#r;#i;#a;get#o(){try{return this.#e?.get(CT.key).filterNodes}catch{return}}get#s(){return this.#e?.get(Qy)}#c;#l;#u;#d;#f;#p;#m;#h;#g},OT=xx(()=>new DT,`blockService`),kT=xx({},`blockServiceInstance`);ST(OT,{displayName:`Ctx<blockService>`}),ST(kT,{displayName:`Ctx<blockServiceInstance>`});var AT=xx({},`blockSpec`);ST(AT,{displayName:`Ctx<blockSpec>`});var jT=vx(e=>{let t=new Op(`MILKDOWN_BLOCK`),n=e.get(OT.key)();e.set(kT.key,n);let r=e.get(AT.key);return new Tp({key:t,...r,props:{...r.props,handleDOMEvents:{drop:e=>n.dropCallback(e),pointermove:(e,t)=>n.mousemoveCallback(e,t),keydown:e=>n.keydownCallback(e),dragover:(e,t)=>n.dragoverCallback(e,t),dragleave:(e,t)=>n.dragleaveCallback(e,t),dragenter:e=>n.dragenterCallback(e),dragend:e=>n.dragendCallback(e)}}})});ST(jT,{displayName:`Prose<block>`});var MT=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;get active(){return this.#r}constructor(e){this.#r=null,this.#a=!1,this.update=()=>{requestAnimationFrame(()=>{if(!this.#a)try{this.#d(),this.#a=!0}catch{}})},this.destroy=()=>{this.#n?.unBind(),this.#n?.removeEvent(this.#e),this.#e.remove()},this.show=e=>{let t=e.el,n=this.#t.get(Qy).dom,r={ctx:this.#t,active:e,editorDom:n,blockDom:this.#e},i={contextElement:t,getBoundingClientRect:()=>this.#l?this.#l(r):t.getBoundingClientRect()},a=[hT()];if(this.#c){let e=pT(this.#c(r));a.push(e)}gT(i,this.#e,{placement:this.#u?this.#u(r):`left`,middleware:[...a,...this.#o],...this.#s}).then(({x:e,y:t})=>{Object.assign(this.#e.style,{left:`${e}px`,top:`${t}px`}),this.#e.dataset.show=`true`}).catch(console.error)},this.hide=()=>{this.#e.dataset.show=`false`},this.#t=e.ctx,this.#e=e.content,this.#c=e.getOffset,this.#l=e.getPosition,this.#u=e.getPlacement,this.#o=e.middleware??[],this.#s=e.floatingUIOptions??{},this.#i=e.root,this.hide()}#d(){let e=this.#t.get(Qy);(this.#i??e.dom.parentElement??document.body).appendChild(this.#e);let t=this.#t.get(kT.key);t.bind(this.#t,e=>{e.type===`hide`?(this.hide(),this.#r=null):e.type===`show`&&(this.show(e.active),this.#r=e.active)}),this.#n=t,this.#n.addEvent(this.#e),this.#e.draggable=!0}},NT=[AT,CT,OT,kT,jT];NT.key=AT.key,NT.pluginKey=jT.key;function PT(e,t){return function(n,r){let{$from:i,$to:a,node:o}=n.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(a))return!1;let s=i.node(-1);if(s.type!=e)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=e||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let t=j.empty,a=i.index(-1)?1:i.index(-2)?2:3;for(let e=i.depth-a;e>=i.depth-3;e--)t=j.from(i.node(e).copy(t));let o=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;t=t.append(j.from(e.createAndFill()));let s=i.before(i.depth-(a-1)),c=n.tr.replace(s,i.after(-o),new M(t,4-a,0)),l=-1;c.doc.nodesBetween(s,c.doc.content.size,(e,t)=>{if(l>-1)return!1;e.isTextblock&&e.content.size==0&&(l=t+1)}),l>-1&&c.setSelection(ap.near(c.doc.resolve(l))),r(c.scrollIntoView())}return!0}let c=a.pos==i.end()?s.contentMatchAt(0).defaultType:null,l=n.tr.delete(i.pos,a.pos),u=c?[t?{type:e,attrs:t}:null,{type:c}]:void 0;return Af(l.doc,i.pos,2,u)?(r&&r(l.split(i.pos,2,u).scrollIntoView()),!0):!1}}function FT(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?IT(t,n,e,a):LT(t,n,a):!0:!1}}function IT(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new ff(a-1,o,a,o,new M(j.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ku(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=vf(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return Mf(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function LT(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?j.empty:j.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new ff(d-+!!s,f+ +!!c,d+1,f-1,new M((s?j.empty:j.from(i.copy(j.empty))).append(c?j.empty:j.from(i.copy(j.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function RT(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=j.from(r?e.create():null),o=new M(j.from(e.create(null,j.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new ff(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}function zT(e){let t=new Map;if(!e||!e.type)throw Error(`mdast-util-definitions expected node`);return _c(e,`definition`,function(e){let n=BT(e.identifier);n&&!t.get(n)&&t.set(n,e)}),n;function n(e){let n=BT(e);return t.get(n)}}function BT(e){return String(e||``).toUpperCase()}function VT(){return function(e){let t=zT(e);_c(e,function(e,n,r){if(e.type===`definition`&&r!==void 0&&typeof n==`number`)return r.children.splice(n,1),[mc,n];if(e.type===`imageReference`||e.type===`linkReference`){let i=t(e.identifier);if(i&&r&&typeof n==`number`)return r.children[n]=e.type===`imageReference`?{type:`image`,url:i.url,title:i.title,alt:e.alt}:{type:`link`,url:i.url,title:i.title,children:e.children},[mc,n]}})}}function HT(e){let t={...e};return t.position&&={start:{...t.position.start},end:{...t.position.end}},delete t.children,t}var UT=`<br />`,WT=/^<br\s*\/?\s*>$/i,GT=e=>typeof e==`string`&&WT.test(e.trim());function KT(e,t){if(!(t.childCount>=1&&t.lastChild?.type.name===`hardbreak`)){e.next(t.content);return}let n=[];t.content.forEach((e,r,i)=>{i!==t.childCount-1&&n.push(e)}),e.next(j.fromArray(n))}function R(e,t){return Object.assign(e,{meta:{package:`@milkdown/preset-commonmark`,...t}}),e}var qT=Ex(`emphasis`);R(qT,{displayName:`Attr<emphasis>`,group:`Emphasis`});var JT=Cx(`emphasis`,e=>({attrs:{marker:{default:e.get(cb).emphasis||`*`,validate:`string`}},parseDOM:[{tag:`i`},{tag:`em`},{style:`font-style`,getAttrs:e=>e===`italic`}],toDOM:t=>[`em`,e.get(qT.key)(t)],parseMarkdown:{match:e=>e.type===`emphasis`,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`emphasis`,runner:(e,t)=>{e.withMark(t,`emphasis`,void 0,{marker:t.attrs.marker})}}}));R(JT.mark,{displayName:`MarkSchema<emphasis>`,group:`Emphasis`}),R(JT.ctx,{displayName:`MarkSchemaCtx<emphasis>`,group:`Emphasis`});var YT=L(`ToggleEmphasis`,e=>()=>im(JT.type(e)));R(YT,{displayName:`Command<toggleEmphasisCommand>`,group:`Emphasis`});var XT=mx(e=>Hm(/(?:^|[^*])\*([^*]+)\*$/,JT.type(e),{getAttr:()=>({marker:`*`}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith(`*`)?{}:{fullMatch:e.slice(1),start:t+1}}));R(XT,{displayName:`InputRule<emphasis>|Star`,group:`Emphasis`});var ZT=mx(e=>Hm(/\b_(?![_\s])(.*?[^_\s])_$/,JT.type(e),{getAttr:()=>({marker:`_`}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith(`_`)?{}:{fullMatch:e.slice(1),start:t+1}}));R(ZT,{displayName:`InputRule<emphasis>|Underscore`,group:`Emphasis`});var QT=wx(`emphasisKeymap`,{ToggleEmphasis:{shortcuts:`Mod-i`,command:e=>{let t=e.get(I);return()=>t.call(YT.key)}}});R(QT.ctx,{displayName:`KeymapCtx<emphasis>`,group:`Emphasis`}),R(QT.shortcuts,{displayName:`Keymap<emphasis>`,group:`Emphasis`});var $T=Ex(`strong`);R($T,{displayName:`Attr<strong>`,group:`Strong`});var eE=Cx(`strong`,e=>({attrs:{marker:{default:e.get(cb).strong||`*`,validate:`string`}},parseDOM:[{tag:`b`,getAttrs:e=>e.style.fontWeight!=`normal`&&null},{tag:`strong`},{style:`font-style`,getAttrs:e=>e===`bold`},{style:`font-weight=400`,clearMark:e=>e.type.name==`strong`},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:t=>[`strong`,e.get($T.key)(t)],parseMarkdown:{match:e=>e.type===`strong`,runner:(e,t,n)=>{e.openMark(n,{marker:t.marker}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`strong`,runner:(e,t)=>{e.withMark(t,`strong`,void 0,{marker:t.attrs.marker})}}}));R(eE.mark,{displayName:`MarkSchema<strong>`,group:`Strong`}),R(eE.ctx,{displayName:`MarkSchemaCtx<strong>`,group:`Strong`});var tE=L(`ToggleStrong`,e=>()=>im(eE.type(e)));R(tE,{displayName:`Command<toggleStrongCommand>`,group:`Strong`});var nE=mx(e=>Hm(/(?<![\w:/])(?:\*\*|__)([^*_]+?)(?:\*\*|__)(?![\w/])$/,eE.type(e),{getAttr:e=>({marker:e[0].startsWith(`*`)?`*`:`_`})}));R(nE,{displayName:`InputRule<strong>`,group:`Strong`});var rE=wx(`strongKeymap`,{ToggleBold:{shortcuts:[`Mod-b`],command:e=>{let t=e.get(I);return()=>t.call(tE.key)}}});R(rE.ctx,{displayName:`KeymapCtx<strong>`,group:`Strong`}),R(rE.shortcuts,{displayName:`Keymap<strong>`,group:`Strong`});var iE=Ex(`inlineCode`);R(iE,{displayName:`Attr<inlineCode>`,group:`InlineCode`});var aE=Cx(`inlineCode`,e=>({priority:100,code:!0,inclusive:!1,parseDOM:[{tag:`code`}],toDOM:t=>[`code`,e.get(iE.key)(t)],parseMarkdown:{match:e=>e.type===`inlineCode`,runner:(e,t,n)=>{e.openMark(n),e.addText(t.value),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`inlineCode`,runner:(e,t,n)=>(e.withMark(t,`inlineCode`,n.text||``),!0)}}));R(aE.mark,{displayName:`MarkSchema<inlineCode>`,group:`InlineCode`}),R(aE.ctx,{displayName:`MarkSchemaCtx<inlineCode>`,group:`InlineCode`});var oE=L(`ToggleInlineCode`,e=>()=>(t,n)=>{let{selection:r,tr:i}=t;if(r.empty)return!1;let{from:a,to:o}=r;return t.doc.rangeHasMark(a,o,aE.type(e))?(n?.(i.removeMark(a,o,aE.type(e))),!0):(Object.keys(t.schema.marks).filter(e=>e!==aE.type.name).map(e=>t.schema.marks[e]).forEach(e=>{i.removeMark(a,o,e)}),n?.(i.addMark(a,o,aE.type(e).create())),!0)});R(oE,{displayName:`Command<toggleInlineCodeCommand>`,group:`InlineCode`});var sE=mx(e=>Hm(/(?:`)([^`]+)(?:`)$/,aE.type(e)));R(sE,{displayName:`InputRule<inlineCodeInputRule>`,group:`InlineCode`});var cE=wx(`inlineCodeKeymap`,{ToggleInlineCode:{shortcuts:`Mod-e`,command:e=>{let t=e.get(I);return()=>t.call(oE.key)}}});R(cE.ctx,{displayName:`KeymapCtx<inlineCode>`,group:`InlineCode`}),R(cE.shortcuts,{displayName:`Keymap<inlineCode>`,group:`InlineCode`});var lE=new Set([`http:`,`https:`,`mailto:`,`tel:`,`ftp:`]);function uE(e){return e<=32||e>=127&&e<=160||e>=8203&&e<=8205||e===8232||e===8233||e===65279}function dE(e){let t=``;for(let n of e)uE(n.codePointAt(0)??0)||(t+=n);return t}function fE(e){if(typeof e!=`string`)return``;let t=e.trim();if(!t)return``;let n=dE(t),r=/^([a-z][a-z0-9+.-]*):/i.exec(n)?.[1];return!r||lE.has(`${r.toLowerCase()}:`)?t:``}var pE=Ex(`link`);R(pE,{displayName:`Attr<link>`,group:`Link`});var mE=Cx(`link`,e=>({attrs:{href:{validate:`string`},title:{default:null,validate:`string|null`}},parseDOM:[{tag:`a[href]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{href:e.getAttribute(`href`),title:e.getAttribute(`title`)}}}],toDOM:t=>[`a`,{...e.get(pE.key)(t),...t.attrs,href:fE(t.attrs.href)}],parseMarkdown:{match:e=>e.type===`link`,runner:(e,t,n)=>{let r=t.url,i=t.title;e.openMark(n,{href:r,title:i}),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`link`,runner:(e,t)=>{e.withMark(t,`link`,void 0,{title:t.attrs.title,url:t.attrs.href})}}}));R(mE.mark,{displayName:`MarkSchema<link>`,group:`Link`});var hE=L(`ToggleLink`,e=>(t={})=>im(mE.type(e),t));R(hE,{displayName:`Command<toggleLinkCommand>`,group:`Link`});var gE=L(`UpdateLink`,e=>(t={})=>(n,r)=>{if(!r)return!1;let i,a=-1,{selection:o}=n,{from:s,to:c}=o;if(n.doc.nodesBetween(s,s===c?c+1:c,(t,n)=>{if(mE.type(e).isInSet(t.marks))return i=t,a=n,!1}),!i)return!1;let l=i.marks.find(({type:t})=>t===mE.type(e));if(!l)return!1;let u=a,d=a+i.nodeSize,{tr:f}=n,p=mE.type(e).create({...l.attrs,...t});return p?(r(f.removeMark(u,d,l).addMark(u,d,p).setSelection(new N(f.selection.$anchor)).scrollIntoView()),!0):!1});R(gE,{displayName:`Command<updateLinkCommand>`,group:`Link`});var _E=_x(`doc`,()=>({content:`block+`,parseMarkdown:{match:({type:e})=>e===`root`,runner:(e,t,n)=>{e.injectRoot(t,n)}},toMarkdown:{match:e=>e.type.name===`doc`,runner:(e,t)=>{e.openNode(`root`);let n=t.childCount>0?t.child(t.childCount-1):null,r=n?.type.name===`paragraph`&&n.content.size===0?t.content.cut(0,t.content.size-n.nodeSize):t.content;e.next(r)}}}));R(_E,{displayName:`NodeSchema<doc>`,group:`Doc`});var vE=Object.freeze([`root`,`blockquote`,`listItem`,`footnoteDefinition`]),yE=new Set([`paragraph`,`heading`,`tableCell`,`link`,`linkReference`,`emphasis`,`strong`,`delete`,`footnote`]),bE=xx(vE,`blockContainerTypes`);R(bE,{displayName:`Ctx<blockContainerTypes>`,group:`Remark`});var xE=new Set;function SE(e){let t=e.isInjected(bE.key)?e.get(bE.key):vE,n=new Set;for(let e of t){if(yE.has(e)){xE.has(e)||(xE.add(e),console.warn(`[milkdown/preset-commonmark] "${e}" holds phrasing content and cannot be a block container; it is ignored in blockContainerTypes.`));continue}n.add(e)}return n}var CE=new Set([`paragraph`,`tableCell`]);function wE(e,t){return hc(e,e=>e.type===`html`&&GT(e.value),(e,n)=>{let r=n[n.length-1];if(r){if(CE.has(r.type)){r.children.length===1&&(r.children=[]);return}if(t.has(r.type)){let t=e;return t.children=[],delete t.value,t.type=`paragraph`,mc}}})}var TE=Dx(`remark-preserve-empty-line`,e=>()=>t=>wE(t,SE(e)));R(TE.plugin,{displayName:`Remark<remarkPreserveEmptyLine>`,group:`Remark`}),R(TE.options,{displayName:`RemarkConfig<remarkPreserveEmptyLine>`,group:`Remark`});var EE=Tx(`paragraph`);R(EE,{displayName:`Attr<paragraph>`,group:`Paragraph`});var DE=Sx(`paragraph`,e=>({content:`inline*`,group:`block`,parseDOM:[{tag:`p`}],toDOM:t=>[`p`,e.get(EE.key)(t),0],parseMarkdown:{match:e=>e.type===`paragraph`,runner:(e,t,n)=>{e.openNode(n),t.children?e.next(t.children):e.addText(t.value||``),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`paragraph`,runner:(t,n)=>{t.openNode(`paragraph`),(!n.content||n.content.size===0)&&OE(e)?t.addNode(`html`,void 0,UT):KT(t,n),t.closeNode()}}}));function OE(e){return e.isInjected(TE.options.key)}R(DE.node,{displayName:`NodeSchema<paragraph>`,group:`Paragraph`}),R(DE.ctx,{displayName:`NodeSchemaCtx<paragraph>`,group:`Paragraph`});var kE=L(`TurnIntoText`,e=>()=>tm(DE.type(e)));R(kE,{displayName:`Command<turnIntoTextCommand>`,group:`Paragraph`});var AE=wx(`paragraphKeymap`,{TurnIntoText:{shortcuts:`Mod-Alt-0`,command:e=>{let t=e.get(I);return()=>t.call(kE.key)}}});R(AE.ctx,{displayName:`KeymapCtx<paragraph>`,group:`Paragraph`}),R(AE.shortcuts,{displayName:`Keymap<paragraph>`,group:`Paragraph`});var jE=[,,,,,,].fill(0).map((e,t)=>t+1);function ME(e){return e.textContent.toLowerCase().trim().replace(/\s+/g,`-`)}var NE=xx(ME,`headingIdGenerator`);R(NE,{displayName:`Ctx<HeadingIdGenerator>`,group:`Heading`});var PE=Tx(`heading`);R(PE,{displayName:`Attr<heading>`,group:`Heading`});var FE=Sx(`heading`,e=>{let t=e.get(NE.key);return{content:`inline*`,group:`block`,defining:!0,attrs:{id:{default:``,validate:`string`},level:{default:1,validate:`number`}},parseDOM:jE.map(e=>({tag:`h${e}`,getAttrs:t=>{if(!(t instanceof HTMLElement))throw pi(t);return{level:e,id:t.id}}})),toDOM:n=>[`h${n.attrs.level}`,{...e.get(PE.key)(n),id:n.attrs.id||t(n)},0],parseMarkdown:{match:({type:e})=>e===`heading`,runner:(e,t,n)=>{let r=t.depth;e.openNode(n,{level:r}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`heading`,runner:(e,t)=>{e.openNode(`heading`,void 0,{depth:t.attrs.level}),KT(e,t),e.closeNode()}}}});R(FE.node,{displayName:`NodeSchema<heading>`,group:`Heading`}),R(FE.ctx,{displayName:`NodeSchemaCtx<heading>`,group:`Heading`});var IE=mx(e=>hm(/^(?<hashes>#+)\s$/,FE.type(e),t=>{let n=t.groups?.hashes?.length||0,{$from:r}=e.get(Qy).state.selection,i=r.node();if(i.type.name===`heading`){let e=Number(i.attrs.level)+Number(n);return e>6&&(e=6),{level:e}}return{level:n}}));R(IE,{displayName:`InputRule<wrapInHeadingInputRule>`,group:`Heading`});var LE=L(`WrapInHeading`,e=>t=>(t??=1,t<1?tm(DE.type(e)):tm(FE.type(e),{level:t})));R(LE,{displayName:`Command<wrapInHeadingCommand>`,group:`Heading`});var RE=L(`DowngradeHeading`,e=>()=>(t,n,r)=>{let{$from:i}=t.selection,a=i.node();if(a.type!==FE.type(e)||!t.selection.empty||i.parentOffset!==0)return!1;let o=a.attrs.level-1;return o?(n?.(t.tr.setNodeMarkup(t.selection.$from.before(),void 0,{...a.attrs,level:o})),!0):tm(DE.type(e))(t,n,r)});R(RE,{displayName:`Command<downgradeHeadingCommand>`,group:`Heading`});var zE=wx(`headingKeymap`,{TurnIntoH1:{shortcuts:`Mod-Alt-1`,command:e=>{let t=e.get(I);return()=>t.call(LE.key,1)}},TurnIntoH2:{shortcuts:`Mod-Alt-2`,command:e=>{let t=e.get(I);return()=>t.call(LE.key,2)}},TurnIntoH3:{shortcuts:`Mod-Alt-3`,command:e=>{let t=e.get(I);return()=>t.call(LE.key,3)}},TurnIntoH4:{shortcuts:`Mod-Alt-4`,command:e=>{let t=e.get(I);return()=>t.call(LE.key,4)}},TurnIntoH5:{shortcuts:`Mod-Alt-5`,command:e=>{let t=e.get(I);return()=>t.call(LE.key,5)}},TurnIntoH6:{shortcuts:`Mod-Alt-6`,command:e=>{let t=e.get(I);return()=>t.call(LE.key,6)}},DowngradeHeading:{shortcuts:[`Delete`,`Backspace`],command:e=>{let t=e.get(I);return()=>t.call(RE.key)}}});R(zE.ctx,{displayName:`KeymapCtx<heading>`,group:`Heading`}),R(zE.shortcuts,{displayName:`Keymap<heading>`,group:`Heading`});var BE=Tx(`blockquote`);R(BE,{displayName:`Attr<blockquote>`,group:`Blockquote`});var VE=Sx(`blockquote`,e=>({content:`block+`,group:`block`,defining:!0,parseDOM:[{tag:`blockquote`}],toDOM:t=>[`blockquote`,e.get(BE.key)(t),0],parseMarkdown:{match:({type:e})=>e===`blockquote`,runner:(e,t,n)=>{e.openNode(n).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===`blockquote`,runner:(e,t)=>{e.openNode(`blockquote`).next(t.content).closeNode()}}}));R(VE.node,{displayName:`NodeSchema<blockquote>`,group:`Blockquote`}),R(VE.ctx,{displayName:`NodeSchemaCtx<blockquote>`,group:`Blockquote`});var HE=mx(e=>mm(/^\s*>\s$/,VE.type(e)));R(HE,{displayName:`InputRule<wrapInBlockquoteInputRule>`,group:`Blockquote`});var UE=L(`WrapInBlockquote`,e=>()=>em(VE.type(e)));R(UE,{displayName:`Command<wrapInBlockquoteCommand>`,group:`Blockquote`});var WE=wx(`blockquoteKeymap`,{WrapInBlockquote:{shortcuts:`Mod-Shift-b`,command:e=>{let t=e.get(I);return()=>t.call(UE.key)}}});R(WE.ctx,{displayName:`KeymapCtx<blockquote>`,group:`Blockquote`}),R(WE.shortcuts,{displayName:`Keymap<blockquote>`,group:`Blockquote`});var GE=Tx(`codeBlock`,()=>({pre:{},code:{}}));R(GE,{displayName:`Attr<codeBlock>`,group:`CodeBlock`});var KE=Sx(`code_block`,e=>({content:`text*`,group:`block`,marks:``,defining:!0,code:!0,attrs:{language:{default:``,validate:`string`}},parseDOM:[{tag:`pre`,preserveWhitespace:`full`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{language:e.dataset.language}}}],toDOM:t=>{let n=e.get(GE.key)(t),r=t.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return[`pre`,{...n.pre,...i},[`code`,n.code,0]]},parseMarkdown:{match:({type:e})=>e===`code`,runner:(e,t,n)=>{let r=t.lang??``,i=t.value;e.openNode(n,{language:r}),i&&e.addText(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`code_block`,runner:(e,t)=>{e.addNode(`code`,void 0,t.content.firstChild?.text||``,{lang:t.attrs.language})}}}));R(KE.node,{displayName:`NodeSchema<codeBlock>`,group:`CodeBlock`}),R(KE.ctx,{displayName:`NodeSchemaCtx<codeBlock>`,group:`CodeBlock`});var qE=mx(e=>hm(/^```(?<language>[a-z]*)?[\s\n]$/,KE.type(e),e=>({language:e.groups?.language??``})));R(qE,{displayName:`InputRule<createCodeBlockInputRule>`,group:`CodeBlock`});var JE=L(`CreateCodeBlock`,e=>(t=``)=>tm(KE.type(e),{language:t}));R(JE,{displayName:`Command<createCodeBlockCommand>`,group:`CodeBlock`}),R(L(`UpdateCodeBlockLanguage`,()=>({pos:e,language:t}={pos:-1,language:``})=>(n,r)=>e>=0&&(r?.(n.tr.setNodeAttribute(e,`language`,t)),!0)),{displayName:`Command<updateCodeBlockLanguageCommand>`,group:`CodeBlock`});var YE=wx(`codeBlockKeymap`,{CreateCodeBlock:{shortcuts:`Mod-Alt-c`,command:e=>{let t=e.get(I);return()=>t.call(JE.key)}}});R(YE.ctx,{displayName:`KeymapCtx<codeBlock>`,group:`CodeBlock`}),R(YE.shortcuts,{displayName:`Keymap<codeBlock>`,group:`CodeBlock`});var XE=Tx(`image`);R(XE,{displayName:`Attr<image>`,group:`Image`});var ZE=Sx(`image`,e=>({inline:!0,group:`inline`,selectable:!0,draggable:!0,marks:``,atom:!0,defining:!0,isolating:!0,attrs:{src:{default:``,validate:`string`},alt:{default:``,validate:`string`},title:{default:``,validate:`string`}},parseDOM:[{tag:`img[src]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{src:e.getAttribute(`src`)||``,alt:e.getAttribute(`alt`)||``,title:e.getAttribute(`title`)||e.getAttribute(`alt`)||``}}}],toDOM:t=>[`img`,{...e.get(XE.key)(t),...t.attrs}],parseMarkdown:{match:({type:e})=>e===`image`,runner:(e,t,n)=>{let r=t.url,i=t.alt??``,a=t.title??``;e.addNode(n,{src:r,alt:i,title:a})}},toMarkdown:{match:e=>e.type.name===`image`,runner:(e,t)=>{e.addNode(`image`,void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));R(ZE.node,{displayName:`NodeSchema<image>`,group:`Image`}),R(ZE.ctx,{displayName:`NodeSchemaCtx<image>`,group:`Image`});var QE=L(`InsertImage`,e=>(t={})=>(n,r)=>{if(!r)return!0;let{src:i=``,alt:a=``,title:o=``}=t,s=ZE.type(e).create({src:i,alt:a,title:o});return s&&r(n.tr.replaceSelectionWith(s).scrollIntoView()),!0});R(QE,{displayName:`Command<insertImageCommand>`,group:`Image`});var $E=L(`UpdateImage`,e=>(t={})=>(n,r)=>{let i=lh(n.selection,ZE.type(e));if(!i)return!1;let{node:a,pos:o}=i,s={...a.attrs},{src:c,alt:l,title:u}=t;return c!==void 0&&(s.src=c),l!==void 0&&(s.alt=l),u!==void 0&&(s.title=u),r?.(n.tr.setNodeMarkup(o,void 0,s).scrollIntoView()),!0});R($E,{displayName:`Command<updateImageCommand>`,group:`Image`}),R(mx(e=>new dm(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(t,n,r,i)=>{let[a,o,s=``,c]=n;return a?t.tr.replaceWith(r,i,ZE.type(e).create({src:s,alt:o,title:c})):null})),{displayName:`InputRule<insertImageInputRule>`,group:`Image`});var eD=Tx(`hardbreak`,e=>({"data-type":`hardbreak`,"data-is-inline":e.attrs.isInline}));R(eD,{displayName:`Attr<hardbreak>`,group:`Hardbreak`});var tD=Sx(`hardbreak`,e=>({inline:!0,group:`inline`,attrs:{isInline:{default:!1,validate:`boolean`}},selectable:!1,parseDOM:[{tag:`br`},{tag:`span[data-type="hardbreak"]`,getAttrs:()=>({isInline:!0})}],toDOM:t=>t.attrs.isInline?[`span`,e.get(eD.key)(t),` `]:[`br`,e.get(eD.key)(t)],parseMarkdown:{match:({type:e})=>e===`break`,runner:(e,t,n)=>{e.addNode(n,{isInline:!!t.data?.isInline})}},leafText:()=>`
53
- `,toMarkdown:{match:e=>e.type.name===`hardbreak`,runner:(e,t)=>{t.attrs.isInline?e.addNode(`text`,void 0,`
54
- `):e.addNode(`break`)}}}));R(tD.node,{displayName:`NodeSchema<hardbreak>`,group:`Hardbreak`}),R(tD.ctx,{displayName:`NodeSchemaCtx<hardbreak>`,group:`Hardbreak`});var nD=L(`InsertHardbreak`,e=>()=>(t,n)=>{let{selection:r,tr:i}=t;if(!(r instanceof N))return!1;if(r.empty){let e=r.$from.node();if(e.childCount>0&&e.lastChild?.type.name===`hardbreak`)return n?.(i.replaceRangeWith(r.to-1,r.to,t.schema.node(`paragraph`)).setSelection(ap.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return n?.(i.setMeta(`hardbreak`,!0).replaceSelectionWith(tD.type(e).create()).scrollIntoView()),!0});R(nD,{displayName:`Command<insertHardbreakCommand>`,group:`Hardbreak`});var rD=wx(`hardbreakKeymap`,{InsertHardbreak:{shortcuts:`Shift-Enter`,command:e=>{let t=e.get(I);return()=>t.call(nD.key)}}});R(rD.ctx,{displayName:`KeymapCtx<hardbreak>`,group:`Hardbreak`}),R(rD.shortcuts,{displayName:`Keymap<hardbreak>`,group:`Hardbreak`});var iD=Tx(`hr`);R(iD,{displayName:`Attr<hr>`,group:`Hr`});var aD=Sx(`hr`,e=>({group:`block`,parseDOM:[{tag:`hr`}],toDOM:t=>[`hr`,e.get(iD.key)(t)],parseMarkdown:{match:({type:e})=>e===`thematicBreak`,runner:(e,t,n)=>{e.addNode(n)}},toMarkdown:{match:e=>e.type.name===`hr`,runner:e=>{e.addNode(`thematicBreak`)}}}));R(aD.node,{displayName:`NodeSchema<hr>`,group:`Hr`}),R(aD.ctx,{displayName:`NodeSchemaCtx<hr>`,group:`Hr`});var oD=mx(e=>new dm(/^(?:---|___\s|\*\*\*\s)$/,(t,n,r,i)=>{let{tr:a}=t;return n[0]&&a.replaceWith(r-1,i,aD.type(e).create()),a}));R(oD,{displayName:`InputRule<insertHrInputRule>`,group:`Hr`});var sD=L(`InsertHr`,e=>()=>(t,n)=>{if(!n)return!0;let r=DE.node.type(e).create(),{tr:i,selection:a}=t,{from:o}=a,s=aD.type(e).create();if(!s)return!0;let c=i.replaceSelectionWith(s).insert(o,r),l=ap.findFrom(c.doc.resolve(o),1,!0);return l&&n(c.setSelection(l).scrollIntoView()),!0});R(sD,{displayName:`Command<insertHrCommand>`,group:`Hr`});var cD=Tx(`bulletList`);R(cD,{displayName:`Attr<bulletList>`,group:`BulletList`});var lD=Sx(`bullet_list`,e=>({content:`listItem+`,group:`block`,attrs:{spread:{default:!1,validate:`boolean`}},parseDOM:[{tag:`ul`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{spread:e.dataset.spread===`true`}}}],toDOM:t=>[`ul`,{...e.get(cD.key)(t),"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e===`list`&&!t,runner:(e,t,n)=>{let r=t.spread??!1;e.openNode(n,{spread:r}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===`bullet_list`,runner:(e,t)=>{e.openNode(`list`,void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));R(lD.node,{displayName:`NodeSchema<bulletList>`,group:`BulletList`}),R(lD.ctx,{displayName:`NodeSchemaCtx<bulletList>`,group:`BulletList`});var uD=mx(e=>mm(/^\s*([-+*])\s$/,lD.type(e)));R(uD,{displayName:`InputRule<wrapInBulletListInputRule>`,group:`BulletList`});var dD=L(`WrapInBulletList`,e=>()=>em(lD.type(e)));R(dD,{displayName:`Command<wrapInBulletListCommand>`,group:`BulletList`});var fD=wx(`bulletListKeymap`,{WrapInBulletList:{shortcuts:`Mod-Alt-8`,command:e=>{let t=e.get(I);return()=>t.call(dD.key)}}});R(fD.ctx,{displayName:`KeymapCtx<bulletListKeymap>`,group:`BulletList`}),R(fD.shortcuts,{displayName:`Keymap<bulletListKeymap>`,group:`BulletList`});var pD=Tx(`orderedList`);R(pD,{displayName:`Attr<orderedList>`,group:`OrderedList`});var mD=Sx(`ordered_list`,e=>({content:`listItem+`,group:`block`,attrs:{order:{default:1,validate:`number`},spread:{default:!1,validate:`boolean`}},parseDOM:[{tag:`ol`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{spread:e.dataset.spread===`true`,order:e.hasAttribute(`start`)?Number(e.getAttribute(`start`)):1}}}],toDOM:t=>[`ol`,{...e.get(pD.key)(t),...t.attrs.order===1?{}:{start:t.attrs.order},"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e===`list`&&!!t,runner:(e,t,n)=>{let r=t.spread??!0;e.openNode(n,{spread:r,order:t.start??1}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===`ordered_list`,runner:(e,t)=>{e.openNode(`list`,void 0,{ordered:!0,start:t.attrs.order??1,spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));R(mD.node,{displayName:`NodeSchema<orderedList>`,group:`OrderedList`}),R(mD.ctx,{displayName:`NodeSchemaCtx<orderedList>`,group:`OrderedList`});var hD=mx(e=>mm(/^\s*(\d+)\.\s$/,mD.type(e),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));R(hD,{displayName:`InputRule<wrapInOrderedListInputRule>`,group:`OrderedList`});var gD=L(`WrapInOrderedList`,e=>()=>em(mD.type(e)));R(gD,{displayName:`Command<wrapInOrderedListCommand>`,group:`OrderedList`});var _D=wx(`orderedListKeymap`,{WrapInOrderedList:{shortcuts:`Mod-Alt-7`,command:e=>{let t=e.get(I);return()=>t.call(gD.key)}}});R(_D.ctx,{displayName:`KeymapCtx<orderedList>`,group:`OrderedList`}),R(_D.shortcuts,{displayName:`Keymap<orderedList>`,group:`OrderedList`});var vD=Tx(`listItem`);R(vD,{displayName:`Attr<listItem>`,group:`ListItem`});var yD=Sx(`list_item`,e=>({group:`listItem`,content:`paragraph block*`,attrs:{label:{default:`•`,validate:`string`},listType:{default:`bullet`,validate:`string`},spread:{default:!0,validate:`boolean`}},defining:!0,parseDOM:[{tag:`li`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread===`true`}}}],toDOM:t=>[`li`,{...e.get(vD.key)(t),"data-label":t.attrs.label,"data-list-type":t.attrs.listType,"data-spread":t.attrs.spread},0],parseMarkdown:{match:({type:e})=>e===`listItem`,runner:(e,t,n)=>{let r=t.label==null?`•`:`${t.label}.`,i=t.label==null?`bullet`:`ordered`,a=t.spread??!0;e.openNode(n,{label:r,listType:i,spread:a}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`list_item`,runner:(e,t)=>{e.openNode(`listItem`,void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));R(yD.node,{displayName:`NodeSchema<listItem>`,group:`ListItem`}),R(yD.ctx,{displayName:`NodeSchemaCtx<listItem>`,group:`ListItem`});var bD=L(`SinkListItem`,e=>()=>RT(yD.type(e)));R(bD,{displayName:`Command<sinkListItemCommand>`,group:`ListItem`});var xD=L(`LiftListItem`,e=>()=>FT(yD.type(e)));R(xD,{displayName:`Command<liftListItemCommand>`,group:`ListItem`});var SD=L(`SplitListItem`,e=>()=>PT(yD.type(e)));R(SD,{displayName:`Command<splitListItemCommand>`,group:`ListItem`});function CD(e){return(t,n,r)=>{let{selection:i}=t;if(!(i instanceof N))return!1;let{empty:a,$from:o}=i;return!a||o.parentOffset!==0||o.node(-1).type!==yD.type(e)?!1:jp(t,n,r)}}var wD=L(`LiftFirstListItem`,e=>()=>CD(e));R(wD,{displayName:`Command<liftFirstListItemCommand>`,group:`ListItem`});var TD=wx(`listItemKeymap`,{NextListItem:{shortcuts:`Enter`,command:e=>{let t=e.get(I);return()=>t.call(SD.key)}},SinkListItem:{shortcuts:[`Tab`,`Mod-]`],command:e=>{let t=e.get(I);return()=>t.call(bD.key)}},LiftListItem:{shortcuts:[`Shift-Tab`,`Mod-[`],command:e=>{let t=e.get(I);return()=>t.call(xD.key)}},LiftFirstListItem:{shortcuts:[`Backspace`,`Delete`],command:e=>{let t=e.get(I);return()=>t.call(wD.key)}}});R(TD.ctx,{displayName:`KeymapCtx<listItem>`,group:`ListItem`}),R(TD.shortcuts,{displayName:`Keymap<listItem>`,group:`ListItem`});var ED=_x(`text`,()=>({group:`inline`,parseMarkdown:{match:({type:e})=>e===`text`,runner:(e,t)=>{e.addText(t.value)}},toMarkdown:{match:e=>e.type.name===`text`,runner:(e,t)=>{e.addNode(`text`,void 0,t.text)}}}));R(ED,{displayName:`NodeSchema<text>`,group:`Text`});var DD=Tx(`html`);R(DD,{displayName:`Attr<html>`,group:`Html`});var OD=Sx(`html`,e=>({atom:!0,group:`inline`,inline:!0,attrs:{value:{default:``,validate:`string`}},toDOM:t=>{let n=document.createElement(`span`),r={...e.get(DD.key)(t),"data-value":t.attrs.value,"data-type":`html`};return n.textContent=t.attrs.value,[`span`,r,t.attrs.value]},parseDOM:[{tag:`span[data-type="html"]`,getAttrs:e=>({value:e.dataset.value??``})}],parseMarkdown:{match:({type:e})=>e===`html`,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>e.type.name===`html`,runner:(e,t)=>{e.addNode(`html`,void 0,t.attrs.value)}}}));R(OD.node,{displayName:`NodeSchema<html>`,group:`Html`}),R(OD.ctx,{displayName:`NodeSchemaCtx<html>`,group:`Html`});var kD=[_E,EE,DE,NE,PE,FE,eD,tD,BE,VE,GE,KE,iD,aD,XE,ZE,cD,lD,pD,mD,vD,yD,qT,JT,$T,eE,iE,aE,pE,mE,DD,OD,ED].flat(),AD=[HE,uD,hD,qE,oD,IE].flat(),jD=[XT,ZT,sE,nE],MD=L(`IsMarkSelected`,()=>e=>t=>{if(!e)return!1;let{doc:n,selection:r}=t;return n.rangeHasMark(r.from,r.to,e)}),ND=L(`IsNoteSelected`,()=>e=>t=>e?uh(t,e).hasNode:!1),PD=L(`ClearTextInCurrentBlock`,()=>()=>(e,t)=>{let n=e.tr,{$from:r,$to:i}=n.selection,{pos:a}=r,{pos:o}=i,s=a-r.node().content.size;return s<0?!1:(n=n.deleteRange(s,o),t?.(n),!0)}),FD=L(`SetBlockType`,()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let a=t.tr,{from:o,to:s}=a.selection;try{a.setBlockType(o,s,r,i)}catch{return!1}return n?.(a),!0}),ID=L(`WrapInBlockType`,()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let a=t.tr;try{let{$from:e,$to:t}=a.selection,n=e.blockRange(t),o=n&&bf(n,r,i);if(!o)return!1;a=a.wrap(n,o)}catch{return!1}return n?.(a),!0}),LD=L(`AddBlockType`,()=>e=>(t,n)=>{let{nodeType:r,attrs:i=null}=e??{};if(!r)return!1;let a=t.tr;try{let e=r instanceof Ju?r:r.createAndFill(i);if(!e)return!1;a.replaceSelectionWith(e)}catch{return!1}return n?.(a),!0}),RD=L(`SelectTextNearPos`,()=>e=>(t,n)=>{let{pos:r}=e??{};if(r==null)return!1;let i=(e,t,n)=>Math.min(Math.max(e,t),n),a=t.tr;try{let e=t.doc.resolve(i(r,0,t.doc.content.size));a.setSelection(N.near(e))}catch{return!1}return n?.(a.scrollIntoView()),!0}),zD=[kE,UE,LE,RE,JE,nD,sD,QE,$E,gD,dD,bD,SD,xD,wD,YT,oE,tE,hE,gE,MD,ND,PD,FD,ID,LD,RD],BD=[WE,YE,rD,zE,TD,_D,fD,AE,QT,cE,rE].flat(),VD=Dx(`remarkAddOrderInList`,()=>()=>e=>{_c(e,`list`,e=>{if(e.ordered){let t=e.start??1;e.children.forEach((e,n)=>{e.label=n+t})}})});R(VD.plugin,{displayName:`Remark<remarkAddOrderInListPlugin>`,group:`Remark`}),R(VD.options,{displayName:`RemarkConfig<remarkAddOrderInListPlugin>`,group:`Remark`});var HD=Dx(`remarkLineBreak`,()=>()=>e=>{let t=/[\t ]*(?:\r?\n|\r)/g;_c(e,`text`,(e,n,r)=>{if(!e.value||typeof e.value!=`string`)return;let i=[],a=0;t.lastIndex=0;let o=t.exec(e.value);for(;o;){let n=o.index;a!==n&&i.push({type:`text`,value:e.value.slice(a,n)}),i.push({type:`break`,data:{isInline:!0}}),a=n+o[0].length,o=t.exec(e.value)}if(i.length>0&&r&&typeof n==`number`)return a<e.value.length&&i.push({type:`text`,value:e.value.slice(a)}),r.children.splice(n,1,...i),n+i.length})});R(HD.plugin,{displayName:`Remark<remarkLineBreak>`,group:`Remark`}),R(HD.options,{displayName:`RemarkConfig<remarkLineBreak>`,group:`Remark`});var UD=Dx(`remarkInlineLink`,()=>VT);R(UD.plugin,{displayName:`Remark<remarkInlineLinkPlugin>`,group:`Remark`}),R(UD.options,{displayName:`RemarkConfig<remarkInlineLinkPlugin>`,group:`Remark`});var WD=e=>!!e.children,GD=e=>e.type===`html`;function KD(e,t){return n(e,0,null)[0];function n(e,r,i){if(WD(e)){let t=[];for(let r=0,i=e.children.length;r<i;r++){let i=e.children[r];if(i){let a=n(i,r,e);if(a)for(let e=0,n=a.length;e<n;e++){let n=a[e];n&&t.push(n)}}}e.children=t}return t(e,r,i)}}var qD=Dx(`remarkHTMLTransformer`,e=>()=>t=>{let n=SE(e);KD(t,(e,t,r)=>(GD(e)&&r&&n.has(r.type)&&(e.children=[HT(e)],delete e.value,e.type=`paragraph`),[e]))});R(qD.plugin,{displayName:`Remark<remarkHtmlTransformer>`,group:`Remark`}),R(qD.options,{displayName:`RemarkConfig<remarkHtmlTransformer>`,group:`Remark`});var JD=Dx(`remarkMarker`,()=>()=>(e,t)=>{let n=e=>t.value.charAt(e.position.start.offset);_c(e,e=>[`strong`,`emphasis`].includes(e.type),e=>{e.marker=n(e)})});R(JD.plugin,{displayName:`Remark<remarkMarker>`,group:`Remark`}),R(JD.options,{displayName:`RemarkConfig<remarkMarker>`,group:`Remark`});var YD=vx(()=>{let e=!1,t=new Tp({key:new Op(`MILKDOWN_INLINE_NODES_CURSOR`),state:{init(){return!1},apply(e){if(!e.selection.empty)return!1;let t=e.selection.$from,n=t.nodeBefore,r=t.nodeAfter;return!!(n&&r&&n.isInline&&!n.isText&&r.isInline&&!r.isText)}},props:{handleDOMEvents:{compositionend:(n,r)=>e?(e=!1,requestAnimationFrame(()=>{if(t.getState(n.state)){let e=n.state.selection.from;r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||``,e))}}),!0):!1,compositionstart:n=>(t.getState(n.state)&&(e=!0),!1),beforeinput:(n,r)=>{if(t.getState(n.state)&&r instanceof InputEvent&&r.data&&!e){let e=n.state.selection.from;return r.preventDefault(),n.dispatch(n.state.tr.insertText(r.data||``,e)),!0}return!1}},decorations(e){if(t.getState(e)){let t=e.selection.$from.pos,n=document.createElement(`span`),r=ay.widget(t,n,{side:-1}),i=document.createElement(`span`),a=ay.widget(t,i);return setTimeout(()=>{n.contentEditable=`true`,i.contentEditable=`true`}),cy.create(e.doc,[r,a])}return cy.empty}}});return t});R(YD,{displayName:`Prose<inlineNodesCursorPlugin>`,group:`Prose`});var XD=vx(e=>new Tp({key:new Op(`MILKDOWN_HARDBREAK_MARKS`),appendTransaction:(t,n,r)=>{if(!t.length)return;let[i]=t;if(!i)return;let[a]=i.steps;if(i.getMeta(`hardbreak`)){if(!(a instanceof df))return;let{from:t}=a;return r.tr.setNodeMarkup(t,tD.type(e),void 0,[])}if(a instanceof sf){let t=r.tr,{from:n,to:i}=a;return r.doc.nodesBetween(n,i,(n,r)=>{n.type===tD.type(e)&&(t=t.setNodeMarkup(r,tD.type(e),void 0,[]))}),t}}}));R(XD,{displayName:`Prose<hardbreakClearMarkPlugin>`,group:`Prose`});var ZD=xx([`table`,`code_block`],`hardbreakFilterNodes`);R(ZD,{displayName:`Ctx<hardbreakFilterNodes>`,group:`Prose`});var QD=vx(e=>{let t=e.get(ZD.key);return new Tp({key:new Op(`MILKDOWN_HARDBREAK_FILTER`),filterTransaction:(e,n)=>{let r=e.getMeta(`hardbreak`),[i]=e.steps;if(r&&i){let{from:e}=i,r=n.doc.resolve(e),a=r.depth,o=!0;for(;a>0;)t.includes(r.node(a).type.name)&&(o=!1),a--;return o}return!0}})});R(QD,{displayName:`Prose<hardbreakFilterPlugin>`,group:`Prose`});var $D=vx(e=>{let t=new Op(`MILKDOWN_HEADING_ID`),n=n=>{if(n.composing)return;let r=e.get(NE.key),i=n.state.tr.setMeta(`addToHistory`,!1),a=!1,o={};n.state.doc.descendants((n,s)=>{if(n.type===FE.type(e)){if(n.textContent.trim().length===0)return;let e=n.attrs,c=r(n);o[c]?(o[c]+=1,c+=`-#${o[c]}`):o[c]=1,e.id!==c&&(a=!0,i.setMeta(t,!0).setNodeMarkup(s,void 0,{...e,id:c}))}}),a&&n.dispatch(i)};return new Tp({key:t,view:e=>(n(e),{update:(e,t)=>{e.state.doc.eq(t.doc)||n(e)}})})});R($D,{displayName:`Prose<syncHeadingIdPlugin>`,group:`Prose`});var eO=vx(e=>new Tp({key:new Op(`MILKDOWN_KEEP_LIST_ORDER`),appendTransaction:(t,n,r)=>{if(!r.selection||t.some(e=>e.getMeta(`addToHistory`)===!1||!e.isGeneric))return null;let i=mD.type(e),a=lD.type(e),o=yD.type(e),s=(e,t,n=1)=>{let r=!1,i=`${t+n}.`;return e.label!==i&&(e.label=i,r=!0),r},c=r.tr,l=!1;return r.doc.descendants((e,t,n,r)=>{if(e.type===a){let n=e.maybeChild(0);n?.type===o&&n.attrs.listType===`ordered`&&(l=!0,c.setNodeMarkup(t,i,{spread:!0}),e.descendants((e,t,n,r)=>{if(e.type===o){let n={...e.attrs};s(n,r)&&(c=c.setNodeMarkup(t,void 0,n))}return!1}))}else if(e.type===o&&n?.type===i){let i={...e.attrs},a=!1;i.listType!==`ordered`&&(i.listType=`ordered`,a=!0),n?.maybeChild(0)&&(a=s(i,r,n?.attrs.order??1)),a&&(c=c.setNodeMarkup(t,void 0,i),l=!0)}}),l?c.setMeta(`addToHistory`,!1):null}}));R(eO,{displayName:`Prose<syncListOrderPlugin>`,group:`Prose`});var tO=[kD,AD,jD,zD,BD,[XD,ZD,QD,YD,bE,VD,UD,HD,qD,JD,TE,$D,eO].flat()].flat();function nO(e){let t=xx({},`${e}_SLASH_SPEC`),n=vx(n=>{let r=n.get(t.key);return new Tp({key:new Op(`${e}_SLASH`),...r})}),r=[t,n];return r.key=t.key,r.pluginKey=n.key,t.meta={package:`@milkdown/plugin-slash`,displayName:`Ctx<slashSpec>|${e}`},n.meta={package:`@milkdown/plugin-slash`,displayName:`Prose<slash>|${e}`},r}var rO=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){this.#e=!1,this.onShow=()=>{},this.onHide=()=>{},this.#l=(e,t)=>{let{state:n,composing:r}=e,{selection:i,doc:a}=n,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),c=Math.max(...o.map(e=>e.$to.pos)),l=t&&t.doc.eq(a)&&t.selection.eq(i);if(this.#e||=((this.#r??e.dom.parentElement??document.body).appendChild(this.element),!0),!(r||l)){if(!this.#o(e,t)){this.hide();return}gT({getBoundingClientRect:()=>eh(e,s,c)},this.element,{placement:`bottom-start`,middleware:[hT(),pT(this.#c),...this.#t],...this.#n}).then(({x:e,y:t})=>{Object.assign(this.element.style,{left:`${e}px`,top:`${t}px`})}).catch(console.error),this.show()}},this.#u=e=>{let t=this.getContent(e);if(!t)return!1;let n=t.at(-1);return n?Array.isArray(this.#a)?this.#a.includes(n):this.#a===n:!1},this.update=(e,t)=>{this.#s(e,t)},this.getContent=(e,t=e=>e.type.name===`paragraph`)=>{let{selection:n}=e.state,{empty:r,$from:i}=n,a=e.state.selection instanceof N;if(typeof document>`u`)return;let o=this.element.contains(document.activeElement),s=!e.hasFocus()&&!o,c=!e.editable,l=!ch(t)(e.state.selection);if(!(s||c||!r||!a||l))return i.parent.textBetween(Math.max(0,i.parentOffset-500),i.parentOffset,void 0,``)},this.destroy=()=>{this.#s.cancel()},this.show=()=>{this.element.dataset.show=`true`,this.onShow()},this.hide=()=>{this.element.dataset.show=`false`,this.onHide()},this.element=e.content,this.#i=e.debounce??200,this.#o=e.shouldShow??this.#u,this.#a=e.trigger??`/`,this.#c=e.offset,this.#t=e.middleware??[],this.#n=e.floatingUIOptions??{},this.#r=e.root,this.#s=Dr(this.#l,this.#i)}#l;#u},iO=Object.defineProperty,aO=Object.getOwnPropertySymbols,oO=Object.prototype.hasOwnProperty,sO=Object.prototype.propertyIsEnumerable,cO=(e,t,n)=>t in e?iO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lO=(e,t)=>{for(var n in t||={})oO.call(t,n)&&cO(e,n,t[n]);if(aO)for(var n of aO(t))sO.call(t,n)&&cO(e,n,t[n]);return e};function uO(e,t){return Object.assign(e,{meta:lO({package:`@milkdown/components`},t)}),e}var dO=xx({imageIcon:`🌌`,captionIcon:`💬`,uploadButton:`Upload file`,confirmButton:`Confirm ⏎`,uploadPlaceholderText:`or paste the image link ...`,captionPlaceholderText:`Image caption`,onUpload:e=>Promise.resolve(URL.createObjectURL(e))},`imageBlockConfigCtx`);uO(dO,{displayName:`Config<image-block>`,group:`ImageBlock`});function fO(e){return _c(e,`paragraph`,(e,t,n)=>{if(e.children?.length!==1)return;let r=e.children?.[0];if(!r||r.type!==`image`)return;let{url:i,alt:a,title:o}=r,s={type:`image-block`,url:i,alt:a,title:o};n.children.splice(t,1,s)})}var pO=Dx(`remark-image-block`,()=>()=>fO);uO(pO.plugin,{displayName:`Remark<remarkImageBlock>`,group:`ImageBlock`}),uO(pO.options,{displayName:`RemarkConfig<remarkImageBlock>`,group:`ImageBlock`});var mO=Object.defineProperty,hO=Object.getOwnPropertySymbols,gO=Object.prototype.hasOwnProperty,_O=Object.prototype.propertyIsEnumerable,vO=(e,t,n)=>t in e?mO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yO=(e,t)=>{for(var n in t||={})gO.call(t,n)&&vO(e,n,t[n]);if(hO)for(var n of hO(t))_O.call(t,n)&&vO(e,n,t[n]);return e},bO=`image-block`,xO=Sx(`image-block`,()=>({inline:!1,group:`block`,selectable:!0,draggable:!0,isolating:!0,marks:``,atom:!0,priority:100,attrs:{src:{default:``,validate:`string`},caption:{default:``,validate:`string`},ratio:{default:1,validate:`number`}},parseDOM:[{tag:`img[data-type="${bO}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{src:e.getAttribute(`src`)||``,caption:e.getAttribute(`caption`)||``,ratio:Number(e.getAttribute(`ratio`)??1)}}}],toDOM:e=>[`img`,yO({"data-type":bO},e.attrs)],parseMarkdown:{match:({type:e})=>e===`image-block`,runner:(e,t,n)=>{let r=t.url,i=t.title??``,a=Number(t.alt||1);(Number.isNaN(a)||a===0)&&(a=1),e.addNode(n,{src:r,caption:i,ratio:a})}},toMarkdown:{match:e=>e.type.name===`image-block`,runner:(e,t)=>{e.openNode(`paragraph`),e.addNode(`image`,void 0,void 0,{title:t.attrs.caption,url:t.attrs.src,alt:`${Number.parseFloat(t.attrs.ratio).toFixed(2)}`}),e.closeNode()}}}));uO(xO.node,{displayName:`NodeSchema<image-block>`,group:`ImageBlock`});var SO=fx(`abcdefghijklmnopqrstuvwxyz0123456789`,8);function CO(e){return`${e}-${SO()}`}function wO({icon:e,class:t,onClick:n}){return f(`span`,{class:bT(`milkdown-icon`,t),onPointerdown:n,innerHTML:e?gt.sanitize(e.trim()):void 0})}wO.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var TO=d({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:a,confirmButton:o,uploadPlaceholderText:s,className:c,onImageLoadError:l}){let u=S(!1),d=S(),p=S(t.value??``),m=CO(`milkdown-image-link`),h=CO(`milkdown-image-upload`),g=S(t.value?.length!==0),_=e=>{let t=e.target.value;g.value=t.length!==0,p.value=t},v=e=>{e.key===`Enter`&&n(d.value?.value??``)},y=()=>{n(d.value?.value??``)},b=e=>{let t=e.target.files?.[0];t&&r(t).then(e=>{e&&(n(e),g.value=!0)}).catch(e=>{console.error(`An error occurred while uploading image`),console.error(e)})};return()=>f(`div`,{class:bT(`image-edit`,c)},f(wO,{icon:i,class:`image-icon`}),f(`div`,{class:bT(`link-importer`,u.value&&`focus`)},f(`input`,{id:m,ref:d,draggable:`true`,onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:`link-input-area`,value:p.value,onInput:_,onKeydown:v,onFocus:()=>u.value=!0,onBlur:()=>u.value=!1}),!g.value&&f(`div`,{class:`placeholder`},f(`input`,{disabled:e.value,class:`hidden`,id:h,type:`file`,accept:`image/*`,onChange:b}),f(`label`,{class:`uploader`,for:h},f(wO,{icon:a})),f(`span`,{class:`text`,onClick:()=>d.value?.focus()},s))),p.value&&f(C,null,f(`div`,{class:`image-preview`},f(`img`,{src:p.value,alt:``,onError:e=>Promise.resolve(l?.(e)).catch(()=>{})})),f(`div`,{class:`confirm`,onClick:()=>y()},f(wO,{icon:o}))))}}),EO=d({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:e,caption:t,ratio:n,readonly:r,setAttr:i,config:a}){let o=S(),s=S(),c=S(!!t.value?.length),l=CO(`milkdown-image-caption`),u=S(0),d=()=>{let e=o.value;if(!e)return;let t=e.closest(`.milkdown-image-block`);if(!t)return;let r=t.getBoundingClientRect().width;if(!r)return;a.maxWidth&&a.maxWidth<r&&(r=a.maxWidth);let i=e.naturalHeight,s=e.naturalWidth,c=s<r?i:i/s*r;a.maxHeight&&c>a.maxHeight&&(c=a.maxHeight);let l=(c*(n.value??1)).toFixed(2);e.dataset.origin=c.toFixed(2),e.dataset.height=l,e.style.height=`${l}px`,a.maxWidth&&(e.style.maxWidth=`${a.maxWidth}px`)},p=e=>{e.preventDefault(),e.stopPropagation(),!r.value&&(c.value=!c.value)},m=e=>{let t=e.target.value;u.value&&window.clearTimeout(u.value),u.value=window.setTimeout(()=>{i(`caption`,t)},1e3)},h=e=>{let t=e.target.value;u.value&&=(window.clearTimeout(u.value),0),i(`caption`,t)},g=e=>{e.preventDefault();let t=o.value;if(!t)return;let n=t.getBoundingClientRect().top,r=e.clientY-n;r<100&&(r=100),a.maxHeight&&r>a.maxHeight&&(r=a.maxHeight);let i=Number(r).toFixed(2);t.dataset.height=i,t.style.height=`${i}px`},_=()=>{window.removeEventListener(`pointermove`,g),window.removeEventListener(`pointerup`,_);let e=o.value;if(!e)return;let t=Number(e.dataset.origin),n=Number(e.dataset.height),r=Number.parseFloat(Number(n/t).toFixed(2));Number.isNaN(r)||i(`ratio`,r)},v=e=>{r.value||(e.preventDefault(),e.stopPropagation(),window.addEventListener(`pointermove`,g),window.addEventListener(`pointerup`,_))};return()=>f(C,null,f(`div`,{class:`image-wrapper`},f(`div`,{class:`operation`},f(`div`,{class:`operation-item`,onPointerdown:p},f(wO,{icon:a.captionIcon}))),f(`img`,{ref:o,"data-type":bO,onLoad:d,src:e.value,alt:t.value,onError:e=>Promise.resolve(a.onImageLoadError?.call(a,e)).catch(()=>{})}),f(`div`,{ref:s,class:`image-resize-handle`,onPointerdown:v})),c.value&&f(`input`,{id:l,draggable:`true`,onDragstart:e=>{e.preventDefault(),e.stopPropagation()},class:`caption-input`,placeholder:a?.captionPlaceholderText,onInput:m,onBlur:h,value:t.value}))}}),DO=Object.defineProperty,OO=Object.getOwnPropertySymbols,kO=Object.prototype.hasOwnProperty,AO=Object.prototype.propertyIsEnumerable,jO=(e,t,n)=>t in e?DO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,MO=(e,t)=>{for(var n in t||={})kO.call(t,n)&&jO(e,n,t[n]);if(OO)for(var n of OO(t))AO.call(t,n)&&jO(e,n,t[n]);return e},NO=d({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){let{src:t}=e;return()=>t.value?.length?f(EO,MO({},e)):f(TO,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr(`src`,t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,onImageLoadError:e.config.onImageLoadError})}}),PO=bx(xO.node,e=>(t,n,r)=>{let i=S(t.attrs.src),a=S(t.attrs.caption),o=S(t.attrs.ratio),s=S(!1),c=S(!n.editable),l=(e,t)=>{if(!n.editable)return;let i=r();i!=null&&n.dispatch(n.state.tr.setNodeAttribute(i,e,e===`src`?gt.sanitize(t):t))},u=e.get(dO.key),d=re(NO,{src:i,caption:a,ratio:o,selected:s,readonly:c,setAttr:l,config:u}),f=document.createElement(`div`);f.className=`milkdown-image-block`;let p=te(()=>{s.value?f.classList.add(`selected`):f.classList.remove(`selected`)}),m=u.proxyDomURL,h=e=>{if(!m)i.value=e.attrs.src;else{let t=m(e.attrs.src);typeof t==`string`?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}o.value=e.attrs.ratio,a.value=e.attrs.caption,c.value=!n.editable};return h(t),d.mount(f),{dom:f,update:e=>e.type===t.type&&(h(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{s.value=!0},deselectNode:()=>{s.value=!1},destroy:()=>{p(),d.unmount(),f.remove()}}});uO(PO,{displayName:`NodeView<image-block>`,group:`ImageBlock`});var FO=[pO,xO,PO,dO].flat(),IO,LO;if(typeof WeakMap<`u`){let e=new WeakMap;IO=t=>e.get(t),LO=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;IO=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},LO=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var RO=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return IO(e)||LO(e,zO(e))}};function zO(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=BO(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new RO(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&VO(s,o,e),s}function BO(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function VO(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=HO(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function HO(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function UO(e,t){if(typeof e==`string`)return{};let n=e.getAttribute(`data-colwidth`),r=n&&/^\d+(,\d+)*$/.test(n)?n.split(`,`).map(e=>Number(e)):null,i=Number(e.getAttribute(`colspan`)||1),a={colspan:i,rowspan:Number(e.getAttribute(`rowspan`)||1),colwidth:r&&r.length==i?r:null};for(let n in t){let r=t[n].getFromDOM,i=r&&r(e);i!=null&&(a[n]=i)}return a}function WO(e,t){let n={};e.attrs.colspan!=1&&(n.colspan=e.attrs.colspan),e.attrs.rowspan!=1&&(n.rowspan=e.attrs.rowspan),e.attrs.colwidth&&(n[`data-colwidth`]=e.attrs.colwidth.join(`,`));for(let r in t){let i=t[r].setDOMAttr;i&&i(e.attrs[r],n)}return n}function GO(e){if(e!==null){if(!Array.isArray(e))throw TypeError(`colwidth must be null or an array`);for(let t of e)if(typeof t!=`number`)throw TypeError(`colwidth must be null or an array of numbers`)}}function KO(e){let t=e.cellAttributes||{},n={colspan:{default:1,validate:`number`},rowspan:{default:1,validate:`number`},colwidth:{default:null,validate:GO}};for(let e in t)n[e]={default:t[e].default,validate:t[e].validate};return{table:{content:`table_row+`,tableRole:`table`,isolating:!0,group:e.tableGroup,parseDOM:[{tag:`table`}],toDOM(){return[`table`,[`tbody`,0]]}},table_row:{content:`(table_cell | table_header)*`,tableRole:`row`,parseDOM:[{tag:`tr`}],toDOM(){return[`tr`,0]}},table_cell:{content:e.cellContent,attrs:n,tableRole:`cell`,isolating:!0,parseDOM:[{tag:`td`,getAttrs:e=>UO(e,t)}],toDOM(e){return[`td`,WO(e,t),0]}},table_header:{content:e.cellContent,attrs:n,tableRole:`header_cell`,isolating:!0,parseDOM:[{tag:`th`,getAttrs:e=>UO(e,t)}],toDOM(e){return[`th`,WO(e,t),0]}}}}function qO(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var JO=new Op(`selectingCells`);function YO(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function XO(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function ZO(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=YO(t.$head)||QO(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function QO(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function $O(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function ek(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function tk(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function nk(e,t,n){let r=e.node(-1),i=RO.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function rk(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function ik(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function ak(e,t,n){let r=qO(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var ok=class e extends ap{constructor(e,t=e){let n=e.node(-1),r=RO.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new op(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if($O(r)&&$O(i)&&tk(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return N.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=RO.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=rk(e,0,l)),u>0&&(e=rk(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(j.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new M(j.from(o),1,1)}replace(e,t=M.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?M.empty:t)}let i=ap.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new M(j.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=RO.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=RO.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=RO.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=RO.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new sk(this.$anchorCell.pos,this.$headCell.pos)}};ok.prototype.visible=!1,ap.jsonID(`cell`,ok);var sk=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&tk(t,n)?new ok(t,n):ap.near(n,1)}};function ck(e){if(!(e.selection instanceof ok))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(ay.node(n,n+e.nodeSize,{class:`selectedCell`}))}),cy.create(e.doc,t)}function lk({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function uk({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function dk(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof P&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=ok.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=ok.rowSelection(e,e)}else if(!n){let e=RO.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=ok.create(i,t+1,n)}}else r instanceof N&&lk(r)?a=N.create(i,r.from):r instanceof N&&uk(r)&&(a=N.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var fk=new Op(`fix-tables`);function pk(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?pk(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function mk(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=hk(e,t,r,n))};return t?t.doc!=e.doc&&pk(t.doc,e.doc,0,r):e.doc.descendants(r),n}function hk(e,t,n,r){let i=RO.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,rk(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=qO(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(fk,{fixTables:!0})}function gk(e){let t=RO.get(e),n=[],r=t.height,i=t.width;for(let a=0;a<r;a++){let r=[];for(let n=0;n<i;n++){let o=a*i+n,s=t.map[o];if(a>0){let e=o-i;if(s===t.map[e]){r.push(null);continue}}if(n>0){let e=o-1;if(s===t.map[e]){r.push(null);continue}}r.push(e.nodeAt(s))}n.push(r)}return n}function _k(e,t){let n=[],r=RO.get(e),i=r.height,a=r.width;for(let o=0;o<i;o++){let i=e.child(o),s=[];for(let n=0;n<a;n++){let i=t[o][n];if(!i)continue;let a=r.map[o*r.width+n],c=e.nodeAt(a);if(!c)continue;let l=c.type.createChecked(i.attrs,i.content,i.marks);s.push(l)}let c=i.type.createChecked(i.attrs,s,i.marks);n.push(c)}return e.type.createChecked(e.attrs,n,e.marks)}function vk(e,t,n,r){let i=t[0]>n[0]?-1:1,a=e.splice(t[0],t.length),o=+(a.length%2==0),s;return s=r===-1&&i===1?n[0]-1:r===1&&i===-1?n[n.length-1]-o+1:i===-1?n[0]:n[n.length-1]-o,e.splice(s,0,...a),e}function yk(e){return bk(e=>e.type.spec.tableRole===`table`,e)}function bk(e,t){for(let n=t.depth;n>=0;--n){let r=t.node(n);if(e(r))return{node:r,pos:n===0?0:t.before(n),start:t.start(n),depth:n}}return null}function xk(e,t){let n=yk(t.$from);if(!n)return;let r=RO.get(n.node);if(!(e<0||e>r.width-1))return r.cellsInRect({left:e,right:e+1,top:0,bottom:r.height}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function Sk(e,t){let n=yk(t.$from);if(!n)return;let r=RO.get(n.node);if(!(e<0||e>r.height-1))return r.cellsInRect({left:0,right:r.width,top:e,bottom:e+1}).map(e=>{let t=n.node.nodeAt(e),r=e+n.start;return{pos:r,start:r+1,node:t,depth:n.depth+2}})}function Ck(e,t,n=t){let r=t,i=n;for(let n=t;n>=0;n--){let t=xk(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;t>=r&&(r=n),t>i&&(i=t)})}for(let n=t;n<=i;n++){let t=xk(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.colspan+n-1;e.node.attrs.colspan>1&&t>i&&(i=t)})}let a=[];for(let t=r;t<=i;t++){let n=xk(t,e.selection);n&&n.length>0&&a.push(t)}r=a[0],i=a[a.length-1];let o=xk(r,e.selection),s=Sk(0,e.selection);if(!o||!s)return;let c=e.doc.resolve(o[o.length-1].pos),l;for(let t=i;t>=r;t--){let n=xk(t,e.selection);if(n&&n.length>0){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){l=n[0];break}if(l)break}}if(l)return{$anchor:c,$head:e.doc.resolve(l.pos),indexes:a}}function wk(e,t,n=t){let r=t,i=n;for(let n=t;n>=0;n--){let t=Sk(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;t>=r&&(r=n),t>i&&(i=t)})}for(let n=t;n<=i;n++){let t=Sk(n,e.selection);t&&t.forEach(e=>{let t=e.node.attrs.rowspan+n-1;e.node.attrs.rowspan>1&&t>i&&(i=t)})}let a=[];for(let t=r;t<=i;t++){let n=Sk(t,e.selection);n&&n.length>0&&a.push(t)}r=a[0],i=a[a.length-1];let o=Sk(r,e.selection),s=xk(0,e.selection);if(!o||!s)return;let c=e.doc.resolve(o[o.length-1].pos),l;for(let t=i;t>=r;t--){let n=Sk(t,e.selection);if(n&&n.length>0){for(let e=s.length-1;e>=0;e--)if(s[e].pos===n[0].pos){l=n[0];break}if(l)break}}if(l)return{$anchor:c,$head:e.doc.resolve(l.pos),indexes:a}}function Tk(e){return e[0].map((t,n)=>e.map(e=>e[n]))}function Ek(e){let{tr:t,originIndex:n,targetIndex:r,select:i,pos:a}=e,o=yk(t.doc.resolve(a));if(!o)return!1;let s=Ck(t,n)?.indexes,c=Ck(t,r)?.indexes;if(!s||!c||s.includes(r))return!1;let l=Dk(o.node,s,c,0);if(t.replaceWith(o.pos,o.pos+o.node.nodeSize,l),!i)return!0;let u=RO.get(l),d=o.start,f=r,p=u.positionAt(u.height-1,f,l),m=t.doc.resolve(d+p),h=u.positionAt(0,f,l),g=t.doc.resolve(d+h);return t.setSelection(ok.colSelection(m,g)),!0}function Dk(e,t,n,r){let i=Tk(gk(e));return i=vk(i,t,n,r),i=Tk(i),_k(e,i)}function Ok(e){let{tr:t,originIndex:n,targetIndex:r,select:i,pos:a}=e,o=yk(t.doc.resolve(a));if(!o)return!1;let s=wk(t,n)?.indexes,c=wk(t,r)?.indexes;if(!s||!c||s.includes(r))return!1;let l=kk(o.node,s,c,0);if(t.replaceWith(o.pos,o.pos+o.node.nodeSize,l),!i)return!0;let u=RO.get(l),d=o.start,f=r,p=u.positionAt(f,u.width-1,l),m=t.doc.resolve(d+p),h=u.positionAt(f,0,l),g=t.doc.resolve(d+h);return t.setSelection(ok.rowSelection(m,g)),!0}function kk(e,t,n,r){let i=gk(e);return i=vk(i,t,n,r),_k(e,i)}function Ak(e){let t=e.selection,n=ZO(e),r=n.node(-1),i=n.start(-1),a=RO.get(r);return{...t instanceof ok?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function jk(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;ak(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,ik(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?qO(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function Mk(e,t){if(!XO(e))return!1;if(t){let n=Ak(e);t(jk(e.tr,n,n.left))}return!0}function Nk(e,t){if(!XO(e))return!1;if(t){let n=Ak(e);t(jk(e.tr,n,n.right))}return!0}function Pk(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,rk(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function Fk(e,t){if(!XO(e))return!1;if(t){let n=Ak(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;Pk(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=RO.get(e)}t(r)}return!0}function Ik(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Lk(e,t){if(!XO(e))return!1;if(t){let n=Ak(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;Ik(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=RO.get(n.table)}t(r)}return!0}function Rk(e,t){return function(n,r){if(!XO(n))return!1;let i=ZO(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof ok?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function zk(e){return function(t,n){if(!XO(t))return!1;if(n){let r=qO(t.schema),i=Ak(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Bk(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Vk(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?zk(e):function(t,n){if(!XO(t))return!1;if(n){let r=qO(t.schema),i=Ak(t),a=t.tr,o=Bk(`row`,i,r),s=Bk(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Vk(`row`,{useDeprecatedLogic:!0}),Vk(`column`,{useDeprecatedLogic:!0}),Vk(`cell`,{useDeprecatedLogic:!0});function Hk(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function Uk(e){return function(t,n){if(!XO(t))return!1;let r=Hk(ZO(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(N.between(e,ek(e))).scrollIntoView())}return!0}}function Wk(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Gk(e,t){let n=e.selection;if(!(n instanceof ok))return!1;if(t){let r=e.tr,i=qO(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new M(i,0,0))}),r.docChanged&&t(r)}return!0}function Kk(e){return(t,n)=>{let{from:r,to:i,select:a=!0,pos:o=t.selection.from}=e,s=t.tr;return Ok({tr:s,originIndex:r,targetIndex:i,select:a,pos:o})?(n?.(s),!0):!1}}function qk(e){return(t,n)=>{let{from:r,to:i,select:a=!0,pos:o=t.selection.from}=e,s=t.tr;return Ek({tr:s,originIndex:r,targetIndex:i,select:a,pos:o})?(n?.(s),!0):!1}}function Jk(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Xk(qO(o).row,new M(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Xk(qO(o).row,new M(t,n,r)).content:t);else return null;return Yk(o,s)}function Yk(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(j.empty),n[i]<r){let a=qO(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(j.from(o))}return{height:t.length,width:r,rows:t}}function Xk(e,t){let n=e.createAndFill();return new rp(n).replace(0,n.content.size,t).doc}function Zk({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(rk(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(j.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(j.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Qk(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=qO(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,j.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function $k(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function eA(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,rk(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(rk(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function tA(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=RO.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=RO.get(a),f=d.mapping.maps.length}Qk(d,o,a,n,l,u,f)&&p(),$k(d,o,a,n,c,l,s,f)&&p(),$k(d,o,a,n,c,l,u,f)&&p(),eA(d,o,a,n,s,u,c,f)&&p(),eA(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new M(i.rows[e-s],0,0))}p(),d.setSelection(new ok(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var nA=_h({ArrowLeft:iA(`horiz`,-1),ArrowRight:iA(`horiz`,1),ArrowUp:iA(`vert`,-1),ArrowDown:iA(`vert`,1),"Shift-ArrowLeft":aA(`horiz`,-1),"Shift-ArrowRight":aA(`horiz`,1),"Shift-ArrowUp":aA(`vert`,-1),"Shift-ArrowDown":aA(`vert`,1),Backspace:Gk,"Mod-Backspace":Gk,Delete:Gk,"Mod-Delete":Gk});function rA(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function iA(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof ok)return rA(n,r,ap.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=lA(i,e,t);if(o==null)return!1;if(e==`horiz`)return rA(n,r,ap.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=nk(i,e,t),s;return s=a?ap.near(a,1):t<0?ap.near(n.doc.resolve(i.before(-1)),-1):ap.near(n.doc.resolve(i.after(-1)),1),rA(n,r,s)}}}function aA(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof ok)o=a;else{let r=lA(i,e,t);if(r==null)return!1;o=new ok(n.doc.resolve(r))}let s=nk(o.$headCell,e,t);return s?rA(n,r,new ok(o.$anchorCell,s)):!1}}function oA(e,t){let n=e.state.doc,r=YO(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new ok(r))),!0):!1}function sA(e,t,n){if(!XO(e.state))return!1;let r=Jk(n),i=e.state.selection;if(i instanceof ok){r||={width:1,height:1,rows:[j.from(Xk(qO(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=RO.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Zk(r,o.right-o.left,o.bottom-o.top),tA(e.state,e.dispatch,a,o,r),!0}if(r){let t=ZO(e.state),n=t.start(-1);return tA(e.state,e.dispatch,n,RO.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function cA(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=uA(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof ok)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=YO(e.state.selection.$anchor))!=null&&dA(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=dA(e,n),i=JO.getState(e.state)==null;if(!r||!tk(t,r)){if(i)r=t;else return}let a=new ok(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(JO,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),JO.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(JO,-1))}function o(r){let o=r,s=JO.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(uA(e,o.target)!=n&&(c=dA(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function lA(e,t,n){if(!(e.state.selection instanceof N))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function uA(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function dA(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&YO(e.state.doc.resolve(r))||YO(e.state.doc.resolve(i))}var fA=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),pA(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type&&(this.node=e,pA(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function pA(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var mA=new Op(`tableColumnResizing`);function hA({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=fA,lastColumnResizable:i=!0}={}){let a=new Tp({key:mA,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=qO(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new gA(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=mA.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{_A(t,n,e,i)},mouseleave:e=>{vA(e)},mousedown:(e,r)=>{yA(e,r,t,n)}},decorations:e=>{let t=mA.getState(e);if(t&&t.activeHandle>-1)return OA(e,t.activeHandle)},nodeViews:{}}});return a}var gA=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(mA);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return $O(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function _A(e,t,n,r){if(!e.editable)return;let i=mA.getState(e.state);if(i&&!i.dragging){let a=xA(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=SA(e,t,`left`,n):i-t.clientX<=n&&(o=SA(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=RO.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}wA(e,o)}}}function vA(e){if(!e.editable)return;let t=mA.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&wA(e,-1)}function yA(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=mA.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=bA(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(mA,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=mA.getState(e.state);r?.dragging&&(TA(e,r.activeHandle,CA(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(mA,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=mA.getState(e.state);if(i&&i.dragging){let a=CA(i.dragging,t,n);EA(e,i.activeHandle,a,r)}}return EA(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function bA(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function xA(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function SA(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=YO(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=RO.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function CA(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function wA(e,t){e.dispatch(e.state.tr.setMeta(mA,{setHandle:t}))}function TA(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=RO.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():DA(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function EA(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=RO.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&pA(a,c.firstChild,c,r,s,n)}function DA(e){return Array(e).fill(0)}function OA(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return cy.empty;let a=RO.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,mA.getState(e)?.dragging&&n.push(ay.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(ay.widget(s,c))}}return cy.create(e.doc,n)}function kA({allowTableNodeSelection:e=!1}={}){return new Tp({key:JO,state:{init(){return null},apply(e,t){let n=e.getMeta(JO);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:ck,handleDOMEvents:{mousedown:cA},createSelectionBetween(e){return JO.getState(e.state)==null?null:e.state.selection},handleTripleClick:oA,handleKeyDown:nA,handlePaste:sA},appendTransaction(t,n,r){return dk(r,mk(r,n),e)}})}var AA=typeof navigator<`u`?navigator:null,jA=AA&&AA.userAgent||``,MA=/Edge\/(\d+)/.exec(jA),NA=/MSIE \d/.exec(jA),PA=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(jA),FA=!(NA||PA||MA)&&!!AA&&/Apple Computer/.test(AA.vendor),IA=new Op(`safari-ime-span`),LA=!1,RA={key:IA,props:{decorations:zA,handleDOMEvents:{compositionstart:()=>{LA=!0},compositionend:()=>{LA=!1}}}};function zA(e){let{$from:t,$to:n,to:r}=e.selection;if(LA&&t.sameParent(n)){let t=ay.widget(r,BA,{ignoreSelection:!0,key:`safari-ime-span`});return cy.create(e.doc,[t])}}function BA(e){let t=e.dom.ownerDocument.createElement(`span`);return t.className=`ProseMirror-safari-ime-span`,t}var VA=new Tp(FA?RA:{key:IA});function HA(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function UA(e,t,n){let r=Ls((n||{}).ignore||[]),i=WA(t),a=-1;for(;++a<i.length;)hc(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1)r.lastIndex=n+1;else{if(s!==n&&f({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a))for(let e of a)f(e);else a&&f(a);s=n+d[0].length,l=!0}if(!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&f({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length;function f(e){let t=u[u.length-1];t&&t.type===`text`&&e.type===`text`?t.value+=e.value:u.push(e)}}}function WA(e){if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let t=[],n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([GA(e[0]),KA(e[1])])}return t}function GA(e){return typeof e==`string`?new RegExp(HA(e),`g`):e}function KA(e){return typeof e==`function`?e:function(){return e}}var qA=`phrasing`,JA=[`autolink`,`link`,`image`,`label`];function YA(){return{transforms:[rj],enter:{literalAutolink:ZA,literalAutolinkEmail:QA,literalAutolinkHttp:QA,literalAutolinkWww:QA},exit:{literalAutolink:nj,literalAutolinkEmail:tj,literalAutolinkHttp:$A,literalAutolinkWww:ej}}}function XA(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:qA,notInConstruct:JA},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:qA,notInConstruct:JA},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:qA,notInConstruct:JA}]}}function ZA(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function QA(e){this.config.enter.autolinkProtocol.call(this,e)}function $A(e){this.config.exit.autolinkProtocol.call(this,e)}function ej(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function tj(e){this.config.exit.autolinkEmail.call(this,e)}function nj(e){this.exit(e)}function rj(e){UA(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ij],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,aj]],{ignore:[`link`,`linkReference`]})}function ij(e,t,n,r,i){let a=``;if(!cj(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!oj(n)))return!1;let o=sj(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function aj(e,t,n,r){return!cj(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function oj(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function sj(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Tt(e,`(`),a=Tt(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function cj(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||ta(n)||ea(n))&&(!t||n!==47)}vj.peek=_j;function lj(){this.buffer()}function uj(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function dj(){this.buffer()}function fj(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function pj(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Wi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function mj(e){this.exit(e)}function hj(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Wi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function gj(e){this.exit(e)}function _j(){return`[`}function vj(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function yj(){return{enter:{gfmFootnoteCallString:lj,gfmFootnoteCall:uj,gfmFootnoteDefinitionLabelString:dj,gfmFootnoteDefinition:fj},exit:{gfmFootnoteCallString:pj,gfmFootnoteCall:mj,gfmFootnoteDefinitionLabelString:hj,gfmFootnoteDefinition:gj}}}function bj(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:vj},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
55
- `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Sj:xj))),s(),o}}function xj(e,t,n){return t===0?e:Sj(e,t,n)}function Sj(e,t,n){return(n?``:` `)+e}var Cj=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Oj.attention=kj,Oj.peek=Aj;function wj(){return{canContainEols:[`delete`],enter:{strikethrough:Ej},exit:{strikethrough:Dj}}}function Tj(){return{handlers:{delete:Oj},unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Cj}]}}function Ej(e){this.enter({type:`delete`,children:[],position:void 0},e)}function Dj(e){this.exit(e)}function Oj(e,t,n,r){let i=n.createTracker(r),a=n.stack.includes(`strikethrough`)?`~`:`~~`,o=n.enter(`strikethrough`),s=i.move(a);return s+=n.containerPhrasing(e,{...i.current(),before:s,after:`~`}),s+=i.move(a),o(),s}function kj(){return{construct:`strikethrough`,markers:[`~`],sizes:[2,1]}}function Aj(){return`~`}function jj(e){return e.length}function Mj(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||jj,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=Nj(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=Pj(r[d]);else{let e=Pj(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
56
- `)}function Nj(e){return e==null?``:String(e)}function Pj(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Fj(){return{enter:{table:Ij,tableData:Bj,tableHeader:Bj,tableRow:Rj},exit:{codeText:Vj,table:Lj,tableData:zj,tableHeader:zj,tableRow:zj}}}function Ij(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Lj(e){this.exit(e),this.data.inTable=void 0}function Rj(e){this.enter({type:`tableRow`,children:[]},e)}function zj(e){this.exit(e)}function Bj(e){this.enter({type:`tableCell`,children:[]},e)}function Vj(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Hj));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Hj(e,t){return t===`|`?t:e}function Uj(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
57
- `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
58
- `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Mj(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=Yc.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Wj(){return{exit:{taskListCheckValueChecked:Kj,taskListCheckValueUnchecked:Kj,paragraph:qj}}}function Gj(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Jj}}}function Kj(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function qj(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Jj(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=Yc.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Yj(){return[YA(),yj(),wj(),Fj(),Wj()]}function Xj(e){return{extensions:[XA(),bj(e),Tj(),Uj(e),Gj()]}}var Zj={tokenize:dM,partial:!0},Qj={tokenize:fM,partial:!0},$j={tokenize:pM,partial:!0},eM={tokenize:mM,partial:!0},tM={tokenize:hM,partial:!0},nM={name:`wwwAutolink`,tokenize:lM,previous:gM},rM={name:`protocolAutolink`,tokenize:uM,previous:_M},iM={name:`emailAutolink`,tokenize:cM,previous:vM},aM={};function oM(){return{text:aM}}for(var sM=48;sM<123;)aM[sM]=iM,sM++,sM===58?sM=65:sM===91&&(sM=97);aM[43]=iM,aM[45]=iM,aM[46]=iM,aM[95]=iM,aM[72]=[iM,rM],aM[104]=[iM,rM],aM[87]=[iM,nM],aM[119]=[iM,nM];function cM(e,t,n){let r=this,i,a;return o;function o(t){return!yM(t)||!vM.call(r,r.previous)||bM(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return yM(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(tM,u,l)(t):t===45||t===95||Ki(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&Gi(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function lM(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!gM.call(r,r.previous)||bM(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Zj,e.attempt(Qj,e.attempt($j,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function uM(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&_M.call(r,r.previous)&&!bM(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Gi(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||Ji(t)||Qi(t)||ta(t)||ea(t)?n(t):e.attempt(Qj,e.attempt($j,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function dM(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function fM(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(eM,c,s)(t):t===null||Qi(t)||ta(t)||t!==45&&ea(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function pM(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(eM,t,a)(o):o===null||Qi(o)||ta(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function mM(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Qi(o)||ta(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Qi(e)||ta(e)?t(e):r(e)}function a(e){return Gi(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Gi(t)?(e.consume(t),o):n(t)}}function hM(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Ki(e)?n(e):t(e)}}function gM(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Qi(e)}function _M(e){return!Gi(e)}function vM(e){return!(e===47||yM(e))}function yM(e){return e===43||e===45||e===46||e===95||Ki(e)}function bM(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var xM={tokenize:kM,partial:!0};function SM(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:EM,continuation:{tokenize:DM},exit:OM}},text:{91:{name:`gfmFootnoteCall`,tokenize:TM},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:CM,resolveTo:wM}}}}function CM(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Wi(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function wM(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function TM(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Qi(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Wi(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Qi(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function EM(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Qi(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Wi(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Qi(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),ra(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function DM(e,t,n){return e.check(xa,t,e.attempt(xM,t,n))}function OM(e){e.exit(`gfmFootnoteDefinition`)}function kM(e,t,n){let r=this;return ra(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function AM(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Li(o,o.length,0,ma(s,e.slice(r+1,n),t)),Li(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Li(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=pa(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=pa(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var jM=class{constructor(){this.map=[],this.index=new Map}add(e,t,n){MM(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function MM(e,t,n,r){if(n===0&&r.length===0)return;let i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}let a=[t,n,r];e.map.push(a),e.index.set(t,a)}function NM(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function PM(){return{flow:{null:{name:`table`,tokenize:FM,resolveAll:IM}}}}function FM(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let{type:e}=r.events[t][1];if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):A(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):$i(t)?ra(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Qi(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,$i(t)?ra(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return $i(t)?ra(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||A(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return $i(t)?ra(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||A(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),ee(t)}function ee(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),ee):n===null||A(n)?(e.exit(`tableRow`),t(n)):$i(n)?ra(e,ee,`whitespace`)(n):(e.enter(`data`),te(n))}function te(t){return t===null||t===124||Qi(t)?(e.exit(`data`),ee(t)):(e.consume(t),t===92?C:te)}function C(t){return t===92||t===124?(e.consume(t),te):te(t)}}function IM(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new jM;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(RM(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=LM(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=LM(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=LM(f,t,o,i,n,d)):(o[0]=o[1],d=LM(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&RM(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=NM(t.events,n))}return e}function LM(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},zM(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=zM(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=zM(t.events,n[2]),a=zM(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},zM(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function RM(e,t,n,r,i){let a=[],o=zM(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function zM(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var BM={name:`tasklistCheck`,tokenize:HM};function VM(){return{text:{91:BM}}}function HM(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Qi(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return A(r)?t(r):$i(r)?e.check({tokenize:UM},t,n)(r):n(r)}}function UM(e,t,n){return ra(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function WM(e){return Bi([oM(),SM(),AM(e),PM(),VM()])}var GM={};function KM(e){let t=this,n=e||GM,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(WM(n)),a.push(Yj()),o.push(Xj(n))}function qM(e,t){return Object.assign(e,{meta:{package:`@milkdown/preset-gfm`,...t}}),e}var JM=Ex(`strike_through`);qM(JM,{displayName:`Attr<strikethrough>`,group:`Strikethrough`});var YM=Cx(`strike_through`,e=>({parseDOM:[{tag:`del`},{style:`text-decoration`,getAttrs:e=>e===`line-through`}],toDOM:t=>[`del`,e.get(JM.key)(t)],parseMarkdown:{match:e=>e.type===`delete`,runner:(e,t,n)=>{e.openMark(n),e.next(t.children),e.closeMark(n)}},toMarkdown:{match:e=>e.type.name===`strike_through`,runner:(e,t)=>{e.withMark(t,`delete`)}}}));qM(YM.mark,{displayName:`MarkSchema<strikethrough>`,group:`Strikethrough`}),qM(YM.ctx,{displayName:`MarkSchemaCtx<strikethrough>`,group:`Strikethrough`});var XM=L(`ToggleStrikeThrough`,e=>()=>im(YM.type(e)));qM(XM,{displayName:`Command<ToggleStrikethrough>`,group:`Strikethrough`});var ZM=mx(e=>Hm(/(?<![\w:/])(~{1,2})(.+?)\1(?!\w|\/)$/,YM.type(e)));qM(ZM,{displayName:`InputRule<strikethrough>`,group:`Strikethrough`});var QM=wx(`strikeThroughKeymap`,{ToggleStrikethrough:{shortcuts:`Mod-Alt-x`,command:e=>{let t=e.get(I);return()=>t.call(XM.key)}}});qM(QM.ctx,{displayName:`KeymapCtx<strikethrough>`,group:`Strikethrough`}),qM(QM.shortcuts,{displayName:`Keymap<strikethrough>`,group:`Strikethrough`});function $M(e,t){let n=t.content.firstChild;if(t.childCount!==1||n?.type.name!==`paragraph`){e.next(t.content);return}let r=n.lastChild,i=r?.type.name===`hardbreak`?n.content.cut(0,n.content.size-r.nodeSize):n.content;e.next(i)}var eN=KO({tableGroup:`block`,cellContent:`paragraph`,cellAttributes:{alignment:{default:`left`,getFromDOM:e=>e.style.textAlign||`left`,setDOMAttr:(e,t)=>{t.style=`text-align: ${e||`left`}`}}}}),tN=Sx(`table`,()=>({...eN.table,content:`table_header_row table_row+`,disableDropCursor:!0,parseMarkdown:{match:e=>e.type===`table`,runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,t)=>({...e,align:r,isHeader:t===0}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`table`,runner:(e,t)=>{let n=t.content.firstChild?.content;if(!n)return;let r=[];n.forEach(e=>{r.push(e.attrs.alignment)}),e.openNode(`table`,void 0,{align:r}),e.next(t.content),e.closeNode()}}}));qM(tN.node,{displayName:`NodeSchema<table>`,group:`Table`}),qM(tN.ctx,{displayName:`NodeSchemaCtx<table>`,group:`Table`});var nN=Sx(`table_header_row`,()=>({...eN.table_row,disableDropCursor:!0,content:`(table_header)*`,parseDOM:[{tag:`tr[data-is-header]`},{tag:`tr`,getAttrs:e=>e instanceof HTMLElement&&e.querySelector(`th`)?{}:!1}],toDOM(){return[`tr`,{"data-is-header":!0},0]},parseMarkdown:{match:e=>!!(e.type===`tableRow`&&e.isHeader),runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,n)=>({...e,align:r[n],isHeader:t.isHeader}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`table_header_row`,runner:(e,t)=>{t.content.size!==0&&(e.openNode(`tableRow`,void 0,{isHeader:!0}),e.next(t.content),e.closeNode())}}}));qM(nN.node,{displayName:`NodeSchema<tableHeaderRow>`,group:`Table`}),qM(nN.ctx,{displayName:`NodeSchemaCtx<tableHeaderRow>`,group:`Table`});var rN=Sx(`table_row`,()=>({...eN.table_row,disableDropCursor:!0,content:`(table_cell)*`,parseMarkdown:{match:e=>e.type===`tableRow`,runner:(e,t,n)=>{let r=t.align,i=t.children.map((e,t)=>({...e,align:r[t]}));e.openNode(n),e.next(i),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`table_row`,runner:(e,t)=>{t.content.size!==0&&(e.openNode(`tableRow`),e.next(t.content),e.closeNode())}}}));qM(rN.node,{displayName:`NodeSchema<tableRow>`,group:`Table`}),qM(rN.ctx,{displayName:`NodeSchemaCtx<tableRow>`,group:`Table`});var iN=Sx(`table_cell`,()=>({...eN.table_cell,disableDropCursor:!0,parseMarkdown:{match:e=>e.type===`tableCell`&&!e.isHeader,runner:(e,t,n)=>{let r=t.align;e.openNode(n,{alignment:r}).openNode(e.schema.nodes.paragraph).next(t.children).closeNode().closeNode()}},toMarkdown:{match:e=>e.type.name===`table_cell`,runner:(e,t)=>{e.openNode(`tableCell`),$M(e,t),e.closeNode()}}}));qM(iN.node,{displayName:`NodeSchema<tableCell>`,group:`Table`}),qM(iN.ctx,{displayName:`NodeSchemaCtx<tableCell>`,group:`Table`});var aN=Sx(`table_header`,()=>({...eN.table_header,disableDropCursor:!0,parseMarkdown:{match:e=>e.type===`tableCell`&&!!e.isHeader,runner:(e,t,n)=>{let r=t.align;e.openNode(n,{alignment:r}),e.openNode(e.schema.nodes.paragraph),e.next(t.children),e.closeNode(),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`table_header`,runner:(e,t)=>{e.openNode(`tableCell`),$M(e,t),e.closeNode()}}}));qM(aN.node,{displayName:`NodeSchema<tableHeader>`,group:`Table`}),qM(aN.ctx,{displayName:`NodeSchemaCtx<tableHeader>`,group:`Table`});function oN(e,t=3,n=3){let r=Array(n).fill(0).map(()=>iN.type(e).createAndFill()),i=Array(n).fill(0).map(()=>aN.type(e).createAndFill()),a=Array(t).fill(0).map((t,n)=>n===0?nN.type(e).create(null,i):rN.type(e).create(null,r));return tN.type(e).create(null,a)}function sN(e){return(t,n)=>r=>{n??=r.selection.from;let i=r.doc.resolve(n),a=sh(e=>e.type.name===`table`)(i),o=a?{node:a.node,from:a.start}:void 0,s=e===`row`;if(o){let e=RO.get(o.node);if(t>=0&&t<(s?e.height:e.width)){let n=e.positionAt(s?t:e.height-1,s?e.width-1:t,o.node),i=r.doc.resolve(o.from+n),a=s?ok.rowSelection:ok.colSelection,c=e.positionAt(s?t:0,s?0:t,o.node),l=r.doc.resolve(o.from+c);return th(r.setSelection(a(i,l)))}}return r}}var cN=sN(`row`),lN=sN(`col`);function uN(e,t,{map:n,tableStart:r,table:i},a){let o=Array(a).fill(0).reduce((e,t,n)=>e+i.child(n).nodeSize,r),s=Array(n.width).fill(0).map((t,r)=>{let a=i.nodeAt(n.map[r]);return iN.type(e).createAndFill({alignment:a?.attrs.alignment})});return t.insert(o,rN.type(e).create(null,s)),t}function dN(e){let t=yk(e.$from);if(!t)return;let n=RO.get(t.node);return n.cellsInRect({left:0,right:n.width,top:0,bottom:n.height}).map(e=>{let n=t.node.nodeAt(e),r=e+t.start;return{pos:r,start:r+1,node:n}})}function fN(e){let t=dN(e.selection);if(t&&t[0]){let n=e.doc.resolve(t[0].pos),r=t[t.length-1];if(r){let t=e.doc.resolve(r.pos);return th(e.setSelection(new ok(t,n)))}}return e}var pN=L(`GoToPrevTableCell`,()=>()=>Uk(-1));qM(pN,{displayName:`Command<goToPrevTableCellCommand>`,group:`Table`});var mN=L(`GoToNextTableCell`,()=>()=>Uk(1));qM(mN,{displayName:`Command<goToNextTableCellCommand>`,group:`Table`});var hN=L(`ExitTable`,e=>()=>(t,n)=>{if(!XO(t))return!1;let{$head:r}=t.selection,i=ah(r,tN.type(e));if(!i)return!1;let{to:a}=i,o=t.tr.replaceWith(a,a,DE.type(e).createAndFill());return o.setSelection(ap.near(o.doc.resolve(a),1)).scrollIntoView(),n?.(o),!0});qM(hN,{displayName:`Command<breakTableCommand>`,group:`Table`});var gN=L(`InsertTable`,e=>({row:t,col:n}={})=>(r,i)=>{let{selection:a,tr:o}=r,{from:s}=a,c=oN(e,t,n),l=o.replaceSelectionWith(c),u=ap.findFrom(l.doc.resolve(s),1,!0);return u&&l.setSelection(u),i?.(l),!0});qM(gN,{displayName:`Command<insertTableCommand>`,group:`Table`});var _N=L(`MoveRow`,()=>({from:e,to:t,pos:n}={})=>Kk({from:e??0,to:t??0,pos:n}));qM(_N,{displayName:`Command<moveRowCommand>`,group:`Table`});var vN=L(`MoveCol`,()=>({from:e,to:t,pos:n}={})=>qk({from:e??0,to:t??0,pos:n}));qM(vN,{displayName:`Command<moveColCommand>`,group:`Table`});var yN=L(`SelectRow`,()=>(e={index:0})=>(t,n)=>{let{tr:r}=t;return!!n?.(cN(e.index,e.pos)(r))});qM(yN,{displayName:`Command<selectRowCommand>`,group:`Table`});var bN=L(`SelectCol`,()=>(e={index:0})=>(t,n)=>{let{tr:r}=t;return!!n?.(lN(e.index,e.pos)(r))});qM(bN,{displayName:`Command<selectColCommand>`,group:`Table`});var xN=L(`SelectTable`,()=>()=>(e,t)=>{let{tr:n}=e;return!!t?.(fN(n))});qM(xN,{displayName:`Command<selectTableCommand>`,group:`Table`});var SN=L(`DeleteSelectedCells`,()=>()=>(e,t)=>{let{selection:n}=e;if(!(n instanceof ok))return!1;let r=n.isRowSelection(),i=n.isColSelection();return r&&i?Wk(e,t):i?Fk(e,t):Lk(e,t)});qM(SN,{displayName:`Command<deleteSelectedCellsCommand>`,group:`Table`});var CN=L(`AddColBefore`,()=>()=>Mk);qM(CN,{displayName:`Command<addColBeforeCommand>`,group:`Table`});var wN=L(`AddColAfter`,()=>()=>Nk);qM(wN,{displayName:`Command<addColAfterCommand>`,group:`Table`});var TN=L(`AddRowBefore`,e=>()=>(t,n)=>{if(!XO(t))return!1;if(n){let r=Ak(t);n(uN(e,t.tr,r,r.top))}return!0});qM(TN,{displayName:`Command<addRowBeforeCommand>`,group:`Table`});var EN=L(`AddRowAfter`,e=>()=>(t,n)=>{if(!XO(t))return!1;if(n){let r=Ak(t);n(uN(e,t.tr,r,r.bottom))}return!0});qM(EN,{displayName:`Command<addRowAfterCommand>`,group:`Table`});var DN=L(`SetAlign`,()=>(e=`left`)=>Rk(`alignment`,e));qM(DN,{displayName:`Command<setAlignCommand>`,group:`Table`});var ON=mx(e=>new dm(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(t,n,r,i)=>{let a=t.doc.resolve(r);if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),tN.type(e)))return null;let o=oN(e,Math.max(Number(n.groups?.row??0),2),Number(n.groups?.col)),s=t.tr.replaceRangeWith(r,i,o);return s.setSelection(N.create(s.doc,r+3)).scrollIntoView()}));qM(ON,{displayName:`InputRule<insertTableInputRule>`,group:`Table`});var kN=hx(e=>({run:(t,n,r)=>{if(r)return t;function i(t){let n=t.childCount,r=t.lastChild?.childCount??0;if(n===0||r===0)return DE.type(e).create();let i=t.firstChild;if(!(r>0&&i&&i.childCount===0))return t;if(n>=3){let r=t.child(1),a=[];for(let t=0;t<r.childCount;t++){let n=r.child(t);a.push(aN.type(e).create(n.attrs,n.content,n.marks))}let o=i.type.create(i.attrs,a),s=[];for(let e=2;e<n;e++)s.push(t.child(e));return t.type.create(t.attrs,[o,...s])}let a=Array(r).fill(0).map(()=>aN.type(e).createAndFill()),o=new M(j.from(a),0,0),s=i.replace(0,0,o);return t.replace(0,i.nodeSize,new M(j.from(s),0,0))}function a(t){let n=rN.type(e),r=[],a=[],o=!1;function s(){if(a.length===0)return;let t=nN.type(e).createAndFill(),n=tN.type(e).create(null,[t,...a]);r.push(i(n)),a=[]}return t.forEach(e=>{e.type===n?(o=!0,a.push(e)):(s(),r.push(e))}),s(),o?j.from(r):t}function o(t){let n=a(t),r=n!==t,s=[];return n.forEach(t=>{if(t.type===tN.type(e)){let e=i(t);e!==t&&(r=!0),s.push(e)}else if(t.childCount>0){let e=o(t.content);e===t.content?s.push(t):(r=!0,s.push(t.copy(e)))}else s.push(t)}),r?j.from(s):t}function s(t){let n=[],r=[];t.forEach(e=>r.push(e));for(let t=0;t<r.length;t++){let i=r[t],a=r[t+1];i.type===DE.type(e)&&i.content.size===0&&a&&a.type===tN.type(e)||n.push(i)}return n.length<r.length?j.from(n):t}let c=o(t.content);return c=s(c),new M(j.from(c),t.openStart,t.openEnd)}}));qM(kN,{displayName:`PasteRule<table>`,group:`Table`});var AN=wx(`tableKeymap`,{NextCell:{priority:100,shortcuts:[`Mod-]`,`Tab`],command:e=>{let t=e.get(I);return()=>t.call(mN.key)}},PrevCell:{shortcuts:[`Mod-[`,`Shift-Tab`],command:e=>{let t=e.get(I);return()=>t.call(pN.key)}},ExitTable:{shortcuts:[`Mod-Enter`,`Enter`],command:e=>{let t=e.get(I);return()=>t.call(hN.key)}}});qM(AN.ctx,{displayName:`KeymapCtx<table>`,group:`Table`}),qM(AN.shortcuts,{displayName:`Keymap<table>`,group:`Table`});var jN=`footnote_definition`,MN=`footnoteDefinition`,NN=Sx(`footnote_definition`,()=>({group:`block`,content:`block+`,defining:!0,attrs:{label:{default:``,validate:`string`}},parseDOM:[{tag:`dl[data-type="${jN}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{label:e.dataset.label}},contentElement:`dd`}],toDOM:e=>{let t=e.attrs.label;return[`dl`,{"data-label":t,"data-type":jN},[`dt`,t],[`dd`,0]]},parseMarkdown:{match:({type:e})=>e===MN,runner:(e,t,n)=>{e.openNode(n,{label:t.label}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name===jN,runner:(e,t)=>{e.openNode(MN,void 0,{label:t.attrs.label,identifier:t.attrs.label}).next(t.content).closeNode()}}}));qM(NN.ctx,{displayName:`NodeSchemaCtx<footnodeDef>`,group:`footnote`}),qM(NN.node,{displayName:`NodeSchema<footnodeDef>`,group:`footnote`});var PN=`footnote_reference`,FN=Sx(`footnote_reference`,()=>({group:`inline`,inline:!0,atom:!0,attrs:{label:{default:``,validate:`string`}},parseDOM:[{tag:`sup[data-type="${PN}"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{label:e.dataset.label}}}],toDOM:e=>{let t=e.attrs.label;return[`sup`,{"data-label":t,"data-type":PN},t]},parseMarkdown:{match:({type:e})=>e===`footnoteReference`,runner:(e,t,n)=>{e.addNode(n,{label:t.label})}},toMarkdown:{match:e=>e.type.name===PN,runner:(e,t)=>{e.addNode(`footnoteReference`,void 0,void 0,{label:t.attrs.label,identifier:t.attrs.label})}}}));qM(FN.ctx,{displayName:`NodeSchemaCtx<footnodeRef>`,group:`footnote`}),qM(FN.node,{displayName:`NodeSchema<footnodeRef>`,group:`footnote`});var IN=yD.extendSchema(e=>t=>{let n=e(t);return{...n,attrs:{...n.attrs,checked:{default:null,validate:`boolean|null`}},parseDOM:[{tag:`li[data-item-type="task"]`,getAttrs:e=>{if(!(e instanceof HTMLElement))throw pi(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread===`true`,checked:e.dataset.checked?e.dataset.checked===`true`:null}}},...n?.parseDOM||[]],toDOM:e=>n.toDOM&&e.attrs.checked==null?n.toDOM(e):[`li`,{"data-item-type":`task`,"data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread,"data-checked":e.attrs.checked},0],parseMarkdown:{match:({type:e})=>e===`listItem`,runner:(e,t,r)=>{if(t.checked==null){n.parseMarkdown.runner(e,t,r);return}let i=t.label==null?`•`:`${t.label}.`,a=t.checked==null?null:!!t.checked,o=t.label==null?`bullet`:`ordered`,s=t.spread??!0;e.openNode(r,{label:i,listType:o,spread:s,checked:a}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name===`list_item`,runner:(e,t)=>{if(t.attrs.checked==null){n.toMarkdown.runner(e,t);return}let r=t.attrs.label,i=t.attrs.listType,a=t.attrs.spread,o=t.attrs.checked;e.openNode(`listItem`,void 0,{label:r,listType:i,spread:a,checked:o}),e.next(t.content),e.closeNode()}}}});qM(IN.node,{displayName:`NodeSchema<taskListItem>`,group:`ListItem`}),qM(IN.ctx,{displayName:`NodeSchemaCtx<taskListItem>`,group:`ListItem`});var LN=mx(()=>new dm(/^\[(?<checked>\s|x)\]\s$/,(e,t,n,r)=>{let i=e.doc.resolve(n),a=0,o=i.node(a);for(;o&&o.type.name!==`list_item`;)a--,o=i.node(a);if(!o||o.attrs.checked!=null)return null;let s=t.groups?.checked===`x`,c=i.before(a),l=e.tr;return l.deleteRange(n,r).setNodeMarkup(c,void 0,{...o.attrs,checked:s}),l}));qM(LN,{displayName:`InputRule<wrapInTaskListInputRule>`,group:`ListItem`});var RN=[QM,AN].flat(),zN=[ON,LN],BN=[ZM],VN=[kN],HN=vx(()=>VA);qM(HN,{displayName:`Prose<autoInsertSpanPlugin>`,group:`Prose`}),qM(vx(()=>hA({})),{displayName:`Prose<columnResizingPlugin>`,group:`Prose`});var UN=vx(()=>kA({allowTableNodeSelection:!0}));qM(UN,{displayName:`Prose<tableEditingPlugin>`,group:`Prose`});var WN=Dx(`remarkGFM`,()=>KM);qM(WN.plugin,{displayName:`Remark<remarkGFMPlugin>`,group:`Remark`}),qM(WN.options,{displayName:`RemarkConfig<remarkGFMPlugin>`,group:`Remark`});var GN=new Op(`MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN`);function KN(e,t){let n=0;return t.forEach((t,r,i)=>{t===e&&(n=i)}),n}function qN(e,t){let n=e.content.findDiffStart(t.content);if(n==null)return null;let r=e.content.findDiffEnd(t.content);return r?{from:n,to:Math.max(r.b,n)}:null}var JN=vx(()=>new Tp({key:GN,appendTransaction:(e,t,n)=>{if(t.doc===n.doc)return;let r=qN(t.doc,n.doc);if(!r)return;let i,a=(e,t)=>{if(e.type.name!==`table_cell`)return;let r=n.doc.resolve(t),a=r.node(r.depth),o=r.node(r.depth-1).firstChild;if(!o)return;let s=KN(e,a),c=o.maybeChild(s);if(!c)return;let l=c.attrs.alignment;l!==e.attrs.alignment&&(i||=n.tr,i.setNodeMarkup(t,void 0,{...e.attrs,alignment:l}))};return n.doc.nodesBetween(r.from,r.to,(e,t)=>e.type.name!==`table`||(n.doc.nodesBetween(t,t+e.nodeSize,a),!1)),i}}));qM(JN,{displayName:`Prose<keepTableAlignPlugin>`,group:`Prose`});var YN=[JN,HN,WN,UN].flat(),XN=[[IN,tN,nN,rN,aN,iN,NN,FN,JM,YM].flat(),zN,VN,BN,RN,[mN,pN,hN,gN,_N,vN,yN,bN,xN,SN,TN,EN,CN,wN,DN,XM],YN].flat(),ZN=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=nP(e.state,n.from);return r.line?$N(e):r.block?tP(e):!1};function QN(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var $N=QN(sP,0),eP=QN(oP,0),tP=QN((e,t)=>oP(e,t,aP(t)),0);function nP(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var rP=50;function iP(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-rP,r),o=e.sliceDoc(i,i+rP),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+rP),d=e.sliceDoc(i-rP,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function aP(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function oP(e,t,n=t.selection.ranges){let r=n.map(e=>nP(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>iP(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function sP(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=nP(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var cP=Re.define(),lP=Re.define(),uP=Ge.define(),dP=Ge.define({combine(e){return le(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),fP=Te.define({create(){return jP.empty},update(e,t){let n=t.state.facet(dP),r=t.annotation(cP);if(r){let i=yP.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?bP(o,o.length,n.minDepth,i):EP(o,t.startState.selection),new jP(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(lP);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(dt.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=yP.fromTransaction(t),o=t.annotation(dt.time),s=t.annotation(dt.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new jP(e.done.map(yP.fromJSON),e.undone.map(yP.fromJSON))}});function pP(e={}){return[fP,dP.of(e),ve.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?hP:e.inputType==`historyRedo`?gP:null;return n?(e.preventDefault(),n(t)):!1}})]}function mP(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(fP,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var hP=mP(0,!1),gP=mP(1,!1),_P=mP(0,!0),vP=mP(1,!0),yP=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&st.fromJSON(t.changes),[],t.mapped&&Xe.fromJSON(t.mapped),t.startSelection&&O.fromJSON(t.startSelection),t.selectionsAfter.map(O.fromJSON))}static fromTransaction(t,n){let r=wP;for(let e of t.startState.facet(uP)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,wP)}static selection(t){return new e(void 0,wP,void 0,void 0,t)}};function bP(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function xP(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function SP(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function CP(e,t){return e.length?t.length?e.concat(t):e:t}var wP=[],TP=200;function EP(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-TP));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),bP(e,e.length-1,1e9,n.setSelAfter(r)))}return[yP.selection([t])]}function DP(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function OP(e,t){if(!e.length)return e;let n=e.length,r=wP;for(;n;){let i=kP(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[yP.selection(r)]:wP}function kP(e,t,n){let r=CP(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):wP,n);if(!e.changes)return yP.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new yP(i,pt.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var AP=/^(input\.type|delete)($|\.)/,jP=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||AP.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,xP(s.changes,t.changes))||r==`input.type.compose`)?bP(o,o.length-1,i.minDepth,new yP(t.changes.compose(s.changes),CP(pt.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,wP)):bP(o,o.length,i.minDepth,t),new e(o,wP,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:wP;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&SP(a[a.length-1],t)?this:new e(EP(this.done,t),this.undone,n,r)}addMapping(t){return new e(OP(this.done,t),OP(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:cP.of({side:e,rest:DP(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?wP:r.slice(0,r.length-1);return i.mapped&&(n=OP(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:cP.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};jP.empty=new jP(wP,wP);var MP=[{key:`Mod-z`,run:hP,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:gP,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:gP,preventDefault:!0},{key:`Mod-u`,run:_P,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:vP,preventDefault:!0}];function NP(e,t){return O.create(e.ranges.map(t),e.mainIndex)}function PP(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function FP({state:e,dispatch:t},n){let r=NP(e.selection,n);return!r.eq(e.selection,!0)&&(t(PP(e,r)),!0)}function IP(e,t){return O.cursor(t?e.to:e.from)}function LP(e,t){return FP(e,n=>n.empty?e.moveByChar(n,t):IP(n,t))}function RP(e){return e.textDirectionAt(e.state.selection.main.head)==he.LTR}var zP=e=>LP(e,!RP(e)),BP=e=>LP(e,RP(e));function VP(e,t){return FP(e,n=>n.empty?e.moveByGroup(n,t):IP(n,t))}var HP=e=>VP(e,!RP(e)),UP=e=>VP(e,RP(e));typeof Intl<`u`&&Intl.Segmenter;function WP(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function GP(e,t,n){let r=qe(e).resolveInner(t.head),i=n?ye.closedBy:ye.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;WP(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?be(e,r.from,1):be(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,O.cursor(s,n?-1:1)}var KP=e=>FP(e,t=>GP(e.state,t,!RP(e))),qP=e=>FP(e,t=>GP(e.state,t,RP(e)));function JP(e,t){return FP(e,n=>{if(!n.empty)return IP(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var YP=e=>JP(e,!1),XP=e=>JP(e,!0);function ZP(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(ve.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function QP(e,t){let n=ZP(e),{state:r}=e,i=NP(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):IP(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=ve.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(PP(r,i),{effects:a}),!0}var $P=e=>QP(e,!1),eF=e=>QP(e,!0);function tF(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=O.cursor(r.from+n))}return i}var nF=e=>FP(e,t=>tF(e,t,!0)),rF=e=>FP(e,t=>tF(e,t,!1)),iF=e=>FP(e,t=>tF(e,t,!RP(e))),aF=e=>FP(e,t=>tF(e,t,RP(e))),oF=e=>FP(e,t=>e.moveToLineBoundary(t,!1,!1)),sF=e=>FP(e,t=>e.moveToLineBoundary(t,!0,!1));function cF(e,t,n){let r=!1,i=NP(e.selection,t=>{let i=be(e,t.head,-1)||be(e,t.head,1)||t.head>0&&be(e,t.head-1,1)||t.head<e.doc.length&&be(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?O.range(t.anchor,a):O.cursor(a)});return r?(t(PP(e,i)),!0):!1}var lF=({state:e,dispatch:t})=>cF(e,t,!1);function uF(e,t,n){let r=NP(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=O.range(e.head,e.anchor));let r=n(e);return O.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(PP(e.state,r)),!0)}function dF(e,t){return uF(e,t,n=>e.moveByChar(n,t))}var fF=e=>dF(e,!RP(e)),pF=e=>dF(e,RP(e));function mF(e,t){return uF(e,t,n=>e.moveByGroup(n,t))}var hF=e=>mF(e,!RP(e)),gF=e=>mF(e,RP(e)),_F=e=>{let t=!RP(e);return uF(e,t,n=>GP(e.state,n,t))},vF=e=>{let t=RP(e);return uF(e,t,n=>GP(e.state,n,t))};function yF(e,t){return uF(e,t,n=>e.moveVertically(n,t))}var bF=e=>yF(e,!1),xF=e=>yF(e,!0);function SF(e,t){return uF(e,t,n=>e.moveVertically(n,t,ZP(e).height))}var CF=e=>SF(e,!1),wF=e=>SF(e,!0),TF=e=>uF(e,!0,t=>tF(e,t,!0)),EF=e=>uF(e,!1,t=>tF(e,t,!1)),DF=e=>{let t=!RP(e);return uF(e,t,n=>tF(e,n,t))},OF=e=>{let t=RP(e);return uF(e,t,n=>tF(e,n,t))},kF=e=>uF(e,!1,t=>O.cursor(e.lineBlockAt(t.head).from)),AF=e=>uF(e,!0,t=>O.cursor(e.lineBlockAt(t.head).to)),jF=({state:e,dispatch:t})=>(t(PP(e,{anchor:0})),!0),MF=({state:e,dispatch:t})=>(t(PP(e,{anchor:e.doc.length})),!0),NF=({state:e,dispatch:t})=>(t(PP(e,{anchor:e.selection.main.anchor,head:0})),!0),PF=({state:e,dispatch:t})=>(t(PP(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),FF=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),IF=({state:e,dispatch:t})=>{let n=tI(e).map(({from:t,to:n})=>O.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:O.create(n),userEvent:`select`})),!0},LF=({state:e,dispatch:t})=>{let n=NP(e.selection,t=>{let n=qe(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return O.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(PP(e,n)),!0)};function RF(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(PP(n,O.create(i,i.length-1))),!0)}var zF=e=>RF(e,!1),BF=e=>RF(e,!0),VF=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=O.create([n.main]):n.main.empty||(r=O.create([O.cursor(n.main.head)])),r?(t(PP(e,r)),!0):!1};function HF(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=UF(e,o,!1)):o>i&&(n=`delete.forward`,o=UF(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=UF(e,i,!1),a=UF(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:O.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?ve.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function UF(e,t,n){if(e instanceof ve)for(let r of e.state.facet(ve.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var WF=(e,t,n)=>HF(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=xe(s,a.tabSize)%ft(a)||ft(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=Je(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=Je(o.text,c-o.from,!1,!1)+o.from);return c}),GF=e=>WF(e,!1,!0),KF=e=>WF(e,!0,!1),qF=(e,t)=>HF(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=Je(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),JF=e=>qF(e,!1),YF=e=>qF(e,!0),XF=e=>HF(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),ZF=e=>HF(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),QF=e=>HF(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),$F=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:ce.of([``,``])},range:O.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},eI=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:Je(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:Je(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:O.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function tI(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function nI(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of tI(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(O.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(O.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:O.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var rI=({state:e,dispatch:t})=>nI(e,t,!1),iI=({state:e,dispatch:t})=>nI(e,t,!0);function aI(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of tI(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var oI=({state:e,dispatch:t})=>aI(e,t,!1),sI=({state:e,dispatch:t})=>aI(e,t,!0),cI=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(tI(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=NP(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function lI(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=qe(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(ye.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var uI=fI(!1),dI=fI(!0);function fI(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&lI(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new Qe(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=we(s,r);for(c??=xe(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,Ee(t,c)];return o&&l.push(Ee(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:ce.of(l)},range:O.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function pI(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:O.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var mI=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Qe(e,{overrideIndentation:e=>n[e]??-1}),i=pI(e,(t,i,a)=>{let o=we(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=Ee(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},hI=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(pI(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ue)})}),{userEvent:`input.indent`})),!0),gI=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(pI(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=xe(r,e.tabSize),a=0,o=Ee(e,Math.max(0,i-ft(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),_I=e=>(e.setTabFocusMode(),!0),vI=[{key:`Ctrl-b`,run:zP,shift:fF,preventDefault:!0},{key:`Ctrl-f`,run:BP,shift:pF},{key:`Ctrl-p`,run:YP,shift:bF},{key:`Ctrl-n`,run:XP,shift:xF},{key:`Ctrl-a`,run:oF,shift:kF},{key:`Ctrl-e`,run:sF,shift:AF},{key:`Ctrl-d`,run:KF},{key:`Ctrl-h`,run:GF},{key:`Ctrl-k`,run:XF},{key:`Ctrl-Alt-h`,run:JF},{key:`Ctrl-o`,run:$F},{key:`Ctrl-t`,run:eI},{key:`Ctrl-v`,run:eF}],yI=[{key:`ArrowLeft`,run:zP,shift:fF,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:HP,shift:hF,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:iF,shift:DF,preventDefault:!0},{key:`ArrowRight`,run:BP,shift:pF,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:UP,shift:gF,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:aF,shift:OF,preventDefault:!0},{key:`ArrowUp`,run:YP,shift:bF,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:jF,shift:NF},{mac:`Ctrl-ArrowUp`,run:$P,shift:CF},{key:`ArrowDown`,run:XP,shift:xF,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:MF,shift:PF},{mac:`Ctrl-ArrowDown`,run:eF,shift:wF},{key:`PageUp`,run:$P,shift:CF},{key:`PageDown`,run:eF,shift:wF},{key:`Home`,run:rF,shift:EF,preventDefault:!0},{key:`Mod-Home`,run:jF,shift:NF},{key:`End`,run:nF,shift:TF,preventDefault:!0},{key:`Mod-End`,run:MF,shift:PF},{key:`Enter`,run:uI,shift:uI},{key:`Mod-a`,run:FF},{key:`Backspace`,run:GF,shift:GF,preventDefault:!0},{key:`Delete`,run:KF,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:JF,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:YF,preventDefault:!0},{mac:`Mod-Backspace`,run:ZF,preventDefault:!0},{mac:`Mod-Delete`,run:QF,preventDefault:!0}].concat(vI.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),bI=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:KP,shift:_F},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:qP,shift:vF},{key:`Alt-ArrowUp`,run:rI},{key:`Shift-Alt-ArrowUp`,run:oI},{key:`Alt-ArrowDown`,run:iI},{key:`Shift-Alt-ArrowDown`,run:sI},{key:`Mod-Alt-ArrowUp`,run:zF},{key:`Mod-Alt-ArrowDown`,run:BF},{key:`Escape`,run:VF},{key:`Mod-Enter`,run:dI},{key:`Alt-l`,mac:`Ctrl-l`,run:IF},{key:`Mod-i`,run:LF,preventDefault:!0},{key:`Mod-[`,run:gI},{key:`Mod-]`,run:hI},{key:`Mod-Alt-\\`,run:mI},{key:`Shift-Mod-k`,run:cI},{key:`Shift-Mod-\\`,run:lF},{key:`Mod-/`,run:ZN},{key:`Alt-A`,mac:`Ctrl-A`,run:eP},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:_I}].concat(yI),xI={key:`Tab`,run:hI,shift:gI},SI=200,CI=function(){};CI.prototype.append=function(e){return e.length?(e=CI.from(e),!this.length&&e||e.length<SI&&this.leafAppend(e)||this.length<SI&&e.leafPrepend(this)||this.appendInner(e)):this},CI.prototype.prepend=function(e){return e.length?CI.from(e).append(this):this},CI.prototype.appendInner=function(e){return new TI(this,e)},CI.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?CI.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},CI.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},CI.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},CI.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},CI.from=function(e){return e instanceof CI?e:e&&e.length?new wI(e):CI.empty};var wI=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=SI)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=SI)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(CI);CI.empty=new wI([]);var TI=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(CI),EI=500,DI=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new kI(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new kI(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new kI(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>jI&&(s=OI(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new tf;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new kI(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;n=Math.min(this.items.length,n);let r=[],i=this.items.length-n,a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new kI(i,o,l))}else r.push(new kI(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new kI(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>EI&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new kI(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(CI.from(i.reverse()),a)}};DI.empty=new DI(CI.empty,0);function OI(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var kI=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},AI=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},jI=20;function MI(e,t,n,r){let i=n.getMeta(BI),a;if(i)return i.historyState;n.getMeta(VI)&&(e=new AI(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(BI))return o.getMeta(BI).redo?new AI(e.done.addTransform(n,void 0,r,zI(t)),e.undone,PI(n.mapping.maps),e.prevTime,e.prevComposition):new AI(e.done,e.undone.addTransform(n,void 0,r,zI(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!NI(n,e.prevRanges)),s=o?FI(e.prevRanges,n.mapping):PI(n.mapping.maps);return new AI(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,zI(t)),DI.empty,s,n.time,i??e.prevComposition)}return(a=n.getMeta(`rebased`))?new AI(e.done.rebased(n,a),e.undone.rebased(n,a),FI(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new AI(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),FI(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function NI(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function PI(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function FI(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function II(e,t,n){let r=zI(t),i=BI.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new AI(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(BI,{redo:n,historyState:c})}var LI=!1,RI=null;function zI(e){let t=e.plugins;if(RI!=t){LI=!1,RI=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){LI=!0;break}}return LI}var BI=new Op(`history`),VI=new Op(`closeHistory`);function HI(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Tp({key:BI,state:{init(){return new AI(DI.empty,DI.empty,null,0,-1)},apply(t,n,r){return MI(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?WI:n==`historyRedo`?GI:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function UI(e,t){return(n,r)=>{let i=BI.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=II(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var WI=UI(!1,!0),GI=UI(!0,!0),KI=Object.defineProperty,qI=Object.getOwnPropertySymbols,JI=Object.prototype.hasOwnProperty,YI=Object.prototype.propertyIsEnumerable,XI=(e,t,n)=>t in e?KI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZI=(e,t)=>{for(var n in t||={})JI.call(t,n)&&XI(e,n,t[n]);if(qI)for(var n of qI(t))YI.call(t,n)&&XI(e,n,t[n]);return e};function QI(e,t){return Object.assign(e,{meta:ZI({package:`@milkdown/components`},t)}),e}var $I=xx({extensions:[],languages:[],expandIcon:`⬇`,searchIcon:`🔍`,clearSearchIcon:`⌫`,searchPlaceholder:`Search language`,noResultText:`No result`,copyText:`Copy`,copyIcon:`📋`,onCopy:()=>{},renderLanguage:e=>e,renderPreview:()=>null,previewToggleButton:e=>e?`Edit`:`Hide`,previewLabel:`Preview`,previewLoading:`Loading...`},`codeBlockConfigCtx`);QI($I,{displayName:`Config<code-block>`,group:`CodeBlock`});var eL=class{constructor(e){this.languages=e,this.map={},e.forEach(e=>{e.alias.forEach(t=>{this.map[t]=e})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){let t=this.map[e.toLowerCase()];return t?t.support?Promise.resolve(t.support):t.load():Promise.resolve(void 0)}};function tL({icon:e,class:t,onClick:n}){return f(`span`,{class:bT(`milkdown-icon`,t),onPointerdown:n,innerHTML:e?gt.sanitize(e.trim()):void 0})}tL.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var nL=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())});function rL(e){return nL(this,null,function*(){try{return navigator.clipboard.writeText(e)}catch{let t=document.createElement(`textarea`),n=document.activeElement;t.value=e,t.setAttribute(`readonly`,``),t.style.contain=`strict`,t.style.position=`absolute`,t.style.left=`-9999px`,t.style.fontSize=`12pt`;let r=document.getSelection(),i=r?r.rangeCount>0&&r.getRangeAt(0):null;document.body.appendChild(t),t.select(),t.selectionStart=0,t.selectionEnd=e.length,document.execCommand(`copy`),document.body.removeChild(t),i&&(r.removeAllRanges(),r.addRange(i)),n&&n.focus()}})}var iL=d({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(e){let t=()=>{rL(e.text).then(()=>e.onCopy(e.text)).catch(console.error)};return()=>f(C,null,f(`button`,{type:`button`,class:`copy-button`,onClick:t},f(tL,{icon:e.copyIcon}),e.copyText))}}),aL=fx(`abcdefghijklmnopqrstuvwxyz0123456789`,8);function oL(e){return`${e}-${aL()}`}var sL=d({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:e,config:t,setLanguage:n,getAllLanguages:r,getReadOnly:o}){let s=S(),c=S(!1),l=S(),u=oL(`milkdown-code-language-search`),d=S(),p=S(``);i([c,s,d],()=>{p.value=``;let e=s.value,t=d.value;e&&t&&gT(e,t,{placement:`bottom-start`}).then(({x:e,y:n})=>{Object.assign(t.style,{left:`${e}px`,top:`${n}px`})}).catch(console.error)});let m=e=>{if(e.preventDefault(),e.stopPropagation(),o())return;let t=!c.value;c.value=t,t&&setTimeout(()=>l.value?.focus(),0)},h=e=>{let t=e.target;p.value=t.value},g=e=>{e.key===`Escape`&&(p.value=``)},_=w(()=>{if(!c.value)return[];let t=r()??[],n=t.find(t=>t.name.toLowerCase()===e.value.toLowerCase()),i=t.filter(e=>{let t=p.value.toLowerCase();return(e.name.toLowerCase().includes(t)||e.alias.some(e=>e.toLowerCase().includes(t)))&&e!==n});return i.length===0?[]:n?[n,...i]:i}),y=e=>{let t=e.target;if(s.value&&s.value.contains(t))return;let n=d.value,r=s.value;r&&n&&r.dataset.expanded===`true`&&(n.contains(t)||(c.value=!1))};return v(()=>{window.addEventListener(`click`,y)}),a(()=>{window.removeEventListener(`click`,y)}),()=>f(C,null,f(`button`,{type:`button`,ref:s,class:`language-button`,onClick:m,"data-expanded":String(c.value)},e.value||`Text`,f(`div`,{class:`expand-icon`},f(tL,{icon:t.expandIcon}))),f(`div`,{ref:d,class:`language-picker`},c.value?f(`div`,{class:`list-wrapper`},f(`div`,{class:`search-box`},f(`div`,{class:`search-icon`},f(tL,{icon:t.searchIcon})),f(`input`,{id:u,ref:l,class:`search-input`,placeholder:t.searchPlaceholder,value:p.value,onInput:h,onKeydown:g}),f(`div`,{class:bT(`clear-icon`,p.value.length===0&&`hidden`),onMousedown:e=>{e.preventDefault(),p.value=``}},f(tL,{icon:t.clearSearchIcon}))),f(`ul`,{class:`language-list`,role:`listbox`,onKeydown:e=>{if(e.key===`Enter`){let e=document.activeElement;e instanceof HTMLElement&&e.dataset.language&&n(e.dataset.language)}}},_.value.length?_.value.map(r=>f(`li`,{role:`listitem`,tabindex:`0`,class:`language-list-item`,"aria-selected":r.name.toLowerCase()===e.value.toLowerCase(),"data-language":r.name,onClick:()=>{n(r.name),c.value=!1}},t.renderLanguage(r.name,r.name.toLowerCase()===e.value.toLowerCase()))):f(`li`,{class:`language-list-item no-result`},t.noResultText))):null))}}),cL=`http://www.w3.org/2000/svg`;function lL(){let e=gt(),t={ADD_TAGS:[`foreignObject`],ADD_ATTR:[`xmlns`],HTML_INTEGRATION_POINTS:{foreignobject:!0}};return e.addHook(`uponSanitizeElement`,(e,t)=>{var n;if(t.tagName===`foreignobject`){let t=e.parentElement;(!t||t.namespaceURI!==cL)&&((n=e.parentNode)==null||n.removeChild(e))}}),n=>e.sanitize(n,t)}var uL;function dL(e){return uL??=lL(),uL(e)}var fL=d({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(e){let{previewOnlyMode:t,config:n,preview:r}=e,i=S();return te(()=>{let e=i.value;if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);let t=r.value;(typeof t==`string`||t instanceof Element)&&(e.innerHTML=dL(t))}),()=>r.value?f(`div`,{class:`preview-panel`},!t.value&&f(C,null,f(`div`,{class:`preview-divider`}),f(`div`,{class:`preview-label`},n.previewLabel)),f(`div`,{ref:i,class:`preview`})):null}}),pL=d({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){let t=e.config.previewOnlyByDefault??e.getReadOnly(),n=S(t),r=S(),a=S(null);v(()=>{for(;r.value?.firstChild;)r.value.removeChild(r.value.firstChild);r.value&&r.value.appendChild(e.codemirror.dom)}),i(()=>[e.text.value,e.language.value],()=>{let t=e.config.renderPreview(e.language.value,e.text.value,e=>a.value=e);t&&(a.value=t),t===void 0&&!a.value&&(a.value=gt.sanitize(e.config.previewLoading)),t===null&&(a.value=null)},{immediate:!0});let o=()=>{};return()=>f(C,null,f(`div`,{class:`tools`},f(sL,{language:e.language,config:e.config,setLanguage:e.setLanguage,getAllLanguages:e.getAllLanguages,getReadOnly:e.getReadOnly}),f(`div`,{class:`tools-button-group`},f(iL,{copyIcon:e.config.copyIcon,copyText:e.config.copyText,onCopy:e.config.onCopy??o,text:e.text.value}),a.value?f(`button`,{class:`preview-toggle-button`,onClick:()=>n.value=!n.value},f(tL,{icon:e.config.previewToggleButton(n.value)})):null)),f(`div`,{ref:r,class:bT(`codemirror-host`,a.value&&n.value&&`hidden`)}),f(fL,{text:e.text,language:e.language,config:e.config,previewOnlyMode:n,preview:a}))}}),mL=new WeakMap,hL=null;function gL(){return hL||=new IntersectionObserver(e=>{for(let t of e)mL.get(t.target)?.(t.isIntersecting)},{rootMargin:`200px`}),hL}var _L=class e{constructor(e,t,n,r,i){this.node=e,this.view=t,this.getPos=n,this.loader=r,this.config=i,this.selected=S(!1),this.language=S(``),this.text=S(``),this.initialized=!1,this.updating=!1,this.languageName=``,this.teardownTimer=null,this.forwardUpdate=e=>{if(this.updating||!this.cm.hasFocus)return;let t=(this.getPos()??0)+1,{main:n}=e.state.selection,r=t+n.from,i=t+n.to,a=this.view.state.selection;if(e.docChanged||a.from!==r||a.to!==i){let n=this.view.state.tr;e.changes.iterChanges((e,r,i,a,o)=>{o.length?n.replaceWith(t+e,t+r,this.view.state.schema.text(o.toString())):n.delete(t+e,t+r),t+=a-i-(r-e)}),n.setSelection(N.create(n.doc,r,i)),this.view.dispatch(n)}},this.createApp=()=>re(pL,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{let e=this.view;return[{key:`ArrowUp`,run:()=>this.maybeEscape(`line`,-1)},{key:`ArrowLeft`,run:()=>this.maybeEscape(`char`,-1)},{key:`ArrowDown`,run:()=>this.maybeEscape(`line`,1)},{key:`ArrowRight`,run:()=>this.maybeEscape(`char`,1)},{key:`Mod-Enter`,run:()=>Up(e.state,e.dispatch)?(e.focus(),!0):!1},{key:`Mod-z`,run:()=>WI(e.state,e.dispatch)},{key:`Shift-Mod-z`,run:()=>GI(e.state,e.dispatch)},{key:`Mod-y`,run:()=>GI(e.state,e.dispatch)},{key:`Backspace`,run:()=>{let e=this.cm.state.selection.ranges;if(e.length>1)return!1;let t=e[0];if(t&&(!t.empty||t.anchor>0)||this.cm.state.doc.lines>=2)return!1;let n=this.view.state,r=this.getPos()??0,i=n.tr.replaceWith(r,r+this.node.nodeSize,n.schema.nodes.paragraph.createChecked({},this.node.content));return i.setSelection(N.near(i.doc.resolve(r))),this.view.dispatch(i),this.view.focus(),!0}}]},this.maybeEscape=(e,t)=>{let{state:n}=this.cm,r=n.selection.main;if(!r.empty||(e===`line`&&(r=n.doc.lineAt(r.head)),t<0?r.from>0:r.to<n.doc.length))return!1;let i=(this.getPos()??0)+(t<0?0:this.node.nodeSize),a=N.near(this.view.state.doc.resolve(i),t),o=this.view.state.tr.setSelection(a).scrollIntoView();return this.view.dispatch(o),this.view.focus(),!0},this.setLanguage=e=>{this.view.dispatch(this.view.state.tr.setNodeAttribute(this.getPos()??0,`language`,e))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new He,this.readOnlyConf=new He,this.text.value=this.node.textContent,this.language.value=this.node.attrs.language??``,this.dom=document.createElement(`div`),this.dom.className=`milkdown-code-block`,this.disposeSelectedWatcher=te(()=>{this.selected.value?this.dom.classList.add(`selected`):this.dom.classList.remove(`selected`)}),this.renderPlaceholder(),mL.set(this.dom,e=>{e?(this.cancelTeardown(),this.initializeCodeMirror()):this.initialized&&this.scheduleTeardown()}),gL().observe(this.dom)}renderPlaceholder(){let e=document.createElement(`pre`);e.className=`milkdown-code-block-placeholder`;let t=document.createElement(`code`);t.textContent=this.node.textContent,e.appendChild(t),this.dom.appendChild(e)}initializeCodeMirror(){if(this.initialized)return;this.initialized=!0,this.cm=new ve({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(Ze.readOnly.of(!this.view.editable)),me(),Ne.of(this.codeMirrorKeymap()),this.languageConf.of([]),Ze.changeFilter.of(()=>this.view.editable||this.updating),...this.config.extensions,ve.updateListener.of(this.forwardUpdate)]});let e=this.dom.querySelector(`.milkdown-code-block-placeholder`);e&&this.dom.removeChild(e),this.app=this.createApp(),this.app.mount(this.dom),this.updateLanguage()}teardownCodeMirror(){if(this.initialized&&!(this.cm.hasFocus||this.selected.value)){for(this.app.unmount(),this.cm.destroy(),this.initialized=!1,this.languageName=``;this.dom.firstChild;)this.dom.removeChild(this.dom.firstChild);this.renderPlaceholder()}}scheduleTeardown(){this.cancelTeardown(),this.teardownTimer=setTimeout(()=>this.teardownCodeMirror(),e.TEARDOWN_DELAY)}cancelTeardown(){this.teardownTimer!=null&&(clearTimeout(this.teardownTimer),this.teardownTimer=null)}updateLanguage(){let e=this.node.attrs.language;e!==this.languageName&&(this.language.value=e,this.loader.load(e??``).then(t=>{t&&(this.cm.dispatch({effects:this.languageConf.reconfigure(t)}),this.languageName=e)}).catch(console.error))}setSelection(e,t){if(this.initialized||this.initializeCodeMirror(),this.cm.dom.isConnected){this.cm.focus(),this.updating=!0;try{this.cm.dispatch({selection:{anchor:e,head:t}})}finally{this.updating=!1}}}update(e){if(e.type!==this.node.type)return!1;if(this.updating)return!0;if(this.node=e,this.text.value=e.textContent,this.language.value=e.attrs.language??``,!this.initialized){let t=this.dom.querySelector(`.milkdown-code-block-placeholder code`);return t&&(t.textContent=e.textContent),!0}this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(Ze.readOnly.of(!this.view.editable))});let t=yL(this.cm.state.doc.toString(),e.textContent);if(t){this.updating=!0;try{this.cm.dispatch({changes:{from:t.from,to:t.to,insert:t.text},scrollIntoView:this.view.editable})}finally{this.updating=!1}}return!0}selectNode(){this.initialized||this.initializeCodeMirror(),this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){this.cancelTeardown(),gL().unobserve(this.dom),mL.delete(this.dom),this.initialized&&(this.app.unmount(),this.cm.destroy()),this.disposeSelectedWatcher()}};_L.TEARDOWN_DELAY=5e3;var vL=_L;function yL(e,t){if(e===t)return null;let n=0,r=e.length,i=t.length;for(;n<r&&e.charCodeAt(n)===t.charCodeAt(n);)++n;for(;r>n&&i>n&&e.charCodeAt(r-1)===t.charCodeAt(i-1);)r--,i--;return{from:n,to:r,text:t.slice(n,i)}}var bL=bx(KE.node,e=>{let t=e.get($I.key),n=new eL(t.languages);return(e,r,i)=>new vL(e,r,i,n,t)});QI(bL,{displayName:`NodeView<code-block>`,group:`CodeBlock`});var xL=[bL,$I],SL=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,CL=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(SL(e)):SL,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return De(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=oe(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=de(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(CL.prototype[Symbol.iterator]=function(){return this});var wL={from:-1,to:-1,match:/.*/.exec(``),precise:!0},TL=`gm`+(/x/.unicode==null?``:`u`),EL=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=wL,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new kL(e,t,n,r,i);this.re=new RegExp(t,TL+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=jL(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=jL(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},DL=new WeakMap,OL=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=DL.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return DL.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),DL.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},kL=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=wL,this.matchPos=jL(e,r),this.re=new RegExp(t,TL+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=OL.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=jL(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=OL.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(EL.prototype[Symbol.iterator]=kL.prototype[Symbol.iterator]=function(){return this});function AL(e){try{return new RegExp(e,TL),!0}catch{return!1}}function jL(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var ML=e=>{let t=Ae(e,`cm-goto-line`);if(t){let e=t.dom.querySelector(`input[type=text]`);return e&&e.select(),!0}let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=$e(e,{class:`cm-goto-line`,label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,l]=r,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),d=Math.round(n.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=n.doc.line(Math.max(1,Math.min(n.doc.lines,d))),p=O.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[i,ve.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},NL={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},PL=Ge.define({combine(e){return le(e,NL,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function FL(e){let t=[VL,BL];return e&&t.push(PL.of(e)),t}var IL=fe.mark({class:`cm-selectionMatch`}),LL=fe.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function RL(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=ze.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=ze.Word)}function zL(e,t,n,r){return e(t.sliceDoc(n,n+1))==ze.Word&&e(t.sliceDoc(r-1,r))==ze.Word}var BL=Ce.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(PL),{state:n}=e,r=n.selection;if(r.ranges.length>1)return fe.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return fe.none;let e=n.wordAt(i.head);if(!e)return fe.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return fe.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(RL(o,n,i.from,i.to)&&zL(o,n,i.from,i.to)))return fe.none}else if(a=n.sliceDoc(i.from,i.to),!a)return fe.none}let s=[];for(let r of e.visibleRanges){let e=new CL(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||RL(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push(LL.range(r,a)):(r>=i.to||a<=i.from)&&s.push(IL.range(r,a)),s.length>t.maxMatches))return fe.none}}return fe.set(s)}},{decorations:e=>e.decorations}),VL=ve.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),HL=({state:e,dispatch:t})=>{let{selection:n}=e,r=O.create(n.ranges.map(t=>e.wordAt(t.head)||O.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function UL(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new CL(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new CL(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var WL=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return HL({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=UL(e,r);return i?(t(e.update({selection:e.selection.addRange(O.range(i.from,i.to),!1),effects:ve.scrollIntoView(i.to)})),!0):!1},GL=Ge.define({combine(e){return le(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new TR(e),scrollToMatch:e=>ve.scrollIntoView(e)})}}),KL=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||AL(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
59
- `:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new rR(this):new ZL(this)}getCursor(e,t=0,n){let r=e.doc?e:Ze.create({doc:e});return n??=r.doc.length,this.regexp?$L(this,r,t,n):YL(this,r,t,n)}},qL=class{constructor(e){this.spec=e}};function JL(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function YL(e,t,n,r){let i;return e.wholeWord&&(i=XL(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=JL(e.test,t,i)),new CL(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function XL(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(eR(i,n-a))!=ze.Word||t(tR(i,n-a))!=ze.Word)&&(t(tR(i,r-a))!=ze.Word||t(eR(i,r-a))!=ze.Word))}var ZL=class extends qL{constructor(e){super(e)}nextMatch(e,t,n){let r=YL(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=YL(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=YL(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=YL(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=YL(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function QL(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function $L(e,t,n,r){let i;return e.wholeWord&&(i=nR(t.charCategorizer(t.selection.main.head))),e.test&&(i=QL(e.test,t,i)),new EL(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function eR(e,t){return e.slice(Je(e,t,!1),t)}function tR(e,t){return e.slice(t,Je(e,t))}function nR(e){return(t,n,r)=>!r[0].length||(e(eR(r.input,r.index))!=ze.Word||e(tR(r.input,r.index))!=ze.Word)&&(e(tR(r.input,r.index+r[0].length))!=ze.Word||e(eR(r.input,r.index+r[0].length))!=ze.Word)}var rR=class extends qL{nextMatch(e,t,n){let r=$L(this.spec,e,n,e.doc.length).next();return r.done&&(r=$L(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=$L(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=$L(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=$L(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},iR=pt.define(),aR=pt.define(),oR=Te.define({create(e){return new sR(yR(e).create(),null)},update(e,t){for(let n of t.effects)n.is(iR)?e=new sR(n.value.create(),e.panel):n.is(aR)&&(e=new sR(e.query,n.value?vR:null));return e},provide:e=>rt.from(e,e=>e.panel)}),sR=class{constructor(e,t){this.query=e,this.panel=t}},cR=fe.mark({class:`cm-searchMatch`}),lR=fe.mark({class:`cm-searchMatch cm-searchMatch-selected`}),uR=Ce.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(oR))}update(e){let t=e.state.field(oR);(t!=e.startState.field(oR)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return fe.none;let{view:n}=this,r=new mt;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?lR:cR)})}return r.finish()}},{decorations:e=>e.decorations});function dR(e){return t=>{let n=t.state.field(oR,!1);return n&&n.query.spec.valid?e(t,n):SR(t)}}var fR=dR((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=O.single(r.from,r.to),a=e.state.facet(GL);return e.dispatch({selection:i,effects:[kR(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),xR(e),!0}),pR=dR((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=O.single(i.from,i.to),o=e.state.facet(GL);return e.dispatch({selection:a,effects:[kR(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),xR(e),!0}),mR=dR((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:O.create(n.map(e=>O.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),hR=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new CL(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(O.range(t.value.from,t.value.to))}return t(e.update({selection:O.create(a,o),userEvent:`select.search.matches`})),!0},gR=dR((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(ve.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=O.single(o.from,o.to).map(d),u.push(kR(e,o)),u.push(n.facet(GL).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),_R=dR((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:ve.announce.of(r),userEvent:`input.replace.all`}),!0});function vR(e){return e.state.facet(GL).createPanel(e)}function yR(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(GL);return new KL({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function bR(e){let t=pe(e,vR);return t&&t.dom.querySelector(`[main-field]`)}function xR(e){let t=bR(e);t&&t==e.root.activeElement&&t.select()}var SR=e=>{let t=e.state.field(oR,!1);if(t&&t.panel){let n=bR(e);if(n&&n!=e.root.activeElement){let r=yR(e.state,t.query.spec);r.valid&&e.dispatch({effects:iR.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[aR.of(!0),t?iR.of(yR(e.state,t.query.spec)):pt.appendConfig.of(jR)]});return!0},CR=e=>{let t=e.state.field(oR,!1);if(!t||!t.panel)return!1;let n=pe(e,vR);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:aR.of(!1)}),!0},wR=[{key:`Mod-f`,run:SR,scope:`editor search-panel`},{key:`F3`,run:fR,shift:pR,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:fR,shift:pR,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:CR,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:hR},{key:`Mod-Alt-g`,run:ML},{key:`Mod-d`,run:WL,preventDefault:!0}],TR=class{constructor(e){this.view=e;let t=this.query=e.state.field(oR).query.spec;this.commit=this.commit.bind(this),this.searchField=Fe(`input`,{value:t.search,placeholder:ER(e,`Find`),"aria-label":ER(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=Fe(`input`,{value:t.replace,placeholder:ER(e,`Replace`),"aria-label":ER(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=Fe(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=Fe(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=Fe(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return Fe(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=Fe(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>fR(e),[ER(e,`next`)]),n(`prev`,()=>pR(e),[ER(e,`previous`)]),n(`select`,()=>mR(e),[ER(e,`all`)]),Fe(`label`,null,[this.caseField,ER(e,`match case`)]),Fe(`label`,null,[this.reField,ER(e,`regexp`)]),Fe(`label`,null,[this.wordField,ER(e,`by word`)]),...e.state.readOnly?[]:[Fe(`br`),this.replaceField,n(`replace`,()=>gR(e),[ER(e,`replace`)]),n(`replaceAll`,()=>_R(e),[ER(e,`replace all`)])],Fe(`button`,{name:`close`,onclick:()=>CR(e),"aria-label":ER(e,`close`),type:`button`},[`×`])])}commit(){let e=new KL({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:iR.of(e)}))}keydown(e){ot(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?pR:fR)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),gR(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(iR)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(GL).top}};function ER(e,t){return e.state.phrase(t)}var DR=30,OR=/[\s\.,:;?!]/;function kR(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-DR),o=Math.min(i,n+DR),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<DR;e++)if(!OR.test(s[e+1])&&OR.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-DR;e--)if(!OR.test(s[e-1])&&OR.test(s[e])){s=s.slice(0,e);break}}return ve.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var AR=ve.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),jR=[oR,Pe.low(uR),AR],MR=class{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}},NR=class e{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(t,n,r){let i=r.facet(qR).markerFilter;i&&(t=i(t,r));let a=t.slice().sort((e,t)=>e.from-t.from||e.to-t.to),o=new mt,s=[],c=0,l=r.doc.iter(),u=0,d=r.doc.length;for(let e=0;;){let t=e==a.length?null:a[e];if(!t&&!s.length)break;let n,r;if(s.length)n=c,r=s.reduce((e,t)=>Math.min(e,t.to),t&&t.from>n?t.from:1e8);else{if(n=t.from,n>d)break;r=t.to,s.push(t),e++}for(;e<a.length;){let t=a[e];if(t.from==n&&(t.to>t.from||t.to==n))s.push(t),e++,r=Math.min(t.to,r);else{r=Math.min(t.from,r);break}}r=Math.min(r,d);let i=!1;if(s.some(e=>e.from==n&&(e.to==r||r==d))&&(i=n==r,!i&&r-n<10)){let e=n-(u+l.value.length);e>0&&(l.next(e),u=n);for(let e=n;;){if(e>=r){i=!0;break}if(!l.lineBreak&&u+l.value.length>e)break;e=u+l.value.length,u+=l.value.length,l.next()}}let f=iz(s);if(i)o.add(n,n,fe.widget({widget:new ZR(f),diagnostics:s.slice()}));else{let e=s.reduce((e,t)=>t.markClass?e+` `+t.markClass:e,``);o.add(n,r,fe.mark({class:`cm-lintRange cm-lintRange-`+f+e,diagnostics:s.slice(),inclusiveEnd:s.some(e=>e.to>r)}))}if(c=r,c==d)break;for(let e=0;e<s.length;e++)s[e].to<=c&&s.splice(e--,1)}let f=o.finish();return new e(f,n,PR(f))}};function PR(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0)){if(!r)r=new MR(e,n,t||i.diagnostics[0]);else if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;else r=new MR(r.from,n,r.diagnostic)}}),r}function FR(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(qR).hideOn(e,n,r);if(i!=null)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(LR))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}function IR(e,t){return e.field(BR,!1)?t:t.concat(pt.appendConfig.of(oz))}var LR=pt.define(),RR=pt.define(),zR=pt.define(),BR=Te.define({create(){return new NR(fe.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=PR(n,e.selected.diagnostic,i)||PR(n,null,i)}!n.size&&i&&t.state.facet(qR).autoPanel&&(i=null),e=new NR(n,i,r)}for(let n of t.effects)if(n.is(LR)){let r=t.state.facet(qR).autoPanel?n.value.length?$R.open:null:e.panel;e=NR.init(n.value,r,t.state)}else n.is(RR)?e=new NR(e.diagnostics,n.value?$R.open:null,e.selected):n.is(zR)&&(e=new NR(e.diagnostics,e.panel,n.value));return e},provide:e=>[rt.from(e,e=>e.panel),ve.decorations.from(e,e=>e.diagnostics)]}),VR=fe.mark({class:`cm-lintRange cm-lintRange-active`});function HR(e,t,n){let{diagnostics:r}=e.state.field(BR),i,a=-1,o=-1;r.between(t-+(n<0),t+ +(n>0),(e,r,{spec:s})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=s.diagnostics,a=e,o=r,!1});let s=e.state.facet(qR).tooltipFilter;return i&&s&&(i=s(i,e.state)),i?{pos:a,end:o,above:!0,create(){return{dom:UR(e,i)}}}:null}function UR(e,t){return Fe(`ul`,{class:`cm-tooltip-lint`},t.map(t=>XR(e,t,!1)))}var WR=e=>{let t=e.state.field(BR,!1);(!t||!t.panel)&&e.dispatch({effects:IR(e.state,[RR.of(!0)])});let n=pe(e,$R.open);return n&&n.dom.querySelector(`.cm-panel-lint ul`).focus(),!0},GR=e=>{let t=e.state.field(BR,!1);return!t||!t.panel?!1:(e.dispatch({effects:RR.of(!1)}),!0)},KR=[{key:`Mod-Shift-m`,run:WR,preventDefault:!0},{key:`F8`,run:e=>{let t=e.state.field(BR,!1);if(!t)return!1;let n=e.state.selection.main,r=PR(t.diagnostics,null,n.to+1);return!r&&(r=PR(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),se(e,r.from,1,{tooltip:az,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],qR=Ge.define({combine(e){return{sources:e.map(e=>e.source).filter(e=>e!=null),...le(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:JR,tooltipFilter:JR,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})}}});function JR(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function YR(e){let t=[];if(e)actions:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue actions}}t.push(``)}return t}function XR(e,t,n){let r=n?YR(t.actions):[];return Fe(`li`,{class:`cm-diagnostic cm-diagnostic-`+t.severity},Fe(`span`,{class:`cm-diagnosticText`},t.renderMessage?t.renderMessage(e):t.message),t.actions?.map((n,i)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=PR(e.state.field(BR).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:s}=n,c=r[i]?s.indexOf(r[i]):-1,l=c<0?s:[s.slice(0,c),Fe(`u`,s.slice(c,c+1)),s.slice(c+1)],u=n.markClass?` `+n.markClass:``;return Fe(`button`,{type:`button`,class:`cm-diagnosticAction`+u,onclick:o,onmousedown:o,"aria-label":` Action: ${s}${c<0?``:` (access key "${r[i]})"`}.`},l)}),t.source&&Fe(`div`,{class:`cm-diagnosticSource`},t.source))}var ZR=class extends ht{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Fe(`span`,{class:`cm-lintPoint cm-lintPoint-`+this.sev})}},QR=class{constructor(e,t){this.diagnostic=t,this.id=`item_`+Math.floor(Math.random()*4294967295).toString(16),this.dom=XR(e,t,!0),this.dom.id=this.id,this.dom.setAttribute(`role`,`option`)}},$R=class e{constructor(e){this.view=e,this.items=[];let t=t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(t.keyCode==27)GR(this.view),this.view.focus();else if(t.keyCode==38||t.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(t.keyCode==40||t.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(t.keyCode==36)this.moveSelection(0);else if(t.keyCode==35)this.moveSelection(this.items.length-1);else if(t.keyCode==13)this.view.focus();else if(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:n}=this.items[this.selectedIndex],r=YR(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=PR(this.view.state.field(BR).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}else return;t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=Fe(`ul`,{tabIndex:0,role:`listbox`,"aria-label":this.view.state.phrase(`Diagnostics`),onkeydown:t,onclick:n}),this.dom=Fe(`div`,{class:`cm-panel-lint`},this.list,Fe(`button`,{type:`button`,name:`close`,"aria-label":this.view.state.phrase(`close`),onclick:()=>GR(this.view)},`×`)),this.update()}get selectedIndex(){let e=this.view.state.field(BR).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(BR),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:s})=>{for(let e of s.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,s;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(s=new QR(this.view,e),this.items.splice(n,0,s),r=!0):(s=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&s.diagnostic==t.diagnostic?s.dom.hasAttribute(`aria-selected`)||(s.dom.setAttribute(`aria-selected`,`true`),i=s):s.dom.hasAttribute(`aria-selected`)&&s.dom.removeAttribute(`aria-selected`),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new QR(this.view,{from:-1,to:-1,severity:`info`,message:this.view.state.phrase(`No diagnostics`)})),r=!0),i?(this.list.setAttribute(`aria-activedescendant`,i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute(`aria-activedescendant`),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=PR(this.view.state.field(BR).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:zR.of(t)})}static open(t){return new e(t)}};function ez(e,t=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function tz(e){return ez(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,`width="6" height="3"`)}var nz=ve.baseTheme({".cm-diagnostic":{padding:`3px 6px 3px 8px`,marginLeft:`-1px`,display:`block`,whiteSpace:`pre-wrap`},".cm-diagnostic-error":{borderLeft:`5px solid #d11`},".cm-diagnostic-warning":{borderLeft:`5px solid orange`},".cm-diagnostic-info":{borderLeft:`5px solid #999`},".cm-diagnostic-hint":{borderLeft:`5px solid #66d`},".cm-diagnosticAction":{font:`inherit`,border:`none`,padding:`2px 4px`,backgroundColor:`#444`,color:`white`,borderRadius:`3px`,marginLeft:`8px`,cursor:`pointer`},".cm-diagnosticSource":{fontSize:`70%`,opacity:.7},".cm-lintRange":{backgroundPosition:`left bottom`,backgroundRepeat:`repeat-x`,paddingBottom:`0.7px`},".cm-lintRange-error":{backgroundImage:tz(`#f11`)},".cm-lintRange-warning":{backgroundImage:tz(`orange`)},".cm-lintRange-info":{backgroundImage:tz(`#999`)},".cm-lintRange-hint":{backgroundImage:tz(`#66d`)},".cm-lintRange-active":{backgroundColor:`#ffdd9980`},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:`relative`,"&:after":{content:`""`,position:`absolute`,bottom:0,left:`-2px`,borderLeft:`3px solid transparent`,borderRight:`3px solid transparent`,borderBottom:`4px solid #d11`}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:`orange`}},".cm-lintPoint-info":{"&:after":{borderBottomColor:`#999`}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:`#66d`}},".cm-panel.cm-panel-lint":{position:`relative`,"& ul":{maxHeight:`100px`,overflowY:`auto`,"& [aria-selected]":{backgroundColor:`#ddd`,"& u":{textDecoration:`underline`}},"&:focus [aria-selected]":{background_fallback:`#bdf`,backgroundColor:`Highlight`,color_fallback:`white`,color:`HighlightText`},"& u":{textDecoration:`none`},padding:0,margin:0},"& [name=close]":{position:`absolute`,top:`0`,right:`2px`,background:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:`#86714a80`},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:`#2e343e`}}});function rz(e){return e==`error`?4:e==`warning`?3:e==`info`?2:1}function iz(e){let t=`hint`,n=1;for(let r of e){let e=rz(r.severity);e>n&&(n=e,t=r.severity)}return t}var az=je(HR,{hideOn:FR}),oz=[BR,ve.decorations.compute([BR],e=>{let{selected:t,panel:n}=e.field(BR);return!t||!n||t.from==t.to?fe.none:fe.set([VR.range(t.from,t.to)])}),az,nz],sz=[Se(),ge(),Me(),pP(),Ue(),me(),Oe(),Ze.allowMultipleSelections.of(!0),ut(),ae(Ve,{fallback:!0}),Ye(),ir(),xr(),Be(),ke(),nt(),FL(),Ne.of([...ur,...bI,...wR,...MP,...ct,...Sr,...KR])];function cz(e){return e.nodeType===1}function lz(e){return cz(e)&&e.namespaceURI===`http://www.w3.org/1999/xhtml`}function uz(e){let t=[[-1,e.state.doc]],n=[];for(;t.length>0;){let[r,i]=t.pop();if(r>=0){let t=e.nodeDOM(r);if(t&&lz(t)){let{top:e,bottom:a,left:o,right:s}=t.getBoundingClientRect();n.push([r,[o,e,s,e]],[r+i.nodeSize,[o,a,s,a]])}}if(i.isBlock&&!i.isTextblock){let e=r+1;for(let n of i.children)t.push([e,n]),e+=n.nodeSize}}return n}function dz(e,t){let n=[],r,i,a=()=>{let t=e.dom.getBoundingClientRect(),a=e.state.doc;return n&&r&&i&&t.width===i.width&&t.height===i.height&&t.x===i.x&&t.y===i.y&&r.eq(a)?n:(i=t,r=a,n=uz(e),n)},o=(n,r)=>{if(!e.editable||e.isDestroyed)return;let i=(e,t)=>{let[r,i]=e,[a,o]=t;return mz(n,i)-mz(n,o)||r-a},o=a();o.sort(i),o=o.slice(0,8);let s=o.find(n=>t?.({view:e,pos:n[0],event:r})!==!1);if(!(s&&hz(e,s[0])))return s},s,c;return(e,t)=>s&&fz(s,e)?c:(s=e,c=o(e,t),c)}function fz(e,t){return e[0]===t[0]&&e[1]===t[1]}function pz(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function mz(e,t){return Math.min(pz(e,[t[0],t[1]]),pz(e,[t[2],t[3]]))}function hz(e,t){let n=e.dragging;if(!n)return;let{move:r}=n;if(!r)return;let i=e.state.selection;if(!(i instanceof P))return;let{from:a,to:o}=i;return a<=t&&t<=o}function gz(e){let t;return new Tp({key:new Op(`prosemirror-drop-indicator`),view:n=>(t=dz(n,e.onDrag),vz(n,t,e)),props:{handleDrop(e,n,r,i){if(!t)return!1;let a=t([n.clientX,n.clientY],n);if(!a)return!1;n.preventDefault();let o=a[0],s=e.state.tr;if(i){let{node:t}=e.dragging||{};t?t.replace(s):s.deleteSelection()}let c=s.mapping.map(o),l=r.openStart==0&&r.openEnd==0&&r.content.childCount==1,u=s.doc;if(l?s.replaceRangeWith(c,c,r.content.firstChild):s.replaceRange(c,c,r),s.doc.eq(u))return!0;let d=s.doc.resolve(c);if(l&&P.isSelectable(r.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(r.content.firstChild))s.setSelection(new P(d));else{let t=s.mapping.map(o);s.mapping.maps[s.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),s.setSelection(_z(e,d,s.doc.resolve(t)))}return e.focus(),e.dispatch(s.setMeta(`uiEvent`,`drop`)),!0}}})}function _z(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||N.between(t,n,r)}function vz(e,t,n){let r=e.dom,i,a,o,s=!1,c=()=>{i&&clearTimeout(i),s=!1,i=setTimeout(()=>{s||n.onHide?.()},30)},l=r=>{s=!0;let{clientX:i,clientY:l}=r;if(a===i&&o===l)return;a=i,o=l;let u=t([i,l],r);if(u){let[t,[r,i,a,o]]=u,s={p1:{x:r,y:i},p2:{x:a,y:o}};n.onShow?.({view:e,pos:t,line:s})}else{c();return}};return r.addEventListener(`dragover`,l),r.addEventListener(`dragend`,c),r.addEventListener(`drop`,c),r.addEventListener(`dragleave`,c),{destroy:()=>{r.removeEventListener(`dragover`,l),r.removeEventListener(`dragend`,c),r.removeEventListener(`drop`,c),r.removeEventListener(`dragleave`,c)}}}var yz=class e extends ap{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):ap.near(r)}content(){return M.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new bz(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Sz(e)||!Cz(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!P.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};yz.prototype.visible=!1,yz.findFrom=yz.findGapCursorFrom,ap.jsonID(`gapcursor`,yz);var bz=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return yz.valid(t)?new yz(t):ap.near(t)}};function xz(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Sz(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||xz(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Cz(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||xz(e.type))return!0;if(e.inlineContent)return!1}}return!0}function wz(){return new Tp({props:{decorations:kz,createSelectionBetween(e,t,n){return t.pos==n.pos&&yz.valid(n)?new yz(n):null},handleClick:Dz,handleKeyDown:Tz,handleDOMEvents:{beforeinput:Oz}}})}var Tz=_h({ArrowLeft:Ez(`horiz`,-1),ArrowRight:Ez(`horiz`,1),ArrowUp:Ez(`vert`,-1),ArrowDown:Ez(`vert`,1)});function Ez(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof N){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=yz.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new yz(c))),!0):!1}}function Dz(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!yz.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&P.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new yz(r))),!0)}function Oz(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof yz))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=j.empty;for(let e=r.length-1;e>=0;e--)i=j.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new M(i,0,0));return a.setSelection(N.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function kz(e){if(!(e.selection instanceof yz))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,cy.create(e.doc,[ay.widget(e.selection.head,t,{key:`gapcursor`})])}function Az(e,t){return Object.assign(e,{meta:{package:`@milkdown/plugin-cursor`,...t}}),e}var jz=xx(null,`dropIndicatorState`);Az(jz,{displayName:`Ctx<dropIndicatorState>`});var Mz=xx({width:2,color:!1,class:`milkdown-drop-indicator`},`dropIndicatorConfig`);Az(Mz,{displayName:`Ctx<dropIndicatorConfig>`});var Nz=new Op(`MILKDOWN_DROP_INDICATOR_DOM`),Pz=vx(e=>new Tp({key:Nz,view:t=>{let n=e.get(Mz.key),r=document.createElement(`div`);Object.assign(r.style,{position:`fixed`,pointerEvents:`none`,display:`none`,backgroundColor:n.color,top:`0`,left:`0`}),r.classList.add(n.class),r.classList.add(`milkdown-drop-indicator`),t.dom.parentNode?.appendChild(r);let i=e.use(jz.key),a=e=>{Fz(r,e,n)};return i.on(a),{destroy:()=>{i.off(a),r.remove()}}}}));Az(Pz,{displayName:`Prose<dropIndicatorDOM>`});function Fz(e,t,n){if(!t){Object.assign(e.style,{display:`none`});return}let{line:r}=t,{width:i}=n,{p1:{x:a,y:o},p2:{x:s,y:c}}=r,l=o===c,u,d,f=o,p=a;l?(u=s-a,d=i,f-=i/2):(u=i,d=c-o,p-=i/2),f=Math.round(f),p=Math.round(p),Object.assign(e.style,{display:`block`,width:`${u}px`,height:`${d}px`,transform:`translate(${p}px, ${f}px)`})}var Iz=vx(e=>gz({onShow:t=>{e.set(jz.key,t)},onHide:()=>{e.set(jz.key,null)},onDrag:()=>!0}));Az(Iz,{displayName:`Prose<dropIndicator>`});var Lz=vx(()=>wz());Az(Lz,{displayName:`Prose<gapCursor>`});var Rz=[Lz,Mz,jz,Pz,Iz].flat();function zz(e){let t=e?.skipWarning??!1,n=typeof document>`u`?null:document.createElement(`div`);return new Tp({key:Bz,view:e=>{t!==!0&&Kz(e.state.schema,t||[]);let r=e.dom.ownerDocument;n||=document.createElement(`div`);let i=n,a=()=>{Wz(e,i)},o;return window.ResizeObserver&&(o=new window.ResizeObserver(()=>a()),o.observe(e.dom)),r.addEventListener(`selectionchange`,a),{update:()=>{a()},destroy:()=>{r.removeEventListener(`selectionchange`,a),o&&o.unobserve(e.dom)}}},props:{handleKeyDown:(e,t)=>{let{selection:n}=e.state;if(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||t.isComposing||![`ArrowLeft`,`ArrowRight`].includes(t.key)||!Uz(n)||!n.empty)return!1;let r=n.$head,[i,a]=Hz(r),o=e.state.storedMarks||r.marks();if(i&&a&&!Ou.sameSet(i,a)){if(t.key===`ArrowLeft`&&!Ou.sameSet(i,o))return e.dispatch(e.state.tr.setStoredMarks(i)),!0;if(t.key===`ArrowRight`&&!Ou.sameSet(a,o))return e.dispatch(e.state.tr.setStoredMarks(a)),!0}return t.key===`ArrowLeft`&&r.textOffset===1?(e.dispatch(e.state.tr.setSelection(N.create(e.state.doc,r.pos-1)).setStoredMarks(r.marks())),!0):t.key===`ArrowRight`&&r.textOffset+1===r.parent.maybeChild(r.index())?.nodeSize&&(e.dispatch(e.state.tr.setSelection(N.create(e.state.doc,r.pos+1)).setStoredMarks(r.marks())),!0)},decorations:e=>{if(n&&Uz(e.selection)&&e.selection.empty)return cy.create(e.doc,[ay.widget(0,n,{key:`prosemirror-virtual-cursor`})])},attributes:{class:`virtual-cursor-enabled`}}})}var Bz=new Op(`prosemirror-virtual-cursor`);function Vz(e,t){let n=window.getSelection();if(!n||!n.rangeCount)return null;let r=(n?.getRangeAt(0))?.cloneRange();if(!r)return null;r.collapse(t);let i=r.getClientRects(),a=i?.length?i[i.length-1]:null;return a?.height?a:e.coordsAtPos(e.state.selection.head)}function Hz(e){let t=e.index(),n=e.parent.maybeChild(t),r=e.textOffset?n:null;return!r&&t>0&&(r=e.parent.maybeChild(t-1)),[r?.marks,n?.marks]}function Uz(e){return e&&typeof e==`object`&&`$cursor`in e}function Wz(e,t){if(!e||!e.dom||e.isDestroyed||!t)return;let{state:n,dom:r}=e,{selection:i}=n;if(!Uz(i))return;let a=Vz(e,i.$head===i.$from);if(!a)return t;let o=r.getBoundingClientRect(),s=`prosemirror-virtual-cursor`,c=n.selection.$head,[l,u]=Hz(c),d=n.storedMarks||c.marks();i.$cursor&&l&&u&&d&&!Ou.sameSet(l,u)&&(Ou.sameSet(l,d)?s+=` prosemirror-virtual-cursor-left`:Ou.sameSet(u,d)&&(s+=` prosemirror-virtual-cursor-right`)),t.className=s,Gz(t,`prosemirror-virtual-cursor-animation`),t.style.height=`${a.bottom-a.top}px`,t.style.left=`${a.left-o.left}px`,t.style.top=`${a.top-o.top}px`}function Gz(e,t){e.classList.remove(t),e.offsetWidth,e.classList.add(t)}function Kz(e,t){for(let[n,r]of Object.entries(e.marks))r.spec.inclusive===!1&&!t.includes(n)&&console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${n}" mark or adding it to the "skipWarning" option.`)}var qz=Object.defineProperty,Jz=Object.getOwnPropertySymbols,Yz=Object.prototype.hasOwnProperty,Xz=Object.prototype.propertyIsEnumerable,Zz=(e,t,n)=>t in e?qz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qz=(e,t)=>{for(var n in t||={})Yz.call(t,n)&&Zz(e,n,t[n]);if(Jz)for(var n of Jz(t))Xz.call(t,n)&&Zz(e,n,t[n]);return e};function $z(e,t){return Object.assign(e,{meta:Qz({package:`@milkdown/components`},t)}),e}var eB=xx({imageIcon:`🌌`,uploadButton:`Upload`,confirmButton:`⏎`,uploadPlaceholderText:`/Paste`,onUpload:e=>Promise.resolve(URL.createObjectURL(e))},`inlineImageConfigCtx`);$z(eB,{displayName:`Config<image-inline>`,group:`ImageInline`});var tB=fx(`abcdefghijklmnopqrstuvwxyz0123456789`,8);function nB(e){return`${e}-${tB()}`}function rB({icon:e,class:t,onClick:n}){return f(`span`,{class:bT(`milkdown-icon`,t),onPointerdown:n,innerHTML:e?gt.sanitize(e.trim()):void 0})}rB.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var iB=d({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0},onImageLoadError:{type:Function,required:!1}},setup({readonly:e,src:t,setLink:n,onUpload:r,imageIcon:i,uploadButton:a,confirmButton:o,uploadPlaceholderText:s,className:c,onImageLoadError:l}){let u=S(!1),d=S(),p=S(t.value??``),m=nB(`milkdown-image-link`),h=nB(`milkdown-image-upload`),g=S(t.value?.length!==0),_=e=>{let t=e.target.value;g.value=t.length!==0,p.value=t},v=e=>{e.key===`Enter`&&n(d.value?.value??``)},y=()=>{n(d.value?.value??``)},b=e=>{let t=e.target.files?.[0];t&&r(t).then(e=>{e&&(n(e),g.value=!0)}).catch(e=>{console.error(`An error occurred while uploading image`),console.error(e)})};return()=>f(`div`,{class:bT(`image-edit`,c)},f(rB,{icon:i,class:`image-icon`}),f(`div`,{class:bT(`link-importer`,u.value&&`focus`)},f(`input`,{id:m,ref:d,draggable:`true`,onDragstart:e=>{e.preventDefault(),e.stopPropagation()},disabled:e.value,class:`link-input-area`,value:p.value,onInput:_,onKeydown:v,onFocus:()=>u.value=!0,onBlur:()=>u.value=!1}),!g.value&&f(`div`,{class:`placeholder`},f(`input`,{disabled:e.value,class:`hidden`,id:h,type:`file`,accept:`image/*`,onChange:b}),f(`label`,{class:`uploader`,for:h},f(rB,{icon:a})),f(`span`,{class:`text`,onClick:()=>d.value?.focus()},s))),p.value&&f(C,null,f(`div`,{class:`image-preview`},f(`img`,{src:p.value,alt:``,onError:e=>Promise.resolve(l?.(e)).catch(()=>{})})),f(`div`,{class:`confirm`,onClick:()=>y()},f(rB,{icon:o}))))}}),aB=d({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(e){let{src:t,alt:n,title:r}=e;return()=>t.value?.length?f(`img`,{class:`image-inline`,src:t.value,alt:n.value,title:r.value}):f(iB,{src:e.src,selected:e.selected,readonly:e.readonly,setLink:t=>e.setAttr(`src`,t),imageIcon:e.config.imageIcon,uploadButton:e.config.uploadButton,confirmButton:e.config.confirmButton,uploadPlaceholderText:e.config.uploadPlaceholderText,onUpload:e.config.onUpload,className:`empty-image-inline`})}}),oB=bx(ZE.node,e=>(t,n,r)=>{let i=S(t.attrs.src),a=S(t.attrs.alt),o=S(t.attrs.title),s=S(!1),c=S(!n.editable),l=(e,t)=>{if(!n.editable)return;let i=r();i!=null&&n.dispatch(n.state.tr.setNodeAttribute(i,e,e===`src`?gt.sanitize(t):t))},u=e.get(eB.key),d=re(aB,{src:i,alt:a,title:o,selected:s,readonly:c,setAttr:l,config:u}),f=document.createElement(`span`);f.className=`milkdown-image-inline`;let p=te(()=>{s.value?f.classList.add(`selected`):f.classList.remove(`selected`)}),m=u.proxyDomURL,h=e=>{if(!m)i.value=e.attrs.src;else{let t=m(e.attrs.src);typeof t==`string`?i.value=t:t.then(e=>{i.value=e}).catch(console.error)}a.value=e.attrs.alt,o.value=e.attrs.title};return h(t),d.mount(f),{dom:f,update:e=>e.type===t.type&&(h(e),!0),stopEvent:e=>e.target instanceof HTMLInputElement,selectNode:()=>{s.value=!0},deselectNode:()=>{s.value=!1},destroy:()=>{p(),d.unmount(),f.remove()}}});$z(oB,{displayName:`NodeView<image-inline>`,group:`ImageInline`});var sB=[eB,oB],z=class e extends Error{constructor(t,n){var r=`KaTeX parse error: `+t,i,a,o=n&&n.loc;if(o&&o.start<=o.end){var s=o.lexer.input;i=o.start,a=o.end,i===s.length?r+=` at end of input: `:r+=` at position `+(i+1)+`: `;var c=s.slice(i,a).replace(/[^]/g,`$&̲`),l=i>15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15<s.length?s.slice(a,a+15)+`…`:s.slice(a);r+=l+c+u}super(r),this.name=`ParseError`,this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},cB=/([A-Z])/g,lB=e=>e.replace(cB,`-$1`).toLowerCase(),uB={"&":`&amp;`,">":`&gt;`,"<":`&lt;`,'"':`&quot;`,"'":`&#x27;`},dB=/[&><"']/g,fB=e=>String(e).replace(dB,e=>uB[e]),pB=e=>e.type===`ordgroup`||e.type===`color`?e.body.length===1?pB(e.body[0]):e:e.type===`font`?pB(e.body):e,mB=new Set([`mathord`,`textord`,`atom`]),hB=e=>mB.has(pB(e).type),gB=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},_B={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format <type>`},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color <color>`,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro <def>`,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness <size>`,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size <n>`,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand <n>`,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}};function vB(e){if(typeof e!=`string`)return e.enum[0];switch(e){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{};default:throw Error(`Unexpected schema type; settings must declare an explicit default.`)}}function yB(e){return Object.prototype.hasOwnProperty.call(e,`default`)&&e.default!==void 0?e.default:vB(Array.isArray(e.type)?e.type[0]:e.type)}function bB(e,t,n,r){var i=Object.prototype.hasOwnProperty.call(n,t)?n[t]:void 0,a=Object.prototype.hasOwnProperty.call(r,`processor`)?r.processor:void 0;e[t]=i===void 0?yB(r):a?a(i):i}var xB=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={};for(var t of Object.keys(_B)){var n=_B[t];n&&bB(this,t,e,n)}}isTrusted(e){if(`url`in e&&e.url&&!e.protocol){var t=gB(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},SB=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return jB[MB[this.id]]}sub(){return jB[NB[this.id]]}fracNum(){return jB[PB[this.id]]}fracDen(){return jB[FB[this.id]]}cramp(){return jB[IB[this.id]]}text(){return jB[LB[this.id]]}isTight(){return this.size>=2}},CB=0,wB=1,TB=2,EB=3,DB=4,OB=5,kB=6,AB=7,jB=[new SB(CB,0,!1),new SB(wB,0,!0),new SB(TB,1,!1),new SB(EB,1,!0),new SB(DB,2,!1),new SB(OB,2,!0),new SB(kB,3,!1),new SB(AB,3,!0)],MB=[DB,OB,DB,OB,kB,AB,kB,AB],NB=[OB,OB,OB,OB,AB,AB,AB,AB],PB=[TB,EB,DB,OB,kB,AB,kB,AB],FB=[EB,EB,OB,OB,AB,AB,AB,AB],IB=[wB,wB,EB,EB,OB,OB,AB,AB],LB=[CB,wB,TB,EB,TB,EB,TB,EB],RB={DISPLAY:jB[CB],TEXT:jB[TB],SCRIPT:jB[DB],SCRIPTSCRIPT:jB[kB]},zB=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}];function BB(e){for(var t=0;t<zB.length;t++)for(var n=zB[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var VB=[];zB.forEach(e=>e.blocks.forEach(e=>VB.push(...e)));function HB(e){for(var t=0;t<VB.length;t+=2)if(e>=VB[t]&&e<=VB[t+1])return!0;return!1}var UB=e=>e+` `+e,WB=80,GB=function(e,t){return`M95,`+(622+e+t)+`
60
- c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
61
- c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
62
- c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
63
- s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
64
- c69,-144,104.5,-217.7,106.5,-221
65
- l`+e/2.075+` -`+e+`
66
- c5.3,-9.3,12,-14,20,-14
67
- H400000v`+(40+e)+`H845.2724
68
- s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
69
- c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
70
- M`+(834+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},KB=function(e,t){return`M263,`+(601+e+t)+`c0.7,0,18,39.7,52,119
71
- c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
72
- c340,-704.7,510.7,-1060.3,512,-1067
73
- l`+e/2.084+` -`+e+`
74
- c4.7,-7.3,11,-11,19,-11
75
- H40000v`+(40+e)+`H1012.3
76
- s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
77
- c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
78
- s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
79
- c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
80
- M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},qB=function(e,t){return`M983 `+(10+e+t)+`
81
- l`+e/3.13+` -`+e+`
82
- c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
83
- H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
84
- s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
85
- c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
86
- c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
87
- c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
88
- c53.7,-170.3,84.5,-266.8,92.5,-289.5z
89
- M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},JB=function(e,t){return`M424,`+(2398+e+t)+`
90
- c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
91
- c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
92
- s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
93
- s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
94
- l`+e/4.223+` -`+e+`c4,-6.7,10,-10,18,-10 H400000
95
- v`+(40+e)+`H1014.6
96
- s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
97
- c-2,6,-10,9,-24,9
98
- c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+` `+t+`
99
- h400000v`+(40+e)+`h-400000z`},YB=function(e,t){return`M473,`+(2713+e+t)+`
100
- c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+` -`+e+`
101
- c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
102
- s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
103
- c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
104
- c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
105
- s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
106
- 606zM`+(1001+e)+` `+t+`h400000v`+(40+e)+`H1017.7z`},XB=function(e){var t=e/2;return`M400000 `+e+` H0 L`+t+` 0 l65 45 L145 `+(e-80)+` H400000z`},ZB=function(e,t,n){var r=n-54-t-e;return`M702 `+(e+t)+`H400000`+(40+e)+`
107
- H742v`+r+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
108
- h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
109
- c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
110
- 219 661 l218 661zM702 `+t+`H400000v`+(40+e)+`H742z`},QB=function(e,t,n){t=1e3*t;var r=``;switch(e){case`sqrtMain`:r=GB(t,WB);break;case`sqrtSize1`:r=KB(t,WB);break;case`sqrtSize2`:r=qB(t,WB);break;case`sqrtSize3`:r=JB(t,WB);break;case`sqrtSize4`:r=YB(t,WB);break;case`sqrtTall`:r=ZB(t,WB,n)}return r},$B=function(e,t){switch(e){case`⎜`:return UB(`M291 0 H417 V`+t+` H291z`);case`∣`:return UB(`M145 0 H188 V`+t+` H145z`);case`∥`:return UB(`M145 0 H188 V`+t+` H145z`)+UB(`M367 0 H410 V`+t+` H367z`);case`⎟`:return UB(`M457 0 H583 V`+t+` H457z`);case`⎢`:return UB(`M319 0 H403 V`+t+` H319z`);case`⎥`:return UB(`M263 0 H347 V`+t+` H263z`);case`⎪`:return UB(`M384 0 H504 V`+t+` H384z`);case`⏐`:return UB(`M312 0 H355 V`+t+` H312z`);case`‖`:return UB(`M257 0 H300 V`+t+` H257z`)+UB(`M478 0 H521 V`+t+` H478z`);default:return``}},eV={doubleleftarrow:`M262 157
111
- l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
112
- 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
113
- 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
114
- c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
115
- 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
116
- -86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
117
- -2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
118
- m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
119
- -10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
120
- 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
121
- -33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
122
- -17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
123
- -13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
124
- c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
125
- -107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
126
- 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
127
- -5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
128
- c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
129
- 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
130
- 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
131
- l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
132
- -45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
133
- 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
134
- 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
135
- 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
136
- -331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
137
- H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
138
- 435 0h399565z`,leftgroupunder:`M400000 262
139
- H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
140
- 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
141
- -3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
142
- -18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
143
- -196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
144
- 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
145
- -4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
146
- -10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
147
- m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
148
- 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
149
- 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
150
- -152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
151
- 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
152
- -2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
153
- v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
154
- -83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
155
- -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
156
- 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:UB(`M40 281 V428 H0 V94 H40 V241 H400000 v40z`),leftbracketunder:UB(`M0 0 h120 V290 H399995 v120 H0z`),leftbracketover:UB(`M0 440 h120 V150 H399995 v-120 H0z`),leftmapsto:UB(`M40 281 V448H0V74H40V241H400000v40z`),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
157
- -.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
158
- c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
159
- 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:UB(`M0 50 h400000 v40H0z m0 194h40000v40H0z`),midbrace:`M200428 334
160
- c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
161
- -53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
162
- 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
163
- 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
164
- c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
165
- 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
166
- 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
167
- -5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
168
- -320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
169
- m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
170
- 60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
171
- -451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
172
- m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
173
- c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
174
- -480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
175
- m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
176
- 85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
177
- -707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
178
- m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
179
- c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
180
- -16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
181
- 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
182
- 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
183
- -40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
184
- -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
185
- 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
186
- -6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
187
- s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
188
- c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
189
- 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
190
- -174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
191
- 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
192
- 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
193
- -3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
194
- -10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
195
- 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
196
- -18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
197
- 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
198
- m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
199
- 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
200
- -7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
201
- -27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
202
- 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
203
- 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
204
- -64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
205
- m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
206
- 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
207
- -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
208
- 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:UB(`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`),rightbracketunder:UB(`M399995 0 h-120 V290 H0 v120 H400000z`),rightbracketover:UB(`M399995 440 h-120 V150 H0 v-120 H399995z`),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
209
- 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
210
- -52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
211
- -167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
212
- 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
213
- -70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
214
- -40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
215
- -37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
216
- 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
217
- c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
218
- 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
219
- 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
220
- -19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
221
- 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
222
- -2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
223
- 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
224
- 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
225
- -68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
226
- -8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
227
- 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
228
- c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
229
- 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
230
- -11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
231
- 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
232
- 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
233
- -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
234
- -11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
235
- 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
236
- 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
237
- -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
238
- 3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
239
- 10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
240
- -1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
241
- -7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
242
- H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
243
- c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
244
- c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
245
- -11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
246
- -11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
247
- -11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
248
- -5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
249
- -11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
250
- -11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
251
- -11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
252
- c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
253
- c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
254
- s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
255
- 121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
256
- s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
257
- c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
258
- M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
259
- -27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
260
- 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
261
- -84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
262
- -119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
263
- -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
264
- 151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
265
- c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
266
- c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
267
- c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
268
- c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
269
- M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
270
- c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
271
- -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
272
- c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
273
- M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
274
- c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
275
- 1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
276
- -152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
277
- M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
278
- c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
279
- -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
280
- c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
281
- M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},tV=function(e,t){switch(e){case`lbrack`:return`M403 1759 V84 H666 V0 H319 V1759 v`+t+` v1759 v84 h347 v-84
282
- H403z M403 1759 V0 H319 V1759 v`+t+` v1759 v84 h84z`;case`rbrack`:return`M347 1759 V0 H0 V84 H263 V1759 v`+t+` v1759 H0 v84 H347z
283
- M347 1759 V0 H263 V1759 v`+t+` v1759 h84z`;case`vert`:return`M145 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15
284
- c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
285
- c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+` v585 h43z`;case`doublevert`:return`M145 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15
286
- c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
287
- c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+` v585 h43z
288
- M367 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15
289
- c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
290
- c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+t+` v585 h43z`;case`lfloor`:return`M319 602 V0 H403 V602 v`+t+` v1715 h263 v84 H319z
291
- MM319 602 V0 H403 V602 v`+t+` v1715 H319z`;case`rfloor`:return`M319 602 V0 H403 V602 v`+t+` v1799 H0 v-84 H319z
292
- MM319 602 V0 H403 V602 v`+t+` v1715 H319z`;case`lceil`:return`M403 1759 V84 H666 V0 H319 V1759 v`+t+` v602 h84z
293
- M403 1759 V0 H319 V1759 v`+t+` v602 h84z`;case`rceil`:return`M347 1759 V0 H0 V84 H263 V1759 v`+t+` v602 h84z
294
- M347 1759 V0 h-84 V1759 v`+t+` v602 h84z`;case`lparen`:return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
295
- c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
296
- -36,557 l0,`+(t+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
297
- 949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
298
- c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
299
- -544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
300
- l0,-`+(t+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
301
- -210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case`rparen`:return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
302
- 63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
303
- c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(t+9)+`
304
- c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
305
- c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
306
- c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
307
- c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
308
- l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
309
- -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw Error(`Unknown stretchy delimiter.`)}};function nV(e){return`toText`in e}var rV=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e=``,t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>{if(nV(e))return e.toText();throw Error(`Expected MathDomNode with toText, got `+e.constructor.name)}).join(``)}},iV={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},aV={ex:!0,em:!0,mu:!0},oV=function(e){return typeof e!=`string`&&(e=e.unit),e in iV||e in aV||e===`ex`},sV=function(e,t){var n;if(e.unit in iV)n=iV[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit===`mu`)n=t.fontMetrics().cssEmPerMu;else{var r=t.style.isTight()?t.havingStyle(t.style.text()):t;if(e.unit===`ex`)n=r.fontMetrics().xHeight;else if(e.unit===`em`)n=r.fontMetrics().quad;else throw new z(`Invalid unit: '`+e.unit+`'`);r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},B=function(e){return+e.toFixed(4)+`em`},cV=function(e){return e.filter(e=>e).join(` `)},lV=function(e){var t=``;for(var n of Object.keys(e)){var r=e[n];r!==void 0&&(t+=lB(n)+`:`+r+`;`)}return t},uV=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push(`mtight`);var r=t.getColor();r&&(this.style.color=r)}},dV=function(e){var t=document.createElement(e);t.className=cV(this.classes),Object.assign(t.style,this.style);for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);for(var r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t},fV=/[\s"'>/=\x00-\x1f]/,pV=function(e){var t=`<`+e;this.classes.length&&(t+=` class="`+fB(cV(this.classes))+`"`);var n=lV(this.style);n&&(t+=` style="`+fB(n)+`"`);for(var r of Object.keys(this.attributes)){if(fV.test(r))throw new z(`Invalid attribute name '`+r+`'`);t+=` `+r+`="`+fB(this.attributes[r])+`"`}t+=`>`;for(var i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+=`</`+e+`>`,t},mV=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,uV.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return dV.call(this,`span`)}toMarkup(){return pV.call(this,`span`)}},hV=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,uV.call(this,t,r),this.children=n||[],this.setAttribute(`href`,e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return dV.call(this,`a`)}toMarkup(){return pV.call(this,`a`)}},gV=class{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=[`mord`],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement(`img`);return e.src=this.src,e.alt=this.alt,e.className=`mord`,Object.assign(e.style,this.style),e}toMarkup(){var e=`<img src="`+fB(this.src)+`"`+(` alt="`+fB(this.alt)+`"`),t=lV(this.style);return t&&(e+=` style="`+fB(t)+`"`),e+=`'/>`,e}},_V={î:`ı̂`,ï:`ı̈`,í:`ı́`,ì:`ı̀`},vV=class{constructor(e,t,n,r,i,a,o,s){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=i||0,this.width=a||0,this.classes=o||[],this.style=s||{},this.maxFontSize=0;var c=BB(this.text.charCodeAt(0));c&&this.classes.push(c+`_fallback`),/[îïíì]/.test(this.text)&&(this.text=_V[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;return this.italic>0&&(t=document.createElement(`span`),t.style.marginRight=B(this.italic)),this.classes.length>0&&(t||=document.createElement(`span`),t.className=cV(this.classes)),Object.keys(this.style).length>0&&(t||=document.createElement(`span`),Object.assign(t.style,this.style)),t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t=`<span`;this.classes.length&&(e=!0,t+=` class="`,t+=fB(cV(this.classes)),t+=`"`);var n=``;this.italic>0&&(n+=`margin-right:`+B(this.italic)+`;`),n+=lV(this.style),n&&(e=!0,t+=` style="`+fB(n)+`"`);var r=fB(this.text);return e?(t+=`>`,t+=r,t+=`</span>`,t):r}},yV=class{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);for(var n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){var e=`<svg xmlns="http://www.w3.org/2000/svg"`;for(var t of Object.keys(this.attributes))e+=` `+t+`="`+fB(this.attributes[t])+`"`;e+=`>`;for(var n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e+=`</svg>`,e}},bV=class{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return this.alternate?e.setAttribute(`d`,this.alternate):e.setAttribute(`d`,eV[this.pathName]),e}toMarkup(){return this.alternate?`<path d="`+fB(this.alternate)+`"/>`:`<path d="`+fB(eV[this.pathName])+`"/>`}},xV=class{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e=document.createElementNS(`http://www.w3.org/2000/svg`,`line`);for(var t of Object.keys(this.attributes))e.setAttribute(t,this.attributes[t]);return e}toMarkup(){var e=`<line`;for(var t of Object.keys(this.attributes))e+=` `+t+`="`+fB(this.attributes[t])+`"`;return e+=`/>`,e}};function SV(e){if(e instanceof vV)return e;throw Error(`Expected symbolNode but got `+String(e)+`.`)}function CV(e){if(e instanceof mV)return e;throw Error(`Expected span<HtmlDomNode> but got `+String(e)+`.`)}var wV=e=>e instanceof mV||e instanceof hV||e instanceof rV,TV={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},EV={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},DV={Å:`A`,Ð:`D`,Þ:`o`,å:`a`,ð:`d`,þ:`o`,А:`A`,Б:`B`,В:`B`,Г:`F`,Д:`A`,Е:`E`,Ж:`K`,З:`3`,И:`N`,Й:`N`,К:`K`,Л:`N`,М:`M`,Н:`H`,О:`O`,П:`N`,Р:`P`,С:`C`,Т:`T`,У:`y`,Ф:`O`,Х:`X`,Ц:`U`,Ч:`h`,Ш:`W`,Щ:`W`,Ъ:`B`,Ы:`X`,Ь:`B`,Э:`3`,Ю:`X`,Я:`R`,а:`a`,б:`b`,в:`a`,г:`r`,д:`y`,е:`e`,ж:`m`,з:`e`,и:`n`,й:`n`,к:`n`,л:`n`,м:`m`,н:`n`,о:`o`,п:`n`,р:`p`,с:`c`,т:`o`,у:`y`,ф:`b`,х:`x`,ц:`n`,ч:`n`,ш:`w`,щ:`w`,ъ:`a`,ы:`m`,ь:`a`,э:`e`,ю:`m`,я:`r`};function OV(e,t){TV[e]=t}function kV(e,t,n){if(!TV[t])throw Error(`Font metrics not found for font: `+t+`.`);var r=e.charCodeAt(0),i=TV[t][r];if(!i&&e[0]in DV&&(r=DV[e[0]].charCodeAt(0),i=TV[t][r]),!i&&n===`text`&&HB(r)&&(i=TV[t][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var AV={};function jV(e){var t=e>=5?0:e>=3?1:2;if(!AV[t]){var n=AV[t]={cssEmPerMu:EV.quad[t]/18};for(var r of Object.keys(EV))n[r]=EV[r][t]}return AV[t]}var MV={math:{},text:{}};function V(e,t,n,r,i,a){MV[e][i]={font:t,group:n,replace:r},a&&r&&(MV[e][r]=MV[e][i])}var H=`math`,U=`text`,W=`main`,G=`ams`,NV=`accent-token`,K=`bin`,PV=`close`,FV=`inner`,q=`mathord`,IV=`op-token`,LV=`open`,RV=`punct`,J=`rel`,zV=`spacing`,Y=`textord`;V(H,W,J,`≡`,`\\equiv`,!0),V(H,W,J,`≺`,`\\prec`,!0),V(H,W,J,`≻`,`\\succ`,!0),V(H,W,J,`∼`,`\\sim`,!0),V(H,W,J,`⊥`,`\\perp`),V(H,W,J,`⪯`,`\\preceq`,!0),V(H,W,J,`⪰`,`\\succeq`,!0),V(H,W,J,`≃`,`\\simeq`,!0),V(H,W,J,`∣`,`\\mid`,!0),V(H,W,J,`≪`,`\\ll`,!0),V(H,W,J,`≫`,`\\gg`,!0),V(H,W,J,`≍`,`\\asymp`,!0),V(H,W,J,`∥`,`\\parallel`),V(H,W,J,`⋈`,`\\bowtie`,!0),V(H,W,J,`⌣`,`\\smile`,!0),V(H,W,J,`⊑`,`\\sqsubseteq`,!0),V(H,W,J,`⊒`,`\\sqsupseteq`,!0),V(H,W,J,`≐`,`\\doteq`,!0),V(H,W,J,`⌢`,`\\frown`,!0),V(H,W,J,`∋`,`\\ni`,!0),V(H,W,J,`∝`,`\\propto`,!0),V(H,W,J,`⊢`,`\\vdash`,!0),V(H,W,J,`⊣`,`\\dashv`,!0),V(H,W,J,`∋`,`\\owns`),V(H,W,RV,`.`,`\\ldotp`),V(H,W,RV,`⋅`,`\\cdotp`),V(H,W,RV,`⋅`,`·`),V(U,W,Y,`⋅`,`·`),V(H,W,Y,`#`,`\\#`),V(U,W,Y,`#`,`\\#`),V(H,W,Y,`&`,`\\&`),V(U,W,Y,`&`,`\\&`),V(H,W,Y,`ℵ`,`\\aleph`,!0),V(H,W,Y,`∀`,`\\forall`,!0),V(H,W,Y,`ℏ`,`\\hbar`,!0),V(H,W,Y,`∃`,`\\exists`,!0),V(H,W,Y,`∇`,`\\nabla`,!0),V(H,W,Y,`♭`,`\\flat`,!0),V(H,W,Y,`ℓ`,`\\ell`,!0),V(H,W,Y,`♮`,`\\natural`,!0),V(H,W,Y,`♣`,`\\clubsuit`,!0),V(H,W,Y,`℘`,`\\wp`,!0),V(H,W,Y,`♯`,`\\sharp`,!0),V(H,W,Y,`♢`,`\\diamondsuit`,!0),V(H,W,Y,`ℜ`,`\\Re`,!0),V(H,W,Y,`♡`,`\\heartsuit`,!0),V(H,W,Y,`ℑ`,`\\Im`,!0),V(H,W,Y,`♠`,`\\spadesuit`,!0),V(H,W,Y,`§`,`\\S`,!0),V(U,W,Y,`§`,`\\S`),V(H,W,Y,`¶`,`\\P`,!0),V(U,W,Y,`¶`,`\\P`),V(H,W,Y,`†`,`\\dag`),V(U,W,Y,`†`,`\\dag`),V(U,W,Y,`†`,`\\textdagger`),V(H,W,Y,`‡`,`\\ddag`),V(U,W,Y,`‡`,`\\ddag`),V(U,W,Y,`‡`,`\\textdaggerdbl`),V(H,W,PV,`⎱`,`\\rmoustache`,!0),V(H,W,LV,`⎰`,`\\lmoustache`,!0),V(H,W,PV,`⟯`,`\\rgroup`,!0),V(H,W,LV,`⟮`,`\\lgroup`,!0),V(H,W,K,`∓`,`\\mp`,!0),V(H,W,K,`⊖`,`\\ominus`,!0),V(H,W,K,`⊎`,`\\uplus`,!0),V(H,W,K,`⊓`,`\\sqcap`,!0),V(H,W,K,`∗`,`\\ast`),V(H,W,K,`⊔`,`\\sqcup`,!0),V(H,W,K,`◯`,`\\bigcirc`,!0),V(H,W,K,`∙`,`\\bullet`,!0),V(H,W,K,`‡`,`\\ddagger`),V(H,W,K,`≀`,`\\wr`,!0),V(H,W,K,`⨿`,`\\amalg`),V(H,W,K,`&`,`\\And`),V(H,W,J,`⟵`,`\\longleftarrow`,!0),V(H,W,J,`⇐`,`\\Leftarrow`,!0),V(H,W,J,`⟸`,`\\Longleftarrow`,!0),V(H,W,J,`⟶`,`\\longrightarrow`,!0),V(H,W,J,`⇒`,`\\Rightarrow`,!0),V(H,W,J,`⟹`,`\\Longrightarrow`,!0),V(H,W,J,`↔`,`\\leftrightarrow`,!0),V(H,W,J,`⟷`,`\\longleftrightarrow`,!0),V(H,W,J,`⇔`,`\\Leftrightarrow`,!0),V(H,W,J,`⟺`,`\\Longleftrightarrow`,!0),V(H,W,J,`↦`,`\\mapsto`,!0),V(H,W,J,`⟼`,`\\longmapsto`,!0),V(H,W,J,`↗`,`\\nearrow`,!0),V(H,W,J,`↩`,`\\hookleftarrow`,!0),V(H,W,J,`↪`,`\\hookrightarrow`,!0),V(H,W,J,`↘`,`\\searrow`,!0),V(H,W,J,`↼`,`\\leftharpoonup`,!0),V(H,W,J,`⇀`,`\\rightharpoonup`,!0),V(H,W,J,`↙`,`\\swarrow`,!0),V(H,W,J,`↽`,`\\leftharpoondown`,!0),V(H,W,J,`⇁`,`\\rightharpoondown`,!0),V(H,W,J,`↖`,`\\nwarrow`,!0),V(H,W,J,`⇌`,`\\rightleftharpoons`,!0),V(H,G,J,`≮`,`\\nless`,!0),V(H,G,J,``,`\\@nleqslant`),V(H,G,J,``,`\\@nleqq`),V(H,G,J,`⪇`,`\\lneq`,!0),V(H,G,J,`≨`,`\\lneqq`,!0),V(H,G,J,``,`\\@lvertneqq`),V(H,G,J,`⋦`,`\\lnsim`,!0),V(H,G,J,`⪉`,`\\lnapprox`,!0),V(H,G,J,`⊀`,`\\nprec`,!0),V(H,G,J,`⋠`,`\\npreceq`,!0),V(H,G,J,`⋨`,`\\precnsim`,!0),V(H,G,J,`⪹`,`\\precnapprox`,!0),V(H,G,J,`≁`,`\\nsim`,!0),V(H,G,J,``,`\\@nshortmid`),V(H,G,J,`∤`,`\\nmid`,!0),V(H,G,J,`⊬`,`\\nvdash`,!0),V(H,G,J,`⊭`,`\\nvDash`,!0),V(H,G,J,`⋪`,`\\ntriangleleft`),V(H,G,J,`⋬`,`\\ntrianglelefteq`,!0),V(H,G,J,`⊊`,`\\subsetneq`,!0),V(H,G,J,``,`\\@varsubsetneq`),V(H,G,J,`⫋`,`\\subsetneqq`,!0),V(H,G,J,``,`\\@varsubsetneqq`),V(H,G,J,`≯`,`\\ngtr`,!0),V(H,G,J,``,`\\@ngeqslant`),V(H,G,J,``,`\\@ngeqq`),V(H,G,J,`⪈`,`\\gneq`,!0),V(H,G,J,`≩`,`\\gneqq`,!0),V(H,G,J,``,`\\@gvertneqq`),V(H,G,J,`⋧`,`\\gnsim`,!0),V(H,G,J,`⪊`,`\\gnapprox`,!0),V(H,G,J,`⊁`,`\\nsucc`,!0),V(H,G,J,`⋡`,`\\nsucceq`,!0),V(H,G,J,`⋩`,`\\succnsim`,!0),V(H,G,J,`⪺`,`\\succnapprox`,!0),V(H,G,J,`≆`,`\\ncong`,!0),V(H,G,J,``,`\\@nshortparallel`),V(H,G,J,`∦`,`\\nparallel`,!0),V(H,G,J,`⊯`,`\\nVDash`,!0),V(H,G,J,`⋫`,`\\ntriangleright`),V(H,G,J,`⋭`,`\\ntrianglerighteq`,!0),V(H,G,J,``,`\\@nsupseteqq`),V(H,G,J,`⊋`,`\\supsetneq`,!0),V(H,G,J,``,`\\@varsupsetneq`),V(H,G,J,`⫌`,`\\supsetneqq`,!0),V(H,G,J,``,`\\@varsupsetneqq`),V(H,G,J,`⊮`,`\\nVdash`,!0),V(H,G,J,`⪵`,`\\precneqq`,!0),V(H,G,J,`⪶`,`\\succneqq`,!0),V(H,G,J,``,`\\@nsubseteqq`),V(H,G,K,`⊴`,`\\unlhd`),V(H,G,K,`⊵`,`\\unrhd`),V(H,G,J,`↚`,`\\nleftarrow`,!0),V(H,G,J,`↛`,`\\nrightarrow`,!0),V(H,G,J,`⇍`,`\\nLeftarrow`,!0),V(H,G,J,`⇏`,`\\nRightarrow`,!0),V(H,G,J,`↮`,`\\nleftrightarrow`,!0),V(H,G,J,`⇎`,`\\nLeftrightarrow`,!0),V(H,G,J,`△`,`\\vartriangle`),V(H,G,Y,`ℏ`,`\\hslash`),V(H,G,Y,`▽`,`\\triangledown`),V(H,G,Y,`◊`,`\\lozenge`),V(H,G,Y,`Ⓢ`,`\\circledS`),V(H,G,Y,`®`,`\\circledR`),V(U,G,Y,`®`,`\\circledR`),V(H,G,Y,`∡`,`\\measuredangle`,!0),V(H,G,Y,`∄`,`\\nexists`),V(H,G,Y,`℧`,`\\mho`),V(H,G,Y,`Ⅎ`,`\\Finv`,!0),V(H,G,Y,`⅁`,`\\Game`,!0),V(H,G,Y,`‵`,`\\backprime`),V(H,G,Y,`▲`,`\\blacktriangle`),V(H,G,Y,`▼`,`\\blacktriangledown`),V(H,G,Y,`■`,`\\blacksquare`),V(H,G,Y,`⧫`,`\\blacklozenge`),V(H,G,Y,`★`,`\\bigstar`),V(H,G,Y,`∢`,`\\sphericalangle`,!0),V(H,G,Y,`∁`,`\\complement`,!0),V(H,G,Y,`ð`,`\\eth`,!0),V(U,W,Y,`ð`,`ð`),V(H,G,Y,`╱`,`\\diagup`),V(H,G,Y,`╲`,`\\diagdown`),V(H,G,Y,`□`,`\\square`),V(H,G,Y,`□`,`\\Box`),V(H,G,Y,`◊`,`\\Diamond`),V(H,G,Y,`¥`,`\\yen`,!0),V(U,G,Y,`¥`,`\\yen`,!0),V(H,G,Y,`✓`,`\\checkmark`,!0),V(U,G,Y,`✓`,`\\checkmark`),V(H,G,Y,`ℶ`,`\\beth`,!0),V(H,G,Y,`ℸ`,`\\daleth`,!0),V(H,G,Y,`ℷ`,`\\gimel`,!0),V(H,G,Y,`ϝ`,`\\digamma`,!0),V(H,G,Y,`ϰ`,`\\varkappa`),V(H,G,LV,`┌`,`\\@ulcorner`,!0),V(H,G,PV,`┐`,`\\@urcorner`,!0),V(H,G,LV,`└`,`\\@llcorner`,!0),V(H,G,PV,`┘`,`\\@lrcorner`,!0),V(H,G,J,`≦`,`\\leqq`,!0),V(H,G,J,`⩽`,`\\leqslant`,!0),V(H,G,J,`⪕`,`\\eqslantless`,!0),V(H,G,J,`≲`,`\\lesssim`,!0),V(H,G,J,`⪅`,`\\lessapprox`,!0),V(H,G,J,`≊`,`\\approxeq`,!0),V(H,G,K,`⋖`,`\\lessdot`),V(H,G,J,`⋘`,`\\lll`,!0),V(H,G,J,`≶`,`\\lessgtr`,!0),V(H,G,J,`⋚`,`\\lesseqgtr`,!0),V(H,G,J,`⪋`,`\\lesseqqgtr`,!0),V(H,G,J,`≑`,`\\doteqdot`),V(H,G,J,`≓`,`\\risingdotseq`,!0),V(H,G,J,`≒`,`\\fallingdotseq`,!0),V(H,G,J,`∽`,`\\backsim`,!0),V(H,G,J,`⋍`,`\\backsimeq`,!0),V(H,G,J,`⫅`,`\\subseteqq`,!0),V(H,G,J,`⋐`,`\\Subset`,!0),V(H,G,J,`⊏`,`\\sqsubset`,!0),V(H,G,J,`≼`,`\\preccurlyeq`,!0),V(H,G,J,`⋞`,`\\curlyeqprec`,!0),V(H,G,J,`≾`,`\\precsim`,!0),V(H,G,J,`⪷`,`\\precapprox`,!0),V(H,G,J,`⊲`,`\\vartriangleleft`),V(H,G,J,`⊴`,`\\trianglelefteq`),V(H,G,J,`⊨`,`\\vDash`,!0),V(H,G,J,`⊪`,`\\Vvdash`,!0),V(H,G,J,`⌣`,`\\smallsmile`),V(H,G,J,`⌢`,`\\smallfrown`),V(H,G,J,`≏`,`\\bumpeq`,!0),V(H,G,J,`≎`,`\\Bumpeq`,!0),V(H,G,J,`≧`,`\\geqq`,!0),V(H,G,J,`⩾`,`\\geqslant`,!0),V(H,G,J,`⪖`,`\\eqslantgtr`,!0),V(H,G,J,`≳`,`\\gtrsim`,!0),V(H,G,J,`⪆`,`\\gtrapprox`,!0),V(H,G,K,`⋗`,`\\gtrdot`),V(H,G,J,`⋙`,`\\ggg`,!0),V(H,G,J,`≷`,`\\gtrless`,!0),V(H,G,J,`⋛`,`\\gtreqless`,!0),V(H,G,J,`⪌`,`\\gtreqqless`,!0),V(H,G,J,`≖`,`\\eqcirc`,!0),V(H,G,J,`≗`,`\\circeq`,!0),V(H,G,J,`≜`,`\\triangleq`,!0),V(H,G,J,`∼`,`\\thicksim`),V(H,G,J,`≈`,`\\thickapprox`),V(H,G,J,`⫆`,`\\supseteqq`,!0),V(H,G,J,`⋑`,`\\Supset`,!0),V(H,G,J,`⊐`,`\\sqsupset`,!0),V(H,G,J,`≽`,`\\succcurlyeq`,!0),V(H,G,J,`⋟`,`\\curlyeqsucc`,!0),V(H,G,J,`≿`,`\\succsim`,!0),V(H,G,J,`⪸`,`\\succapprox`,!0),V(H,G,J,`⊳`,`\\vartriangleright`),V(H,G,J,`⊵`,`\\trianglerighteq`),V(H,G,J,`⊩`,`\\Vdash`,!0),V(H,G,J,`∣`,`\\shortmid`),V(H,G,J,`∥`,`\\shortparallel`),V(H,G,J,`≬`,`\\between`,!0),V(H,G,J,`⋔`,`\\pitchfork`,!0),V(H,G,J,`∝`,`\\varpropto`),V(H,G,J,`◀`,`\\blacktriangleleft`),V(H,G,J,`∴`,`\\therefore`,!0),V(H,G,J,`∍`,`\\backepsilon`),V(H,G,J,`▶`,`\\blacktriangleright`),V(H,G,J,`∵`,`\\because`,!0),V(H,G,J,`⋘`,`\\llless`),V(H,G,J,`⋙`,`\\gggtr`),V(H,G,K,`⊲`,`\\lhd`),V(H,G,K,`⊳`,`\\rhd`),V(H,G,J,`≂`,`\\eqsim`,!0),V(H,W,J,`⋈`,`\\Join`),V(H,G,J,`≑`,`\\Doteq`,!0),V(H,G,K,`∔`,`\\dotplus`,!0),V(H,G,K,`∖`,`\\smallsetminus`),V(H,G,K,`⋒`,`\\Cap`,!0),V(H,G,K,`⋓`,`\\Cup`,!0),V(H,G,K,`⩞`,`\\doublebarwedge`,!0),V(H,G,K,`⊟`,`\\boxminus`,!0),V(H,G,K,`⊞`,`\\boxplus`,!0),V(H,G,K,`⋇`,`\\divideontimes`,!0),V(H,G,K,`⋉`,`\\ltimes`,!0),V(H,G,K,`⋊`,`\\rtimes`,!0),V(H,G,K,`⋋`,`\\leftthreetimes`,!0),V(H,G,K,`⋌`,`\\rightthreetimes`,!0),V(H,G,K,`⋏`,`\\curlywedge`,!0),V(H,G,K,`⋎`,`\\curlyvee`,!0),V(H,G,K,`⊝`,`\\circleddash`,!0),V(H,G,K,`⊛`,`\\circledast`,!0),V(H,G,K,`⋅`,`\\centerdot`),V(H,G,K,`⊺`,`\\intercal`,!0),V(H,G,K,`⋒`,`\\doublecap`),V(H,G,K,`⋓`,`\\doublecup`),V(H,G,K,`⊠`,`\\boxtimes`,!0),V(H,G,J,`⇢`,`\\dashrightarrow`,!0),V(H,G,J,`⇠`,`\\dashleftarrow`,!0),V(H,G,J,`⇇`,`\\leftleftarrows`,!0),V(H,G,J,`⇆`,`\\leftrightarrows`,!0),V(H,G,J,`⇚`,`\\Lleftarrow`,!0),V(H,G,J,`↞`,`\\twoheadleftarrow`,!0),V(H,G,J,`↢`,`\\leftarrowtail`,!0),V(H,G,J,`↫`,`\\looparrowleft`,!0),V(H,G,J,`⇋`,`\\leftrightharpoons`,!0),V(H,G,J,`↶`,`\\curvearrowleft`,!0),V(H,G,J,`↺`,`\\circlearrowleft`,!0),V(H,G,J,`↰`,`\\Lsh`,!0),V(H,G,J,`⇈`,`\\upuparrows`,!0),V(H,G,J,`↿`,`\\upharpoonleft`,!0),V(H,G,J,`⇃`,`\\downharpoonleft`,!0),V(H,W,J,`⊶`,`\\origof`,!0),V(H,W,J,`⊷`,`\\imageof`,!0),V(H,G,J,`⊸`,`\\multimap`,!0),V(H,G,J,`↭`,`\\leftrightsquigarrow`,!0),V(H,G,J,`⇉`,`\\rightrightarrows`,!0),V(H,G,J,`⇄`,`\\rightleftarrows`,!0),V(H,G,J,`↠`,`\\twoheadrightarrow`,!0),V(H,G,J,`↣`,`\\rightarrowtail`,!0),V(H,G,J,`↬`,`\\looparrowright`,!0),V(H,G,J,`↷`,`\\curvearrowright`,!0),V(H,G,J,`↻`,`\\circlearrowright`,!0),V(H,G,J,`↱`,`\\Rsh`,!0),V(H,G,J,`⇊`,`\\downdownarrows`,!0),V(H,G,J,`↾`,`\\upharpoonright`,!0),V(H,G,J,`⇂`,`\\downharpoonright`,!0),V(H,G,J,`⇝`,`\\rightsquigarrow`,!0),V(H,G,J,`⇝`,`\\leadsto`),V(H,G,J,`⇛`,`\\Rrightarrow`,!0),V(H,G,J,`↾`,`\\restriction`),V(H,W,Y,`‘`,"`"),V(H,W,Y,`$`,`\\$`),V(U,W,Y,`$`,`\\$`),V(U,W,Y,`$`,`\\textdollar`),V(H,W,Y,`%`,`\\%`),V(U,W,Y,`%`,`\\%`),V(H,W,Y,`_`,`\\_`),V(U,W,Y,`_`,`\\_`),V(U,W,Y,`_`,`\\textunderscore`),V(H,W,Y,`∠`,`\\angle`,!0),V(H,W,Y,`∞`,`\\infty`,!0),V(H,W,Y,`′`,`\\prime`),V(H,W,Y,`△`,`\\triangle`),V(H,W,Y,`Γ`,`\\Gamma`,!0),V(H,W,Y,`Δ`,`\\Delta`,!0),V(H,W,Y,`Θ`,`\\Theta`,!0),V(H,W,Y,`Λ`,`\\Lambda`,!0),V(H,W,Y,`Ξ`,`\\Xi`,!0),V(H,W,Y,`Π`,`\\Pi`,!0),V(H,W,Y,`Σ`,`\\Sigma`,!0),V(H,W,Y,`Υ`,`\\Upsilon`,!0),V(H,W,Y,`Φ`,`\\Phi`,!0),V(H,W,Y,`Ψ`,`\\Psi`,!0),V(H,W,Y,`Ω`,`\\Omega`,!0),V(H,W,Y,`A`,`Α`),V(H,W,Y,`B`,`Β`),V(H,W,Y,`E`,`Ε`),V(H,W,Y,`Z`,`Ζ`),V(H,W,Y,`H`,`Η`),V(H,W,Y,`I`,`Ι`),V(H,W,Y,`K`,`Κ`),V(H,W,Y,`M`,`Μ`),V(H,W,Y,`N`,`Ν`),V(H,W,Y,`O`,`Ο`),V(H,W,Y,`P`,`Ρ`),V(H,W,Y,`T`,`Τ`),V(H,W,Y,`X`,`Χ`),V(H,W,Y,`¬`,`\\neg`,!0),V(H,W,Y,`¬`,`\\lnot`),V(H,W,Y,`⊤`,`\\top`),V(H,W,Y,`⊥`,`\\bot`),V(H,W,Y,`∅`,`\\emptyset`),V(H,G,Y,`∅`,`\\varnothing`),V(H,W,q,`α`,`\\alpha`,!0),V(H,W,q,`β`,`\\beta`,!0),V(H,W,q,`γ`,`\\gamma`,!0),V(H,W,q,`δ`,`\\delta`,!0),V(H,W,q,`ϵ`,`\\epsilon`,!0),V(H,W,q,`ζ`,`\\zeta`,!0),V(H,W,q,`η`,`\\eta`,!0),V(H,W,q,`θ`,`\\theta`,!0),V(H,W,q,`ι`,`\\iota`,!0),V(H,W,q,`κ`,`\\kappa`,!0),V(H,W,q,`λ`,`\\lambda`,!0),V(H,W,q,`μ`,`\\mu`,!0),V(H,W,q,`ν`,`\\nu`,!0),V(H,W,q,`ξ`,`\\xi`,!0),V(H,W,q,`ο`,`\\omicron`,!0),V(H,W,q,`π`,`\\pi`,!0),V(H,W,q,`ρ`,`\\rho`,!0),V(H,W,q,`σ`,`\\sigma`,!0),V(H,W,q,`τ`,`\\tau`,!0),V(H,W,q,`υ`,`\\upsilon`,!0),V(H,W,q,`ϕ`,`\\phi`,!0),V(H,W,q,`χ`,`\\chi`,!0),V(H,W,q,`ψ`,`\\psi`,!0),V(H,W,q,`ω`,`\\omega`,!0),V(H,W,q,`ε`,`\\varepsilon`,!0),V(H,W,q,`ϑ`,`\\vartheta`,!0),V(H,W,q,`ϖ`,`\\varpi`,!0),V(H,W,q,`ϱ`,`\\varrho`,!0),V(H,W,q,`ς`,`\\varsigma`,!0),V(H,W,q,`φ`,`\\varphi`,!0),V(H,W,K,`∗`,`*`,!0),V(H,W,K,`+`,`+`),V(H,W,K,`−`,`-`,!0),V(H,W,K,`⋅`,`\\cdot`,!0),V(H,W,K,`∘`,`\\circ`,!0),V(H,W,K,`÷`,`\\div`,!0),V(H,W,K,`±`,`\\pm`,!0),V(H,W,K,`×`,`\\times`,!0),V(H,W,K,`∩`,`\\cap`,!0),V(H,W,K,`∪`,`\\cup`,!0),V(H,W,K,`∖`,`\\setminus`,!0),V(H,W,K,`∧`,`\\land`),V(H,W,K,`∨`,`\\lor`),V(H,W,K,`∧`,`\\wedge`,!0),V(H,W,K,`∨`,`\\vee`,!0),V(H,W,Y,`√`,`\\surd`),V(H,W,LV,`⟨`,`\\langle`,!0),V(H,W,LV,`∣`,`\\lvert`),V(H,W,LV,`∥`,`\\lVert`),V(H,W,PV,`?`,`?`),V(H,W,PV,`!`,`!`),V(H,W,PV,`⟩`,`\\rangle`,!0),V(H,W,PV,`∣`,`\\rvert`),V(H,W,PV,`∥`,`\\rVert`),V(H,W,J,`=`,`=`),V(H,W,J,`:`,`:`),V(H,W,J,`≈`,`\\approx`,!0),V(H,W,J,`≅`,`\\cong`,!0),V(H,W,J,`≥`,`\\ge`),V(H,W,J,`≥`,`\\geq`,!0),V(H,W,J,`←`,`\\gets`),V(H,W,J,`>`,`\\gt`,!0),V(H,W,J,`∈`,`\\in`,!0),V(H,W,J,``,`\\@not`),V(H,W,J,`⊂`,`\\subset`,!0),V(H,W,J,`⊃`,`\\supset`,!0),V(H,W,J,`⊆`,`\\subseteq`,!0),V(H,W,J,`⊇`,`\\supseteq`,!0),V(H,G,J,`⊈`,`\\nsubseteq`,!0),V(H,G,J,`⊉`,`\\nsupseteq`,!0),V(H,W,J,`⊨`,`\\models`),V(H,W,J,`←`,`\\leftarrow`,!0),V(H,W,J,`≤`,`\\le`),V(H,W,J,`≤`,`\\leq`,!0),V(H,W,J,`<`,`\\lt`,!0),V(H,W,J,`→`,`\\rightarrow`,!0),V(H,W,J,`→`,`\\to`),V(H,G,J,`≱`,`\\ngeq`,!0),V(H,G,J,`≰`,`\\nleq`,!0),V(H,W,zV,`\xA0`,`\\ `),V(H,W,zV,`\xA0`,`\\space`),V(H,W,zV,`\xA0`,`\\nobreakspace`),V(U,W,zV,`\xA0`,`\\ `),V(U,W,zV,`\xA0`,` `),V(U,W,zV,`\xA0`,`\\space`),V(U,W,zV,`\xA0`,`\\nobreakspace`),V(H,W,zV,``,`\\nobreak`),V(H,W,zV,``,`\\allowbreak`),V(H,W,RV,`,`,`,`),V(H,W,RV,`;`,`;`),V(H,G,K,`⊼`,`\\barwedge`,!0),V(H,G,K,`⊻`,`\\veebar`,!0),V(H,W,K,`⊙`,`\\odot`,!0),V(H,W,K,`⊕`,`\\oplus`,!0),V(H,W,K,`⊗`,`\\otimes`,!0),V(H,W,Y,`∂`,`\\partial`,!0),V(H,W,K,`⊘`,`\\oslash`,!0),V(H,G,K,`⊚`,`\\circledcirc`,!0),V(H,G,K,`⊡`,`\\boxdot`,!0),V(H,W,K,`△`,`\\bigtriangleup`),V(H,W,K,`▽`,`\\bigtriangledown`),V(H,W,K,`†`,`\\dagger`),V(H,W,K,`⋄`,`\\diamond`),V(H,W,K,`⋆`,`\\star`),V(H,W,K,`◃`,`\\triangleleft`),V(H,W,K,`▹`,`\\triangleright`),V(H,W,LV,`{`,`\\{`),V(U,W,Y,`{`,`\\{`),V(U,W,Y,`{`,`\\textbraceleft`),V(H,W,PV,`}`,`\\}`),V(U,W,Y,`}`,`\\}`),V(U,W,Y,`}`,`\\textbraceright`),V(H,W,LV,`{`,`\\lbrace`),V(H,W,PV,`}`,`\\rbrace`),V(H,W,LV,`[`,`\\lbrack`,!0),V(U,W,Y,`[`,`\\lbrack`,!0),V(H,W,PV,`]`,`\\rbrack`,!0),V(U,W,Y,`]`,`\\rbrack`,!0),V(H,W,LV,`(`,`\\lparen`,!0),V(H,W,PV,`)`,`\\rparen`,!0),V(U,W,Y,`<`,`\\textless`,!0),V(U,W,Y,`>`,`\\textgreater`,!0),V(H,W,LV,`⌊`,`\\lfloor`,!0),V(H,W,PV,`⌋`,`\\rfloor`,!0),V(H,W,LV,`⌈`,`\\lceil`,!0),V(H,W,PV,`⌉`,`\\rceil`,!0),V(H,W,Y,`\\`,`\\backslash`),V(H,W,Y,`∣`,`|`),V(H,W,Y,`∣`,`\\vert`),V(U,W,Y,`|`,`\\textbar`,!0),V(H,W,Y,`∥`,`\\|`),V(H,W,Y,`∥`,`\\Vert`),V(U,W,Y,`∥`,`\\textbardbl`),V(U,W,Y,`~`,`\\textasciitilde`),V(U,W,Y,`\\`,`\\textbackslash`),V(U,W,Y,`^`,`\\textasciicircum`),V(H,W,J,`↑`,`\\uparrow`,!0),V(H,W,J,`⇑`,`\\Uparrow`,!0),V(H,W,J,`↓`,`\\downarrow`,!0),V(H,W,J,`⇓`,`\\Downarrow`,!0),V(H,W,J,`↕`,`\\updownarrow`,!0),V(H,W,J,`⇕`,`\\Updownarrow`,!0),V(H,W,IV,`∐`,`\\coprod`),V(H,W,IV,`⋁`,`\\bigvee`),V(H,W,IV,`⋀`,`\\bigwedge`),V(H,W,IV,`⨄`,`\\biguplus`),V(H,W,IV,`⋂`,`\\bigcap`),V(H,W,IV,`⋃`,`\\bigcup`),V(H,W,IV,`∫`,`\\int`),V(H,W,IV,`∫`,`\\intop`),V(H,W,IV,`∬`,`\\iint`),V(H,W,IV,`∭`,`\\iiint`),V(H,W,IV,`∏`,`\\prod`),V(H,W,IV,`∑`,`\\sum`),V(H,W,IV,`⨂`,`\\bigotimes`),V(H,W,IV,`⨁`,`\\bigoplus`),V(H,W,IV,`⨀`,`\\bigodot`),V(H,W,IV,`∮`,`\\oint`),V(H,W,IV,`∯`,`\\oiint`),V(H,W,IV,`∰`,`\\oiiint`),V(H,W,IV,`⨆`,`\\bigsqcup`),V(H,W,IV,`∫`,`\\smallint`),V(U,W,FV,`…`,`\\textellipsis`),V(H,W,FV,`…`,`\\mathellipsis`),V(U,W,FV,`…`,`\\ldots`,!0),V(H,W,FV,`…`,`\\ldots`,!0),V(H,W,FV,`⋯`,`\\@cdots`,!0),V(H,W,FV,`⋱`,`\\ddots`,!0),V(H,W,Y,`⋮`,`\\varvdots`),V(U,W,Y,`⋮`,`\\varvdots`),V(H,W,NV,`ˊ`,`\\acute`),V(H,W,NV,`ˋ`,`\\grave`),V(H,W,NV,`¨`,`\\ddot`),V(H,W,NV,`~`,`\\tilde`),V(H,W,NV,`ˉ`,`\\bar`),V(H,W,NV,`˘`,`\\breve`),V(H,W,NV,`ˇ`,`\\check`),V(H,W,NV,`^`,`\\hat`),V(H,W,NV,`⃗`,`\\vec`),V(H,W,NV,`˙`,`\\dot`),V(H,W,NV,`˚`,`\\mathring`),V(H,W,q,``,`\\@imath`),V(H,W,q,``,`\\@jmath`),V(H,W,Y,`ı`,`ı`),V(H,W,Y,`ȷ`,`ȷ`),V(U,W,Y,`ı`,`\\i`,!0),V(U,W,Y,`ȷ`,`\\j`,!0),V(U,W,Y,`ß`,`\\ss`,!0),V(U,W,Y,`æ`,`\\ae`,!0),V(U,W,Y,`œ`,`\\oe`,!0),V(U,W,Y,`ø`,`\\o`,!0),V(U,W,Y,`Æ`,`\\AE`,!0),V(U,W,Y,`Œ`,`\\OE`,!0),V(U,W,Y,`Ø`,`\\O`,!0),V(U,W,NV,`ˊ`,`\\'`),V(U,W,NV,`ˋ`,"\\`"),V(U,W,NV,`ˆ`,`\\^`),V(U,W,NV,`˜`,`\\~`),V(U,W,NV,`ˉ`,`\\=`),V(U,W,NV,`˘`,`\\u`),V(U,W,NV,`˙`,`\\.`),V(U,W,NV,`¸`,`\\c`),V(U,W,NV,`˚`,`\\r`),V(U,W,NV,`ˇ`,`\\v`),V(U,W,NV,`¨`,`\\"`),V(U,W,NV,`˝`,`\\H`),V(U,W,NV,`◯`,`\\textcircled`);var BV={"--":!0,"---":!0,"``":!0,"''":!0};V(U,W,Y,`–`,`--`,!0),V(U,W,Y,`–`,`\\textendash`),V(U,W,Y,`—`,`---`,!0),V(U,W,Y,`—`,`\\textemdash`),V(U,W,Y,`‘`,"`",!0),V(U,W,Y,`‘`,`\\textquoteleft`),V(U,W,Y,`’`,`'`,!0),V(U,W,Y,`’`,`\\textquoteright`),V(U,W,Y,`“`,"``",!0),V(U,W,Y,`“`,`\\textquotedblleft`),V(U,W,Y,`”`,`''`,!0),V(U,W,Y,`”`,`\\textquotedblright`),V(H,W,Y,`°`,`\\degree`,!0),V(U,W,Y,`°`,`\\degree`),V(U,W,Y,`°`,`\\textdegree`,!0),V(H,W,Y,`£`,`\\pounds`),V(H,W,Y,`£`,`\\mathsterling`,!0),V(U,W,Y,`£`,`\\pounds`),V(U,W,Y,`£`,`\\textsterling`,!0),V(H,G,Y,`✠`,`\\maltese`),V(U,G,Y,`✠`,`\\maltese`);for(var VV=`0123456789/@."`,HV=0;HV<VV.length;HV++){var UV=VV.charAt(HV);V(H,W,Y,UV,UV)}for(var WV=`0123456789!@*()-=+";:?/.,`,GV=0;GV<WV.length;GV++){var KV=WV.charAt(GV);V(U,W,Y,KV,KV)}for(var qV=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,JV=0;JV<qV.length;JV++){var YV=qV.charAt(JV);V(H,W,q,YV,YV),V(U,W,Y,YV,YV)}V(H,G,Y,`C`,`ℂ`),V(U,G,Y,`C`,`ℂ`),V(H,G,Y,`H`,`ℍ`),V(U,G,Y,`H`,`ℍ`),V(H,G,Y,`N`,`ℕ`),V(U,G,Y,`N`,`ℕ`),V(H,G,Y,`P`,`ℙ`),V(U,G,Y,`P`,`ℙ`),V(H,G,Y,`Q`,`ℚ`),V(U,G,Y,`Q`,`ℚ`),V(H,G,Y,`R`,`ℝ`),V(U,G,Y,`R`,`ℝ`),V(H,G,Y,`Z`,`ℤ`),V(U,G,Y,`Z`,`ℤ`),V(H,W,q,`h`,`ℎ`),V(U,W,q,`h`,`ℎ`);for(var XV,ZV=0;ZV<qV.length;ZV++){var QV=qV.charAt(ZV);XV=String.fromCharCode(55349,56320+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),XV=String.fromCharCode(55349,56372+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),XV=String.fromCharCode(55349,56424+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),XV=String.fromCharCode(55349,56580+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),XV=String.fromCharCode(55349,56684+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),XV=String.fromCharCode(55349,56736+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),XV=String.fromCharCode(55349,56788+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),XV=String.fromCharCode(55349,56840+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),XV=String.fromCharCode(55349,56944+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),ZV<26&&(XV=String.fromCharCode(55349,56632+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV),XV=String.fromCharCode(55349,56476+ZV),V(H,W,q,QV,XV),V(U,W,Y,QV,XV))}XV=String.fromCharCode(55349,56668),V(H,W,q,`k`,XV),V(U,W,Y,`k`,XV);for(var $V=0;$V<10;$V++){var eH=$V.toString();XV=String.fromCharCode(55349,57294+$V),V(H,W,q,eH,XV),V(U,W,Y,eH,XV),XV=String.fromCharCode(55349,57314+$V),V(H,W,q,eH,XV),V(U,W,Y,eH,XV),XV=String.fromCharCode(55349,57324+$V),V(H,W,q,eH,XV),V(U,W,Y,eH,XV),XV=String.fromCharCode(55349,57334+$V),V(H,W,q,eH,XV),V(U,W,Y,eH,XV)}for(var tH=`ÐÞþ`,nH=0;nH<tH.length;nH++){var rH=tH.charAt(nH);V(H,W,q,rH,rH),V(U,W,Y,rH,rH)}var iH={mathClass:`mathbf`,textClass:`textbf`,font:`Main-Bold`},aH={mathClass:`mathnormal`,textClass:`textit`,font:`Math-Italic`},oH={mathClass:`boldsymbol`,textClass:`boldsymbol`,font:`Main-BoldItalic`},sH={mathClass:`mathscr`,textClass:`textscr`,font:`Script-Regular`},cH={mathClass:``,textClass:``,font:``},lH={mathClass:`mathfrak`,textClass:`textfrak`,font:`Fraktur-Regular`},uH={mathClass:`mathbb`,textClass:`textbb`,font:`AMS-Regular`},dH={mathClass:`mathboldfrak`,textClass:`textboldfrak`,font:`Fraktur-Regular`},fH={mathClass:`mathsf`,textClass:`textsf`,font:`SansSerif-Regular`},pH={mathClass:`mathboldsf`,textClass:`textboldsf`,font:`SansSerif-Bold`},mH={mathClass:`mathitsf`,textClass:`textitsf`,font:`SansSerif-Italic`},hH={mathClass:`mathtt`,textClass:`texttt`,font:`Typewriter-Regular`},gH=[iH,iH,aH,aH,oH,oH,sH,cH,cH,cH,lH,lH,uH,uH,dH,dH,fH,fH,pH,pH,mH,mH,cH,cH,hH,hH],_H=[iH,cH,fH,pH,hH],vH=e=>{var t=e.charCodeAt(0),n=e.charCodeAt(1),r=(t-55296)*1024+(n-56320)+65536;if(119808<=r&&r<120484)return gH[Math.floor((r-119808)/26)];if(120782<=r&&r<=120831)return _H[Math.floor((r-120782)/10)];if(r===120485||r===120486)return gH[0];if(120486<r&&r<120782)return cH;throw new z(`Unsupported character: `+e)};function yH(e){var t=e.strict,n=e.errorCode,r=e.errorMsg,i=e.token,a=e.report,o=t;if(typeof t==`function`){if(a)o=t(n,r,i);else try{o=t(n,r,i)}catch{o=`error`}}switch(o){case!0:case`error`:if(a)throw new z(`LaTeX-incompatible input and strict mode is set to 'error': `+(r+` [`+n+`]`),i);return!0;case!1:case`ignore`:if(!a)return!1;break;default:if(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(r+` [`+n+`]`)),!a)return!1}}var bH=function(e,t,n){if(MV[n][e]){var r=MV[n][e].replace;r&&(e=r)}return{value:e,metrics:kV(e,t,n)}},xH=function(e,t,n,r,i){var a=bH(e,t,n),o=a.metrics;e=a.value;var s;if(o){var c=o.italic;(n===`text`||r&&r.font===`mathit`)&&(c=0),s=new vV(e,o.height,o.depth,c,o.skew,o.width,i)}else yH({strict:r.strict,errorCode:`symbolNotInFont`,errorMsg:`No character metrics for '`+e+`' in style '`+t+`' and mode '`+n+`'`,report:!0}),s=new vV(e,0,0,0,0,0,i);s.maxFontSize=r.sizeMultiplier,r.style.isTight()&&s.classes.push(`mtight`);var l=r.getColor();return l&&(s.style.color=l),s},SH=function(e,t,n,r){return r===void 0&&(r=[]),n.font===`boldsymbol`&&bH(e,`Main-Bold`,t).metrics?xH(e,`Main-Bold`,t,n,r.concat([`mathbf`])):e===`\\`||MV[t][e].font===`main`?xH(e,`Main-Regular`,t,n,r):xH(e,`AMS-Regular`,t,n,r.concat([`amsrm`]))},CH=function(e,t,n){return n!==`textord`&&bH(e,`Math-BoldItalic`,t).metrics?{fontName:`Math-BoldItalic`,fontClass:`boldsymbol`}:{fontName:`Main-Bold`,fontClass:`mathbf`}},wH=function(e,t){var n=e.type===`mathord`?`mathord`:`textord`,r=e.mode,i=e.text,a=[`mord`],o=t.font,s=t.fontFamily,c=t.fontWeight,l=t.fontShape,u=r===`math`||r===`text`&&!!o,d=u?o:s,f=``,p=``;if(i.charCodeAt(0)===55349){var m=vH(i);f=m.font,p=m[r+`Class`]}if(f)return xH(i,f,r,t,a.concat(p));if(d){var h,g;if(d===`boldsymbol`){var _=CH(i,r,n);h=_.fontName,g=[_.fontClass]}else u?(h=LH[o].fontName,g=[o]):(h=IH(s,c,l),g=[s,c,l]);if(bH(i,h,r).metrics)return xH(i,h,r,t,a.concat(g));if(Object.prototype.hasOwnProperty.call(BV,i)&&h.slice(0,10)===`Typewriter`){for(var v=[],y=0;y<i.length;y++)v.push(xH(i[y],h,r,t,a.concat(g)));return jH(v)}}if(n===`mathord`)return xH(i,`Math-Italic`,r,t,a.concat([`mathnormal`]));if(n===`textord`){var b=MV[r][i]&&MV[r][i].font;if(b===`ams`)return xH(i,IH(`amsrm`,c,l),r,t,a.concat(`amsrm`,c,l));if(b===`main`||!b)return xH(i,IH(`textrm`,c,l),r,t,a.concat(c,l));var x=IH(b,c,l);return xH(i,x,r,t,a.concat(x,c,l))}throw Error(`unexpected type: `+n+` in makeOrd`)},TH=(e,t)=>{if(cV(e.classes)!==cV(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass(`mathnormal`))return!1;if(e.classes.length===1){var n=e.classes[0];if(n===`mbin`||n===`mord`)return!1}for(var r of Object.keys(e.style))if(e.style[r]!==t.style[r])return!1;for(var i of Object.keys(t.style))if(e.style[i]!==t.style[i])return!1;return!0},EH=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof vV&&r instanceof vV&&TH(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e},DH=function(e){for(var t=0,n=0,r=0,i=0;i<e.children.length;i++){var a=e.children[i];a.height>t&&(t=a.height),a.depth>n&&(n=a.depth),a.maxFontSize>r&&(r=a.maxFontSize)}e.height=t,e.depth=n,e.maxFontSize=r},X=function(e,t,n,r){var i=new mV(e,t,n,r);return DH(i),i},OH=(e,t,n,r)=>new mV(e,t,n,r),kH=function(e,t,n){var r=X([e],[],t);return r.height=Math.max(n||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),r.style.borderBottomWidth=B(r.height),r.maxFontSize=1,r},AH=function(e,t,n,r){var i=new hV(e,t,n,r);return DH(i),i},jH=function(e){var t=new rV(e);return DH(t),t},MH=function(e,t){return e instanceof rV?X([],[e],t):e},NH=function(e){if(e.positionType===`individualShift`){for(var t=e.children,n=[t[0]],r=-t[0].shift-t[0].elem.depth,i=r,a=1;a<t.length;a++){var o=-t[a].shift-i-t[a].elem.depth,s=o-(t[a-1].elem.height+t[a-1].elem.depth);i+=o,n.push({type:`kern`,size:s}),n.push(t[a])}return{children:n,depth:r}}var c;if(e.positionType===`top`){for(var l=e.positionData,u=0;u<e.children.length;u++){var d=e.children[u];l-=d.type===`kern`?d.size:d.elem.height+d.elem.depth}c=l}else if(e.positionType===`bottom`)c=-e.positionData;else{var f=e.children[0];if(f.type!==`elem`)throw Error(`First child must have type "elem".`);if(e.positionType===`shift`)c=-f.elem.depth-e.positionData;else if(e.positionType===`firstBaseline`)c=-f.elem.depth;else throw Error(`Invalid positionType `+e.positionType+`.`)}return{children:e.children,depth:c}},PH=function(e,t){for(var n=NH(e),r=n.children,i=n.depth,a=0,o=0;o<r.length;o++){var s=r[o];if(s.type===`elem`){var c=s.elem;a=Math.max(a,c.maxFontSize,c.height)}}a+=2;var l=X([`pstrut`],[]);l.style.height=B(a);for(var u=[],d=i,f=i,p=i,m=0;m<r.length;m++){var h=r[m];if(h.type===`kern`)p+=h.size;else{var g=h.elem,_=h.wrapperClasses||[],v=h.wrapperStyle||{},y=X(_,[l,g],void 0,v);y.style.top=B(-a-p-g.depth),h.marginLeft&&(y.style.marginLeft=h.marginLeft),h.marginRight&&(y.style.marginRight=h.marginRight),u.push(y),p+=g.height+g.depth}d=Math.min(d,p),f=Math.max(f,p)}var b=X([`vlist`],u);b.style.height=B(f);var x;if(d<0){var S=X([`vlist`],[X([],[])]);S.style.height=B(-d),x=[X([`vlist-r`],[b,X([`vlist-s`],[new vV(`​`)])]),X([`vlist-r`],[S])]}else x=[X([`vlist-r`],[b])];var ee=X([`vlist-t`],x);return x.length===2&&ee.classes.push(`vlist-t2`),ee.height=f,ee.depth=-d,ee},FH=(e,t)=>{var n=X([`mspace`],[],t),r=sV(e,t);return n.style.marginRight=B(r),n},IH=(e,t,n)=>{var r,i;switch(e){case`amsrm`:r=`AMS`;break;case`textrm`:r=`Main`;break;case`textsf`:r=`SansSerif`;break;case`texttt`:r=`Typewriter`;break;default:r=e}return i=t===`textbf`&&n===`textit`?`BoldItalic`:t===`textbf`?`Bold`:n===`textit`?`Italic`:`Regular`,r+`-`+i},LH={mathbf:{variant:`bold`,fontName:`Main-Bold`},mathrm:{variant:`normal`,fontName:`Main-Regular`},textit:{variant:`italic`,fontName:`Main-Italic`},mathit:{variant:`italic`,fontName:`Main-Italic`},mathnormal:{variant:`italic`,fontName:`Math-Italic`},mathsfit:{variant:`sans-serif-italic`,fontName:`SansSerif-Italic`},mathbb:{variant:`double-struck`,fontName:`AMS-Regular`},mathcal:{variant:`script`,fontName:`Caligraphic-Regular`},mathfrak:{variant:`fraktur`,fontName:`Fraktur-Regular`},mathscr:{variant:`script`,fontName:`Script-Regular`},mathsf:{variant:`sans-serif`,fontName:`SansSerif-Regular`},mathtt:{variant:`monospace`,fontName:`Typewriter-Regular`}},RH={vec:[`vec`,.471,.714],oiintSize1:[`oiintSize1`,.957,.499],oiintSize2:[`oiintSize2`,1.472,.659],oiiintSize1:[`oiiintSize1`,1.304,.499],oiiintSize2:[`oiiintSize2`,1.98,.659]},zH=function(e,t){var n=RH[e],r=n[0],i=n[1],a=n[2],o=OH([`katex-overlay`],[new yV([new bV(r)],{width:B(i),height:B(a),style:`width:`+B(i),viewBox:`0 0 `+1e3*i+` `+1e3*a,preserveAspectRatio:`xMinYMin`})],t);return o.height=a,o.style.height=B(a),o.style.width=B(i),o},BH={number:3,unit:`mu`},VH={number:4,unit:`mu`},HH={number:5,unit:`mu`},UH={mord:{mop:BH,mbin:VH,mrel:HH,minner:BH},mop:{mord:BH,mop:BH,mrel:HH,minner:BH},mbin:{mord:VH,mop:VH,mopen:VH,minner:VH},mrel:{mord:HH,mop:HH,mopen:HH,minner:HH},mopen:{},mclose:{mop:BH,mbin:VH,mrel:HH,minner:BH},mpunct:{mord:BH,mop:BH,mrel:HH,mopen:BH,mclose:BH,mpunct:BH,minner:BH},minner:{mord:BH,mop:BH,mbin:VH,mrel:HH,mopen:BH,mpunct:BH,minner:BH}},WH={mord:{mop:BH},mop:{mord:BH,mop:BH},mbin:{},mrel:{},mopen:{},mclose:{mop:BH},mpunct:{},minner:{mop:BH}},GH={},KH={},qH={};function Z(e){for(var t=e.type,n=e.names,r=e.htmlBuilder,i=e.mathmlBuilder,a=0;a<n.length;++a)GH[n[a]]=e;t&&(r&&(KH[t]=r),i&&(qH[t]=i))}function JH(e){var t=e.type,n=e.htmlBuilder,r=e.mathmlBuilder;n&&(KH[t]=n),r&&(qH[t]=r)}var YH=function(e){return e.type===`ordgroup`&&e.body.length===1?e.body[0]:e},XH=function(e){return e.type===`ordgroup`?e.body:[e]},ZH=new Set([`leftmost`,`mbin`,`mopen`,`mrel`,`mop`,`mpunct`]),QH=new Set([`rightmost`,`mrel`,`mclose`,`mpunct`]),$H={display:RB.DISPLAY,text:RB.TEXT,script:RB.SCRIPT,scriptscript:RB.SCRIPTSCRIPT},eU={mord:`mord`,mop:`mop`,mbin:`mbin`,mrel:`mrel`,mopen:`mopen`,mclose:`mclose`,mpunct:`mpunct`,minner:`minner`},tU=function(e,t,n,r){r===void 0&&(r=[null,null]);for(var i=[],a=0;a<e.length;a++){var o=sU(e[a],t);if(o instanceof rV){var s=o.children;i.push(...s)}else i.push(o)}if(EH(i),!n)return i;var c=t;if(e.length===1){var l=e[0];l.type===`sizing`?c=t.havingSize(l.size):l.type===`styling`&&(c=t.havingStyle($H[l.style]))}var u=X([r[0]||`leftmost`],[],t),d=X([r[1]||`rightmost`],[],t),f=n===`root`;return nU(i,(e,t)=>{var n=t.classes[0],r=e.classes[0];n===`mbin`&&QH.has(r)?t.classes[0]=`mord`:r===`mbin`&&ZH.has(n)&&(e.classes[0]=`mord`)},{node:u},d,f),nU(i,(e,t)=>{var n=aU(t),r=aU(e),i=n&&r?e.hasClass(`mtight`)?WH[n]?.[r]:UH[n]?.[r]:null;if(i)return FH(i,c)},{node:u},d,f),i},nU=function(e,t,n,r,i){r&&e.push(r);for(var a=0;a<e.length;a++){var o=e[a],s=rU(o);if(s){nU(s.children,t,n,null,i);continue}var c=!o.hasClass(`mspace`);if(c){var l=t(o,n.node);l&&(n.insertAfter?n.insertAfter(l):(e.unshift(l),a++))}c?n.node=o:i&&o.hasClass(`katex-newline`)&&(n.node=X([`leftmost`])),n.insertAfter=(t=>n=>{e.splice(t+1,0,n),a++})(a)}r&&e.pop()},rU=function(e){return e instanceof rV||e instanceof hV||e instanceof mV&&e.hasClass(`enclosing`)?e:null},iU=function(e,t){var n=rU(e);if(n){var r=n.children;if(r.length){if(t===`right`)return iU(r[r.length-1],`right`);if(t===`left`)return iU(r[0],`left`)}}return e},aU=function(e,t){return e?(t&&(e=iU(e,t)),eU[e.classes[0]]||null):null},oU=function(e,t){var n=[`nulldelimiter`].concat(e.baseSizingClasses());return X(t.concat(n))},sU=function(e,t,n){if(!e)return X();if(KH[e.type]){var r=KH[e.type](e,t);if(n&&t.size!==n.size){r=X(t.sizingClasses(n),[r],t);var i=t.sizeMultiplier/n.sizeMultiplier;r.height*=i,r.depth*=i}return r}throw new z(`Got group of unknown type: '`+e.type+`'`)};function cU(e,t){var n=X([`katex-base`],e,t),r=X([`katex-strut`]);return r.style.height=B(n.height+n.depth),n.depth&&(r.style.verticalAlign=B(-n.depth)),n.children.unshift(r),n}function lU(e,t){var n=null;e.length===1&&e[0].type===`tag`&&(n=e[0].tag,e=e[0].body);var r=tU(e,t,`root`),i;r.length===2&&r[1].hasClass(`katex-tag`)&&(i=r.pop());for(var a=[],o=[],s=0;s<r.length;s++)if(o.push(r[s]),r[s].hasClass(`mbin`)||r[s].hasClass(`mrel`)||r[s].hasClass(`allowbreak`)){for(var c=!1;s<r.length-1&&r[s+1].hasClass(`mspace`)&&!r[s+1].hasClass(`katex-newline`);)s++,o.push(r[s]),r[s].hasClass(`nobreak`)&&(c=!0);c||(a.push(cU(o,t)),o=[])}else r[s].hasClass(`katex-newline`)&&(o.pop(),o.length>0&&(a.push(cU(o,t)),o=[]),a.push(r[s]));o.length>0&&a.push(cU(o,t));var l;n?(l=cU(tU(n,t,!0),t),l.classes=[`katex-tag`],a.push(l)):i&&a.push(i);var u=X([`katex-html`],a);if(u.setAttribute(`aria-hidden`,`true`),l){var d=l.children[0];d.style.height=B(u.height+u.depth),u.depth&&(d.style.verticalAlign=B(-u.depth))}return u}function uU(e){return new rV(e)}var Q=class{constructor(e,t,n){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=n||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,this.type);for(var t of Object.entries(this.attributes)){var n=t[0],r=t[1];e.setAttribute(n,r)}this.classes.length>0&&(e.className=cV(this.classes));for(var i=0;i<this.children.length;i++)if(this.children[i]instanceof dU&&this.children[i+1]instanceof dU){for(var a=this.children[i].toText()+this.children[++i].toText();this.children[i+1]instanceof dU;)a+=this.children[++i].toText();e.appendChild(new dU(a).toNode())}else e.appendChild(this.children[i].toNode());return e}toMarkup(){var e=`<`+this.type;for(var t of Object.entries(this.attributes)){var n=t[0],r=t[1];e+=` `+n+`="`,e+=fB(r),e+=`"`}this.classes.length>0&&(e+=` class ="`+fB(cV(this.classes))+`"`),e+=`>`;for(var i=0;i<this.children.length;i++)e+=this.children[i].toMarkup();return e+=`</`+this.type+`>`,e}toText(){return this.children.map(e=>e.toText()).join(``)}},dU=class{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return fB(this.toText())}toText(){return this.text}},fU=class{constructor(e){this.width=void 0,this.character=void 0,this.width=e,this.character=e>=.05555&&e<=.05556?` `:e>=.1666&&e<=.1667?` `:e>=.2222&&e<=.2223?` `:e>=.2777&&e<=.2778?`  `:e>=-.05556&&e<=-.05555?` ⁣`:e>=-.1667&&e<=-.1666?` ⁣`:e>=-.2223&&e<=-.2222?` ⁣`:e>=-.2778&&e<=-.2777?` ⁣`:null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`mspace`);return e.setAttribute(`width`,B(this.width)),e}toMarkup(){return this.character?`<mtext>`+this.character+`</mtext>`:`<mspace width="`+B(this.width)+`"/>`}toText(){return this.character?this.character:` `}},pU=new Set([`\\imath`,`\\jmath`]),mU=new Set([`mrow`,`mtable`]),hU=function(e,t,n){var r,i;return MV[t][e]&&MV[t][e].replace&&e.charCodeAt(0)!==55349&&(!Object.prototype.hasOwnProperty.call(BV,e)||(n==null||(r=n.fontFamily)==null?void 0:r.slice(4,6))!==`tt`&&(n==null||(i=n.font)==null?void 0:i.slice(4,6))!==`tt`)&&(e=MV[t][e].replace),new dU(e)},gU=function(e){return e.length===1?e[0]:new Q(`mrow`,e)},_U={mathit:`italic`,boldsymbol:e=>e.type===`textord`?`bold`:`bold-italic`,mathbf:`bold`,mathbb:`double-struck`,mathsfit:`sans-serif-italic`,mathfrak:`fraktur`,mathscr:`script`,mathcal:`script`,mathsf:`sans-serif`,mathtt:`monospace`},vU=(e,t)=>{if(e.mode===`text`){if(t.fontFamily===`texttt`)return`monospace`;if(t.fontFamily===`textsf`)return t.fontShape===`textit`&&t.fontWeight===`textbf`?`sans-serif-bold-italic`:t.fontShape===`textit`?`sans-serif-italic`:t.fontWeight===`textbf`?`bold-sans-serif`:`sans-serif`;if(t.fontShape===`textit`&&t.fontWeight===`textbf`)return`bold-italic`;if(t.fontShape===`textit`)return`italic`;if(t.fontWeight===`textbf`)return`bold`}var n=t.font;if(!n||n===`mathnormal`)return null;var r=e.mode,i=_U[n];if(i)return typeof i==`function`?i(e):i;var a=e.text;if(pU.has(a))return null;if(MV[r][a]){var o=MV[r][a].replace;o&&(a=o)}var s=LH[n].fontName;return kV(a,s,r)?LH[n].variant:null};function yU(e){if(!e)return!1;if(e.type===`mi`&&e.children.length===1){var t=e.children[0];return t instanceof dU&&t.text===`.`}if(e.type===`mo`&&e.children.length===1&&e.getAttribute(`separator`)===`true`&&e.getAttribute(`lspace`)===`0em`&&e.getAttribute(`rspace`)===`0em`){var n=e.children[0];return n instanceof dU&&n.text===`,`}return!1}var bU=function(e,t,n){if(e.length===1){var r=SU(e[0],t);return n&&r instanceof Q&&r.type===`mo`&&(r.setAttribute(`lspace`,`0em`),r.setAttribute(`rspace`,`0em`)),[r]}for(var i=[],a,o=0;o<e.length;o++){var s=SU(e[o],t);if(s instanceof Q&&a instanceof Q){if(s.type===`mtext`&&a.type===`mtext`&&s.getAttribute(`mathvariant`)===a.getAttribute(`mathvariant`)){a.children.push(...s.children);continue}if(s.type===`mn`&&a.type===`mn`){a.children.push(...s.children);continue}if(yU(s)&&a.type===`mn`){a.children.push(...s.children);continue}if(s.type===`mn`&&yU(a))s.children=[...a.children,...s.children],i.pop();else if((s.type===`msup`||s.type===`msub`)&&s.children.length>=1&&(a.type===`mn`||yU(a))){var c=s.children[0];c instanceof Q&&c.type===`mn`&&(c.children=[...a.children,...c.children],i.pop())}else if(a.type===`mi`&&a.children.length===1){var l=a.children[0];if(l instanceof dU&&l.text===`̸`&&(s.type===`mo`||s.type===`mi`||s.type===`mn`)){var u=s.children[0];u instanceof dU&&u.text.length>0&&(u.text=u.text.slice(0,1)+`̸`+u.text.slice(1),i.pop())}}}i.push(s),a=s}return i},xU=function(e,t,n){return gU(bU(e,t,n))},SU=function(e,t){if(!e)return new Q(`mrow`);if(qH[e.type])return qH[e.type](e,t);throw new z(`Got group of unknown type: '`+e.type+`'`)};function CU(e,t,n,r,i){var a=bU(e,n),o=a.length===1&&a[0]instanceof Q&&mU.has(a[0].type)?a[0]:new Q(`mrow`,a),s=new Q(`annotation`,[new dU(t)]);s.setAttribute(`encoding`,`application/x-tex`);var c=new Q(`math`,[new Q(`semantics`,[o,s])]);return c.setAttribute(`xmlns`,`http://www.w3.org/1998/Math/MathML`),r&&c.setAttribute(`display`,`block`),X([i?`katex`:`katex-mathml`],[c])}var wU=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],TU=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],EU=function(e,t){return t.size<2?e:wU[e-1][t.size-1]},DU=class e{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.strict=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||``,this.fontFamily=t.fontFamily||``,this.fontWeight=t.fontWeight||``,this.fontShape=t.fontShape||``,this.sizeMultiplier=TU[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this.strict=t.strict,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness,strict:this.strict};return Object.assign(n,t),new e(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:EU(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:TU[e-1]})}havingBaseStyle(t){t||=this.style.text();var n=EU(e.BASESIZE,t);return this.size===n&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:``})}withTextFontWeight(e){return this.extend({fontWeight:e,font:``})}withTextFontShape(e){return this.extend({fontShape:e,font:``})}sizingClasses(e){return e.size===this.size?[]:[`katex-sizing`,`reset-size`+e.size,`size`+this.size]}baseSizingClasses(){return this.size===e.BASESIZE?[]:[`katex-sizing`,`reset-size`+this.size,`size`+e.BASESIZE]}fontMetrics(){return this._fontMetrics||=jV(this.size),this._fontMetrics}getColor(){return this.phantom?`transparent`:this.color}};DU.BASESIZE=6;var OU=e=>new DU({style:e.displayMode?RB.DISPLAY:RB.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness,strict:e.strict}),kU=function(e,t){if(t.displayMode){var n=[`katex-display`];t.leqno&&n.push(`leqno`),t.fleqn&&n.push(`fleqn`),e=X(n,[e])}return e},AU=function(e,t,n){var r=OU(n),i;return n.output===`mathml`?CU(e,t,r,n.displayMode,!0):(i=n.output===`html`?X([`katex`],[lU(e,r)]):X([`katex`],[CU(e,t,r,n.displayMode,!1),lU(e,r)]),kU(i,n))},jU=function(e,t){return kU(X([`katex`],[lU(e,OU(t))]),t)},MU={widehat:`^`,widecheck:`ˇ`,widetilde:`~`,utilde:`~`,overleftarrow:`←`,underleftarrow:`←`,xleftarrow:`←`,overrightarrow:`→`,underrightarrow:`→`,xrightarrow:`→`,underbrace:`⏟`,overbrace:`⏞`,underbracket:`⎵`,overbracket:`⎴`,overgroup:`⏠`,undergroup:`⏡`,overleftrightarrow:`↔`,underleftrightarrow:`↔`,xleftrightarrow:`↔`,Overrightarrow:`⇒`,xRightarrow:`⇒`,overleftharpoon:`↼`,xleftharpoonup:`↼`,overrightharpoon:`⇀`,xrightharpoonup:`⇀`,xLeftarrow:`⇐`,xLeftrightarrow:`⇔`,xhookleftarrow:`↩`,xhookrightarrow:`↪`,xmapsto:`↦`,xrightharpoondown:`⇁`,xleftharpoondown:`↽`,xrightleftharpoons:`⇌`,xleftrightharpoons:`⇋`,xtwoheadleftarrow:`↞`,xtwoheadrightarrow:`↠`,xlongequal:`=`,xtofrom:`⇄`,xrightleftarrows:`⇄`,xrightequilibrium:`⇌`,xleftequilibrium:`⇋`,"\\cdrightarrow":`→`,"\\cdleftarrow":`←`,"\\cdlongequal":`=`},NU=function(e){var t=new Q(`mo`,[new dU(MU[e.replace(/^\\/,``)])]);return t.setAttribute(`stretchy`,`true`),t},PU={overrightarrow:[[`rightarrow`],.888,522,`xMaxYMin`],overleftarrow:[[`leftarrow`],.888,522,`xMinYMin`],underrightarrow:[[`rightarrow`],.888,522,`xMaxYMin`],underleftarrow:[[`leftarrow`],.888,522,`xMinYMin`],xrightarrow:[[`rightarrow`],1.469,522,`xMaxYMin`],"\\cdrightarrow":[[`rightarrow`],3,522,`xMaxYMin`],xleftarrow:[[`leftarrow`],1.469,522,`xMinYMin`],"\\cdleftarrow":[[`leftarrow`],3,522,`xMinYMin`],Overrightarrow:[[`doublerightarrow`],.888,560,`xMaxYMin`],xRightarrow:[[`doublerightarrow`],1.526,560,`xMaxYMin`],xLeftarrow:[[`doubleleftarrow`],1.526,560,`xMinYMin`],overleftharpoon:[[`leftharpoon`],.888,522,`xMinYMin`],xleftharpoonup:[[`leftharpoon`],.888,522,`xMinYMin`],xleftharpoondown:[[`leftharpoondown`],.888,522,`xMinYMin`],overrightharpoon:[[`rightharpoon`],.888,522,`xMaxYMin`],xrightharpoonup:[[`rightharpoon`],.888,522,`xMaxYMin`],xrightharpoondown:[[`rightharpoondown`],.888,522,`xMaxYMin`],xlongequal:[[`longequal`],.888,334,`xMinYMin`],"\\cdlongequal":[[`longequal`],3,334,`xMinYMin`],xtwoheadleftarrow:[[`twoheadleftarrow`],.888,334,`xMinYMin`],xtwoheadrightarrow:[[`twoheadrightarrow`],.888,334,`xMaxYMin`],overleftrightarrow:[[`leftarrow`,`rightarrow`],.888,522],overbrace:[[`leftbrace`,`midbrace`,`rightbrace`],1.6,548],underbrace:[[`leftbraceunder`,`midbraceunder`,`rightbraceunder`],1.6,548],underleftrightarrow:[[`leftarrow`,`rightarrow`],.888,522],xleftrightarrow:[[`leftarrow`,`rightarrow`],1.75,522],xLeftrightarrow:[[`doubleleftarrow`,`doublerightarrow`],1.75,560],xrightleftharpoons:[[`leftharpoondownplus`,`rightharpoonplus`],1.75,716],xleftrightharpoons:[[`leftharpoonplus`,`rightharpoondownplus`],1.75,716],xhookleftarrow:[[`leftarrow`,`righthook`],1.08,522],xhookrightarrow:[[`lefthook`,`rightarrow`],1.08,522],overlinesegment:[[`leftlinesegment`,`rightlinesegment`],.888,522],underlinesegment:[[`leftlinesegment`,`rightlinesegment`],.888,522],overbracket:[[`leftbracketover`,`rightbracketover`],1.6,440],underbracket:[[`leftbracketunder`,`rightbracketunder`],1.6,410],overgroup:[[`leftgroup`,`rightgroup`],.888,342],undergroup:[[`leftgroupunder`,`rightgroupunder`],.888,342],xmapsto:[[`leftmapsto`,`rightarrow`],1.5,522],xtofrom:[[`leftToFrom`,`rightToFrom`],1.75,528],xrightleftarrows:[[`baraboveleftarrow`,`rightarrowabovebar`],1.75,901],xrightequilibrium:[[`baraboveshortleftharpoon`,`rightharpoonaboveshortbar`],1.75,716],xleftequilibrium:[[`shortbaraboveleftharpoon`,`shortrightharpoonabovebar`],1.75,716]},FU=new Set([`widehat`,`widecheck`,`widetilde`,`utilde`]),IU=function(e,t){function n(){var n=4e5,r=e.label.slice(1);if(FU.has(r)&&`base`in e){var i=e.base.type===`ordgroup`?e.base.body.length:1,a,o,s;if(i>5)r===`widehat`||r===`widecheck`?(a=420,n=2364,s=.42,o=r+`4`):(a=312,n=2340,s=.34,o=`tilde4`);else{var c=[1,1,2,2,3,3][i];r===`widehat`||r===`widecheck`?(n=[0,1062,2364,2364,2364][c],a=[0,239,300,360,420][c],s=[0,.24,.3,.3,.36,.42][c],o=r+c):(n=[0,600,1033,2339,2340][c],a=[0,260,286,306,312][c],s=[0,.26,.286,.3,.306,.34][c],o=`tilde`+c)}return{span:OH([],[new yV([new bV(o)],{width:`100%`,height:B(s),viewBox:`0 0 `+n+` `+a,preserveAspectRatio:`none`})],t),minWidth:0,height:s}}var l=[],u=PU[r];if(!u)throw Error(`No SVG data for "`+r+`".`);var d=u[0],f=u[1],p=u[2],m=p/1e3,h=d.length,g,_;if(h===1){if(u.length!==4)throw Error(`Expected 4-tuple for single-path SVG data "`+r+`".`);g=[`hide-tail`],_=[u[3]]}else if(h===2)g=[`halfarrow-left`,`halfarrow-right`],_=[`xMinYMin`,`xMaxYMin`];else if(h===3)g=[`brace-left`,`brace-center`,`brace-right`],_=[`xMinYMin`,`xMidYMin`,`xMaxYMin`];else throw Error(`Correct katexImagesData or update code here to support
310
- `+h+` children.`);for(var v=0;v<h;v++){var y=new yV([new bV(d[v])],{width:`400em`,height:B(m),viewBox:`0 0 `+n+` `+p,preserveAspectRatio:_[v]+` slice`}),b=OH([g[v]],[y],t);if(h===1)return{span:b,minWidth:f,height:m};b.style.height=B(m),l.push(b)}return{span:X([`katex-stretchy`],l,t),minWidth:f,height:m}}var r=n(),i=r.span,a=r.minWidth,o=r.height;return i.height=o,i.style.height=B(o),a>0&&(i.style.minWidth=B(a)),i},LU=function(e,t,n,r,i){var a,o=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(a=X([`katex-stretchy`,t],[],i),t===`fbox`){var s=i.color&&i.getColor();s&&(a.style.borderColor=s)}}else{var c=[];/^[bx]cancel$/.test(t)&&c.push(new xV({x1:`0`,y1:`0`,x2:`100%`,y2:`100%`,"stroke-width":`0.046em`})),/^x?cancel$/.test(t)&&c.push(new xV({x1:`0`,y1:`100%`,x2:`100%`,y2:`0`,"stroke-width":`0.046em`})),a=OH([],[new yV(c,{width:`100%`,height:B(o)})],i)}return a.height=o,a.style.height=B(o),a},RU=[`bin`,`close`,`inner`,`open`,`punct`,`rel`],zU=[`accent-token`,`mathord`,`op-token`,`spacing`,`textord`],BU=new Set(RU),VU=new Set(zU);function HU(e){return BU.has(e)}function UU(e,t){if(!e||e.type!==t)throw Error(`Expected node of type `+t+`, but got `+(e?`node of type `+e.type:String(e)));return e}function WU(e){var t=GU(e);if(!t)throw Error(`Expected node of symbol group type, but got `+(e?`node of type `+e.type:String(e)));return t}function GU(e){return e.type===`atom`||VU.has(e.type)?e:null}function KU(e,t,n){var r=``;for(var i of e.body)if(i.type===`textord`)r+=i.text;else if(n&&i.type===`spacing`&&i.text===` `)r+=` `;else throw new z(t,e);return r}var qU=e=>{if(e instanceof vV)return e;if(wV(e)&&e.children.length===1)return qU(e.children[0])},JU=(e,t)=>{var n,r,i;e&&e.type===`supsub`?(r=UU(e.base,`accent`),n=r.base,e.base=n,i=CV(sU(e,t)),e.base=r):(r=UU(e,`accent`),n=r.base);var a=sU(n,t.havingCrampedStyle()),o=r.isShifty&&hB(n),s=0;o&&(s=qU(a)?.skew??0);var c=r.label===`\\c`,l=c?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),u;if(r.isStretchy)u=IU(r,t),u=PH({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`elem`,elem:u,wrapperClasses:[`svg-align`],wrapperStyle:s>0?{width:`calc(100% - `+B(2*s)+`)`,marginLeft:B(2*s)}:void 0}]});else{var d,f;r.label===`\\vec`?(d=zH(`vec`,t),f=RH.vec[1]):(d=wH({type:`textord`,mode:r.mode,text:r.label},t),d=SV(d),d.italic=0,f=d.width,c&&(l+=d.depth)),u=X([`accent-body`],[d]);var p=r.label===`\\textcircled`;p&&(u.classes.push(`accent-full`),l=a.height);var m=s;p||(m-=f/2),u.style.left=B(m),r.label===`\\textcircled`&&(u.style.top=`.2em`),u=PH({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`kern`,size:-l},{type:`elem`,elem:u}]})}var h=X([`mord`,`katex-accent`],[u],t);return i?(i.children[0]=h,i.height=Math.max(h.height,i.height),i.classes[0]=`mord`,i):h},YU=(e,t)=>{var n=e.isStretchy?NU(e.label):new Q(`mo`,[hU(e.label,e.mode)]),r=new Q(`mover`,[SU(e.base,t),n]);return r.setAttribute(`accent`,`true`),r},XU=new RegExp([`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`].map(e=>`\\`+e).join(`|`));Z({type:`accent`,names:[`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`,`\\widecheck`,`\\widehat`,`\\widetilde`,`\\overrightarrow`,`\\overleftarrow`,`\\Overrightarrow`,`\\overleftrightarrow`,`\\overgroup`,`\\overlinesegment`,`\\overleftharpoon`,`\\overrightharpoon`],numArgs:1,handler:(e,t)=>{var n=YH(t[0]),r=!XU.test(e.funcName),i=!r||e.funcName===`\\widehat`||e.funcName===`\\widetilde`||e.funcName===`\\widecheck`;return{type:`accent`,mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:JU,mathmlBuilder:YU}),Z({type:`accent`,names:[`\\'`,"\\`",`\\^`,`\\~`,`\\=`,`\\u`,`\\.`,`\\"`,`\\c`,`\\r`,`\\H`,`\\v`,`\\textcircled`],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`primitive`],handler:(e,t)=>{var n=t[0],r=e.parser.mode;return r===`math`&&(yH({strict:e.parser.settings.strict,errorCode:`mathVsTextAccents`,errorMsg:`LaTeX's accent `+e.funcName+` works only in text mode`,report:!0}),r=`text`),{type:`accent`,mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}}}),Z({type:`accentUnder`,names:[`\\underleftarrow`,`\\underrightarrow`,`\\underleftrightarrow`,`\\undergroup`,`\\underlinesegment`,`\\utilde`],numArgs:1,handler:(e,t)=>{var n=e.parser,r=e.funcName,i=t[0];return{type:`accentUnder`,mode:n.mode,label:r,base:i}},htmlBuilder:(e,t)=>{var n=sU(e.base,t),r=IU(e,t),i=e.label===`\\utilde`?.12:0;return X([`mord`,`accentunder`],[PH({positionType:`top`,positionData:n.height,children:[{type:`elem`,elem:r,wrapperClasses:[`svg-align`]},{type:`kern`,size:i},{type:`elem`,elem:n}]})],t)},mathmlBuilder:(e,t)=>{var n=NU(e.label),r=new Q(`munder`,[SU(e.base,t),n]);return r.setAttribute(`accentunder`,`true`),r}});var ZU=e=>{var t=new Q(`mpadded`,e?[e]:[]);return t.setAttribute(`width`,`+0.6em`),t.setAttribute(`lspace`,`0.3em`),t};Z({type:`xArrow`,names:[`\\xleftarrow`,`\\xrightarrow`,`\\xLeftarrow`,`\\xRightarrow`,`\\xleftrightarrow`,`\\xLeftrightarrow`,`\\xhookleftarrow`,`\\xhookrightarrow`,`\\xmapsto`,`\\xrightharpoondown`,`\\xrightharpoonup`,`\\xleftharpoondown`,`\\xleftharpoonup`,`\\xrightleftharpoons`,`\\xleftrightharpoons`,`\\xlongequal`,`\\xtwoheadrightarrow`,`\\xtwoheadleftarrow`,`\\xtofrom`,`\\xrightleftarrows`,`\\xrightequilibrium`,`\\xleftequilibrium`,`\\\\cdrightarrow`,`\\\\cdleftarrow`,`\\\\cdlongequal`],numArgs:1,numOptionalArgs:1,handler(e,t,n){var r=e.parser,i=e.funcName;return{type:`xArrow`,mode:r.mode,label:i,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,r=t.havingStyle(n.sup()),i=MH(sU(e.body,r,t),t),a=e.label.slice(0,2)===`\\x`?`x`:`cd`;i.classes.push(a+`-arrow-pad`);var o;e.below&&(r=t.havingStyle(n.sub()),o=MH(sU(e.below,r,t),t),o.classes.push(a+`-arrow-pad`));var s=IU(e,t),c=-t.fontMetrics().axisHeight+.5*s.height,l=-t.fontMetrics().axisHeight-.5*s.height-.111;(i.depth>.25||e.label===`\\xleftequilibrium`)&&(l-=i.depth);var u;if(o){var d=-t.fontMetrics().axisHeight+o.height+.5*s.height+.111;u=PH({positionType:`individualShift`,children:[{type:`elem`,elem:i,shift:l},{type:`elem`,elem:s,shift:c,wrapperClasses:[`svg-align`]},{type:`elem`,elem:o,shift:d}]})}else u=PH({positionType:`individualShift`,children:[{type:`elem`,elem:i,shift:l},{type:`elem`,elem:s,shift:c,wrapperClasses:[`svg-align`]}]});return X([`mrel`,`x-arrow`],[u],t)},mathmlBuilder(e,t){var n=NU(e.label);n.setAttribute(`minsize`,e.label.charAt(0)===`x`?`1.75em`:`3.0em`);var r;if(e.body){var i=ZU(SU(e.body,t));r=e.below?new Q(`munderover`,[n,ZU(SU(e.below,t)),i]):new Q(`mover`,[n,i])}else e.below?r=new Q(`munder`,[n,ZU(SU(e.below,t))]):(r=ZU(),r=new Q(`mover`,[n,r]));return r}});function QU(e,t){var n=tU(e.body,t,!0);return X([e.mclass],n,t)}function $U(e,t){var n,r=bU(e.body,t);return e.mclass===`minner`?n=new Q(`mpadded`,r):e.mclass===`mord`?e.isCharacterBox?(n=r[0],n.type=`mi`):n=new Q(`mi`,r):(e.isCharacterBox?(n=r[0],n.type=`mo`):n=new Q(`mo`,r),e.mclass===`mbin`?(n.attributes.lspace=`0.22em`,n.attributes.rspace=`0.22em`):e.mclass===`mpunct`?(n.attributes.lspace=`0em`,n.attributes.rspace=`0.17em`):(e.mclass===`mopen`||e.mclass===`mclose`)&&(n.attributes.lspace=`0em`,n.attributes.rspace=`0em`)),n}Z({type:`mclass`,names:[`\\mathord`,`\\mathbin`,`\\mathrel`,`\\mathopen`,`\\mathclose`,`\\mathpunct`,`\\mathinner`],numArgs:1,primitive:!0,handler(e,t){var n=e.parser,r=e.funcName,i=t[0];return{type:`mclass`,mode:n.mode,mclass:`m`+r.slice(5),body:XH(i),isCharacterBox:hB(i)}},htmlBuilder:QU,mathmlBuilder:$U});var eW=e=>{var t=e.type===`ordgroup`&&e.body.length?e.body[0]:e;return t.type===`atom`&&(t.family===`bin`||t.family===`rel`)?`m`+t.family:`mord`};Z({type:`mclass`,names:[`\\@binrel`],numArgs:2,handler(e,t){return{type:`mclass`,mode:e.parser.mode,mclass:eW(t[0]),body:XH(t[1]),isCharacterBox:hB(t[1])}}}),Z({type:`mclass`,names:[`\\stackrel`,`\\overset`,`\\underset`],numArgs:2,handler(e,t){var n=e.parser,r=e.funcName,i=t[1],a=t[0],o=r===`\\stackrel`?`mrel`:eW(i),s={type:`op`,mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!==`\\stackrel`,body:XH(i)},c=r===`\\underset`?{type:`supsub`,mode:a.mode,base:s,sub:a}:{type:`supsub`,mode:a.mode,base:s,sup:a};return{type:`mclass`,mode:n.mode,mclass:o,body:[c],isCharacterBox:hB(c)}}}),Z({type:`pmb`,names:[`\\pmb`],numArgs:1,allowedInText:!0,handler(e,t){return{type:`pmb`,mode:e.parser.mode,mclass:eW(t[0]),body:XH(t[0])}},htmlBuilder(e,t){var n=tU(e.body,t,!0),r=X([e.mclass],n,t);return r.style.textShadow=`0.02em 0.01em 0.04px`,r},mathmlBuilder(e,t){var n=new Q(`mstyle`,bU(e.body,t));return n.setAttribute(`style`,`text-shadow: 0.02em 0.01em 0.04px`),n}});var tW={">":`\\\\cdrightarrow`,"<":`\\\\cdleftarrow`,"=":`\\\\cdlongequal`,A:`\\uparrow`,V:`\\downarrow`,"|":`\\Vert`,".":`no arrow`},nW=()=>({type:`styling`,body:[],mode:`math`,style:`display`,resetFont:!0}),rW=e=>e.type===`textord`&&e.text===`@`,iW=(e,t)=>(e.type===`mathord`||e.type===`atom`)&&e.text===t;function aW(e,t,n){var r=tW[e];switch(r){case`\\\\cdrightarrow`:case`\\\\cdleftarrow`:return n.callFunction(r,[t[0]],[t[1]]);case`\\uparrow`:case`\\downarrow`:var i=n.callFunction(`\\\\cdleft`,[t[0]],[]),a={type:`atom`,text:r,mode:`math`,family:`rel`},o={type:`ordgroup`,mode:`math`,body:[i,n.callFunction(`\\Big`,[a],[]),n.callFunction(`\\\\cdright`,[t[1]],[])]};return n.callFunction(`\\\\cdparent`,[o],[]);case`\\\\cdlongequal`:return n.callFunction(`\\\\cdlongequal`,[],[]);case`\\Vert`:return n.callFunction(`\\Big`,[{type:`textord`,text:`\\Vert`,mode:`math`}],[]);default:return{type:`textord`,text:` `,mode:`math`}}}function oW(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set(`\\cr`,`\\\\\\relax`),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,`\\\\`)),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n===`&`||n===`\\\\`)e.consume();else if(n===`\\end`){t[t.length-1].length===0&&t.pop();break}else throw new z(`Expected \\\\ or \\cr or \\end`,e.nextToken)}for(var r=[],i=[r],a=0;a<t.length;a++){for(var o=t[a],s=nW(),c=0;c<o.length;c++)if(!rW(o[c]))s.body.push(o[c]);else{r.push(s),c+=1;var l=WU(o[c]).text,u=[,,];if(u[0]={type:`ordgroup`,mode:`math`,body:[]},u[1]={type:`ordgroup`,mode:`math`,body:[]},!`=|.`.includes(l)){if(`<>AV`.includes(l))for(var d=0;d<2;d++){for(var f=!0,p=c+1;p<o.length;p++){if(iW(o[p],l)){f=!1,c=p;break}if(rW(o[p]))throw new z(`Missing a `+l+` character to complete a CD arrow.`,o[p]);u[d].body.push(o[p])}if(f)throw new z(`Missing a `+l+` character to complete a CD arrow.`,o[c])}else throw new z(`Expected one of "<>AV=|." after @`,o[c])}var m={type:`styling`,body:[aW(l,u,e)],mode:`math`,style:`display`,resetFont:!0};r.push(m),s=nW()}a%2==0?r.push(s):r.shift(),r=[],i.push(r)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:`array`,mode:`math`,body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:Array(i[0].length).fill({type:`align`,align:`c`,pregap:.25,postgap:.25}),colSeparationType:`CD`,hLinesBeforeRow:Array(i.length+1).fill([])}}Z({type:`cdlabel`,names:[`\\\\cdleft`,`\\\\cdright`],numArgs:1,handler(e,t){var n=e.parser,r=e.funcName;return{type:`cdlabel`,mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=MH(sU(e.label,n,t),t);return r.classes.push(`cd-label-`+e.side),r.style.bottom=B(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new Q(`mrow`,[SU(e.label,t)]);return n=new Q(`mpadded`,[n]),n.setAttribute(`width`,`0`),e.side===`left`&&n.setAttribute(`lspace`,`-1width`),n.setAttribute(`voffset`,`0.7em`),n=new Q(`mstyle`,[n]),n.setAttribute(`displaystyle`,`false`),n.setAttribute(`scriptlevel`,`1`),n}}),Z({type:`cdlabelparent`,names:[`\\\\cdparent`],numArgs:1,handler(e,t){return{type:`cdlabelparent`,mode:e.parser.mode,fragment:t[0]}},htmlBuilder(e,t){var n=MH(sU(e.fragment,t),t);return n.classes.push(`cd-vert-arrow`),n},mathmlBuilder(e,t){return new Q(`mrow`,[SU(e.fragment,t)])}}),Z({type:`textord`,names:[`\\@char`],numArgs:1,allowedInText:!0,handler(e,t){var n=e.parser,r=KU(UU(t[0],`ordgroup`),`\\@char has non-numeric argument`),i=parseInt(r),a;if(isNaN(i))throw new z(`\\@char has non-numeric argument `+r);if(i<0||i>1114111)throw new z(`\\@char with invalid code point `+r);return i<=65535?a=String.fromCharCode(i):(i-=65536,a=String.fromCharCode((i>>10)+55296,(i&1023)+56320)),{type:`textord`,mode:n.mode,text:a}}}),Z({type:`color`,names:[`\\textcolor`],numArgs:2,allowedInText:!0,argTypes:[`color`,`original`],handler(e,t){var n=e.parser,r=UU(t[0],`color-token`).color,i=t[1];return{type:`color`,mode:n.mode,color:r,body:XH(i)}},htmlBuilder:(e,t)=>jH(tU(e.body,t.withColor(e.color),!1)),mathmlBuilder:(e,t)=>{var n=new Q(`mstyle`,bU(e.body,t.withColor(e.color)));return n.setAttribute(`mathcolor`,e.color),n}}),Z({type:`color`,names:[`\\color`],numArgs:1,allowedInText:!0,argTypes:[`color`],handler(e,t){var n=e.parser,r=e.breakOnTokenText,i=UU(t[0],`color-token`).color;n.gullet.macros.set(`\\current@color`,i);var a=n.parseExpression(!0,r);return{type:`color`,mode:n.mode,color:i,body:a}}}),Z({type:`cr`,names:[`\\\\`],numArgs:0,numOptionalArgs:0,allowedInText:!0,handler(e){var t=e.parser,n=t.gullet.future().text===`[`?t.parseSizeGroup(!0):null,r=!t.settings.displayMode||!yH({strict:t.settings.strict,errorCode:`newLineInDisplayMode`,errorMsg:`In LaTeX, \\\\ or \\newline does nothing in display mode`,report:!1});return{type:`cr`,mode:t.mode,newLine:r,size:n&&UU(n,`size`).value}},htmlBuilder(e,t){var n=X([`mspace`],[],t);return e.newLine&&(n.classes.push(`katex-newline`),e.size&&(n.style.marginTop=B(sV(e.size,t)))),n},mathmlBuilder(e,t){var n=new Q(`mspace`);return e.newLine&&(n.setAttribute(`linebreak`,`newline`),e.size&&n.setAttribute(`height`,B(sV(e.size,t)))),n}});var sW={"\\global":`\\global`,"\\long":`\\\\globallong`,"\\\\globallong":`\\\\globallong`,"\\def":`\\gdef`,"\\gdef":`\\gdef`,"\\edef":`\\xdef`,"\\xdef":`\\xdef`,"\\let":`\\\\globallet`,"\\futurelet":`\\\\globalfuture`},cW=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new z(`Expected a control sequence`,e);return t},lW=e=>{var t=e.gullet.popToken();return t.text===`=`&&(t=e.gullet.popToken(),t.text===` `&&(t=e.gullet.popToken())),t},uW=(e,t,n,r)=>{var i=e.gullet.macros.get(n.text);i??=(n.noexpand=!0,{tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,i,r)};Z({type:`internal`,names:[`\\global`,`\\long`,`\\\\globallong`],numArgs:0,allowedInText:!0,handler(e){var t=e.parser,n=e.funcName;t.consumeSpaces();var r=t.fetch();if(sW[r.text])return(n===`\\global`||n===`\\\\globallong`)&&(r.text=sW[r.text]),UU(t.parseFunction(),`internal`);throw new z(`Invalid token after macro prefix`,r)}}),Z({type:`internal`,names:[`\\def`,`\\gdef`,`\\edef`,`\\xdef`],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var t=e.parser,n=e.funcName,r=t.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new z(`Expected a control sequence`,r);for(var a=0,o,s=[[]];t.gullet.future().text!==`{`;)if(r=t.gullet.popToken(),r.text===`#`){if(t.gullet.future().text===`{`){o=t.gullet.future(),s[a].push(`{`);break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new z(`Invalid argument number "`+r.text+`"`);if(parseInt(r.text)!==a+1)throw new z(`Argument number "`+r.text+`" out of order`);a++,s.push([])}else if(r.text===`EOF`)throw new z(`Expected a macro definition`);else s[a].push(r.text);var c=t.gullet.consumeArg().tokens;return o&&c.unshift(o),(n===`\\edef`||n===`\\xdef`)&&(c=t.gullet.expandTokens(c),c.reverse()),t.gullet.macros.set(i,{tokens:c,numArgs:a,delimiters:s},n===sW[n]),{type:`internal`,mode:t.mode}}}),Z({type:`internal`,names:[`\\let`,`\\\\globallet`],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var t=e.parser,n=e.funcName,r=cW(t.gullet.popToken());return t.gullet.consumeSpaces(),uW(t,r,lW(t),n===`\\\\globallet`),{type:`internal`,mode:t.mode}}}),Z({type:`internal`,names:[`\\futurelet`,`\\\\globalfuture`],numArgs:0,allowedInText:!0,primitive:!0,handler(e){var t=e.parser,n=e.funcName,r=cW(t.gullet.popToken()),i=t.gullet.popToken(),a=t.gullet.popToken();return uW(t,r,a,n===`\\\\globalfuture`),t.gullet.pushToken(a),t.gullet.pushToken(i),{type:`internal`,mode:t.mode}}});var dW=function(e,t,n){var r=kV(MV.math[e]&&MV.math[e].replace||e,t,n);if(!r)throw Error(`Unsupported symbol `+e+` and font size `+t+`.`);return r},fW=function(e,t,n,r){var i=n.havingBaseStyle(t),a=X(r.concat(i.sizingClasses(n)),[e],n),o=i.sizeMultiplier/n.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=i.sizeMultiplier,a},pW=function(e,t,n){var r=t.havingBaseStyle(n),i=(1-t.sizeMultiplier/r.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push(`delimcenter`),e.style.top=B(i),e.height-=i,e.depth+=i},mW=function(e,t,n,r,i,a){var o=fW(xH(e,`Main-Regular`,i,r),t,r,a);return n&&pW(o,r,t),o},hW=function(e,t,n,r){return xH(e,`Size`+t+`-Regular`,n,r)},gW=function(e,t,n,r,i,a){var o=hW(e,t,i,r),s=fW(X([`delimsizing`,`size`+t],[o],r),RB.TEXT,r,a);return n&&pW(s,r,RB.TEXT),s},_W=function(e,t,n,r){return{type:`elem`,elem:X([`delimsizinginner`,t===`Size1-Regular`?`delim-size1`:`delim-size4`],[X([],[xH(e,t,n,r)])])}},vW=function(e,t,n){var r=TV[`Size4-Regular`][e.charCodeAt(0)]?TV[`Size4-Regular`][e.charCodeAt(0)][4]:TV[`Size1-Regular`][e.charCodeAt(0)][4],i=OH([],[new yV([new bV(`inner`,$B(e,Math.round(1e3*t)))],{width:B(r),height:B(t),style:`width:`+B(r),viewBox:`0 0 `+1e3*r+` `+Math.round(1e3*t),preserveAspectRatio:`xMinYMin`})],n);return i.height=t,i.style.height=B(t),i.style.width=B(r),{type:`elem`,elem:i}},yW=.008,bW={type:`kern`,size:-1*yW},xW=new Set([`|`,`\\lvert`,`\\rvert`,`\\vert`]),SW=new Set([`\\|`,`\\lVert`,`\\rVert`,`\\Vert`]),CW=function(e,t,n,r,i,a){var o,s,c,l,u=``,d=0;o=c=l=e,s=null;var f=`Size1-Regular`;e===`\\uparrow`?c=l=`⏐`:e===`\\Uparrow`?c=l=`‖`:e===`\\downarrow`?o=c=`⏐`:e===`\\Downarrow`?o=c=`‖`:e===`\\updownarrow`?(o=`\\uparrow`,c=`⏐`,l=`\\downarrow`):e===`\\Updownarrow`?(o=`\\Uparrow`,c=`‖`,l=`\\Downarrow`):xW.has(e)?(c=`∣`,u=`vert`,d=333):SW.has(e)?(c=`∥`,u=`doublevert`,d=556):e===`[`||e===`\\lbrack`?(o=`⎡`,c=`⎢`,l=`⎣`,f=`Size4-Regular`,u=`lbrack`,d=667):e===`]`||e===`\\rbrack`?(o=`⎤`,c=`⎥`,l=`⎦`,f=`Size4-Regular`,u=`rbrack`,d=667):e===`\\lfloor`||e===`⌊`?(c=o=`⎢`,l=`⎣`,f=`Size4-Regular`,u=`lfloor`,d=667):e===`\\lceil`||e===`⌈`?(o=`⎡`,c=l=`⎢`,f=`Size4-Regular`,u=`lceil`,d=667):e===`\\rfloor`||e===`⌋`?(c=o=`⎥`,l=`⎦`,f=`Size4-Regular`,u=`rfloor`,d=667):e===`\\rceil`||e===`⌉`?(o=`⎤`,c=l=`⎥`,f=`Size4-Regular`,u=`rceil`,d=667):e===`(`||e===`\\lparen`?(o=`⎛`,c=`⎜`,l=`⎝`,f=`Size4-Regular`,u=`lparen`,d=875):e===`)`||e===`\\rparen`?(o=`⎞`,c=`⎟`,l=`⎠`,f=`Size4-Regular`,u=`rparen`,d=875):e===`\\{`||e===`\\lbrace`?(o=`⎧`,s=`⎨`,l=`⎩`,c=`⎪`,f=`Size4-Regular`):e===`\\}`||e===`\\rbrace`?(o=`⎫`,s=`⎬`,l=`⎭`,c=`⎪`,f=`Size4-Regular`):e===`\\lgroup`||e===`⟮`?(o=`⎧`,l=`⎩`,c=`⎪`,f=`Size4-Regular`):e===`\\rgroup`||e===`⟯`?(o=`⎫`,l=`⎭`,c=`⎪`,f=`Size4-Regular`):e===`\\lmoustache`||e===`⎰`?(o=`⎧`,l=`⎭`,c=`⎪`,f=`Size4-Regular`):(e===`\\rmoustache`||e===`⎱`)&&(o=`⎫`,l=`⎩`,c=`⎪`,f=`Size4-Regular`);var p=dW(o,f,i),m=p.height+p.depth,h=dW(c,f,i),g=h.height+h.depth,_=dW(l,f,i),v=_.height+_.depth,y=0,b=1;if(s!==null){var x=dW(s,f,i);y=x.height+x.depth,b=2}var S=m+v+y,ee=S+Math.max(0,Math.ceil((t-S)/(b*g)))*b*g,te=r.fontMetrics().axisHeight;n&&(te*=r.sizeMultiplier);var C=ee/2-te,w=[];if(u.length>0){var ne=ee-m-v,re=Math.round(ee*1e3),T=tV(u,Math.round(ne*1e3)),ie=new bV(u,T),ae=B(d/1e3),oe=B(re/1e3),se=OH([],[new yV([ie],{width:ae,height:oe,viewBox:`0 0 `+d+` `+re})],r);se.height=re/1e3,se.style.width=ae,se.style.height=oe,w.push({type:`elem`,elem:se})}else{if(w.push(_W(l,f,i,r)),w.push(bW),s===null){var ce=ee-m-v+2*yW;w.push(vW(c,ce,r))}else{var le=(ee-m-v-y)/2+2*yW;w.push(vW(c,le,r)),w.push(bW),w.push(_W(s,f,i,r)),w.push(bW),w.push(vW(c,le,r))}w.push(bW),w.push(_W(o,f,i,r))}var ue=r.havingBaseStyle(RB.TEXT);return fW(X([`delimsizing`,`mult`],[PH({positionType:`bottom`,positionData:C,children:w})],ue),RB.TEXT,r,a)},wW=80,TW=.08,EW=function(e,t,n,r,i){return OH([`hide-tail`],[new yV([new bV(e,QB(e,r,n))],{width:`400em`,height:B(t),viewBox:`0 0 400000 `+n,preserveAspectRatio:`xMinYMin slice`})],i)},DW=function(e,t){var n=t.havingBaseSizing(),r=LW(`\\surd`,e*n.sizeMultiplier,FW,n),i=n.sizeMultiplier,a=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),o,s,c,l,u;return r.type===`small`?(l=1e3+1e3*a+wW,e<1?i=1:e<1.4&&(i=.7),s=(1+a+TW)/i,c=(1+a)/i,o=EW(`sqrtMain`,s,l,a,t),o.style.minWidth=`0.853em`,u=.833/i):r.type===`large`?(l=(1e3+wW)*jW[r.size],c=(jW[r.size]+a)/i,s=(jW[r.size]+a+TW)/i,o=EW(`sqrtSize`+r.size,s,l,a,t),o.style.minWidth=`1.02em`,u=1/i):(s=e+a+TW,c=e+a,l=Math.floor(1e3*e+a)+wW,o=EW(`sqrtTall`,s,l,a,t),o.style.minWidth=`0.742em`,u=1.056),o.height=c,o.style.height=B(s),{span:o,advanceWidth:u,ruleWidth:(t.fontMetrics().sqrtRuleThickness+a)*i}},OW=new Set([`(`,`\\lparen`,`)`,`\\rparen`,`[`,`\\lbrack`,`]`,`\\rbrack`,`\\{`,`\\lbrace`,`\\}`,`\\rbrace`,`\\lfloor`,`\\rfloor`,`⌊`,`⌋`,`\\lceil`,`\\rceil`,`⌈`,`⌉`,`\\surd`]),kW=new Set([`\\uparrow`,`\\downarrow`,`\\updownarrow`,`\\Uparrow`,`\\Downarrow`,`\\Updownarrow`,`|`,`\\|`,`\\vert`,`\\Vert`,`\\lvert`,`\\rvert`,`\\lVert`,`\\rVert`,`\\lgroup`,`\\rgroup`,`⟮`,`⟯`,`\\lmoustache`,`\\rmoustache`,`⎰`,`⎱`]),AW=new Set([`<`,`>`,`\\langle`,`\\rangle`,`/`,`\\backslash`,`\\lt`,`\\gt`]),jW=[0,1.2,1.8,2.4,3],MW=function(e,t,n,r,i){if(e===`<`||e===`\\lt`||e===`⟨`?e=`\\langle`:(e===`>`||e===`\\gt`||e===`⟩`)&&(e=`\\rangle`),OW.has(e)||AW.has(e))return gW(e,t,!1,n,r,i);if(kW.has(e))return CW(e,jW[t],!1,n,r,i);throw new z(`Illegal delimiter: '`+e+`'`)},NW=[{type:`small`,style:RB.SCRIPTSCRIPT},{type:`small`,style:RB.SCRIPT},{type:`small`,style:RB.TEXT},{type:`large`,size:1},{type:`large`,size:2},{type:`large`,size:3},{type:`large`,size:4}],PW=[{type:`small`,style:RB.SCRIPTSCRIPT},{type:`small`,style:RB.SCRIPT},{type:`small`,style:RB.TEXT},{type:`stack`}],FW=[{type:`small`,style:RB.SCRIPTSCRIPT},{type:`small`,style:RB.SCRIPT},{type:`small`,style:RB.TEXT},{type:`large`,size:1},{type:`large`,size:2},{type:`large`,size:3},{type:`large`,size:4},{type:`stack`}],IW=function(e){if(e.type===`small`)return`Main-Regular`;if(e.type===`large`)return`Size`+e.size+`-Regular`;if(e.type===`stack`)return`Size4-Regular`;var t=e.type;throw Error(`Add support for delim type '`+t+`' here.`)},LW=function(e,t,n,r){for(var i=Math.min(2,3-r.style.size);i<n.length;i++){var a=n[i];if(a.type===`stack`)break;var o=dW(e,IW(a),`math`),s=o.height+o.depth;if(a.type===`small`){var c=r.havingBaseStyle(a.style);s*=c.sizeMultiplier}if(s>t)return a}return n[n.length-1]},RW=function(e,t,n,r,i,a){e===`<`||e===`\\lt`||e===`⟨`?e=`\\langle`:(e===`>`||e===`\\gt`||e===`⟩`)&&(e=`\\rangle`);var o=AW.has(e)?NW:OW.has(e)?FW:PW,s=LW(e,t,o,r);return s.type===`small`?mW(e,s.style,n,r,i,a):s.type===`large`?gW(e,s.size,n,r,i,a):CW(e,t,n,r,i,a)},zW=function(e,t,n,r,i,a){var o=r.fontMetrics().axisHeight*r.sizeMultiplier,s=901,c=5/r.fontMetrics().ptPerEm,l=Math.max(t-o,n+o);return RW(e,Math.max(l/500*s,2*l-c),!0,r,i,a)},BW={"\\bigl":{mclass:`mopen`,size:1},"\\Bigl":{mclass:`mopen`,size:2},"\\biggl":{mclass:`mopen`,size:3},"\\Biggl":{mclass:`mopen`,size:4},"\\bigr":{mclass:`mclose`,size:1},"\\Bigr":{mclass:`mclose`,size:2},"\\biggr":{mclass:`mclose`,size:3},"\\Biggr":{mclass:`mclose`,size:4},"\\bigm":{mclass:`mrel`,size:1},"\\Bigm":{mclass:`mrel`,size:2},"\\biggm":{mclass:`mrel`,size:3},"\\Biggm":{mclass:`mrel`,size:4},"\\big":{mclass:`mord`,size:1},"\\Big":{mclass:`mord`,size:2},"\\bigg":{mclass:`mord`,size:3},"\\Bigg":{mclass:`mord`,size:4}},VW=new Set(`(,\\lparen,),\\rparen,[,\\lbrack,],\\rbrack,\\{,\\lbrace,\\},\\rbrace,\\lfloor,\\rfloor,⌊,⌋,\\lceil,\\rceil,⌈,⌉,<,>,\\langle,⟨,\\rangle,⟩,\\lt,\\gt,\\lvert,\\rvert,\\lVert,\\rVert,\\lgroup,\\rgroup,⟮,⟯,\\lmoustache,\\rmoustache,⎰,⎱,/,\\backslash,|,\\vert,\\|,\\Vert,\\uparrow,\\Uparrow,\\downarrow,\\Downarrow,\\updownarrow,\\Updownarrow,.`.split(`,`));function HW(e){return`isMiddle`in e}function UW(e,t){var n=GU(e);if(n&&VW.has(n.text))return n;throw n?new z(`Invalid delimiter '`+n.text+`' after '`+t.funcName+`'`,e):new z(`Invalid delimiter type '`+e.type+`'`,e)}Z({type:`delimsizing`,names:[`\\bigl`,`\\Bigl`,`\\biggl`,`\\Biggl`,`\\bigr`,`\\Bigr`,`\\biggr`,`\\Biggr`,`\\bigm`,`\\Bigm`,`\\biggm`,`\\Biggm`,`\\big`,`\\Big`,`\\bigg`,`\\Bigg`],numArgs:1,argTypes:[`primitive`],handler:(e,t)=>{var n=UW(YH(t[0]),e);return{type:`delimsizing`,mode:e.parser.mode,size:BW[e.funcName].size,mclass:BW[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim===`.`?X([e.mclass]):MW(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!==`.`&&t.push(hU(e.delim,e.mode));var n=new Q(`mo`,t);e.mclass===`mopen`||e.mclass===`mclose`?n.setAttribute(`fence`,`true`):n.setAttribute(`fence`,`false`),n.setAttribute(`stretchy`,`true`);var r=B(jW[e.size]);return n.setAttribute(`minsize`,r),n.setAttribute(`maxsize`,r),n}});function WW(e){if(!e.body)throw Error(`Bug: The leftright ParseNode wasn't fully parsed.`)}Z({type:`leftright-right`,names:[`\\right`],numArgs:1,primitive:!0,handler:(e,t)=>{var n=e.parser.gullet.macros.get(`\\current@color`);if(n&&typeof n!=`string`)throw new z(`\\current@color set to non-string in \\right`);return{type:`leftright-right`,mode:e.parser.mode,delim:UW(t[0],e).text,color:n}}}),Z({type:`leftright`,names:[`\\left`],numArgs:1,primitive:!0,handler:(e,t)=>{var n=UW(t[0],e),r=e.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect(`\\right`,!1);var a=UU(r.parseFunction(),`leftright-right`);return{type:`leftright`,mode:r.mode,body:i,left:n.text,right:a.delim,rightColor:a.color}},htmlBuilder:(e,t)=>{WW(e);for(var n=tU(e.body,t,!0,[`mopen`,`mclose`]),r=0,i=0,a=!1,o=0;o<n.length;o++){var s=n[o];HW(s)?a=!0:(r=Math.max(n[o].height,r),i=Math.max(n[o].depth,i))}r*=t.sizeMultiplier,i*=t.sizeMultiplier;var c=e.left===`.`?oU(t,[`mopen`]):zW(e.left,r,i,t,e.mode,[`mopen`]);if(n.unshift(c),a)for(var l=1;l<n.length;l++){var u=n[l];if(HW(u)){var d=u.isMiddle;n[l]=zW(d.delim,r,i,d.options,e.mode,[])}}var f;if(e.right===`.`)f=oU(t,[`mclose`]);else{var p=e.rightColor?t.withColor(e.rightColor):t;f=zW(e.right,r,i,p,e.mode,[`mclose`])}return n.push(f),X([`minner`],n,t)},mathmlBuilder:(e,t)=>{WW(e);var n=bU(e.body,t);if(e.left!==`.`){var r=new Q(`mo`,[hU(e.left,e.mode)]);r.setAttribute(`fence`,`true`),n.unshift(r)}if(e.right!==`.`){var i=new Q(`mo`,[hU(e.right,e.mode)]);i.setAttribute(`fence`,`true`),e.rightColor&&i.setAttribute(`mathcolor`,e.rightColor),n.push(i)}return gU(n)}}),Z({type:`middle`,names:[`\\middle`],numArgs:1,primitive:!0,handler:(e,t)=>{var n=UW(t[0],e);if(!e.parser.leftrightDepth)throw new z(`\\middle without preceding \\left`,n);return{type:`middle`,mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim===`.`?n=oU(t,[]):(n=MW(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=new Q(`mo`,[e.delim===`\\vert`||e.delim===`|`?hU(`|`,`text`):hU(e.delim,e.mode)]);return n.setAttribute(`fence`,`true`),n.setAttribute(`lspace`,`0.05em`),n.setAttribute(`rspace`,`0.05em`),n}}),Z({type:`enclose`,names:[`\\colorbox`],numArgs:2,allowedInText:!0,argTypes:[`color`,`hbox`],handler(e,t,n){var r=e.parser,i=e.funcName,a=UU(t[0],`color-token`).color,o=t[1];return{type:`enclose`,mode:r.mode,label:i,backgroundColor:a,body:o}},htmlBuilder:(e,t)=>{var n=MH(sU(e.body,t),t),r=e.label.slice(1),i=t.sizeMultiplier,a,o,s=hB(e.body);if(r===`sout`)a=X([`katex-stretchy`,`katex-sout`]),a.height=t.fontMetrics().defaultRuleThickness/i,o=-.5*t.fontMetrics().xHeight;else if(r===`phase`){var c=sV({number:.6,unit:`pt`},t),l=sV({number:.35,unit:`ex`},t),u=t.havingBaseSizing();i/=u.sizeMultiplier;var d=n.height+n.depth+c+l;n.style.paddingLeft=B(d/2+c);var f=Math.floor(1e3*d*i);a=OH([`hide-tail`],[new yV([new bV(`phase`,XB(f))],{width:`400em`,height:B(f/1e3),viewBox:`0 0 400000 `+f,preserveAspectRatio:`xMinYMin slice`})],t),a.style.height=B(d),o=n.depth+c+l}else{/cancel/.test(r)?s||n.classes.push(`cancel-pad`):r===`angl`?n.classes.push(`anglpad`):n.classes.push(`boxpad`);var p,m,h=0;/box/.test(r)?(h=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),p=t.fontMetrics().fboxsep+(r===`colorbox`?0:h),m=p):r===`angl`?(h=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),p=4*h,m=Math.max(0,.25-n.depth)):(p=s?.2:0,m=p),a=LU(n,r,p,m,t),/fbox|boxed|fcolorbox/.test(r)?(a.style.borderStyle=`solid`,a.style.borderWidth=B(h)):r===`angl`&&h!==.049&&(a.style.borderTopWidth=B(h),a.style.borderRightWidth=B(h)),o=n.depth+m,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var g;if(e.backgroundColor)g=PH({positionType:`individualShift`,children:[{type:`elem`,elem:a,shift:o},{type:`elem`,elem:n,shift:0}]});else{var _=/cancel|phase/.test(r)?[`svg-align`]:[];g=PH({positionType:`individualShift`,children:[{type:`elem`,elem:n,shift:0},{type:`elem`,elem:a,shift:o,wrapperClasses:_}]})}return/cancel/.test(r)&&(g.height=n.height,g.depth=n.depth),/cancel/.test(r)&&!s?X([`mord`,`cancel-lap`],[g],t):X([`mord`],[g],t)},mathmlBuilder:(e,t)=>{var n,r=new Q(e.label.includes(`colorbox`)?`mpadded`:`menclose`,[SU(e.body,t)]);switch(e.label){case`\\cancel`:r.setAttribute(`notation`,`updiagonalstrike`);break;case`\\bcancel`:r.setAttribute(`notation`,`downdiagonalstrike`);break;case`\\phase`:r.setAttribute(`notation`,`phasorangle`);break;case`\\sout`:r.setAttribute(`notation`,`horizontalstrike`);break;case`\\fbox`:r.setAttribute(`notation`,`box`);break;case`\\angl`:r.setAttribute(`notation`,`actuarial`);break;case`\\fcolorbox`:case`\\colorbox`:if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute(`width`,`+`+2*n+`pt`),r.setAttribute(`height`,`+`+2*n+`pt`),r.setAttribute(`lspace`,n+`pt`),r.setAttribute(`voffset`,n+`pt`),e.label===`\\fcolorbox`){var i=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute(`style`,`border: `+B(i)+` solid `+e.borderColor)}break;case`\\xcancel`:r.setAttribute(`notation`,`updiagonalstrike downdiagonalstrike`)}return e.backgroundColor&&r.setAttribute(`mathbackground`,e.backgroundColor),r}}),Z({type:`enclose`,names:[`\\fcolorbox`],numArgs:3,allowedInText:!0,argTypes:[`color`,`color`,`hbox`],handler(e,t,n){var r=e.parser,i=e.funcName,a=UU(t[0],`color-token`).color,o=UU(t[1],`color-token`).color,s=t[2];return{type:`enclose`,mode:r.mode,label:i,backgroundColor:o,borderColor:a,body:s}}}),Z({type:`enclose`,names:[`\\fbox`],numArgs:1,argTypes:[`hbox`],allowedInText:!0,handler(e,t){return{type:`enclose`,mode:e.parser.mode,label:`\\fbox`,body:t[0]}}}),Z({type:`enclose`,names:[`\\cancel`,`\\bcancel`,`\\xcancel`,`\\phase`],numArgs:1,handler(e,t){var n=e.parser,r=e.funcName,i=t[0];return{type:`enclose`,mode:n.mode,label:r,body:i}}}),Z({type:`enclose`,names:[`\\sout`],numArgs:1,allowedInText:!0,handler(e,t){var n=e.parser,r=e.funcName;n.mode===`math`&&yH({strict:n.settings.strict,errorCode:`mathVsSout`,errorMsg:`LaTeX's \\sout works only in text mode`,report:!0});var i=t[0];return{type:`enclose`,mode:n.mode,label:r,body:i}}}),Z({type:`enclose`,names:[`\\angl`],numArgs:1,argTypes:[`hbox`],allowedInText:!1,handler(e,t){return{type:`enclose`,mode:e.parser.mode,label:`\\angl`,body:t[0]}}});var GW={};function KW(e){for(var t=e.type,n=e.names,r=e.props,i=e.handler,a=e.htmlBuilder,o=e.mathmlBuilder,s={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},c=0;c<n.length;++c)GW[n[c]]=s;a&&(KH[t]=a),o&&(qH[t]=o)}var qW={};function $(e,t){qW[e]=t}var JW=class e{constructor(e,t,n){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=n}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new e(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}},YW=class e{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(t,n){return new e(n,JW.range(this,t))}};function XW(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for(n===`\\relax`&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n===`\\hline`||n===`\\hdashline`;)e.consume(),t.push(n===`\\hdashline`),e.consumeSpaces(),n=e.fetch().text;return t}var ZW=e=>{if(!e.parser.settings.displayMode)throw new z(`{`+e.envName+`} can be used only in display mode.`)},QW=new Set([`gather`,`gather*`]);function $W(e){if(!e.includes(`ed`))return!e.includes(`*`)}function eG(e,t,n){var r=t.hskipBeforeAndAfter,i=t.addJot,a=t.cols,o=t.arraystretch,s=t.colSeparationType,c=t.autoTag,l=t.singleRow,u=t.emptySingleRow,d=t.maxNumCols,f=t.leqno;if(e.gullet.beginGroup(),l||e.gullet.macros.set(`\\cr`,`\\\\\\relax`),!o){var p=e.gullet.expandMacroAsText(`\\arraystretch`);if(p==null)o=1;else if(o=parseFloat(p),!o||o<0)throw new z(`Invalid \\arraystretch: `+p)}e.gullet.beginGroup();var m=[],h=[m],g=[],_=[],v=c==null?void 0:[];function y(){c&&e.gullet.macros.set(`\\@eqnsw`,`1`,!0)}function b(){v&&(e.gullet.macros.get(`\\df@tag`)?(v.push(e.subparse([new YW(`\\df@tag`)])),e.gullet.macros.set(`\\df@tag`,void 0,!0)):v.push(!!c&&e.gullet.macros.get(`\\@eqnsw`)===`1`))}for(y(),_.push(XW(e));;){var x=e.parseExpression(!1,l?`\\end`:`\\\\`);e.gullet.endGroup(),e.gullet.beginGroup();var S={type:`ordgroup`,mode:e.mode,body:x};n&&(S={type:`styling`,mode:e.mode,style:n,resetFont:!0,body:[S]}),m.push(S);var ee=e.fetch().text;if(ee===`&`){if(d&&m.length===d){if(l||s)throw new z(`Too many tab characters: &`,e.nextToken);yH({strict:e.settings.strict,errorCode:`textEnv`,errorMsg:`Too few columns specified in the {array} column argument.`,report:!0})}e.consume()}else if(ee===`\\end`){b(),m.length===1&&S.type===`styling`&&S.body.length===1&&S.body[0].type===`ordgroup`&&S.body[0].body.length===0&&(h.length>1||!u)&&!Array.isArray(v?.[v.length-1])&&!(c&&v?.[v.length-1]===!0)&&h.pop(),_.length<h.length+1&&_.push([]);break}else if(ee===`\\\\`){e.consume();var te=void 0;e.gullet.future().text!==` `&&(te=e.parseSizeGroup(!0)),g.push(te?te.value:null),b(),_.push(XW(e)),m=[],h.push(m),y()}else throw new z(`Expected & or \\\\ or \\cr or \\end`,e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:`array`,mode:e.mode,addJot:i,arraystretch:o,body:h,cols:a,rowGaps:g,hskipBeforeAndAfter:r,hLinesBeforeRow:_,colSeparationType:s,tags:v,leqno:f}}function tG(e){return e.slice(0,1)===`d`?`display`:`text`}var nG=function(e,t){var n,r,i=e.body.length,a=e.hLinesBeforeRow,o=0,s=Array(i),c=[],l=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),u=1/t.fontMetrics().ptPerEm,d=5*u;e.colSeparationType&&e.colSeparationType===`small`&&(d=.2778*(t.havingStyle(RB.SCRIPT).sizeMultiplier/t.sizeMultiplier));var f=e.colSeparationType===`CD`?sV({number:3,unit:`ex`},t):12*u,p=3*u,m=e.arraystretch*f,h=.7*m,g=.3*m,_=0;function v(e){for(var t=0;t<e.length;++t)t>0&&(_+=.25),c.push({pos:_,isDashed:e[t]})}for(v(a[0]),n=0;n<e.body.length;++n){var y=e.body[n],b=h,x=g;o<y.length&&(o=y.length);var S={cells:Array(y.length),height:0,depth:0,pos:0};for(r=0;r<y.length;++r){var ee=sU(y[r],t);x<ee.depth&&(x=ee.depth),b<ee.height&&(b=ee.height),S.cells[r]=ee}var te=e.rowGaps[n],C=0;te&&(C=sV(te,t),C>0&&(C+=g,x<C&&(x=C),C=0)),e.addJot&&n<e.body.length-1&&(x+=p),S.height=b,S.depth=x,_+=b,S.pos=_,_+=x+C,s[n]=S,v(a[n+1])}var w=_/2+t.fontMetrics().axisHeight,ne=e.cols||[],re=[],T,ie,ae=[];if(e.tags&&e.tags.some(e=>e))for(n=0;n<i;++n){var oe=s[n],se=oe.pos-w,ce=e.tags[n],le=void 0;le=ce===!0?X([`eqn-num`],[],t):ce===!1?X([],[],t):X([],tU(ce,t,!0),t),le.depth=oe.depth,le.height=oe.height,ae.push({type:`elem`,elem:le,shift:se})}for(r=0,ie=0;r<o||ie<ne.length;++r,++ie){for(var ue=ne[ie],de=!0;(fe=ue)?.type===`separator`;){var fe;if(de||(T=X([`arraycolsep`],[]),T.style.width=B(t.fontMetrics().doubleRuleSep),re.push(T)),ue.separator===`|`||ue.separator===`:`){var pe=ue.separator===`|`?`solid`:`dashed`,me=X([`vertical-separator`],[],t);me.style.height=B(_),me.style.borderRightWidth=B(l),me.style.borderRightStyle=pe,me.style.margin=`0 `+B(-l/2);var he=_-w;he&&(me.style.verticalAlign=B(-he)),re.push(me)}else throw new z(`Invalid separator type: `+ue.separator);ie++,ue=ne[ie],de=!1}if(!(r>=o)){var ge=void 0;(r>0||e.hskipBeforeAndAfter)&&(ge=ue?.pregap??d,ge!==0&&(T=X([`arraycolsep`],[]),T.style.width=B(ge),re.push(T)));var _e=[];for(n=0;n<i;++n){var ve=s[n],ye=ve.cells[r];if(ye){var be=ve.pos-w;ye.depth=ve.depth,ye.height=ve.height,_e.push({type:`elem`,elem:ye,shift:be})}}var xe=PH({positionType:`individualShift`,children:_e}),E=X([`col-align-`+(ue?.align||`c`)],[xe]);re.push(E),(r<o-1||e.hskipBeforeAndAfter)&&(ge=ue?.postgap??d,ge!==0&&(T=X([`arraycolsep`],[]),T.style.width=B(ge),re.push(T)))}}var Se=X([`mtable`],re);if(c.length>0){for(var Ce=kH(`katex-hline`,t,l),we=kH(`katex-hdashline`,t,l),Te=[{type:`elem`,elem:Se,shift:0}];c.length>0;){var Ee=c.pop(),De=Ee.pos-w;Ee.isDashed?Te.push({type:`elem`,elem:we,shift:De}):Te.push({type:`elem`,elem:Ce,shift:De})}Se=PH({positionType:`individualShift`,children:Te})}if(ae.length===0)return X([`mord`],[Se],t);var Oe=X([`katex-tag`],[PH({positionType:`individualShift`,children:ae})],t);return jH([Se,Oe])},rG={c:`center `,l:`left `,r:`right `},iG=function(e,t){for(var n=[],r=new Q(`mtd`,[],[`mtr-glue`]),i=new Q(`mtd`,[],[`mml-eqn-num`]),a=0;a<e.body.length;a++){for(var o=e.body[a],s=[],c=0;c<o.length;c++)s.push(new Q(`mtd`,[SU(o[c],t)]));e.tags&&e.tags[a]&&(s.unshift(r),s.push(r),e.leqno?s.unshift(i):s.push(i)),n.push(new Q(`mtr`,s))}var l=new Q(`mtable`,n),u=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);l.setAttribute(`rowspacing`,B(u));var d=``,f=``;if(e.cols&&e.cols.length>0){var p=e.cols,m=``,h=!1,g=0,_=p.length;p[0].type===`separator`&&(d+=`top `,g=1),p[p.length-1].type===`separator`&&(d+=`bottom `,--_);for(var v=g;v<_;v++){var y=p[v];y.type===`align`?(f+=rG[y.align],h&&(m+=`none `),h=!0):y.type===`separator`&&(h&&=(m+=y.separator===`|`?`solid `:`dashed `,!1))}l.setAttribute(`columnalign`,f.trim()),/[sd]/.test(m)&&l.setAttribute(`columnlines`,m.trim())}if(e.colSeparationType===`align`){for(var b=e.cols||[],x=``,S=1;S<b.length;S++)x+=S%2?`0em `:`1em `;l.setAttribute(`columnspacing`,x.trim())}else e.colSeparationType===`alignat`||e.colSeparationType===`gather`?l.setAttribute(`columnspacing`,`0em`):e.colSeparationType===`small`?l.setAttribute(`columnspacing`,`0.2778em`):e.colSeparationType===`CD`?l.setAttribute(`columnspacing`,`0.5em`):l.setAttribute(`columnspacing`,`1em`);var ee=``,te=e.hLinesBeforeRow;d+=te[0].length>0?`left `:``,d+=te[te.length-1].length>0?`right `:``;for(var C=1;C<te.length-1;C++)ee+=te[C].length===0?`none `:te[C][0]?`dashed `:`solid `;return/[sd]/.test(ee)&&l.setAttribute(`rowlines`,ee.trim()),d!==``&&(l=new Q(`menclose`,[l]),l.setAttribute(`notation`,d.trim())),e.arraystretch&&e.arraystretch<1&&(l=new Q(`mstyle`,[l]),l.setAttribute(`scriptlevel`,`1`)),l},aG=function(e,t){e.envName.includes(`ed`)||ZW(e);var n=[],r=e.envName===`split`,i=eG(e.parser,{cols:n,addJot:!0,autoTag:r?void 0:$W(e.envName),emptySingleRow:!0,colSeparationType:e.envName.includes(`at`)?`alignat`:`align`,maxNumCols:r?2:void 0,leqno:e.parser.settings.leqno},`display`),a=0,o=0,s={type:`ordgroup`,mode:e.mode,body:[]};if(t[0]&&t[0].type===`ordgroup`){var c=`Number of columns should be a positive integer`,l=KU(t[0],c);if(!/^[0-9]+$/.test(l)||Number(l)<1)throw new z(c,t[0]);a=Number(l),o=a*2}var u=!o;i.body.forEach(function(e){for(var t=1;t<e.length;t+=2)UU(UU(e[t],`styling`).body[0],`ordgroup`).body.unshift(s);if(u)o<e.length&&(o=e.length);else{var n=e.length/2;if(a<n)throw new z(`Too many math in a row: `+(`expected `+a+`, but got `+n),e[0])}});for(var d=0;d<o;++d){var f=`r`,p=0;d%2==1?f=`l`:d>0&&u&&(p=1),n[d]={type:`align`,align:f,pregap:p,postgap:0}}return i.colSeparationType=u?`align`:`alignat`,i};KW({type:`array`,names:[`array`,`darray`],props:{numArgs:1},handler(e,t){var n=(GU(t[0])?[t[0]]:UU(t[0],`ordgroup`).body).map(function(e){var t=WU(e).text;if(`lcr`.includes(t))return{type:`align`,align:t};if(t===`|`)return{type:`separator`,separator:`|`};if(t===`:`)return{type:`separator`,separator:`:`};throw new z(`Unknown column alignment: `+t,e)}),r={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return eG(e.parser,r,tG(e.envName))},htmlBuilder:nG,mathmlBuilder:iG}),KW({type:`array`,names:[`matrix`,`pmatrix`,`bmatrix`,`Bmatrix`,`vmatrix`,`Vmatrix`,`matrix*`,`pmatrix*`,`bmatrix*`,`Bmatrix*`,`vmatrix*`,`Vmatrix*`],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:[`(`,`)`],bmatrix:[`[`,`]`],Bmatrix:[`\\{`,`\\}`],vmatrix:[`|`,`|`],Vmatrix:[`\\Vert`,`\\Vert`]}[e.envName.replace(`*`,``)],n=`c`,r={hskipBeforeAndAfter:!1,cols:[{type:`align`,align:n}]};if(e.envName.charAt(e.envName.length-1)===`*`){var i=e.parser;if(i.consumeSpaces(),i.fetch().text===`[`){if(i.consume(),i.consumeSpaces(),n=i.fetch().text,!`lcr`.includes(n))throw new z(`Expected l or c or r`,i.nextToken);i.consume(),i.consumeSpaces(),i.expect(`]`),i.consume(),r.cols=[{type:`align`,align:n}]}}var a=eG(e.parser,r,tG(e.envName)),o=Math.max(0,...a.body.map(e=>e.length));return a.cols=Array(o).fill({type:`align`,align:n}),t?{type:`leftright`,mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:nG,mathmlBuilder:iG}),KW({type:`array`,names:[`smallmatrix`],props:{numArgs:0},handler(e){var t=eG(e.parser,{arraystretch:.5},`script`);return t.colSeparationType=`small`,t},htmlBuilder:nG,mathmlBuilder:iG}),KW({type:`array`,names:[`subarray`],props:{numArgs:1},handler(e,t){var n=(GU(t[0])?[t[0]]:UU(t[0],`ordgroup`).body).map(function(e){var t=WU(e).text;if(`lc`.includes(t))return{type:`align`,align:t};throw new z(`Unknown column alignment: `+t,e)});if(n.length>1)throw new z(`{subarray} can contain only one column`);var r={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5},i=eG(e.parser,r,`script`);if(i.body.length>0&&i.body[0].length>1)throw new z(`{subarray} can contain only one column`);return i},htmlBuilder:nG,mathmlBuilder:iG}),KW({type:`array`,names:[`cases`,`dcases`,`rcases`,`drcases`],props:{numArgs:0},handler(e){var t=eG(e.parser,{arraystretch:1.2,cols:[{type:`align`,align:`l`,pregap:0,postgap:1},{type:`align`,align:`l`,pregap:0,postgap:0}]},tG(e.envName));return{type:`leftright`,mode:e.mode,body:[t],left:e.envName.includes(`r`)?`.`:`\\{`,right:e.envName.includes(`r`)?`\\}`:`.`,rightColor:void 0}},htmlBuilder:nG,mathmlBuilder:iG}),KW({type:`array`,names:[`align`,`align*`,`aligned`,`split`],props:{numArgs:0},handler:aG,htmlBuilder:nG,mathmlBuilder:iG}),KW({type:`array`,names:[`gathered`,`gather`,`gather*`],props:{numArgs:0},handler(e){QW.has(e.envName)&&ZW(e);var t={cols:[{type:`align`,align:`c`}],addJot:!0,colSeparationType:`gather`,autoTag:$W(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return eG(e.parser,t,`display`)},htmlBuilder:nG,mathmlBuilder:iG}),KW({type:`array`,names:[`alignat`,`alignat*`,`alignedat`],props:{numArgs:1},handler:aG,htmlBuilder:nG,mathmlBuilder:iG}),KW({type:`array`,names:[`equation`,`equation*`],props:{numArgs:0},handler(e){ZW(e);var t={autoTag:$W(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return eG(e.parser,t,`display`)},htmlBuilder:nG,mathmlBuilder:iG}),KW({type:`array`,names:[`CD`],props:{numArgs:0},handler(e){return ZW(e),oW(e.parser)},htmlBuilder:nG,mathmlBuilder:iG}),$(`\\nonumber`,`\\gdef\\@eqnsw{0}`),$(`\\notag`,`\\nonumber`),Z({type:`text`,names:[`\\hline`,`\\hdashline`],numArgs:0,allowedInText:!0,allowedInMath:!0,handler(e,t){throw new z(e.funcName+` valid only within array environment`)}});var oG=GW;Z({type:`environment`,names:[`\\begin`,`\\end`],numArgs:1,argTypes:[`text`],handler(e,t){var n=e.parser,r=e.funcName,i=t[0];if(i.type!==`ordgroup`)throw new z(`Invalid environment name`,i);var a=KU(i,`Environment name should contain only text characters and spaces`,!0);if(r===`\\begin`){if(!Object.prototype.hasOwnProperty.call(oG,a))throw new z(`No such environment: `+a,i);var o=oG[a],s=n.parseArguments(`\\begin{`+a+`}`,o),c=s.args,l=s.optArgs,u={mode:n.mode,envName:a,parser:n},d=o.handler(u,c,l);n.expect(`\\end`,!1);var f=n.nextToken,p=UU(n.parseFunction(),`environment`);if(p.name!==a)throw new z(`Mismatch: \\begin{`+a+`} matched by \\end{`+p.name+`}`,f);return d}return{type:`environment`,mode:n.mode,name:a,nameGroup:i}}});var sG=(e,t)=>{var n=e.font,r=t.withFont(n);return sU(e.body,r)},cG=(e,t)=>{var n=e.font,r=t.withFont(n);return SU(e.body,r)},lG={"\\Bbb":`\\mathbb`,"\\bold":`\\mathbf`,"\\frak":`\\mathfrak`};Z({type:`font`,names:[`\\mathrm`,`\\mathit`,`\\mathbf`,`\\mathnormal`,`\\mathsfit`,`\\mathbb`,`\\mathcal`,`\\mathfrak`,`\\mathscr`,`\\mathsf`,`\\mathtt`,`\\Bbb`,`\\bold`,`\\frak`],numArgs:1,allowedInArgument:!0,handler:(e,t)=>{var n=e.parser,r=e.funcName,i=YH(t[0]),a=r in lG?lG[r]:r;return{type:`font`,mode:n.mode,font:a.slice(1),body:i}},htmlBuilder:sG,mathmlBuilder:cG}),Z({type:`mclass`,names:[`\\boldsymbol`,`\\bm`],numArgs:1,handler:(e,t)=>{var n=e.parser,r=t[0];return{type:`mclass`,mode:n.mode,mclass:eW(r),body:[{type:`font`,mode:n.mode,font:`boldsymbol`,body:r}],isCharacterBox:hB(r)}}}),Z({type:`font`,names:[`\\rm`,`\\sf`,`\\tt`,`\\bf`,`\\it`,`\\cal`],numArgs:0,allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=e.funcName,i=e.breakOnTokenText,a=n.mode,o=n.parseExpression(!0,i);return{type:`font`,mode:a,font:`math`+r.slice(1),body:{type:`ordgroup`,mode:n.mode,body:o}}}});var uG=(e,t)=>{var n=t.style,r=n.fracNum(),i=n.fracDen(),a=t.havingStyle(r),o=sU(e.numer,a,t);if(e.continued){var s=8.5/t.fontMetrics().ptPerEm,c=3.5/t.fontMetrics().ptPerEm;o.height=o.height<s?s:o.height,o.depth=o.depth<c?c:o.depth}a=t.havingStyle(i);var l=sU(e.denom,a,t),u,d,f;e.hasBarLine?(e.barSize?(d=sV(e.barSize,t),u=kH(`frac-line`,t,d)):u=kH(`frac-line`,t),d=u.height,f=u.height):(u=null,d=0,f=t.fontMetrics().defaultRuleThickness);var p,m,h;n.size===RB.DISPLAY.size?(p=t.fontMetrics().num1,m=d>0?3*f:7*f,h=t.fontMetrics().denom1):(d>0?(p=t.fontMetrics().num2,m=f):(p=t.fontMetrics().num3,m=3*f),h=t.fontMetrics().denom2);var g;if(u){var _=t.fontMetrics().axisHeight;p-o.depth-(_+.5*d)<m&&(p+=m-(p-o.depth-(_+.5*d))),_-.5*d-(l.height-h)<m&&(h+=m-(_-.5*d-(l.height-h)));var v=-(_-.5*d);g=PH({positionType:`individualShift`,children:[{type:`elem`,elem:l,shift:h},{type:`elem`,elem:u,shift:v},{type:`elem`,elem:o,shift:-p}]})}else{var y=p-o.depth-(l.height-h);y<m&&(p+=.5*(m-y),h+=.5*(m-y)),g=PH({positionType:`individualShift`,children:[{type:`elem`,elem:l,shift:h},{type:`elem`,elem:o,shift:-p}]})}a=t.havingStyle(n),g.height*=a.sizeMultiplier/t.sizeMultiplier,g.depth*=a.sizeMultiplier/t.sizeMultiplier;var b=n.size===RB.DISPLAY.size?t.fontMetrics().delim1:n.size===RB.SCRIPTSCRIPT.size?t.havingStyle(RB.SCRIPT).fontMetrics().delim2:t.fontMetrics().delim2,x=e.leftDelim==null?oU(t,[`mopen`]):RW(e.leftDelim,b,!0,t.havingStyle(n),e.mode,[`mopen`]),S=e.continued?X([]):e.rightDelim==null?oU(t,[`mclose`]):RW(e.rightDelim,b,!0,t.havingStyle(n),e.mode,[`mclose`]);return X([`mord`].concat(a.sizingClasses(t)),[x,X([`mfrac`],[g]),S],t)},dG=(e,t)=>{var n=new Q(`mfrac`,[SU(e.numer,t),SU(e.denom,t)]);if(!e.hasBarLine)n.setAttribute(`linethickness`,`0px`);else if(e.barSize){var r=sV(e.barSize,t);n.setAttribute(`linethickness`,B(r))}if(e.leftDelim!=null||e.rightDelim!=null){var i=[];if(e.leftDelim!=null){var a=new Q(`mo`,[new dU(e.leftDelim.replace(`\\`,``))]);a.setAttribute(`fence`,`true`),i.push(a)}if(i.push(n),e.rightDelim!=null){var o=new Q(`mo`,[new dU(e.rightDelim.replace(`\\`,``))]);o.setAttribute(`fence`,`true`),i.push(o)}return gU(i)}return n},fG=(e,t)=>t?{type:`styling`,mode:e.mode,style:t,body:[e]}:e;Z({type:`genfrac`,names:[`\\cfrac`,`\\dfrac`,`\\frac`,`\\tfrac`,`\\dbinom`,`\\binom`,`\\tbinom`,`\\\\atopfrac`,`\\\\bracefrac`,`\\\\brackfrac`],numArgs:2,allowedInArgument:!0,handler:(e,t)=>{var n=e.parser,r=e.funcName,i=t[0],a=t[1],o,s=null,c=null;switch(r){case`\\cfrac`:case`\\dfrac`:case`\\frac`:case`\\tfrac`:o=!0;break;case`\\\\atopfrac`:o=!1;break;case`\\dbinom`:case`\\binom`:case`\\tbinom`:o=!1,s=`(`,c=`)`;break;case`\\\\bracefrac`:o=!1,s=`\\{`,c=`\\}`;break;case`\\\\brackfrac`:o=!1,s=`[`,c=`]`;break;default:throw Error(`Unrecognized genfrac command`)}var l=r===`\\cfrac`,u=null;return l||r.startsWith(`\\d`)?u=`display`:r.startsWith(`\\t`)&&(u=`text`),fG({type:`genfrac`,mode:n.mode,numer:i,denom:a,continued:l,hasBarLine:o,leftDelim:s,rightDelim:c,barSize:null},u)},htmlBuilder:uG,mathmlBuilder:dG}),Z({type:`infix`,names:[`\\over`,`\\choose`,`\\atop`,`\\brace`,`\\brack`],numArgs:0,infix:!0,handler(e){var t=e.parser,n=e.funcName,r=e.token,i;switch(n){case`\\over`:i=`\\frac`;break;case`\\choose`:i=`\\binom`;break;case`\\atop`:i=`\\\\atopfrac`;break;case`\\brace`:i=`\\\\bracefrac`;break;case`\\brack`:i=`\\\\brackfrac`;break;default:throw Error(`Unrecognized infix genfrac command`)}return{type:`infix`,mode:t.mode,replaceWith:i,token:r}}});var pG=[`display`,`text`,`script`,`scriptscript`],mG=function(e){var t=null;return e.length>0&&(t=e,t=t===`.`?null:t),t};Z({type:`genfrac`,names:[`\\genfrac`],numArgs:6,allowedInArgument:!0,argTypes:[`math`,`math`,`size`,`text`,`math`,`math`],handler(e,t){var n=e.parser,r=t[4],i=t[5],a=YH(t[0]),o=a.type===`atom`&&a.family===`open`?mG(a.text):null,s=YH(t[1]),c=s.type===`atom`&&s.family===`close`?mG(s.text):null,l=UU(t[2],`size`),u,d=null;l.isBlank?u=!0:(d=l.value,u=d.number>0);var f=null,p=t[3];if(p.type===`ordgroup`){if(p.body.length>0){var m=UU(p.body[0],`textord`);f=pG[Number(m.text)]}}else p=UU(p,`textord`),f=pG[Number(p.text)];return fG({type:`genfrac`,mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:u,barSize:d,leftDelim:o,rightDelim:c},f)}}),Z({type:`infix`,names:[`\\above`],numArgs:1,argTypes:[`size`],infix:!0,handler(e,t){var n=e.parser;e.funcName;var r=e.token;return{type:`infix`,mode:n.mode,replaceWith:`\\\\abovefrac`,size:UU(t[0],`size`).value,token:r}}}),Z({type:`genfrac`,names:[`\\\\abovefrac`],numArgs:3,argTypes:[`math`,`size`,`math`],handler:(e,t)=>{var n=e.parser;e.funcName;var r=t[0],i=UU(t[1],`infix`).size;if(!i)throw Error(`\\\\abovefrac expected size, but got `+String(i));var a=t[2],o=i.number>0;return{type:`genfrac`,mode:n.mode,numer:r,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null}}});var hG=(e,t)=>{var n=t.style,r,i;e.type===`supsub`?(r=e.sup?sU(e.sup,t.havingStyle(n.sup()),t):sU(e.sub,t.havingStyle(n.sub()),t),i=UU(e.base,`horizBrace`)):i=UU(e,`horizBrace`);var a=sU(i.base,t.havingBaseStyle(RB.DISPLAY)),o=IU(i,t),s=i.isOver?PH({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`kern`,size:.1},{type:`elem`,elem:o,wrapperClasses:[`svg-align`]}]}):PH({positionType:`bottom`,positionData:a.depth+.1+o.height,children:[{type:`elem`,elem:o,wrapperClasses:[`svg-align`]},{type:`kern`,size:.1},{type:`elem`,elem:a}]});if(r){var c=X([`minner`,i.isOver?`mover`:`munder`],[s],t);s=i.isOver?PH({positionType:`firstBaseline`,children:[{type:`elem`,elem:c},{type:`kern`,size:.2},{type:`elem`,elem:r}]}):PH({positionType:`bottom`,positionData:c.depth+.2+r.height+r.depth,children:[{type:`elem`,elem:r},{type:`kern`,size:.2},{type:`elem`,elem:c}]})}return X([`minner`,i.isOver?`mover`:`munder`],[s],t)};Z({type:`horizBrace`,names:[`\\overbrace`,`\\underbrace`,`\\overbracket`,`\\underbracket`],numArgs:1,handler(e,t){var n=e.parser,r=e.funcName;return{type:`horizBrace`,mode:n.mode,label:r,isOver:r.includes(`\\over`),base:t[0]}},htmlBuilder:hG,mathmlBuilder:(e,t)=>{var n=NU(e.label);return new Q(e.isOver?`mover`:`munder`,[SU(e.base,t),n])}}),Z({type:`href`,names:[`\\href`],numArgs:2,argTypes:[`url`,`original`],allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=t[1],i=UU(t[0],`url`).url;return n.settings.isTrusted({command:`\\href`,url:i})?{type:`href`,mode:n.mode,href:i,body:XH(r)}:n.formatUnsupportedCmd(`\\href`)},htmlBuilder:(e,t)=>{var n=tU(e.body,t,!1);return AH(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=xU(e.body,t);return n instanceof Q||(n=new Q(`mrow`,[n])),n.setAttribute(`href`,e.href),n}}),Z({type:`href`,names:[`\\url`],numArgs:1,argTypes:[`url`],allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=UU(t[0],`url`).url;if(!n.settings.isTrusted({command:`\\url`,url:r}))return n.formatUnsupportedCmd(`\\url`);for(var i=[],a=0;a<r.length;a++){var o=r[a];o===`~`&&(o=`\\textasciitilde`),i.push({type:`textord`,mode:`text`,text:o})}var s={type:`text`,mode:n.mode,font:`\\texttt`,body:i};return{type:`href`,mode:n.mode,href:r,body:XH(s)}}}),Z({type:`hbox`,names:[`\\hbox`],numArgs:1,argTypes:[`text`],allowedInText:!0,primitive:!0,handler(e,t){return{type:`hbox`,mode:e.parser.mode,body:XH(t[0])}},htmlBuilder(e,t){return jH(tU(e.body,t.withFont(``),!1))},mathmlBuilder(e,t){return new Q(`mrow`,bU(e.body,t.withFont(``)))}}),Z({type:`html`,names:[`\\htmlClass`,`\\htmlId`,`\\htmlStyle`,`\\htmlData`],numArgs:2,argTypes:[`raw`,`original`],allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=e.funcName;e.token;var i=UU(t[0],`raw`).string,a=t[1];n.settings.strict&&yH({strict:n.settings.strict,errorCode:`htmlExtension`,errorMsg:`HTML extension is disabled on strict mode`,report:!0});var o,s={};switch(r){case`\\htmlClass`:s.class=i,o={command:`\\htmlClass`,class:i};break;case`\\htmlId`:s.id=i,o={command:`\\htmlId`,id:i};break;case`\\htmlStyle`:s.style=i,o={command:`\\htmlStyle`,style:i};break;case`\\htmlData`:for(var c=`{,}`,l=[],u=``,d=0;d<i.length;d++)i.startsWith(c,d)?(u+=`,`,d+=c.length-1):i[d]===`,`?(l.push(u),u=``):u+=i[d];l.push(u);for(var f=0;f<l.length;f++){var p=l[f],m=p.indexOf(`=`);if(m<0)throw new z(`\\htmlData key/value '`+p+`' missing equals sign`);var h=p.slice(0,m),g=p.slice(m+1);s[`data-`+h.trim()]=g}o={command:`\\htmlData`,attributes:s};break;default:throw Error(`Unrecognized html command`)}return n.settings.isTrusted(o)?{type:`html`,mode:n.mode,attributes:s,body:XH(a)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=tU(e.body,t,!1),r=[`enclosing`];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var i=X(r,n,t);for(var a of Object.entries(e.attributes)){var o=a[0],s=a[1];o!==`class`&&i.setAttribute(o,s)}return i},mathmlBuilder:(e,t)=>xU(e.body,t)}),Z({type:`htmlmathml`,names:[`\\html@mathml`],numArgs:2,allowedInArgument:!0,allowedInText:!0,handler:(e,t)=>({type:`htmlmathml`,mode:e.parser.mode,html:XH(t[0]),mathml:XH(t[1])}),htmlBuilder:(e,t)=>jH(tU(e.html,t,!1)),mathmlBuilder:(e,t)=>xU(e.mathml,t)});var gG=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:`bp`};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new z(`Invalid size: '`+e+`' in \\includegraphics`);var n={number:+(t[1]+t[2]),unit:t[3]};if(!oV(n))throw new z(`Invalid unit: '`+n.unit+`' in \\includegraphics.`);return n};Z({type:`includegraphics`,names:[`\\includegraphics`],numArgs:1,numOptionalArgs:1,argTypes:[`raw`,`url`],allowedInText:!1,handler:(e,t,n)=>{var r=e.parser,i={number:0,unit:`em`},a={number:.9,unit:`em`},o={number:0,unit:`em`},s=``;if(n[0])for(var c=UU(n[0],`raw`).string.split(`,`),l=0;l<c.length;l++){var u=c[l].split(`=`);if(u.length===2){var d=u[1].trim();switch(u[0].trim()){case`alt`:s=d;break;case`width`:i=gG(d);break;case`height`:a=gG(d);break;case`totalheight`:o=gG(d);break;default:throw new z(`Invalid key: '`+u[0]+`' in \\includegraphics.`)}}}var f=UU(t[0],`url`).url;return s===``&&(s=f,s=s.replace(/^.*[\\/]/,``),s=s.substring(0,s.lastIndexOf(`.`))),r.settings.isTrusted({command:`\\includegraphics`,url:f})?{type:`includegraphics`,mode:r.mode,alt:s,width:i,height:a,totalheight:o,src:f}:r.formatUnsupportedCmd(`\\includegraphics`)},htmlBuilder:(e,t)=>{var n=sV(e.height,t),r=0;e.totalheight.number>0&&(r=sV(e.totalheight,t)-n);var i=0;e.width.number>0&&(i=sV(e.width,t));var a={height:B(n+r)};i>0&&(a.width=B(i)),r>0&&(a.verticalAlign=B(-r));var o=new gV(e.src,e.alt,a);return o.height=n,o.depth=r,o},mathmlBuilder:(e,t)=>{var n=new Q(`mglyph`,[]);n.setAttribute(`alt`,e.alt);var r=sV(e.height,t),i=0;if(e.totalheight.number>0&&(i=sV(e.totalheight,t)-r,n.setAttribute(`valign`,B(-i))),n.setAttribute(`height`,B(r+i)),e.width.number>0){var a=sV(e.width,t);n.setAttribute(`width`,B(a))}return n.setAttribute(`src`,e.src),n}}),Z({type:`kern`,names:[`\\kern`,`\\mkern`,`\\hskip`,`\\mskip`],numArgs:1,argTypes:[`size`],primitive:!0,allowedInText:!0,handler(e,t){var n=e.parser,r=e.funcName,i=UU(t[0],`size`);if(n.settings.strict){var a=r[1]===`m`,o=i.value.unit===`mu`;a?(o||yH({strict:n.settings.strict,errorCode:`mathVsTextUnits`,errorMsg:`LaTeX's `+r+` supports only mu units, `+(`not `+i.value.unit+` units`),report:!0}),n.mode!==`math`&&yH({strict:n.settings.strict,errorCode:`mathVsTextUnits`,errorMsg:`LaTeX's `+r+` works only in math mode`,report:!0})):o&&yH({strict:n.settings.strict,errorCode:`mathVsTextUnits`,errorMsg:`LaTeX's `+r+` doesn't support mu units`,report:!0})}return{type:`kern`,mode:n.mode,dimension:i.value}},htmlBuilder(e,t){return FH(e.dimension,t)},mathmlBuilder(e,t){return new fU(sV(e.dimension,t))}}),Z({type:`lap`,names:[`\\mathllap`,`\\mathrlap`,`\\mathclap`],numArgs:1,allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=e.funcName,i=t[0];return{type:`lap`,mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:(e,t)=>{var n;e.alignment===`clap`?(n=X([],[sU(e.body,t)]),n=X([`katex-inner`],[n],t)):n=X([`katex-inner`],[sU(e.body,t)]);var r=X([`katex-fix`],[]),i=X([e.alignment],[n,r],t),a=X([`katex-strut`]);return a.style.height=B(i.height+i.depth),i.depth&&(a.style.verticalAlign=B(-i.depth)),i.children.unshift(a),i=X([`katex-thinbox`],[i],t),X([`mord`,`katex-vbox`],[i],t)},mathmlBuilder:(e,t)=>{var n=new Q(`mpadded`,[SU(e.body,t)]);if(e.alignment!==`rlap`){var r=e.alignment===`llap`?`-1`:`-0.5`;n.setAttribute(`lspace`,r+`width`)}return n.setAttribute(`width`,`0px`),n}}),Z({type:`styling`,names:[`\\(`,`$`],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){var n=e.funcName,r=e.parser,i=r.mode;r.switchMode(`math`);var a=n===`\\(`?`\\)`:`$`,o=r.parseExpression(!1,a);return r.expect(a),r.switchMode(i),{type:`styling`,mode:r.mode,style:`text`,resetFont:!0,body:o}}}),Z({type:`text`,names:[`\\)`,`\\]`],numArgs:0,allowedInText:!0,allowedInMath:!1,handler(e,t){throw new z(`Mismatched `+e.funcName)}});var _G=(e,t)=>{switch(t.style.size){case RB.DISPLAY.size:return e.display;case RB.TEXT.size:return e.text;case RB.SCRIPT.size:return e.script;case RB.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Z({type:`mathchoice`,names:[`\\mathchoice`],numArgs:4,primitive:!0,handler:(e,t)=>({type:`mathchoice`,mode:e.parser.mode,display:XH(t[0]),text:XH(t[1]),script:XH(t[2]),scriptscript:XH(t[3])}),htmlBuilder:(e,t)=>jH(tU(_G(e,t),t,!1)),mathmlBuilder:(e,t)=>xU(_G(e,t),t)});var vG=(e,t,n,r,i,a,o)=>{e=X([],[e]);var s=n&&hB(n),c,l;if(t){var u=sU(t,r.havingStyle(i.sup()),r);l={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=sU(n,r.havingStyle(i.sub()),r);c={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}var f;if(l&&c)f=PH({positionType:`bottom`,positionData:r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+e.depth+o,children:[{type:`kern`,size:r.fontMetrics().bigOpSpacing5},{type:`elem`,elem:c.elem,marginLeft:B(-a)},{type:`kern`,size:c.kern},{type:`elem`,elem:e},{type:`kern`,size:l.kern},{type:`elem`,elem:l.elem,marginLeft:B(a)},{type:`kern`,size:r.fontMetrics().bigOpSpacing5}]});else if(c)f=PH({positionType:`top`,positionData:e.height-o,children:[{type:`kern`,size:r.fontMetrics().bigOpSpacing5},{type:`elem`,elem:c.elem,marginLeft:B(-a)},{type:`kern`,size:c.kern},{type:`elem`,elem:e}]});else if(l)f=PH({positionType:`bottom`,positionData:e.depth+o,children:[{type:`elem`,elem:e},{type:`kern`,size:l.kern},{type:`elem`,elem:l.elem,marginLeft:B(a)},{type:`kern`,size:r.fontMetrics().bigOpSpacing5}]});else return e;var p=[f];if(c&&a!==0&&!s){var m=X([`mspace`],[],r);m.style.marginRight=B(a),p.unshift(m)}return X([`mop`,`op-limits`],p,r)},yG=new Set([`\\smallint`]),bG=(e,t)=>{var n,r,i=!1,a;e.type===`supsub`?(n=e.sup,r=e.sub,a=UU(e.base,`op`),i=!0):a=UU(e,`op`);var o=t.style,s=!1;o.size===RB.DISPLAY.size&&a.symbol&&!yG.has(a.name)&&(s=!0);var c,l;if(a.symbol){var u=s?`Size2-Regular`:`Size1-Regular`,d=``;if((a.name===`\\oiint`||a.name===`\\oiiint`)&&(d=a.name.slice(1),a.name=d===`oiint`?`\\iint`:`\\iiint`),c=xH(a.name,u,`math`,t,[`mop`,`op-symbol`,s?`large-op`:`small-op`]),l=c.italic,d.length>0){var f=zH(d+`Size`+(s?`2`:`1`),t);c=PH({positionType:`individualShift`,children:[{type:`elem`,elem:c,shift:0},{type:`elem`,elem:f,shift:s?.08:0}]}),a.name=`\\`+d,c.classes.unshift(`mop`),c.italic=l}}else if(a.body){var p=tU(a.body,t,!0);p.length===1&&p[0]instanceof vV?(c=p[0],c.classes[0]=`mop`):c=X([`mop`],p,t)}else{for(var m=[],h=1;h<a.name.length;h++)m.push(SH(a.name[h],a.mode,t));c=X([`mop`],m,t)}var g=0,_=0;return(c instanceof vV||a.name===`\\oiint`||a.name===`\\oiiint`)&&!a.suppressBaseShift&&(g=(c.height-c.depth)/2-t.fontMetrics().axisHeight,_=c.italic??0),i?vG(c,n,r,t,o,_,g):(g&&(c.style.position=`relative`,c.style.top=B(g)),c)},xG=(e,t)=>{var n;if(e.symbol)n=new Q(`mo`,[hU(e.name,e.mode)]),yG.has(e.name)&&n.setAttribute(`largeop`,`false`);else if(e.body)n=new Q(`mo`,bU(e.body,t));else{n=new Q(`mi`,[new dU(e.name.slice(1))]);var r=new Q(`mo`,[hU(`⁡`,`text`)]);n=e.parentIsSupSub?new Q(`mrow`,[n,r]):uU([n,r])}return n},SG={"∏":`\\prod`,"∐":`\\coprod`,"∑":`\\sum`,"⋀":`\\bigwedge`,"⋁":`\\bigvee`,"⋂":`\\bigcap`,"⋃":`\\bigcup`,"⨀":`\\bigodot`,"⨁":`\\bigoplus`,"⨂":`\\bigotimes`,"⨄":`\\biguplus`,"⨆":`\\bigsqcup`};Z({type:`op`,names:`\\coprod.\\bigvee.\\bigwedge.\\biguplus.\\bigcap.\\bigcup.\\intop.\\prod.\\sum.\\bigotimes.\\bigoplus.\\bigodot.\\bigsqcup.\\smallint.∏.∐.∑.⋀.⋁.⋂.⋃.⨀.⨁.⨂.⨄.⨆`.split(`.`),numArgs:0,handler:(e,t)=>{var n=e.parser,r=e.funcName;return r.length===1&&(r=SG[r]),{type:`op`,mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:bG,mathmlBuilder:xG}),Z({type:`op`,names:[`\\mathop`],numArgs:1,primitive:!0,handler:(e,t)=>{var n=e.parser,r=t[0];return{type:`op`,mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:XH(r)}}});var CG={"∫":`\\int`,"∬":`\\iint`,"∭":`\\iiint`,"∮":`\\oint`,"∯":`\\oiint`,"∰":`\\oiiint`};Z({type:`op`,names:`\\arcsin.\\arccos.\\arctan.\\arctg.\\arcctg.\\arg.\\ch.\\cos.\\cosec.\\cosh.\\cot.\\cotg.\\coth.\\csc.\\ctg.\\cth.\\deg.\\dim.\\exp.\\hom.\\ker.\\lg.\\ln.\\log.\\sec.\\sin.\\sinh.\\sh.\\tan.\\tanh.\\tg.\\th`.split(`.`),numArgs:0,handler(e){var t=e.parser,n=e.funcName;return{type:`op`,mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}}}),Z({type:`op`,names:[`\\det`,`\\gcd`,`\\inf`,`\\lim`,`\\max`,`\\min`,`\\Pr`,`\\sup`],numArgs:0,handler(e){var t=e.parser,n=e.funcName;return{type:`op`,mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}}}),Z({type:`op`,names:[`\\int`,`\\iint`,`\\iiint`,`\\oint`,`\\oiint`,`\\oiiint`,`∫`,`∬`,`∭`,`∮`,`∯`,`∰`],numArgs:0,allowedInArgument:!0,handler(e){var t=e.parser,n=e.funcName;return n.length===1&&(n=CG[n]),{type:`op`,mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:n}}});var wG=(e,t)=>{var n,r,i=!1,a;e.type===`supsub`?(n=e.sup,r=e.sub,a=UU(e.base,`operatorname`),i=!0):a=UU(e,`operatorname`);var o;if(a.body.length>0){for(var s=tU(a.body.map(e=>{var t=`text`in e?e.text:void 0;return typeof t==`string`?{type:`textord`,mode:e.mode,text:t}:e}),t.withFont(`mathrm`),!0),c=0;c<s.length;c++){var l=s[c];l instanceof vV&&(l.text=l.text.replace(/\u2212/,`-`).replace(/\u2217/,`*`))}o=X([`mop`],s,t)}else o=X([`mop`],[],t);return i?vG(o,n,r,t,t.style,0,0):o};Z({type:`operatorname`,names:[`\\operatorname@`,`\\operatornamewithlimits`],numArgs:1,handler:(e,t)=>{var n=e.parser,r=e.funcName,i=t[0];return{type:`operatorname`,mode:n.mode,body:XH(i),alwaysHandleSupSub:r===`\\operatornamewithlimits`,limits:!1,parentIsSupSub:!1}},htmlBuilder:wG,mathmlBuilder:(e,t)=>{for(var n=bU(e.body,t.withFont(`mathrm`)),r=!0,i=0;i<n.length;i++){var a=n[i];if(!(a instanceof fU)){if(a instanceof Q)switch(a.type){case`mi`:case`mn`:case`mspace`:case`mtext`:break;case`mo`:var o=a.children[0];a.children.length===1&&o instanceof dU?o.text=o.text.replace(/\u2212/,`-`).replace(/\u2217/,`*`):r=!1;break;default:r=!1}else r=!1}}r&&(n=[new dU(n.map(e=>e.toText()).join(``))]);var s=new Q(`mi`,n);s.setAttribute(`mathvariant`,`normal`);var c=new Q(`mo`,[hU(`⁡`,`text`)]);return e.parentIsSupSub?new Q(`mrow`,[s,c]):uU([s,c])}}),$(`\\operatorname`,`\\@ifstar\\operatornamewithlimits\\operatorname@`),JH({type:`ordgroup`,htmlBuilder(e,t){return e.semisimple?jH(tU(e.body,t,!1)):X([`mord`],tU(e.body,t,!0),t)},mathmlBuilder(e,t){return xU(e.body,t,!0)}}),Z({type:`overline`,names:[`\\overline`],numArgs:1,handler(e,t){var n=e.parser,r=t[0];return{type:`overline`,mode:n.mode,body:r}},htmlBuilder(e,t){var n=sU(e.body,t.havingCrampedStyle()),r=kH(`overline-line`,t),i=t.fontMetrics().defaultRuleThickness;return X([`mord`,`katex-overline`],[PH({positionType:`firstBaseline`,children:[{type:`elem`,elem:n},{type:`kern`,size:3*i},{type:`elem`,elem:r},{type:`kern`,size:i}]})],t)},mathmlBuilder(e,t){var n=new Q(`mo`,[new dU(`‾`)]);n.setAttribute(`stretchy`,`true`);var r=new Q(`mover`,[SU(e.body,t),n]);return r.setAttribute(`accent`,`true`),r}}),Z({type:`phantom`,names:[`\\phantom`],numArgs:1,allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=t[0];return{type:`phantom`,mode:n.mode,body:XH(r)}},htmlBuilder:(e,t)=>jH(tU(e.body,t.withPhantom(),!1)),mathmlBuilder:(e,t)=>new Q(`mphantom`,bU(e.body,t))}),$(`\\hphantom`,`\\smash{\\phantom{#1}}`),Z({type:`vphantom`,names:[`\\vphantom`],numArgs:1,allowedInText:!0,handler:(e,t)=>{var n=e.parser,r=t[0];return{type:`vphantom`,mode:n.mode,body:r}},htmlBuilder:(e,t)=>X([`mord`,`rlap`],[X([`katex-inner`],[sU(e.body,t.withPhantom())]),X([`katex-fix`],[])],t),mathmlBuilder:(e,t)=>{var n=new Q(`mpadded`,[new Q(`mphantom`,bU(XH(e.body),t))]);return n.setAttribute(`width`,`0px`),n}}),Z({type:`raisebox`,names:[`\\raisebox`],numArgs:2,argTypes:[`size`,`hbox`],allowedInText:!0,handler(e,t){var n=e.parser,r=UU(t[0],`size`).value,i=t[1];return{type:`raisebox`,mode:n.mode,dy:r,body:i}},htmlBuilder(e,t){var n=sU(e.body,t);return PH({positionType:`shift`,positionData:-sV(e.dy,t),children:[{type:`elem`,elem:n}]})},mathmlBuilder(e,t){var n=new Q(`mpadded`,[SU(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute(`voffset`,r),n}});var TG=(e,t)=>({type:`reflectbox`,mode:e.parser.mode,body:t[0]});Z({type:`reflectbox`,names:[`\\reflectbox`],numArgs:1,argTypes:[`hbox`],allowedInText:!0,handler:TG,htmlBuilder(e,t){return X([`mord`,`reflectbox`],[sU(e.body,t)],t)},mathmlBuilder(e,t){return SU(e.body,t)}}),Z({type:`reflectbox`,names:[`\\mathreflectbox`],numArgs:1,argTypes:[`math`],handler:TG}),Z({type:`internal`,names:[`\\relax`],numArgs:0,allowedInText:!0,allowedInArgument:!0,handler(e){return{type:`internal`,mode:e.parser.mode}}}),Z({type:`rule`,names:[`\\rule`],numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`size`,`size`,`size`],handler(e,t,n){var r=e.parser,i=n[0],a=UU(t[0],`size`),o=UU(t[1],`size`);return{type:`rule`,mode:r.mode,shift:i&&UU(i,`size`).value,width:a.value,height:o.value}},htmlBuilder(e,t){var n=X([`mord`,`katex-rule`],[],t),r=sV(e.width,t),i=sV(e.height,t),a=e.shift?sV(e.shift,t):0;return n.style.borderRightWidth=B(r),n.style.borderTopWidth=B(i),n.style.bottom=B(a),n.width=r,n.height=i+a,n.depth=-a,n.maxFontSize=i*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=sV(e.width,t),r=sV(e.height,t),i=e.shift?sV(e.shift,t):0,a=t.color&&t.getColor()||`black`,o=new Q(`mspace`);o.setAttribute(`mathbackground`,a),o.setAttribute(`width`,B(n)),o.setAttribute(`height`,B(r));var s=new Q(`mpadded`,[o]);return i>=0?s.setAttribute(`height`,B(i)):(s.setAttribute(`height`,B(i)),s.setAttribute(`depth`,B(-i))),s.setAttribute(`voffset`,B(i)),s}});function EG(e,t,n){for(var r=tU(e,t,!1),i=t.sizeMultiplier/n.sizeMultiplier,a=0;a<r.length;a++){var o=r[a].classes.indexOf(`katex-sizing`);o<0?Array.prototype.push.apply(r[a].classes,t.sizingClasses(n)):r[a].classes[o+1]===`reset-size`+t.size&&(r[a].classes[o+1]=`reset-size`+n.size),r[a].height*=i,r[a].depth*=i}return jH(r)}var DG=[`\\tiny`,`\\sixptsize`,`\\scriptsize`,`\\footnotesize`,`\\small`,`\\normalsize`,`\\large`,`\\Large`,`\\LARGE`,`\\huge`,`\\Huge`];Z({type:`sizing`,names:DG,numArgs:0,allowedInText:!0,handler:(e,t)=>{var n=e.breakOnTokenText,r=e.funcName,i=e.parser,a=i.parseExpression(!1,n);return{type:`sizing`,mode:i.mode,size:DG.indexOf(r)+1,body:a}},htmlBuilder:(e,t)=>{var n=t.havingSize(e.size);return EG(e.body,n,t)},mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=new Q(`mstyle`,bU(e.body,n));return r.setAttribute(`mathsize`,B(n.sizeMultiplier)),r}}),Z({type:`smash`,names:[`\\smash`],numArgs:1,numOptionalArgs:1,allowedInText:!0,handler:(e,t,n)=>{var r=e.parser,i=!1,a=!1,o=n[0]&&UU(n[0],`ordgroup`);if(o)for(var s,c=0;c<o.body.length;++c){var l=o.body[c];if(s=WU(l).text,s===`t`)i=!0;else if(s===`b`)a=!0;else{i=!1,a=!1;break}}else i=!0,a=!0;var u=t[0];return{type:`smash`,mode:r.mode,body:u,smashHeight:i,smashDepth:a}},htmlBuilder:(e,t)=>{var n=X([],[sU(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0),e.smashDepth&&(n.depth=0),e.smashHeight&&e.smashDepth)return X([`mord`,`katex-smash`],[n],t);if(n.children)for(var r=0;r<n.children.length;r++)e.smashHeight&&(n.children[r].height=0),e.smashDepth&&(n.children[r].depth=0);return X([`mord`],[PH({positionType:`firstBaseline`,children:[{type:`elem`,elem:n}]})],t)},mathmlBuilder:(e,t)=>{var n=new Q(`mpadded`,[SU(e.body,t)]);return e.smashHeight&&n.setAttribute(`height`,`0px`),e.smashDepth&&n.setAttribute(`depth`,`0px`),n}}),Z({type:`sqrt`,names:[`\\sqrt`],numArgs:1,numOptionalArgs:1,handler(e,t,n){var r=e.parser,i=n[0],a=t[0];return{type:`sqrt`,mode:r.mode,body:a,index:i}},htmlBuilder(e,t){var n=sU(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=MH(n,t);var r=t.fontMetrics().defaultRuleThickness,i=r;t.style.id<RB.TEXT.id&&(i=t.fontMetrics().xHeight);var a=r+i/4,o=DW(n.height+n.depth+a+r,t),s=o.span,c=o.ruleWidth,l=o.advanceWidth,u=s.height-c;u>n.height+n.depth+a&&(a=(a+u-n.height-n.depth)/2);var d=s.height-n.height-a-c;n.style.paddingLeft=B(l);var f=PH({positionType:`firstBaseline`,children:[{type:`elem`,elem:n,wrapperClasses:[`svg-align`]},{type:`kern`,size:-(n.height+d)},{type:`elem`,elem:s},{type:`kern`,size:c}]});if(e.index){var p=t.havingStyle(RB.SCRIPTSCRIPT),m=sU(e.index,p,t);return X([`mord`,`sqrt`],[X([`katex-root`],[PH({positionType:`shift`,positionData:-(.6*(f.height-f.depth)),children:[{type:`elem`,elem:m}]})]),f],t)}return X([`mord`,`sqrt`],[f],t)},mathmlBuilder(e,t){var n=e.body,r=e.index;return r?new Q(`mroot`,[SU(n,t),SU(r,t)]):new Q(`msqrt`,[SU(n,t)])}});var OG={display:RB.DISPLAY,text:RB.TEXT,script:RB.SCRIPT,scriptscript:RB.SCRIPTSCRIPT};function kG(e){return e in OG}Z({type:`styling`,names:[`\\displaystyle`,`\\textstyle`,`\\scriptstyle`,`\\scriptscriptstyle`],numArgs:0,allowedInText:!0,primitive:!0,handler(e,t){var n=e.breakOnTokenText,r=e.funcName,i=e.parser,a=i.parseExpression(!0,n),o=r.slice(1,r.length-5);if(!kG(o))throw Error(`Unknown style: `+o);return{type:`styling`,mode:i.mode,style:o,body:a}},htmlBuilder(e,t){var n=OG[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont(``)),EG(e.body,r,t)},mathmlBuilder(e,t){var n=OG[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(``));var i=new Q(`mstyle`,bU(e.body,r)),a={display:[`0`,`true`],text:[`0`,`false`],script:[`1`,`false`],scriptscript:[`2`,`false`]}[e.style];return i.setAttribute(`scriptlevel`,a[0]),i.setAttribute(`displaystyle`,a[1]),i}});var AG=function(e,t){var n=e.base;return n?n.type===`op`?n.limits&&(t.style.size===RB.DISPLAY.size||n.alwaysHandleSupSub)?bG:null:n.type===`operatorname`?n.alwaysHandleSupSub&&(t.style.size===RB.DISPLAY.size||n.limits)?wG:null:n.type===`accent`?hB(n.base)?JU:null:n.type===`horizBrace`&&!e.sub===n.isOver?hG:null:null};JH({type:`supsub`,htmlBuilder(e,t){var n=AG(e,t);if(n)return n(e,t);var r=e.base,i=e.sup,a=e.sub,o=sU(r,t),s,c,l=t.fontMetrics(),u=0,d=0,f=r&&hB(r);if(i){var p=t.havingStyle(t.style.sup());s=sU(i,p,t),f||(u=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(a){var m=t.havingStyle(t.style.sub());c=sU(a,m,t),f||(d=o.depth+m.fontMetrics().subDrop*m.sizeMultiplier/t.sizeMultiplier)}var h=t.style===RB.DISPLAY?l.sup1:t.style.cramped?l.sup3:l.sup2,g=t.sizeMultiplier,_=B(.5/l.ptPerEm/g),v=null;if(c){var y=e.base&&e.base.type===`op`&&e.base.name&&(e.base.name===`\\oiint`||e.base.name===`\\oiiint`);(o instanceof vV||y)&&(v=B(-(o.italic??0)))}var b;if(s&&c){u=Math.max(u,h,s.depth+.25*l.xHeight),d=Math.max(d,l.sub2);var x=4*l.defaultRuleThickness;if(u-s.depth-(c.height-d)<x){d=x-(u-s.depth)+c.height;var S=.8*l.xHeight-(u-s.depth);S>0&&(u+=S,d-=S)}b=PH({positionType:`individualShift`,children:[{type:`elem`,elem:c,shift:d,marginRight:_,marginLeft:v},{type:`elem`,elem:s,shift:-u,marginRight:_}]})}else if(c)d=Math.max(d,l.sub1,c.height-.8*l.xHeight),b=PH({positionType:`shift`,positionData:d,children:[{type:`elem`,elem:c,marginLeft:v,marginRight:_}]});else if(s)u=Math.max(u,h,s.depth+.25*l.xHeight),b=PH({positionType:`shift`,positionData:-u,children:[{type:`elem`,elem:s,marginRight:_}]});else throw Error(`supsub must have either sup or sub.`);return X([aU(o,`right`)||`mord`],[o,X([`msupsub`],[b])],t)},mathmlBuilder(e,t){var n=!1,r,i;e.base&&e.base.type===`horizBrace`&&(i=!!e.sup,i===e.base.isOver&&(n=!0,r=e.base.isOver)),e.base&&(e.base.type===`op`||e.base.type===`operatorname`)&&(e.base.parentIsSupSub=!0);var a=[SU(e.base,t)];e.sub&&a.push(SU(e.sub,t)),e.sup&&a.push(SU(e.sup,t));var o;if(n)o=r?`mover`:`munder`;else if(!e.sub){var s=e.base;o=s&&s.type===`op`&&s.limits&&(t.style===RB.DISPLAY||s.alwaysHandleSupSub)||s&&s.type===`operatorname`&&s.alwaysHandleSupSub&&(s.limits||t.style===RB.DISPLAY)?`mover`:`msup`}else if(e.sup){var c=e.base;o=c&&c.type===`op`&&c.limits&&t.style===RB.DISPLAY||c&&c.type===`operatorname`&&c.alwaysHandleSupSub&&(t.style===RB.DISPLAY||c.limits)?`munderover`:`msubsup`}else{var l=e.base;o=l&&l.type===`op`&&l.limits&&(t.style===RB.DISPLAY||l.alwaysHandleSupSub)||l&&l.type===`operatorname`&&l.alwaysHandleSupSub&&(l.limits||t.style===RB.DISPLAY)?`munder`:`msub`}return new Q(o,a)}}),JH({type:`atom`,htmlBuilder(e,t){return SH(e.text,e.mode,t,[`m`+e.family])},mathmlBuilder(e,t){var n=new Q(`mo`,[hU(e.text,e.mode)]);if(e.family===`bin`){var r=vU(e,t);r===`bold-italic`&&n.setAttribute(`mathvariant`,r)}else e.family===`punct`?n.setAttribute(`separator`,`true`):(e.family===`open`||e.family===`close`)&&n.setAttribute(`stretchy`,`false`);return n}});var jG={mi:`italic`,mn:`normal`,mtext:`normal`};JH({type:`mathord`,htmlBuilder(e,t){return wH(e,t)},mathmlBuilder(e,t){var n=new Q(`mi`,[hU(e.text,e.mode,t)]),r=vU(e,t)||`italic`;return r!==jG[n.type]&&n.setAttribute(`mathvariant`,r),n}}),JH({type:`textord`,htmlBuilder(e,t){return wH(e,t)},mathmlBuilder(e,t){var n=hU(e.text,e.mode,t),r=vU(e,t)||`normal`,i=e.mode===`text`?new Q(`mtext`,[n]):/[0-9]/.test(e.text)?new Q(`mn`,[n]):e.text===`\\prime`?new Q(`mo`,[n]):new Q(`mi`,[n]);return r!==jG[i.type]&&i.setAttribute(`mathvariant`,r),i}});var MG=new Map([[`\\nobreak`,`nobreak`],[`\\allowbreak`,`allowbreak`]]),NG=new Map([[` `,{}],[`\\ `,{}],[`~`,{className:`nobreak`}],[`\\space`,{}],[`\\nobreakspace`,{className:`nobreak`}]]);JH({type:`spacing`,htmlBuilder(e,t){var n=NG.get(e.text),r=MG.get(e.text);if(n){var i=n.className||``;if(e.mode===`text`){var a=wH(e,t);return a.classes.push(i),a}return X([`mspace`,i],[SH(e.text,e.mode,t)],t)}if(r)return X([`mspace`,r],[],t);throw new z(`Unknown type of space "`+e.text+`"`)},mathmlBuilder(e,t){var n;if(NG.has(e.text))n=new Q(`mtext`,[new dU(`\xA0`)]);else if(MG.has(e.text))return new Q(`mspace`);else throw new z(`Unknown type of space "`+e.text+`"`);return n}});var PG=()=>{var e=new Q(`mtd`,[]);return e.setAttribute(`width`,`50%`),e};JH({type:`tag`,mathmlBuilder(e,t){var n=new Q(`mtable`,[new Q(`mtr`,[PG(),new Q(`mtd`,[xU(e.body,t)]),PG(),new Q(`mtd`,[xU(e.tag,t)])])]);return n.setAttribute(`width`,`100%`),n}});var FG={"\\text":void 0,"\\textrm":`textrm`,"\\textsf":`textsf`,"\\texttt":`texttt`,"\\textnormal":`textrm`},IG={"\\textbf":`textbf`,"\\textmd":`textmd`},LG={"\\textit":`textit`,"\\textup":`textup`},RG=(e,t)=>{var n=e.font;return n?FG[n]?t.withTextFontFamily(FG[n]):IG[n]?t.withTextFontWeight(IG[n]):n===`\\emph`?t.fontShape===`textit`?t.withTextFontShape(`textup`):t.withTextFontShape(`textit`):t.withTextFontShape(LG[n]):t};Z({type:`text`,names:[`\\text`,`\\textrm`,`\\textsf`,`\\texttt`,`\\textnormal`,`\\textbf`,`\\textmd`,`\\textit`,`\\textup`,`\\emph`],numArgs:1,argTypes:[`text`],allowedInArgument:!0,allowedInText:!0,handler(e,t){var n=e.parser,r=e.funcName,i=t[0];return{type:`text`,mode:n.mode,body:XH(i),font:r}},htmlBuilder(e,t){var n=RG(e,t);return X([`mord`,`text`],tU(e.body,n,!0),n)},mathmlBuilder(e,t){var n=RG(e,t);return xU(e.body,n)}}),Z({type:`underline`,names:[`\\underline`],numArgs:1,allowedInText:!0,handler(e,t){return{type:`underline`,mode:e.parser.mode,body:t[0]}},htmlBuilder(e,t){var n=sU(e.body,t),r=kH(`underline-line`,t),i=t.fontMetrics().defaultRuleThickness;return X([`mord`,`katex-underline`],[PH({positionType:`top`,positionData:n.height,children:[{type:`kern`,size:i},{type:`elem`,elem:r},{type:`kern`,size:3*i},{type:`elem`,elem:n}]})],t)},mathmlBuilder(e,t){var n=new Q(`mo`,[new dU(`‾`)]);n.setAttribute(`stretchy`,`true`);var r=new Q(`munder`,[SU(e.body,t),n]);return r.setAttribute(`accentunder`,`true`),r}}),Z({type:`vcenter`,names:[`\\vcenter`],numArgs:1,argTypes:[`original`],allowedInText:!1,handler(e,t){return{type:`vcenter`,mode:e.parser.mode,body:t[0]}},htmlBuilder(e,t){var n=sU(e.body,t),r=t.fontMetrics().axisHeight;return PH({positionType:`shift`,positionData:.5*(n.height-r-(n.depth+r)),children:[{type:`elem`,elem:n}]})},mathmlBuilder(e,t){return new Q(`mrow`,[new Q(`mpadded`,[SU(e.body,t)],[`vcenter`])])}}),Z({type:`verb`,names:[`\\verb`],numArgs:0,allowedInText:!0,handler(e,t,n){throw new z(`\\verb ended by end of line instead of matching delimiter`)},htmlBuilder(e,t){for(var n=zG(e),r=[],i=t.havingStyle(t.style.text()),a=0;a<n.length;a++){var o=n[a];o===`~`&&(o=`\\textasciitilde`),r.push(xH(o,`Typewriter-Regular`,e.mode,i,[`mord`,`texttt`]))}return X([`mord`,`text`].concat(i.sizingClasses(t)),EH(r),i)},mathmlBuilder(e,t){var n=new Q(`mtext`,[new dU(zG(e))]);return n.setAttribute(`mathvariant`,`monospace`),n}});var zG=e=>e.body.replace(/ /g,e.star?`␣`:`\xA0`),BG=GH,VG=`[ \r
311
- ]`,HG=`\\\\[a-zA-Z@]+`,UG=`\\\\[^\ud800-\udfff]`,WG=`(`+HG+`)`+VG+`*`,GG=`\\\\(
312
- |[ \r ]+
313
- ?)[ \r ]*`,KG=`[̀-ͯ]`,qG=RegExp(KG+`+$`),JG=`(`+VG+`+)|`+(GG+`|`)+`([!-\\[\\]-‧‪-퟿豈-￿]`+(KG+`*`)+`|[\ud800-\udbff][\udc00-\udfff]`+(KG+`*`)+`|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5`+(`|`+WG)+(`|`+UG+`)`),YG=class{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(JG,`g`),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new YW(`EOF`,new JW(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new z(`Unexpected character: '`+e[t]+`'`,new YW(e[t],new JW(this,t,t+1)));var r=n[6]||n[3]||(n[2]?`\\ `:` `);if(this.catcodes[r]===14){var i=e.indexOf(`
314
- `,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,yH({strict:this.settings.strict,errorCode:`commentAtEnd`,errorMsg:`% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)`,report:!0})):this.tokenRegex.lastIndex=i+1,this.lex()}return new YW(r,new JW(this,t,this.tokenRegex.lastIndex))}},XG=class{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new z(`Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug`);var e=this.undefStack.pop();for(var t of Object.keys(e))e[t]===void 0?delete this.current[t]:this.current[t]=e[t]}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){if(Object.prototype.hasOwnProperty.call(this.current,e))return this.current[e];if(Object.prototype.hasOwnProperty.call(this.builtins,e))return this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!Object.prototype.hasOwnProperty.call(i,e)&&(i[e]=Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:void 0)}t==null?delete this.current[e]:this.current[e]=t}},ZG=qW;$(`\\noexpand`,function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),$(`\\expandafter`,function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),$(`\\@firstoftwo`,function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),$(`\\@secondoftwo`,function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),$(`\\@ifnextchar`,function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),$(`\\@ifstar`,`\\@ifnextchar *{\\@firstoftwo{#1}}`),$(`\\TextOrMath`,function(e){var t=e.consumeArgs(2);return e.mode===`text`?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var QG={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};$(`\\char`,function(e){var t=e.popToken(),n,r=0;if(t.text===`'`)n=8,t=e.popToken();else if(t.text===`"`)n=16,t=e.popToken();else if(t.text==="`"){if(t=e.popToken(),t.text[0]===`\\`)r=t.text.charCodeAt(1);else if(t.text===`EOF`)throw new z("\\char` missing argument");else r=t.text.charCodeAt(0)}else n=10;if(n){if(r=QG[t.text],r==null||r>=n)throw new z(`Invalid base-`+n+` digit `+t.text);for(var i;(i=QG[e.future().text])!=null&&i<n;)r*=n,r+=i,e.popToken()}return`\\@char{`+r+`}`});var $G=(e,t,n,r)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new z(`\\newcommand's first argument must be a macro name`);var a=i[0].text,o=e.isDefined(a);if(o&&!t)throw new z(`\\newcommand{`+a+`} attempting to redefine `+(a+`; use \\renewcommand`));if(!o&&!n)throw new z(`\\renewcommand{`+a+`} when command `+a+` does not yet exist; use \\newcommand`);var s=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text===`[`){for(var c=``,l=e.expandNextToken();l.text!==`]`&&l.text!==`EOF`;)c+=l.text,l=e.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new z(`Invalid number of arguments: `+c);s=parseInt(c),i=e.consumeArg().tokens}return o&&r||e.macros.set(a,{tokens:i,numArgs:s}),``};$(`\\newcommand`,e=>$G(e,!1,!0,!1)),$(`\\renewcommand`,e=>$G(e,!0,!1,!1)),$(`\\providecommand`,e=>$G(e,!0,!0,!0)),$(`\\message`,e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(e=>e.text).join(``)),``}),$(`\\errmessage`,e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(e=>e.text).join(``)),``}),$(`\\show`,e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),BG[n],MV.math[n],MV.text[n]),``}),$(`\\bgroup`,`{`),$(`\\egroup`,`}`),$(`~`,`\\nobreakspace`),$(`\\lq`,"`"),$(`\\rq`,`'`),$(`\\aa`,`\\r a`),$(`\\AA`,`\\r A`),$(`\\textcopyright`,"\\html@mathml{\\textcircled{c}}{\\char`©}"),$(`\\copyright`,`\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}`),$(`\\textregistered`,"\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),$(`ℬ`,`\\mathscr{B}`),$(`ℰ`,`\\mathscr{E}`),$(`ℱ`,`\\mathscr{F}`),$(`ℋ`,`\\mathscr{H}`),$(`ℐ`,`\\mathscr{I}`),$(`ℒ`,`\\mathscr{L}`),$(`ℳ`,`\\mathscr{M}`),$(`ℛ`,`\\mathscr{R}`),$(`ℭ`,`\\mathfrak{C}`),$(`ℌ`,`\\mathfrak{H}`),$(`ℨ`,`\\mathfrak{Z}`),$(`\\Bbbk`,`\\Bbb{k}`),$(`\\llap`,`\\mathllap{\\textrm{#1}}`),$(`\\rlap`,`\\mathrlap{\\textrm{#1}}`),$(`\\clap`,`\\mathclap{\\textrm{#1}}`),$(`\\mathstrut`,`\\vphantom{(}`),$(`\\underbar`,`\\underline{\\text{#1}}`),$(`\\not`,`\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}`),$(`\\neq`,"\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"),$(`\\ne`,`\\neq`),$(`≠`,`\\neq`),$(`\\notin`,"\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"),$(`∉`,`\\notin`),$(`≘`,"\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"),$(`≙`,"\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"),$(`≚`,"\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"),$(`≛`,"\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"),$(`≝`,"\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"),$(`≞`,"\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"),$(`≟`,"\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"),$(`⟂`,`\\perp`),$(`‼`,`\\mathclose{!\\mkern-0.8mu!}`),$(`∌`,`\\notni`),$(`⌜`,`\\ulcorner`),$(`⌝`,`\\urcorner`),$(`⌞`,`\\llcorner`),$(`⌟`,`\\lrcorner`),$(`©`,`\\copyright`),$(`®`,`\\textregistered`),$(`\\ulcorner`,`\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}`),$(`\\urcorner`,`\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}`),$(`\\llcorner`,`\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}`),$(`\\lrcorner`,`\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}`),$(`\\vdots`,`{\\varvdots\\rule{0pt}{15pt}}`),$(`⋮`,`\\vdots`),$(`\\varGamma`,`\\mathit{\\Gamma}`),$(`\\varDelta`,`\\mathit{\\Delta}`),$(`\\varTheta`,`\\mathit{\\Theta}`),$(`\\varLambda`,`\\mathit{\\Lambda}`),$(`\\varXi`,`\\mathit{\\Xi}`),$(`\\varPi`,`\\mathit{\\Pi}`),$(`\\varSigma`,`\\mathit{\\Sigma}`),$(`\\varUpsilon`,`\\mathit{\\Upsilon}`),$(`\\varPhi`,`\\mathit{\\Phi}`),$(`\\varPsi`,`\\mathit{\\Psi}`),$(`\\varOmega`,`\\mathit{\\Omega}`),$(`\\substack`,`\\begin{subarray}{c}#1\\end{subarray}`),$(`\\colon`,`\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax`),$(`\\boxed`,`\\fbox{$\\displaystyle{#1}$}`),$(`\\iff`,`\\DOTSB\\;\\Longleftrightarrow\\;`),$(`\\implies`,`\\DOTSB\\;\\Longrightarrow\\;`),$(`\\impliedby`,`\\DOTSB\\;\\Longleftarrow\\;`),$(`\\dddot`,`{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}`),$(`\\ddddot`,`{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}`);var eK={",":`\\dotsc`,"\\not":`\\dotsb`,"+":`\\dotsb`,"=":`\\dotsb`,"<":`\\dotsb`,">":`\\dotsb`,"-":`\\dotsb`,"*":`\\dotsb`,":":`\\dotsb`,"\\DOTSB":`\\dotsb`,"\\coprod":`\\dotsb`,"\\bigvee":`\\dotsb`,"\\bigwedge":`\\dotsb`,"\\biguplus":`\\dotsb`,"\\bigcap":`\\dotsb`,"\\bigcup":`\\dotsb`,"\\prod":`\\dotsb`,"\\sum":`\\dotsb`,"\\bigotimes":`\\dotsb`,"\\bigoplus":`\\dotsb`,"\\bigodot":`\\dotsb`,"\\bigsqcup":`\\dotsb`,"\\And":`\\dotsb`,"\\longrightarrow":`\\dotsb`,"\\Longrightarrow":`\\dotsb`,"\\longleftarrow":`\\dotsb`,"\\Longleftarrow":`\\dotsb`,"\\longleftrightarrow":`\\dotsb`,"\\Longleftrightarrow":`\\dotsb`,"\\mapsto":`\\dotsb`,"\\longmapsto":`\\dotsb`,"\\hookrightarrow":`\\dotsb`,"\\doteq":`\\dotsb`,"\\mathbin":`\\dotsb`,"\\mathrel":`\\dotsb`,"\\relbar":`\\dotsb`,"\\Relbar":`\\dotsb`,"\\xrightarrow":`\\dotsb`,"\\xleftarrow":`\\dotsb`,"\\DOTSI":`\\dotsi`,"\\int":`\\dotsi`,"\\oint":`\\dotsi`,"\\iint":`\\dotsi`,"\\iiint":`\\dotsi`,"\\iiiint":`\\dotsi`,"\\idotsint":`\\dotsi`,"\\DOTSX":`\\dotsx`},tK=new Set([`bin`,`rel`]);$(`\\dots`,function(e){var t=`\\dotso`,n=e.expandAfterFuture().text;return n in eK?t=eK[n]:(n.slice(0,4)===`\\not`||n in MV.math&&tK.has(MV.math[n].group))&&(t=`\\dotsb`),t});var nK={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};$(`\\dotso`,function(e){return e.future().text in nK?`\\ldots\\,`:`\\ldots`}),$(`\\dotsc`,function(e){var t=e.future().text;return t in nK&&t!==`,`?`\\ldots\\,`:`\\ldots`}),$(`\\cdots`,function(e){return e.future().text in nK?`\\@cdots\\,`:`\\@cdots`}),$(`\\dotsb`,`\\cdots`),$(`\\dotsm`,`\\cdots`),$(`\\dotsi`,`\\!\\cdots`),$(`\\dotsx`,`\\ldots\\,`),$(`\\DOTSI`,`\\relax`),$(`\\DOTSB`,`\\relax`),$(`\\DOTSX`,`\\relax`),$(`\\tmspace`,`\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax`),$(`\\,`,`\\tmspace+{3mu}{.1667em}`),$(`\\thinspace`,`\\,`),$(`\\>`,`\\mskip{4mu}`),$(`\\:`,`\\tmspace+{4mu}{.2222em}`),$(`\\medspace`,`\\:`),$(`\\;`,`\\tmspace+{5mu}{.2777em}`),$(`\\thickspace`,`\\;`),$(`\\!`,`\\tmspace-{3mu}{.1667em}`),$(`\\negthinspace`,`\\!`),$(`\\negmedspace`,`\\tmspace-{4mu}{.2222em}`),$(`\\negthickspace`,`\\tmspace-{5mu}{.277em}`),$(`\\enspace`,`\\kern.5em `),$(`\\enskip`,`\\hskip.5em\\relax`),$(`\\quad`,`\\hskip1em\\relax`),$(`\\qquad`,`\\hskip2em\\relax`),$(`\\tag`,`\\@ifstar\\tag@literal\\tag@paren`),$(`\\tag@paren`,`\\tag@literal{({#1})}`),$(`\\tag@literal`,e=>{if(e.macros.get(`\\df@tag`))throw new z(`Multiple \\tag`);return`\\gdef\\df@tag{\\text{#1}}`}),$(`\\bmod`,`\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}`),$(`\\pod`,`\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)`),$(`\\pmod`,`\\pod{{\\rm mod}\\mkern6mu#1}`),$(`\\mod`,`\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1`),$(`\\newline`,`\\\\\\relax`),$(`\\TeX`,`\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}`);var rK=B(TV[`Main-Regular`][84][1]-.7*TV[`Main-Regular`][65][1]);$(`\\LaTeX`,`\\textrm{\\html@mathml{`+(`L\\kern-.36em\\raisebox{`+rK+`}{\\scriptstyle A}`)+`\\kern-.15em\\TeX}{LaTeX}}`),$(`\\KaTeX`,`\\textrm{\\html@mathml{`+(`K\\kern-.17em\\raisebox{`+rK+`}{\\scriptstyle A}`)+`\\kern-.15em\\TeX}{KaTeX}}`),$(`\\hspace`,`\\@ifstar\\@hspacer\\@hspace`),$(`\\@hspace`,`\\hskip #1\\relax`),$(`\\@hspacer`,`\\rule{0pt}{0pt}\\hskip #1\\relax`),$(`\\ordinarycolon`,`:`),$(`\\vcentcolon`,`\\mathrel{\\mathop\\ordinarycolon}`),$(`\\dblcolon`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}`),$(`\\coloneqq`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}`),$(`\\Coloneqq`,`\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}`),$(`\\coloneq`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}`),$(`\\Coloneq`,`\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}`),$(`\\eqqcolon`,`\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}`),$(`\\Eqqcolon`,`\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}`),$(`\\eqcolon`,`\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}`),$(`\\Eqcolon`,`\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}`),$(`\\colonapprox`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}`),$(`\\Colonapprox`,`\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}`),$(`\\colonsim`,`\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}`),$(`\\Colonsim`,`\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}`),$(`∷`,`\\dblcolon`),$(`∹`,`\\eqcolon`),$(`≔`,`\\coloneqq`),$(`≕`,`\\eqqcolon`),$(`⩴`,`\\Coloneqq`),$(`\\ratio`,`\\vcentcolon`),$(`\\coloncolon`,`\\dblcolon`),$(`\\colonequals`,`\\coloneqq`),$(`\\coloncolonequals`,`\\Coloneqq`),$(`\\equalscolon`,`\\eqqcolon`),$(`\\equalscoloncolon`,`\\Eqqcolon`),$(`\\colonminus`,`\\coloneq`),$(`\\coloncolonminus`,`\\Coloneq`),$(`\\minuscolon`,`\\eqcolon`),$(`\\minuscoloncolon`,`\\Eqcolon`),$(`\\coloncolonapprox`,`\\Colonapprox`),$(`\\coloncolonsim`,`\\Colonsim`),$(`\\simcolon`,`\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}`),$(`\\simcoloncolon`,`\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}`),$(`\\approxcolon`,`\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}`),$(`\\approxcoloncolon`,`\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}`),$(`\\notni`,"\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"),$(`\\limsup`,`\\DOTSB\\operatorname*{lim\\,sup}`),$(`\\liminf`,`\\DOTSB\\operatorname*{lim\\,inf}`),$(`\\injlim`,`\\DOTSB\\operatorname*{inj\\,lim}`),$(`\\projlim`,`\\DOTSB\\operatorname*{proj\\,lim}`),$(`\\varlimsup`,`\\DOTSB\\operatorname*{\\overline{lim}}`),$(`\\varliminf`,`\\DOTSB\\operatorname*{\\underline{lim}}`),$(`\\varinjlim`,`\\DOTSB\\operatorname*{\\underrightarrow{lim}}`),$(`\\varprojlim`,`\\DOTSB\\operatorname*{\\underleftarrow{lim}}`),$(`\\gvertneqq`,`\\html@mathml{\\@gvertneqq}{≩}`),$(`\\lvertneqq`,`\\html@mathml{\\@lvertneqq}{≨}`),$(`\\ngeqq`,`\\html@mathml{\\@ngeqq}{≱}`),$(`\\ngeqslant`,`\\html@mathml{\\@ngeqslant}{≱}`),$(`\\nleqq`,`\\html@mathml{\\@nleqq}{≰}`),$(`\\nleqslant`,`\\html@mathml{\\@nleqslant}{≰}`),$(`\\nshortmid`,`\\html@mathml{\\@nshortmid}{∤}`),$(`\\nshortparallel`,`\\html@mathml{\\@nshortparallel}{∦}`),$(`\\nsubseteqq`,`\\html@mathml{\\@nsubseteqq}{⊈}`),$(`\\nsupseteqq`,`\\html@mathml{\\@nsupseteqq}{⊉}`),$(`\\varsubsetneq`,`\\html@mathml{\\@varsubsetneq}{⊊}`),$(`\\varsubsetneqq`,`\\html@mathml{\\@varsubsetneqq}{⫋}`),$(`\\varsupsetneq`,`\\html@mathml{\\@varsupsetneq}{⊋}`),$(`\\varsupsetneqq`,`\\html@mathml{\\@varsupsetneqq}{⫌}`),$(`\\imath`,`\\html@mathml{\\@imath}{ı}`),$(`\\jmath`,`\\html@mathml{\\@jmath}{ȷ}`),$(`\\llbracket`,"\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"),$(`\\rrbracket`,"\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"),$(`⟦`,`\\llbracket`),$(`⟧`,`\\rrbracket`),$(`\\lBrace`,"\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"),$(`\\rBrace`,"\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"),$(`↤`,`\\mapsfrom`),$(`\\mapsfrom`,"\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}"),$(`⦃`,`\\lBrace`),$(`⦄`,`\\rBrace`),$(`\\minuso`,"\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"),$(`⦵`,`\\minuso`),$(`\\darr`,`\\downarrow`),$(`\\dArr`,`\\Downarrow`),$(`\\Darr`,`\\Downarrow`),$(`\\lang`,`\\langle`),$(`\\rang`,`\\rangle`),$(`\\uarr`,`\\uparrow`),$(`\\uArr`,`\\Uparrow`),$(`\\Uarr`,`\\Uparrow`),$(`\\N`,`\\mathbb{N}`),$(`\\R`,`\\mathbb{R}`),$(`\\Z`,`\\mathbb{Z}`),$(`\\alef`,`\\aleph`),$(`\\alefsym`,`\\aleph`),$(`\\Alpha`,`\\mathrm{A}`),$(`\\Beta`,`\\mathrm{B}`),$(`\\bull`,`\\bullet`),$(`\\Chi`,`\\mathrm{X}`),$(`\\clubs`,`\\clubsuit`),$(`\\cnums`,`\\mathbb{C}`),$(`\\Complex`,`\\mathbb{C}`),$(`\\Dagger`,`\\ddagger`),$(`\\diamonds`,`\\diamondsuit`),$(`\\empty`,`\\emptyset`),$(`\\Epsilon`,`\\mathrm{E}`),$(`\\Eta`,`\\mathrm{H}`),$(`\\exist`,`\\exists`),$(`\\harr`,`\\leftrightarrow`),$(`\\hArr`,`\\Leftrightarrow`),$(`\\Harr`,`\\Leftrightarrow`),$(`\\hearts`,`\\heartsuit`),$(`\\image`,`\\Im`),$(`\\infin`,`\\infty`),$(`\\Iota`,`\\mathrm{I}`),$(`\\isin`,`\\in`),$(`\\Kappa`,`\\mathrm{K}`),$(`\\larr`,`\\leftarrow`),$(`\\lArr`,`\\Leftarrow`),$(`\\Larr`,`\\Leftarrow`),$(`\\lrarr`,`\\leftrightarrow`),$(`\\lrArr`,`\\Leftrightarrow`),$(`\\Lrarr`,`\\Leftrightarrow`),$(`\\Mu`,`\\mathrm{M}`),$(`\\natnums`,`\\mathbb{N}`),$(`\\Nu`,`\\mathrm{N}`),$(`\\Omicron`,`\\mathrm{O}`),$(`\\plusmn`,`\\pm`),$(`\\rarr`,`\\rightarrow`),$(`\\rArr`,`\\Rightarrow`),$(`\\Rarr`,`\\Rightarrow`),$(`\\real`,`\\Re`),$(`\\reals`,`\\mathbb{R}`),$(`\\Reals`,`\\mathbb{R}`),$(`\\Rho`,`\\mathrm{P}`),$(`\\sdot`,`\\cdot`),$(`\\sect`,`\\S`),$(`\\spades`,`\\spadesuit`),$(`\\sub`,`\\subset`),$(`\\sube`,`\\subseteq`),$(`\\supe`,`\\supseteq`),$(`\\Tau`,`\\mathrm{T}`),$(`\\thetasym`,`\\vartheta`),$(`\\weierp`,`\\wp`),$(`\\Zeta`,`\\mathrm{Z}`),$(`\\argmin`,`\\DOTSB\\operatorname*{arg\\,min}`),$(`\\argmax`,`\\DOTSB\\operatorname*{arg\\,max}`),$(`\\plim`,`\\DOTSB\\mathop{\\operatorname{plim}}\\limits`),$(`\\bra`,`\\mathinner{\\langle{#1}|}`),$(`\\ket`,`\\mathinner{|{#1}\\rangle}`),$(`\\braket`,`\\mathinner{\\langle{#1}\\rangle}`),$(`\\Bra`,`\\left\\langle#1\\right|`),$(`\\Ket`,`\\left|#1\\right\\rangle`);var iK=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,a=t.consumeArg().tokens,o=t.macros.get(`|`),s=t.macros.get(`\\|`);t.macros.beginGroup();var c=t=>n=>{e&&(n.macros.set(`|`,o),i.length&&n.macros.set(`\\|`,s));var a=t;return!t&&i.length&&n.future().text===`|`&&(n.popToken(),a=!0),{tokens:a?i:r,numArgs:0}};t.macros.set(`|`,c(!1)),i.length&&t.macros.set(`\\|`,c(!0));var l=t.consumeArg().tokens,u=t.expandTokens([...a,...l,...n]);return t.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};$(`\\bra@ket`,iK(!1)),$(`\\bra@set`,iK(!0)),$(`\\Braket`,`\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}`),$(`\\Set`,`\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}`),$(`\\set`,`\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}`),$(`\\angln`,`{\\angl n}`),$(`\\blue`,`\\textcolor{##6495ed}{#1}`),$(`\\orange`,`\\textcolor{##ffa500}{#1}`),$(`\\pink`,`\\textcolor{##ff00af}{#1}`),$(`\\red`,`\\textcolor{##df0030}{#1}`),$(`\\green`,`\\textcolor{##28ae7b}{#1}`),$(`\\gray`,`\\textcolor{gray}{#1}`),$(`\\purple`,`\\textcolor{##9d38bd}{#1}`),$(`\\blueA`,`\\textcolor{##ccfaff}{#1}`),$(`\\blueB`,`\\textcolor{##80f6ff}{#1}`),$(`\\blueC`,`\\textcolor{##63d9ea}{#1}`),$(`\\blueD`,`\\textcolor{##11accd}{#1}`),$(`\\blueE`,`\\textcolor{##0c7f99}{#1}`),$(`\\tealA`,`\\textcolor{##94fff5}{#1}`),$(`\\tealB`,`\\textcolor{##26edd5}{#1}`),$(`\\tealC`,`\\textcolor{##01d1c1}{#1}`),$(`\\tealD`,`\\textcolor{##01a995}{#1}`),$(`\\tealE`,`\\textcolor{##208170}{#1}`),$(`\\greenA`,`\\textcolor{##b6ffb0}{#1}`),$(`\\greenB`,`\\textcolor{##8af281}{#1}`),$(`\\greenC`,`\\textcolor{##74cf70}{#1}`),$(`\\greenD`,`\\textcolor{##1fab54}{#1}`),$(`\\greenE`,`\\textcolor{##0d923f}{#1}`),$(`\\goldA`,`\\textcolor{##ffd0a9}{#1}`),$(`\\goldB`,`\\textcolor{##ffbb71}{#1}`),$(`\\goldC`,`\\textcolor{##ff9c39}{#1}`),$(`\\goldD`,`\\textcolor{##e07d10}{#1}`),$(`\\goldE`,`\\textcolor{##a75a05}{#1}`),$(`\\redA`,`\\textcolor{##fca9a9}{#1}`),$(`\\redB`,`\\textcolor{##ff8482}{#1}`),$(`\\redC`,`\\textcolor{##f9685d}{#1}`),$(`\\redD`,`\\textcolor{##e84d39}{#1}`),$(`\\redE`,`\\textcolor{##bc2612}{#1}`),$(`\\maroonA`,`\\textcolor{##ffbde0}{#1}`),$(`\\maroonB`,`\\textcolor{##ff92c6}{#1}`),$(`\\maroonC`,`\\textcolor{##ed5fa6}{#1}`),$(`\\maroonD`,`\\textcolor{##ca337c}{#1}`),$(`\\maroonE`,`\\textcolor{##9e034e}{#1}`),$(`\\purpleA`,`\\textcolor{##ddd7ff}{#1}`),$(`\\purpleB`,`\\textcolor{##c6b9fc}{#1}`),$(`\\purpleC`,`\\textcolor{##aa87ff}{#1}`),$(`\\purpleD`,`\\textcolor{##7854ab}{#1}`),$(`\\purpleE`,`\\textcolor{##543b78}{#1}`),$(`\\mintA`,`\\textcolor{##f5f9e8}{#1}`),$(`\\mintB`,`\\textcolor{##edf2df}{#1}`),$(`\\mintC`,`\\textcolor{##e0e5cc}{#1}`),$(`\\grayA`,`\\textcolor{##f6f7f7}{#1}`),$(`\\grayB`,`\\textcolor{##f0f1f2}{#1}`),$(`\\grayC`,`\\textcolor{##e3e5e6}{#1}`),$(`\\grayD`,`\\textcolor{##d6d8da}{#1}`),$(`\\grayE`,`\\textcolor{##babec2}{#1}`),$(`\\grayF`,`\\textcolor{##888d93}{#1}`),$(`\\grayG`,`\\textcolor{##626569}{#1}`),$(`\\grayH`,`\\textcolor{##3b3e40}{#1}`),$(`\\grayI`,`\\textcolor{##21242c}{#1}`),$(`\\kaBlue`,`\\textcolor{##314453}{#1}`),$(`\\kaGreen`,`\\textcolor{##71B307}{#1}`);var aK={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},oK=class{constructor(e,t,n){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new XG(ZG,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new YG(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,n,r;if(e){if(this.consumeSpaces(),this.future().text!==`[`)return null;t=this.popToken();var i=this.consumeArg([`]`]);r=i.tokens,n=i.end}else{var a=this.consumeArg();r=a.tokens,t=a.start,n=a.end}return this.pushToken(new YW(`EOF`,n.loc)),this.pushTokens(r),new YW(``,JW.range(t,n))}consumeSpaces(){for(;this.future().text===` `;)this.stack.pop()}consumeArg(e){var t=[],n=e&&e.length>0;n||this.consumeSpaces();var r=this.future(),i,a=0,o=0;do{if(i=this.popToken(),t.push(i),i.text===`{`)++a;else if(i.text===`}`){if(--a,a===-1)throw new z(`Extra }`,i)}else if(i.text===`EOF`)throw new z(`Unexpected end of input in a macro argument, expected '`+(e&&n?e[o]:`}`)+`'`,i);if(e&&n){if((a===0||a===1&&e[o]===`{`)&&i.text===e[o]){if(++o,o===e.length){t.splice(-o,o);break}}else o=0}}while(a!==0||n);return r.text===`{`&&t[t.length-1].text===`}`&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:r,end:i}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new z(`The length of delimiters doesn't match the number of args!`);for(var n=t[0],r=0;r<n.length;r++){var i=this.popToken();if(n[r]!==i.text)throw new z(`Use of the macro doesn't match its definition`,i)}}for(var a=[],o=0;o<e;o++)a.push(this.consumeArg(t&&t[o+1]).tokens);return a}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new z(`Too many expansions: infinite loop or need to increase maxExpand setting`)}expandOnce(e){var t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(r==null||e&&r.unexpandable){if(e&&r==null&&n[0]===`\\`&&!this.isDefined(n))throw new z(`Undefined control sequence: `+n);return this.pushToken(t),!1}this.countExpansion(1);var i=r.tokens,a=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs){i=i.slice();for(var o=i.length-1;o>=0;--o){var s=i[o];if(s.text===`#`){if(o===0)throw new z(`Incomplete placeholder at end of macro body`,s);if(s=i[--o],s.text===`#`)i.splice(o+1,1);else if(/^[1-9]$/.test(s.text))i.splice(o,2,...a[s.text-1]);else throw new z(`Not a valid argument number`,s)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text=`\\relax`),e}}expandMacro(e){return this.macros.has(e)?this.expandTokens([new YW(e)]):void 0}expandTokens(e){var t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){var r=this.stack.pop();r.treatAsRelax&&=(r.noexpand=!1,!1),t.push(r)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(e=>e.text).join(``)}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var n=this.lexer.catcodes[e];if(n!=null&&n!==13)return}var r=typeof t==`function`?t(this):t;if(typeof r==`string`){var i=0;if(r.includes(`#`))for(var a=r.replace(/##/g,``);a.includes(`#`+(i+1));)++i;for(var o=new YG(r,this.settings),s=[],c=o.lex();c.text!==`EOF`;)s.push(c),c=o.lex();return s.reverse(),{tokens:s,numArgs:i}}return r}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(BG,e)||Object.prototype.hasOwnProperty.call(MV.math,e)||Object.prototype.hasOwnProperty.call(MV.text,e)||Object.prototype.hasOwnProperty.call(aK,e)}isExpandable(e){var t=this.macros.get(e);return t==null?Object.prototype.hasOwnProperty.call(BG,e)&&!BG[e].primitive:typeof t==`string`||typeof t==`function`||!t.unexpandable}},sK=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,cK=Object.freeze({"₊":`+`,"₋":`-`,"₌":`=`,"₍":`(`,"₎":`)`,"₀":`0`,"₁":`1`,"₂":`2`,"₃":`3`,"₄":`4`,"₅":`5`,"₆":`6`,"₇":`7`,"₈":`8`,"₉":`9`,ₐ:`a`,ₑ:`e`,ₕ:`h`,ᵢ:`i`,ⱼ:`j`,ₖ:`k`,ₗ:`l`,ₘ:`m`,ₙ:`n`,ₒ:`o`,ₚ:`p`,ᵣ:`r`,ₛ:`s`,ₜ:`t`,ᵤ:`u`,ᵥ:`v`,ₓ:`x`,ᵦ:`β`,ᵧ:`γ`,ᵨ:`ρ`,ᵩ:`ϕ`,ᵪ:`χ`,"⁺":`+`,"⁻":`-`,"⁼":`=`,"⁽":`(`,"⁾":`)`,"⁰":`0`,"¹":`1`,"²":`2`,"³":`3`,"⁴":`4`,"⁵":`5`,"⁶":`6`,"⁷":`7`,"⁸":`8`,"⁹":`9`,ᴬ:`A`,ᴮ:`B`,ᴰ:`D`,ᴱ:`E`,ᴳ:`G`,ᴴ:`H`,ᴵ:`I`,ᴶ:`J`,ᴷ:`K`,ᴸ:`L`,ᴹ:`M`,ᴺ:`N`,ᴼ:`O`,ᴾ:`P`,ᴿ:`R`,ᵀ:`T`,ᵁ:`U`,ⱽ:`V`,ᵂ:`W`,ᵃ:`a`,ᵇ:`b`,ᶜ:`c`,ᵈ:`d`,ᵉ:`e`,ᶠ:`f`,ᵍ:`g`,ʰ:`h`,ⁱ:`i`,ʲ:`j`,ᵏ:`k`,ˡ:`l`,ᵐ:`m`,ⁿ:`n`,ᵒ:`o`,ᵖ:`p`,ʳ:`r`,ˢ:`s`,ᵗ:`t`,ᵘ:`u`,ᵛ:`v`,ʷ:`w`,ˣ:`x`,ʸ:`y`,ᶻ:`z`,ᵝ:`β`,ᵞ:`γ`,ᵟ:`δ`,ᵠ:`ϕ`,ᵡ:`χ`,ᶿ:`θ`}),lK={"́":{text:`\\'`,math:`\\acute`},"̀":{text:"\\`",math:`\\grave`},"̈":{text:`\\"`,math:`\\ddot`},"̃":{text:`\\~`,math:`\\tilde`},"̄":{text:`\\=`,math:`\\bar`},"̆":{text:`\\u`,math:`\\breve`},"̌":{text:`\\v`,math:`\\check`},"̂":{text:`\\^`,math:`\\hat`},"̇":{text:`\\.`,math:`\\dot`},"̊":{text:`\\r`,math:`\\mathring`},"̋":{text:`\\H`},"̧":{text:`\\c`}},uK={á:`á`,à:`à`,ä:`ä`,ǟ:`ǟ`,ã:`ã`,ā:`ā`,ă:`ă`,ắ:`ắ`,ằ:`ằ`,ẵ:`ẵ`,ǎ:`ǎ`,â:`â`,ấ:`ấ`,ầ:`ầ`,ẫ:`ẫ`,ȧ:`ȧ`,ǡ:`ǡ`,å:`å`,ǻ:`ǻ`,ḃ:`ḃ`,ć:`ć`,ḉ:`ḉ`,č:`č`,ĉ:`ĉ`,ċ:`ċ`,ç:`ç`,ď:`ď`,ḋ:`ḋ`,ḑ:`ḑ`,é:`é`,è:`è`,ë:`ë`,ẽ:`ẽ`,ē:`ē`,ḗ:`ḗ`,ḕ:`ḕ`,ĕ:`ĕ`,ḝ:`ḝ`,ě:`ě`,ê:`ê`,ế:`ế`,ề:`ề`,ễ:`ễ`,ė:`ė`,ȩ:`ȩ`,ḟ:`ḟ`,ǵ:`ǵ`,ḡ:`ḡ`,ğ:`ğ`,ǧ:`ǧ`,ĝ:`ĝ`,ġ:`ġ`,ģ:`ģ`,ḧ:`ḧ`,ȟ:`ȟ`,ĥ:`ĥ`,ḣ:`ḣ`,ḩ:`ḩ`,í:`í`,ì:`ì`,ï:`ï`,ḯ:`ḯ`,ĩ:`ĩ`,ī:`ī`,ĭ:`ĭ`,ǐ:`ǐ`,î:`î`,ǰ:`ǰ`,ĵ:`ĵ`,ḱ:`ḱ`,ǩ:`ǩ`,ķ:`ķ`,ĺ:`ĺ`,ľ:`ľ`,ļ:`ļ`,ḿ:`ḿ`,ṁ:`ṁ`,ń:`ń`,ǹ:`ǹ`,ñ:`ñ`,ň:`ň`,ṅ:`ṅ`,ņ:`ņ`,ó:`ó`,ò:`ò`,ö:`ö`,ȫ:`ȫ`,õ:`õ`,ṍ:`ṍ`,ṏ:`ṏ`,ȭ:`ȭ`,ō:`ō`,ṓ:`ṓ`,ṑ:`ṑ`,ŏ:`ŏ`,ǒ:`ǒ`,ô:`ô`,ố:`ố`,ồ:`ồ`,ỗ:`ỗ`,ȯ:`ȯ`,ȱ:`ȱ`,ő:`ő`,ṕ:`ṕ`,ṗ:`ṗ`,ŕ:`ŕ`,ř:`ř`,ṙ:`ṙ`,ŗ:`ŗ`,ś:`ś`,ṥ:`ṥ`,š:`š`,ṧ:`ṧ`,ŝ:`ŝ`,ṡ:`ṡ`,ş:`ş`,ẗ:`ẗ`,ť:`ť`,ṫ:`ṫ`,ţ:`ţ`,ú:`ú`,ù:`ù`,ü:`ü`,ǘ:`ǘ`,ǜ:`ǜ`,ǖ:`ǖ`,ǚ:`ǚ`,ũ:`ũ`,ṹ:`ṹ`,ū:`ū`,ṻ:`ṻ`,ŭ:`ŭ`,ǔ:`ǔ`,û:`û`,ů:`ů`,ű:`ű`,ṽ:`ṽ`,ẃ:`ẃ`,ẁ:`ẁ`,ẅ:`ẅ`,ŵ:`ŵ`,ẇ:`ẇ`,ẘ:`ẘ`,ẍ:`ẍ`,ẋ:`ẋ`,ý:`ý`,ỳ:`ỳ`,ÿ:`ÿ`,ỹ:`ỹ`,ȳ:`ȳ`,ŷ:`ŷ`,ẏ:`ẏ`,ẙ:`ẙ`,ź:`ź`,ž:`ž`,ẑ:`ẑ`,ż:`ż`,Á:`Á`,À:`À`,Ä:`Ä`,Ǟ:`Ǟ`,Ã:`Ã`,Ā:`Ā`,Ă:`Ă`,Ắ:`Ắ`,Ằ:`Ằ`,Ẵ:`Ẵ`,Ǎ:`Ǎ`,Â:`Â`,Ấ:`Ấ`,Ầ:`Ầ`,Ẫ:`Ẫ`,Ȧ:`Ȧ`,Ǡ:`Ǡ`,Å:`Å`,Ǻ:`Ǻ`,Ḃ:`Ḃ`,Ć:`Ć`,Ḉ:`Ḉ`,Č:`Č`,Ĉ:`Ĉ`,Ċ:`Ċ`,Ç:`Ç`,Ď:`Ď`,Ḋ:`Ḋ`,Ḑ:`Ḑ`,É:`É`,È:`È`,Ë:`Ë`,Ẽ:`Ẽ`,Ē:`Ē`,Ḗ:`Ḗ`,Ḕ:`Ḕ`,Ĕ:`Ĕ`,Ḝ:`Ḝ`,Ě:`Ě`,Ê:`Ê`,Ế:`Ế`,Ề:`Ề`,Ễ:`Ễ`,Ė:`Ė`,Ȩ:`Ȩ`,Ḟ:`Ḟ`,Ǵ:`Ǵ`,Ḡ:`Ḡ`,Ğ:`Ğ`,Ǧ:`Ǧ`,Ĝ:`Ĝ`,Ġ:`Ġ`,Ģ:`Ģ`,Ḧ:`Ḧ`,Ȟ:`Ȟ`,Ĥ:`Ĥ`,Ḣ:`Ḣ`,Ḩ:`Ḩ`,Í:`Í`,Ì:`Ì`,Ï:`Ï`,Ḯ:`Ḯ`,Ĩ:`Ĩ`,Ī:`Ī`,Ĭ:`Ĭ`,Ǐ:`Ǐ`,Î:`Î`,İ:`İ`,Ĵ:`Ĵ`,Ḱ:`Ḱ`,Ǩ:`Ǩ`,Ķ:`Ķ`,Ĺ:`Ĺ`,Ľ:`Ľ`,Ļ:`Ļ`,Ḿ:`Ḿ`,Ṁ:`Ṁ`,Ń:`Ń`,Ǹ:`Ǹ`,Ñ:`Ñ`,Ň:`Ň`,Ṅ:`Ṅ`,Ņ:`Ņ`,Ó:`Ó`,Ò:`Ò`,Ö:`Ö`,Ȫ:`Ȫ`,Õ:`Õ`,Ṍ:`Ṍ`,Ṏ:`Ṏ`,Ȭ:`Ȭ`,Ō:`Ō`,Ṓ:`Ṓ`,Ṑ:`Ṑ`,Ŏ:`Ŏ`,Ǒ:`Ǒ`,Ô:`Ô`,Ố:`Ố`,Ồ:`Ồ`,Ỗ:`Ỗ`,Ȯ:`Ȯ`,Ȱ:`Ȱ`,Ő:`Ő`,Ṕ:`Ṕ`,Ṗ:`Ṗ`,Ŕ:`Ŕ`,Ř:`Ř`,Ṙ:`Ṙ`,Ŗ:`Ŗ`,Ś:`Ś`,Ṥ:`Ṥ`,Š:`Š`,Ṧ:`Ṧ`,Ŝ:`Ŝ`,Ṡ:`Ṡ`,Ş:`Ş`,Ť:`Ť`,Ṫ:`Ṫ`,Ţ:`Ţ`,Ú:`Ú`,Ù:`Ù`,Ü:`Ü`,Ǘ:`Ǘ`,Ǜ:`Ǜ`,Ǖ:`Ǖ`,Ǚ:`Ǚ`,Ũ:`Ũ`,Ṹ:`Ṹ`,Ū:`Ū`,Ṻ:`Ṻ`,Ŭ:`Ŭ`,Ǔ:`Ǔ`,Û:`Û`,Ů:`Ů`,Ű:`Ű`,Ṽ:`Ṽ`,Ẃ:`Ẃ`,Ẁ:`Ẁ`,Ẅ:`Ẅ`,Ŵ:`Ŵ`,Ẇ:`Ẇ`,Ẍ:`Ẍ`,Ẋ:`Ẋ`,Ý:`Ý`,Ỳ:`Ỳ`,Ÿ:`Ÿ`,Ỹ:`Ỹ`,Ȳ:`Ȳ`,Ŷ:`Ŷ`,Ẏ:`Ẏ`,Ź:`Ź`,Ž:`Ž`,Ẑ:`Ẑ`,Ż:`Ż`,ά:`ά`,ὰ:`ὰ`,ᾱ:`ᾱ`,ᾰ:`ᾰ`,έ:`έ`,ὲ:`ὲ`,ή:`ή`,ὴ:`ὴ`,ί:`ί`,ὶ:`ὶ`,ϊ:`ϊ`,ΐ:`ΐ`,ῒ:`ῒ`,ῑ:`ῑ`,ῐ:`ῐ`,ό:`ό`,ὸ:`ὸ`,ύ:`ύ`,ὺ:`ὺ`,ϋ:`ϋ`,ΰ:`ΰ`,ῢ:`ῢ`,ῡ:`ῡ`,ῠ:`ῠ`,ώ:`ώ`,ὼ:`ὼ`,Ύ:`Ύ`,Ὺ:`Ὺ`,Ϋ:`Ϋ`,Ῡ:`Ῡ`,Ῠ:`Ῠ`,Ώ:`Ώ`,Ὼ:`Ὼ`},dK=class e{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode=`math`,this.gullet=new oK(e,t,this.mode),this.settings=t,this.leftrightDepth=0,this.nextToken=null}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new z(`Expected '`+e+`', got '`+this.fetch().text+`'`,this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken??=this.gullet.expandNextToken(),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set(`\\color`,`\\textcolor`);try{var e=this.parseExpression(!1);return this.expect(`EOF`),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new YW(`}`)),this.gullet.pushTokens(e);var n=this.parseExpression(!1);return this.expect(`}`),this.nextToken=t,n}parseExpression(t,n){for(var r=[];;){this.mode===`math`&&this.consumeSpaces();var i=this.fetch();if(e.endOfExpression.has(i.text)||n&&i.text===n||t&&BG[i.text]&&BG[i.text].infix)break;var a=this.parseAtom(n);if(!a)break;a.type!==`internal`&&r.push(a)}return this.mode===`text`&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var t=-1,n,r=0;r<e.length;r++){var i=e[r];if(i.type===`infix`){if(t!==-1)throw new z(`only one infix operator per group`,i.token);t=r,n=i.replaceWith}}if(t!==-1&&n){var a,o,s=e.slice(0,t),c=e.slice(t+1);return a=s.length===1&&s[0].type===`ordgroup`?s[0]:{type:`ordgroup`,mode:this.mode,body:s},o=c.length===1&&c[0].type===`ordgroup`?c[0]:{type:`ordgroup`,mode:this.mode,body:c},[n===`\\\\abovefrac`?this.callFunction(n,[a,e[t],o],[]):this.callFunction(n,[a,o],[])]}return e}handleSupSubscript(e){var t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();var r;do r=this.parseGroup(e);while(r?.type===`internal`);if(!r)throw new z(`Expected group after '`+n+`'`,t);return r}formatUnsupportedCmd(e){for(var t=[],n=0;n<e.length;n++)t.push({type:`textord`,mode:`text`,text:e[n]});var r={type:`text`,mode:this.mode,body:t};return{type:`color`,mode:this.mode,color:this.settings.errorColor,body:[r]}}parseAtom(e){var t=this.parseGroup(`atom`,e);if(t?.type===`internal`||this.mode===`text`)return t;for(var n,r;;){this.consumeSpaces();var i=this.fetch();if(i.text===`\\limits`||i.text===`\\nolimits`){if(t&&t.type===`op`)t.limits=i.text===`\\limits`,t.alwaysHandleSupSub=!0;else if(t&&t.type===`operatorname`)t.alwaysHandleSupSub&&(t.limits=i.text===`\\limits`);else throw new z(`Limit controls must follow a math operator`,i);this.consume()}else if(i.text===`^`){if(n)throw new z(`Double superscript`,i);n=this.handleSupSubscript(`superscript`)}else if(i.text===`_`){if(r)throw new z(`Double subscript`,i);r=this.handleSupSubscript(`subscript`)}else if(i.text===`'`){if(n)throw new z(`Double superscript`,i);var a={type:`textord`,mode:this.mode,text:`\\prime`},o=[a];for(this.consume();this.fetch().text===`'`;)o.push(a),this.consume();this.fetch().text===`^`&&o.push(this.handleSupSubscript(`superscript`)),n={type:`ordgroup`,mode:this.mode,body:o}}else if(cK[i.text]){var s=sK.test(i.text),c=[];for(c.push(new YW(cK[i.text])),this.consume();;){var l=this.fetch().text;if(!cK[l]||sK.test(l)!==s)break;c.unshift(new YW(cK[l])),this.consume()}var u=this.subparse(c);s?r={type:`ordgroup`,mode:`math`,body:u}:n={type:`ordgroup`,mode:`math`,body:u}}else break}return n&&r?{type:`supsub`,mode:this.mode,base:t,sup:n,sub:r}:n?{type:`supsub`,mode:this.mode,base:t,sup:n}:r?{type:`supsub`,mode:this.mode,base:t,sub:r}:t}parseFunction(e,t){var n=this.fetch(),r=n.text,i=BG[r];if(!i)return null;if(this.consume(),t&&t!==`atom`&&!i.allowedInArgument)throw new z(`Got function '`+r+`' with no arguments`+(t?` as `+t:``),n);if(this.mode===`text`&&!i.allowedInText)throw new z(`Can't use function '`+r+`' in text mode`,n);if(this.mode===`math`&&i.allowedInMath===!1)throw new z(`Can't use function '`+r+`' in math mode`,n);var a=this.parseArguments(r,i),o=a.args,s=a.optArgs;return this.callFunction(r,o,s,n,e)}callFunction(e,t,n,r,i){var a={funcName:e,parser:this,token:r,breakOnTokenText:i},o=BG[e];if(o&&o.handler)return o.handler(a,t,n);throw new z(`No function handler for `+e)}parseArguments(e,t){var n=t.numOptionalArgs??0,r=t.numArgs+n;if(r===0)return{args:[],optArgs:[]};for(var i=[],a=[],o=0;o<r;o++){var s=t.argTypes?.[o],c=o<n;(`primitive`in t&&t.primitive&&s==null||t.type===`sqrt`&&o===1&&a[0]==null)&&(s=`primitive`);var l=this.parseGroupOfType(`argument to '`+e+`'`,s,c);if(c)a.push(l);else if(l!=null)i.push(l);else throw new z(`Null argument, please report this as a bug`)}return{args:i,optArgs:a}}parseGroupOfType(e,t,n){switch(t){case`color`:return this.parseColorGroup(n);case`size`:return this.parseSizeGroup(n);case`url`:return this.parseUrlGroup(n);case`math`:case`text`:return this.parseArgumentGroup(n,t);case`hbox`:var r=this.parseArgumentGroup(n,`text`);return r==null?null:{type:`styling`,mode:r.mode,body:[r],style:`text`,resetFont:!0};case`raw`:var i=this.parseStringGroup(n);return i==null?null:{type:`raw`,mode:`text`,string:i.text};case`primitive`:if(n)throw new z(`A primitive argument cannot be optional`);var a=this.parseGroup(e);if(a==null)throw new z(`Expected group as `+e,this.fetch());return a;case`original`:case void 0:return this.parseArgumentGroup(n);default:throw new z(`Unknown group type as `+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===` `;)this.consume()}parseStringGroup(e){var t=this.gullet.scanArgument(e);if(t==null)return null;for(var n=``,r;(r=this.fetch()).text!==`EOF`;)n+=r.text,this.consume();return this.consume(),t.text=n,t}parseRegexGroup(e,t){for(var n=this.fetch(),r=n,i=``,a;(a=this.fetch()).text!==`EOF`&&e.test(i+a.text);)r=a,i+=r.text,this.consume();if(i===``)throw new z(`Invalid `+t+`: '`+n.text+`'`,n);return n.range(r,i)}parseColorGroup(e){var t=this.parseStringGroup(e);if(t==null)return null;var n=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!n)throw new z(`Invalid color: '`+t.text+`'`,t);var r=n[0];return/^[0-9a-f]{6}$/i.test(r)&&(r=`#`+r),{type:`color-token`,mode:this.mode,color:r}}parseSizeGroup(e){var t,n=!1;if(this.gullet.consumeSpaces(),t=!e&&this.gullet.future().text!==`{`?this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,`size`):this.parseStringGroup(e),!t)return null;!e&&t.text.length===0&&(t.text=`0pt`,n=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!r)throw new z(`Invalid size: '`+t.text+`'`,t);var i={number:+(r[1]+r[2]),unit:r[3]};if(!oV(i))throw new z(`Invalid unit: '`+i.unit+`'`,t);return{type:`size`,mode:this.mode,value:i,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode(`%`,13),this.gullet.lexer.setCatcode(`~`,12);var t=this.parseStringGroup(e);if(this.gullet.lexer.setCatcode(`%`,14),this.gullet.lexer.setCatcode(`~`,13),t==null)return null;var n=t.text.replace(/\\([#$%&~_^{}])/g,`$1`);return{type:`url`,mode:this.mode,url:n}}parseArgumentGroup(e,t){var n=this.gullet.scanArgument(e);if(n==null)return null;var r=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var i=this.parseExpression(!1,`EOF`);this.expect(`EOF`),this.gullet.endGroup();var a={type:`ordgroup`,mode:this.mode,loc:n.loc,body:i};return t&&this.switchMode(r),a}parseGroup(e,t){var n=this.fetch(),r=n.text,i;if(r===`{`||r===`\\begingroup`){this.consume();var a=r===`{`?`}`:`\\endgroup`;this.gullet.beginGroup();var o=this.parseExpression(!1,a),s=this.fetch();this.expect(a),this.gullet.endGroup(),i={type:`ordgroup`,mode:this.mode,loc:JW.range(n,s),body:o,semisimple:r===`\\begingroup`||void 0}}else if(i=this.parseFunction(t,e)||this.parseSymbol(),i==null&&r[0]===`\\`&&!Object.prototype.hasOwnProperty.call(aK,r)){if(this.settings.throwOnError)throw new z(`Undefined control sequence: `+r,n);i=this.formatUnsupportedCmd(r),this.consume()}return i}formLigatures(e){for(var t=e.length-1,n=0;n<t;++n){var r=e[n];if(r.type===`textord`){var i=r.text,a=e[n+1];if(a&&a.type===`textord`){if(i===`-`&&a.text===`-`){var o=e[n+2];n+1<t&&o&&o.type===`textord`&&o.text===`-`?(e.splice(n,3,{type:`textord`,mode:`text`,loc:JW.range(r,o),text:`---`}),t-=2):(e.splice(n,2,{type:`textord`,mode:`text`,loc:JW.range(r,a),text:`--`}),--t)}(i===`'`||i==="`")&&a.text===i&&(e.splice(n,2,{type:`textord`,mode:`text`,loc:JW.range(r,a),text:i+i}),--t)}}}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var n=t.slice(5),r=n.charAt(0)===`*`;if(r&&(n=n.slice(1)),n.length<2||n.charAt(0)!==n.slice(-1))throw new z(`\\verb assertion failed --
315
- please report what input caused this bug`);return n=n.slice(1,-1),{type:`verb`,mode:`text`,body:n,star:r}}Object.prototype.hasOwnProperty.call(uK,t[0])&&!MV[this.mode][t[0]]&&(this.settings.strict&&this.mode===`math`&&yH({strict:this.settings.strict,errorCode:`unicodeTextInMathMode`,errorMsg:`Accented Unicode text character "`+t[0]+`" used in math mode`,report:!0,token:e}),t=uK[t[0]]+t.slice(1));var i=qG.exec(t);i&&(t=t.substring(0,i.index),t===`i`?t=`ı`:t===`j`&&(t=`ȷ`));var a;if(MV[this.mode][t]){this.settings.strict&&this.mode===`math`&&tH.includes(t)&&yH({strict:this.settings.strict,errorCode:`unicodeTextInMathMode`,errorMsg:`Latin-1/Unicode text character "`+t[0]+`" used in math mode`,report:!0,token:e});var o=MV[this.mode][t].group,s=JW.range(e);a=HU(o)?{type:`atom`,mode:this.mode,family:o,loc:s,text:t}:{type:o,mode:this.mode,loc:s,text:t}}else if(t.charCodeAt(0)>=128)this.settings.strict&&(HB(t.charCodeAt(0))?this.mode===`math`&&yH({strict:this.settings.strict,errorCode:`unicodeTextInMathMode`,errorMsg:`Unicode text character "`+t[0]+`" used in math mode`,report:!0,token:e}):yH({strict:this.settings.strict,errorCode:`unknownSymbol`,errorMsg:`Unrecognized Unicode character "`+t[0]+`"`+(` (`+t.charCodeAt(0)+`)`),report:!0,token:e})),a={type:`textord`,mode:`text`,loc:JW.range(e),text:t};else return null;if(this.consume(),i)for(var c=0;c<i[0].length;c++){var l=i[0][c];if(!lK[l])throw new z(`Unknown accent ' `+l+`'`,e);var u=lK[l][this.mode]||lK[l].text;if(!u)throw new z(`Accent `+l+` unsupported in `+this.mode+` mode`,e);a={type:`accent`,mode:this.mode,loc:JW.range(e),label:u,isStretchy:!1,isShifty:!0,base:a}}return a}};dK.endOfExpression=new Set([`}`,`\\endgroup`,`\\end`,`\\right`,`&`]);var fK=function(e,t){if(!(typeof e==`string`||e instanceof String))throw TypeError(`KaTeX can only parse string typed expression`);var n=new dK(e,t);delete n.gullet.macros.current[`\\df@tag`];var r=n.parse();if(delete n.gullet.macros.current[`\\current@color`],delete n.gullet.macros.current[`\\color`],n.gullet.macros.get(`\\df@tag`)){if(!t.displayMode)throw new z(`\\tag works only in display equations`);r=[{type:`tag`,mode:`text`,body:r,tag:n.subparse([new YW(`\\df@tag`)])}]}return r},pK=function(e,t,n){t.textContent=``;var r=_K(e,n).toNode();t.appendChild(r)};typeof document<`u`&&document.compatMode!==`CSS1Compat`&&(typeof console<`u`&&console.warn(`Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype.`),pK=function(){throw new z(`KaTeX doesn't work in quirks mode.`)});var mK=function(e,t){return _K(e,t).toMarkup()},hK=function(e,t){return fK(e,new xB(t))},gK=function(e,t,n){if(n.throwOnError||!(e instanceof z))throw e;var r=X([`katex-error`],[new vV(t)]);return r.setAttribute(`title`,e.toString()),r.setAttribute(`style`,`color:`+n.errorColor),r},_K=function(e,t){var n=new xB(t);try{return AU(fK(e,n),e,n)}catch(t){return gK(t,e,n)}},vK={version:`0.19.0`,render:pK,renderToString:mK,ParseError:z,SETTINGS_SCHEMA:_B,__parse:hK,__renderToDomTree:_K,__renderToHTMLTree:function(e,t){var n=new xB(t);try{return jU(fK(e,n),n)}catch(t){return gK(t,e,n)}},__setFontMetrics:OV,__defineSymbol:V,__defineFunction:Z,__defineMacro:$,__domTree:{Span:mV,Anchor:hV,SymbolNode:vV,SvgNode:yV,PathNode:bV,LineNode:xV}};function yK(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:s,mathText:o,mathTextData:s}};function e(e){this.enter({type:`math`,meta:null,value:``,data:{hName:`pre`,hChildren:[{type:`element`,tagName:`code`,properties:{className:[`language-math`,`math-display`]},children:[]}]}},e)}function t(){this.buffer()}function n(){let e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;let r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:`text`,value:t}),this.data.mathFlowInside=void 0}function a(e){this.enter({type:`inlineMath`,value:``,data:{hName:`code`,hProperties:{className:[`language-math`,`math-inline`]},hChildren:[]}},e),this.buffer()}function o(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t,n.data.hChildren.push({type:`text`,value:t})}function s(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}function bK(e){let t=(e||{}).singleDollarTextMath;return t??=!0,r.peek=i,{unsafe:[{character:`\r`,inConstruct:`mathFlowMeta`},{character:`
316
- `,inConstruct:`mathFlowMeta`},{character:`$`,after:t?void 0:`\\$`,inConstruct:`phrasing`},{character:`$`,inConstruct:`mathFlowMeta`},{atBreak:!0,character:`$`,after:`\\$`}],handlers:{math:n,inlineMath:r}};function n(e,t,n,r){let i=e.value||``,a=n.createTracker(r),o=`$`.repeat(Math.max(ec(i,`$`)+1,2)),s=n.enter(`mathFlow`),c=a.move(o);if(e.meta){let t=n.enter(`mathFlowMeta`);c+=a.move(n.safe(e.meta,{after:`
317
- `,before:c,encode:[`$`],...a.current()})),t()}return c+=a.move(`
318
- `),i&&(c+=a.move(i+`
319
- `)),c+=a.move(o),s(),c}function r(e,n,r){let i=e.value||``,a=1;for(t||a++;RegExp(`(^|[^$])`+`\\$`.repeat(a)+`([^$]|$)`).test(i);)a++;let o=`$`.repeat(a);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` `+i+` `);let s=-1;for(;++s<r.unsafe.length;){let e=r.unsafe[s];if(!e.atBreak)continue;let t=r.compilePattern(e),n;for(;n=t.exec(i);){let e=n.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=i.slice(0,e)+` `+i.slice(n.index+1)}}return o+i+o}function i(){return`$`}}var xK={tokenize:CK,concrete:!0,name:`mathFlow`},SK={tokenize:wK,partial:!0};function CK(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){return e.enter(`mathFlow`),e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),c(t)}function c(t){return t===36?(e.consume(t),o++,c):o<2?n(t):(e.exit(`mathFlowFenceSequence`),ra(e,l,`whitespace`)(t))}function l(t){return t===null||A(t)?d(t):(e.enter(`mathFlowFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===null||A(t)?(e.exit(`chunkString`),e.exit(`mathFlowFenceMeta`),d(t)):t===36?n(t):(e.consume(t),u)}function d(n){return e.exit(`mathFlowFence`),r.interrupt?t(n):e.attempt(SK,f,g)(n)}function f(t){return e.attempt({tokenize:_,partial:!0},g,p)(t)}function p(t){return(a?ra(e,m,`linePrefix`,a+1):m)(t)}function m(t){return t===null?g(t):A(t)?e.attempt(SK,f,g)(t):(e.enter(`mathFlowValue`),h(t))}function h(t){return t===null||A(t)?(e.exit(`mathFlowValue`),m(t)):(e.consume(t),h)}function g(n){return e.exit(`mathFlow`),t(n)}function _(e,t,n){let i=0;return ra(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),s(t)}function s(t){return t===36?(i++,e.consume(t),s):i<o?n(t):(e.exit(`mathFlowFenceSequence`),ra(e,c,`whitespace`)(t))}function c(r){return r===null||A(r)?(e.exit(`mathFlowFence`),t(r)):n(r)}}}function wK(e,t,n){let r=this;return i;function i(n){return n===null?t(n):(e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function TK(e){let t=(e||{}).singleDollarTextMath;return t??=!0,{tokenize:n,resolve:EK,previous:DK,name:`mathText`};function n(e,n,r){let i=0,a,o;return s;function s(t){return e.enter(`mathText`),e.enter(`mathTextSequence`),c(t)}function c(n){return n===36?(e.consume(n),i++,c):i<2&&!t?r(n):(e.exit(`mathTextSequence`),l(n))}function l(t){return t===null?r(t):t===36?(o=e.enter(`mathTextSequence`),a=0,d(t)):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),l):A(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),l):(e.enter(`mathTextData`),u(t))}function u(t){return t===null||t===32||t===36||A(t)?(e.exit(`mathTextData`),l(t)):(e.consume(t),u)}function d(t){return t===36?(e.consume(t),a++,d):a===i?(e.exit(`mathTextSequence`),e.exit(`mathText`),n(t)):(o.type=`mathTextData`,u(t))}}}function EK(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`mathTextData`){e[t][1].type=`mathTextPadding`,e[n][1].type=`mathTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`mathTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function DK(e){return e!==36||this.events[this.events.length-1][1].type===`characterEscape`}function OK(e){return{flow:{36:xK},text:{36:TK(e)}}}var kK={};function AK(e){let t=this,n=e||kK,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(OK(n)),a.push(yK()),o.push(bK(n))}var jK=Object.defineProperty,MK=Object.getOwnPropertySymbols,NK=Object.prototype.hasOwnProperty,PK=Object.prototype.propertyIsEnumerable,FK=(e,t,n)=>t in e?jK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IK=(e,t)=>{for(var n in t||={})NK.call(t,n)&&FK(e,n,t[n]);if(MK)for(var n of MK(t))PK.call(t,n)&&FK(e,n,t[n]);return e};function LK(e,t){return Object.assign(e,{meta:IK({package:`@milkdown/components`},t)}),e}var RK=Object.defineProperty,zK=Object.getOwnPropertySymbols,BK=Object.prototype.hasOwnProperty,VK=Object.prototype.propertyIsEnumerable,HK=(e,t,n)=>t in e?RK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UK=(e,t)=>{for(var n in t||={})BK.call(t,n)&&HK(e,n,t[n]);if(zK)for(var n of zK(t))VK.call(t,n)&&HK(e,n,t[n]);return e},WK=xx(UK({},{mode:`preview`}),`linkTooltipStateCtx`);LK(WK,{displayName:`State<link-tooltip>`,group:`LinkTooltip`});var GK=xx(UK({},{addLink:()=>{},editLink:()=>{},removeLink:()=>{}}),`linkTooltipAPICtx`);LK(WK,{displayName:`API<link-tooltip>`,group:`LinkTooltip`});var KK=xx(UK({},{linkIcon:`🔗`,editButton:`✎`,removeButton:`⌫`,confirmButton:`Confirm ⏎`,onCopyLink:()=>{},inputPlaceholder:`Paste link...`}),`linkTooltipConfigCtx`);LK(WK,{displayName:`Config<link-tooltip>`,group:`LinkTooltip`});var qK=L(`ToggleLink`,e=>()=>t=>{let{doc:n,selection:r}=t,i=mE.type(e);return n.rangeHasMark(r.from,r.to,i)?(e.get(GK.key).removeLink(r.from,r.to),!0):(e.get(GK.key).addLink(r.from,r.to),!0)}),JK=vT(`LINK_PREVIEW`);LK(JK[0],{displayName:`PreviewTooltipSpec<link-tooltip>`,group:`LinkTooltip`}),LK(JK[1],{displayName:`PreviewTooltipPlugin<link-tooltip>`,group:`LinkTooltip`});var YK=vT(`LINK_EDIT`);LK(YK[0],{displayName:`EditTooltipSpec<link-tooltip>`,group:`LinkTooltip`}),LK(YK[1],{displayName:`EditTooltipPlugin<link-tooltip>`,group:`LinkTooltip`});function XK({icon:e,class:t,onClick:n}){return f(`span`,{class:bT(`milkdown-icon`,t),onPointerdown:n,innerHTML:e?gt.sanitize(e.trim()):void 0})}XK.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var ZK=fx(`abcdefghijklmnopqrstuvwxyz0123456789`,8);function QK(e){return`${e}-${ZK()}`}var $K=d({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:e,src:t,onConfirm:n,onCancel:r}){let a=S(t),o=QK(`milkdown-link-edit`);i(t,e=>{a.value=e});let s=()=>{n(a.value)},c=e=>{e.stopPropagation(),e.key===`Enter`&&(e.preventDefault(),s()),e.key===`Escape`&&(e.preventDefault(),r())};return()=>f(`div`,{class:`link-edit`},f(`input`,{id:o,class:`input-area`,placeholder:e.value.inputPlaceholder,onKeydown:c,onInput:e=>{a.value=e.target.value},value:a.value}),a.value?f(XK,{class:`button confirm`,icon:e.value.confirmButton,onClick:s}):null)}}),eq=Object.defineProperty,tq=Object.defineProperties,nq=Object.getOwnPropertyDescriptors,rq=Object.getOwnPropertySymbols,iq=Object.prototype.hasOwnProperty,aq=Object.prototype.propertyIsEnumerable,oq=e=>{throw TypeError(e)},sq=(e,t,n)=>t in e?eq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cq=(e,t)=>{for(var n in t||={})iq.call(t,n)&&sq(e,n,t[n]);if(rq)for(var n of rq(t))aq.call(t,n)&&sq(e,n,t[n]);return e},lq=(e,t)=>tq(e,nq(t)),uq=(e,t,n)=>t.has(e)||oq(`Cannot `+n),dq=(e,t,n)=>(uq(e,t,`read from private field`),n?n.call(e):t.get(e)),fq=(e,t,n)=>t.has(e)?oq(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),pq=(e,t,n,r)=>(uq(e,t,`write to private field`),t.set(e,n),n),mq,hq,gq,_q,vq,yq,bq,xq,Sq,Cq,wq,Tq,Eq={from:-1,to:-1,mark:null},Dq=class{constructor(e,t){this.ctx=e,fq(this,mq),fq(this,hq),fq(this,gq,cq({},Eq)),fq(this,_q),fq(this,vq),fq(this,yq,S(``)),fq(this,bq,()=>{dq(this,Cq).call(this),dq(this,hq).hide(),this.ctx.update(WK.key,e=>lq(cq({},e),{mode:`preview`})),pq(this,gq,cq({},Eq))}),fq(this,xq,e=>{let t=e.target;t&&(dq(this,mq).contains(t)||dq(this,bq).call(this))}),fq(this,Sq,()=>{document.addEventListener(`pointerdown`,dq(this,xq),!0)}),fq(this,Cq,()=>{document.removeEventListener(`pointerdown`,dq(this,xq),!0)}),fq(this,wq,e=>{let t=this.ctx.get(Qy),{from:n,to:r,mark:i}=dq(this,gq),a=mE.type(this.ctx),o=fE(e);if(i&&i.attrs.href===o){dq(this,bq).call(this);return}let s=t.state.tr;if(i&&s.removeMark(n,r,i),n===r){if(!o){dq(this,bq).call(this);return}let e=a.create({href:o});s.insertText(o,n),s.addMark(n,n+o.length,e)}else s.addMark(n,r,a.create({href:o}));t.dispatch(s),dq(this,bq).call(this)}),fq(this,Tq,(e,t,n)=>{let r=this.ctx.get(KK.key);dq(this,vq).value=r,dq(this,yq).value=e,this.ctx.update(WK.key,e=>lq(cq({},e),{mode:`edit`}));let i=this.ctx.get(Qy);i.dispatch(i.state.tr.setSelection(N.create(i.state.doc,t,n))),dq(this,hq).show({getBoundingClientRect:()=>eh(i,t,n)},i),dq(this,Sq).call(this),requestAnimationFrame(()=>{var e;(e=dq(this,mq).querySelector(`input`))==null||e.focus()})}),this.update=e=>{let{state:t}=e,{selection:n}=t;if(!(n instanceof N))return;let{from:r,to:i}=n;(r!==dq(this,gq).from||i!==dq(this,gq).to)&&dq(this,bq).call(this)},this.destroy=()=>{dq(this,Cq).call(this),dq(this,_q).unmount(),dq(this,hq).destroy(),dq(this,mq).remove()},this.addLink=(e,t)=>{pq(this,gq,{from:e,to:t,mark:null}),dq(this,Tq).call(this,``,e,t)},this.editLink=(e,t,n)=>{pq(this,gq,{from:t,to:n,mark:e}),dq(this,Tq).call(this,e.attrs.href,t,n)},this.removeLink=(e,t)=>{let n=this.ctx.get(Qy),r=n.state.tr;r.removeMark(e,t,mE.type(this.ctx)),n.dispatch(r),dq(this,bq).call(this)},pq(this,vq,S(this.ctx.get(KK.key)));let n=document.createElement(`div`);n.className=`milkdown-link-edit`;let r=re($K,{config:dq(this,vq),src:dq(this,yq),onConfirm:dq(this,wq),onCancel:dq(this,bq)});r.mount(n),pq(this,_q,r),pq(this,mq,n),pq(this,hq,new _T({content:n,debounce:0,shouldShow:()=>!1})),dq(this,hq).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},dq(this,hq).update(t)}};mq=new WeakMap,hq=new WeakMap,gq=new WeakMap,_q=new WeakMap,vq=new WeakMap,yq=new WeakMap,bq=new WeakMap,xq=new WeakMap,Sq=new WeakMap,Cq=new WeakMap,wq=new WeakMap,Tq=new WeakMap;var Oq=Object.defineProperty,kq=Object.defineProperties,Aq=Object.getOwnPropertyDescriptors,jq=Object.getOwnPropertySymbols,Mq=Object.prototype.hasOwnProperty,Nq=Object.prototype.propertyIsEnumerable,Pq=(e,t,n)=>t in e?Oq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fq=(e,t)=>{for(var n in t||={})Mq.call(t,n)&&Pq(e,n,t[n]);if(jq)for(var n of jq(t))Nq.call(t,n)&&Pq(e,n,t[n]);return e},Iq=(e,t)=>kq(e,Aq(t));function Lq(e){let t;e.update(GK.key,e=>Iq(Fq({},e),{addLink:(e,n)=>{t?.addLink(e,n)},editLink:(e,n,r)=>{t?.editLink(e,n,r)},removeLink:(e,n)=>{t?.removeLink(e,n)}})),e.set(YK.key,{view:n=>(t=new Dq(e,n),t)})}function Rq(e,t,n,r,i){let a={start:-1,end:-1};return n.nodesBetween(r,i,(n,r)=>{if(a.start>-1)return!1;a.start===-1&&e.isInSet(n.marks)&&t===n&&(a={start:r,end:r+Math.max(n.textContent.length,1)})}),a}function zq(e,t,n){let r=t.posAtCoords({left:n.clientX,top:n.clientY});if(!r)return;let{pos:i}=r,a=t.state.doc.nodeAt(i);if(!a)return;let o=a.marks.find(t=>t.type===mE.mark.type(e));if(o&&JK.pluginKey())return{show:!0,pos:i,node:a,mark:o}}var Bq=d({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:e,src:t,onEdit:n,onRemove:r}){let i=w(()=>fE(t.value)),a=e=>{e.preventDefault(),e.stopPropagation(),n.value()},o=e=>{e.preventDefault(),e.stopPropagation(),r.value()},s=n=>{n.preventDefault();let r=t.value;navigator.clipboard&&r&&navigator.clipboard.writeText(r).then(()=>{e.value.onCopyLink(r)}).catch(e=>console.error(e))};return()=>f(`div`,{class:`link-preview`},f(XK,{class:`button link-icon`,icon:e.value.linkIcon,onClick:s}),f(`a`,{href:i.value,target:`_blank`,rel:`noopener noreferrer`,class:`link-display`},t.value),f(XK,{class:`button link-edit-button`,icon:e.value.editButton,onClick:a}),f(XK,{class:`button link-remove-button`,icon:e.value.removeButton,onClick:o}))}}),Vq=e=>{throw TypeError(e)},Hq=(e,t,n)=>t.has(e)||Vq(`Cannot `+n),Uq=(e,t,n)=>(Hq(e,t,`read from private field`),n?n.call(e):t.get(e)),Wq=(e,t,n)=>t.has(e)?Vq(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Gq=(e,t,n,r)=>(Hq(e,t,`write to private field`),t.set(e,n),n),Kq,qq,Jq,Yq,Xq,Zq,Qq,$q,eJ,tJ,nJ,rJ,iJ,aJ,oJ=class{constructor(e,t){this.ctx=e,Wq(this,Kq),Wq(this,qq),Wq(this,Jq),Wq(this,Yq),Wq(this,Xq,S(``)),Wq(this,Zq,S(()=>{})),Wq(this,Qq,S(()=>{})),Wq(this,$q),Wq(this,eJ),Wq(this,tJ,!1),Wq(this,nJ,({mode:e})=>{e===`edit`&&Uq(this,aJ).call(this)}),Wq(this,rJ,()=>{Gq(this,tJ,!0)}),Wq(this,iJ,()=>{Gq(this,tJ,!1)}),Wq(this,aJ,()=>{Uq(this,qq).hide(),Uq(this,qq).element.removeEventListener(`mouseenter`,Uq(this,rJ)),Uq(this,qq).element.removeEventListener(`mouseleave`,Uq(this,iJ))}),this.show=(e,t,n,r)=>{Uq(this,Yq).value=this.ctx.get(KK.key),Uq(this,Xq).value=e.attrs.href,Uq(this,Zq).value=()=>{this.ctx.get(GK.key).editLink(e,t,n)},Uq(this,Qq).value=()=>{this.ctx.get(GK.key).removeLink(t,n),Uq(this,aJ).call(this)},Uq(this,qq).show({getBoundingClientRect:()=>r},Uq(this,eJ)),Uq(this,qq).element.addEventListener(`mouseenter`,Uq(this,rJ)),Uq(this,qq).element.addEventListener(`mouseleave`,Uq(this,iJ))},this.hide=()=>{Uq(this,tJ)||Uq(this,aJ).call(this)},this.update=()=>{},this.destroy=()=>{Uq(this,$q).unmount(),Uq(this,Jq).off(Uq(this,nJ)),Uq(this,qq).destroy(),Uq(this,Kq).remove()},Gq(this,eJ,t),Gq(this,Yq,S(this.ctx.get(KK.key))),Gq(this,$q,re(Bq,{config:Uq(this,Yq),src:Uq(this,Xq),onEdit:Uq(this,Zq),onRemove:Uq(this,Qq)})),Gq(this,Kq,document.createElement(`div`)),Uq(this,Kq).className=`milkdown-link-preview`,Uq(this,$q).mount(Uq(this,Kq)),Gq(this,qq,new _T({debounce:0,content:Uq(this,Kq),shouldShow:()=>!1})),Uq(this,qq).update(t),Gq(this,Jq,e.use(WK.key)),Uq(this,Jq).on(Uq(this,nJ))}};Kq=new WeakMap,qq=new WeakMap,Jq=new WeakMap,Yq=new WeakMap,Xq=new WeakMap,Zq=new WeakMap,Qq=new WeakMap,$q=new WeakMap,eJ=new WeakMap,tJ=new WeakMap,nJ=new WeakMap,rJ=new WeakMap,iJ=new WeakMap,aJ=new WeakMap;function sJ(e){let t,n=Dr((n,r)=>{if(!t||!n.hasFocus()||e.get(WK.key).mode===`edit`)return;let i=zq(e,n,r);if(i){let e=n.state.doc.resolve(i.pos),r=Rq(i.mark,i.node,n.state.doc,e.before(),e.after()),a=r.start,o=r.end;t.show(i.mark,a,o,eh(n,a,o));return}t.hide()},50);e.set(JK.key,{props:{handleDOMEvents:{mousemove:n,mouseleave:()=>{setTimeout(()=>{t?.hide()},50)}}},view:n=>(t=new oJ(e,n),t)})}function cJ(e){sJ(e),Lq(e)}var lJ=[WK,GK,KK,JK,YK,qK].flat(),uJ=Object.defineProperty,dJ=Object.getOwnPropertySymbols,fJ=Object.prototype.hasOwnProperty,pJ=Object.prototype.propertyIsEnumerable,mJ=(e,t,n)=>t in e?uJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hJ=(e,t)=>{for(var n in t||={})fJ.call(t,n)&&mJ(e,n,t[n]);if(dJ)for(var n of dJ(t))pJ.call(t,n)&&mJ(e,n,t[n]);return e};function gJ(e,t){return Object.assign(e,{meta:hJ({package:`@milkdown/components`},t)}),e}var _J=xx({renderLabel:({label:e,listType:t,checked:n})=>n==null?t===`bullet`?`⦿`:e:n?`☑`:`□`},`listItemBlockConfigCtx`);gJ(_J,{displayName:`Config<list-item-block>`,group:`ListItemBlock`});function vJ({icon:e,class:t,onClick:n}){return f(`span`,{class:bT(`milkdown-icon`,t),onPointerdown:n,innerHTML:e?gt.sanitize(e.trim()):void 0})}vJ.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var yJ=d({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:e,checked:t,listType:n,config:r,readonly:i,setAttr:a,onMount:o,selected:s}){let c=e=>{e!=null&&e instanceof Element&&o(e)},l=e=>{t.value!=null&&(e.stopPropagation(),e.preventDefault(),a(`checked`,!t.value))},u=w(()=>r.renderLabel({label:e.value,listType:n.value,checked:t.value,readonly:i.value})),d=w(()=>t.value==null?n.value===`bullet`?`bullet`:`ordered`:t.value?`checked`:`unchecked`);return()=>f(`li`,{class:bT(`list-item`,s.value&&`ProseMirror-selectednode`)},f(`div`,{class:`label-wrapper`,onPointerdown:l,contenteditable:!1},f(vJ,{class:bT(`label`,i.value&&`readonly`,d.value),icon:u.value})),f(`div`,{class:`children`,ref:c}))}}),bJ=new WeakMap;function xJ(e,t,n){let r=bJ.get(e);if(!r){let t=new Map;r=t,bJ.set(e,t),requestAnimationFrame(()=>{if(bJ.delete(e),e.isDestroyed)return;let{state:n}=e,r=n.doc.content.size,i;for(let e of t.values())e.anchor<=r&&e.head<=r&&(i=e);if(!i)return;let a=n.doc.resolve(i.anchor),o=n.doc.resolve(i.head),s=N.between(a,o);e.dispatch(n.tr.setSelection(s))})}r.delete(t),r.set(t,n)}var SJ=bx(yD.node,e=>(t,n,r)=>{let i=document.createElement(`div`);i.className=`milkdown-list-item-block`;let a=document.createElement(`div`);a.setAttribute(`data-content-dom`,`true`),a.classList.add(`content-dom`);let o=S(t.attrs.label),s=S(t.attrs.checked),c=S(t.attrs.listType),l=S(!n.editable),u=e.get(_J.key),d=S(!1),f=(e,t)=>{if(!n.editable)return;let i=r();i!=null&&(n.hasFocus()||n.focus(),n.dispatch(n.state.tr.setNodeAttribute(i,e,t)))},p=te(()=>{d.value?i.classList.add(`selected`):i.classList.remove(`selected`)}),m=null,h=re(yJ,{label:o,checked:s,listType:c,readonly:l,config:u,selected:d,setAttr:f,onMount:e=>{if(e===m)return;m=e;let{anchor:t,head:r}=n.state.selection;e.appendChild(a),xJ(n,i,{anchor:t,head:r})}});h.mount(i);let g=e=>{c.value=e.attrs.listType,o.value=e.attrs.label,s.value=e.attrs.checked,l.value=!n.editable};g(t);let _=t;return{dom:i,contentDOM:a,update:e=>e.type===t.type?e.sameMarkup(_)&&e.content.eq(_.content)?!0:(_=e,g(e),!0):!1,ignoreMutation:e=>!i||!a?!0:e.type===`selection`?!1:a===e.target&&e.type===`attributes`||!a.contains(e.target),selectNode:()=>{d.value=!0},deselectNode:()=>{d.value=!1},destroy:()=>{var e;(e=bJ.get(n))==null||e.delete(i),p(),h.unmount(),i.remove(),a.remove()}}});gJ(SJ,{displayName:`NodeView<list-item-block>`,group:`ListItemBlock`});var CJ=[_J,SJ],wJ=Object.defineProperty,TJ=Object.getOwnPropertySymbols,EJ=Object.prototype.hasOwnProperty,DJ=Object.prototype.propertyIsEnumerable,OJ=(e,t,n)=>t in e?wJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kJ=(e,t)=>{for(var n in t||={})EJ.call(t,n)&&OJ(e,n,t[n]);if(TJ)for(var n of TJ(t))DJ.call(t,n)&&OJ(e,n,t[n]);return e};function AJ(e,t){return Object.assign(e,{meta:kJ({package:`@milkdown/components`},t)}),e}var jJ=Object.defineProperty,MJ=Object.getOwnPropertySymbols,NJ=Object.prototype.hasOwnProperty,PJ=Object.prototype.propertyIsEnumerable,FJ=(e,t,n)=>t in e?jJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IJ=xx(((e,t)=>{for(var n in t||={})NJ.call(t,n)&&FJ(e,n,t[n]);if(MJ)for(var n of MJ(t))PJ.call(t,n)&&FJ(e,n,t[n]);return e})({},{renderButton:e=>{switch(e){case`add_row`:return`+`;case`add_col`:return`+`;case`delete_row`:return`-`;case`delete_col`:return`-`;case`align_col_left`:return`left`;case`align_col_center`:return`center`;case`align_col_right`:return`right`;case`col_drag_handle`:return`=`;case`row_drag_handle`:return`=`}}}),`tableBlockConfigCtx`);AJ(IJ,{displayName:`Config<table-block>`,group:`TableBlock`});function LJ({icon:e,class:t,onClick:n}){return f(`span`,{class:bT(`milkdown-icon`,t),onPointerdown:n,innerHTML:e?gt.sanitize(e.trim()):void 0})}LJ.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function RJ(e){let{dragPreviewRef:t,tableWrapperRef:n,contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:a,colHandleRef:o,rowHandleRef:s}=e,c=t.value;if(!c)return;let l=n.value;if(!l)return;let u=r.value;if(!u)return;let d=u.querySelector(`tbody`);if(!d)return;let f=c.querySelector(`tbody`);if(!f)return;let p=i.value;if(!p)return;let m=a.value;if(!m)return;let h=o.value;if(!h)return;let g=s.value;if(g)return{preview:c,wrapper:l,content:u,contentRoot:d,previewRoot:f,yHandle:p,xHandle:m,colHandle:h,rowHandle:g}}function zJ(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function BJ(e,t,n,r,i){let{width:a,height:o}=r.querySelector(`tbody`).getBoundingClientRect();if(e===`y`){let e=r.querySelectorAll(`tr`)[i];if(!e)return;n.appendChild(e.cloneNode(!0));let o=e.getBoundingClientRect().height;Object.assign(t.style,{width:`${a}px`,height:`${o}px`}),t.dataset.show=`true`;return}if(e===`x`){let e=r.querySelectorAll(`tr`),a;Array.from(e).forEach(e=>{let t=e.children[i];if(!t)return;a===void 0&&(a=t.getBoundingClientRect().width);let r=t.parentElement.cloneNode(!1),o=t.cloneNode(!0);r.appendChild(o),n.appendChild(r)}),Object.assign(t.style,{width:`${a}px`,height:`${o}px`}),t.dataset.show=`true`;return}}function VJ(e,t){return n=>{WJ(e,n,t,t=>{UJ(`y`,n,t,e);let{preview:r,content:i,previewRoot:a}=t;zJ(a);let{hoverIndex:o}=e,[s]=o.value;BJ(`y`,r,a,i,s)})}}function HJ(e,t){return n=>{WJ(e,n,t,t=>{UJ(`x`,n,t,e);let{preview:r,content:i,previewRoot:a}=t,{hoverIndex:o}=e,[s,c]=o.value;zJ(a),BJ(`x`,r,a,i,c)})}}function UJ(e,t,n,r){let{xHandle:i,yHandle:a,colHandle:o,rowHandle:s,preview:c}=n;i.dataset.displayType=e===`y`?`indicator`:`none`,a.dataset.displayType=e===`x`?`indicator`:`none`,e===`y`?(o.dataset.show=`false`,GJ(s)):(s.dataset.show=`false`,GJ(o));let{hoverIndex:l,dragInfo:u}=r,[d,f]=l.value;u.value={startCoords:[t.clientX,t.clientY],startIndex:e===`y`?d:f,endIndex:e===`y`?d:f,type:e===`y`?`row`:`col`},c.dataset.direction=e===`y`?`vertical`:`horizontal`}function WJ(e,t,n,r){if(!n?.get(Qy)?.editable)return;t.stopPropagation(),t.dataTransfer&&(t.dataTransfer.effectAllowed=`move`);let i=RJ(e);i&&requestAnimationFrame(()=>{r(i)})}function GJ(e){var t;(t=e.querySelector(`.button-group`))==null||t.setAttribute(`data-show`,`false`)}function KJ(e,t){for(let n=0;n<e.childCount;n++)if(e.child(n)===t)return n;return-1}function qJ(e,t){if(t)try{let n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return;let r=n?.inside;if(r==null||r<0)return;let i=t.state.doc.resolve(r),a=t.state.doc.nodeAt(r);if(!a)return;let o=[`table_cell`,`table_header`],s=[`table_row`,`table_header_row`],c=o.includes(a.type.name)?a:ih(e=>o.includes(e.type.name))(i)?.node,l=ih(e=>s.includes(e.type.name))(i)?.node,u=ih(e=>e.type.name===`table`)(i)?.node;if(!c||!l||!u)return;let d=KJ(l,c);return[KJ(u,l),d]}catch{return}}function JJ(e,[t,n]){let r=e.value;if(!r)return;let i=r.querySelectorAll(`tr`),a=i[t];if(!a)return;let o=i[0];if(!o)return;let s=o.children[n];if(!s)return;let c=a.children[n];if(c)return{row:a,col:c,headerCol:s}}function YJ(e,t,n){if(!n||!t)return;let{selection:r}=t.state;if(!(r instanceof ok))return;let{$from:i}=r,a=yk(i);if(a&&a.node===n){if(r.isColSelection()){let{$head:t}=r;XJ({refs:e,index:[0,t.index(t.depth-1)],before:e=>{var t;(t=e.querySelector(`.button-group`))==null||t.setAttribute(`data-show`,`true`)}});return}if(r.isRowSelection()){let{$head:t}=r,n=ih(e=>e.type.name===`table_row`||e.type.name===`table_header_row`)(t);if(!n)return;let i=KJ(a.node,n.node);ZJ({refs:e,index:[i,0],before:e=>{var t;i>0&&((t=e.querySelector(`.button-group`))==null||t.setAttribute(`data-show`,`true`))}})}}}function XJ({refs:e,index:t,before:n,after:r}){let{contentWrapperRef:i,colHandleRef:a,hoverIndex:o}=e,s=a.value;if(!s)return;o.value=t;let c=JJ(i,t);if(!c)return;let{headerCol:l}=c;s.dataset.show=`true`,n&&n(s),gT(l,s,{placement:`top`}).then(({x:e,y:t})=>{Object.assign(s.style,{left:`${e}px`,top:`${t}px`}),r&&r(s)}).catch(console.error)}function ZJ({refs:e,index:t,before:n,after:r}){let{contentWrapperRef:i,rowHandleRef:a,hoverIndex:o}=e,s=a.value;if(!s)return;o.value=t;let c=JJ(i,t);if(!c)return;let{row:l}=c;s.dataset.show=`true`,n&&n(s),gT(l,s,{placement:`left`}).then(({x:e,y:t})=>{Object.assign(s.style,{left:`${e}px`,top:`${t}px`}),r&&r(s)}).catch(console.error)}function QJ(e,t,n){let r=n===`x`?`left`:`top`,i=n===`x`?`right`:`bottom`,a=e.length-1,o=e.findIndex((e,n)=>{let o=e.getBoundingClientRect(),s=o[r],c=o[i];return s<=t&&t<=c||n===a&&t>c||n===0&&t<s}),s=e[o];return s?[s,o]:void 0}function $J(e,t){let n=e.querySelector(`tr`);if(n)return QJ(Array.from(n.children),t,`x`)}function eY(e,t){return QJ(Array.from(e.querySelectorAll(`tr`)),t,`y`)}function tY(e){return Mr(t=>{let n=RJ(e);if(!n)return;let{preview:r,content:i,contentRoot:a,xHandle:o,yHandle:s}=n,{dragInfo:c,hoverIndex:l}=e;if(r.dataset.show===`false`)return;let u=JJ(e.contentWrapperRef,l.value);if(!u||!a.querySelector(`tr`))return;let d=c.value;if(!d||!a.offsetParent)return;let f=a.offsetParent.offsetTop,p=a.offsetParent.offsetLeft;if(d.type===`col`){let e=u.col.getBoundingClientRect().width,{left:n,width:o}=a.getBoundingClientRect(),c=p-n,l=t.clientX+c-e/2,[m]=d.startCoords,h=m<t.clientX?`right`:`left`;r.style.top=`${f}px`;let g=l<n+c-20?n+c-20:l>n+o+c-e+20?n+o+c-e+20:l;r.style.left=`${g}px`;let _=$J(a,t.clientX);if(_){let[e,t]=_,n=s.getBoundingClientRect().width,r=i.getBoundingClientRect();d.endIndex=t,gT(e,s,{placement:h===`left`?`left`:`right`,middleware:[pT(h===`left`?-1*n:0)]}).then(({x:e})=>{s.dataset.show=`true`,Object.assign(s.style,{height:`${r.height}px`,left:`${e}px`,top:`${f}px`})}).catch(console.error)}}else if(d.type===`row`){let e=u.row.getBoundingClientRect().height,{top:n,height:s}=a.getBoundingClientRect(),c=f-n,l=t.clientY+c-e/2,[m,h]=d.startCoords,g=h<t.clientY?`down`:`up`,_=l<n+c-20?n+c-20:l>n+s+c-e+20?n+s+c-e+20:l;r.style.top=`${_}px`,r.style.left=`${p}px`;let v=eY(a,t.clientY);if(v){let[e,t]=v,n=o.getBoundingClientRect().height,r=i.getBoundingClientRect();d.endIndex=t,gT(e,o,{placement:g===`up`?`top`:`bottom`,middleware:[pT(g===`up`?-1*n:0)]}).then(({y:e})=>{o.dataset.show=`true`,Object.assign(o.style,{width:`${r.width}px`,top:`${e}px`})}).catch(console.error)}}},20)}function nY(e,t,n){let{dragPreviewRef:r,yLineHandleRef:i,xLineHandleRef:o,dragInfo:s}=e,c=VJ(e,t),l=HJ(e,t),u=()=>{let e=r.value;if(!e||e.dataset.show===`false`)return;let t=e?.querySelector(`tbody`);for(;t?.firstChild;)t?.removeChild(t.firstChild);e&&(e.dataset.show=`false`)},d=()=>{let a=r.value;if(!a)return;let c=i.value;if(!c)return;let l=o.value;if(!l)return;let u=s.value;if(!u||!t||a.dataset.show===`false`||!e.colHandleRef.value||!e.rowHandleRef.value||(c.dataset.show=`false`,l.dataset.show=`false`,u.startIndex===u.endIndex))return;let d=t.get(I),f={from:u.startIndex,to:u.endIndex,pos:(n?.()??0)+1};u.type===`col`?(d.call(bN.key,{pos:f.pos,index:u.startIndex}),d.call(vN.key,f),XJ({refs:e,index:[0,u.endIndex]})):(d.call(yN.key,{pos:f.pos,index:u.startIndex}),d.call(_N.key,f),ZJ({refs:e,index:[u.endIndex,0]})),requestAnimationFrame(()=>{t.get(Qy).focus()})},f=tY(e);return v(()=>{window.addEventListener(`dragover`,f),window.addEventListener(`dragend`,u),window.addEventListener(`drop`,d)}),a(()=>{window.removeEventListener(`dragover`,f),window.removeEventListener(`dragend`,u),window.removeEventListener(`drop`,d)}),{dragRow:c,dragCol:l}}function rY(e,t,n){let{xLineHandleRef:r,contentWrapperRef:i,colHandleRef:a,rowHandleRef:o,hoverIndex:s,lineHoverIndex:c}=e;return{onAddRow:()=>{if(!t)return;let e=r.value;if(!e)return;let[a]=c.value;if(a<0||!t.get(Qy).editable)return;let o=Array.from(i.value?.querySelectorAll(`tr`)??[]),s=t.get(I),l=(n?.()??0)+1;o.length===a?(s.call(yN.key,{pos:l,index:a-1}),s.call(EN.key)):(s.call(yN.key,{pos:l,index:a}),s.call(TN.key)),s.call(yN.key,{pos:l,index:a}),e.dataset.show=`false`},onAddCol:()=>{if(!t||!r.value)return;let[e,a]=c.value;if(a<0||!t.get(Qy).editable)return;let o=Array.from(i.value?.querySelector(`tr`)?.children??[]),s=t.get(I),l=(n?.()??0)+1;o.length===a?(s.call(bN.key,{pos:l,index:a-1}),s.call(wN.key)):(s.call(bN.key,{pos:l,index:a}),s.call(CN.key)),s.call(bN.key,{pos:l,index:a})},selectCol:()=>{if(!t)return;let[e,r]=s.value,i=t.get(I),o=(n?.()??0)+1;i.call(bN.key,{pos:o,index:r});let c=a.value?.querySelector(`.button-group`);c&&(c.dataset.show=c.dataset.show===`true`?`false`:`true`)},selectRow:()=>{if(!t)return;let[e,r]=s.value,i=t.get(I),a=(n?.()??0)+1;i.call(yN.key,{pos:a,index:e});let c=o.value?.querySelector(`.button-group`);c&&e>0&&(c.dataset.show=c.dataset.show===`true`?`false`:`true`)},deleteSelected:e=>{t&&t.get(Qy).editable&&(e.preventDefault(),e.stopPropagation(),t.get(I).call(SN.key),requestAnimationFrame(()=>{t.get(Qy).focus()}))},onAlign:e=>n=>{t&&t.get(Qy).editable&&(n.preventDefault(),n.stopPropagation(),t.get(I).call(DN.key,e),requestAnimationFrame(()=>{t.get(Qy).focus()}))}}}function iY(e,t){return Mr(n=>{if(!t?.editable)return;let{contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:a,colHandleRef:o,rowHandleRef:s,hoverIndex:c,lineHoverIndex:l}=e,u=i.value;if(!u)return;let d=a.value;if(!d)return;let f=r.value;if(!f)return;let p=s.value;if(!p)return;let m=o.value;if(!m)return;let h=qJ(n,t);if(!h)return;let g=JJ(r,h);if(!g)return;let[_,v]=h,y=g.col.getBoundingClientRect(),b=Math.abs(n.clientX-y.left)<8,x=Math.abs(y.right-n.clientX)<8,S=Math.abs(n.clientY-y.top)<8,ee=Math.abs(y.bottom-n.clientY)<8,te=b||x||S||ee,C=p.querySelector(`.button-group`),w=m.querySelector(`.button-group`);if(C&&(C.dataset.show=`false`),w&&(w.dataset.show=`false`),te){let e=f.getBoundingClientRect();p.dataset.show=`false`,m.dataset.show=`false`,d.dataset.displayType=`tool`,u.dataset.displayType=`tool`;let t=u.getBoundingClientRect().width,n=d.getBoundingClientRect().height;b||x?(l.value[1]=b?v:v+1,gT(g.col,u,{placement:b?`left`:`right`,middleware:[pT(b?-1*t:0)]}).then(({x:t})=>{u.dataset.show=`true`,Object.assign(u.style,{height:`${e.height}px`,left:`${t}px`})}).catch(console.error)):u.dataset.show=`false`,h[0]!==0&&(S||ee)?(l.value[0]=S?_:_+1,gT(g.row,d,{placement:S?`top`:`bottom`,middleware:[pT(S?-1*n:0)]}).then(({y:t})=>{d.dataset.show=`true`,Object.assign(d.style,{width:`${e.width}px`,top:`${t}px`})}).catch(console.error)):d.dataset.show=`false`;return}l.value=[-1,-1],u.dataset.show=`false`,d.dataset.show=`false`,p.dataset.show=`true`,m.dataset.show=`true`,ZJ({refs:e,index:h}),XJ({refs:e,index:h}),c.value=h},20)}function aY(e){return()=>{let{rowHandleRef:t,colHandleRef:n,yLineHandleRef:r,xLineHandleRef:i}=e;setTimeout(()=>{let e=t.value;if(!e)return;let a=n.value;if(!a)return;let o=r.value;if(!o)return;let s=i.value;s&&(e.dataset.show=`false`,a.dataset.show=`false`,o.dataset.show=`false`,s.dataset.show=`false`)},200)}}function oY(e,t){return{pointerMove:iY(e,t),pointerLeave:aY(e)}}var sY=d({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:e,node:t,ctx:n,getPos:r,config:i,onMount:a}){let o=S(),s=e=>{e!=null&&(e instanceof HTMLElement?(o.value=e,a(e)):o.value=void 0)},c=S(),l=S(),u=S(),d=S(),p=S(),m=S(),h={dragPreviewRef:m,tableWrapperRef:p,contentWrapperRef:o,yLineHandleRef:d,xLineHandleRef:u,colHandleRef:c,rowHandleRef:l,hoverIndex:S([0,0]),lineHoverIndex:S([-1,-1]),dragInfo:S()},{pointerLeave:g,pointerMove:_}=oY(h,e),{dragRow:y,dragCol:b}=nY(h,n,r),{onAddRow:x,onAddCol:ee,selectCol:te,selectRow:C,deleteSelected:w,onAlign:ne}=rY(h,n,r);return v(()=>{requestAnimationFrame(()=>{e.editable&&YJ(h,e,t.value)})}),()=>f(`div`,{onDragstart:e=>e.preventDefault(),onDragover:e=>e.preventDefault(),onDragleave:e=>e.preventDefault(),onPointermove:_,onPointerleave:g},f(`div`,{"data-show":`false`,contenteditable:`false`,draggable:`true`,"data-role":`col-drag-handle`,class:`handle cell-handle`,onDragstart:b,onClick:te,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:c},f(LJ,{icon:i.renderButton(`col_drag_handle`)}),f(`div`,{"data-show":`false`,class:`button-group`,onPointermove:e=>e.stopPropagation()},f(`button`,{type:`button`,onPointerdown:ne(`left`)},f(LJ,{icon:i.renderButton(`align_col_left`)})),f(`button`,{type:`button`,onPointerdown:ne(`center`)},f(LJ,{icon:i.renderButton(`align_col_center`)})),f(`button`,{type:`button`,onPointerdown:ne(`right`)},f(LJ,{icon:i.renderButton(`align_col_right`)})),f(`button`,{type:`button`,onPointerdown:w},f(LJ,{icon:i.renderButton(`delete_col`)})))),f(`div`,{"data-show":`false`,contenteditable:`false`,draggable:`true`,"data-role":`row-drag-handle`,class:`handle cell-handle`,onDragstart:y,onClick:C,onPointerdown:e=>e.stopPropagation(),onPointermove:e=>e.stopPropagation(),ref:l},f(LJ,{icon:i.renderButton(`row_drag_handle`)}),f(`div`,{"data-show":`false`,class:`button-group`,onPointermove:e=>e.stopPropagation()},f(`button`,{type:`button`,onPointerdown:w},f(LJ,{icon:i.renderButton(`delete_row`)})))),f(`div`,{class:`table-wrapper`,ref:p},f(`div`,{"data-show":`false`,class:`drag-preview`,"data-direction":`vertical`,ref:m},f(`table`,null,f(`tbody`,null))),f(`div`,{"data-show":`false`,contenteditable:`false`,"data-display-type":`tool`,"data-role":`x-line-drag-handle`,class:`handle line-handle`,onPointermove:e=>e.stopPropagation(),ref:u},f(`button`,{type:`button`,onClick:x,class:`add-button`},f(LJ,{icon:i.renderButton(`add_row`)}))),f(`div`,{"data-show":`false`,contenteditable:`false`,"data-display-type":`tool`,"data-role":`y-line-drag-handle`,class:`handle line-handle`,onPointermove:e=>e.stopPropagation(),ref:d},f(`button`,{type:`button`,onClick:ee,class:`add-button`},f(LJ,{icon:i.renderButton(`add_col`)}))),f(`table`,{ref:s,class:`children`})))}}),cY=e=>{throw TypeError(e)},lY=(e,t,n)=>t.has(e)||cY(`Cannot `+n),uY=(e,t,n)=>t.has(e)?cY(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),dY=(e,t,n)=>(lY(e,t,`access private method`),n),fY,pY,mY=class{constructor(e,t,n,r){this.ctx=e,this.node=t,this.view=n,this.getPos=r,uY(this,fY);let i=document.createElement(`div`);i.className=`milkdown-table-block`;let a=document.createElement(`tbody`);this.contentDOM=a,a.setAttribute(`data-content-dom`,`true`),a.classList.add(`content-dom`),this.nodeRef=m(t);let o=re(sY,{view:n,ctx:e,getPos:r,config:e.get(IJ.key),onMount:e=>{e.appendChild(a)},node:this.nodeRef});o.mount(i),this.app=o,this.dom=i}update(e){return e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content)?!1:(this.node=e,this.nodeRef.value=e,!0)}stopEvent(e){if(e.type===`drop`||e.type.startsWith(`drag`))return!0;if(e.type===`mousedown`||e.type===`pointerdown`){if(e.target instanceof Element&&e.target.closest(`button`))return!0;let t=e.target;if(t instanceof HTMLElement&&(t.closest(`th`)||t.closest(`td`))){let t=e;return dY(this,fY,pY).call(this,t)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:e.type===`selection`?!1:this.contentDOM===e.target&&e.type===`attributes`||!this.contentDOM.contains(e.target)}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}};fY=new WeakSet,pY=function(e){let t=this.view;if(!t.editable)return!1;let{state:n,dispatch:r}=t,i=t.posAtCoords({left:e.clientX,top:e.clientY});if(!i)return!1;let a=n.doc.resolve(i.inside),o=ih(e=>e.type.name===`table_cell`||e.type.name===`table_header`)(a);if(!o||n.selection instanceof N&&ih(e=>e.type.name===`table_cell`||e.type.name===`table_header`)(n.selection.$from)?.node===o.node)return!1;let{from:s}=o,c=P.create(n.doc,s+1);return!n.selection.eq(c)&&(n.selection instanceof ok?setTimeout(()=>{r(n.tr.setSelection(c).scrollIntoView())},20):requestAnimationFrame(()=>{r(n.tr.setSelection(c).scrollIntoView())}),!0)};var hY=bx(tN.node,e=>(t,n,r)=>new mY(e,t,n,r));AJ(hY,{displayName:`NodeView<table-block>`,group:`TableBlock`});var gY=[IJ,hY];function _Y(e){if(!e)return!1;if(Array.isArray(e))return e.length>1?!1:_Y(e[0]);let t=e.content;return t?_Y(t):e.type===`text`}function vY(e,t){return Object.assign(e,{meta:{package:`@milkdown/plugin-clipboard`,...t}}),e}function yY(e,t){let n=rh(t);if(n)return e.dispatch(e.state.tr.replaceSelectionWith(n,!0)),!0;try{return e.dispatch(e.state.tr.replaceSelection(t)),!0}catch{return!1}}var bY=vx(e=>{let t=e.get(hb);return e.update(ex,e=>({...e,editable:e.editable??(()=>!0),transformPastedHTML:(t,n)=>{let r=e.transformPastedHTML;return r&&(t=r(t,n)),t.includes(`docs-internal-guid`)&&(t=t.replace(/<b[^>]*id="docs-internal-guid[^"]*"[^>]*>([\s\S]*)<\/b>/,`$1`),t=t.replace(/<div[^>]*>(<table[\s\S]*?<\/table>)<\/div>/g,`$1`)),t}})),new Tp({key:new Op(`MILKDOWN_CLIPBOARD`),props:{handlePaste:(n,r,i)=>{let a=e.get(Nb),o=n.props.editable?.(n.state),{clipboardData:s}=r;if(!o||!s||n.state.selection.$from.node().type.spec.code)return!1;let c=s.getData(`text/plain`),l=s.getData(`vscode-editor-data`);if(l){let e=JSON.parse(l)?.mode;if(c&&e){let{tr:r}=n.state,i=oh(`code_block`,t);return r.replaceSelectionWith(i.create({language:e})).setSelection(N.near(r.doc.resolve(Math.max(0,r.selection.from-2)))).insertText(c.replace(/\r\n?/g,`
320
- `)),n.dispatch(r),!0}}let u=s.getData(`text/html`);if(u.length===0&&c.length===0)return!1;if(u.length>0&&i)return yY(n,i);let d=Cd.fromSchema(t),f;if(u.length===0){let e=a(c);if(!e||typeof e==`string`)return!1;f=Ld.fromSchema(t).serializeFragment(e.content)}else{let e=document.createElement(`template`);e.innerHTML=u,f=e.content.cloneNode(!0),e.remove()}return yY(n,d.parseSlice(f))},clipboardTextSerializer:n=>{let r=e.get(zb);if(_Y(n.content.toJSON()))return n.content.textBetween(0,n.content.size,`
321
-
322
- `);let i=t.topNodeType.createAndFill(void 0,n.content);return i?r(i):``}}})});vY(bY,{displayName:`Prose<clipboard>`});function xY(e,t){return Object.assign(e,{meta:{package:`@milkdown/plugin-history`,...t}}),e}var SY=L(`Undo`,()=>()=>WI);xY(SY,{displayName:`Command<undo>`});var CY=L(`Redo`,()=>()=>GI);xY(CY,{displayName:`Command<redo>`});var wY=xx({},`historyProviderConfig`);xY(wY,{displayName:`Ctx<historyProviderConfig>`});var TY=vx(e=>HI(e.get(wY.key)));xY(TY,{displayName:`Ctx<historyProviderPlugin>`});var EY=wx(`historyKeymap`,{Undo:{shortcuts:`Mod-z`,command:e=>{let t=e.get(I);return()=>t.call(SY.key)}},Redo:{shortcuts:[`Mod-y`,`Shift-Mod-z`],command:e=>{let t=e.get(I);return()=>t.call(CY.key)}}});xY(EY.ctx,{displayName:`KeymapCtx<history>`}),xY(EY.shortcuts,{displayName:`Keymap<history>`});var DY=[wY,TY,EY,SY,CY].flat();function OY(e,t){let{doc:n,selection:r}=e;if(!n||!r||!(r instanceof N||r instanceof dp))return e;let{to:i}=r,a=t.type===`space`?Array(t.size).fill(` `).join(``):` `;return e.insertText(a,i)}var kY=xx({type:`space`,size:2},`indentConfig`);kY.meta={package:`@milkdown/plugin-indent`,displayName:`Ctx<indentConfig>`};var AY=yx(e=>({Tab:(t,n)=>{let r=e.get(kY.key),{tr:i}=t,a=OY(i,r);return a.docChanged?(n?.(a),!0):!1}}));AY.meta={package:`@milkdown/plugin-indent`,displayName:`Shortcut<indent>`};var jY=[kY,AY],MY=class{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}},NY=Ci(new MY,`listener`),PY=new Op(`MILKDOWN_LISTENER`),FY=e=>(e.inject(NY,new MY),async()=>{await e.wait(db);let{listeners:t}=e.get(NY);t.beforeMount.forEach(t=>t(e)),await e.wait(Ib);let n=e.get(zb),r=null,i=null,a=null,o=null,s=Dr(()=>{if(!o)return;let{doc:a}=o;if(t.updated.length>0&&r&&!r.eq(a)&&t.updated.forEach(t=>{t(e,a,r)}),t.markdownUpdated.length>0&&r&&!r.eq(a)){let r=n(a);t.markdownUpdated.forEach(t=>{t(e,r,i)}),i=r}r=a,o=null},200),c=new Tp({key:PY,view:()=>({destroy:()=>{s.cancel(),t.destroy.forEach(t=>t(e))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(t=>t(e)),!1),blur:()=>(t.blur.forEach(t=>t(e)),!1)}},state:{init:(e,t)=>{r=t.doc,i=n(t.doc)},apply:n=>{let r=n.selection;(!a&&r||a&&!r.eq(a))&&(t.selectionUpdated.forEach(t=>{t(e,r,a)}),a=r),(n.docChanged||n.storedMarksSet)&&n.getMeta(`addToHistory`)!==!1&&(o=n,s())}}});e.update(rb,e=>e.concat(c)),await e.wait(Qb),t.mounted.forEach(t=>t(e))});FY.meta={package:`@milkdown/plugin-listener`,displayName:`Listener`};var IY=xx({shouldAppend:e=>!(!e||[`heading`,`paragraph`].includes(e.type.name)),getNode:e=>e.schema.nodes.paragraph.create()},`trailingConfig`);IY.meta={package:`@milkdown/plugin-trailing`,displayName:`Ctx<trailingConfig>`};var LY=vx(e=>{let t=new Op(`MILKDOWN_TRAILING`),{shouldAppend:n,getNode:r}=e.get(IY.key),i=new Tp({key:t,state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return n(r,t)},apply:(e,t,r,i)=>{if(!e.docChanged)return t;let a=e.doc.lastChild;return n(a,i)}},appendTransaction:(e,t,n)=>{let{doc:a,tr:o}=n,s=r?.(n),c=i.getState(n),l=a.content.size;if(c&&s)return o.insert(l,s)}});return i});LY.meta={package:`@milkdown/plugin-trailing`,displayName:`Prose<trailing>`};var RY=[IY,LY];function zY(e){return new Promise(t=>{let n=new FileReader;n.addEventListener(`load`,()=>{t({alt:e.name,src:n.result})},!1),n.readAsDataURL(e)})}var BY=xx({uploader:async(e,t)=>{let n=[];for(let t=0;t<e.length;t++){let r=e.item(t);r&&r.type.includes(`image`)&&n.push(r)}let{image:r}=t.nodes;if(!r)throw hi(`image`);return(await Promise.all(n.map(e=>zY(e)))).map(({alt:e,src:t})=>r.createAndFill({src:t,alt:e}))},enableHtmlFileUploader:!1,uploadWidgetFactory:(e,t)=>{let n=document.createElement(`span`);return n.textContent=`Upload in progress...`,ay.widget(e,n,t)}},`uploadConfig`);BY.meta={package:`@milkdown/plugin-upload`,displayName:`Ctx<uploadConfig>`};var VY=vx(e=>{let t=new Op(`MILKDOWN_UPLOAD`),n=(e,n)=>{let r=t.getState(e);if(!r)return-1;let i=r.find(void 0,void 0,e=>e.id===n);return i.length?i[0]?.from??-1:-1},r=(r,i,a)=>{if(!a||a.length<=0)return!1;let o=Symbol(`upload symbol`),s=e.get(hb),{uploader:c,getInsertPos:l}=e.get(BY.key),{tr:u}=r.state,d=i instanceof DragEvent?r.posAtCoords({left:i.clientX,top:i.clientY})?.pos??u.selection.from:u.selection.from,f=typeof l==`function`?l(i,e,d):d;return r.dispatch(u.setMeta(t,{add:{id:o,pos:f}})),c(a,s,e,f).then(e=>{let i=n(r.state,o);i<0||r.dispatch(r.state.tr.replaceWith(i,i,e).setMeta(t,{remove:{id:o}}))}).catch(e=>{console.error(e)}),!0};return new Tp({key:t,state:{init(){return cy.empty},apply(t,n){let r=n.map(t.mapping,t.doc),i=t.getMeta(this);if(!i)return r;if(i.add){let{uploadWidgetFactory:n}=e.get(BY.key),a=n(i.add.pos,{id:i.add.id});return r.add(t.doc,[a])}if(i.remove){let e=r.find(void 0,void 0,e=>e.id===i.remove.id);return r.remove(e)}return r}},props:{decorations(e){return this.getState(e)},handlePaste:(t,n)=>{let{enableHtmlFileUploader:i}=e.get(BY.key);return!(n instanceof ClipboardEvent)||!i&&n.clipboardData?.getData(`text/html`)?!1:r(t,n,n.clipboardData?.files)},handleDrop:(e,t)=>t instanceof DragEvent&&r(e,t,t.dataTransfer?.files)}})});VY.meta={package:`@milkdown/plugin-upload`,displayName:`Prose<upload>`};var HY=[BY,VY],UY=(e=>(e.CodeMirror=`code-mirror`,e.ListItem=`list-item`,e.LinkTooltip=`link-tooltip`,e.Cursor=`cursor`,e.ImageBlock=`image-block`,e.BlockEdit=`block-edit`,e.Toolbar=`toolbar`,e.Placeholder=`placeholder`,e.Table=`table`,e.Latex=`latex`,e.TopBar=`top-bar`,e.AI=`ai`,e))(UY||{}),WY={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0,"top-bar":!1,ai:!1},GY=`
323
- <svg
324
- xmlns="http://www.w3.org/2000/svg"
325
- width="24"
326
- height="24"
327
- viewBox="0 0 24 24"
328
- >
329
- <path
330
- fill="currentColor"
331
- d="M19 9l1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm0 14l1.25-2.75L23 19l-2.75-1.25L19 15l-1.25 2.75L15 19l2.75 1.25zM9 20l3-6.5L18 10l-6-3.5L9 0L6 6.5L0 10l6 3.5z"
332
- transform="translate(3 3) scale(0.75)"
333
- />
334
- </svg>
335
- `,KY=`
336
- <svg
337
- xmlns="http://www.w3.org/2000/svg"
338
- width="24"
339
- height="24"
340
- viewBox="0 0 24 24"
341
- >
342
- <path
343
- d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM8.25 16.625C8.0375 16.625 7.85942 16.5531 7.71575 16.4093C7.57192 16.2654 7.5 16.0872 7.5 15.8748C7.5 15.6621 7.57192 15.484 7.71575 15.3405C7.85942 15.1968 8.0375 15.125 8.25 15.125H15.75C15.9625 15.125 16.1406 15.1969 16.2843 15.3408C16.4281 15.4846 16.5 15.6628 16.5 15.8753C16.5 16.0879 16.4281 16.266 16.2843 16.4095C16.1406 16.5532 15.9625 16.625 15.75 16.625H8.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM8.25 8.875C8.0375 8.875 7.85942 8.80308 7.71575 8.65925C7.57192 8.51542 7.5 8.33725 7.5 8.12475C7.5 7.91208 7.57192 7.734 7.71575 7.5905C7.85942 7.44683 8.0375 7.375 8.25 7.375H15.75C15.9625 7.375 16.1406 7.44692 16.2843 7.59075C16.4281 7.73458 16.5 7.91275 16.5 8.12525C16.5 8.33792 16.4281 8.516 16.2843 8.6595C16.1406 8.80317 15.9625 8.875 15.75 8.875H8.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
344
- />
345
- </svg>
346
- `,qY=`
347
- <svg
348
- xmlns="http://www.w3.org/2000/svg"
349
- width="24"
350
- height="24"
351
- viewBox="0 0 24 24"
352
- >
353
- <path
354
- d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM4.25 16.625C4.0375 16.625 3.85942 16.5531 3.71575 16.4093C3.57192 16.2654 3.5 16.0872 3.5 15.8748C3.5 15.6621 3.57192 15.484 3.71575 15.3405C3.85942 15.1968 4.0375 15.125 4.25 15.125H13.75C13.9625 15.125 14.1406 15.1969 14.2843 15.3408C14.4281 15.4846 14.5 15.6628 14.5 15.8753C14.5 16.0879 14.4281 16.266 14.2843 16.4095C14.1406 16.5532 13.9625 16.625 13.75 16.625H4.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM4.25 8.875C4.0375 8.875 3.85942 8.80308 3.71575 8.65925C3.57192 8.51542 3.5 8.33725 3.5 8.12475C3.5 7.91208 3.57192 7.734 3.71575 7.5905C3.85942 7.44683 4.0375 7.375 4.25 7.375H13.75C13.9625 7.375 14.1406 7.44692 14.2843 7.59075C14.4281 7.73458 14.5 7.91275 14.5 8.12525C14.5 8.33792 14.4281 8.516 14.2843 8.6595C14.1406 8.80317 13.9625 8.875 13.75 8.875H4.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
355
- />
356
- </svg>
357
- `,JY=`
358
- <svg
359
- xmlns="http://www.w3.org/2000/svg"
360
- width="24"
361
- height="24"
362
- viewBox="0 0 24 24"
363
- >
364
- <path
365
- d="M4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25ZM10.25 8.875C10.0375 8.875 9.85942 8.80308 9.71575 8.65925C9.57192 8.51542 9.5 8.33725 9.5 8.12475C9.5 7.91208 9.57192 7.734 9.71575 7.5905C9.85942 7.44683 10.0375 7.375 10.25 7.375H19.75C19.9625 7.375 20.1406 7.44692 20.2843 7.59075C20.4281 7.73458 20.5 7.91275 20.5 8.12525C20.5 8.33792 20.4281 8.516 20.2843 8.6595C20.1406 8.80317 19.9625 8.875 19.75 8.875H10.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM10.25 16.625C10.0375 16.625 9.85942 16.5531 9.71575 16.4093C9.57192 16.2654 9.5 16.0872 9.5 15.8748C9.5 15.6621 9.57192 15.484 9.71575 15.3405C9.85942 15.1968 10.0375 15.125 10.25 15.125H19.75C19.9625 15.125 20.1406 15.1969 20.2843 15.3408C20.4281 15.4846 20.5 15.6628 20.5 15.8753C20.5 16.0879 20.4281 16.266 20.2843 16.4095C20.1406 16.5532 19.9625 16.625 19.75 16.625H10.25ZM4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25Z"
366
- />
367
- </svg>
368
- `,YY=`
369
- <svg
370
- xmlns="http://www.w3.org/2000/svg"
371
- width="24"
372
- height="24"
373
- viewBox="0 0 24 24"
374
- >
375
- <path
376
- d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z"
377
- />
378
- </svg>
379
- `,XY=`
380
- <svg
381
- xmlns="http://www.w3.org/2000/svg"
382
- width="24"
383
- height="24"
384
- viewBox="0 0 24 24"
385
- >
386
- <g clip-path="url(#clip0_952_6527)">
387
- <circle cx="12" cy="12" r="3" />
388
- </g>
389
- <defs>
390
- <clipPath id="clip0_952_6527">
391
- <rect width="24" height="24" />
392
- </clipPath>
393
- </defs>
394
- </svg>
395
- `,ZY=`
396
- <svg
397
- xmlns="http://www.w3.org/2000/svg"
398
- width="24"
399
- height="24"
400
- viewBox="0 0 24 24"
401
- >
402
- <g clip-path="url(#clip0_977_8070)">
403
- <path
404
- d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z"
405
- />
406
- </g>
407
- <defs>
408
- <clipPath id="clip0_977_8070">
409
- <rect width="24" height="24" />
410
- </clipPath>
411
- </defs>
412
- </svg>
413
- `,QY=`
414
- <svg
415
- xmlns="http://www.w3.org/2000/svg"
416
- width="32"
417
- height="32"
418
- viewBox="0 0 24 24"
419
- >
420
- <path
421
- fill="currentColor"
422
- d="M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12z"
423
- />
424
- </svg>
425
- `,$Y=`
426
- <svg
427
- xmlns="http://www.w3.org/2000/svg"
428
- width="24"
429
- height="24"
430
- viewBox="0 0 24 24"
431
- >
432
- <g clip-path="url(#clip0_1803_1151)">
433
- <path
434
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM10.71 16.29C10.32 16.68 9.69 16.68 9.3 16.29L5.71 12.7C5.32 12.31 5.32 11.68 5.71 11.29C6.1 10.9 6.73 10.9 7.12 11.29L10 14.17L16.88 7.29C17.27 6.9 17.9 6.9 18.29 7.29C18.68 7.68 18.68 8.31 18.29 8.7L10.71 16.29Z"
435
- />
436
- </g>
437
- <defs>
438
- <clipPath id="clip0_1803_1151">
439
- <rect width="24" height="24" />
440
- </clipPath>
441
- </defs>
442
- </svg>
443
- `,eX=`
444
- <svg
445
- xmlns="http://www.w3.org/2000/svg"
446
- width="24"
447
- height="24"
448
- viewBox="0 0 24 24"
449
- >
450
- <g clip-path="url(#clip0_1803_535)">
451
- <path
452
- d="M18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3Z"
453
- />
454
- </g>
455
- <defs>
456
- <clipPath id="clip0_1803_535">
457
- <rect width="24" height="24" />
458
- </clipPath>
459
- </defs>
460
- </svg>
461
- `,tX=`
462
- <svg
463
- xmlns="http://www.w3.org/2000/svg"
464
- fill="none"
465
- viewBox="0 0 24 24"
466
- stroke-width="1.5"
467
- stroke="currentColor"
468
- class="w-6 h-6"
469
- >
470
- <path
471
- stroke-linecap="round"
472
- stroke-linejoin="round"
473
- d="M19.5 8.25l-7.5 7.5-7.5-7.5"
474
- />
475
- </svg>
476
- `,nX=`
477
- <svg
478
- xmlns="http://www.w3.org/2000/svg"
479
- fill="none"
480
- viewBox="0 0 24 24"
481
- stroke-width="1.5"
482
- stroke="currentColor"
483
- >
484
- <path
485
- stroke-linecap="round"
486
- stroke-linejoin="round"
487
- d="M15.75 19.5L8.25 12l7.5-7.5"
488
- />
489
- </svg>
490
- `,rX=`
491
- <svg
492
- xmlns="http://www.w3.org/2000/svg"
493
- fill="none"
494
- viewBox="0 0 24 24"
495
- stroke-width="1.5"
496
- stroke="currentColor"
497
- >
498
- <path
499
- stroke-linecap="round"
500
- stroke-linejoin="round"
501
- d="M8.25 4.5l7.5 7.5-7.5 7.5"
502
- />
503
- </svg>
504
- `,iX=`
505
- <svg
506
- xmlns="http://www.w3.org/2000/svg"
507
- width="24"
508
- height="24"
509
- viewBox="0 0 24 24"
510
- >
511
- <g clip-path="url(#clip0_1098_15553)">
512
- <path
513
- d="M18.3007 5.70973C17.9107 5.31973 17.2807 5.31973 16.8907 5.70973L12.0007 10.5897L7.1107 5.69973C6.7207 5.30973 6.0907 5.30973 5.7007 5.69973C5.3107 6.08973 5.3107 6.71973 5.7007 7.10973L10.5907 11.9997L5.7007 16.8897C5.3107 17.2797 5.3107 17.9097 5.7007 18.2997C6.0907 18.6897 6.7207 18.6897 7.1107 18.2997L12.0007 13.4097L16.8907 18.2997C17.2807 18.6897 17.9107 18.6897 18.3007 18.2997C18.6907 17.9097 18.6907 17.2797 18.3007 16.8897L13.4107 11.9997L18.3007 7.10973C18.6807 6.72973 18.6807 6.08973 18.3007 5.70973Z"
514
- />
515
- </g>
516
- <defs>
517
- <clipPath id="clip0_1098_15553">
518
- <rect width="24" height="24" />
519
- </clipPath>
520
- </defs>
521
- </svg>
522
- `,aX=`
523
- <svg
524
- xmlns="http://www.w3.org/2000/svg"
525
- width="24"
526
- height="24"
527
- viewBox="0 0 24 24"
528
- >
529
- <g clip-path="url(#clip0_977_8081)">
530
- <path
531
- d="M9.4 16.6L4.8 12L9.4 7.4L8 6L2 12L8 18L9.4 16.6ZM14.6 16.6L19.2 12L14.6 7.4L16 6L22 12L16 18L14.6 16.6Z"
532
- />
533
- </g>
534
- <defs>
535
- <clipPath id="clip0_977_8081">
536
- <rect width="24" height="24" />
537
- </clipPath>
538
- </defs>
539
- </svg>
540
- `,oX=`
541
- <svg
542
- xmlns="http://www.w3.org/2000/svg"
543
- width="24"
544
- height="24"
545
- viewBox="0 0 24 24"
546
- >
547
- <path
548
- d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm1 2v14h16V5H4zm8 10h6v2h-6v-2zm-3.333-3L5.838 9.172l1.415-1.415L11.495 12l-4.242 4.243-1.415-1.415L8.667 12z"
549
- />
550
- </svg>
551
- `,sX=`
552
- <svg
553
- xmlns="http://www.w3.org/2000/svg"
554
- width="24"
555
- height="24"
556
- viewBox="0 0 24 24"
557
- fill="none"
558
- >
559
- <g clip-path="url(#clip0_1013_1606)">
560
- <path
561
- d="M9.00012 16.1998L5.50012 12.6998C5.11012 12.3098 4.49012 12.3098 4.10012 12.6998C3.71012 13.0898 3.71012 13.7098 4.10012 14.0998L8.29012 18.2898C8.68012 18.6798 9.31012 18.6798 9.70012 18.2898L20.3001 7.69982C20.6901 7.30982 20.6901 6.68982 20.3001 6.29982C19.9101 5.90982 19.2901 5.90982 18.9001 6.29982L9.00012 16.1998Z"
562
- fill="#817567"
563
- />
564
- </g>
565
- <defs>
566
- <clipPath id="clip0_1013_1606">
567
- <rect width="24" height="24" />
568
- </clipPath>
569
- </defs>
570
- </svg>
571
- `,cX=`
572
- <svg
573
- xmlns="http://www.w3.org/2000/svg"
574
- height="24px"
575
- viewBox="0 -960 960 960"
576
- width="24px"
577
- fill="none"
578
- >
579
- <path
580
- d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"
581
- />
582
- </svg>
583
- `,lX=`
584
- <svg
585
- xmlns="http://www.w3.org/2000/svg"
586
- width="24"
587
- height="24"
588
- viewBox="0 0 24 24"
589
- >
590
- <g clip-path="url(#clip0_977_7900)">
591
- <path
592
- fill-rule="evenodd"
593
- clip-rule="evenodd"
594
- d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z"
595
- />
596
- </g>
597
- <defs>
598
- <clipPath id="clip0_977_7900">
599
- <rect width="24" height="24" />
600
- </clipPath>
601
- </defs>
602
- </svg>
603
- `,uX=`
604
- <svg
605
- xmlns="http://www.w3.org/2000/svg"
606
- width="16"
607
- height="16"
608
- viewBox="0 0 16 16"
609
- >
610
- <path
611
- d="M3.5 9.83366C3.35833 9.83366 3.23961 9.78571 3.14383 9.68983C3.04794 9.59394 3 9.47516 3 9.33349C3 9.19171 3.04794 9.07299 3.14383 8.97733C3.23961 8.88155 3.35833 8.83366 3.5 8.83366H12.5C12.6417 8.83366 12.7604 8.8816 12.8562 8.97749C12.9521 9.07338 13 9.19216 13 9.33383C13 9.4756 12.9521 9.59433 12.8562 9.68999C12.7604 9.78577 12.6417 9.83366 12.5 9.83366H3.5ZM3.5 7.16699C3.35833 7.16699 3.23961 7.11905 3.14383 7.02316C3.04794 6.92727 3 6.80849 3 6.66683C3 6.52505 3.04794 6.40633 3.14383 6.31066C3.23961 6.21488 3.35833 6.16699 3.5 6.16699H12.5C12.6417 6.16699 12.7604 6.21494 12.8562 6.31083C12.9521 6.40671 13 6.52549 13 6.66716C13 6.80894 12.9521 6.92766 12.8562 7.02333C12.7604 7.1191 12.6417 7.16699 12.5 7.16699H3.5Z"
612
- />
613
- </svg>
614
- `,dX=`
615
- <svg
616
- xmlns="http://www.w3.org/2000/svg"
617
- width="24"
618
- height="24"
619
- viewBox="0 0 24 24"
620
- >
621
- <g clip-path="url(#clip0_1013_1585)">
622
- <path
623
- d="M14.06 9.02L14.98 9.94L5.92 19H5V18.08L14.06 9.02ZM17.66 3C17.41 3 17.15 3.1 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C18.17 3.09 17.92 3 17.66 3ZM14.06 6.19L3 17.25V21H6.75L17.81 9.94L14.06 6.19Z"
624
- />
625
- </g>
626
- <defs>
627
- <clipPath id="clip0_1013_1585">
628
- <rect width="24" height="24" />
629
- </clipPath>
630
- </defs>
631
- </svg>
632
- `,fX=`
633
- <svg
634
- xmlns="http://www.w3.org/2000/svg"
635
- width="24"
636
- height="24"
637
- viewBox="0 0 24 24"
638
- >
639
- <path
640
- fill="currentColor"
641
- d="M9 16l-5-5l5-5l1.4 1.4L7.825 10H18V6h2v6H7.825l2.575 2.6z"
642
- />
643
- </svg>
644
- `,pX=`
645
- <svg
646
- xmlns="http://www.w3.org/2000/svg"
647
- width="24"
648
- height="24"
649
- viewBox="0 0 24 24"
650
- >
651
- <path
652
- fill="currentColor"
653
- d="M9.55 17.575L4.225 12.25l1.4-1.425L9.55 14.75l8.825-8.825l1.4 1.425z"
654
- />
655
- </svg>
656
- `,mX=`
657
- <svg
658
- xmlns="http://www.w3.org/2000/svg"
659
- width="24"
660
- height="24"
661
- viewBox="0 0 24 24"
662
- >
663
- <g clip-path="url(#clip0_992_5553)">
664
- <path
665
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z"
666
- />
667
- </g>
668
- <defs>
669
- <clipPath id="clip0_992_5553">
670
- <rect width="24" height="24" />
671
- </clipPath>
672
- </defs>
673
- </svg>
674
- `,hX=`
675
- <svg
676
- xmlns="http://www.w3.org/2000/svg"
677
- width="24"
678
- height="24"
679
- viewBox="0 0 24 24"
680
- >
681
- <g clip-path="url(#clip0_992_5559)">
682
- <path
683
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z"
684
- />
685
- </g>
686
- <defs>
687
- <clipPath id="clip0_992_5559">
688
- <rect width="24" height="24" />
689
- </clipPath>
690
- </defs>
691
- </svg>
692
- `,gX=`
693
- <svg
694
- xmlns="http://www.w3.org/2000/svg"
695
- width="24"
696
- height="24"
697
- viewBox="0 0 24 24"
698
- >
699
- <g clip-path="url(#clip0_992_5565)">
700
- <path
701
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
702
- />
703
- </g>
704
- <defs>
705
- <clipPath id="clip0_992_5565">
706
- <rect width="24" height="24" />
707
- </clipPath>
708
- </defs>
709
- </svg>
710
- `,_X=`
711
- <svg
712
- xmlns="http://www.w3.org/2000/svg"
713
- width="24"
714
- height="24"
715
- viewBox="0 0 24 24"
716
- >
717
- <g clip-path="url(#clip0_977_7757)">
718
- <path
719
- d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z"
720
- />
721
- </g>
722
- <defs>
723
- <clipPath id="clip0_977_7757">
724
- <rect width="24" height="24" />
725
- </clipPath>
726
- </defs>
727
- </svg>
728
- `,vX=`
729
- <svg
730
- xmlns="http://www.w3.org/2000/svg"
731
- width="24"
732
- height="24"
733
- viewBox="0 0 24 24"
734
- >
735
- <g clip-path="url(#clip0_977_7760)">
736
- <path
737
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
738
- />
739
- </g>
740
- <defs>
741
- <clipPath id="clip0_977_7760">
742
- <rect width="24" height="24" />
743
- </clipPath>
744
- </defs>
745
- </svg>
746
- `,yX=`
747
- <svg
748
- xmlns="http://www.w3.org/2000/svg"
749
- width="24"
750
- height="24"
751
- viewBox="0 0 24 24"
752
- >
753
- <g clip-path="url(#clip0_977_7763)">
754
- <path
755
- d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z"
756
- />
757
- </g>
758
- <defs>
759
- <clipPath id="clip0_977_7763">
760
- <rect width="24" height="24" />
761
- </clipPath>
762
- </defs>
763
- </svg>
764
- `,bX=`
765
- <svg
766
- xmlns="http://www.w3.org/2000/svg"
767
- width="24"
768
- height="24"
769
- viewBox="0 0 24 24"
770
- >
771
- <g clip-path="url(#clip0_977_8075)">
772
- <path
773
- d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z"
774
- />
775
- </g>
776
- <defs>
777
- <clipPath id="clip0_977_8075">
778
- <rect width="24" height="24" />
779
- </clipPath>
780
- </defs>
781
- </svg>
782
- `,xX=`
783
- <svg
784
- xmlns="http://www.w3.org/2000/svg"
785
- width="24"
786
- height="24"
787
- viewBox="0 0 24 24"
788
- >
789
- <path
790
- d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z"
791
- />
792
- </svg>
793
- `,SX=`
794
- <svg
795
- xmlns="http://www.w3.org/2000/svg"
796
- width="24"
797
- height="24"
798
- viewBox="0 0 24 24"
799
- >
800
- <path
801
- d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z"
802
- />
803
- </svg>
804
- `,CX=`
805
- <svg
806
- xmlns="http://www.w3.org/2000/svg"
807
- width="24"
808
- height="24"
809
- viewBox="0 0 24 24"
810
- >
811
- <path
812
- fill="currentColor"
813
- d="M3 18v-2h13v2zm0-5v-2h18v2zm0-5V6h18v2zm15 13v-3h-3v-2h3v-3h2v3h3v2h-3v3z"
814
- />
815
- </svg>
816
- `,wX=`
817
- <svg
818
- xmlns="http://www.w3.org/2000/svg"
819
- width="24"
820
- height="24"
821
- viewBox="0 0 24 24"
822
- >
823
- <g clip-path="url(#clip0_971_7680)">
824
- <path
825
- d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z"
826
- />
827
- </g>
828
- <defs>
829
- <clipPath id="clip0_971_7680">
830
- <rect width="24" height="24" />
831
- </clipPath>
832
- </defs>
833
- </svg>
834
- `,TX=`
835
- <svg
836
- xmlns="http://www.w3.org/2000/svg"
837
- width="24"
838
- height="24"
839
- viewBox="0 0 24 24"
840
- >
841
- <g clip-path="url(#clip0_977_8067)">
842
- <path
843
- d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z"
844
- />
845
- </g>
846
- <defs>
847
- <clipPath id="clip0_977_8067">
848
- <rect width="24" height="24" />
849
- </clipPath>
850
- </defs>
851
- </svg>
852
- `,EX=`
853
- <svg
854
- xmlns="http://www.w3.org/2000/svg"
855
- width="24"
856
- height="24"
857
- viewBox="0 0 24 24"
858
- >
859
- <g clip-path="url(#clip0_971_7676)">
860
- <path
861
- d="M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z"
862
- />
863
- </g>
864
- <defs>
865
- <clipPath id="clip0_971_7676">
866
- <rect width="24" height="24" />
867
- </clipPath>
868
- </defs>
869
- </svg>
870
- `,DX=`
871
- <svg
872
- xmlns="http://www.w3.org/2000/svg"
873
- width="24"
874
- height="24"
875
- viewBox="0 0 24 24"
876
- >
877
- <g clip-path="url(#clip0_977_7897)">
878
- <path
879
- d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z"
880
- />
881
- </g>
882
- <defs>
883
- <clipPath id="clip0_977_7897">
884
- <rect width="24" height="24" />
885
- </clipPath>
886
- </defs>
887
- </svg>
888
- `,OX=`
889
- <svg
890
- xmlns="http://www.w3.org/2000/svg"
891
- width="24"
892
- height="24"
893
- viewBox="0 0 24 24"
894
- >
895
- <path
896
- d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"
897
- />
898
- </svg>
899
- `,kX=`
900
- <svg
901
- xmlns="http://www.w3.org/2000/svg"
902
- width="24"
903
- height="24"
904
- viewBox="0 0 24 24"
905
- >
906
- <path
907
- fill="currentColor"
908
- d="M12 20q-3.35 0-5.675-2.325T4 12q0-3.35 2.325-5.675T12 4q1.725 0 3.3.713T18 6.75V4h2v7h-7V9h4.2q-.8-1.4-2.187-2.2T12 6Q9.5 6 7.75 7.75T6 12q0 2.5 1.75 4.25T12 18q1.925 0 3.475-1.1T17.65 14h2.1q-.7 2.65-2.85 4.325T12 20"
909
- />
910
- </svg>
911
- `,AX=`
912
- <svg
913
- xmlns="http://www.w3.org/2000/svg"
914
- fill="none"
915
- viewBox="0 0 24 24"
916
- stroke-width="1.5"
917
- stroke="currentColor"
918
- class="w-6 h-6"
919
- >
920
- <path
921
- stroke-linecap="round"
922
- stroke-linejoin="round"
923
- d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
924
- />
925
- </svg>
926
- `,jX=`
927
- <svg
928
- xmlns="http://www.w3.org/2000/svg"
929
- width="24"
930
- height="24"
931
- viewBox="0 0 24 24"
932
- >
933
- <path
934
- fill="currentColor"
935
- d="M11 20V7.825l-5.6 5.6L4 12l8-8l8 8l-1.4 1.425l-5.6-5.6V20z"
936
- />
937
- </svg>
938
- `,MX=`
939
- <svg
940
- xmlns="http://www.w3.org/2000/svg"
941
- width="24"
942
- height="24"
943
- viewBox="0 0 24 24"
944
- >
945
- <path
946
- fill="currentColor"
947
- d="M3 20v-6l8-2l-8-2V4l19 8z"
948
- />
949
- </svg>
950
- `,NX=`
951
- <svg
952
- xmlns="http://www.w3.org/2000/svg"
953
- width="24"
954
- height="24"
955
- viewBox="0 0 24 24"
956
- >
957
- <path
958
- fill="currentColor"
959
- d="M5 13v-2h14v2z"
960
- />
961
- </svg>
962
- `,PX=`
963
- <svg
964
- xmlns="http://www.w3.org/2000/svg"
965
- width="24"
966
- height="24"
967
- viewBox="0 0 24 24"
968
- >
969
- <path
970
- d="M3.25 13.7404C3.0375 13.7404 2.85938 13.6684 2.71563 13.5246C2.57188 13.3808 2.5 13.2026 2.5 12.99C2.5 12.7774 2.57188 12.5993 2.71563 12.4558C2.85938 12.3122 3.0375 12.2404 3.25 12.2404H20.75C20.9625 12.2404 21.1406 12.3123 21.2843 12.4561C21.4281 12.5999 21.5 12.7781 21.5 12.9907C21.5 13.2033 21.4281 13.3814 21.2843 13.525C21.1406 13.6686 20.9625 13.7404 20.75 13.7404H3.25ZM10.9423 10.2596V6.62495H6.5673C6.2735 6.62495 6.02377 6.52201 5.8181 6.31613C5.61245 6.11026 5.50963 5.86027 5.50963 5.56615C5.50963 5.27205 5.61245 5.02083 5.8181 4.8125C6.02377 4.60417 6.2735 4.5 6.5673 4.5H17.4423C17.7361 4.5 17.9858 4.60294 18.1915 4.80883C18.3971 5.01471 18.5 5.2647 18.5 5.5588C18.5 5.85292 18.3971 6.10413 18.1915 6.31245C17.9858 6.52078 17.7361 6.62495 17.4423 6.62495H13.0673V10.2596H10.9423ZM10.9423 15.7211H13.0673V18.4423C13.0673 18.7361 12.9643 18.9858 12.7584 19.1915C12.5526 19.3971 12.3026 19.5 12.0085 19.5C11.7144 19.5 11.4631 19.3962 11.2548 19.1887C11.0465 18.9811 10.9423 18.7291 10.9423 18.4327V15.7211Z"
971
- />
972
- </svg>
973
- `,FX=`
974
- <svg
975
- xmlns="http://www.w3.org/2000/svg"
976
- width="24"
977
- height="24"
978
- viewBox="0 0 24 24"
979
- >
980
- <g clip-path="url(#clip0_977_8078)">
981
- <path
982
- d="M20 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3ZM20 5V8H5V5H20ZM15 19H10V10H15V19ZM5 10H8V19H5V10ZM17 19V10H20V19H17Z"
983
- />
984
- </g>
985
- <defs>
986
- <clipPath id="clip0_977_8078">
987
- <rect width="24" height="24" />
988
- </clipPath>
989
- </defs>
990
- </svg>
991
- `,IX=`
992
- <svg
993
- xmlns="http://www.w3.org/2000/svg"
994
- width="24"
995
- height="24"
996
- viewBox="0 0 24 24"
997
- >
998
- <g clip-path="url(#clip0_992_5547)">
999
- <path
1000
- d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z"
1001
- />
1002
- </g>
1003
- <defs>
1004
- <clipPath id="clip0_992_5547">
1005
- <rect width="24" height="24" />
1006
- </clipPath>
1007
- </defs>
1008
- </svg>
1009
- `,LX=`
1010
- <svg
1011
- xmlns="http://www.w3.org/2000/svg"
1012
- width="24"
1013
- height="24"
1014
- viewBox="0 0 24 24"
1015
- >
1016
- <path
1017
- d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"
1018
- />
1019
- </svg>
1020
- `,RX=`
1021
- <svg
1022
- xmlns="http://www.w3.org/2000/svg"
1023
- width="24"
1024
- height="24"
1025
- viewBox="0 0 24 24"
1026
- >
1027
- <path
1028
- fill="currentColor"
1029
- d="m12.9 16l-2.55-2.5l.05-.05q1.45-1.6 2.262-3.117T13.95 7H16V5h-6V3H8v2H2v2h9.1q-.5 1.2-1.225 2.387T8 11.7q-.6-.6-1.187-1.412T5.85 8.6H3.85q.5 1.4 1.3 2.7T6.95 13.7L2.85 17.75L4.25 19.15L8 15.4L10.55 17.95zM18.5 22h-2L21 10h2l4.5 12h-2l-1.05-3h-4.9zm1.6-5h3.6l-1.8-5.1z"
1030
- />
1031
- </svg>
1032
- `,zX=`
1033
- <svg
1034
- xmlns="http://www.w3.org/2000/svg"
1035
- width="32"
1036
- height="32"
1037
- viewBox="0 0 24 24"
1038
- >
1039
- <path
1040
- fill="currentColor"
1041
- d="M7 19v-.808L13.096 12L7 5.808V5h10v1.25H9.102L14.727 12l-5.625 5.77H17V19z"
1042
- />
1043
- </svg>
1044
- `,BX=`
1045
- <svg
1046
- xmlns="http://www.w3.org/2000/svg"
1047
- height="24px"
1048
- viewBox="0 -960 960 960"
1049
- width="24px"
1050
- >
1051
- <path
1052
- d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"
1053
- />
1054
- </svg>
1055
- `,VX={[UY.CodeMirror]:{theme:$r,languages:Pr,expandIcon:tX,searchIcon:AX,clearSearchIcon:iX,searchPlaceholder:`Search language`,noResultText:`No result`,previewToggleIcon:e=>e?dX:BX}},HX=Ci([],`FeaturesCtx`),UX=Ci({},`CrepeCtx`);function WX(e){return e.get(`CrepeCtx`)}function GX(e){return e.use(`FeaturesCtx`)}function KX(e){return t=>{GX(t).update(t=>t.includes(e)?t:[...t,e])}}function qX(e,t){let n=e.get(Qy),r=e.get(zb),{state:i}=n,a=r(i.doc),o=``;if(!i.selection.empty){let{from:e,to:t}=i.selection,n=i.doc.slice(e,t),{schema:a}=i.doc.type,s=a.topNodeType.createAndFill(null,n.content);if(!s){let e=a.nodes.paragraph?.createAndFill(null,n.content);e&&(s=a.topNodeType.createAndFill(null,e))}o=s?r(s):i.doc.textBetween(e,t)}return{document:a,selection:o,instruction:t}}var JX=xx({provider:void 0,buildContext:void 0,diffReviewOnEnd:!0,onError:e=>{console.error(`[milkdown/ai] [${e.code}]`,e)},aiIcon:void 0},`aiProviderConfig`),YX=xx({abortController:null,label:``,lastInstruction:``,lastLabel:void 0,lastFrom:-1,lastTo:-1,diffOwnedByAI:!1},`aiSession`);function XX(e,t){let n=e.get(JX.key);try{n.onError(t)}catch(e){console.error(`[milkdown/ai] onError handler failed:`,e)}}function ZX(e){let t=e.get(YX.key);e.set(YX.key,{...t,abortController:null,label:``})}async function QX(e,t,n,r){try{let i=t(n,r.signal),a=e.get(I);for await(let e of i){if(r.signal.aborted)break;a.call(DC.key,e)}if(r.signal.aborted)return;let o=e.get(JX.key);if(o.diffReviewOnEnd){let t=e.get(YX.key);e.set(YX.key,{...t,diffOwnedByAI:!0})}let s=a.call(OC.key,{diffReview:o.diffReviewOnEnd});if(o.diffReviewOnEnd&&!s){let t=e.get(YX.key);e.set(YX.key,{...t,diffOwnedByAI:!1})}}catch(t){if(r.signal.aborted)return;XX(e,vi(t)),e.get(I).call(kC.key,{keep:!1})}finally{e.get(YX.key).abortController===r&&ZX(e)}}var $X=L(`RunAI`,e=>t=>(n,r)=>{if(!t?.instruction)return!1;let i=e.get(JX.key);if(!i.provider||e.get(YX.key).abortController||SC.getState(n)?.active||dS.getState(n)?.active)return!1;if(!r)return!0;let a=new AbortController,{from:o,to:s}=n.selection;e.set(YX.key,{abortController:a,label:t.label??``,lastInstruction:t.instruction,lastLabel:t.label,lastFrom:o,lastTo:s,diffOwnedByAI:!1});let c=e.get(I),l=n.selection.empty?`cursor`:`selection`;if(!c.call(EC.key,{insertAt:l}))return ZX(e),!1;let u;try{u=(i.buildContext??qX)(e,t.instruction)}catch(t){return XX(e,yi(t)),c.call(kC.key,{keep:!1}),ZX(e),!1}return QX(e,i.provider,u,a),!0}),eZ=L(`AbortAI`,e=>t=>(n,r)=>{let i=e.get(YX.key);return r?i.abortController?(i.abortController.abort(),ZX(e),SC.getState(n)?.active&&e.get(I).call(kC.key,t),!0):!1:!!i.abortController}),tZ=e=>{throw TypeError(e)},nZ=(e,t,n)=>t.has(e)||tZ(`Cannot `+n),rZ=(e,t,n)=>(nZ(e,t,`read from private field`),n?n.call(e):t.get(e)),iZ=(e,t,n)=>t.has(e)?tZ(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),aZ=(e,t,n,r)=>(nZ(e,t,`write to private field`),t.set(e,n),n),oZ=(e,t,n)=>(nZ(e,t,`access private method`),n),sZ,cZ,lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ,bZ,xZ,SZ,CZ=`milkdown-ai-diff-actions`;function wZ(e,t){e.innerHTML=gt.sanitize(t.trim())}function TZ(e){let t=document.createElement(`span`);return t.className=`${CZ}-icon`,wZ(t,e),t}var EZ=class{constructor(e,t,n){this.ctx=e,iZ(this,hZ),iZ(this,sZ),iZ(this,cZ),iZ(this,lZ),iZ(this,uZ),iZ(this,dZ,!1),iZ(this,fZ,!1),iZ(this,pZ,null),iZ(this,mZ,!1),iZ(this,yZ,()=>{let e=this.ctx.get(YX.key);if(!e.lastInstruction||!rZ(this,mZ)||!oZ(this,hZ,bZ).call(this))return;let t=this.ctx.get(I);t.call(wS.key);let n=this.ctx.get(Qy),{doc:r}=n.state,i=Math.min(Math.max(e.lastFrom,0),r.content.size),a=Math.min(Math.max(e.lastTo,0),r.content.size);n.dispatch(n.state.tr.setSelection(N.create(n.state.doc,i,a))),t.call($X.key,{instruction:e.lastInstruction,label:e.lastLabel})}),iZ(this,xZ,()=>{this.ctx.get(I).call(wS.key)}),iZ(this,SZ,()=>{this.ctx.get(I).call(CS.key)}),aZ(this,uZ,n),aZ(this,cZ,oZ(this,hZ,gZ).call(this,t));let r=document.createElement(`div`);r.className=CZ,r.dataset.show=`false`,aZ(this,lZ,oZ(this,hZ,_Z).call(this,`retry`,n.retryIcon,n.retryLabel,rZ(this,yZ))),r.appendChild(rZ(this,lZ)),r.appendChild(oZ(this,hZ,_Z).call(this,`reject`,n.rejectIcon,n.rejectAllLabel,rZ(this,xZ)));let i=oZ(this,hZ,_Z).call(this,`accept`,n.acceptIcon,n.acceptAllLabel,rZ(this,SZ));i.appendChild(oZ(this,hZ,vZ).call(this)),r.appendChild(i),aZ(this,sZ,r),rZ(this,cZ).appendChild(r),this.update(t)}update(e){let t=!!dS.getState(e.state)?.active;if(t!==rZ(this,fZ)){if(aZ(this,fZ,t),t){let t=this.ctx.get(YX.key);aZ(this,mZ,t.diffOwnedByAI),aZ(this,pZ,e.state.doc)}else{aZ(this,mZ,!1),aZ(this,pZ,null);let e=this.ctx.get(YX.key);e.diffOwnedByAI&&this.ctx.set(YX.key,{...e,diffOwnedByAI:!1})}}let n=t&&rZ(this,mZ);if(n!==rZ(this,dZ)&&(aZ(this,dZ,n),rZ(this,sZ).dataset.show=n?`true`:`false`),n){let t=this.ctx.get(YX.key),n=!!rZ(this,pZ)&&e.state.doc.eq(rZ(this,pZ));rZ(this,lZ).disabled=!t.lastInstruction||!n}}destroy(){rZ(this,sZ).remove()}};sZ=new WeakMap,cZ=new WeakMap,lZ=new WeakMap,uZ=new WeakMap,dZ=new WeakMap,fZ=new WeakMap,pZ=new WeakMap,mZ=new WeakMap,hZ=new WeakSet,gZ=function(e){return e.dom.closest(`.milkdown`)??document.body},_Z=function(e,t,n,r){let i=document.createElement(`button`);i.type=`button`,i.className=`${CZ}-btn ${CZ}-btn-${e}`,i.appendChild(TZ(t));let a=document.createElement(`span`);return a.textContent=n,i.appendChild(a),i.addEventListener(`mousedown`,e=>e.preventDefault()),i.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r()}),i},vZ=function(){let e=document.createElement(`span`);e.className=`${CZ}-shortcut`;let t=document.createElement(`span`);t.textContent=rZ(this,uZ).modSymbol;let n=document.createElement(`span`);return n.className=`${CZ}-shortcut-icon`,wZ(n,rZ(this,uZ).enterKeyIcon),e.append(t,n),e},yZ=new WeakMap,bZ=function(){return rZ(this,pZ)?this.ctx.get(Qy).state.doc.eq(rZ(this,pZ)):!1},xZ=new WeakMap,SZ=new WeakMap;var DZ=new Op(`CREPE_AI_DIFF_ACTIONS_PANEL`),OZ=`Retry`,kZ=`Reject all`,AZ=`Accept all`;function jZ(){if(typeof navigator>`u`)return`⌘`;let e=navigator,t=e.userAgentData?.platform??e.platform??e.userAgent??``;return/mac|iphone|ipad|ipod/i.test(t)?`⌘`:`Ctrl`}var MZ=jZ();function NZ(e){let{config:t,enterKeyIcon:n}=e;return{retryLabel:t?.retryLabel??OZ,rejectAllLabel:t?.rejectAllLabel??kZ,acceptAllLabel:t?.acceptAllLabel??AZ,retryIcon:t?.retryIcon??kX,rejectIcon:t?.rejectIcon??iX,acceptIcon:t?.acceptIcon??sX,enterKeyIcon:n??fX,modSymbol:t?.modSymbol??MZ}}function PZ(e={}){let t=NZ(e);return vx(e=>new Tp({key:DZ,view(n){return new EZ(e,n,t)},props:{handleKeyDown(t,n){return n.key!==`Enter`||!(n.metaKey||n.ctrlKey)||!dS.getState(t.state)?.active||!e.get(YX.key).diffOwnedByAI?!1:(n.preventDefault(),e.get(I).call(CS.key),!0)}}}))}var FZ=e=>{throw TypeError(e)},IZ=(e,t,n)=>t.has(e)||FZ(`Cannot `+n),LZ=(e,t,n)=>(IZ(e,t,`read from private field`),n?n.call(e):t.get(e)),RZ=(e,t,n)=>t.has(e)?FZ(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),zZ=(e,t,n,r)=>(IZ(e,t,`write to private field`),t.set(e,n),n),BZ,VZ;function HZ(e){let t={addItem:(n,r)=>(e.items.set(n,r),t),removeItem:n=>(e.items.delete(n),t),getItem:t=>e.items.get(t),clear:()=>(e.items.clear(),t)};return t}var UZ=class{constructor(){RZ(this,BZ,[]),this.addItem=(e,t)=>(LZ(this,VZ).call(this,e),LZ(this,BZ).push({kind:`item`,id:e,item:t}),this),this.addSubmenu=(e,t,n)=>{LZ(this,VZ).call(this,e);let r={def:t,items:new Map};return n&&n(HZ(r)),LZ(this,BZ).push({kind:`submenu`,id:e,node:r}),this},this.removeItem=e=>(LZ(this,VZ).call(this,e),this),this.getItem=e=>{let t=LZ(this,BZ).find(t=>t.kind===`item`&&t.id===e);return t?.kind===`item`?t.item:void 0},this.getSubmenu=e=>{let t=LZ(this,BZ).find(t=>t.kind===`submenu`&&t.id===e);return t?.kind===`submenu`?HZ(t.node):void 0},this.clear=()=>(zZ(this,BZ,[]),this),this.build=()=>{let e=[],t={};for(let n of LZ(this,BZ))n.kind===`item`?e.push({kind:`item`,id:n.id,item:n.item}):(e.push({kind:`submenu`,id:n.id,def:n.node.def}),t[n.id]={def:n.node.def,items:Array.from(n.node.items.entries()).map(([e,t])=>({id:e,item:t}))});return{main:e,submenus:t}},RZ(this,VZ,e=>{zZ(this,BZ,LZ(this,BZ).filter(t=>t.id!==e))})}};BZ=new WeakMap,VZ=new WeakMap;function WZ(e){e.addItem(`improve`,{icon:GY,label:`Improve writing`,streamingLabel:`Improving writing`,prompt:`Improve the writing while preserving the original meaning.`}).addItem(`grammar`,{icon:pX,label:`Fix grammar & spelling`,streamingLabel:`Fixing grammar & spelling`,prompt:`Fix any grammar and spelling errors without changing the meaning.`}).addItem(`shorter`,{icon:NX,label:`Make shorter`,streamingLabel:`Making shorter`,prompt:`Make this shorter while preserving the key information.`}).addItem(`longer`,{icon:CX,label:`Make longer`,streamingLabel:`Expanding`,prompt:`Expand this with more detail and examples.`}),e.addSubmenu(`tone`,{icon:dX,label:`Change tone…`,title:`Change tone`,searchPlaceholder:`Search tones…`},e=>{for(let[t,n]of[[`professional`,`Professional`],[`casual`,`Casual`],[`confident`,`Confident`],[`friendly`,`Friendly`],[`direct`,`Direct`],[`formal`,`Formal`]])e.addItem(t,{icon:dX,label:n,streamingLabel:`Adjusting tone`,prompt:`Rewrite this in a ${n.toLowerCase()} tone.`})}),e.addSubmenu(`translate`,{icon:RX,label:`Translate…`,title:`Translate`,searchPlaceholder:`Search languages…`},e=>{for(let[t,n,r]of[[`english`,`English`,`English`],[`chinese`,`Chinese`,`Chinese (Simplified)`],[`japanese`,`Japanese`,`Japanese`],[`korean`,`Korean`,`Korean`],[`spanish`,`Spanish`,`Spanish`],[`french`,`French`,`French`],[`german`,`German`,`German`]])e.addItem(t,{icon:RX,label:n,streamingLabel:`Translating to ${n}`,prompt:`Translate this to ${r}.`})})}function GZ(e,t){let n=t.trim();if(!n)return[e];let r=e.toLowerCase(),i=n.toLowerCase(),a=r.indexOf(i);return a===-1?[e]:[e.slice(0,a),f(`mark`,null,e.slice(a,a+n.length)),e.slice(a+n.length)]}var KZ=d({props:{placeholder:{type:Object,required:!0},resetSignal:{type:Object,required:!0},suggestions:{type:Object,required:!0},chrome:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({placeholder:e,resetSignal:t,suggestions:n,chrome:r,onConfirm:a,onCancel:o}){let s=S(``),c=S({kind:`main`}),u=S(0),d=S(null),p=S(null),m=`ai-instruction-list-${Math.random().toString(36).slice(2,9)}`,h=e=>`${m}-opt-${e}`,g=`ai-instruction-input-${Math.random().toString(36).slice(2,9)}`;i(t,()=>{s.value=``,c.value={kind:`main`},u.value=0});let _=w(()=>{if(c.value.kind===`submenu`){let e=n.submenus[c.value.id];return e?e.items.map(({id:e,item:t})=>({id:e,icon:t.icon,label:t.label,hasSubmenu:!1,prompt:{text:t.prompt,streamingLabel:t.streamingLabel}})):[]}return n.main.map(e=>e.kind===`item`?{id:e.id,icon:e.item.icon,label:e.item.label,hasSubmenu:!1,prompt:{text:e.item.prompt,streamingLabel:e.item.streamingLabel}}:{id:e.id,icon:e.def.icon,label:e.def.label,hasSubmenu:!0})}),v=w(()=>c.value.kind===`submenu`?n.submenus[c.value.id]?.def??null:null),y=w(()=>{let e=s.value.trim().toLowerCase();return e?_.value.filter(t=>t.label.toLowerCase().includes(e)):_.value}),b=w(()=>s.value.trim().length>0),x=w(()=>y.value.length+ +!!b.value);i([y,c,b],()=>{u.value=b.value?y.value.length:0});let ee=()=>{l(()=>d.value?.focus())},te=e=>{c.value={kind:`submenu`,id:e},s.value=``,u.value=0,ee()},C=()=>{c.value={kind:`main`},s.value=``,u.value=0,ee()},ne=e=>{e.hasSubmenu?te(e.id):e.prompt&&(a(e.prompt.text,e.prompt.streamingLabel),s.value=``)},re=()=>{let e=s.value.trim();e&&(a(e),s.value=``)},T=()=>{let e=u.value,t=y.value;e<t.length?ne(t[e]):b.value&&re()},ie=()=>{l(()=>{let e=p.value;e&&e.querySelector(`[data-index="${u.value}"]`)?.scrollIntoView({block:`nearest`})})},ae=e=>{if(e.stopPropagation(),e.key===`ArrowDown`){if(e.preventDefault(),x.value===0)return;u.value=(u.value+1)%x.value,ie();return}if(e.key===`ArrowUp`){if(e.preventDefault(),x.value===0)return;u.value=(u.value-1+x.value)%x.value,ie();return}if(e.key===`Enter`){e.preventDefault(),T();return}if(e.key===`Escape`){e.preventDefault(),c.value.kind===`submenu`?C():o();return}e.key===`Backspace`&&s.value===``&&c.value.kind===`submenu`&&(e.preventDefault(),C())},oe=e=>{e.preventDefault()};return()=>{let t=y.value,n=b.value,i=v.value;return f(`div`,{class:`ai-instruction`},f(`div`,{class:`ai-instruction-input`},f(`span`,{class:`ai-instruction-input-prefix`},f(xT,{icon:r.aiIcon})),f(`input`,{ref:d,id:g,class:`ai-instruction-input-field`,role:`combobox`,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-controls":m,"aria-activedescendant":x.value>0?h(u.value):void 0,placeholder:i?i.searchPlaceholder:e.value,value:s.value,onInput:e=>{s.value=e.target.value},onKeydown:ae}),f(`button`,{type:`button`,class:`ai-instruction-submit`,"aria-label":r.submitButtonLabel,disabled:!n,onMousedown:oe,onClick:re},f(xT,{icon:r.sendIcon}))),f(`div`,{class:`ai-instruction-list`,ref:p,id:m,role:`listbox`,"aria-label":r.listboxLabel},i&&f(`button`,{type:`button`,class:`ai-instruction-back`,onMousedown:oe,onClick:C},f(`span`,{class:`ai-instruction-back-icon`,"aria-hidden":`true`},f(xT,{icon:r.chevronLeftIcon})),f(`span`,null,i.title)),t.length>0&&f(`div`,{class:`ai-instruction-section`},f(`div`,{class:`ai-instruction-section-header`},r.suggestionsHeaderLabel),t.map((e,t)=>f(`div`,{key:e.id,id:h(t),"data-index":t,role:`option`,"aria-selected":t===u.value,class:[`ai-instruction-item`,t===u.value?`active`:``],onMousedown:oe,onClick:()=>ne(e),onPointerenter:()=>{u.value=t}},f(`span`,{class:`ai-instruction-item-icon`},f(xT,{icon:e.icon})),f(`span`,{class:`ai-instruction-item-label`},GZ(e.label,s.value)),e.hasSubmenu&&f(`span`,{class:`ai-instruction-item-arrow`},f(xT,{icon:r.chevronRightIcon}))))),n&&f(`div`,{class:`ai-instruction-section`},f(`div`,{class:`ai-instruction-section-header`},r.sendAsPromptHeaderLabel),f(`div`,{id:h(t.length),"data-index":t.length,role:`option`,"aria-selected":u.value===t.length,class:[`ai-instruction-item`,`ai-instruction-item-prompt`,u.value===t.length?`active`:``],onMousedown:oe,onClick:re,onPointerenter:()=>{u.value=t.length}},f(`span`,{class:`ai-instruction-item-icon`},f(xT,{icon:r.sendPromptIcon})),f(`span`,{class:`ai-instruction-item-label`},r.sendAsPromptLabel,` `,f(`span`,{class:`ai-instruction-item-quote`},`"`,s.value,`"`)),f(`span`,{class:`ai-instruction-item-shortcut`},f(xT,{icon:r.enterKeyIcon}))))))}}}),qZ=e=>{throw TypeError(e)},JZ=(e,t,n)=>t.has(e)||qZ(`Cannot `+n),YZ=(e,t,n)=>(JZ(e,t,`read from private field`),n?n.call(e):t.get(e)),XZ=(e,t,n)=>t.has(e)?qZ(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),ZZ=(e,t,n,r)=>(JZ(e,t,`write to private field`),t.set(e,n),n),QZ,$Z,eQ,tQ,nQ,rQ,iQ,aQ,oQ,sQ,cQ=class{constructor(e,t,n){this.ctx=e,XZ(this,QZ),XZ(this,$Z),XZ(this,eQ),XZ(this,tQ),XZ(this,nQ),XZ(this,rQ,-1),XZ(this,iQ,-1),XZ(this,aQ,!1),XZ(this,oQ,(e,t)=>{e.trim()&&this.ctx.get(I).call($X.key,{instruction:e,label:t})&&(ZZ(this,aQ,!1),YZ(this,$Z).hide())}),XZ(this,sQ,()=>{ZZ(this,aQ,!1),YZ(this,$Z).hide()}),this.show=(e,t)=>{ZZ(this,rQ,e),ZZ(this,iQ,t),YZ(this,nQ).value++,ZZ(this,aQ,!0);let n=this.ctx.get(Qy);YZ(this,$Z).show({getBoundingClientRect:()=>eh(n,e,t)},n),requestAnimationFrame(()=>{var e;(e=YZ(this,QZ).querySelector(`input`))==null||e.focus()})},this.update=(e,t)=>{let{selection:n}=e.state,r=n instanceof N,i=n.from!==YZ(this,rQ)||n.to!==YZ(this,iQ);if(!r||i){ZZ(this,aQ,!1),YZ(this,$Z).hide();return}YZ(this,$Z).update(e,t)},this.destroy=()=>{YZ(this,eQ).unmount(),YZ(this,$Z).destroy(),YZ(this,QZ).remove()},ZZ(this,tQ,S(n.placeholder)),ZZ(this,nQ,S(0));let r=document.createElement(`div`);r.className=`milkdown-ai-instruction`;let i=re(KZ,{placeholder:YZ(this,tQ),resetSignal:YZ(this,nQ),suggestions:n.suggestions,chrome:n.chrome,onConfirm:YZ(this,oQ),onCancel:YZ(this,sQ)});i.mount(r),ZZ(this,eQ,i),ZZ(this,QZ,r),ZZ(this,$Z,new _T({content:r,debounce:0,offset:10,shouldShow:()=>YZ(this,aQ),floatingUIOptions:{placement:`bottom`}})),YZ(this,$Z).onHide=()=>{ZZ(this,aQ,!1),requestAnimationFrame(()=>{try{let e=YZ(this,QZ).getRootNode().activeElement;if(!e||!YZ(this,QZ).contains(e))return;this.ctx.get(Qy).dom.focus({preventScroll:!0})}catch{}})},YZ(this,$Z).update(t)}};QZ=new WeakMap,$Z=new WeakMap,eQ=new WeakMap,tQ=new WeakMap,nQ=new WeakMap,rQ=new WeakMap,iQ=new WeakMap,aQ=new WeakMap,oQ=new WeakMap,sQ=new WeakMap;var lQ=xx({show:()=>{}},`aiInstructionTooltipAPI`),uQ=vT(`CREPE_AI_INSTRUCTION`),dQ=`SUGGESTIONS`,fQ=`SEND AS PROMPT`,pQ=`Ask AI:`,mQ=`Send prompt`,hQ=`AI suggestions`,gQ=`Tell AI what to do with the selection…`;function _Q(e){return{aiIcon:e?.aiIcon??GY,sendIcon:e?.sendIcon??jX,sendPromptIcon:e?.sendPromptIcon??MX,enterKeyIcon:e?.enterKeyIcon??fX,chevronLeftIcon:e?.chevronLeftIcon??nX,chevronRightIcon:e?.chevronRightIcon??rX,suggestionsHeaderLabel:e?.suggestionsHeaderLabel??dQ,sendAsPromptHeaderLabel:e?.sendAsPromptHeaderLabel??fQ,sendAsPromptLabel:e?.sendAsPromptLabel??pQ,submitButtonLabel:e?.submitButtonLabel??mQ,listboxLabel:e?.listboxLabel??hQ}}function vQ(e){var t;let n=new UZ;return WZ(n),(t=e?.buildAISuggestions)==null||t.call(e,n),{placeholder:e?.instructionPlaceholder??gQ,chrome:_Q(e),suggestions:n.build()}}function yQ(e){return t=>{let n=vQ(e),r=null;t.update(lQ.key,e=>({...e,show:(e,t)=>{r?.show(e,t)}})),t.set(uQ.key,{view:e=>(r=new cQ(t,e,n),r)})}}var bQ=e=>{throw TypeError(e)},xQ=(e,t,n)=>t.has(e)||bQ(`Cannot `+n),SQ=(e,t,n)=>(xQ(e,t,`read from private field`),n?n.call(e):t.get(e)),CQ=(e,t,n)=>t.has(e)?bQ(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),wQ=(e,t,n,r)=>(xQ(e,t,`write to private field`),t.set(e,n),n),TQ,EQ,DQ,OQ,kQ,AQ,jQ,MQ=`milkdown-ai-streaming`,NQ=800,PQ=`Generating`,FQ=`Esc to cancel`,IQ=new Op(`CREPE_AI_STREAMING_INDICATOR`),LQ=class{constructor(e,t,n){CQ(this,TQ),CQ(this,EQ),CQ(this,DQ),CQ(this,OQ,performance.now()),CQ(this,kQ,``),CQ(this,AQ,0),CQ(this,jQ,()=>{let e=(performance.now()-SQ(this,OQ))/NQ*360;SQ(this,TQ).style.transform=`rotate(${e}deg)`,wQ(this,AQ,requestAnimationFrame(SQ(this,jQ)))}),wQ(this,DQ,t);let r=document.createElement(`span`);r.className=`${MQ}-indicator`,r.contentEditable=`false`,r.setAttribute(`role`,`status`),r.setAttribute(`aria-live`,`polite`);let i=document.createElement(`span`);i.className=`${MQ}-spinner`,i.setAttribute(`aria-hidden`,`true`),r.appendChild(i);let a=document.createElement(`span`);a.className=`${MQ}-label`,r.appendChild(a);let o=document.createElement(`span`);o.className=`${MQ}-esc`,o.textContent=n,r.appendChild(o),this.dom=r,wQ(this,TQ,i),wQ(this,EQ,a),this.setLabel(e),SQ(this,jQ).call(this)}setLabel(e){let t=`${e.get(YX.key).label||SQ(this,DQ)}\u2026`;t!==SQ(this,kQ)&&(wQ(this,kQ,t),SQ(this,EQ).textContent=t)}destroy(){SQ(this,AQ)&&cancelAnimationFrame(SQ(this,AQ)),wQ(this,AQ,0)}};TQ=new WeakMap,EQ=new WeakMap,DQ=new WeakMap,OQ=new WeakMap,kQ=new WeakMap,AQ=new WeakMap,jQ=new WeakMap;function RQ(e={}){let{config:t}=e,n=t?.fallbackLabel??PQ,r=t?.cancelHint??FQ;return vx(e=>{let t=null;function i(){return t?t.setLabel(e):t=new LQ(e,n,r),t}function a(){t&&=(t.destroy(),null)}function o(e,t){let n=Math.min(t,e.content.size),r=ay.widget(n,i().dom,{side:1,key:`ai-streaming-indicator`});return cy.create(e,[r])}return new Tp({key:IQ,state:{init:()=>cy.empty,apply(e,t,n,r){let i=SC.getState(r);return!i?.active||i.insertEndPos==null?(a(),cy.empty):e.getMeta(SC)||e.docChanged?o(r.doc,i.insertEndPos):t.map(e.mapping,e.doc)}},view(){return{destroy(){a()}}},props:{decorations(e){return IQ.getState(e)??cy.empty},handleKeyDown(t,n){if(n.key!==`Escape`)return!1;let r=e.get(I);return e.get(YX.key).abortController?(n.preventDefault(),r.call(eZ.key,{keep:!0}),!0):SC.getState(t.state)?.active?(n.preventDefault(),r.call(kC.key,{keep:!0}),!0):!1}}})})}var zQ=[`table`,`image-block`,`code_block`],BQ={heading:[`id`]},VQ=(e,t)=>{let n=t?.diff??{},r=t?.streaming??{};e.config(KX(UY.AI)).config(e=>{e.update(uS.key,e=>({...e,ignoreAttrs:n.ignoreAttrs??BQ}));let{ignoreAttrs:t,...r}=n;e.update(PS.key,e=>({...e,customBlockTypes:r.customBlockTypes??zQ,...r}))}).use(TS).use(aC).config(e=>{e.update(sC.key,e=>({...e,...r,ignoreAttrs:r.ignoreAttrs??BQ,...t?.diffReviewOnEnd===void 0?{}:{diffReviewOnEnd:t.diffReviewOnEnd}}))}).use(AC).config(e=>{e.update(JX.key,e=>({...e,...t?.provider===void 0?{}:{provider:t.provider},...t?.buildContext===void 0?{}:{buildContext:t.buildContext},diffReviewOnEnd:t?.diffReviewOnEnd??e.diffReviewOnEnd,...t?.onError===void 0?{}:{onError:t.onError},...t?.aiIcon===void 0?{}:{aiIcon:t.aiIcon}}))}).use(JX).use(YX).use($X).use(eZ).config(yQ(t)).use(lQ).use(uQ).use(RQ({config:t?.streamingIndicator})).use(PZ({config:t?.diffActions,enterKeyIcon:t?.enterKeyIcon}))};function HQ(e){return e.$from.parent.type.name===`code_block`}function UQ(e){return e.$from.node(e.$from.depth-1)?.type?.name===`list_item`}var WQ=e=>{throw TypeError(e)},GQ=(e,t,n)=>t.has(e)||WQ(`Cannot `+n),KQ=(e,t,n)=>(GQ(e,t,`read from private field`),n?n.call(e):t.get(e)),qQ=(e,t,n)=>t.has(e)?WQ(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),JQ=(e,t,n,r)=>(GQ(e,t,`write to private field`),t.set(e,n),n),YQ,XQ,ZQ=class{constructor(){qQ(this,YQ,[]),this.clear=()=>(JQ(this,YQ,[]),this),qQ(this,XQ,e=>{let t={group:e,addItem:(n,r)=>{let i={...r,key:n};return e.items.push(i),t},clear:()=>(e.items=[],t)};return t}),this.addGroup=(e,t)=>{let n={key:e,label:t,items:[]};return KQ(this,YQ).push(n),KQ(this,XQ).call(this,n)},this.getGroup=e=>{let t=KQ(this,YQ).find(t=>t.key===e);if(!t)throw Error(`Group with key ${e} not found`);return KQ(this,XQ).call(this,t)},this.build=()=>KQ(this,YQ)}};YQ=new WeakMap,XQ=new WeakMap;function QQ(e,t,n){var r;let i=n&&GX(n).get(),a=i?.includes(UY.Latex),o=i?.includes(UY.ImageBlock),s=i?.includes(UY.Table),c=new ZQ;if(t?.textGroup!==null){let e=c.addGroup(`text`,t?.textGroup?.label??`Text`);t?.textGroup?.text!==null&&e.addItem(`text`,{label:t?.textGroup?.text?.label??`Text`,icon:t?.textGroup?.text?.icon??IX,onRun:e=>{let t=e.get(I),n=DE.type(e);t.call(PD.key),t.call(FD.key,{nodeType:n})}}),t?.textGroup?.h1!==null&&e.addItem(`h1`,{label:t?.textGroup?.h1?.label??`Heading 1`,icon:t?.textGroup?.h1?.icon??mX,onRun:e=>{let t=e.get(I),n=FE.type(e);t.call(PD.key),t.call(FD.key,{nodeType:n,attrs:{level:1}})}}),t?.textGroup?.h2!==null&&e.addItem(`h2`,{label:t?.textGroup?.h2?.label??`Heading 2`,icon:t?.textGroup?.h2?.icon??hX,onRun:e=>{let t=e.get(I),n=FE.type(e);t.call(PD.key),t.call(FD.key,{nodeType:n,attrs:{level:2}})}}),t?.textGroup?.h3!==null&&e.addItem(`h3`,{label:t?.textGroup?.h3?.label??`Heading 3`,icon:t?.textGroup?.h3?.icon??gX,onRun:e=>{let t=e.get(I),n=FE.type(e);t.call(PD.key),t.call(FD.key,{nodeType:n,attrs:{level:3}})}}),t?.textGroup?.h4!==null&&e.addItem(`h4`,{label:t?.textGroup?.h4?.label??`Heading 4`,icon:t?.textGroup?.h4?.icon??_X,onRun:e=>{let t=e.get(I),n=FE.type(e);t.call(PD.key),t.call(FD.key,{nodeType:n,attrs:{level:4}})}}),t?.textGroup?.h5!==null&&e.addItem(`h5`,{label:t?.textGroup?.h5?.label??`Heading 5`,icon:t?.textGroup?.h5?.icon??vX,onRun:e=>{let t=e.get(I),n=FE.type(e);t.call(PD.key),t.call(FD.key,{nodeType:n,attrs:{level:5}})}}),t?.textGroup?.h6!==null&&e.addItem(`h6`,{label:t?.textGroup?.h6?.label??`Heading 6`,icon:t?.textGroup?.h6?.icon??yX,onRun:e=>{let t=e.get(I),n=FE.type(e);t.call(PD.key),t.call(FD.key,{nodeType:n,attrs:{level:6}})}}),t?.textGroup?.quote!==null&&e.addItem(`quote`,{label:t?.textGroup?.quote?.label??`Quote`,icon:t?.textGroup?.quote?.icon??DX,onRun:e=>{let t=e.get(I),n=VE.type(e);t.call(PD.key),t.call(ID.key,{nodeType:n})}}),t?.textGroup?.divider!==null&&e.addItem(`divider`,{label:t?.textGroup?.divider?.label??`Divider`,icon:t?.textGroup?.divider?.icon??lX,onRun:e=>{let t=e.get(I),n=aD.type(e);t.call(PD.key),t.call(LD.key,{nodeType:n})}})}if(t?.listGroup!==null){let e=c.addGroup(`list`,t?.listGroup?.label??`List`);t?.listGroup?.bulletList!==null&&e.addItem(`bullet-list`,{label:t?.listGroup?.bulletList?.label??`Bullet List`,icon:t?.listGroup?.bulletList?.icon??ZY,onRun:e=>{let t=e.get(I),n=lD.type(e);t.call(PD.key),t.call(ID.key,{nodeType:n})}}),t?.listGroup?.orderedList!==null&&e.addItem(`ordered-list`,{label:t?.listGroup?.orderedList?.label??`Ordered List`,icon:t?.listGroup?.orderedList?.icon??TX,onRun:e=>{let t=e.get(I),n=mD.type(e);t.call(PD.key),t.call(ID.key,{nodeType:n})}}),t?.listGroup?.taskList!==null&&e.addItem(`task-list`,{label:t?.listGroup?.taskList?.label??`Task List`,icon:t?.listGroup?.taskList?.icon??LX,onRun:e=>{let t=e.get(I),n=yD.type(e);t.call(PD.key),t.call(ID.key,{nodeType:n,attrs:{checked:!1}})}})}if(t?.advancedGroup!==null){let e=c.addGroup(`advanced`,t?.advancedGroup?.label??`Advanced`);t?.advancedGroup?.image!==null&&o&&e.addItem(`image`,{label:t?.advancedGroup?.image?.label??`Image`,icon:t?.advancedGroup?.image?.icon??bX,onRun:e=>{let t=e.get(I),n=xO.type(e);t.call(PD.key),t.call(LD.key,{nodeType:n})}}),t?.advancedGroup?.codeBlock!==null&&e.addItem(`code`,{label:t?.advancedGroup?.codeBlock?.label??`Code`,icon:t?.advancedGroup?.codeBlock?.icon??aX,onRun:e=>{let t=e.get(I),n=KE.type(e);t.call(PD.key),t.call(FD.key,{nodeType:n})}}),t?.advancedGroup?.table!==null&&s&&e.addItem(`table`,{label:t?.advancedGroup?.table?.label??`Table`,icon:t?.advancedGroup?.table?.icon??FX,onRun:e=>{let t=e.get(I),n=e.get(Qy);t.call(PD.key);let{from:r}=n.state.selection;t.call(LD.key,{nodeType:oN(e,3,3)}),t.call(RD.key,{pos:r})}}),t?.advancedGroup?.math!==null&&a&&e.addItem(`math`,{label:t?.advancedGroup?.math?.label??`Math`,icon:t?.advancedGroup?.math?.icon??zX,onRun:e=>{let t=e.get(I),n=KE.type(e);t.call(PD.key),t.call(LD.key,{nodeType:n,attrs:{language:`LaTeX`}})}})}(r=t?.buildMenu)==null||r.call(t,c);let l=c.build();e&&(l=l.map(t=>{let n=t.items.filter(t=>t.label.toLowerCase().includes(e.toLowerCase()));return{...t,items:n}}).filter(e=>e.items.length>0));let u=l.flatMap(e=>e.items);return u.forEach((e,t)=>{Object.assign(e,{index:t})}),l.reduce((e,t)=>{let n=e+t.items.length;return Object.assign(t,{range:[e,n]}),n},0),{groups:l,size:u.length}}var $Q=d({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:e,show:t,filter:n,hide:r,config:o}){let s=S(),c=w(()=>QQ(n.value,o,e)),l=S(0),u=S({x:-999,y:-999}),d=e=>{let{x:t,y:n}=e;u.value={x:t,y:n}};i([c,t],()=>{let{size:e}=c.value;e===0&&t.value?r():l.value>=e&&(l.value=0)});let p=(e,t)=>{let n=l.value,r=typeof e==`function`?e(n):e;t?.(r),l.value=r},m=e=>{let t=s.value?.querySelector(`[data-index="${e}"]`),n=s.value?.querySelector(`.menu-groups`);t&&n&&(n.scrollTop=t.offsetTop-n.offsetTop)},h=t=>{let n=c.value.groups.flatMap(e=>e.items).at(t);n?.onRun&&e&&n.onRun(e),r()},g=e=>{let{size:t,groups:n}=c.value;if(e.key===`Escape`){e.preventDefault(),r?.();return}if(e.key===`ArrowDown`)return e.preventDefault(),p(e=>e<t-1?e+1:e,m);if(e.key===`ArrowUp`)return e.preventDefault(),p(e=>e<=0?e:e-1,m);if(e.key===`ArrowLeft`)return e.preventDefault(),p(e=>{let t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;let r=n[n.indexOf(t)-1];return r?r.range[1]-1:e},m);if(e.key===`ArrowRight`)return e.preventDefault(),p(e=>{let t=n.find(t=>t.range[0]<=e&&t.range[1]>e);if(!t)return e;let r=n[n.indexOf(t)+1];return r?r.range[0]:e},m);e.key===`Enter`&&(e.preventDefault(),h(l.value))},_=e=>t=>{let n=u.value;if(!n)return;let{x:r,y:i}=t;(r!==n.x||i!==n.y)&&p(e)};return te(()=>{t.value?window.addEventListener(`keydown`,g,{capture:!0}):window.removeEventListener(`keydown`,g,{capture:!0})}),a(()=>{window.removeEventListener(`keydown`,g,{capture:!0})}),()=>f(`div`,{ref:s,onPointerdown:e=>e.preventDefault()},f(`nav`,{class:`tab-group`},f(`ul`,null,c.value.groups.map(e=>f(`li`,{key:e.key,onPointerdown:()=>p(e.range[0],m),class:l.value>=e.range[0]&&l.value<e.range[1]?`selected`:``},e.label)))),f(`div`,{class:`menu-groups`,onPointermove:d},c.value.groups.map(e=>f(`div`,{key:e.key,class:`menu-group`},f(`h6`,null,e.label),f(`ul`,null,e.items.map(e=>f(`li`,{key:e.key,"data-index":e.index,class:l.value===e.index?`hover`:``,onPointerenter:_(e.index),onPointerdown:()=>{var t;(t=s.value?.querySelector(`[data-index="${e.index}"]`))==null||t.classList.add(`active`)},onPointerup:()=>{var t;(t=s.value?.querySelector(`[data-index="${e.index}"]`))==null||t.classList.remove(`active`),h(e.index)}},f(xT,{icon:e.icon}),f(`span`,null,e.label))))))))}}),e$=e=>{throw TypeError(e)},t$=(e,t,n)=>t.has(e)||e$(`Cannot `+n),n$=(e,t,n)=>(t$(e,t,`read from private field`),n?n.call(e):t.get(e)),r$=(e,t,n)=>t.has(e)?e$(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),i$=(e,t,n,r)=>(t$(e,t,`write to private field`),t.set(e,n),n),a$,o$,s$,c$,l$,u$=nO(`CREPE_MENU`),d$=xx({show:()=>{},hide:()=>{}},`menuAPICtx`);function f$(e,t){e.set(u$.key,{view:n=>new p$(e,n,t)})}var p$=class{constructor(e,t,n){r$(this,a$),r$(this,o$),r$(this,s$),r$(this,c$),r$(this,l$,null),this.update=e=>{n$(this,c$).update(e)},this.show=e=>{i$(this,l$,e),n$(this,s$).value=``,n$(this,c$).show()},this.hide=()=>{i$(this,l$,null),n$(this,c$).hide()},this.destroy=()=>{n$(this,c$).destroy(),n$(this,o$).unmount(),n$(this,a$).remove()};let r=document.createElement(`div`);r.classList.add(`milkdown-slash-menu`);let i=S(!1),a=S(``);i$(this,s$,a);let o=this.hide,s=re($Q,{ctx:e,config:n,show:i,filter:a,hide:o});i$(this,o$,s),s.mount(r),i$(this,a$,r);let c=this,l=n?.slashMenu??{};i$(this,c$,new rO({content:n$(this,a$),debounce:20,shouldShow(e){if(HQ(e.state.selection)||UQ(e.state.selection))return!1;let t=this.getContent(e,e=>[`paragraph`,`heading`].includes(e.type.name));if(t==null||!m$(e.state.selection))return!1;let n=n$(c,l$);if(a.value=t.startsWith(`/`)?t.slice(1):t,typeof n==`number`){let t=e.state.doc.nodeSize-2,r=Math.min(n,t);return e.state.doc.resolve(r).node()===e.state.doc.resolve(e.state.selection.from).node()||(i$(c,l$,null),!1)}return!!t.startsWith(`/`)},offset:l.offset??10,middleware:l.middleware,floatingUIOptions:l.floatingUIOptions,root:l.root})),n$(this,c$).onShow=()=>{i.value=!0},n$(this,c$).onHide=()=>{i.value=!1},this.update(t),e.set(d$.key,{show:e=>this.show(e),hide:()=>this.hide()})}};a$=new WeakMap,o$=new WeakMap,s$=new WeakMap,c$=new WeakMap,l$=new WeakMap;function m$(e){if(!(e instanceof N))return!1;let{$head:t}=e,n=t.parent;return t.parentOffset===n.content.size}var h$=d({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(e){let t=S();return()=>f(C,null,f(`div`,{ref:t,class:`operation-item`,onPointerdown:e=>{var n;e.preventDefault(),e.stopPropagation(),(n=t.value)==null||n.classList.add(`active`)},onPointerup:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=t.value)==null||r.classList.remove(`active`),e.onAdd()}},f(xT,{icon:e.addIcon})),f(`div`,{class:`operation-item`},f(xT,{icon:e.handleIcon})))}}),g$=e=>{throw TypeError(e)},_$=(e,t,n)=>t.has(e)||g$(`Cannot `+n),v$=(e,t,n)=>(_$(e,t,`read from private field`),n?n.call(e):t.get(e)),y$=(e,t,n)=>t.has(e)?g$(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),b$=(e,t,n,r)=>(_$(e,t,`write to private field`),t.set(e,n),n),x$,S$,C$,w$,T$=class{constructor(e,t){y$(this,x$),y$(this,S$),y$(this,C$),y$(this,w$),this.update=()=>{v$(this,S$).update()},this.destroy=()=>{v$(this,S$).destroy(),v$(this,x$).remove(),v$(this,C$).unmount()},this.onAdd=()=>{let e=v$(this,w$),t=e.get(Qy);t.hasFocus()||t.focus();let{state:n,dispatch:r}=t,i=v$(this,S$).active;if(!i)return;let a=i.$pos.pos+i.node.nodeSize,o=n.tr.insert(a,DE.type(e).create());o=o.setSelection(N.near(o.doc.resolve(a))),r(o.scrollIntoView()),v$(this,S$).hide(),e.get(d$.key).show(o.selection.from)},b$(this,w$,e);let n=document.createElement(`div`);n.classList.add(`milkdown-block-handle`);let r=re(h$,{onAdd:this.onAdd,addIcon:t?.handleAddIcon??EX,handleIcon:t?.handleDragIcon??wX});r.mount(n),b$(this,C$,r),b$(this,x$,n);let i=t?.blockHandle??{};b$(this,S$,new MT({ctx:e,content:n,getOffset:i.getOffset??(()=>16),getPlacement:i.getPlacement??(({active:e,blockDom:t})=>{if(e.node.type.name===`heading`)return`left`;let n=0;e.node.descendants(e=>{n+=e.childCount});let r=e.el,i=r.getBoundingClientRect(),a=t.getBoundingClientRect(),o=window.getComputedStyle(r),s=Number.parseInt(o.paddingTop,10)||0,c=Number.parseInt(o.paddingBottom,10)||0,l=i.height-s-c,u=a.height;return n>2||u<l?`left-start`:`left`}),shouldShow:i.shouldShow,getPosition:i.getPosition,middleware:i.middleware,floatingUIOptions:i.floatingUIOptions,root:i.root})),this.update()}};x$=new WeakMap,S$=new WeakMap,C$=new WeakMap,w$=new WeakMap;function E$(e,t){e.set(CT.key,{filterNodes:e=>!ih(e=>[`table`,`blockquote`,`math_inline`].includes(e.type.name))(e)}),e.set(NT.key,{view:()=>new T$(e,t)})}var D$=(e,t)=>{e.config(KX(UY.BlockEdit)).config(e=>E$(e,t)).config(e=>f$(e,t)).use(d$).use(NT).use(u$)},O$=(e,t={})=>{e.config(KX(UY.CodeMirror)).config(e=>{let{languages:n=[],theme:r}=t,i=[Ne.of(bI.concat(xI)),sz];r&&i.push(r),t.extensions&&i.push(...t.extensions),e.update($I.key,e=>({extensions:i,languages:n,expandIcon:t.expandIcon||tX,searchIcon:t.searchIcon||AX,clearSearchIcon:t.clearSearchIcon||iX,searchPlaceholder:t.searchPlaceholder||`Search language`,copyText:t.copyText||`Copy`,copyIcon:t.copyIcon||cX,onCopy:t.onCopy||(()=>{}),noResultText:t.noResultText||`No result`,renderLanguage:t.renderLanguage||e.renderLanguage,renderPreview:t.renderPreview||e.renderPreview,previewToggleButton:e=>[t.previewToggleIcon?.call(t,e)||(e?dX:BX),t.previewToggleText?.call(t,e)||(e?`Edit`:`Hide`)].map(e=>e.trim()).join(` `),previewLabel:t.previewLabel||e.previewLabel,previewLoading:t.previewLoading||e.previewLoading,previewOnlyByDefault:t.previewOnlyByDefault??e.previewOnlyByDefault}))}).use(xL)},k$=(e,t)=>{if(e.config(KX(UY.Cursor)).config(e=>{e.update(Mz.key,()=>({class:`crepe-drop-cursor`,width:t?.width??4,color:t?.color??!1}))}).use(Rz),t?.virtual===!1)return;let n=zz({skipWarning:[`inlineCode`]});e.use(vx(()=>n))},A$=(e,t)=>{e.config(KX(UY.ImageBlock)).config(e=>{e.update(eB.key,e=>({uploadButton:t?.inlineUploadButton??`Upload`,imageIcon:t?.inlineImageIcon??bX,confirmButton:t?.inlineConfirmButton??sX,uploadPlaceholderText:t?.inlineUploadPlaceholderText??`or paste link`,onUpload:t?.inlineOnUpload??t?.onUpload??e.onUpload,proxyDomURL:t?.proxyDomURL})),e.update(dO.key,e=>({uploadButton:t?.blockUploadButton??`Upload file`,imageIcon:t?.blockImageIcon??bX,captionIcon:t?.blockCaptionIcon??QY,confirmButton:t?.blockConfirmButton??`Confirm`,captionPlaceholderText:t?.blockCaptionPlaceholderText??`Write Image Caption`,uploadPlaceholderText:t?.blockUploadPlaceholderText??`or paste link`,onUpload:t?.blockOnUpload??t?.onUpload??e.onUpload,proxyDomURL:t?.proxyDomURL,onImageLoadError:t?.onImageLoadError??e.onImageLoadError,maxWidth:t?.maxWidth,maxHeight:t?.maxHeight}))}).use(FO).use(sB)},j$=KE.extendSchema(e=>t=>{let n=e(t);return{...n,toMarkdown:{match:n.toMarkdown.match,runner:(e,t)=>{if((t.attrs.language??``).toLowerCase()===`latex`)e.addNode(`math`,void 0,t.content.firstChild?.text||``);else return n.toMarkdown.runner(e,t)}}}}),M$=`math_inline`,N$=`ToggleLatex`,P$=Sx(M$,()=>({group:`inline`,inline:!0,draggable:!0,atom:!0,attrs:{value:{default:``}},parseDOM:[{tag:`span[data-type="${M$}"]`,getAttrs:e=>({value:e.dataset.value??``})}],toDOM:e=>{let t=e.attrs.value,n=document.createElement(`span`);return n.dataset.type=M$,n.dataset.value=t,vK.render(t,n,{throwOnError:!1}),n},parseMarkdown:{match:e=>e.type===`inlineMath`,runner:(e,t,n)=>{e.addNode(n,{value:t.value})}},toMarkdown:{match:e=>e.type.name===M$,runner:(e,t)=>{e.addNode(`inlineMath`,void 0,t.attrs.value)}}})),F$=L(`ToggleLatex`,e=>()=>(t,n)=>{let{hasNode:r,pos:i,target:a}=uh(t,P$.type(e)),{selection:o,doc:s,tr:c}=t;if(!r){let t=s.textBetween(o.from,o.to),r=c.replaceSelectionWith(P$.type(e).create({value:t}));return n&&n(r.setSelection(P.create(r.doc,o.from))),!0}let{from:l,to:u}=o;if(!a||i<0)return!1;let d=c.delete(i,i+1),f=a.attrs.value;return d=d.insertText(f,i),n&&n(d.setSelection(N.create(d.doc,l,u+f.length-1))),!0}),I$=vT(`INLINE_LATEX`),L$=d({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(e){let t=t=>{if(t&&t instanceof HTMLElement){for(;t.firstChild;)t.removeChild(t.firstChild);e.innerView.value&&t.appendChild(e.innerView.value.dom)}},n=t=>{t.preventDefault(),e.updateValue.value()};return()=>f(`div`,{class:`container`},e.innerView.value&&f(`div`,{ref:t}),f(`button`,{type:`button`,onPointerdown:n},f(xT,{icon:e.config.inlineEditConfirm})))}}),R$=e=>{throw TypeError(e)},z$=(e,t,n)=>t.has(e)||R$(`Cannot `+n),B$=(e,t,n)=>(z$(e,t,`read from private field`),n?n.call(e):t.get(e)),V$=(e,t,n)=>t.has(e)?R$(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),H$=(e,t,n,r)=>(z$(e,t,`write to private field`),t.set(e,n),n),U$,W$,G$,K$,q$,J$,Y$,X$,Z$=class{constructor(e,t,n){this.ctx=e,V$(this,U$),V$(this,W$),V$(this,G$),V$(this,K$,m(null)),V$(this,q$,m(()=>{})),V$(this,J$),V$(this,Y$,()=>{B$(this,K$).value&&(B$(this,K$).value.destroy(),B$(this,K$).value=null)}),V$(this,X$,e=>{let t=(()=>{if(!e.editable)return!1;let{selection:t,schema:n}=e.state;if(t.empty||!(t instanceof P))return!1;let r=t.node;if(r.type.name!==M$)return!1;let i=t.from,a=n.nodes.paragraph.create(null,n.text(r.attrs.value)),o=new Hy(B$(this,G$),{state:Cp.create({doc:a,schema:new yd({nodes:{doc:{content:`block+`},paragraph:{content:`inline*`,group:`block`,parseDOM:[{tag:`p`}],toDOM(){return[`p`,0]}},text:{group:`inline`}}}),plugins:[gh({"Mod-z":WI,"Mod-Z":GI,"Mod-y":GI,Enter:()=>(B$(this,q$).value(),!0)})]})});return B$(this,K$).value=o,B$(this,q$).value=()=>{let{tr:t}=e.state;t.setNodeAttribute(i,`value`,o.state.doc.textContent),e.dispatch(t),requestAnimationFrame(()=>{e.focus()})},!0})();return t||B$(this,Y$).call(this),t}),this.update=(e,t)=>{B$(this,W$).update(e,t)},this.destroy=()=>{B$(this,J$).unmount(),B$(this,W$).destroy(),B$(this,U$).remove()};let r=document.createElement(`div`);r.className=`milkdown-latex-inline-edit`,H$(this,U$,r),H$(this,J$,re(L$,{config:n,innerView:B$(this,K$),updateValue:B$(this,q$)})),B$(this,J$).mount(r),H$(this,W$,new _T({debounce:0,content:B$(this,U$),shouldShow:B$(this,X$),offset:10,floatingUIOptions:{placement:`bottom`}})),B$(this,W$).update(t),H$(this,G$,document.createElement(`div`))}};U$=new WeakMap,W$=new WeakMap,G$=new WeakMap,K$=new WeakMap,q$=new WeakMap,J$=new WeakMap,Y$=new WeakMap,X$=new WeakMap;var Q$=mx(e=>Um(/(?:\$)([^$]+)(?:\$)$/,P$.type(e),{getAttr:e=>({value:e[1]??``})})),$$=mx(e=>hm(/^\$\$[\s\n]$/,KE.type(e),()=>({language:`LaTeX`}))),e1=Dx(`remarkMath`,()=>AK);function t1(e){return _c(e,`math`,(e,t,n)=>{let{value:r}=e,i={type:`code`,lang:`LaTeX`,value:r};n.children.splice(t,1,i)})}var n1=Dx(`remarkMathBlock`,()=>()=>t1),r1=(e,t)=>{e.config(KX(UY.Latex)).config(e=>{if(!GX(e).get().includes(UY.CodeMirror))throw Error(`You need to enable CodeMirror to use LaTeX feature`);e.update($I.key,e=>({...e,renderPreview:(n,r,i)=>{if(n.toLowerCase()===`latex`&&r.length>0)return i1(r,t?.katexOptions);let a=e.renderPreview;return a(n,r,i)}})),e.set(I$.key,{view:n=>new Z$(e,n,{inlineEditConfirm:t?.inlineEditConfirm??sX,...t})})}).use(e1).use(n1).use(P$).use(I$).use(Q$).use($$).use(j$).use(F$)};function i1(e,t){return vK.renderToString(e,{...t,throwOnError:!1,displayMode:!0})}var a1=(e,t)=>{e.config(KX(UY.LinkTooltip)).config(cJ).config(e=>{e.update(KK.key,e=>({...e,linkIcon:t?.linkIcon??cX,editButton:t?.editButton??dX,removeButton:t?.removeButton??OX,confirmButton:t?.confirmButton??sX,inputPlaceholder:t?.inputPlaceholder??`Paste link...`,onCopyLink:t?.onCopyLink??(()=>{})}))}).use(lJ)};function o1(e,t){e.set(_J.key,{renderLabel:({label:e,listType:n,checked:r})=>r==null?n===`bullet`?t?.bulletIcon??XY:e:r?t?.checkBoxCheckedIcon??$Y:t?.checkBoxUncheckedIcon??eX})}var s1=(e,t)=>{e.config(KX(UY.ListItem)).config(e=>o1(e,t)).use(CJ)};function c1(e){return e.childCount<=1&&!e.firstChild?.content.size}function l1(e,t){let{selection:n}=e;if(!n.empty)return null;let r=n.$anchor,i=r.parent;if(i.content.size>0||ih(e=>e.type.name===`table`)(r))return null;let a=r.before();return ay.node(a,a+i.nodeSize,{class:`crepe-placeholder`,"data-placeholder":t})}var u1=xx({text:`Please enter...`,mode:`block`},`placeholderConfigCtx`),d1=vx(e=>new Tp({key:new Op(`CREPE_PLACEHOLDER`),props:{decorations:t=>{if(WX(e).readonly)return null;let n=e.get(u1.key);if(n.mode===`doc`&&!c1(t.doc)||HQ(t.selection)||UQ(t.selection))return null;let r=l1(t,n.text??`Please enter...`);return r?cy.create(t.doc,[r]):null}}})),f1=(e,t)=>{e.config(KX(UY.Placeholder)).config(e=>{t&&e.update(u1.key,e=>({...e,...t}))}).use(d1).use(u1)},p1=(e,t)=>{e.config(KX(UY.Table)).config(e=>{e.update(IJ.key,e=>({...e,renderButton:e=>{switch(e){case`add_row`:return t?.addRowIcon??EX;case`add_col`:return t?.addColIcon??EX;case`delete_row`:return t?.deleteRowIcon??OX;case`delete_col`:return t?.deleteColIcon??OX;case`align_col_left`:return t?.alignLeftIcon??qY;case`align_col_center`:return t?.alignCenterIcon??KY;case`align_col_right`:return t?.alignRightIcon??JY;case`col_drag_handle`:return t?.colDragHandleIcon??uX;case`row_drag_handle`:return t?.rowDragHandleIcon??uX}}}))}).use(gY)};function m1(e,t){return{slice:e,entry:t}}function h1(e){if(e===` `||e.toLowerCase()===`space`)return{display:`Space`,aria:` `};if(e.length===1){let t=e.toUpperCase();return{display:t,aria:t}}return{display:e,aria:e}}function g1(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1]??``,i=n.slice(0,-1),a=!1,o=!1,s=!1,c=!1;for(let e of i)switch(e.toLowerCase()){case`mod`:t?a=!0:o=!0;break;case`meta`:case`cmd`:case`m`:a=!0;break;case`ctrl`:case`control`:case`c`:o=!0;break;case`alt`:case`option`:case`a`:s=!0;break;case`shift`:case`s`:c=!0}let l=h1(r);return{display:t?[o&&`⌃`,s&&`⌥`,c&&`⇧`,a&&`⌘`,l.display].filter(Boolean).join(``):[o&&`Ctrl`,s&&`Alt`,c&&`Shift`,a&&`Meta`,l.display].filter(Boolean).join(`+`),aria:[a&&`Meta`,o&&`Control`,s&&`Alt`,c&&`Shift`,l.aria].filter(Boolean).join(`+`)}}function _1(e,t){if(!e.isInjected(t.slice))return;let n=e.get(t.slice)[t.entry],r=n?[n.shortcuts].flat()[0]:void 0;if(r)return g1(r,Fm.mac)}function v1(e,t){var n;let r=new ZQ;r.addGroup(`formatting`,`Formatting`).addItem(`bold`,{icon:e?.boldIcon??YY,label:e?.boldLabel??`Bold`,keymap:m1(rE.key,`ToggleBold`),active:e=>e.get(I).call(MD.key,eE.type(e)),onRun:e=>{e.get(I).call(tE.key)}}).addItem(`italic`,{icon:e?.italicIcon??xX,label:e?.italicLabel??`Italic`,keymap:m1(QT.key,`ToggleEmphasis`),active:e=>e.get(I).call(MD.key,JT.type(e)),onRun:e=>{e.get(I).call(YT.key)}}).addItem(`strikethrough`,{icon:e?.strikethroughIcon??PX,label:e?.strikethroughLabel??`Strikethrough`,keymap:m1(QM.key,`ToggleStrikethrough`),active:e=>e.get(I).call(MD.key,YM.type(e)),onRun:e=>{e.get(I).call(XM.key)}});let i=r.addGroup(`function`,`Function`);i.addItem(`code`,{icon:e?.codeIcon??aX,label:e?.codeLabel??`Inline code`,keymap:m1(cE.key,`ToggleInlineCode`),active:e=>e.get(I).call(MD.key,aE.type(e)),onRun:e=>{e.get(I).call(oE.key)}});let a=t&&GX(t).get();if(a?.includes(UY.Latex)&&i.addItem(`latex`,{icon:e?.latexIcon??zX,label:e?.latexLabel??`Inline math`,active:e=>{let t=e.get(I),n=e.get(hb).nodes[M$];return t.call(ND.key,n)},onRun:e=>{e.get(I).call(N$)}}),i.addItem(`link`,{icon:e?.linkIcon??SX,label:e?.linkLabel??`Link`,active:e=>e.get(I).call(MD.key,mE.type(e)),onRun:e=>{e.get(I).call(qK.key)}}),t&&a?.includes(UY.AI)){let n=t.get(JX.key);n.provider&&i.addItem(`ai`,{icon:e?.aiIcon??n.aiIcon??GY,label:e?.aiLabel??`Ask AI`,active:()=>!1,onRun:e=>{let t=e.get(lQ.key),{from:n,to:r}=e.get(Qy).state.selection;t.show(n,r)}})}(n=e?.buildToolbar)==null||n.call(e,r);let o=r.build();if(t)for(let e of o)for(let n of e.items){if(!n.keymap)continue;let e=_1(t,n.keymap);e&&(n.shortcut??=e.display,n.ariaKeyshortcuts??=e.aria)}return o}var y1=d({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(e){let{ctx:t,config:n}=e,r=e=>n=>{n.preventDefault(),t&&e?.(t)};function i(n){return e.selection.value,t.get(tb).status===cx.Created&&n(t)}let a=w(()=>v1(n,t));function o(e){if(e.label)return e.shortcut?`${e.label} (${e.shortcut})`:e.label}return()=>f(C,null,a.value.map(e=>e.items.map(e=>f(`button`,{type:`button`,class:bT(`toolbar-item`,t&&i(e.active)&&`active`),"data-toolbar-item":e.key,title:o(e),"aria-label":e.label,"aria-keyshortcuts":e.ariaKeyshortcuts,onPointerdown:r(e.onRun)},f(xT,{icon:e.icon})))).reduce((e,t,n)=>(n===0?e.push(...t):e.push(f(`div`,{class:`divider`}),...t),e),[]))}}),b1=e=>{throw TypeError(e)},x1=(e,t,n)=>t.has(e)||b1(`Cannot `+n),S1=(e,t,n)=>(x1(e,t,`read from private field`),n?n.call(e):t.get(e)),C1=(e,t,n)=>t.has(e)?b1(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),w1=(e,t,n,r)=>(x1(e,t,`write to private field`),t.set(e,n),n),T1,E1,D1,O1,k1,A1=vT(`CREPE_TOOLBAR`),j1=class{constructor(e,t,n){C1(this,T1),C1(this,E1),C1(this,D1),C1(this,O1),C1(this,k1,S(!1)),this.update=(e,t)=>{S1(this,T1).update(e,t),S1(this,O1).value=e.state.selection},this.destroy=()=>{S1(this,T1).destroy(),S1(this,D1).unmount(),S1(this,E1).remove()},this.hide=()=>{S1(this,T1).hide()};let r=document.createElement(`div`);r.className=`milkdown-toolbar`,w1(this,O1,m(t.state.selection));let i=re(y1,{ctx:e,hide:this.hide,config:n,selection:S1(this,O1),show:S1(this,k1)});i.mount(r),w1(this,E1,r),w1(this,D1,i),w1(this,T1,new _T({content:S1(this,E1),debounce:20,offset:10,shouldShow(e){let{doc:t,selection:n}=e.state,{empty:i,from:a,to:o}=n,s=!t.textBetween(a,o).length&&n instanceof N,c=!(n instanceof N),l=e.dom.getRootNode().activeElement,u=r.contains(l),d=!e.hasFocus()&&!u,f=!e.editable;return!(d||c||i||s||f)}})),S1(this,T1).onShow=()=>{S1(this,k1).value=!0},S1(this,T1).onHide=()=>{S1(this,k1).value=!1},this.update(t)}};T1=new WeakMap,E1=new WeakMap,D1=new WeakMap,O1=new WeakMap,k1=new WeakMap;var M1=(e,t)=>{e.config(KX(UY.Toolbar)).config(e=>{e.set(A1.key,{view:n=>new j1(e,n,t)})}).use(A1)},N1=[{label:`Paragraph`,level:null},{label:`Heading 1`,level:1},{label:`Heading 2`,level:2},{label:`Heading 3`,level:3},{label:`Heading 4`,level:4},{label:`Heading 5`,level:5},{label:`Heading 6`,level:6}];function P1(e,t){let n=t??N1,{$from:r}=e.get(Qy).state.selection,i=r.parent,a=n.find(e=>e.level===null)??n[0];if(i.type===FE.type(e)){let e=i.attrs.level;return n.find(t=>t.level===e)??a}return a}function F1(e,t){let n=e.get(I);if(t==null){let t=DE.type(e);n.call(FD.key,{nodeType:t})}else{let r=FE.type(e);n.call(FD.key,{nodeType:r,attrs:{level:t}})}}function I1(e,t){if(e.get(I).call(MD.key,t))return!0;let{state:n}=e.get(Qy);if(n.storedMarks)return n.storedMarks.some(e=>e.type===t);if(n.selection instanceof N){let{$cursor:e}=n.selection;if(e)return e.marks().some(e=>e.type===t)}return!1}function L1(e,t){let n=e??N1;return{icon:``,active:()=>!1,selector:{chevronIcon:t??tX,activeLabel:e=>P1(e,n).label,options:n.map(e=>({label:e.label,onSelect:t=>F1(t,e.level)}))}}}function R1(e,t){var n;let r=t&&GX(t).get(),i=r?.includes(UY.Latex),a=r?.includes(UY.ImageBlock),o=r?.includes(UY.Table),s=new ZQ;s.addGroup(`heading`,`Heading`).addItem(`heading-selector`,{...L1(e?.headingOptions,e?.chevronDownIcon)}),s.addGroup(`formatting`,`Formatting`).addItem(`bold`,{icon:e?.boldIcon??YY,active:e=>I1(e,eE.type(e)),onRun:e=>{e.get(I).call(tE.key)}}).addItem(`italic`,{icon:e?.italicIcon??xX,active:e=>I1(e,JT.type(e)),onRun:e=>{e.get(I).call(YT.key)}}).addItem(`strikethrough`,{icon:e?.strikethroughIcon??PX,active:e=>I1(e,YM.type(e)),onRun:e=>{e.get(I).call(XM.key)}}).addItem(`code`,{icon:e?.codeIcon??aX,active:e=>I1(e,aE.type(e)),onRun:e=>{let t=e.get(Qy),{state:n}=t;if(n.selection.empty){let r=aE.type(e);I1(e,r)?t.dispatch(n.tr.removeStoredMark(r)):t.dispatch(n.tr.addStoredMark(r.create()))}else e.get(I).call(oE.key)}}),s.addGroup(`list`,`List`).addItem(`bullet-list`,{icon:e?.bulletListIcon??ZY,active:()=>!1,onRun:e=>{let t=e.get(I),n=lD.type(e);t.call(ID.key,{nodeType:n})}}).addItem(`ordered-list`,{icon:e?.orderedListIcon??TX,active:()=>!1,onRun:e=>{let t=e.get(I),n=mD.type(e);t.call(ID.key,{nodeType:n})}}).addItem(`task-list`,{icon:e?.taskListIcon??LX,active:()=>!1,onRun:e=>{let t=e.get(I),n=yD.type(e);t.call(ID.key,{nodeType:n,attrs:{checked:!1}})}});let c=s.addGroup(`insert`,`Insert`);c.addItem(`link`,{icon:e?.linkIcon??SX,active:e=>I1(e,mE.type(e)),onRun:e=>{let t=e.get(Qy),{state:n}=t,r=mE.type(e);if(n.selection.empty&&I1(e,r)){t.dispatch(n.tr.removeStoredMark(r));return}e.get(I).call(qK.key)}}),a&&c.addItem(`image`,{icon:e?.imageIcon??bX,active:()=>!1,onRun:e=>{let t=e.get(I),n=xO.type(e);t.call(LD.key,{nodeType:n})}}),o&&c.addItem(`table`,{icon:e?.tableIcon??FX,active:()=>!1,onRun:e=>{let t=e.get(I),{from:n}=e.get(Qy).state.selection;t.call(LD.key,{nodeType:oN(e,3,3)}),t.call(RD.key,{pos:n})}});let l=s.addGroup(`block`,`Block`);return l.addItem(`code-block`,{icon:e?.codeBlockIcon??oX,active:()=>!1,onRun:e=>{let t=e.get(I),n=KE.type(e);t.call(FD.key,{nodeType:n})}}),i&&l.addItem(`math`,{icon:e?.mathIcon??zX,active:()=>!1,onRun:e=>{let t=e.get(I),n=KE.type(e);t.call(LD.key,{nodeType:n,attrs:{language:`LaTeX`}})}}),s.addGroup(`more`,`More`).addItem(`quote`,{icon:e?.quoteIcon??DX,active:()=>!1,onRun:e=>{let t=e.get(I),n=VE.type(e);t.call(ID.key,{nodeType:n})}}).addItem(`hr`,{icon:e?.hrIcon??lX,active:()=>!1,onRun:e=>{let t=e.get(I),n=aD.type(e);t.call(LD.key,{nodeType:n})}}),(n=e?.buildTopBar)==null||n.call(e,s),s.build()}var z1=d({props:{ctx:{type:Object,required:!0},version:{type:Object,required:!0},config:{type:Object,required:!1}},setup(e){let{ctx:t,config:n}=e,r=S(null),i=e=>n=>{n.preventDefault(),t&&e(t)};function o(){return t.get(tb).status===cx.Created}function s(){e.version.value}function c(e){return s(),o()?e(t):!1}function l(e){return s(),o()?e.activeLabel(t):e.options[0]?.label??``}function u(e,t){t.preventDefault(),t.stopPropagation(),r.value=r.value===e?null:e}let d=e=>{e.target.closest(`.top-bar-heading-selector`)||(r.value=null)};v(()=>{window.addEventListener(`pointerdown`,d)}),a(()=>{window.removeEventListener(`pointerdown`,d)});let p=w(()=>R1(n,t));function m(e,n){let i=r.value===e,a=l(n);return f(`div`,{key:e,class:`top-bar-heading-selector`},f(`button`,{type:`button`,class:`top-bar-heading-button`,onPointerdown:t=>u(e,t)},f(`span`,{class:`top-bar-heading-label`},a),n.chevronIcon&&f(`span`,{class:`top-bar-chevron`},f(xT,{icon:n.chevronIcon}))),i&&f(`div`,{class:`top-bar-heading-dropdown`},n.options.map((n,i)=>f(`button`,{key:`${e}-${i}`,type:`button`,class:bT(`top-bar-heading-option`,a===n.label&&`active`),onPointerdown:e=>{e.preventDefault(),e.stopPropagation(),r.value=null,n.onSelect(t)}},n.label))))}function h(e){return f(`button`,{key:e.key,type:`button`,class:bT(`top-bar-item`,c(e.active)&&`active`),onPointerdown:i(e.onRun)},f(xT,{icon:e.icon}))}return()=>{let e=o()?t.get(Qy):null;return e&&!e.editable?null:f(`div`,{class:`top-bar-inner`},p.value.map(e=>e.items.map(e=>e.selector?m(e.key,e.selector):e.onRun?h(e):null)).reduce((e,t,n)=>{if(n===0)e.push(...t);else{let r=p.value[n]?.key??n;e.push(f(`div`,{key:`divider-${r}`,class:`top-bar-divider`}),...t)}return e},[]))}}}),B1=e=>{throw TypeError(e)},V1=(e,t,n)=>t.has(e)||B1(`Cannot `+n),H1=(e,t,n)=>(V1(e,t,`read from private field`),n?n.call(e):t.get(e)),U1=(e,t,n)=>t.has(e)?B1(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),W1=(e,t,n,r)=>(V1(e,t,`write to private field`),t.set(e,n),n),G1,K1,q1,J1=new Op(`CREPE_TOP_BAR`),Y1=class{constructor(e,t,n){U1(this,G1),U1(this,K1),U1(this,q1),this.update=(e,t)=>{H1(this,G1).style.display=e.editable?``:`none`,H1(this,q1).value++},this.destroy=()=>{H1(this,K1).unmount(),H1(this,G1).remove()},W1(this,q1,S(0));let r=document.createElement(`div`);r.className=`milkdown-top-bar`;let i=re(z1,{ctx:e,config:n,version:H1(this,q1)});i.mount(r),W1(this,G1,r),W1(this,K1,i);let a=t.dom.parentElement;a&&a.insertBefore(r,a.firstChild),this.update(t)}};G1=new WeakMap,K1=new WeakMap,q1=new WeakMap;var X1=xx({view:()=>({update:()=>{},destroy:()=>{}})},`topBarConfig`),Z1=vx(e=>new Tp({key:J1,view:e.get(X1.key).view})),Q1=(e,t)=>{e.config(KX(UY.TopBar)).config(e=>{e.set(X1.key,{view:n=>new Y1(e,n,t)})}).use(X1).use(Z1)};function $1(e,t,n){switch(e){case UY.CodeMirror:return O$(t,n);case UY.ListItem:return s1(t,n);case UY.LinkTooltip:return a1(t,n);case UY.ImageBlock:return A$(t,n);case UY.Cursor:return k$(t,n);case UY.BlockEdit:return D$(t,n);case UY.Placeholder:return f1(t,n);case UY.Toolbar:return M1(t,n);case UY.Table:return p1(t,n);case UY.Latex:return r1(t,n);case UY.TopBar:return Q1(t,n);case UY.AI:return VQ(t,n)}}var e0=e=>{throw TypeError(e)},t0=(e,t,n)=>t.has(e)||e0(`Cannot `+n),n0=(e,t,n)=>(t0(e,t,`read from private field`),n?n.call(e):t.get(e)),r0=(e,t,n)=>t.has(e)?e0(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),i0=(e,t,n,r)=>(t0(e,t,`write to private field`),t.set(e,n),n),a0,o0,s0,c0=class{constructor({root:e,defaultValue:t=``}={}){r0(this,a0),r0(this,o0),r0(this,s0,!0),this.addFeature=(e,t)=>(e(n0(this,a0),t),this),this.create=()=>n0(this,a0).create(),this.destroy=()=>n0(this,a0).destroy(),this.setReadonly=e=>(i0(this,s0,!e),n0(this,a0).action(t=>{n0(this,a0).status===cx.Created&&t.get(Qy).setProps({editable:()=>!e})}),this),this.getMarkdown=()=>n0(this,a0).action(Ox()),this.on=e=>n0(this,a0).status===cx.Created?(n0(this,a0).action(t=>{e(t.get(NY))}),this):(n0(this,a0).config(t=>{e(t.get(NY))}),this),i0(this,o0,(typeof e==`string`?document.querySelector(e):e)??document.body),i0(this,a0,lx.make().config(e=>{e.inject(UX,this),e.inject(HX,[])}).config(e=>{e.set(tx,n0(this,o0)),e.set(Vb,t),e.set(ex,{editable:()=>n0(this,s0)}),e.update(kY.key,e=>({...e,size:4})),e.update(BY.key,e=>({...e,uploader:async(e,t,n)=>{let r=GX(n).get().includes(UY.ImageBlock),i=r?t.nodes[`image-block`]:t.nodes.image;if(!i)return[];let a=r?n.get(dO.key).onUpload:void 0,o=[];for(let t=0;t<e.length;t++){let n=e.item(t);n&&n.type.includes(`image`)&&o.push(n)}return await Promise.all(o.map(async e=>{let t=a?await a(e):URL.createObjectURL(e);return i.createAndFill({src:t})}))}}))}).use(tO).use(FY).use(DY).use(jY).use(RY).use(bY).use(HY).use(XN))}get editor(){return n0(this,a0)}get readonly(){return!n0(this,s0)}};a0=new WeakMap,o0=new WeakMap,s0=new WeakMap;var l0=class extends c0{constructor({features:e={},featureConfigs:t={},...n}={}){super(n);let r=Ar(t,VX);Object.entries({...WY,...e}).filter(([,e])=>e).map(([e])=>e).forEach(e=>{let t=r[e];$1(e,this.editor,t)})}};l0.Feature=UY;function u0(e,t){e.config(e=>{e.update(BY.key,e=>({...e,uploader:async(e,n)=>{try{let r=Array.from(e).filter(e=>e.type.startsWith(`image/`)),i=await Promise.all(r.map(async e=>{let t=await Nt.uploadAsset(e);return n.nodes.image.create({src:t.url,alt:e.name})}));return t.disposed()||t.error(``),t.disposed()?[]:i}catch(e){return t.disposed()||t.error(Et(e)),[]}}}))}),e.use(mE.extendSchema(e=>t=>({...e(t),inclusive:!1}))),e.use(DE.extendSchema(e=>t=>{let n=e(t);return{...n,toMarkdown:{...n.toMarkdown,runner:(e,t)=>{t.content.size===0?e.openNode(`paragraph`).closeNode():n.toMarkdown.runner(e,t)}}}}))}function d0(e,t,n){let r=S(``),i,a=!1,s=!1,c;function l(){return s=!1,c??=i?.destroy().catch(e=>{a||(r.value=Et(e))}),c}function u(){return s&&i?i.editor.action(e=>e.get(Qy)):void 0}return v(async()=>{let o=g(e);if(!o)return;let c=g(t);if(kt(c)){n.unsupported();return}let u=At(c);try{let e=new l0({root:o,defaultValue:u,featureConfigs:{[l0.Feature.Toolbar]:{buildToolbar(e){for(let t of e.build()){let e=t.items.find(e=>e.key===`link`);e&&(e.onRun=n.link)}}}},features:{[l0.Feature.Latex]:!1,[l0.Feature.ImageBlock]:!1}});i=e,u0(e.editor,{disposed:()=>a,error:e=>{r.value=e}}),e.editor.use(vx(e=>new Tp({props:{handleKeyDown:n.keydown},view:()=>({update(t,r){s&&(n.update(t),t.state.doc.eq(r.doc)||n.change(e.get(zb)(t.state.doc)))}})}))),await e.create(),a?await l():Ot(u,e.getMarkdown())?(s=!0,n.ready()):(n.unsupported(),await l())}catch(e){a||(r.value=Et(e),n.unsupported()),await l()}}),o(()=>{a=!0,s&&l()}),{error:r,getView:u}}function f0(e,t){let n=0;e.forEach((e,r)=>{let i=r+e.nodeSize;i<=t&&e.marks.some(e=>e.type.name===`link`)&&(n=i)});let r=jt(e.textBetween(n,t,`
1056
- `,``));return r?{...r,start:n+r.start}:null}function p0(e,t,n){let r=m(null),{matches:i,active:a,move:o}=It(n,()=>r.value?.query??null),s,c;function l(e){let{selection:t}=e.state,n=t.$from,i=t.empty&&n.parent.isTextblock&&!n.parent.type.spec.code?f0(n.parent,n.parentOffset):null;if(!i||n.marks().some(e=>e.type.name===`link`||e.type.name===`inlineCode`)){r.value=null,c=void 0;return}let a=n.start()+i.start;if(c===a)return;let o=e.coordsAtPos(t.from);r.value={from:a,to:t.from,query:i.query,left:Math.max(8,Math.min(o.left,window.innerWidth-340)),top:Math.min(o.bottom+4,window.innerHeight-220)}}function u(n,i=!1){let a=e();if(!a||i&&!r.value)return;let o=s??a.state.selection,c=i?r.value.from:o.from,l=i?r.value.to:o.to,u=!i&&c!==l?a.state.doc.textBetween(c,l,` `):n.split(`/`).at(-1).replace(/\.md$/i,``),d=a.state.schema.marks.link.create({href:Pt(g(t),n)});r.value=null,s=void 0,a.dispatch(a.state.tr.replaceWith(c,l,a.state.schema.text(u,[d])).scrollIntoView()),a.focus()}function d(){let t=e();t&&(s=t.state.selection,r.value=null)}function f(e,t){return r.value?t.key===`Escape`?(c=r.value.from,r.value=null,!0):t.key===`ArrowDown`||t.key===`ArrowUp`?(o(t.key===`ArrowDown`?1:-1),!0):t.key===`Enter`&&i.value[a.value]?(u(i.value[a.value],!0),!0):!1:!1}return{popup:r,matches:i,active:a,updatePopup:l,handleKeyDown:f,prepareLink:d,insertLink:u}}var m0={class:`note-visual`},h0=d({__name:`NoteVisualEditor`,props:{text:{},path:{},paths:{}},emits:[`change`,`unsupported`,`ready`,`link`],setup(e,{expose:t,emit:n}){let i=e,a=n,o=u(`root`),l=()=>void 0,d=p0(()=>l(),()=>i.path,()=>i.paths),{popup:f,matches:m,active:g,prepareLink:v,insertLink:S}=d,{error:te,getView:C}=d0(o,()=>i.text,{change:e=>a(`change`,e),unsupported:()=>a(`unsupported`),ready:()=>a(`ready`),link:()=>{v(),a(`link`)},update:d.updatePopup,keydown:d.handleKeyDown});return l=C,t({prepareLink:v,insertLink:S}),(e,t)=>(c(),h(`div`,m0,[ee(te)?(c(),b(Dt,{key:0,dense:``,class:`note-banner text-negative`},{default:r(()=>[x(y(ee(te)),1)]),_:1})):ne(``,!0),(c(),b(_,{to:`body`},[ee(f)?(c(),b(Ft,{key:0,class:`agent-menu note-mention-list`,style:s({left:ee(f).left+`px`,top:ee(f).top+`px`}),paths:ee(m),active:ee(g),onSelect:t[0]||=e=>ee(S)(e,!0)},null,8,[`style`,`paths`,`active`])):ne(``,!0)])),p(`div`,{ref_key:`root`,ref:o},null,512)]))}}),g0=t({default:()=>_0}),_0=Mt(h0,[[`__scopeId`,`data-v-fb22d0d7`]]);export{Qn as a,_0 as default,Vt as i,Lt as n,Bt as r,g0 as t};