@nextcloud/vue 9.0.0-alpha.7 → 9.0.0-alpha.8

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 (461) hide show
  1. package/CHANGELOG.md +228 -138
  2. package/README.md +9 -5
  3. package/dist/assets/{NcActionButton-CVjVxm7I.css → NcActionButton-d8aZCq9u.css} +16 -16
  4. package/dist/assets/{NcActionCaption-BNDtcWJ7.css → NcActionCaption-DnG2OyWa.css} +2 -2
  5. package/dist/assets/{NcActionCheckbox-CnTyr-NN.css → NcActionCheckbox-tMIOGziy.css} +12 -12
  6. package/dist/assets/{NcActionInput-D19t1QsM.css → NcActionInput-C-rQsTEA.css} +62 -62
  7. package/dist/assets/{NcActionLink-DA3ebr8W.css → NcActionLink-jSPFFKV8.css} +12 -12
  8. package/dist/assets/{NcActionRadio-C7Kqlz6k.css → NcActionRadio-xdrmoEIq.css} +12 -12
  9. package/dist/assets/{NcActionRouter-BtJqkgqu.css → NcActionRouter-qNNqBZab.css} +15 -15
  10. package/dist/assets/{NcActionText-FHEPUweO.css → NcActionText-0XNfku_2.css} +17 -17
  11. package/dist/assets/{NcActionTextEditable-DzNRmwkV.css → NcActionTextEditable-ZlNtR_B_.css} +60 -60
  12. package/dist/assets/{NcActions-BepWTc-7.css → NcActions-D7gPHaUE.css} +11 -11
  13. package/dist/assets/{NcAppContent-BZ3rplmb.css → NcAppContent-CLu_1q4O.css} +24 -24
  14. package/dist/assets/{NcAppNavigation-_K9H-MtG.css → NcAppNavigation-BXItV5BV.css} +13 -13
  15. package/dist/assets/{NcAppNavigationItem-PKTHyQue.css → NcAppNavigationItem-aVy0uQwf.css} +34 -34
  16. package/dist/assets/{NcAppNavigationNew-L_VNZNL4.css → NcAppNavigationNew-Ba3wWpcY.css} +3 -3
  17. package/dist/assets/{NcAppNavigationSearch-Bsr4esEc.css → NcAppNavigationSearch-BAzhDRd7.css} +6 -6
  18. package/dist/assets/{NcAppNavigationToggle-By3_rHPL.css → NcAppNavigationToggle-DnTKNSH7.css} +3 -3
  19. package/dist/assets/{NcAppSettingsDialog-c8Xj_A-1.css → NcAppSettingsDialog-DZfD_UEa.css} +11 -11
  20. package/dist/assets/{NcAppSidebar-g99AGRiQ.css → NcAppSidebar-GFQ62pY2.css} +61 -61
  21. package/dist/assets/{NcAvatar-Bg20-FW4.css → NcAvatar-DUKfNDGL.css} +26 -26
  22. package/dist/assets/{NcBreadcrumb-r0TATv9A.css → NcBreadcrumb-CV3DgRKn.css} +15 -15
  23. package/dist/assets/{NcBreadcrumbs-Bbd8rdwH.css → NcBreadcrumbs-D2wff82k.css} +6 -6
  24. package/dist/assets/{NcButton-C50FLvfa.css → NcButton-wmjlEdLP.css} +48 -49
  25. package/dist/assets/{NcCheckboxRadioSwitch-jfJIoM4m.css → NcCheckboxRadioSwitch-uwXbP_jb.css} +42 -42
  26. package/dist/assets/{NcChip-BWWUudAH.css → NcChip-CKtzzrlA.css} +9 -9
  27. package/dist/assets/{NcCollectionList-COXbQt16.css → NcCollectionList-DTJgOfCk.css} +29 -29
  28. package/dist/assets/{NcColorPicker-3h8DrL_S.css → NcColorPicker-Clz7MjCA.css} +29 -29
  29. package/dist/assets/{NcContent-BgziefsK.css → NcContent-aXaYSfjS.css} +10 -10
  30. package/dist/assets/{NcDashboardWidget-Cdxxd7ei.css → NcDashboardWidget-xV4o6Cen.css} +14 -15
  31. package/dist/assets/NcDateTimePicker-AIJmp5dC.css +81 -0
  32. package/dist/assets/{NcDateTimePickerNative-pbWtBuzt.css → NcDateTimePickerNative-CdHLvH4A.css} +13 -13
  33. package/dist/assets/{NcDialog-DL7A_udP.css → NcDialog-Dkeikssh.css} +15 -15
  34. package/dist/assets/{NcEllipsisedOption-DGr9_bIL.css → NcEllipsisedOption-D-IsjXWc.css} +5 -5
  35. package/dist/assets/{NcEmojiPicker-Bfk2pnZE.css → NcEmojiPicker-DnMU8iEd.css} +5 -5
  36. package/dist/assets/{NcEmptyContent-DZSuQ2yE.css → NcEmptyContent-D1O466rM.css} +9 -9
  37. package/dist/assets/{NcHeaderButton-cVjCMSVn.css → NcHeaderButton-BPIasMkw.css} +7 -7
  38. package/dist/assets/{NcHeaderMenu-QJK2rMK3.css → NcHeaderMenu-ZmtqwEYA.css} +11 -11
  39. package/dist/assets/{NcInputConfirmCancel-D46m8Alt.css → NcInputConfirmCancel-9YyvRYjw.css} +6 -6
  40. package/dist/assets/{NcInputField-CRvNH5sg.css → NcInputField-B8J2uFD4.css} +32 -32
  41. package/dist/assets/{NcListItem-BEfZK5UK.css → NcListItem-Byw-ayOI.css} +44 -44
  42. package/dist/assets/{NcListItemIcon-E21VFJqd.css → NcListItemIcon-Bnr-Z-SO.css} +14 -14
  43. package/dist/assets/{NcPasswordField-Bl9fhgy-.css → NcPasswordField-z9gbKnov.css} +2 -2
  44. package/dist/assets/{NcRelatedResourcesPanel-Chjd8iT7.css → NcRelatedResourcesPanel-DXfywiqL.css} +23 -23
  45. package/dist/assets/{NcRichContenteditable-BwHgQWPX.css → NcRichContenteditable-Bxi-Ki0j.css} +10 -10
  46. package/dist/assets/{NcRichText-fo4QE8--.css → NcRichText-Dvt8jvWN.css} +83 -83
  47. package/dist/assets/{NcSelect-GdIw6cIy.css → NcSelect-B6DUjUdl.css} +2 -2
  48. package/dist/assets/{NcSettingsInputText-BTOyFeAK.css → NcSettingsInputText-B-V6Y4MD.css} +7 -7
  49. package/dist/assets/{NcSettingsSelectGroup-DhyosmOr.css → NcSettingsSelectGroup-DZcNr_Dq.css} +2 -2
  50. package/dist/assets/{NcTextArea-BfSGN55r.css → NcTextArea-DHr9DPOJ.css} +20 -20
  51. package/dist/assets/{index-BRaTLqzR.css → index-Du_FXiPy.css} +61 -61
  52. package/dist/assets/{referencePickerModal-Cy43S4js.css → referencePickerModal-CkGgDb19.css} +8 -8
  53. package/dist/chunks/AlertCircleOutline-DVzpKQVu.mjs +1 -0
  54. package/dist/chunks/ArrowLeft-CanHG70H.mjs +1 -0
  55. package/dist/chunks/ArrowRight-DQT24Cb-.mjs +1 -0
  56. package/dist/chunks/Check-5i4xKnkl.mjs +1 -0
  57. package/dist/chunks/ChevronDown-FiGpp0KT.mjs +1 -0
  58. package/dist/chunks/ChevronLeft-FfC-tiIS.mjs +1 -0
  59. package/dist/chunks/ChevronRight-LvtA5_hq.mjs +1 -0
  60. package/dist/chunks/ChevronUp-DPXFp1ss.mjs +1 -0
  61. package/dist/chunks/{Close-idsVwGrC.mjs → Close-D6ngJ4t9.mjs} +3 -2
  62. package/dist/chunks/{Close-idsVwGrC.mjs.map → Close-D6ngJ4t9.mjs.map} +1 -1
  63. package/dist/chunks/DotsHorizontal-AMVAlTNH.mjs +1 -0
  64. package/dist/chunks/{NcActionButton-DBFJTCO5.mjs → NcActionButton-BdQ_qmvW.mjs} +6 -4
  65. package/dist/chunks/{NcActionButton-DBFJTCO5.mjs.map → NcActionButton-BdQ_qmvW.mjs.map} +1 -1
  66. package/dist/chunks/{NcActionButtonGroup-nwHeJeV7.mjs → NcActionButtonGroup-TitZerDl.mjs} +6 -4
  67. package/dist/chunks/NcActionButtonGroup-TitZerDl.mjs.map +1 -0
  68. package/dist/chunks/{NcActionCaption-DmOKI_Kc.mjs → NcActionCaption-Fumfjzxj.mjs} +5 -3
  69. package/dist/chunks/NcActionCaption-Fumfjzxj.mjs.map +1 -0
  70. package/dist/chunks/{NcActionCheckbox-yPCmA5vr.mjs → NcActionCheckbox-CUYbo1rw.mjs} +7 -5
  71. package/dist/chunks/NcActionCheckbox-CUYbo1rw.mjs.map +1 -0
  72. package/dist/chunks/{NcActionInput-DTzVHmHn.mjs → NcActionInput-TI648L3V.mjs} +12 -11
  73. package/dist/chunks/NcActionInput-TI648L3V.mjs.map +1 -0
  74. package/dist/chunks/{NcActionLink-CG3cKif-.mjs → NcActionLink-cQlsviu9.mjs} +6 -4
  75. package/dist/chunks/NcActionLink-cQlsviu9.mjs.map +1 -0
  76. package/dist/chunks/{NcActionRadio-BWPi0DII.mjs → NcActionRadio-tORL1qPt.mjs} +7 -5
  77. package/dist/chunks/NcActionRadio-tORL1qPt.mjs.map +1 -0
  78. package/dist/chunks/{NcActionRouter-C7VSuJLq.mjs → NcActionRouter-Bw1tpEZt.mjs} +6 -4
  79. package/dist/chunks/NcActionRouter-Bw1tpEZt.mjs.map +1 -0
  80. package/dist/chunks/NcActionSeparator-Doekl1NX.mjs +1 -0
  81. package/dist/chunks/{NcActionText-ByD1mFXe.mjs → NcActionText-VLCHOiIy.mjs} +6 -4
  82. package/dist/chunks/NcActionText-VLCHOiIy.mjs.map +1 -0
  83. package/dist/chunks/{NcActionTextEditable-DLKA6lfe.mjs → NcActionTextEditable-nTbwgRy2.mjs} +7 -6
  84. package/dist/chunks/NcActionTextEditable-nTbwgRy2.mjs.map +1 -0
  85. package/dist/chunks/{NcActions-DxTtucKk.mjs → NcActions-CgKHXNbF.mjs} +49 -37
  86. package/dist/chunks/NcActions-CgKHXNbF.mjs.map +1 -0
  87. package/dist/chunks/{NcAppContent-Cu9zhNK3.mjs → NcAppContent-C4gBVRQs.mjs} +67 -16
  88. package/dist/chunks/NcAppContent-C4gBVRQs.mjs.map +1 -0
  89. package/dist/chunks/NcAppContentDetails-DsEEBJ0U.mjs +1 -0
  90. package/dist/chunks/NcAppContentList-DnLY_sWw.mjs +1 -0
  91. package/dist/chunks/{NcAppNavigation-BxUvXgeG.mjs → NcAppNavigation-DbRpHbi9.mjs} +4 -3
  92. package/dist/chunks/{NcAppNavigation-BxUvXgeG.mjs.map → NcAppNavigation-DbRpHbi9.mjs.map} +1 -1
  93. package/dist/chunks/{NcAppNavigationCaption-S_2Jmwqr.mjs → NcAppNavigationCaption-R_UZ7iKw.mjs} +2 -1
  94. package/dist/chunks/{NcAppNavigationCaption-S_2Jmwqr.mjs.map → NcAppNavigationCaption-R_UZ7iKw.mjs.map} +1 -1
  95. package/dist/chunks/NcAppNavigationIconBullet-B1kc4u65.mjs +1 -0
  96. package/dist/chunks/{NcAppNavigationItem-C7bIZuo2.mjs → NcAppNavigationItem-CxYtFEhV.mjs} +16 -15
  97. package/dist/chunks/NcAppNavigationItem-CxYtFEhV.mjs.map +1 -0
  98. package/dist/chunks/NcAppNavigationList-DX_Yo23V.mjs +1 -0
  99. package/dist/chunks/{NcAppNavigationNew-BO-Llutk.mjs → NcAppNavigationNew-sMVo_IoL.mjs} +11 -6
  100. package/dist/chunks/NcAppNavigationNew-sMVo_IoL.mjs.map +1 -0
  101. package/dist/chunks/{NcAppNavigationNewItem-D7CYmmOm.mjs → NcAppNavigationNewItem-CJZcL6GH.mjs} +2 -1
  102. package/dist/chunks/{NcAppNavigationNewItem-D7CYmmOm.mjs.map → NcAppNavigationNewItem-CJZcL6GH.mjs.map} +1 -1
  103. package/dist/chunks/{NcAppNavigationSearch-DLbzvkkq.mjs → NcAppNavigationSearch-Dbhh-Vtw.mjs} +7 -6
  104. package/dist/chunks/NcAppNavigationSearch-Dbhh-Vtw.mjs.map +1 -0
  105. package/dist/chunks/{NcAppNavigationSettings-vM8ajNNK.mjs → NcAppNavigationSettings-Bfo3EWk_.mjs} +5 -4
  106. package/dist/chunks/NcAppNavigationSettings-Bfo3EWk_.mjs.map +1 -0
  107. package/dist/chunks/NcAppNavigationSpacer-CzBLuQL8.mjs +1 -0
  108. package/dist/chunks/{NcAppNavigationToggle-DBtf139E.mjs → NcAppNavigationToggle-Ys-PjFo3.mjs} +9 -8
  109. package/dist/chunks/NcAppNavigationToggle-Ys-PjFo3.mjs.map +1 -0
  110. package/dist/chunks/{NcAppSettingsDialog-CdFUuydh.mjs → NcAppSettingsDialog-Cc-OdY9a.mjs} +5 -4
  111. package/dist/chunks/{NcAppSettingsDialog-CdFUuydh.mjs.map → NcAppSettingsDialog-Cc-OdY9a.mjs.map} +1 -1
  112. package/dist/chunks/NcAppSettingsSection-CssmXyZ0.mjs +1 -0
  113. package/dist/chunks/{NcAppSidebar-Dav-iGv2.mjs → NcAppSidebar-Dgwj8O_Z.mjs} +26 -25
  114. package/dist/chunks/NcAppSidebar-Dgwj8O_Z.mjs.map +1 -0
  115. package/dist/chunks/NcAppSidebarTab-DG51ajic.mjs +1 -0
  116. package/dist/chunks/{NcAvatar-A1YnlIoN.mjs → NcAvatar-CA8y4d-c.mjs} +34 -34
  117. package/dist/chunks/NcAvatar-CA8y4d-c.mjs.map +1 -0
  118. package/dist/chunks/NcBlurHash-BiFktE2N.mjs +1 -0
  119. package/dist/chunks/NcBlurHash-BiFktE2N.mjs.map +1 -1
  120. package/dist/chunks/{NcBreadcrumb-D5cRcQg5.mjs → NcBreadcrumb-DSjIxTeU.mjs} +21 -17
  121. package/dist/chunks/NcBreadcrumb-DSjIxTeU.mjs.map +1 -0
  122. package/dist/chunks/{NcBreadcrumbs-CnWT9rE5.mjs → NcBreadcrumbs-jPvP6Cmo.mjs} +10 -9
  123. package/dist/chunks/NcBreadcrumbs-jPvP6Cmo.mjs.map +1 -0
  124. package/dist/chunks/{NcButton-QmfEsvXC.mjs → NcButton-BHLqKKYP.mjs} +63 -53
  125. package/dist/chunks/NcButton-BHLqKKYP.mjs.map +1 -0
  126. package/dist/chunks/{NcCheckboxRadioSwitch-Ctdu7_UC.mjs → NcCheckboxRadioSwitch-CWU_M_ui.mjs} +7 -6
  127. package/dist/chunks/NcCheckboxRadioSwitch-CWU_M_ui.mjs.map +1 -0
  128. package/dist/chunks/{NcChip-BnD-EmBn.mjs → NcChip-C3U2HYR9.mjs} +21 -60
  129. package/dist/chunks/NcChip-C3U2HYR9.mjs.map +1 -0
  130. package/dist/chunks/{NcCollectionList-9YfN6xAi.mjs → NcCollectionList-BtHsipae.mjs} +9 -8
  131. package/dist/chunks/NcCollectionList-BtHsipae.mjs.map +1 -0
  132. package/dist/chunks/{NcColorPicker-DQqAv2wB.mjs → NcColorPicker-BI-Is4nj.mjs} +14 -13
  133. package/dist/chunks/NcColorPicker-BI-Is4nj.mjs.map +1 -0
  134. package/dist/chunks/{NcContent-CsDFFKvH.mjs → NcContent-BcF6f3N-.mjs} +8 -7
  135. package/dist/chunks/{NcContent-CsDFFKvH.mjs.map → NcContent-BcF6f3N-.mjs.map} +1 -1
  136. package/dist/chunks/NcCounterBubble-6B_JNUUS.mjs +1 -0
  137. package/dist/chunks/{NcDashboardWidget-ROT13m5A.mjs → NcDashboardWidget-1rVqTzgV.mjs} +8 -7
  138. package/dist/chunks/{NcDashboardWidget-ROT13m5A.mjs.map → NcDashboardWidget-1rVqTzgV.mjs.map} +1 -1
  139. package/dist/chunks/{NcDashboardWidgetItem-DoYOYxck.mjs → NcDashboardWidgetItem-7RXY5EKJ.mjs} +4 -3
  140. package/dist/chunks/{NcDashboardWidgetItem-DoYOYxck.mjs.map → NcDashboardWidgetItem-7RXY5EKJ.mjs.map} +1 -1
  141. package/dist/chunks/NcDateTime.vue_vue_type_script_setup_true_lang-DtP-oauZ.mjs +31 -0
  142. package/dist/chunks/NcDateTime.vue_vue_type_script_setup_true_lang-DtP-oauZ.mjs.map +1 -0
  143. package/dist/chunks/NcDateTimePicker-BzfuHym4.mjs +257 -0
  144. package/dist/chunks/NcDateTimePicker-BzfuHym4.mjs.map +1 -0
  145. package/dist/chunks/{NcDateTimePickerNative-Dbc6pBXk.mjs → NcDateTimePickerNative-Dake1IML.mjs} +6 -5
  146. package/dist/chunks/NcDateTimePickerNative-Dake1IML.mjs.map +1 -0
  147. package/dist/chunks/{NcDialog-B81mllwn.mjs → NcDialog-_pc2BPHU.mjs} +12 -11
  148. package/dist/chunks/NcDialog-_pc2BPHU.mjs.map +1 -0
  149. package/dist/chunks/{NcDialogButton.vue_vue_type_script_setup_true_lang-DgWqkSL7.mjs → NcDialogButton.vue_vue_type_script_setup_true_lang-BKrJ_xd8.mjs} +22 -23
  150. package/dist/chunks/NcDialogButton.vue_vue_type_script_setup_true_lang-BKrJ_xd8.mjs.map +1 -0
  151. package/dist/chunks/{NcEllipsisedOption-D4OggsNq.mjs → NcEllipsisedOption-4k07kvEr.mjs} +5 -4
  152. package/dist/chunks/NcEllipsisedOption-4k07kvEr.mjs.map +1 -0
  153. package/dist/chunks/{NcEmojiPicker-DKGBXunS.mjs → NcEmojiPicker-CWbez_of.mjs} +18 -14
  154. package/dist/chunks/NcEmojiPicker-CWbez_of.mjs.map +1 -0
  155. package/dist/chunks/{NcEmptyContent-D-wBvEi4.mjs → NcEmptyContent-BQnIrQQn.mjs} +3 -2
  156. package/dist/chunks/NcEmptyContent-BQnIrQQn.mjs.map +1 -0
  157. package/dist/chunks/NcGuestContent-iQpV7mLC.mjs +1 -0
  158. package/dist/chunks/{NcHeaderButton-Cq62USyt.mjs → NcHeaderButton-BsstEWtv.mjs} +9 -8
  159. package/dist/chunks/{NcHeaderButton-Cq62USyt.mjs.map → NcHeaderButton-BsstEWtv.mjs.map} +1 -1
  160. package/dist/chunks/{NcHeaderMenu-BRiroRYT.mjs → NcHeaderMenu-ZzoCwPvX.mjs} +13 -14
  161. package/dist/chunks/NcHeaderMenu-ZzoCwPvX.mjs.map +1 -0
  162. package/dist/chunks/{NcHighlight-BHtRIzqk.mjs → NcHighlight-Cu4UfEEO.mjs} +11 -7
  163. package/dist/chunks/NcHighlight-Cu4UfEEO.mjs.map +1 -0
  164. package/dist/chunks/NcIconSvgWrapper-BYTrkA66.mjs +1 -0
  165. package/dist/chunks/{NcInputConfirmCancel-xnrPAGac.mjs → NcInputConfirmCancel-CX56m05a.mjs} +19 -18
  166. package/dist/chunks/NcInputConfirmCancel-CX56m05a.mjs.map +1 -0
  167. package/dist/chunks/{NcInputField-CzC820tG.mjs → NcInputField-DdZlDVwQ.mjs} +7 -6
  168. package/dist/chunks/NcInputField-DdZlDVwQ.mjs.map +1 -0
  169. package/dist/chunks/{NcListItem-DFLsabmR.mjs → NcListItem-DF8Yv05m.mjs} +4 -3
  170. package/dist/chunks/NcListItem-DF8Yv05m.mjs.map +1 -0
  171. package/dist/chunks/{NcListItemIcon-BK9GBjoD.mjs → NcListItemIcon-nzw_x2Q5.mjs} +5 -4
  172. package/dist/chunks/{NcListItemIcon-BK9GBjoD.mjs.map → NcListItemIcon-nzw_x2Q5.mjs.map} +1 -1
  173. package/dist/chunks/NcLoadingIcon-CsMn1bFR.mjs +1 -0
  174. package/dist/chunks/NcMentionBubble.vue_vue_type_style_index_0_scoped_6c8d0da9_lang-DYJMHclV.mjs +1 -0
  175. package/dist/chunks/NcNoteCard-XoSOund1.mjs +1 -0
  176. package/dist/chunks/{NcPasswordField-BLHAdm-k.mjs → NcPasswordField-BnnlEhT1.mjs} +6 -5
  177. package/dist/chunks/{NcPasswordField-BLHAdm-k.mjs.map → NcPasswordField-BnnlEhT1.mjs.map} +1 -1
  178. package/dist/chunks/{NcPopover-D4D97Y3j.mjs → NcPopover-C3ZoyUjc.mjs} +7 -2
  179. package/dist/chunks/NcPopover-C3ZoyUjc.mjs.map +1 -0
  180. package/dist/chunks/NcProgressBar-Bx8bMkd4.mjs +1 -0
  181. package/dist/chunks/{NcRelatedResourcesPanel-DsuNT9hM.mjs → NcRelatedResourcesPanel-D2YLEouH.mjs} +13 -12
  182. package/dist/chunks/NcRelatedResourcesPanel-D2YLEouH.mjs.map +1 -0
  183. package/dist/chunks/{NcRichContenteditable-BkSojqgy.mjs → NcRichContenteditable-B16VJW0Y.mjs} +18 -18
  184. package/dist/chunks/NcRichContenteditable-B16VJW0Y.mjs.map +1 -0
  185. package/dist/chunks/NcRichText-4jIBSmap.mjs +3673 -0
  186. package/dist/chunks/NcRichText-4jIBSmap.mjs.map +1 -0
  187. package/dist/chunks/NcSavingIndicatorIcon-icWy8J5x.mjs +1 -0
  188. package/dist/chunks/{NcSelect-B61ik8an.mjs → NcSelect-CAx_ixPU.mjs} +11 -10
  189. package/dist/chunks/NcSelect-CAx_ixPU.mjs.map +1 -0
  190. package/dist/chunks/{NcSelectTags-Dx3nG6jx.mjs → NcSelectTags-UXzC7lDz.mjs} +4 -3
  191. package/dist/chunks/{NcSelectTags-Dx3nG6jx.mjs.map → NcSelectTags-UXzC7lDz.mjs.map} +1 -1
  192. package/dist/chunks/{NcSettingsInputText-B5FrLCL9.mjs → NcSettingsInputText-BEHu3xAI.mjs} +6 -5
  193. package/dist/chunks/NcSettingsInputText-BEHu3xAI.mjs.map +1 -0
  194. package/dist/chunks/{NcSettingsSection-CAdn6gS9.mjs → NcSettingsSection-X7f0W7vZ.mjs} +3 -2
  195. package/dist/chunks/{NcSettingsSection-CAdn6gS9.mjs.map → NcSettingsSection-X7f0W7vZ.mjs.map} +1 -1
  196. package/dist/chunks/{NcSettingsSelectGroup-CKIbxms2.mjs → NcSettingsSelectGroup-DfrKchOy.mjs} +8 -7
  197. package/dist/chunks/NcSettingsSelectGroup-DfrKchOy.mjs.map +1 -0
  198. package/dist/chunks/{NcTextArea-C-PMlEbl.mjs → NcTextArea-DKHjCur8.mjs} +5 -4
  199. package/dist/chunks/NcTextArea-DKHjCur8.mjs.map +1 -0
  200. package/dist/chunks/{NcTextField-CNV42Zey.mjs → NcTextField-BTzKCPza.mjs} +6 -5
  201. package/dist/chunks/{NcTextField-CNV42Zey.mjs.map → NcTextField-BTzKCPza.mjs.map} +1 -1
  202. package/dist/chunks/{NcTimezonePicker-tZmX1Qp4.mjs → NcTimezonePicker-CMoUk4sZ.mjs} +8 -7
  203. package/dist/chunks/NcTimezonePicker-CMoUk4sZ.mjs.map +1 -0
  204. package/dist/chunks/{NcUserBubble-MfDc1YR2.mjs → NcUserBubble-Dgzog0Ps.mjs} +3 -2
  205. package/dist/chunks/{NcUserBubble-MfDc1YR2.mjs.map → NcUserBubble-Dgzog0Ps.mjs.map} +1 -1
  206. package/dist/chunks/{NcUserStatusIcon-vtnkNASH.mjs → NcUserStatusIcon-DvYiEs2L.mjs} +2 -1
  207. package/dist/chunks/{NcUserStatusIcon-vtnkNASH.mjs.map → NcUserStatusIcon-DvYiEs2L.mjs.map} +1 -1
  208. package/dist/chunks/{ScopeComponent-DgRMJomt.mjs → ScopeComponent-BWZEma4R.mjs} +2 -1
  209. package/dist/chunks/{ScopeComponent-DgRMJomt.mjs.map → ScopeComponent-BWZEma4R.mjs.map} +1 -1
  210. package/dist/chunks/_l10n-7kR7gXFc.mjs +132 -0
  211. package/dist/chunks/_l10n-7kR7gXFc.mjs.map +1 -0
  212. package/dist/chunks/_plugin-vue_export-helper-1tPrXgE0.mjs +1 -0
  213. package/dist/chunks/actionGlobal-BZFdtdJL.mjs +1 -0
  214. package/dist/chunks/{actionText-aI0owku1.mjs → actionText-BiV1_BZX.mjs} +8 -13
  215. package/dist/chunks/actionText-BiV1_BZX.mjs.map +1 -0
  216. package/dist/chunks/autolink-CKPk5rzg.mjs +1 -0
  217. package/dist/chunks/{GenColors-G1ZRJcz5.mjs → colors-BJbWzaQ-.mjs} +28 -22
  218. package/dist/chunks/colors-BJbWzaQ-.mjs.map +1 -0
  219. package/dist/chunks/createElementId-DhjFt1I9.mjs +8 -0
  220. package/dist/chunks/createElementId-DhjFt1I9.mjs.map +1 -0
  221. package/dist/chunks/emoji-BY_D0V5K.mjs +1 -0
  222. package/dist/chunks/focusTrap-DmkaYJTC.mjs +1 -0
  223. package/dist/chunks/{index-wLgC9ACl.mjs → index--u6iHwFv.mjs} +3 -2
  224. package/dist/chunks/{index-wLgC9ACl.mjs.map → index--u6iHwFv.mjs.map} +1 -1
  225. package/dist/chunks/index-BF8joS9W.mjs +1 -0
  226. package/dist/chunks/logger-D3RVzcfQ.mjs +1 -0
  227. package/dist/chunks/logger-D3RVzcfQ.mjs.map +1 -1
  228. package/dist/chunks/mdi-zYpVOORa.mjs +17 -0
  229. package/dist/chunks/mdi-zYpVOORa.mjs.map +1 -0
  230. package/dist/chunks/{referencePickerModal-CzI44bxD.mjs → referencePickerModal-BpNnwC_g.mjs} +17 -17
  231. package/dist/chunks/{referencePickerModal-CzI44bxD.mjs.map → referencePickerModal-BpNnwC_g.mjs.map} +1 -1
  232. package/dist/chunks/rtl-v0UOPAM7.mjs +1 -0
  233. package/dist/chunks/{useFormatDateTime-Cvc8YJRE.mjs → useFormatDateTime-B5sWtJdj.mjs} +2 -1
  234. package/dist/chunks/{useFormatDateTime-Cvc8YJRE.mjs.map → useFormatDateTime-B5sWtJdj.mjs.map} +1 -1
  235. package/dist/chunks/useNcActions-CiGWxAJE.mjs +7 -0
  236. package/dist/chunks/useNcActions-CiGWxAJE.mjs.map +1 -0
  237. package/dist/chunks/useTrapStackControl-b3A_383w.mjs +1 -0
  238. package/dist/chunks/usernameToColor-CzXWY0j4.mjs +22 -0
  239. package/dist/chunks/usernameToColor-CzXWY0j4.mjs.map +1 -0
  240. package/dist/components/NcActionButton/NcActionButton.vue.d.ts +5 -0
  241. package/dist/components/NcActionButton/index.mjs +2 -1
  242. package/dist/components/NcActionButtonGroup/index.mjs +2 -1
  243. package/dist/components/NcActionCaption/index.mjs +2 -1
  244. package/dist/components/NcActionCheckbox/index.mjs +2 -1
  245. package/dist/components/NcActionInput/index.mjs +2 -1
  246. package/dist/components/NcActionLink/index.mjs +2 -1
  247. package/dist/components/NcActionRadio/index.mjs +2 -1
  248. package/dist/components/NcActionRouter/NcActionRouter.vue.d.ts +5 -0
  249. package/dist/components/NcActionRouter/index.mjs +2 -1
  250. package/dist/components/NcActionSeparator/index.mjs +1 -0
  251. package/dist/components/NcActionText/NcActionText.vue.d.ts +5 -0
  252. package/dist/components/NcActionText/index.mjs +2 -1
  253. package/dist/components/NcActionTextEditable/NcActionTextEditable.vue.d.ts +5 -0
  254. package/dist/components/NcActionTextEditable/index.mjs +2 -1
  255. package/dist/components/NcActions/NcActions.vue.d.ts +52 -40
  256. package/dist/components/NcActions/index.mjs +2 -1
  257. package/dist/components/NcActions/useNcActions.d.ts +3 -0
  258. package/dist/components/NcAppContent/index.mjs +2 -1
  259. package/dist/components/NcAppContentDetails/index.mjs +1 -0
  260. package/dist/components/NcAppContentList/index.mjs +1 -0
  261. package/dist/components/NcAppNavigation/NcAppNavigation.vue.d.ts +16 -15
  262. package/dist/components/NcAppNavigation/index.mjs +2 -1
  263. package/dist/components/NcAppNavigationCaption/NcAppNavigationCaption.vue.d.ts +34 -30
  264. package/dist/components/NcAppNavigationCaption/index.mjs +2 -1
  265. package/dist/components/NcAppNavigationIconBullet/index.mjs +1 -0
  266. package/dist/components/NcAppNavigationItem/NcAppNavigationIconCollapsible.vue.d.ts +16 -15
  267. package/dist/components/NcAppNavigationItem/NcAppNavigationItem.vue.d.ts +94 -83
  268. package/dist/components/NcAppNavigationItem/NcInputConfirmCancel.vue.d.ts +25 -24
  269. package/dist/components/NcAppNavigationItem/index.mjs +2 -1
  270. package/dist/components/NcAppNavigationList/index.mjs +1 -0
  271. package/dist/components/NcAppNavigationNew/NcAppNavigationNew.vue.d.ts +27 -18
  272. package/dist/components/NcAppNavigationNew/index.mjs +2 -1
  273. package/dist/components/NcAppNavigationNewItem/NcAppNavigationNewItem.vue.d.ts +18 -17
  274. package/dist/components/NcAppNavigationNewItem/index.mjs +2 -1
  275. package/dist/components/NcAppNavigationSearch/NcAppNavigationSearch.vue.d.ts +16 -15
  276. package/dist/components/NcAppNavigationSearch/index.mjs +2 -1
  277. package/dist/components/NcAppNavigationSettings/index.mjs +2 -1
  278. package/dist/components/NcAppNavigationSpacer/index.mjs +1 -0
  279. package/dist/components/NcAppNavigationToggle/NcAppNavigationToggle.vue.d.ts +16 -15
  280. package/dist/components/NcAppNavigationToggle/index.mjs +2 -1
  281. package/dist/components/NcAppSettingsDialog/index.mjs +2 -1
  282. package/dist/components/NcAppSettingsSection/index.mjs +1 -0
  283. package/dist/components/NcAppSidebar/index.mjs +2 -1
  284. package/dist/components/NcAppSidebarTab/index.mjs +1 -0
  285. package/dist/components/NcAvatar/index.mjs +2 -1
  286. package/dist/components/NcBlurHash/index.mjs +1 -0
  287. package/dist/components/NcBreadcrumb/NcBreadcrumb.vue.d.ts +70 -64
  288. package/dist/components/NcBreadcrumb/index.mjs +2 -1
  289. package/dist/components/NcBreadcrumbs/NcBreadcrumbs.vue.d.ts +97 -77
  290. package/dist/components/NcBreadcrumbs/index.mjs +2 -1
  291. package/dist/components/NcButton/NcButton.vue.d.ts +42 -38
  292. package/dist/components/NcButton/index.mjs +4 -3
  293. package/dist/components/NcButton/types.d.ts +2 -2
  294. package/dist/components/NcCheckboxRadioSwitch/index.mjs +2 -1
  295. package/dist/components/NcChip/NcChip.vue.d.ts +57 -92
  296. package/dist/components/NcChip/index.mjs +2 -1
  297. package/dist/components/NcCollectionList/index.mjs +2 -1
  298. package/dist/components/NcColorPicker/index.mjs +2 -1
  299. package/dist/components/NcContent/NcContent.vue.d.ts +16 -15
  300. package/dist/components/NcContent/index.mjs +2 -1
  301. package/dist/components/NcCounterBubble/index.mjs +1 -0
  302. package/dist/components/NcDashboardWidget/index.mjs +2 -1
  303. package/dist/components/NcDashboardWidgetItem/index.mjs +2 -1
  304. package/dist/components/NcDateTime/NcDateTime.vue.d.ts +56 -1
  305. package/dist/components/NcDateTime/index.d.ts +4 -0
  306. package/dist/components/NcDateTime/index.mjs +3 -2
  307. package/dist/components/NcDateTimePicker/NcDateTimePicker.vue.d.ts +116 -1
  308. package/dist/components/NcDateTimePicker/index.d.ts +4 -0
  309. package/dist/components/NcDateTimePicker/index.mjs +2 -1
  310. package/dist/components/NcDateTimePickerNative/index.mjs +2 -1
  311. package/dist/components/NcDialog/NcDialog.vue.d.ts +45 -48
  312. package/dist/components/NcDialog/index.mjs +2 -1
  313. package/dist/components/NcDialogButton/NcDialogButton.vue.d.ts +37 -33
  314. package/dist/components/NcDialogButton/index.mjs +2 -1
  315. package/dist/components/NcEllipsisedOption/index.mjs +2 -1
  316. package/dist/components/NcEmojiPicker/NcEmojiPicker.vue.d.ts +33 -31
  317. package/dist/components/NcEmojiPicker/index.mjs +2 -1
  318. package/dist/components/NcEmptyContent/index.mjs +2 -1
  319. package/dist/components/NcGuestContent/index.mjs +1 -0
  320. package/dist/components/NcHeaderButton/index.mjs +2 -1
  321. package/dist/components/NcHeaderMenu/NcHeaderMenu.vue.d.ts +24 -22
  322. package/dist/components/NcHeaderMenu/index.mjs +2 -1
  323. package/dist/components/NcHighlight/index.mjs +2 -1
  324. package/dist/components/NcIconSvgWrapper/index.mjs +1 -0
  325. package/dist/components/NcInputField/NcInputField.vue.d.ts +16 -15
  326. package/dist/components/NcInputField/index.mjs +2 -1
  327. package/dist/components/NcListItem/NcListItem.vue.d.ts +34 -30
  328. package/dist/components/NcListItem/index.mjs +2 -1
  329. package/dist/components/NcListItemIcon/index.mjs +2 -1
  330. package/dist/components/NcLoadingIcon/index.mjs +1 -0
  331. package/dist/components/NcModal/index.mjs +34 -31
  332. package/dist/components/NcModal/index.mjs.map +1 -1
  333. package/dist/components/NcNoteCard/index.mjs +1 -0
  334. package/dist/components/NcPasswordField/index.mjs +2 -1
  335. package/dist/components/NcPopover/index.mjs +2 -1
  336. package/dist/components/NcProgressBar/index.mjs +1 -0
  337. package/dist/components/NcRelatedResourcesPanel/NcRelatedResourcesPanel.vue.d.ts +32 -30
  338. package/dist/components/NcRelatedResourcesPanel/NcResource.vue.d.ts +16 -15
  339. package/dist/components/NcRelatedResourcesPanel/NcTeamResources.vue.d.ts +16 -15
  340. package/dist/components/NcRelatedResourcesPanel/index.mjs +2 -1
  341. package/dist/components/NcRichContenteditable/index.mjs +3 -2
  342. package/dist/components/NcRichText/NcReferenceList.vue.d.ts +17 -16
  343. package/dist/components/NcRichText/NcReferencePicker/NcRawLinkInput.vue.d.ts +33 -31
  344. package/dist/components/NcRichText/NcReferenceWidget.vue.d.ts +17 -16
  345. package/dist/components/NcRichText/NcRichText.vue.d.ts +17 -16
  346. package/dist/components/NcRichText/index.mjs +4 -3
  347. package/dist/components/NcSavingIndicatorIcon/index.mjs +1 -0
  348. package/dist/components/NcSelect/index.mjs +2 -1
  349. package/dist/components/NcSelectTags/index.mjs +2 -1
  350. package/dist/components/NcSettingsInputText/index.mjs +2 -1
  351. package/dist/components/NcSettingsSection/index.mjs +2 -1
  352. package/dist/components/NcSettingsSelectGroup/index.mjs +2 -1
  353. package/dist/components/NcTextArea/index.mjs +2 -1
  354. package/dist/components/NcTextField/NcTextField.vue.d.ts +16 -15
  355. package/dist/components/NcTextField/index.mjs +2 -1
  356. package/dist/components/NcTimezonePicker/index.mjs +2 -1
  357. package/dist/components/NcUserBubble/index.mjs +2 -1
  358. package/dist/components/NcUserStatusIcon/index.mjs +2 -1
  359. package/dist/components/NcVNodes/index.mjs +1 -0
  360. package/dist/composables/index.d.ts +6 -2
  361. package/dist/composables/useHotKey/index.mjs +1 -0
  362. package/dist/composables/useIsDarkTheme/index.mjs +1 -0
  363. package/dist/composables/useIsFullscreen/index.d.ts +3 -4
  364. package/dist/composables/useIsFullscreen/index.mjs +4 -1
  365. package/dist/composables/useIsFullscreen/index.mjs.map +1 -1
  366. package/dist/composables/useIsMobile/index.d.ts +9 -14
  367. package/dist/composables/useIsMobile/index.mjs +1 -2
  368. package/dist/composables/useIsMobile/index.mjs.map +1 -1
  369. package/dist/directives/Focus/index.mjs +1 -0
  370. package/dist/directives/Linkify/index.d.ts +2 -1
  371. package/dist/directives/Linkify/index.mjs +38 -10
  372. package/dist/directives/Linkify/index.mjs.map +1 -1
  373. package/dist/directives/Tooltip/index.mjs +1 -0
  374. package/dist/directives/index.d.ts +1 -1
  375. package/dist/functions/a11y/index.mjs +1 -0
  376. package/dist/functions/dialog/index.mjs +1 -0
  377. package/dist/functions/emoji/index.mjs +1 -0
  378. package/dist/functions/isDarkTheme/index.mjs +1 -0
  379. package/dist/functions/preloadImage/index.mjs +1 -0
  380. package/dist/functions/reference/index.mjs +2 -1
  381. package/dist/functions/registerReference/index.mjs +1 -0
  382. package/dist/functions/usernameToColor/index.d.ts +5 -1
  383. package/dist/functions/usernameToColor/index.mjs +2 -1
  384. package/dist/functions/usernameToColor/usernameToColor.d.ts +4 -9
  385. package/dist/index.mjs +114 -114
  386. package/dist/mixins/actionText.d.ts +6 -0
  387. package/dist/mixins/richEditor/index.mjs +2 -1
  388. package/dist/utils/appName.d.ts +5 -0
  389. package/dist/utils/colors.d.ts +34 -0
  390. package/dist/utils/createElementId.d.ts +7 -0
  391. package/dist/utils/findRanges.d.ts +16 -0
  392. package/dist/utils/isSlotPopulated.d.ts +1 -2
  393. package/dist/utils/linkify.d.ts +8 -0
  394. package/dist/utils/logger.d.ts +4 -0
  395. package/dist/vendor.LICENSE.txt +128 -0
  396. package/package.json +27 -21
  397. package/dist/assets/NcDateTimePicker-CRb2xZzf.css +0 -918
  398. package/dist/chunks/GenColors-G1ZRJcz5.mjs.map +0 -1
  399. package/dist/chunks/GenRandomId-CMooMQt0.mjs +0 -6
  400. package/dist/chunks/GenRandomId-CMooMQt0.mjs.map +0 -1
  401. package/dist/chunks/NcActionButtonGroup-nwHeJeV7.mjs.map +0 -1
  402. package/dist/chunks/NcActionCaption-DmOKI_Kc.mjs.map +0 -1
  403. package/dist/chunks/NcActionCheckbox-yPCmA5vr.mjs.map +0 -1
  404. package/dist/chunks/NcActionInput-DTzVHmHn.mjs.map +0 -1
  405. package/dist/chunks/NcActionLink-CG3cKif-.mjs.map +0 -1
  406. package/dist/chunks/NcActionRadio-BWPi0DII.mjs.map +0 -1
  407. package/dist/chunks/NcActionRouter-C7VSuJLq.mjs.map +0 -1
  408. package/dist/chunks/NcActionText-ByD1mFXe.mjs.map +0 -1
  409. package/dist/chunks/NcActionTextEditable-DLKA6lfe.mjs.map +0 -1
  410. package/dist/chunks/NcActions-DxTtucKk.mjs.map +0 -1
  411. package/dist/chunks/NcAppContent-Cu9zhNK3.mjs.map +0 -1
  412. package/dist/chunks/NcAppNavigationItem-C7bIZuo2.mjs.map +0 -1
  413. package/dist/chunks/NcAppNavigationNew-BO-Llutk.mjs.map +0 -1
  414. package/dist/chunks/NcAppNavigationSearch-DLbzvkkq.mjs.map +0 -1
  415. package/dist/chunks/NcAppNavigationSettings-vM8ajNNK.mjs.map +0 -1
  416. package/dist/chunks/NcAppNavigationToggle-DBtf139E.mjs.map +0 -1
  417. package/dist/chunks/NcAppSidebar-Dav-iGv2.mjs.map +0 -1
  418. package/dist/chunks/NcAvatar-A1YnlIoN.mjs.map +0 -1
  419. package/dist/chunks/NcBreadcrumb-D5cRcQg5.mjs.map +0 -1
  420. package/dist/chunks/NcBreadcrumbs-CnWT9rE5.mjs.map +0 -1
  421. package/dist/chunks/NcButton-QmfEsvXC.mjs.map +0 -1
  422. package/dist/chunks/NcCheckboxRadioSwitch-Ctdu7_UC.mjs.map +0 -1
  423. package/dist/chunks/NcChip-BnD-EmBn.mjs.map +0 -1
  424. package/dist/chunks/NcCollectionList-9YfN6xAi.mjs.map +0 -1
  425. package/dist/chunks/NcColorPicker-DQqAv2wB.mjs.map +0 -1
  426. package/dist/chunks/NcDateTime-D3snW0sN.mjs +0 -65
  427. package/dist/chunks/NcDateTime-D3snW0sN.mjs.map +0 -1
  428. package/dist/chunks/NcDateTimePicker-DUPn2UCM.mjs +0 -377
  429. package/dist/chunks/NcDateTimePicker-DUPn2UCM.mjs.map +0 -1
  430. package/dist/chunks/NcDateTimePickerNative-Dbc6pBXk.mjs.map +0 -1
  431. package/dist/chunks/NcDialog-B81mllwn.mjs.map +0 -1
  432. package/dist/chunks/NcDialogButton.vue_vue_type_script_setup_true_lang-DgWqkSL7.mjs.map +0 -1
  433. package/dist/chunks/NcEllipsisedOption-D4OggsNq.mjs.map +0 -1
  434. package/dist/chunks/NcEmojiPicker-DKGBXunS.mjs.map +0 -1
  435. package/dist/chunks/NcEmptyContent-D-wBvEi4.mjs.map +0 -1
  436. package/dist/chunks/NcHeaderMenu-BRiroRYT.mjs.map +0 -1
  437. package/dist/chunks/NcHighlight-BHtRIzqk.mjs.map +0 -1
  438. package/dist/chunks/NcInputConfirmCancel-xnrPAGac.mjs.map +0 -1
  439. package/dist/chunks/NcInputField-CzC820tG.mjs.map +0 -1
  440. package/dist/chunks/NcListItem-DFLsabmR.mjs.map +0 -1
  441. package/dist/chunks/NcPopover-D4D97Y3j.mjs.map +0 -1
  442. package/dist/chunks/NcRelatedResourcesPanel-DsuNT9hM.mjs.map +0 -1
  443. package/dist/chunks/NcRichContenteditable-BkSojqgy.mjs.map +0 -1
  444. package/dist/chunks/NcRichText-Cn583bql.mjs +0 -414
  445. package/dist/chunks/NcRichText-Cn583bql.mjs.map +0 -1
  446. package/dist/chunks/NcSelect-B61ik8an.mjs.map +0 -1
  447. package/dist/chunks/NcSettingsInputText-B5FrLCL9.mjs.map +0 -1
  448. package/dist/chunks/NcSettingsSelectGroup-CKIbxms2.mjs.map +0 -1
  449. package/dist/chunks/NcTextArea-C-PMlEbl.mjs.map +0 -1
  450. package/dist/chunks/NcTimezonePicker-tZmX1Qp4.mjs.map +0 -1
  451. package/dist/chunks/_l10n-BEP_UzXI.mjs +0 -133
  452. package/dist/chunks/_l10n-BEP_UzXI.mjs.map +0 -1
  453. package/dist/chunks/actionText-aI0owku1.mjs.map +0 -1
  454. package/dist/chunks/usernameToColor-B_Q_sS3j.mjs +0 -26
  455. package/dist/chunks/usernameToColor-B_Q_sS3j.mjs.map +0 -1
  456. package/dist/utils/FindRanges.d.ts +0 -13
  457. package/dist/utils/GenColors.d.ts +0 -28
  458. package/dist/utils/GenRandomId.d.ts +0 -6
  459. package/dist/utils/GetChildren.d.ts +0 -13
  460. package/dist/utils/GetParent.d.ts +0 -13
  461. package/dist/utils/Linkify.d.ts +0 -8
@@ -0,0 +1,3673 @@
1
+ import '../assets/NcRichText-Dvt8jvWN.css';
2
+ import { unified } from "unified";
3
+ import { resolveComponent, createElementBlock, createCommentVNode, openBlock, normalizeClass, Fragment, renderList, createBlock, ref, h } from "vue";
4
+ import { RouterLink } from "vue-router";
5
+ import remarkParse from "remark-parse";
6
+ import breaks from "remark-breaks";
7
+ import remark2rehype from "remark-rehype";
8
+ import rehype2react from "rehype-react";
9
+ import rehypeExternalLinks from "rehype-external-links";
10
+ import { N as NcCheckboxRadioSwitch } from "./NcCheckboxRadioSwitch-CWU_M_ui.mjs";
11
+ import { N as NcReferenceWidget } from "./referencePickerModal-BpNnwC_g.mjs";
12
+ import { U as URL_PATTERN, p as parseUrl, g as getRoute, r as remarkAutolink } from "./autolink-CKPk5rzg.mjs";
13
+ import axios from "@nextcloud/axios";
14
+ import { getSharingToken } from "@nextcloud/sharing/public";
15
+ import { getCurrentUser } from "@nextcloud/auth";
16
+ import { generateOcsUrl } from "@nextcloud/router";
17
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.mjs";
18
+ import { u } from "unist-builder";
19
+ import { visit, EXIT as EXIT$1, SKIP as SKIP$1 } from "unist-util-visit";
20
+ import { c as createElementId } from "./createElementId-DhjFt1I9.mjs";
21
+ function ccount(value, character) {
22
+ const source = String(value);
23
+ if (typeof character !== "string") {
24
+ throw new TypeError("Expected character");
25
+ }
26
+ let count = 0;
27
+ let index = source.indexOf(character);
28
+ while (index !== -1) {
29
+ count++;
30
+ index = source.indexOf(character, index + character.length);
31
+ }
32
+ return count;
33
+ }
34
+ function ok$1() {
35
+ }
36
+ const asciiAlpha = regexCheck(/[A-Za-z]/);
37
+ const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
38
+ function asciiControl(code2) {
39
+ return (
40
+ // Special whitespace codes (which have negative values), C0 and Control
41
+ // character DEL
42
+ code2 !== null && (code2 < 32 || code2 === 127)
43
+ );
44
+ }
45
+ function markdownLineEnding(code2) {
46
+ return code2 !== null && code2 < -2;
47
+ }
48
+ function markdownLineEndingOrSpace(code2) {
49
+ return code2 !== null && (code2 < 0 || code2 === 32);
50
+ }
51
+ function markdownSpace(code2) {
52
+ return code2 === -2 || code2 === -1 || code2 === 32;
53
+ }
54
+ const unicodePunctuation = regexCheck(new RegExp("\\p{P}|\\p{S}", "u"));
55
+ const unicodeWhitespace = regexCheck(/\s/);
56
+ function regexCheck(regex) {
57
+ return check;
58
+ function check(code2) {
59
+ return code2 !== null && code2 > -1 && regex.test(String.fromCharCode(code2));
60
+ }
61
+ }
62
+ function escapeStringRegexp(string) {
63
+ if (typeof string !== "string") {
64
+ throw new TypeError("Expected a string");
65
+ }
66
+ return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
67
+ }
68
+ const convert = (
69
+ // Note: overloads in JSDoc can’t yet use different `@template`s.
70
+ /**
71
+ * @type {(
72
+ * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
73
+ * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
74
+ * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
75
+ * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
76
+ * ((test?: Test) => Check)
77
+ * )}
78
+ */
79
+ /**
80
+ * @param {Test} [test]
81
+ * @returns {Check}
82
+ */
83
+ function(test) {
84
+ if (test === null || test === void 0) {
85
+ return ok;
86
+ }
87
+ if (typeof test === "function") {
88
+ return castFactory(test);
89
+ }
90
+ if (typeof test === "object") {
91
+ return Array.isArray(test) ? anyFactory(test) : propsFactory(test);
92
+ }
93
+ if (typeof test === "string") {
94
+ return typeFactory(test);
95
+ }
96
+ throw new Error("Expected function, string, or object as test");
97
+ }
98
+ );
99
+ function anyFactory(tests) {
100
+ const checks = [];
101
+ let index = -1;
102
+ while (++index < tests.length) {
103
+ checks[index] = convert(tests[index]);
104
+ }
105
+ return castFactory(any);
106
+ function any(...parameters) {
107
+ let index2 = -1;
108
+ while (++index2 < checks.length) {
109
+ if (checks[index2].apply(this, parameters)) return true;
110
+ }
111
+ return false;
112
+ }
113
+ }
114
+ function propsFactory(check) {
115
+ const checkAsRecord = (
116
+ /** @type {Record<string, unknown>} */
117
+ check
118
+ );
119
+ return castFactory(all2);
120
+ function all2(node2) {
121
+ const nodeAsRecord = (
122
+ /** @type {Record<string, unknown>} */
123
+ /** @type {unknown} */
124
+ node2
125
+ );
126
+ let key;
127
+ for (key in check) {
128
+ if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
129
+ }
130
+ return true;
131
+ }
132
+ }
133
+ function typeFactory(check) {
134
+ return castFactory(type);
135
+ function type(node2) {
136
+ return node2 && node2.type === check;
137
+ }
138
+ }
139
+ function castFactory(testFunction) {
140
+ return check;
141
+ function check(value, index, parent) {
142
+ return Boolean(
143
+ looksLikeANode(value) && testFunction.call(
144
+ this,
145
+ value,
146
+ typeof index === "number" ? index : void 0,
147
+ parent || void 0
148
+ )
149
+ );
150
+ }
151
+ }
152
+ function ok() {
153
+ return true;
154
+ }
155
+ function looksLikeANode(value) {
156
+ return value !== null && typeof value === "object" && "type" in value;
157
+ }
158
+ function color(d) {
159
+ return d;
160
+ }
161
+ const empty = [];
162
+ const CONTINUE = true;
163
+ const EXIT = false;
164
+ const SKIP = "skip";
165
+ function visitParents(tree, test, visitor, reverse) {
166
+ let check;
167
+ {
168
+ check = test;
169
+ }
170
+ const is = convert(check);
171
+ const step = 1;
172
+ factory(tree, void 0, [])();
173
+ function factory(node2, index, parents) {
174
+ const value = (
175
+ /** @type {Record<string, unknown>} */
176
+ node2 && typeof node2 === "object" ? node2 : {}
177
+ );
178
+ if (typeof value.type === "string") {
179
+ const name = (
180
+ // `hast`
181
+ typeof value.tagName === "string" ? value.tagName : (
182
+ // `xast`
183
+ typeof value.name === "string" ? value.name : void 0
184
+ )
185
+ );
186
+ Object.defineProperty(visit2, "name", {
187
+ value: "node (" + color(node2.type + (name ? "<" + name + ">" : "")) + ")"
188
+ });
189
+ }
190
+ return visit2;
191
+ function visit2() {
192
+ let result = empty;
193
+ let subresult;
194
+ let offset;
195
+ let grandparents;
196
+ if (is(node2, index, parents[parents.length - 1] || void 0)) {
197
+ result = toResult(visitor(node2, parents));
198
+ if (result[0] === EXIT) {
199
+ return result;
200
+ }
201
+ }
202
+ if ("children" in node2 && node2.children) {
203
+ const nodeAsParent = (
204
+ /** @type {UnistParent} */
205
+ node2
206
+ );
207
+ if (nodeAsParent.children && result[0] !== SKIP) {
208
+ offset = -1 + step;
209
+ grandparents = parents.concat(nodeAsParent);
210
+ while (offset > -1 && offset < nodeAsParent.children.length) {
211
+ const child = nodeAsParent.children[offset];
212
+ subresult = factory(child, offset, grandparents)();
213
+ if (subresult[0] === EXIT) {
214
+ return subresult;
215
+ }
216
+ offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
217
+ }
218
+ }
219
+ }
220
+ return result;
221
+ }
222
+ }
223
+ }
224
+ function toResult(value) {
225
+ if (Array.isArray(value)) {
226
+ return value;
227
+ }
228
+ if (typeof value === "number") {
229
+ return [CONTINUE, value];
230
+ }
231
+ return value === null || value === void 0 ? empty : [value];
232
+ }
233
+ function findAndReplace(tree, list2, options) {
234
+ const settings = options || {};
235
+ const ignored = convert(settings.ignore || []);
236
+ const pairs = toPairs(list2);
237
+ let pairIndex = -1;
238
+ while (++pairIndex < pairs.length) {
239
+ visitParents(tree, "text", visitor);
240
+ }
241
+ function visitor(node2, parents) {
242
+ let index = -1;
243
+ let grandparent;
244
+ while (++index < parents.length) {
245
+ const parent = parents[index];
246
+ const siblings = grandparent ? grandparent.children : void 0;
247
+ if (ignored(
248
+ parent,
249
+ siblings ? siblings.indexOf(parent) : void 0,
250
+ grandparent
251
+ )) {
252
+ return;
253
+ }
254
+ grandparent = parent;
255
+ }
256
+ if (grandparent) {
257
+ return handler(node2, parents);
258
+ }
259
+ }
260
+ function handler(node2, parents) {
261
+ const parent = parents[parents.length - 1];
262
+ const find = pairs[pairIndex][0];
263
+ const replace2 = pairs[pairIndex][1];
264
+ let start = 0;
265
+ const siblings = parent.children;
266
+ const index = siblings.indexOf(node2);
267
+ let change = false;
268
+ let nodes = [];
269
+ find.lastIndex = 0;
270
+ let match = find.exec(node2.value);
271
+ while (match) {
272
+ const position = match.index;
273
+ const matchObject = {
274
+ index: match.index,
275
+ input: match.input,
276
+ stack: [...parents, node2]
277
+ };
278
+ let value = replace2(...match, matchObject);
279
+ if (typeof value === "string") {
280
+ value = value.length > 0 ? { type: "text", value } : void 0;
281
+ }
282
+ if (value === false) {
283
+ find.lastIndex = position + 1;
284
+ } else {
285
+ if (start !== position) {
286
+ nodes.push({
287
+ type: "text",
288
+ value: node2.value.slice(start, position)
289
+ });
290
+ }
291
+ if (Array.isArray(value)) {
292
+ nodes.push(...value);
293
+ } else if (value) {
294
+ nodes.push(value);
295
+ }
296
+ start = position + match[0].length;
297
+ change = true;
298
+ }
299
+ if (!find.global) {
300
+ break;
301
+ }
302
+ match = find.exec(node2.value);
303
+ }
304
+ if (change) {
305
+ if (start < node2.value.length) {
306
+ nodes.push({ type: "text", value: node2.value.slice(start) });
307
+ }
308
+ parent.children.splice(index, 1, ...nodes);
309
+ } else {
310
+ nodes = [node2];
311
+ }
312
+ return index + nodes.length;
313
+ }
314
+ }
315
+ function toPairs(tupleOrList) {
316
+ const result = [];
317
+ if (!Array.isArray(tupleOrList)) {
318
+ throw new TypeError("Expected find and replace tuple or list of tuples");
319
+ }
320
+ const list2 = !tupleOrList[0] || Array.isArray(tupleOrList[0]) ? tupleOrList : [tupleOrList];
321
+ let index = -1;
322
+ while (++index < list2.length) {
323
+ const tuple = list2[index];
324
+ result.push([toExpression(tuple[0]), toFunction(tuple[1])]);
325
+ }
326
+ return result;
327
+ }
328
+ function toExpression(find) {
329
+ return typeof find === "string" ? new RegExp(escapeStringRegexp(find), "g") : find;
330
+ }
331
+ function toFunction(replace2) {
332
+ return typeof replace2 === "function" ? replace2 : function() {
333
+ return replace2;
334
+ };
335
+ }
336
+ const inConstruct = "phrasing";
337
+ const notInConstruct = ["autolink", "link", "image", "label"];
338
+ function gfmAutolinkLiteralFromMarkdown() {
339
+ return {
340
+ transforms: [transformGfmAutolinkLiterals],
341
+ enter: {
342
+ literalAutolink: enterLiteralAutolink,
343
+ literalAutolinkEmail: enterLiteralAutolinkValue,
344
+ literalAutolinkHttp: enterLiteralAutolinkValue,
345
+ literalAutolinkWww: enterLiteralAutolinkValue
346
+ },
347
+ exit: {
348
+ literalAutolink: exitLiteralAutolink,
349
+ literalAutolinkEmail: exitLiteralAutolinkEmail,
350
+ literalAutolinkHttp: exitLiteralAutolinkHttp,
351
+ literalAutolinkWww: exitLiteralAutolinkWww
352
+ }
353
+ };
354
+ }
355
+ function gfmAutolinkLiteralToMarkdown() {
356
+ return {
357
+ unsafe: [
358
+ {
359
+ character: "@",
360
+ before: "[+\\-.\\w]",
361
+ after: "[\\-.\\w]",
362
+ inConstruct,
363
+ notInConstruct
364
+ },
365
+ {
366
+ character: ".",
367
+ before: "[Ww]",
368
+ after: "[\\-.\\w]",
369
+ inConstruct,
370
+ notInConstruct
371
+ },
372
+ {
373
+ character: ":",
374
+ before: "[ps]",
375
+ after: "\\/",
376
+ inConstruct,
377
+ notInConstruct
378
+ }
379
+ ]
380
+ };
381
+ }
382
+ function enterLiteralAutolink(token) {
383
+ this.enter({ type: "link", title: null, url: "", children: [] }, token);
384
+ }
385
+ function enterLiteralAutolinkValue(token) {
386
+ this.config.enter.autolinkProtocol.call(this, token);
387
+ }
388
+ function exitLiteralAutolinkHttp(token) {
389
+ this.config.exit.autolinkProtocol.call(this, token);
390
+ }
391
+ function exitLiteralAutolinkWww(token) {
392
+ this.config.exit.data.call(this, token);
393
+ const node2 = this.stack[this.stack.length - 1];
394
+ ok$1(node2.type === "link");
395
+ node2.url = "http://" + this.sliceSerialize(token);
396
+ }
397
+ function exitLiteralAutolinkEmail(token) {
398
+ this.config.exit.autolinkEmail.call(this, token);
399
+ }
400
+ function exitLiteralAutolink(token) {
401
+ this.exit(token);
402
+ }
403
+ function transformGfmAutolinkLiterals(tree) {
404
+ findAndReplace(
405
+ tree,
406
+ [
407
+ [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl],
408
+ [/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g, findEmail]
409
+ ],
410
+ { ignore: ["link", "linkReference"] }
411
+ );
412
+ }
413
+ function findUrl(_, protocol, domain2, path2, match) {
414
+ let prefix = "";
415
+ if (!previous(match)) {
416
+ return false;
417
+ }
418
+ if (/^w/i.test(protocol)) {
419
+ domain2 = protocol + domain2;
420
+ protocol = "";
421
+ prefix = "http://";
422
+ }
423
+ if (!isCorrectDomain(domain2)) {
424
+ return false;
425
+ }
426
+ const parts = splitUrl(domain2 + path2);
427
+ if (!parts[0]) return false;
428
+ const result = {
429
+ type: "link",
430
+ title: null,
431
+ url: prefix + protocol + parts[0],
432
+ children: [{ type: "text", value: protocol + parts[0] }]
433
+ };
434
+ if (parts[1]) {
435
+ return [result, { type: "text", value: parts[1] }];
436
+ }
437
+ return result;
438
+ }
439
+ function findEmail(_, atext, label, match) {
440
+ if (
441
+ // Not an expected previous character.
442
+ !previous(match, true) || // Label ends in not allowed character.
443
+ /[-\d_]$/.test(label)
444
+ ) {
445
+ return false;
446
+ }
447
+ return {
448
+ type: "link",
449
+ title: null,
450
+ url: "mailto:" + atext + "@" + label,
451
+ children: [{ type: "text", value: atext + "@" + label }]
452
+ };
453
+ }
454
+ function isCorrectDomain(domain2) {
455
+ const parts = domain2.split(".");
456
+ if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\d]/.test(parts[parts.length - 2]))) {
457
+ return false;
458
+ }
459
+ return true;
460
+ }
461
+ function splitUrl(url) {
462
+ const trailExec = /[!"&'),.:;<>?\]}]+$/.exec(url);
463
+ if (!trailExec) {
464
+ return [url, void 0];
465
+ }
466
+ url = url.slice(0, trailExec.index);
467
+ let trail2 = trailExec[0];
468
+ let closingParenIndex = trail2.indexOf(")");
469
+ const openingParens = ccount(url, "(");
470
+ let closingParens = ccount(url, ")");
471
+ while (closingParenIndex !== -1 && openingParens > closingParens) {
472
+ url += trail2.slice(0, closingParenIndex + 1);
473
+ trail2 = trail2.slice(closingParenIndex + 1);
474
+ closingParenIndex = trail2.indexOf(")");
475
+ closingParens++;
476
+ }
477
+ return [url, trail2];
478
+ }
479
+ function previous(match, email) {
480
+ const code2 = match.input.charCodeAt(match.index - 1);
481
+ return (match.index === 0 || unicodeWhitespace(code2) || unicodePunctuation(code2)) && (!email || code2 !== 47);
482
+ }
483
+ function normalizeIdentifier(value) {
484
+ return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
485
+ }
486
+ footnoteReference.peek = footnoteReferencePeek;
487
+ function gfmFootnoteFromMarkdown() {
488
+ return {
489
+ enter: {
490
+ gfmFootnoteDefinition: enterFootnoteDefinition,
491
+ gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,
492
+ gfmFootnoteCall: enterFootnoteCall,
493
+ gfmFootnoteCallString: enterFootnoteCallString
494
+ },
495
+ exit: {
496
+ gfmFootnoteDefinition: exitFootnoteDefinition,
497
+ gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,
498
+ gfmFootnoteCall: exitFootnoteCall,
499
+ gfmFootnoteCallString: exitFootnoteCallString
500
+ }
501
+ };
502
+ }
503
+ function gfmFootnoteToMarkdown() {
504
+ return {
505
+ // This is on by default already.
506
+ unsafe: [{ character: "[", inConstruct: ["phrasing", "label", "reference"] }],
507
+ handlers: { footnoteDefinition, footnoteReference }
508
+ };
509
+ }
510
+ function enterFootnoteDefinition(token) {
511
+ this.enter(
512
+ { type: "footnoteDefinition", identifier: "", label: "", children: [] },
513
+ token
514
+ );
515
+ }
516
+ function enterFootnoteDefinitionLabelString() {
517
+ this.buffer();
518
+ }
519
+ function exitFootnoteDefinitionLabelString(token) {
520
+ const label = this.resume();
521
+ const node2 = this.stack[this.stack.length - 1];
522
+ ok$1(node2.type === "footnoteDefinition");
523
+ node2.label = label;
524
+ node2.identifier = normalizeIdentifier(
525
+ this.sliceSerialize(token)
526
+ ).toLowerCase();
527
+ }
528
+ function exitFootnoteDefinition(token) {
529
+ this.exit(token);
530
+ }
531
+ function enterFootnoteCall(token) {
532
+ this.enter({ type: "footnoteReference", identifier: "", label: "" }, token);
533
+ }
534
+ function enterFootnoteCallString() {
535
+ this.buffer();
536
+ }
537
+ function exitFootnoteCallString(token) {
538
+ const label = this.resume();
539
+ const node2 = this.stack[this.stack.length - 1];
540
+ ok$1(node2.type === "footnoteReference");
541
+ node2.label = label;
542
+ node2.identifier = normalizeIdentifier(
543
+ this.sliceSerialize(token)
544
+ ).toLowerCase();
545
+ }
546
+ function exitFootnoteCall(token) {
547
+ this.exit(token);
548
+ }
549
+ function footnoteReference(node2, _, state, info) {
550
+ const tracker = state.createTracker(info);
551
+ let value = tracker.move("[^");
552
+ const exit2 = state.enter("footnoteReference");
553
+ const subexit = state.enter("reference");
554
+ value += tracker.move(
555
+ state.safe(state.associationId(node2), {
556
+ ...tracker.current(),
557
+ before: value,
558
+ after: "]"
559
+ })
560
+ );
561
+ subexit();
562
+ exit2();
563
+ value += tracker.move("]");
564
+ return value;
565
+ }
566
+ function footnoteReferencePeek() {
567
+ return "[";
568
+ }
569
+ function footnoteDefinition(node2, _, state, info) {
570
+ const tracker = state.createTracker(info);
571
+ let value = tracker.move("[^");
572
+ const exit2 = state.enter("footnoteDefinition");
573
+ const subexit = state.enter("label");
574
+ value += tracker.move(
575
+ state.safe(state.associationId(node2), {
576
+ ...tracker.current(),
577
+ before: value,
578
+ after: "]"
579
+ })
580
+ );
581
+ subexit();
582
+ value += tracker.move(
583
+ "]:" + (node2.children && node2.children.length > 0 ? " " : "")
584
+ );
585
+ tracker.shift(4);
586
+ value += tracker.move(
587
+ state.indentLines(state.containerFlow(node2, tracker.current()), map$2)
588
+ );
589
+ exit2();
590
+ return value;
591
+ }
592
+ function map$2(line, index, blank) {
593
+ if (index === 0) {
594
+ return line;
595
+ }
596
+ return (blank ? "" : " ") + line;
597
+ }
598
+ const constructsWithoutStrikethrough = [
599
+ "autolink",
600
+ "destinationLiteral",
601
+ "destinationRaw",
602
+ "reference",
603
+ "titleQuote",
604
+ "titleApostrophe"
605
+ ];
606
+ handleDelete.peek = peekDelete;
607
+ function gfmStrikethroughFromMarkdown() {
608
+ return {
609
+ canContainEols: ["delete"],
610
+ enter: { strikethrough: enterStrikethrough },
611
+ exit: { strikethrough: exitStrikethrough }
612
+ };
613
+ }
614
+ function gfmStrikethroughToMarkdown() {
615
+ return {
616
+ unsafe: [
617
+ {
618
+ character: "~",
619
+ inConstruct: "phrasing",
620
+ notInConstruct: constructsWithoutStrikethrough
621
+ }
622
+ ],
623
+ handlers: { delete: handleDelete }
624
+ };
625
+ }
626
+ function enterStrikethrough(token) {
627
+ this.enter({ type: "delete", children: [] }, token);
628
+ }
629
+ function exitStrikethrough(token) {
630
+ this.exit(token);
631
+ }
632
+ function handleDelete(node2, _, state, info) {
633
+ const tracker = state.createTracker(info);
634
+ const exit2 = state.enter("strikethrough");
635
+ let value = tracker.move("~~");
636
+ value += state.containerPhrasing(node2, {
637
+ ...tracker.current(),
638
+ before: value,
639
+ after: "~"
640
+ });
641
+ value += tracker.move("~~");
642
+ exit2();
643
+ return value;
644
+ }
645
+ function peekDelete() {
646
+ return "~";
647
+ }
648
+ function markdownTable(table, options = {}) {
649
+ const align = (options.align || []).concat();
650
+ const stringLength = options.stringLength || defaultStringLength;
651
+ const alignments = [];
652
+ const cellMatrix = [];
653
+ const sizeMatrix = [];
654
+ const longestCellByColumn = [];
655
+ let mostCellsPerRow = 0;
656
+ let rowIndex = -1;
657
+ while (++rowIndex < table.length) {
658
+ const row2 = [];
659
+ const sizes2 = [];
660
+ let columnIndex2 = -1;
661
+ if (table[rowIndex].length > mostCellsPerRow) {
662
+ mostCellsPerRow = table[rowIndex].length;
663
+ }
664
+ while (++columnIndex2 < table[rowIndex].length) {
665
+ const cell = serialize(table[rowIndex][columnIndex2]);
666
+ if (options.alignDelimiters !== false) {
667
+ const size = stringLength(cell);
668
+ sizes2[columnIndex2] = size;
669
+ if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {
670
+ longestCellByColumn[columnIndex2] = size;
671
+ }
672
+ }
673
+ row2.push(cell);
674
+ }
675
+ cellMatrix[rowIndex] = row2;
676
+ sizeMatrix[rowIndex] = sizes2;
677
+ }
678
+ let columnIndex = -1;
679
+ if (typeof align === "object" && "length" in align) {
680
+ while (++columnIndex < mostCellsPerRow) {
681
+ alignments[columnIndex] = toAlignment(align[columnIndex]);
682
+ }
683
+ } else {
684
+ const code2 = toAlignment(align);
685
+ while (++columnIndex < mostCellsPerRow) {
686
+ alignments[columnIndex] = code2;
687
+ }
688
+ }
689
+ columnIndex = -1;
690
+ const row = [];
691
+ const sizes = [];
692
+ while (++columnIndex < mostCellsPerRow) {
693
+ const code2 = alignments[columnIndex];
694
+ let before = "";
695
+ let after = "";
696
+ if (code2 === 99) {
697
+ before = ":";
698
+ after = ":";
699
+ } else if (code2 === 108) {
700
+ before = ":";
701
+ } else if (code2 === 114) {
702
+ after = ":";
703
+ }
704
+ let size = options.alignDelimiters === false ? 1 : Math.max(
705
+ 1,
706
+ longestCellByColumn[columnIndex] - before.length - after.length
707
+ );
708
+ const cell = before + "-".repeat(size) + after;
709
+ if (options.alignDelimiters !== false) {
710
+ size = before.length + size + after.length;
711
+ if (size > longestCellByColumn[columnIndex]) {
712
+ longestCellByColumn[columnIndex] = size;
713
+ }
714
+ sizes[columnIndex] = size;
715
+ }
716
+ row[columnIndex] = cell;
717
+ }
718
+ cellMatrix.splice(1, 0, row);
719
+ sizeMatrix.splice(1, 0, sizes);
720
+ rowIndex = -1;
721
+ const lines = [];
722
+ while (++rowIndex < cellMatrix.length) {
723
+ const row2 = cellMatrix[rowIndex];
724
+ const sizes2 = sizeMatrix[rowIndex];
725
+ columnIndex = -1;
726
+ const line = [];
727
+ while (++columnIndex < mostCellsPerRow) {
728
+ const cell = row2[columnIndex] || "";
729
+ let before = "";
730
+ let after = "";
731
+ if (options.alignDelimiters !== false) {
732
+ const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
733
+ const code2 = alignments[columnIndex];
734
+ if (code2 === 114) {
735
+ before = " ".repeat(size);
736
+ } else if (code2 === 99) {
737
+ if (size % 2) {
738
+ before = " ".repeat(size / 2 + 0.5);
739
+ after = " ".repeat(size / 2 - 0.5);
740
+ } else {
741
+ before = " ".repeat(size / 2);
742
+ after = before;
743
+ }
744
+ } else {
745
+ after = " ".repeat(size);
746
+ }
747
+ }
748
+ if (options.delimiterStart !== false && !columnIndex) {
749
+ line.push("|");
750
+ }
751
+ if (options.padding !== false && // Don’t add the opening space if we’re not aligning and the cell is
752
+ // empty: there will be a closing space.
753
+ !(options.alignDelimiters === false && cell === "") && (options.delimiterStart !== false || columnIndex)) {
754
+ line.push(" ");
755
+ }
756
+ if (options.alignDelimiters !== false) {
757
+ line.push(before);
758
+ }
759
+ line.push(cell);
760
+ if (options.alignDelimiters !== false) {
761
+ line.push(after);
762
+ }
763
+ if (options.padding !== false) {
764
+ line.push(" ");
765
+ }
766
+ if (options.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
767
+ line.push("|");
768
+ }
769
+ }
770
+ lines.push(
771
+ options.delimiterEnd === false ? line.join("").replace(/ +$/, "") : line.join("")
772
+ );
773
+ }
774
+ return lines.join("\n");
775
+ }
776
+ function serialize(value) {
777
+ return value === null || value === void 0 ? "" : String(value);
778
+ }
779
+ function defaultStringLength(value) {
780
+ return value.length;
781
+ }
782
+ function toAlignment(value) {
783
+ const code2 = typeof value === "string" ? value.codePointAt(0) : 0;
784
+ return code2 === 67 || code2 === 99 ? 99 : code2 === 76 || code2 === 108 ? 108 : code2 === 82 || code2 === 114 ? 114 : 0;
785
+ }
786
+ function blockquote(node2, _, state, info) {
787
+ const exit2 = state.enter("blockquote");
788
+ const tracker = state.createTracker(info);
789
+ tracker.move("> ");
790
+ tracker.shift(2);
791
+ const value = state.indentLines(
792
+ state.containerFlow(node2, tracker.current()),
793
+ map$1
794
+ );
795
+ exit2();
796
+ return value;
797
+ }
798
+ function map$1(line, _, blank) {
799
+ return ">" + (blank ? "" : " ") + line;
800
+ }
801
+ function patternInScope(stack, pattern) {
802
+ return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);
803
+ }
804
+ function listInScope(stack, list2, none) {
805
+ if (typeof list2 === "string") {
806
+ list2 = [list2];
807
+ }
808
+ if (!list2 || list2.length === 0) {
809
+ return none;
810
+ }
811
+ let index = -1;
812
+ while (++index < list2.length) {
813
+ if (stack.includes(list2[index])) {
814
+ return true;
815
+ }
816
+ }
817
+ return false;
818
+ }
819
+ function hardBreak(_, _1, state, info) {
820
+ let index = -1;
821
+ while (++index < state.unsafe.length) {
822
+ if (state.unsafe[index].character === "\n" && patternInScope(state.stack, state.unsafe[index])) {
823
+ return /[ \t]/.test(info.before) ? "" : " ";
824
+ }
825
+ }
826
+ return "\\\n";
827
+ }
828
+ function longestStreak(value, substring) {
829
+ const source = String(value);
830
+ let index = source.indexOf(substring);
831
+ let expected = index;
832
+ let count = 0;
833
+ let max = 0;
834
+ if (typeof substring !== "string") {
835
+ throw new TypeError("Expected substring");
836
+ }
837
+ while (index !== -1) {
838
+ if (index === expected) {
839
+ if (++count > max) {
840
+ max = count;
841
+ }
842
+ } else {
843
+ count = 1;
844
+ }
845
+ expected = index + substring.length;
846
+ index = source.indexOf(substring, expected);
847
+ }
848
+ return max;
849
+ }
850
+ function formatCodeAsIndented(node2, state) {
851
+ return Boolean(
852
+ state.options.fences === false && node2.value && // If there’s no info…
853
+ !node2.lang && // And there’s a non-whitespace character…
854
+ /[^ \r\n]/.test(node2.value) && // And the value doesn’t start or end in a blank…
855
+ !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node2.value)
856
+ );
857
+ }
858
+ function checkFence(state) {
859
+ const marker = state.options.fence || "`";
860
+ if (marker !== "`" && marker !== "~") {
861
+ throw new Error(
862
+ "Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`"
863
+ );
864
+ }
865
+ return marker;
866
+ }
867
+ function code$1(node2, _, state, info) {
868
+ const marker = checkFence(state);
869
+ const raw = node2.value || "";
870
+ const suffix = marker === "`" ? "GraveAccent" : "Tilde";
871
+ if (formatCodeAsIndented(node2, state)) {
872
+ const exit3 = state.enter("codeIndented");
873
+ const value2 = state.indentLines(raw, map);
874
+ exit3();
875
+ return value2;
876
+ }
877
+ const tracker = state.createTracker(info);
878
+ const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
879
+ const exit2 = state.enter("codeFenced");
880
+ let value = tracker.move(sequence);
881
+ if (node2.lang) {
882
+ const subexit = state.enter(`codeFencedLang${suffix}`);
883
+ value += tracker.move(
884
+ state.safe(node2.lang, {
885
+ before: value,
886
+ after: " ",
887
+ encode: ["`"],
888
+ ...tracker.current()
889
+ })
890
+ );
891
+ subexit();
892
+ }
893
+ if (node2.lang && node2.meta) {
894
+ const subexit = state.enter(`codeFencedMeta${suffix}`);
895
+ value += tracker.move(" ");
896
+ value += tracker.move(
897
+ state.safe(node2.meta, {
898
+ before: value,
899
+ after: "\n",
900
+ encode: ["`"],
901
+ ...tracker.current()
902
+ })
903
+ );
904
+ subexit();
905
+ }
906
+ value += tracker.move("\n");
907
+ if (raw) {
908
+ value += tracker.move(raw + "\n");
909
+ }
910
+ value += tracker.move(sequence);
911
+ exit2();
912
+ return value;
913
+ }
914
+ function map(line, _, blank) {
915
+ return (blank ? "" : " ") + line;
916
+ }
917
+ function checkQuote(state) {
918
+ const marker = state.options.quote || '"';
919
+ if (marker !== '"' && marker !== "'") {
920
+ throw new Error(
921
+ "Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`"
922
+ );
923
+ }
924
+ return marker;
925
+ }
926
+ function definition(node2, _, state, info) {
927
+ const quote = checkQuote(state);
928
+ const suffix = quote === '"' ? "Quote" : "Apostrophe";
929
+ const exit2 = state.enter("definition");
930
+ let subexit = state.enter("label");
931
+ const tracker = state.createTracker(info);
932
+ let value = tracker.move("[");
933
+ value += tracker.move(
934
+ state.safe(state.associationId(node2), {
935
+ before: value,
936
+ after: "]",
937
+ ...tracker.current()
938
+ })
939
+ );
940
+ value += tracker.move("]: ");
941
+ subexit();
942
+ if (
943
+ // If there’s no url, or…
944
+ !node2.url || // If there are control characters or whitespace.
945
+ /[\0- \u007F]/.test(node2.url)
946
+ ) {
947
+ subexit = state.enter("destinationLiteral");
948
+ value += tracker.move("<");
949
+ value += tracker.move(
950
+ state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
951
+ );
952
+ value += tracker.move(">");
953
+ } else {
954
+ subexit = state.enter("destinationRaw");
955
+ value += tracker.move(
956
+ state.safe(node2.url, {
957
+ before: value,
958
+ after: node2.title ? " " : "\n",
959
+ ...tracker.current()
960
+ })
961
+ );
962
+ }
963
+ subexit();
964
+ if (node2.title) {
965
+ subexit = state.enter(`title${suffix}`);
966
+ value += tracker.move(" " + quote);
967
+ value += tracker.move(
968
+ state.safe(node2.title, {
969
+ before: value,
970
+ after: quote,
971
+ ...tracker.current()
972
+ })
973
+ );
974
+ value += tracker.move(quote);
975
+ subexit();
976
+ }
977
+ exit2();
978
+ return value;
979
+ }
980
+ function checkEmphasis(state) {
981
+ const marker = state.options.emphasis || "*";
982
+ if (marker !== "*" && marker !== "_") {
983
+ throw new Error(
984
+ "Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`"
985
+ );
986
+ }
987
+ return marker;
988
+ }
989
+ emphasis.peek = emphasisPeek;
990
+ function emphasis(node2, _, state, info) {
991
+ const marker = checkEmphasis(state);
992
+ const exit2 = state.enter("emphasis");
993
+ const tracker = state.createTracker(info);
994
+ let value = tracker.move(marker);
995
+ value += tracker.move(
996
+ state.containerPhrasing(node2, {
997
+ before: value,
998
+ after: marker,
999
+ ...tracker.current()
1000
+ })
1001
+ );
1002
+ value += tracker.move(marker);
1003
+ exit2();
1004
+ return value;
1005
+ }
1006
+ function emphasisPeek(_, _1, state) {
1007
+ return state.options.emphasis || "*";
1008
+ }
1009
+ const emptyOptions$1 = {};
1010
+ function toString(value, options) {
1011
+ const settings = emptyOptions$1;
1012
+ const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
1013
+ const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
1014
+ return one(value, includeImageAlt, includeHtml);
1015
+ }
1016
+ function one(value, includeImageAlt, includeHtml) {
1017
+ if (node(value)) {
1018
+ if ("value" in value) {
1019
+ return value.type === "html" && !includeHtml ? "" : value.value;
1020
+ }
1021
+ if (includeImageAlt && "alt" in value && value.alt) {
1022
+ return value.alt;
1023
+ }
1024
+ if ("children" in value) {
1025
+ return all(value.children, includeImageAlt, includeHtml);
1026
+ }
1027
+ }
1028
+ if (Array.isArray(value)) {
1029
+ return all(value, includeImageAlt, includeHtml);
1030
+ }
1031
+ return "";
1032
+ }
1033
+ function all(values, includeImageAlt, includeHtml) {
1034
+ const result = [];
1035
+ let index = -1;
1036
+ while (++index < values.length) {
1037
+ result[index] = one(values[index], includeImageAlt, includeHtml);
1038
+ }
1039
+ return result.join("");
1040
+ }
1041
+ function node(value) {
1042
+ return Boolean(value && typeof value === "object");
1043
+ }
1044
+ function formatHeadingAsSetext(node2, state) {
1045
+ let literalWithBreak = false;
1046
+ visit(node2, function(node3) {
1047
+ if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") {
1048
+ literalWithBreak = true;
1049
+ return EXIT$1;
1050
+ }
1051
+ });
1052
+ return Boolean(
1053
+ (!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak)
1054
+ );
1055
+ }
1056
+ function heading(node2, _, state, info) {
1057
+ const rank = Math.max(Math.min(6, node2.depth || 1), 1);
1058
+ const tracker = state.createTracker(info);
1059
+ if (formatHeadingAsSetext(node2, state)) {
1060
+ const exit3 = state.enter("headingSetext");
1061
+ const subexit2 = state.enter("phrasing");
1062
+ const value2 = state.containerPhrasing(node2, {
1063
+ ...tracker.current(),
1064
+ before: "\n",
1065
+ after: "\n"
1066
+ });
1067
+ subexit2();
1068
+ exit3();
1069
+ return value2 + "\n" + (rank === 1 ? "=" : "-").repeat(
1070
+ // The whole size…
1071
+ value2.length - // Minus the position of the character after the last EOL (or
1072
+ // 0 if there is none)…
1073
+ (Math.max(value2.lastIndexOf("\r"), value2.lastIndexOf("\n")) + 1)
1074
+ );
1075
+ }
1076
+ const sequence = "#".repeat(rank);
1077
+ const exit2 = state.enter("headingAtx");
1078
+ const subexit = state.enter("phrasing");
1079
+ tracker.move(sequence + " ");
1080
+ let value = state.containerPhrasing(node2, {
1081
+ before: "# ",
1082
+ after: "\n",
1083
+ ...tracker.current()
1084
+ });
1085
+ if (/^[\t ]/.test(value)) {
1086
+ value = "&#x" + value.charCodeAt(0).toString(16).toUpperCase() + ";" + value.slice(1);
1087
+ }
1088
+ value = value ? sequence + " " + value : sequence;
1089
+ if (state.options.closeAtx) {
1090
+ value += " " + sequence;
1091
+ }
1092
+ subexit();
1093
+ exit2();
1094
+ return value;
1095
+ }
1096
+ html.peek = htmlPeek;
1097
+ function html(node2) {
1098
+ return node2.value || "";
1099
+ }
1100
+ function htmlPeek() {
1101
+ return "<";
1102
+ }
1103
+ image.peek = imagePeek;
1104
+ function image(node2, _, state, info) {
1105
+ const quote = checkQuote(state);
1106
+ const suffix = quote === '"' ? "Quote" : "Apostrophe";
1107
+ const exit2 = state.enter("image");
1108
+ let subexit = state.enter("label");
1109
+ const tracker = state.createTracker(info);
1110
+ let value = tracker.move("![");
1111
+ value += tracker.move(
1112
+ state.safe(node2.alt, { before: value, after: "]", ...tracker.current() })
1113
+ );
1114
+ value += tracker.move("](");
1115
+ subexit();
1116
+ if (
1117
+ // If there’s no url but there is a title…
1118
+ !node2.url && node2.title || // If there are control characters or whitespace.
1119
+ /[\0- \u007F]/.test(node2.url)
1120
+ ) {
1121
+ subexit = state.enter("destinationLiteral");
1122
+ value += tracker.move("<");
1123
+ value += tracker.move(
1124
+ state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
1125
+ );
1126
+ value += tracker.move(">");
1127
+ } else {
1128
+ subexit = state.enter("destinationRaw");
1129
+ value += tracker.move(
1130
+ state.safe(node2.url, {
1131
+ before: value,
1132
+ after: node2.title ? " " : ")",
1133
+ ...tracker.current()
1134
+ })
1135
+ );
1136
+ }
1137
+ subexit();
1138
+ if (node2.title) {
1139
+ subexit = state.enter(`title${suffix}`);
1140
+ value += tracker.move(" " + quote);
1141
+ value += tracker.move(
1142
+ state.safe(node2.title, {
1143
+ before: value,
1144
+ after: quote,
1145
+ ...tracker.current()
1146
+ })
1147
+ );
1148
+ value += tracker.move(quote);
1149
+ subexit();
1150
+ }
1151
+ value += tracker.move(")");
1152
+ exit2();
1153
+ return value;
1154
+ }
1155
+ function imagePeek() {
1156
+ return "!";
1157
+ }
1158
+ imageReference.peek = imageReferencePeek;
1159
+ function imageReference(node2, _, state, info) {
1160
+ const type = node2.referenceType;
1161
+ const exit2 = state.enter("imageReference");
1162
+ let subexit = state.enter("label");
1163
+ const tracker = state.createTracker(info);
1164
+ let value = tracker.move("![");
1165
+ const alt = state.safe(node2.alt, {
1166
+ before: value,
1167
+ after: "]",
1168
+ ...tracker.current()
1169
+ });
1170
+ value += tracker.move(alt + "][");
1171
+ subexit();
1172
+ const stack = state.stack;
1173
+ state.stack = [];
1174
+ subexit = state.enter("reference");
1175
+ const reference = state.safe(state.associationId(node2), {
1176
+ before: value,
1177
+ after: "]",
1178
+ ...tracker.current()
1179
+ });
1180
+ subexit();
1181
+ state.stack = stack;
1182
+ exit2();
1183
+ if (type === "full" || !alt || alt !== reference) {
1184
+ value += tracker.move(reference + "]");
1185
+ } else if (type === "shortcut") {
1186
+ value = value.slice(0, -1);
1187
+ } else {
1188
+ value += tracker.move("]");
1189
+ }
1190
+ return value;
1191
+ }
1192
+ function imageReferencePeek() {
1193
+ return "!";
1194
+ }
1195
+ inlineCode.peek = inlineCodePeek;
1196
+ function inlineCode(node2, _, state) {
1197
+ let value = node2.value || "";
1198
+ let sequence = "`";
1199
+ let index = -1;
1200
+ while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
1201
+ sequence += "`";
1202
+ }
1203
+ if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
1204
+ value = " " + value + " ";
1205
+ }
1206
+ while (++index < state.unsafe.length) {
1207
+ const pattern = state.unsafe[index];
1208
+ const expression = state.compilePattern(pattern);
1209
+ let match;
1210
+ if (!pattern.atBreak) continue;
1211
+ while (match = expression.exec(value)) {
1212
+ let position = match.index;
1213
+ if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
1214
+ position--;
1215
+ }
1216
+ value = value.slice(0, position) + " " + value.slice(match.index + 1);
1217
+ }
1218
+ }
1219
+ return sequence + value + sequence;
1220
+ }
1221
+ function inlineCodePeek() {
1222
+ return "`";
1223
+ }
1224
+ function formatLinkAsAutolink(node2, state) {
1225
+ const raw = toString(node2);
1226
+ return Boolean(
1227
+ !state.options.resourceLink && // If there’s a url…
1228
+ node2.url && // And there’s a no title…
1229
+ !node2.title && // And the content of `node` is a single text node…
1230
+ node2.children && node2.children.length === 1 && node2.children[0].type === "text" && // And if the url is the same as the content…
1231
+ (raw === node2.url || "mailto:" + raw === node2.url) && // And that starts w/ a protocol…
1232
+ /^[a-z][a-z+.-]+:/i.test(node2.url) && // And that doesn’t contain ASCII control codes (character escapes and
1233
+ // references don’t work), space, or angle brackets…
1234
+ !/[\0- <>\u007F]/.test(node2.url)
1235
+ );
1236
+ }
1237
+ link.peek = linkPeek;
1238
+ function link(node2, _, state, info) {
1239
+ const quote = checkQuote(state);
1240
+ const suffix = quote === '"' ? "Quote" : "Apostrophe";
1241
+ const tracker = state.createTracker(info);
1242
+ let exit2;
1243
+ let subexit;
1244
+ if (formatLinkAsAutolink(node2, state)) {
1245
+ const stack = state.stack;
1246
+ state.stack = [];
1247
+ exit2 = state.enter("autolink");
1248
+ let value2 = tracker.move("<");
1249
+ value2 += tracker.move(
1250
+ state.containerPhrasing(node2, {
1251
+ before: value2,
1252
+ after: ">",
1253
+ ...tracker.current()
1254
+ })
1255
+ );
1256
+ value2 += tracker.move(">");
1257
+ exit2();
1258
+ state.stack = stack;
1259
+ return value2;
1260
+ }
1261
+ exit2 = state.enter("link");
1262
+ subexit = state.enter("label");
1263
+ let value = tracker.move("[");
1264
+ value += tracker.move(
1265
+ state.containerPhrasing(node2, {
1266
+ before: value,
1267
+ after: "](",
1268
+ ...tracker.current()
1269
+ })
1270
+ );
1271
+ value += tracker.move("](");
1272
+ subexit();
1273
+ if (
1274
+ // If there’s no url but there is a title…
1275
+ !node2.url && node2.title || // If there are control characters or whitespace.
1276
+ /[\0- \u007F]/.test(node2.url)
1277
+ ) {
1278
+ subexit = state.enter("destinationLiteral");
1279
+ value += tracker.move("<");
1280
+ value += tracker.move(
1281
+ state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
1282
+ );
1283
+ value += tracker.move(">");
1284
+ } else {
1285
+ subexit = state.enter("destinationRaw");
1286
+ value += tracker.move(
1287
+ state.safe(node2.url, {
1288
+ before: value,
1289
+ after: node2.title ? " " : ")",
1290
+ ...tracker.current()
1291
+ })
1292
+ );
1293
+ }
1294
+ subexit();
1295
+ if (node2.title) {
1296
+ subexit = state.enter(`title${suffix}`);
1297
+ value += tracker.move(" " + quote);
1298
+ value += tracker.move(
1299
+ state.safe(node2.title, {
1300
+ before: value,
1301
+ after: quote,
1302
+ ...tracker.current()
1303
+ })
1304
+ );
1305
+ value += tracker.move(quote);
1306
+ subexit();
1307
+ }
1308
+ value += tracker.move(")");
1309
+ exit2();
1310
+ return value;
1311
+ }
1312
+ function linkPeek(node2, _, state) {
1313
+ return formatLinkAsAutolink(node2, state) ? "<" : "[";
1314
+ }
1315
+ linkReference.peek = linkReferencePeek;
1316
+ function linkReference(node2, _, state, info) {
1317
+ const type = node2.referenceType;
1318
+ const exit2 = state.enter("linkReference");
1319
+ let subexit = state.enter("label");
1320
+ const tracker = state.createTracker(info);
1321
+ let value = tracker.move("[");
1322
+ const text2 = state.containerPhrasing(node2, {
1323
+ before: value,
1324
+ after: "]",
1325
+ ...tracker.current()
1326
+ });
1327
+ value += tracker.move(text2 + "][");
1328
+ subexit();
1329
+ const stack = state.stack;
1330
+ state.stack = [];
1331
+ subexit = state.enter("reference");
1332
+ const reference = state.safe(state.associationId(node2), {
1333
+ before: value,
1334
+ after: "]",
1335
+ ...tracker.current()
1336
+ });
1337
+ subexit();
1338
+ state.stack = stack;
1339
+ exit2();
1340
+ if (type === "full" || !text2 || text2 !== reference) {
1341
+ value += tracker.move(reference + "]");
1342
+ } else if (type === "shortcut") {
1343
+ value = value.slice(0, -1);
1344
+ } else {
1345
+ value += tracker.move("]");
1346
+ }
1347
+ return value;
1348
+ }
1349
+ function linkReferencePeek() {
1350
+ return "[";
1351
+ }
1352
+ function checkBullet(state) {
1353
+ const marker = state.options.bullet || "*";
1354
+ if (marker !== "*" && marker !== "+" && marker !== "-") {
1355
+ throw new Error(
1356
+ "Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`"
1357
+ );
1358
+ }
1359
+ return marker;
1360
+ }
1361
+ function checkBulletOther(state) {
1362
+ const bullet = checkBullet(state);
1363
+ const bulletOther = state.options.bulletOther;
1364
+ if (!bulletOther) {
1365
+ return bullet === "*" ? "-" : "*";
1366
+ }
1367
+ if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") {
1368
+ throw new Error(
1369
+ "Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
1370
+ );
1371
+ }
1372
+ if (bulletOther === bullet) {
1373
+ throw new Error(
1374
+ "Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different"
1375
+ );
1376
+ }
1377
+ return bulletOther;
1378
+ }
1379
+ function checkBulletOrdered(state) {
1380
+ const marker = state.options.bulletOrdered || ".";
1381
+ if (marker !== "." && marker !== ")") {
1382
+ throw new Error(
1383
+ "Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`"
1384
+ );
1385
+ }
1386
+ return marker;
1387
+ }
1388
+ function checkRule(state) {
1389
+ const marker = state.options.rule || "*";
1390
+ if (marker !== "*" && marker !== "-" && marker !== "_") {
1391
+ throw new Error(
1392
+ "Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`"
1393
+ );
1394
+ }
1395
+ return marker;
1396
+ }
1397
+ function list(node2, parent, state, info) {
1398
+ const exit2 = state.enter("list");
1399
+ const bulletCurrent = state.bulletCurrent;
1400
+ let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);
1401
+ const bulletOther = node2.ordered ? bullet === "." ? ")" : "." : checkBulletOther(state);
1402
+ let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;
1403
+ if (!node2.ordered) {
1404
+ const firstListItem = node2.children ? node2.children[0] : void 0;
1405
+ if (
1406
+ // Bullet could be used as a thematic break marker:
1407
+ (bullet === "*" || bullet === "-") && // Empty first list item:
1408
+ firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:
1409
+ state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && // That are each the first child.
1410
+ state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0
1411
+ ) {
1412
+ useDifferentMarker = true;
1413
+ }
1414
+ if (checkRule(state) === bullet && firstListItem) {
1415
+ let index = -1;
1416
+ while (++index < node2.children.length) {
1417
+ const item = node2.children[index];
1418
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
1419
+ useDifferentMarker = true;
1420
+ break;
1421
+ }
1422
+ }
1423
+ }
1424
+ }
1425
+ if (useDifferentMarker) {
1426
+ bullet = bulletOther;
1427
+ }
1428
+ state.bulletCurrent = bullet;
1429
+ const value = state.containerFlow(node2, info);
1430
+ state.bulletLastUsed = bullet;
1431
+ state.bulletCurrent = bulletCurrent;
1432
+ exit2();
1433
+ return value;
1434
+ }
1435
+ function checkListItemIndent(state) {
1436
+ const style = state.options.listItemIndent || "one";
1437
+ if (style !== "tab" && style !== "one" && style !== "mixed") {
1438
+ throw new Error(
1439
+ "Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
1440
+ );
1441
+ }
1442
+ return style;
1443
+ }
1444
+ function listItem(node2, parent, state, info) {
1445
+ const listItemIndent = checkListItemIndent(state);
1446
+ let bullet = state.bulletCurrent || checkBullet(state);
1447
+ if (parent && parent.type === "list" && parent.ordered) {
1448
+ bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;
1449
+ }
1450
+ let size = bullet.length + 1;
1451
+ if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) {
1452
+ size = Math.ceil(size / 4) * 4;
1453
+ }
1454
+ const tracker = state.createTracker(info);
1455
+ tracker.move(bullet + " ".repeat(size - bullet.length));
1456
+ tracker.shift(size);
1457
+ const exit2 = state.enter("listItem");
1458
+ const value = state.indentLines(
1459
+ state.containerFlow(node2, tracker.current()),
1460
+ map2
1461
+ );
1462
+ exit2();
1463
+ return value;
1464
+ function map2(line, index, blank) {
1465
+ if (index) {
1466
+ return (blank ? "" : " ".repeat(size)) + line;
1467
+ }
1468
+ return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
1469
+ }
1470
+ }
1471
+ function paragraph(node2, _, state, info) {
1472
+ const exit2 = state.enter("paragraph");
1473
+ const subexit = state.enter("phrasing");
1474
+ const value = state.containerPhrasing(node2, info);
1475
+ subexit();
1476
+ exit2();
1477
+ return value;
1478
+ }
1479
+ const phrasing = (
1480
+ /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
1481
+ convert([
1482
+ "break",
1483
+ "delete",
1484
+ "emphasis",
1485
+ // To do: next major: removed since footnotes were added to GFM.
1486
+ "footnote",
1487
+ "footnoteReference",
1488
+ "image",
1489
+ "imageReference",
1490
+ "inlineCode",
1491
+ // Enabled by `mdast-util-math`:
1492
+ "inlineMath",
1493
+ "link",
1494
+ "linkReference",
1495
+ // Enabled by `mdast-util-mdx`:
1496
+ "mdxJsxTextElement",
1497
+ // Enabled by `mdast-util-mdx`:
1498
+ "mdxTextExpression",
1499
+ "strong",
1500
+ "text",
1501
+ // Enabled by `mdast-util-directive`:
1502
+ "textDirective"
1503
+ ])
1504
+ );
1505
+ function root(node2, _, state, info) {
1506
+ const hasPhrasing = node2.children.some(function(d) {
1507
+ return phrasing(d);
1508
+ });
1509
+ const fn = hasPhrasing ? state.containerPhrasing : state.containerFlow;
1510
+ return fn.call(state, node2, info);
1511
+ }
1512
+ function checkStrong(state) {
1513
+ const marker = state.options.strong || "*";
1514
+ if (marker !== "*" && marker !== "_") {
1515
+ throw new Error(
1516
+ "Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`"
1517
+ );
1518
+ }
1519
+ return marker;
1520
+ }
1521
+ strong.peek = strongPeek;
1522
+ function strong(node2, _, state, info) {
1523
+ const marker = checkStrong(state);
1524
+ const exit2 = state.enter("strong");
1525
+ const tracker = state.createTracker(info);
1526
+ let value = tracker.move(marker + marker);
1527
+ value += tracker.move(
1528
+ state.containerPhrasing(node2, {
1529
+ before: value,
1530
+ after: marker,
1531
+ ...tracker.current()
1532
+ })
1533
+ );
1534
+ value += tracker.move(marker + marker);
1535
+ exit2();
1536
+ return value;
1537
+ }
1538
+ function strongPeek(_, _1, state) {
1539
+ return state.options.strong || "*";
1540
+ }
1541
+ function text$1(node2, _, state, info) {
1542
+ return state.safe(node2.value, info);
1543
+ }
1544
+ function checkRuleRepetition(state) {
1545
+ const repetition = state.options.ruleRepetition || 3;
1546
+ if (repetition < 3) {
1547
+ throw new Error(
1548
+ "Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more"
1549
+ );
1550
+ }
1551
+ return repetition;
1552
+ }
1553
+ function thematicBreak(_, _1, state) {
1554
+ const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
1555
+ return state.options.ruleSpaces ? value.slice(0, -1) : value;
1556
+ }
1557
+ const handle = {
1558
+ blockquote,
1559
+ break: hardBreak,
1560
+ code: code$1,
1561
+ definition,
1562
+ emphasis,
1563
+ hardBreak,
1564
+ heading,
1565
+ html,
1566
+ image,
1567
+ imageReference,
1568
+ inlineCode,
1569
+ link,
1570
+ linkReference,
1571
+ list,
1572
+ listItem,
1573
+ paragraph,
1574
+ root,
1575
+ strong,
1576
+ text: text$1,
1577
+ thematicBreak
1578
+ };
1579
+ function gfmTableFromMarkdown() {
1580
+ return {
1581
+ enter: {
1582
+ table: enterTable,
1583
+ tableData: enterCell,
1584
+ tableHeader: enterCell,
1585
+ tableRow: enterRow
1586
+ },
1587
+ exit: {
1588
+ codeText: exitCodeText,
1589
+ table: exitTable,
1590
+ tableData: exit,
1591
+ tableHeader: exit,
1592
+ tableRow: exit
1593
+ }
1594
+ };
1595
+ }
1596
+ function enterTable(token) {
1597
+ const align = token._align;
1598
+ this.enter(
1599
+ {
1600
+ type: "table",
1601
+ align: align.map(function(d) {
1602
+ return d === "none" ? null : d;
1603
+ }),
1604
+ children: []
1605
+ },
1606
+ token
1607
+ );
1608
+ this.data.inTable = true;
1609
+ }
1610
+ function exitTable(token) {
1611
+ this.exit(token);
1612
+ this.data.inTable = void 0;
1613
+ }
1614
+ function enterRow(token) {
1615
+ this.enter({ type: "tableRow", children: [] }, token);
1616
+ }
1617
+ function exit(token) {
1618
+ this.exit(token);
1619
+ }
1620
+ function enterCell(token) {
1621
+ this.enter({ type: "tableCell", children: [] }, token);
1622
+ }
1623
+ function exitCodeText(token) {
1624
+ let value = this.resume();
1625
+ if (this.data.inTable) {
1626
+ value = value.replace(/\\([\\|])/g, replace);
1627
+ }
1628
+ const node2 = this.stack[this.stack.length - 1];
1629
+ ok$1(node2.type === "inlineCode");
1630
+ node2.value = value;
1631
+ this.exit(token);
1632
+ }
1633
+ function replace($0, $1) {
1634
+ return $1 === "|" ? $1 : $0;
1635
+ }
1636
+ function gfmTableToMarkdown(options) {
1637
+ const settings = options || {};
1638
+ const padding = settings.tableCellPadding;
1639
+ const alignDelimiters = settings.tablePipeAlign;
1640
+ const stringLength = settings.stringLength;
1641
+ const around = padding ? " " : "|";
1642
+ return {
1643
+ unsafe: [
1644
+ { character: "\r", inConstruct: "tableCell" },
1645
+ { character: "\n", inConstruct: "tableCell" },
1646
+ // A pipe, when followed by a tab or space (padding), or a dash or colon
1647
+ // (unpadded delimiter row), could result in a table.
1648
+ { atBreak: true, character: "|", after: "[ :-]" },
1649
+ // A pipe in a cell must be encoded.
1650
+ { character: "|", inConstruct: "tableCell" },
1651
+ // A colon must be followed by a dash, in which case it could start a
1652
+ // delimiter row.
1653
+ { atBreak: true, character: ":", after: "-" },
1654
+ // A delimiter row can also start with a dash, when followed by more
1655
+ // dashes, a colon, or a pipe.
1656
+ // This is a stricter version than the built in check for lists, thematic
1657
+ // breaks, and setex heading underlines though:
1658
+ // <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57>
1659
+ { atBreak: true, character: "-", after: "[:|-]" }
1660
+ ],
1661
+ handlers: {
1662
+ inlineCode: inlineCodeWithTable,
1663
+ table: handleTable,
1664
+ tableCell: handleTableCell,
1665
+ tableRow: handleTableRow
1666
+ }
1667
+ };
1668
+ function handleTable(node2, _, state, info) {
1669
+ return serializeData(handleTableAsData(node2, state, info), node2.align);
1670
+ }
1671
+ function handleTableRow(node2, _, state, info) {
1672
+ const row = handleTableRowAsData(node2, state, info);
1673
+ const value = serializeData([row]);
1674
+ return value.slice(0, value.indexOf("\n"));
1675
+ }
1676
+ function handleTableCell(node2, _, state, info) {
1677
+ const exit2 = state.enter("tableCell");
1678
+ const subexit = state.enter("phrasing");
1679
+ const value = state.containerPhrasing(node2, {
1680
+ ...info,
1681
+ before: around,
1682
+ after: around
1683
+ });
1684
+ subexit();
1685
+ exit2();
1686
+ return value;
1687
+ }
1688
+ function serializeData(matrix, align) {
1689
+ return markdownTable(matrix, {
1690
+ align,
1691
+ // @ts-expect-error: `markdown-table` types should support `null`.
1692
+ alignDelimiters,
1693
+ // @ts-expect-error: `markdown-table` types should support `null`.
1694
+ padding,
1695
+ // @ts-expect-error: `markdown-table` types should support `null`.
1696
+ stringLength
1697
+ });
1698
+ }
1699
+ function handleTableAsData(node2, state, info) {
1700
+ const children = node2.children;
1701
+ let index = -1;
1702
+ const result = [];
1703
+ const subexit = state.enter("table");
1704
+ while (++index < children.length) {
1705
+ result[index] = handleTableRowAsData(children[index], state, info);
1706
+ }
1707
+ subexit();
1708
+ return result;
1709
+ }
1710
+ function handleTableRowAsData(node2, state, info) {
1711
+ const children = node2.children;
1712
+ let index = -1;
1713
+ const result = [];
1714
+ const subexit = state.enter("tableRow");
1715
+ while (++index < children.length) {
1716
+ result[index] = handleTableCell(children[index], node2, state, info);
1717
+ }
1718
+ subexit();
1719
+ return result;
1720
+ }
1721
+ function inlineCodeWithTable(node2, parent, state) {
1722
+ let value = handle.inlineCode(node2, parent, state);
1723
+ if (state.stack.includes("tableCell")) {
1724
+ value = value.replace(/\|/g, "\\$&");
1725
+ }
1726
+ return value;
1727
+ }
1728
+ }
1729
+ function gfmTaskListItemFromMarkdown() {
1730
+ return {
1731
+ exit: {
1732
+ taskListCheckValueChecked: exitCheck,
1733
+ taskListCheckValueUnchecked: exitCheck,
1734
+ paragraph: exitParagraphWithTaskListItem
1735
+ }
1736
+ };
1737
+ }
1738
+ function gfmTaskListItemToMarkdown() {
1739
+ return {
1740
+ unsafe: [{ atBreak: true, character: "-", after: "[:|-]" }],
1741
+ handlers: { listItem: listItemWithTaskListItem }
1742
+ };
1743
+ }
1744
+ function exitCheck(token) {
1745
+ const node2 = this.stack[this.stack.length - 2];
1746
+ ok$1(node2.type === "listItem");
1747
+ node2.checked = token.type === "taskListCheckValueChecked";
1748
+ }
1749
+ function exitParagraphWithTaskListItem(token) {
1750
+ const parent = this.stack[this.stack.length - 2];
1751
+ if (parent && parent.type === "listItem" && typeof parent.checked === "boolean") {
1752
+ const node2 = this.stack[this.stack.length - 1];
1753
+ ok$1(node2.type === "paragraph");
1754
+ const head = node2.children[0];
1755
+ if (head && head.type === "text") {
1756
+ const siblings = parent.children;
1757
+ let index = -1;
1758
+ let firstParaghraph;
1759
+ while (++index < siblings.length) {
1760
+ const sibling = siblings[index];
1761
+ if (sibling.type === "paragraph") {
1762
+ firstParaghraph = sibling;
1763
+ break;
1764
+ }
1765
+ }
1766
+ if (firstParaghraph === node2) {
1767
+ head.value = head.value.slice(1);
1768
+ if (head.value.length === 0) {
1769
+ node2.children.shift();
1770
+ } else if (node2.position && head.position && typeof head.position.start.offset === "number") {
1771
+ head.position.start.column++;
1772
+ head.position.start.offset++;
1773
+ node2.position.start = Object.assign({}, head.position.start);
1774
+ }
1775
+ }
1776
+ }
1777
+ }
1778
+ this.exit(token);
1779
+ }
1780
+ function listItemWithTaskListItem(node2, parent, state, info) {
1781
+ const head = node2.children[0];
1782
+ const checkable = typeof node2.checked === "boolean" && head && head.type === "paragraph";
1783
+ const checkbox = "[" + (node2.checked ? "x" : " ") + "] ";
1784
+ const tracker = state.createTracker(info);
1785
+ if (checkable) {
1786
+ tracker.move(checkbox);
1787
+ }
1788
+ let value = handle.listItem(node2, parent, state, {
1789
+ ...info,
1790
+ ...tracker.current()
1791
+ });
1792
+ if (checkable) {
1793
+ value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check);
1794
+ }
1795
+ return value;
1796
+ function check($0) {
1797
+ return $0 + checkbox;
1798
+ }
1799
+ }
1800
+ function gfmFromMarkdown() {
1801
+ return [
1802
+ gfmAutolinkLiteralFromMarkdown(),
1803
+ gfmFootnoteFromMarkdown(),
1804
+ gfmStrikethroughFromMarkdown(),
1805
+ gfmTableFromMarkdown(),
1806
+ gfmTaskListItemFromMarkdown()
1807
+ ];
1808
+ }
1809
+ function gfmToMarkdown(options) {
1810
+ return {
1811
+ extensions: [
1812
+ gfmAutolinkLiteralToMarkdown(),
1813
+ gfmFootnoteToMarkdown(),
1814
+ gfmStrikethroughToMarkdown(),
1815
+ gfmTableToMarkdown(options),
1816
+ gfmTaskListItemToMarkdown()
1817
+ ]
1818
+ };
1819
+ }
1820
+ function splice(list2, start, remove, items) {
1821
+ const end = list2.length;
1822
+ let chunkStart = 0;
1823
+ let parameters;
1824
+ if (start < 0) {
1825
+ start = -start > end ? 0 : end + start;
1826
+ } else {
1827
+ start = start > end ? end : start;
1828
+ }
1829
+ remove = remove > 0 ? remove : 0;
1830
+ if (items.length < 1e4) {
1831
+ parameters = Array.from(items);
1832
+ parameters.unshift(start, remove);
1833
+ list2.splice(...parameters);
1834
+ } else {
1835
+ if (remove) list2.splice(start, remove);
1836
+ while (chunkStart < items.length) {
1837
+ parameters = items.slice(chunkStart, chunkStart + 1e4);
1838
+ parameters.unshift(start, 0);
1839
+ list2.splice(...parameters);
1840
+ chunkStart += 1e4;
1841
+ start += 1e4;
1842
+ }
1843
+ }
1844
+ }
1845
+ const hasOwnProperty = {}.hasOwnProperty;
1846
+ function combineExtensions(extensions) {
1847
+ const all2 = {};
1848
+ let index = -1;
1849
+ while (++index < extensions.length) {
1850
+ syntaxExtension(all2, extensions[index]);
1851
+ }
1852
+ return all2;
1853
+ }
1854
+ function syntaxExtension(all2, extension) {
1855
+ let hook;
1856
+ for (hook in extension) {
1857
+ const maybe = hasOwnProperty.call(all2, hook) ? all2[hook] : void 0;
1858
+ const left = maybe || (all2[hook] = {});
1859
+ const right = extension[hook];
1860
+ let code2;
1861
+ if (right) {
1862
+ for (code2 in right) {
1863
+ if (!hasOwnProperty.call(left, code2)) left[code2] = [];
1864
+ const value = right[code2];
1865
+ constructs(
1866
+ // @ts-expect-error Looks like a list.
1867
+ left[code2],
1868
+ Array.isArray(value) ? value : value ? [value] : []
1869
+ );
1870
+ }
1871
+ }
1872
+ }
1873
+ }
1874
+ function constructs(existing, list2) {
1875
+ let index = -1;
1876
+ const before = [];
1877
+ while (++index < list2.length) {
1878
+ (list2[index].add === "after" ? existing : before).push(list2[index]);
1879
+ }
1880
+ splice(existing, 0, 0, before);
1881
+ }
1882
+ const wwwPrefix = {
1883
+ tokenize: tokenizeWwwPrefix,
1884
+ partial: true
1885
+ };
1886
+ const domain = {
1887
+ tokenize: tokenizeDomain,
1888
+ partial: true
1889
+ };
1890
+ const path = {
1891
+ tokenize: tokenizePath,
1892
+ partial: true
1893
+ };
1894
+ const trail = {
1895
+ tokenize: tokenizeTrail,
1896
+ partial: true
1897
+ };
1898
+ const emailDomainDotTrail = {
1899
+ tokenize: tokenizeEmailDomainDotTrail,
1900
+ partial: true
1901
+ };
1902
+ const wwwAutolink = {
1903
+ tokenize: tokenizeWwwAutolink,
1904
+ previous: previousWww
1905
+ };
1906
+ const protocolAutolink = {
1907
+ tokenize: tokenizeProtocolAutolink,
1908
+ previous: previousProtocol
1909
+ };
1910
+ const emailAutolink = {
1911
+ tokenize: tokenizeEmailAutolink,
1912
+ previous: previousEmail
1913
+ };
1914
+ const text = {};
1915
+ function gfmAutolinkLiteral() {
1916
+ return {
1917
+ text
1918
+ };
1919
+ }
1920
+ let code = 48;
1921
+ while (code < 123) {
1922
+ text[code] = emailAutolink;
1923
+ code++;
1924
+ if (code === 58) code = 65;
1925
+ else if (code === 91) code = 97;
1926
+ }
1927
+ text[43] = emailAutolink;
1928
+ text[45] = emailAutolink;
1929
+ text[46] = emailAutolink;
1930
+ text[95] = emailAutolink;
1931
+ text[72] = [emailAutolink, protocolAutolink];
1932
+ text[104] = [emailAutolink, protocolAutolink];
1933
+ text[87] = [emailAutolink, wwwAutolink];
1934
+ text[119] = [emailAutolink, wwwAutolink];
1935
+ function tokenizeEmailAutolink(effects, ok2, nok) {
1936
+ const self = this;
1937
+ let dot;
1938
+ let data;
1939
+ return start;
1940
+ function start(code2) {
1941
+ if (!gfmAtext(code2) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {
1942
+ return nok(code2);
1943
+ }
1944
+ effects.enter("literalAutolink");
1945
+ effects.enter("literalAutolinkEmail");
1946
+ return atext(code2);
1947
+ }
1948
+ function atext(code2) {
1949
+ if (gfmAtext(code2)) {
1950
+ effects.consume(code2);
1951
+ return atext;
1952
+ }
1953
+ if (code2 === 64) {
1954
+ effects.consume(code2);
1955
+ return emailDomain;
1956
+ }
1957
+ return nok(code2);
1958
+ }
1959
+ function emailDomain(code2) {
1960
+ if (code2 === 46) {
1961
+ return effects.check(
1962
+ emailDomainDotTrail,
1963
+ emailDomainAfter,
1964
+ emailDomainDot
1965
+ )(code2);
1966
+ }
1967
+ if (code2 === 45 || code2 === 95 || asciiAlphanumeric(code2)) {
1968
+ data = true;
1969
+ effects.consume(code2);
1970
+ return emailDomain;
1971
+ }
1972
+ return emailDomainAfter(code2);
1973
+ }
1974
+ function emailDomainDot(code2) {
1975
+ effects.consume(code2);
1976
+ dot = true;
1977
+ return emailDomain;
1978
+ }
1979
+ function emailDomainAfter(code2) {
1980
+ if (data && dot && asciiAlpha(self.previous)) {
1981
+ effects.exit("literalAutolinkEmail");
1982
+ effects.exit("literalAutolink");
1983
+ return ok2(code2);
1984
+ }
1985
+ return nok(code2);
1986
+ }
1987
+ }
1988
+ function tokenizeWwwAutolink(effects, ok2, nok) {
1989
+ const self = this;
1990
+ return wwwStart;
1991
+ function wwwStart(code2) {
1992
+ if (code2 !== 87 && code2 !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {
1993
+ return nok(code2);
1994
+ }
1995
+ effects.enter("literalAutolink");
1996
+ effects.enter("literalAutolinkWww");
1997
+ return effects.check(
1998
+ wwwPrefix,
1999
+ effects.attempt(domain, effects.attempt(path, wwwAfter), nok),
2000
+ nok
2001
+ )(code2);
2002
+ }
2003
+ function wwwAfter(code2) {
2004
+ effects.exit("literalAutolinkWww");
2005
+ effects.exit("literalAutolink");
2006
+ return ok2(code2);
2007
+ }
2008
+ }
2009
+ function tokenizeProtocolAutolink(effects, ok2, nok) {
2010
+ const self = this;
2011
+ let buffer = "";
2012
+ let seen = false;
2013
+ return protocolStart;
2014
+ function protocolStart(code2) {
2015
+ if ((code2 === 72 || code2 === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {
2016
+ effects.enter("literalAutolink");
2017
+ effects.enter("literalAutolinkHttp");
2018
+ buffer += String.fromCodePoint(code2);
2019
+ effects.consume(code2);
2020
+ return protocolPrefixInside;
2021
+ }
2022
+ return nok(code2);
2023
+ }
2024
+ function protocolPrefixInside(code2) {
2025
+ if (asciiAlpha(code2) && buffer.length < 5) {
2026
+ buffer += String.fromCodePoint(code2);
2027
+ effects.consume(code2);
2028
+ return protocolPrefixInside;
2029
+ }
2030
+ if (code2 === 58) {
2031
+ const protocol = buffer.toLowerCase();
2032
+ if (protocol === "http" || protocol === "https") {
2033
+ effects.consume(code2);
2034
+ return protocolSlashesInside;
2035
+ }
2036
+ }
2037
+ return nok(code2);
2038
+ }
2039
+ function protocolSlashesInside(code2) {
2040
+ if (code2 === 47) {
2041
+ effects.consume(code2);
2042
+ if (seen) {
2043
+ return afterProtocol;
2044
+ }
2045
+ seen = true;
2046
+ return protocolSlashesInside;
2047
+ }
2048
+ return nok(code2);
2049
+ }
2050
+ function afterProtocol(code2) {
2051
+ return code2 === null || asciiControl(code2) || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || unicodePunctuation(code2) ? nok(code2) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code2);
2052
+ }
2053
+ function protocolAfter(code2) {
2054
+ effects.exit("literalAutolinkHttp");
2055
+ effects.exit("literalAutolink");
2056
+ return ok2(code2);
2057
+ }
2058
+ }
2059
+ function tokenizeWwwPrefix(effects, ok2, nok) {
2060
+ let size = 0;
2061
+ return wwwPrefixInside;
2062
+ function wwwPrefixInside(code2) {
2063
+ if ((code2 === 87 || code2 === 119) && size < 3) {
2064
+ size++;
2065
+ effects.consume(code2);
2066
+ return wwwPrefixInside;
2067
+ }
2068
+ if (code2 === 46 && size === 3) {
2069
+ effects.consume(code2);
2070
+ return wwwPrefixAfter;
2071
+ }
2072
+ return nok(code2);
2073
+ }
2074
+ function wwwPrefixAfter(code2) {
2075
+ return code2 === null ? nok(code2) : ok2(code2);
2076
+ }
2077
+ }
2078
+ function tokenizeDomain(effects, ok2, nok) {
2079
+ let underscoreInLastSegment;
2080
+ let underscoreInLastLastSegment;
2081
+ let seen;
2082
+ return domainInside;
2083
+ function domainInside(code2) {
2084
+ if (code2 === 46 || code2 === 95) {
2085
+ return effects.check(trail, domainAfter, domainAtPunctuation)(code2);
2086
+ }
2087
+ if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2) || code2 !== 45 && unicodePunctuation(code2)) {
2088
+ return domainAfter(code2);
2089
+ }
2090
+ seen = true;
2091
+ effects.consume(code2);
2092
+ return domainInside;
2093
+ }
2094
+ function domainAtPunctuation(code2) {
2095
+ if (code2 === 95) {
2096
+ underscoreInLastSegment = true;
2097
+ } else {
2098
+ underscoreInLastLastSegment = underscoreInLastSegment;
2099
+ underscoreInLastSegment = void 0;
2100
+ }
2101
+ effects.consume(code2);
2102
+ return domainInside;
2103
+ }
2104
+ function domainAfter(code2) {
2105
+ if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {
2106
+ return nok(code2);
2107
+ }
2108
+ return ok2(code2);
2109
+ }
2110
+ }
2111
+ function tokenizePath(effects, ok2) {
2112
+ let sizeOpen = 0;
2113
+ let sizeClose = 0;
2114
+ return pathInside;
2115
+ function pathInside(code2) {
2116
+ if (code2 === 40) {
2117
+ sizeOpen++;
2118
+ effects.consume(code2);
2119
+ return pathInside;
2120
+ }
2121
+ if (code2 === 41 && sizeClose < sizeOpen) {
2122
+ return pathAtPunctuation(code2);
2123
+ }
2124
+ if (code2 === 33 || code2 === 34 || code2 === 38 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 60 || code2 === 63 || code2 === 93 || code2 === 95 || code2 === 126) {
2125
+ return effects.check(trail, ok2, pathAtPunctuation)(code2);
2126
+ }
2127
+ if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
2128
+ return ok2(code2);
2129
+ }
2130
+ effects.consume(code2);
2131
+ return pathInside;
2132
+ }
2133
+ function pathAtPunctuation(code2) {
2134
+ if (code2 === 41) {
2135
+ sizeClose++;
2136
+ }
2137
+ effects.consume(code2);
2138
+ return pathInside;
2139
+ }
2140
+ }
2141
+ function tokenizeTrail(effects, ok2, nok) {
2142
+ return trail2;
2143
+ function trail2(code2) {
2144
+ if (code2 === 33 || code2 === 34 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 63 || code2 === 95 || code2 === 126) {
2145
+ effects.consume(code2);
2146
+ return trail2;
2147
+ }
2148
+ if (code2 === 38) {
2149
+ effects.consume(code2);
2150
+ return trailCharRefStart;
2151
+ }
2152
+ if (code2 === 93) {
2153
+ effects.consume(code2);
2154
+ return trailBracketAfter;
2155
+ }
2156
+ if (
2157
+ // `<` is an end.
2158
+ code2 === 60 || // So is whitespace.
2159
+ code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)
2160
+ ) {
2161
+ return ok2(code2);
2162
+ }
2163
+ return nok(code2);
2164
+ }
2165
+ function trailBracketAfter(code2) {
2166
+ if (code2 === null || code2 === 40 || code2 === 91 || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
2167
+ return ok2(code2);
2168
+ }
2169
+ return trail2(code2);
2170
+ }
2171
+ function trailCharRefStart(code2) {
2172
+ return asciiAlpha(code2) ? trailCharRefInside(code2) : nok(code2);
2173
+ }
2174
+ function trailCharRefInside(code2) {
2175
+ if (code2 === 59) {
2176
+ effects.consume(code2);
2177
+ return trail2;
2178
+ }
2179
+ if (asciiAlpha(code2)) {
2180
+ effects.consume(code2);
2181
+ return trailCharRefInside;
2182
+ }
2183
+ return nok(code2);
2184
+ }
2185
+ }
2186
+ function tokenizeEmailDomainDotTrail(effects, ok2, nok) {
2187
+ return start;
2188
+ function start(code2) {
2189
+ effects.consume(code2);
2190
+ return after;
2191
+ }
2192
+ function after(code2) {
2193
+ return asciiAlphanumeric(code2) ? nok(code2) : ok2(code2);
2194
+ }
2195
+ }
2196
+ function previousWww(code2) {
2197
+ return code2 === null || code2 === 40 || code2 === 42 || code2 === 95 || code2 === 91 || code2 === 93 || code2 === 126 || markdownLineEndingOrSpace(code2);
2198
+ }
2199
+ function previousProtocol(code2) {
2200
+ return !asciiAlpha(code2);
2201
+ }
2202
+ function previousEmail(code2) {
2203
+ return !(code2 === 47 || gfmAtext(code2));
2204
+ }
2205
+ function gfmAtext(code2) {
2206
+ return code2 === 43 || code2 === 45 || code2 === 46 || code2 === 95 || asciiAlphanumeric(code2);
2207
+ }
2208
+ function previousUnbalanced(events) {
2209
+ let index = events.length;
2210
+ let result = false;
2211
+ while (index--) {
2212
+ const token = events[index][1];
2213
+ if ((token.type === "labelLink" || token.type === "labelImage") && !token._balanced) {
2214
+ result = true;
2215
+ break;
2216
+ }
2217
+ if (token._gfmAutolinkLiteralWalkedInto) {
2218
+ result = false;
2219
+ break;
2220
+ }
2221
+ }
2222
+ if (events.length > 0 && !result) {
2223
+ events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;
2224
+ }
2225
+ return result;
2226
+ }
2227
+ function classifyCharacter(code2) {
2228
+ if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
2229
+ return 1;
2230
+ }
2231
+ if (unicodePunctuation(code2)) {
2232
+ return 2;
2233
+ }
2234
+ }
2235
+ function resolveAll(constructs2, events, context) {
2236
+ const called = [];
2237
+ let index = -1;
2238
+ while (++index < constructs2.length) {
2239
+ const resolve = constructs2[index].resolveAll;
2240
+ if (resolve && !called.includes(resolve)) {
2241
+ events = resolve(events, context);
2242
+ called.push(resolve);
2243
+ }
2244
+ }
2245
+ return events;
2246
+ }
2247
+ function factorySpace(effects, ok2, type, max) {
2248
+ const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
2249
+ let size = 0;
2250
+ return start;
2251
+ function start(code2) {
2252
+ if (markdownSpace(code2)) {
2253
+ effects.enter(type);
2254
+ return prefix(code2);
2255
+ }
2256
+ return ok2(code2);
2257
+ }
2258
+ function prefix(code2) {
2259
+ if (markdownSpace(code2) && size++ < limit) {
2260
+ effects.consume(code2);
2261
+ return prefix;
2262
+ }
2263
+ effects.exit(type);
2264
+ return ok2(code2);
2265
+ }
2266
+ }
2267
+ const blankLine = {
2268
+ tokenize: tokenizeBlankLine,
2269
+ partial: true
2270
+ };
2271
+ function tokenizeBlankLine(effects, ok2, nok) {
2272
+ return start;
2273
+ function start(code2) {
2274
+ return markdownSpace(code2) ? factorySpace(effects, after, "linePrefix")(code2) : after(code2);
2275
+ }
2276
+ function after(code2) {
2277
+ return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
2278
+ }
2279
+ }
2280
+ const indent = {
2281
+ tokenize: tokenizeIndent,
2282
+ partial: true
2283
+ };
2284
+ function gfmFootnote() {
2285
+ return {
2286
+ document: {
2287
+ [91]: {
2288
+ tokenize: tokenizeDefinitionStart,
2289
+ continuation: {
2290
+ tokenize: tokenizeDefinitionContinuation
2291
+ },
2292
+ exit: gfmFootnoteDefinitionEnd
2293
+ }
2294
+ },
2295
+ text: {
2296
+ [91]: {
2297
+ tokenize: tokenizeGfmFootnoteCall
2298
+ },
2299
+ [93]: {
2300
+ add: "after",
2301
+ tokenize: tokenizePotentialGfmFootnoteCall,
2302
+ resolveTo: resolveToPotentialGfmFootnoteCall
2303
+ }
2304
+ }
2305
+ };
2306
+ }
2307
+ function tokenizePotentialGfmFootnoteCall(effects, ok2, nok) {
2308
+ const self = this;
2309
+ let index = self.events.length;
2310
+ const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
2311
+ let labelStart;
2312
+ while (index--) {
2313
+ const token = self.events[index][1];
2314
+ if (token.type === "labelImage") {
2315
+ labelStart = token;
2316
+ break;
2317
+ }
2318
+ if (token.type === "gfmFootnoteCall" || token.type === "labelLink" || token.type === "label" || token.type === "image" || token.type === "link") {
2319
+ break;
2320
+ }
2321
+ }
2322
+ return start;
2323
+ function start(code2) {
2324
+ if (!labelStart || !labelStart._balanced) {
2325
+ return nok(code2);
2326
+ }
2327
+ const id = normalizeIdentifier(
2328
+ self.sliceSerialize({
2329
+ start: labelStart.end,
2330
+ end: self.now()
2331
+ })
2332
+ );
2333
+ if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
2334
+ return nok(code2);
2335
+ }
2336
+ effects.enter("gfmFootnoteCallLabelMarker");
2337
+ effects.consume(code2);
2338
+ effects.exit("gfmFootnoteCallLabelMarker");
2339
+ return ok2(code2);
2340
+ }
2341
+ }
2342
+ function resolveToPotentialGfmFootnoteCall(events, context) {
2343
+ let index = events.length;
2344
+ while (index--) {
2345
+ if (events[index][1].type === "labelImage" && events[index][0] === "enter") {
2346
+ events[index][1];
2347
+ break;
2348
+ }
2349
+ }
2350
+ events[index + 1][1].type = "data";
2351
+ events[index + 3][1].type = "gfmFootnoteCallLabelMarker";
2352
+ const call = {
2353
+ type: "gfmFootnoteCall",
2354
+ start: Object.assign({}, events[index + 3][1].start),
2355
+ end: Object.assign({}, events[events.length - 1][1].end)
2356
+ };
2357
+ const marker = {
2358
+ type: "gfmFootnoteCallMarker",
2359
+ start: Object.assign({}, events[index + 3][1].end),
2360
+ end: Object.assign({}, events[index + 3][1].end)
2361
+ };
2362
+ marker.end.column++;
2363
+ marker.end.offset++;
2364
+ marker.end._bufferIndex++;
2365
+ const string = {
2366
+ type: "gfmFootnoteCallString",
2367
+ start: Object.assign({}, marker.end),
2368
+ end: Object.assign({}, events[events.length - 1][1].start)
2369
+ };
2370
+ const chunk = {
2371
+ type: "chunkString",
2372
+ contentType: "string",
2373
+ start: Object.assign({}, string.start),
2374
+ end: Object.assign({}, string.end)
2375
+ };
2376
+ const replacement = [
2377
+ // Take the `labelImageMarker` (now `data`, the `!`)
2378
+ events[index + 1],
2379
+ events[index + 2],
2380
+ ["enter", call, context],
2381
+ // The `[`
2382
+ events[index + 3],
2383
+ events[index + 4],
2384
+ // The `^`.
2385
+ ["enter", marker, context],
2386
+ ["exit", marker, context],
2387
+ // Everything in between.
2388
+ ["enter", string, context],
2389
+ ["enter", chunk, context],
2390
+ ["exit", chunk, context],
2391
+ ["exit", string, context],
2392
+ // The ending (`]`, properly parsed and labelled).
2393
+ events[events.length - 2],
2394
+ events[events.length - 1],
2395
+ ["exit", call, context]
2396
+ ];
2397
+ events.splice(index, events.length - index + 1, ...replacement);
2398
+ return events;
2399
+ }
2400
+ function tokenizeGfmFootnoteCall(effects, ok2, nok) {
2401
+ const self = this;
2402
+ const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
2403
+ let size = 0;
2404
+ let data;
2405
+ return start;
2406
+ function start(code2) {
2407
+ effects.enter("gfmFootnoteCall");
2408
+ effects.enter("gfmFootnoteCallLabelMarker");
2409
+ effects.consume(code2);
2410
+ effects.exit("gfmFootnoteCallLabelMarker");
2411
+ return callStart;
2412
+ }
2413
+ function callStart(code2) {
2414
+ if (code2 !== 94) return nok(code2);
2415
+ effects.enter("gfmFootnoteCallMarker");
2416
+ effects.consume(code2);
2417
+ effects.exit("gfmFootnoteCallMarker");
2418
+ effects.enter("gfmFootnoteCallString");
2419
+ effects.enter("chunkString").contentType = "string";
2420
+ return callData;
2421
+ }
2422
+ function callData(code2) {
2423
+ if (
2424
+ // Too long.
2425
+ size > 999 || // Closing brace with nothing.
2426
+ code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.
2427
+ // `\n` and `[` not being supported makes sense.
2428
+ code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)
2429
+ ) {
2430
+ return nok(code2);
2431
+ }
2432
+ if (code2 === 93) {
2433
+ effects.exit("chunkString");
2434
+ const token = effects.exit("gfmFootnoteCallString");
2435
+ if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {
2436
+ return nok(code2);
2437
+ }
2438
+ effects.enter("gfmFootnoteCallLabelMarker");
2439
+ effects.consume(code2);
2440
+ effects.exit("gfmFootnoteCallLabelMarker");
2441
+ effects.exit("gfmFootnoteCall");
2442
+ return ok2;
2443
+ }
2444
+ if (!markdownLineEndingOrSpace(code2)) {
2445
+ data = true;
2446
+ }
2447
+ size++;
2448
+ effects.consume(code2);
2449
+ return code2 === 92 ? callEscape : callData;
2450
+ }
2451
+ function callEscape(code2) {
2452
+ if (code2 === 91 || code2 === 92 || code2 === 93) {
2453
+ effects.consume(code2);
2454
+ size++;
2455
+ return callData;
2456
+ }
2457
+ return callData(code2);
2458
+ }
2459
+ }
2460
+ function tokenizeDefinitionStart(effects, ok2, nok) {
2461
+ const self = this;
2462
+ const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);
2463
+ let identifier;
2464
+ let size = 0;
2465
+ let data;
2466
+ return start;
2467
+ function start(code2) {
2468
+ effects.enter("gfmFootnoteDefinition")._container = true;
2469
+ effects.enter("gfmFootnoteDefinitionLabel");
2470
+ effects.enter("gfmFootnoteDefinitionLabelMarker");
2471
+ effects.consume(code2);
2472
+ effects.exit("gfmFootnoteDefinitionLabelMarker");
2473
+ return labelAtMarker;
2474
+ }
2475
+ function labelAtMarker(code2) {
2476
+ if (code2 === 94) {
2477
+ effects.enter("gfmFootnoteDefinitionMarker");
2478
+ effects.consume(code2);
2479
+ effects.exit("gfmFootnoteDefinitionMarker");
2480
+ effects.enter("gfmFootnoteDefinitionLabelString");
2481
+ effects.enter("chunkString").contentType = "string";
2482
+ return labelInside;
2483
+ }
2484
+ return nok(code2);
2485
+ }
2486
+ function labelInside(code2) {
2487
+ if (
2488
+ // Too long.
2489
+ size > 999 || // Closing brace with nothing.
2490
+ code2 === 93 && !data || // Space or tab is not supported by GFM for some reason.
2491
+ // `\n` and `[` not being supported makes sense.
2492
+ code2 === null || code2 === 91 || markdownLineEndingOrSpace(code2)
2493
+ ) {
2494
+ return nok(code2);
2495
+ }
2496
+ if (code2 === 93) {
2497
+ effects.exit("chunkString");
2498
+ const token = effects.exit("gfmFootnoteDefinitionLabelString");
2499
+ identifier = normalizeIdentifier(self.sliceSerialize(token));
2500
+ effects.enter("gfmFootnoteDefinitionLabelMarker");
2501
+ effects.consume(code2);
2502
+ effects.exit("gfmFootnoteDefinitionLabelMarker");
2503
+ effects.exit("gfmFootnoteDefinitionLabel");
2504
+ return labelAfter;
2505
+ }
2506
+ if (!markdownLineEndingOrSpace(code2)) {
2507
+ data = true;
2508
+ }
2509
+ size++;
2510
+ effects.consume(code2);
2511
+ return code2 === 92 ? labelEscape : labelInside;
2512
+ }
2513
+ function labelEscape(code2) {
2514
+ if (code2 === 91 || code2 === 92 || code2 === 93) {
2515
+ effects.consume(code2);
2516
+ size++;
2517
+ return labelInside;
2518
+ }
2519
+ return labelInside(code2);
2520
+ }
2521
+ function labelAfter(code2) {
2522
+ if (code2 === 58) {
2523
+ effects.enter("definitionMarker");
2524
+ effects.consume(code2);
2525
+ effects.exit("definitionMarker");
2526
+ if (!defined.includes(identifier)) {
2527
+ defined.push(identifier);
2528
+ }
2529
+ return factorySpace(
2530
+ effects,
2531
+ whitespaceAfter,
2532
+ "gfmFootnoteDefinitionWhitespace"
2533
+ );
2534
+ }
2535
+ return nok(code2);
2536
+ }
2537
+ function whitespaceAfter(code2) {
2538
+ return ok2(code2);
2539
+ }
2540
+ }
2541
+ function tokenizeDefinitionContinuation(effects, ok2, nok) {
2542
+ return effects.check(blankLine, ok2, effects.attempt(indent, ok2, nok));
2543
+ }
2544
+ function gfmFootnoteDefinitionEnd(effects) {
2545
+ effects.exit("gfmFootnoteDefinition");
2546
+ }
2547
+ function tokenizeIndent(effects, ok2, nok) {
2548
+ const self = this;
2549
+ return factorySpace(
2550
+ effects,
2551
+ afterPrefix,
2552
+ "gfmFootnoteDefinitionIndent",
2553
+ 4 + 1
2554
+ );
2555
+ function afterPrefix(code2) {
2556
+ const tail = self.events[self.events.length - 1];
2557
+ return tail && tail[1].type === "gfmFootnoteDefinitionIndent" && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok2(code2) : nok(code2);
2558
+ }
2559
+ }
2560
+ function gfmStrikethrough(options) {
2561
+ const options_ = options || {};
2562
+ let single = options_.singleTilde;
2563
+ const tokenizer = {
2564
+ tokenize: tokenizeStrikethrough,
2565
+ resolveAll: resolveAllStrikethrough
2566
+ };
2567
+ if (single === null || single === void 0) {
2568
+ single = true;
2569
+ }
2570
+ return {
2571
+ text: {
2572
+ [126]: tokenizer
2573
+ },
2574
+ insideSpan: {
2575
+ null: [tokenizer]
2576
+ },
2577
+ attentionMarkers: {
2578
+ null: [126]
2579
+ }
2580
+ };
2581
+ function resolveAllStrikethrough(events, context) {
2582
+ let index = -1;
2583
+ while (++index < events.length) {
2584
+ if (events[index][0] === "enter" && events[index][1].type === "strikethroughSequenceTemporary" && events[index][1]._close) {
2585
+ let open = index;
2586
+ while (open--) {
2587
+ if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && // If the sizes are the same:
2588
+ events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {
2589
+ events[index][1].type = "strikethroughSequence";
2590
+ events[open][1].type = "strikethroughSequence";
2591
+ const strikethrough = {
2592
+ type: "strikethrough",
2593
+ start: Object.assign({}, events[open][1].start),
2594
+ end: Object.assign({}, events[index][1].end)
2595
+ };
2596
+ const text2 = {
2597
+ type: "strikethroughText",
2598
+ start: Object.assign({}, events[open][1].end),
2599
+ end: Object.assign({}, events[index][1].start)
2600
+ };
2601
+ const nextEvents = [
2602
+ ["enter", strikethrough, context],
2603
+ ["enter", events[open][1], context],
2604
+ ["exit", events[open][1], context],
2605
+ ["enter", text2, context]
2606
+ ];
2607
+ const insideSpan = context.parser.constructs.insideSpan.null;
2608
+ if (insideSpan) {
2609
+ splice(
2610
+ nextEvents,
2611
+ nextEvents.length,
2612
+ 0,
2613
+ resolveAll(insideSpan, events.slice(open + 1, index), context)
2614
+ );
2615
+ }
2616
+ splice(nextEvents, nextEvents.length, 0, [
2617
+ ["exit", text2, context],
2618
+ ["enter", events[index][1], context],
2619
+ ["exit", events[index][1], context],
2620
+ ["exit", strikethrough, context]
2621
+ ]);
2622
+ splice(events, open - 1, index - open + 3, nextEvents);
2623
+ index = open + nextEvents.length - 2;
2624
+ break;
2625
+ }
2626
+ }
2627
+ }
2628
+ }
2629
+ index = -1;
2630
+ while (++index < events.length) {
2631
+ if (events[index][1].type === "strikethroughSequenceTemporary") {
2632
+ events[index][1].type = "data";
2633
+ }
2634
+ }
2635
+ return events;
2636
+ }
2637
+ function tokenizeStrikethrough(effects, ok2, nok) {
2638
+ const previous2 = this.previous;
2639
+ const events = this.events;
2640
+ let size = 0;
2641
+ return start;
2642
+ function start(code2) {
2643
+ if (previous2 === 126 && events[events.length - 1][1].type !== "characterEscape") {
2644
+ return nok(code2);
2645
+ }
2646
+ effects.enter("strikethroughSequenceTemporary");
2647
+ return more(code2);
2648
+ }
2649
+ function more(code2) {
2650
+ const before = classifyCharacter(previous2);
2651
+ if (code2 === 126) {
2652
+ if (size > 1) return nok(code2);
2653
+ effects.consume(code2);
2654
+ size++;
2655
+ return more;
2656
+ }
2657
+ if (size < 2 && !single) return nok(code2);
2658
+ const token = effects.exit("strikethroughSequenceTemporary");
2659
+ const after = classifyCharacter(code2);
2660
+ token._open = !after || after === 2 && Boolean(before);
2661
+ token._close = !before || before === 2 && Boolean(after);
2662
+ return ok2(code2);
2663
+ }
2664
+ }
2665
+ }
2666
+ class EditMap {
2667
+ /**
2668
+ * Create a new edit map.
2669
+ */
2670
+ constructor() {
2671
+ this.map = [];
2672
+ }
2673
+ /**
2674
+ * Create an edit: a remove and/or add at a certain place.
2675
+ *
2676
+ * @param {number} index
2677
+ * @param {number} remove
2678
+ * @param {Array<Event>} add
2679
+ * @returns {undefined}
2680
+ */
2681
+ add(index, remove, add) {
2682
+ addImpl(this, index, remove, add);
2683
+ }
2684
+ // To do: add this when moving to `micromark`.
2685
+ // /**
2686
+ // * Create an edit: but insert `add` before existing additions.
2687
+ // *
2688
+ // * @param {number} index
2689
+ // * @param {number} remove
2690
+ // * @param {Array<Event>} add
2691
+ // * @returns {undefined}
2692
+ // */
2693
+ // addBefore(index, remove, add) {
2694
+ // addImpl(this, index, remove, add, true)
2695
+ // }
2696
+ /**
2697
+ * Done, change the events.
2698
+ *
2699
+ * @param {Array<Event>} events
2700
+ * @returns {undefined}
2701
+ */
2702
+ consume(events) {
2703
+ this.map.sort(function(a, b) {
2704
+ return a[0] - b[0];
2705
+ });
2706
+ if (this.map.length === 0) {
2707
+ return;
2708
+ }
2709
+ let index = this.map.length;
2710
+ const vecs = [];
2711
+ while (index > 0) {
2712
+ index -= 1;
2713
+ vecs.push(
2714
+ events.slice(this.map[index][0] + this.map[index][1]),
2715
+ this.map[index][2]
2716
+ );
2717
+ events.length = this.map[index][0];
2718
+ }
2719
+ vecs.push([...events]);
2720
+ events.length = 0;
2721
+ let slice = vecs.pop();
2722
+ while (slice) {
2723
+ events.push(...slice);
2724
+ slice = vecs.pop();
2725
+ }
2726
+ this.map.length = 0;
2727
+ }
2728
+ }
2729
+ function addImpl(editMap, at, remove, add) {
2730
+ let index = 0;
2731
+ if (remove === 0 && add.length === 0) {
2732
+ return;
2733
+ }
2734
+ while (index < editMap.map.length) {
2735
+ if (editMap.map[index][0] === at) {
2736
+ editMap.map[index][1] += remove;
2737
+ editMap.map[index][2].push(...add);
2738
+ return;
2739
+ }
2740
+ index += 1;
2741
+ }
2742
+ editMap.map.push([at, remove, add]);
2743
+ }
2744
+ function gfmTableAlign(events, index) {
2745
+ let inDelimiterRow = false;
2746
+ const align = [];
2747
+ while (index < events.length) {
2748
+ const event = events[index];
2749
+ if (inDelimiterRow) {
2750
+ if (event[0] === "enter") {
2751
+ if (event[1].type === "tableContent") {
2752
+ align.push(
2753
+ events[index + 1][1].type === "tableDelimiterMarker" ? "left" : "none"
2754
+ );
2755
+ }
2756
+ } else if (event[1].type === "tableContent") {
2757
+ if (events[index - 1][1].type === "tableDelimiterMarker") {
2758
+ const alignIndex = align.length - 1;
2759
+ align[alignIndex] = align[alignIndex] === "left" ? "center" : "right";
2760
+ }
2761
+ } else if (event[1].type === "tableDelimiterRow") {
2762
+ break;
2763
+ }
2764
+ } else if (event[0] === "enter" && event[1].type === "tableDelimiterRow") {
2765
+ inDelimiterRow = true;
2766
+ }
2767
+ index += 1;
2768
+ }
2769
+ return align;
2770
+ }
2771
+ function gfmTable() {
2772
+ return {
2773
+ flow: {
2774
+ null: {
2775
+ tokenize: tokenizeTable,
2776
+ resolveAll: resolveTable
2777
+ }
2778
+ }
2779
+ };
2780
+ }
2781
+ function tokenizeTable(effects, ok2, nok) {
2782
+ const self = this;
2783
+ let size = 0;
2784
+ let sizeB = 0;
2785
+ let seen;
2786
+ return start;
2787
+ function start(code2) {
2788
+ let index = self.events.length - 1;
2789
+ while (index > -1) {
2790
+ const type = self.events[index][1].type;
2791
+ if (type === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
2792
+ type === "linePrefix")
2793
+ index--;
2794
+ else break;
2795
+ }
2796
+ const tail = index > -1 ? self.events[index][1].type : null;
2797
+ const next = tail === "tableHead" || tail === "tableRow" ? bodyRowStart : headRowBefore;
2798
+ if (next === bodyRowStart && self.parser.lazy[self.now().line]) {
2799
+ return nok(code2);
2800
+ }
2801
+ return next(code2);
2802
+ }
2803
+ function headRowBefore(code2) {
2804
+ effects.enter("tableHead");
2805
+ effects.enter("tableRow");
2806
+ return headRowStart(code2);
2807
+ }
2808
+ function headRowStart(code2) {
2809
+ if (code2 === 124) {
2810
+ return headRowBreak(code2);
2811
+ }
2812
+ seen = true;
2813
+ sizeB += 1;
2814
+ return headRowBreak(code2);
2815
+ }
2816
+ function headRowBreak(code2) {
2817
+ if (code2 === null) {
2818
+ return nok(code2);
2819
+ }
2820
+ if (markdownLineEnding(code2)) {
2821
+ if (sizeB > 1) {
2822
+ sizeB = 0;
2823
+ self.interrupt = true;
2824
+ effects.exit("tableRow");
2825
+ effects.enter("lineEnding");
2826
+ effects.consume(code2);
2827
+ effects.exit("lineEnding");
2828
+ return headDelimiterStart;
2829
+ }
2830
+ return nok(code2);
2831
+ }
2832
+ if (markdownSpace(code2)) {
2833
+ return factorySpace(effects, headRowBreak, "whitespace")(code2);
2834
+ }
2835
+ sizeB += 1;
2836
+ if (seen) {
2837
+ seen = false;
2838
+ size += 1;
2839
+ }
2840
+ if (code2 === 124) {
2841
+ effects.enter("tableCellDivider");
2842
+ effects.consume(code2);
2843
+ effects.exit("tableCellDivider");
2844
+ seen = true;
2845
+ return headRowBreak;
2846
+ }
2847
+ effects.enter("data");
2848
+ return headRowData(code2);
2849
+ }
2850
+ function headRowData(code2) {
2851
+ if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {
2852
+ effects.exit("data");
2853
+ return headRowBreak(code2);
2854
+ }
2855
+ effects.consume(code2);
2856
+ return code2 === 92 ? headRowEscape : headRowData;
2857
+ }
2858
+ function headRowEscape(code2) {
2859
+ if (code2 === 92 || code2 === 124) {
2860
+ effects.consume(code2);
2861
+ return headRowData;
2862
+ }
2863
+ return headRowData(code2);
2864
+ }
2865
+ function headDelimiterStart(code2) {
2866
+ self.interrupt = false;
2867
+ if (self.parser.lazy[self.now().line]) {
2868
+ return nok(code2);
2869
+ }
2870
+ effects.enter("tableDelimiterRow");
2871
+ seen = false;
2872
+ if (markdownSpace(code2)) {
2873
+ return factorySpace(
2874
+ effects,
2875
+ headDelimiterBefore,
2876
+ "linePrefix",
2877
+ self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
2878
+ )(code2);
2879
+ }
2880
+ return headDelimiterBefore(code2);
2881
+ }
2882
+ function headDelimiterBefore(code2) {
2883
+ if (code2 === 45 || code2 === 58) {
2884
+ return headDelimiterValueBefore(code2);
2885
+ }
2886
+ if (code2 === 124) {
2887
+ seen = true;
2888
+ effects.enter("tableCellDivider");
2889
+ effects.consume(code2);
2890
+ effects.exit("tableCellDivider");
2891
+ return headDelimiterCellBefore;
2892
+ }
2893
+ return headDelimiterNok(code2);
2894
+ }
2895
+ function headDelimiterCellBefore(code2) {
2896
+ if (markdownSpace(code2)) {
2897
+ return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code2);
2898
+ }
2899
+ return headDelimiterValueBefore(code2);
2900
+ }
2901
+ function headDelimiterValueBefore(code2) {
2902
+ if (code2 === 58) {
2903
+ sizeB += 1;
2904
+ seen = true;
2905
+ effects.enter("tableDelimiterMarker");
2906
+ effects.consume(code2);
2907
+ effects.exit("tableDelimiterMarker");
2908
+ return headDelimiterLeftAlignmentAfter;
2909
+ }
2910
+ if (code2 === 45) {
2911
+ sizeB += 1;
2912
+ return headDelimiterLeftAlignmentAfter(code2);
2913
+ }
2914
+ if (code2 === null || markdownLineEnding(code2)) {
2915
+ return headDelimiterCellAfter(code2);
2916
+ }
2917
+ return headDelimiterNok(code2);
2918
+ }
2919
+ function headDelimiterLeftAlignmentAfter(code2) {
2920
+ if (code2 === 45) {
2921
+ effects.enter("tableDelimiterFiller");
2922
+ return headDelimiterFiller(code2);
2923
+ }
2924
+ return headDelimiterNok(code2);
2925
+ }
2926
+ function headDelimiterFiller(code2) {
2927
+ if (code2 === 45) {
2928
+ effects.consume(code2);
2929
+ return headDelimiterFiller;
2930
+ }
2931
+ if (code2 === 58) {
2932
+ seen = true;
2933
+ effects.exit("tableDelimiterFiller");
2934
+ effects.enter("tableDelimiterMarker");
2935
+ effects.consume(code2);
2936
+ effects.exit("tableDelimiterMarker");
2937
+ return headDelimiterRightAlignmentAfter;
2938
+ }
2939
+ effects.exit("tableDelimiterFiller");
2940
+ return headDelimiterRightAlignmentAfter(code2);
2941
+ }
2942
+ function headDelimiterRightAlignmentAfter(code2) {
2943
+ if (markdownSpace(code2)) {
2944
+ return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code2);
2945
+ }
2946
+ return headDelimiterCellAfter(code2);
2947
+ }
2948
+ function headDelimiterCellAfter(code2) {
2949
+ if (code2 === 124) {
2950
+ return headDelimiterBefore(code2);
2951
+ }
2952
+ if (code2 === null || markdownLineEnding(code2)) {
2953
+ if (!seen || size !== sizeB) {
2954
+ return headDelimiterNok(code2);
2955
+ }
2956
+ effects.exit("tableDelimiterRow");
2957
+ effects.exit("tableHead");
2958
+ return ok2(code2);
2959
+ }
2960
+ return headDelimiterNok(code2);
2961
+ }
2962
+ function headDelimiterNok(code2) {
2963
+ return nok(code2);
2964
+ }
2965
+ function bodyRowStart(code2) {
2966
+ effects.enter("tableRow");
2967
+ return bodyRowBreak(code2);
2968
+ }
2969
+ function bodyRowBreak(code2) {
2970
+ if (code2 === 124) {
2971
+ effects.enter("tableCellDivider");
2972
+ effects.consume(code2);
2973
+ effects.exit("tableCellDivider");
2974
+ return bodyRowBreak;
2975
+ }
2976
+ if (code2 === null || markdownLineEnding(code2)) {
2977
+ effects.exit("tableRow");
2978
+ return ok2(code2);
2979
+ }
2980
+ if (markdownSpace(code2)) {
2981
+ return factorySpace(effects, bodyRowBreak, "whitespace")(code2);
2982
+ }
2983
+ effects.enter("data");
2984
+ return bodyRowData(code2);
2985
+ }
2986
+ function bodyRowData(code2) {
2987
+ if (code2 === null || code2 === 124 || markdownLineEndingOrSpace(code2)) {
2988
+ effects.exit("data");
2989
+ return bodyRowBreak(code2);
2990
+ }
2991
+ effects.consume(code2);
2992
+ return code2 === 92 ? bodyRowEscape : bodyRowData;
2993
+ }
2994
+ function bodyRowEscape(code2) {
2995
+ if (code2 === 92 || code2 === 124) {
2996
+ effects.consume(code2);
2997
+ return bodyRowData;
2998
+ }
2999
+ return bodyRowData(code2);
3000
+ }
3001
+ }
3002
+ function resolveTable(events, context) {
3003
+ let index = -1;
3004
+ let inFirstCellAwaitingPipe = true;
3005
+ let rowKind = 0;
3006
+ let lastCell = [0, 0, 0, 0];
3007
+ let cell = [0, 0, 0, 0];
3008
+ let afterHeadAwaitingFirstBodyRow = false;
3009
+ let lastTableEnd = 0;
3010
+ let currentTable;
3011
+ let currentBody;
3012
+ let currentCell;
3013
+ const map2 = new EditMap();
3014
+ while (++index < events.length) {
3015
+ const event = events[index];
3016
+ const token = event[1];
3017
+ if (event[0] === "enter") {
3018
+ if (token.type === "tableHead") {
3019
+ afterHeadAwaitingFirstBodyRow = false;
3020
+ if (lastTableEnd !== 0) {
3021
+ flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);
3022
+ currentBody = void 0;
3023
+ lastTableEnd = 0;
3024
+ }
3025
+ currentTable = {
3026
+ type: "table",
3027
+ start: Object.assign({}, token.start),
3028
+ // Note: correct end is set later.
3029
+ end: Object.assign({}, token.end)
3030
+ };
3031
+ map2.add(index, 0, [["enter", currentTable, context]]);
3032
+ } else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
3033
+ inFirstCellAwaitingPipe = true;
3034
+ currentCell = void 0;
3035
+ lastCell = [0, 0, 0, 0];
3036
+ cell = [0, index + 1, 0, 0];
3037
+ if (afterHeadAwaitingFirstBodyRow) {
3038
+ afterHeadAwaitingFirstBodyRow = false;
3039
+ currentBody = {
3040
+ type: "tableBody",
3041
+ start: Object.assign({}, token.start),
3042
+ // Note: correct end is set later.
3043
+ end: Object.assign({}, token.end)
3044
+ };
3045
+ map2.add(index, 0, [["enter", currentBody, context]]);
3046
+ }
3047
+ rowKind = token.type === "tableDelimiterRow" ? 2 : currentBody ? 3 : 1;
3048
+ } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
3049
+ inFirstCellAwaitingPipe = false;
3050
+ if (cell[2] === 0) {
3051
+ if (lastCell[1] !== 0) {
3052
+ cell[0] = cell[1];
3053
+ currentCell = flushCell(
3054
+ map2,
3055
+ context,
3056
+ lastCell,
3057
+ rowKind,
3058
+ void 0,
3059
+ currentCell
3060
+ );
3061
+ lastCell = [0, 0, 0, 0];
3062
+ }
3063
+ cell[2] = index;
3064
+ }
3065
+ } else if (token.type === "tableCellDivider") {
3066
+ if (inFirstCellAwaitingPipe) {
3067
+ inFirstCellAwaitingPipe = false;
3068
+ } else {
3069
+ if (lastCell[1] !== 0) {
3070
+ cell[0] = cell[1];
3071
+ currentCell = flushCell(
3072
+ map2,
3073
+ context,
3074
+ lastCell,
3075
+ rowKind,
3076
+ void 0,
3077
+ currentCell
3078
+ );
3079
+ }
3080
+ lastCell = cell;
3081
+ cell = [lastCell[1], index, 0, 0];
3082
+ }
3083
+ }
3084
+ } else if (token.type === "tableHead") {
3085
+ afterHeadAwaitingFirstBodyRow = true;
3086
+ lastTableEnd = index;
3087
+ } else if (token.type === "tableRow" || token.type === "tableDelimiterRow") {
3088
+ lastTableEnd = index;
3089
+ if (lastCell[1] !== 0) {
3090
+ cell[0] = cell[1];
3091
+ currentCell = flushCell(
3092
+ map2,
3093
+ context,
3094
+ lastCell,
3095
+ rowKind,
3096
+ index,
3097
+ currentCell
3098
+ );
3099
+ } else if (cell[1] !== 0) {
3100
+ currentCell = flushCell(map2, context, cell, rowKind, index, currentCell);
3101
+ }
3102
+ rowKind = 0;
3103
+ } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) {
3104
+ cell[3] = index;
3105
+ }
3106
+ }
3107
+ if (lastTableEnd !== 0) {
3108
+ flushTableEnd(map2, context, lastTableEnd, currentTable, currentBody);
3109
+ }
3110
+ map2.consume(context.events);
3111
+ index = -1;
3112
+ while (++index < context.events.length) {
3113
+ const event = context.events[index];
3114
+ if (event[0] === "enter" && event[1].type === "table") {
3115
+ event[1]._align = gfmTableAlign(context.events, index);
3116
+ }
3117
+ }
3118
+ return events;
3119
+ }
3120
+ function flushCell(map2, context, range, rowKind, rowEnd, previousCell) {
3121
+ const groupName = rowKind === 1 ? "tableHeader" : rowKind === 2 ? "tableDelimiter" : "tableData";
3122
+ const valueName = "tableContent";
3123
+ if (range[0] !== 0) {
3124
+ previousCell.end = Object.assign({}, getPoint(context.events, range[0]));
3125
+ map2.add(range[0], 0, [["exit", previousCell, context]]);
3126
+ }
3127
+ const now = getPoint(context.events, range[1]);
3128
+ previousCell = {
3129
+ type: groupName,
3130
+ start: Object.assign({}, now),
3131
+ // Note: correct end is set later.
3132
+ end: Object.assign({}, now)
3133
+ };
3134
+ map2.add(range[1], 0, [["enter", previousCell, context]]);
3135
+ if (range[2] !== 0) {
3136
+ const relatedStart = getPoint(context.events, range[2]);
3137
+ const relatedEnd = getPoint(context.events, range[3]);
3138
+ const valueToken = {
3139
+ type: valueName,
3140
+ start: Object.assign({}, relatedStart),
3141
+ end: Object.assign({}, relatedEnd)
3142
+ };
3143
+ map2.add(range[2], 0, [["enter", valueToken, context]]);
3144
+ if (rowKind !== 2) {
3145
+ const start = context.events[range[2]];
3146
+ const end = context.events[range[3]];
3147
+ start[1].end = Object.assign({}, end[1].end);
3148
+ start[1].type = "chunkText";
3149
+ start[1].contentType = "text";
3150
+ if (range[3] > range[2] + 1) {
3151
+ const a = range[2] + 1;
3152
+ const b = range[3] - range[2] - 1;
3153
+ map2.add(a, b, []);
3154
+ }
3155
+ }
3156
+ map2.add(range[3] + 1, 0, [["exit", valueToken, context]]);
3157
+ }
3158
+ if (rowEnd !== void 0) {
3159
+ previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));
3160
+ map2.add(rowEnd, 0, [["exit", previousCell, context]]);
3161
+ previousCell = void 0;
3162
+ }
3163
+ return previousCell;
3164
+ }
3165
+ function flushTableEnd(map2, context, index, table, tableBody) {
3166
+ const exits = [];
3167
+ const related = getPoint(context.events, index);
3168
+ if (tableBody) {
3169
+ tableBody.end = Object.assign({}, related);
3170
+ exits.push(["exit", tableBody, context]);
3171
+ }
3172
+ table.end = Object.assign({}, related);
3173
+ exits.push(["exit", table, context]);
3174
+ map2.add(index + 1, 0, exits);
3175
+ }
3176
+ function getPoint(events, index) {
3177
+ const event = events[index];
3178
+ const side = event[0] === "enter" ? "start" : "end";
3179
+ return event[1][side];
3180
+ }
3181
+ const tasklistCheck = {
3182
+ tokenize: tokenizeTasklistCheck
3183
+ };
3184
+ function gfmTaskListItem() {
3185
+ return {
3186
+ text: {
3187
+ [91]: tasklistCheck
3188
+ }
3189
+ };
3190
+ }
3191
+ function tokenizeTasklistCheck(effects, ok2, nok) {
3192
+ const self = this;
3193
+ return open;
3194
+ function open(code2) {
3195
+ if (
3196
+ // Exit if there’s stuff before.
3197
+ self.previous !== null || // Exit if not in the first content that is the first child of a list
3198
+ // item.
3199
+ !self._gfmTasklistFirstContentOfListItem
3200
+ ) {
3201
+ return nok(code2);
3202
+ }
3203
+ effects.enter("taskListCheck");
3204
+ effects.enter("taskListCheckMarker");
3205
+ effects.consume(code2);
3206
+ effects.exit("taskListCheckMarker");
3207
+ return inside;
3208
+ }
3209
+ function inside(code2) {
3210
+ if (markdownLineEndingOrSpace(code2)) {
3211
+ effects.enter("taskListCheckValueUnchecked");
3212
+ effects.consume(code2);
3213
+ effects.exit("taskListCheckValueUnchecked");
3214
+ return close;
3215
+ }
3216
+ if (code2 === 88 || code2 === 120) {
3217
+ effects.enter("taskListCheckValueChecked");
3218
+ effects.consume(code2);
3219
+ effects.exit("taskListCheckValueChecked");
3220
+ return close;
3221
+ }
3222
+ return nok(code2);
3223
+ }
3224
+ function close(code2) {
3225
+ if (code2 === 93) {
3226
+ effects.enter("taskListCheckMarker");
3227
+ effects.consume(code2);
3228
+ effects.exit("taskListCheckMarker");
3229
+ effects.exit("taskListCheck");
3230
+ return after;
3231
+ }
3232
+ return nok(code2);
3233
+ }
3234
+ function after(code2) {
3235
+ if (markdownLineEnding(code2)) {
3236
+ return ok2(code2);
3237
+ }
3238
+ if (markdownSpace(code2)) {
3239
+ return effects.check(
3240
+ {
3241
+ tokenize: spaceThenNonSpace
3242
+ },
3243
+ ok2,
3244
+ nok
3245
+ )(code2);
3246
+ }
3247
+ return nok(code2);
3248
+ }
3249
+ }
3250
+ function spaceThenNonSpace(effects, ok2, nok) {
3251
+ return factorySpace(effects, after, "whitespace");
3252
+ function after(code2) {
3253
+ return code2 === null ? nok(code2) : ok2(code2);
3254
+ }
3255
+ }
3256
+ function gfm(options) {
3257
+ return combineExtensions([
3258
+ gfmAutolinkLiteral(),
3259
+ gfmFootnote(),
3260
+ gfmStrikethrough(options),
3261
+ gfmTable(),
3262
+ gfmTaskListItem()
3263
+ ]);
3264
+ }
3265
+ const emptyOptions = {};
3266
+ function remarkGfm(options) {
3267
+ const self = (
3268
+ /** @type {Processor<Root>} */
3269
+ this
3270
+ );
3271
+ const settings = options || emptyOptions;
3272
+ const data = self.data();
3273
+ const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
3274
+ const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
3275
+ const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
3276
+ micromarkExtensions.push(gfm(settings));
3277
+ fromMarkdownExtensions.push(gfmFromMarkdown());
3278
+ toMarkdownExtensions.push(gfmToMarkdown(settings));
3279
+ }
3280
+ const _sfc_main$1 = {
3281
+ name: "NcReferenceList",
3282
+ components: {
3283
+ NcReferenceWidget
3284
+ },
3285
+ props: {
3286
+ text: {
3287
+ type: String,
3288
+ default: ""
3289
+ },
3290
+ referenceData: {
3291
+ type: Object,
3292
+ default: null
3293
+ },
3294
+ limit: {
3295
+ type: Number,
3296
+ default: 1
3297
+ },
3298
+ displayFallback: {
3299
+ type: Boolean,
3300
+ default: false
3301
+ },
3302
+ interactive: {
3303
+ type: Boolean,
3304
+ default: true
3305
+ },
3306
+ interactiveOptIn: {
3307
+ type: Boolean,
3308
+ default: false
3309
+ }
3310
+ },
3311
+ emits: ["loaded"],
3312
+ data() {
3313
+ return {
3314
+ references: null,
3315
+ loading: true
3316
+ };
3317
+ },
3318
+ computed: {
3319
+ isVisible() {
3320
+ return this.loading || this.displayedReferences.length !== 0;
3321
+ },
3322
+ values() {
3323
+ if (this.referenceData) {
3324
+ return this.referenceData;
3325
+ }
3326
+ if (this.displayFallback && !this.loading && !this.references) {
3327
+ return [this.fallbackReference];
3328
+ }
3329
+ return this.references ? Object.values(this.references) : [];
3330
+ },
3331
+ firstReference() {
3332
+ return this.values[0] ?? null;
3333
+ },
3334
+ displayedReferences() {
3335
+ return this.values.slice(0, this.limit);
3336
+ },
3337
+ fallbackReference() {
3338
+ return {
3339
+ accessible: true,
3340
+ openGraphObject: {
3341
+ id: this.text,
3342
+ link: this.text,
3343
+ name: this.text
3344
+ },
3345
+ richObjectType: "open-graph"
3346
+ };
3347
+ }
3348
+ },
3349
+ watch: {
3350
+ text: "fetch"
3351
+ },
3352
+ mounted() {
3353
+ this.fetch();
3354
+ },
3355
+ methods: {
3356
+ fetch() {
3357
+ this.loading = true;
3358
+ if (this.referenceData) {
3359
+ this.references = null;
3360
+ this.loading = false;
3361
+ return;
3362
+ }
3363
+ if (!new RegExp(URL_PATTERN).exec(this.text)) {
3364
+ this.references = null;
3365
+ this.loading = false;
3366
+ return;
3367
+ }
3368
+ this.resolve().then((response) => {
3369
+ this.references = response.data.ocs.data.references;
3370
+ this.loading = false;
3371
+ this.$emit("loaded");
3372
+ }).catch((error) => {
3373
+ console.error("Failed to extract references", error);
3374
+ this.loading = false;
3375
+ this.$emit("loaded");
3376
+ });
3377
+ },
3378
+ resolve() {
3379
+ const match = new RegExp(URL_PATTERN).exec(this.text.trim());
3380
+ const isPublic = getCurrentUser() === null;
3381
+ if (this.limit === 1 && match) {
3382
+ return isPublic ? axios.get(generateOcsUrl("references/resolvePublic") + `?reference=${encodeURIComponent(match[0])}&sharingToken=${getSharingToken()}`) : axios.get(generateOcsUrl("references/resolve") + `?reference=${encodeURIComponent(match[0])}`);
3383
+ }
3384
+ return isPublic ? axios.post(generateOcsUrl("references/extractPublic"), {
3385
+ text: this.text,
3386
+ resolve: true,
3387
+ limit: this.limit,
3388
+ sharingToken: getSharingToken()
3389
+ }) : axios.post(generateOcsUrl("references/extract"), {
3390
+ text: this.text,
3391
+ resolve: true,
3392
+ limit: this.limit
3393
+ });
3394
+ }
3395
+ }
3396
+ };
3397
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3398
+ const _component_NcReferenceWidget = resolveComponent("NcReferenceWidget");
3399
+ return $options.isVisible ? (openBlock(), createElementBlock("div", {
3400
+ key: 0,
3401
+ class: normalizeClass(["widgets--list", { "icon-loading": $data.loading }])
3402
+ }, [
3403
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.displayedReferences, (reference) => {
3404
+ return openBlock(), createBlock(_component_NcReferenceWidget, {
3405
+ key: reference?.openGraphObject?.id,
3406
+ reference,
3407
+ interactive: $props.interactive,
3408
+ "interactive-opt-in": $props.interactiveOptIn
3409
+ }, null, 8, ["reference", "interactive", "interactive-opt-in"]);
3410
+ }), 128))
3411
+ ], 2)) : createCommentVNode("", true);
3412
+ }
3413
+ const NcReferenceList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__scopeId", "data-v-8d575d2d"]]);
3414
+ const remarkPlaceholder = function() {
3415
+ return function(ast) {
3416
+ visit(ast, (node2) => node2.type === "text", visitor);
3417
+ function visitor(node2, index, parent) {
3418
+ const placeholders = node2.value.split(/(\{[a-z\-_.0-9]+\})/ig).map((entry, index2, list2) => {
3419
+ const matches = entry.match(/^\{([a-z\-_.0-9]+)\}$/i);
3420
+ if (!matches) {
3421
+ return u("text", entry);
3422
+ }
3423
+ const [, component] = matches;
3424
+ return u("element", {
3425
+ tagName: `#${component}`,
3426
+ children: []
3427
+ });
3428
+ });
3429
+ parent.children.splice(index, 1, ...placeholders);
3430
+ }
3431
+ };
3432
+ };
3433
+ const prepareTextNode = ({ h: h2, context }, text2) => {
3434
+ if (context.autolink) {
3435
+ text2 = parseUrl(text2);
3436
+ }
3437
+ if (Array.isArray(text2)) {
3438
+ return text2.map((entry) => {
3439
+ if (typeof entry === "string") {
3440
+ return entry;
3441
+ }
3442
+ const { component, props } = entry;
3443
+ const componentClass = component.name === "NcLink" ? void 0 : "rich-text--component";
3444
+ return h2(component, {
3445
+ ...props,
3446
+ class: componentClass
3447
+ });
3448
+ });
3449
+ }
3450
+ return text2;
3451
+ };
3452
+ const remarkUnescape = function() {
3453
+ return function(tree) {
3454
+ visit(
3455
+ tree,
3456
+ (node2) => ["text", "code", "inlineCode"].includes(node2.type),
3457
+ (node2, index, parent) => {
3458
+ parent.children.splice(index, 1, {
3459
+ ...node2,
3460
+ value: node2.value.replace(/&lt;/gmi, "<").replace(/&gt;/gmi, ">")
3461
+ });
3462
+ return [SKIP$1, index + 1];
3463
+ }
3464
+ );
3465
+ };
3466
+ };
3467
+ const rehypeHighlight = ref(null);
3468
+ async function importRehypeHighlightLibrary() {
3469
+ const module = await import("rehype-highlight");
3470
+ rehypeHighlight.value = module.default;
3471
+ }
3472
+ const _sfc_main = {
3473
+ name: "NcRichText",
3474
+ components: {
3475
+ NcReferenceList
3476
+ },
3477
+ props: {
3478
+ text: {
3479
+ type: String,
3480
+ default: ""
3481
+ },
3482
+ arguments: {
3483
+ type: Object,
3484
+ default: () => {
3485
+ return {};
3486
+ }
3487
+ },
3488
+ referenceLimit: {
3489
+ type: Number,
3490
+ default: 0
3491
+ },
3492
+ referenceInteractive: {
3493
+ type: Boolean,
3494
+ default: true
3495
+ },
3496
+ referenceInteractiveOptIn: {
3497
+ type: Boolean,
3498
+ default: false
3499
+ },
3500
+ /** Provide data upfront to avoid extra http request */
3501
+ references: {
3502
+ type: Object,
3503
+ default: null
3504
+ },
3505
+ /** Provide basic Markdown syntax */
3506
+ useMarkdown: {
3507
+ type: Boolean,
3508
+ default: false
3509
+ },
3510
+ /** Provide GitHub Flavored Markdown syntax */
3511
+ useExtendedMarkdown: {
3512
+ type: Boolean,
3513
+ default: false
3514
+ },
3515
+ /** Provide event from rendered markdown inputs */
3516
+ interactive: {
3517
+ type: Boolean,
3518
+ default: false
3519
+ },
3520
+ autolink: {
3521
+ type: Boolean,
3522
+ default: true
3523
+ }
3524
+ },
3525
+ emits: ["interact:todo"],
3526
+ data() {
3527
+ return {
3528
+ parentId: createElementId()
3529
+ };
3530
+ },
3531
+ methods: {
3532
+ renderPlaintext() {
3533
+ const placeholders = this.text.split(/(\{[a-z\-_.0-9]+\})/ig).map((entry) => {
3534
+ const matches = entry.match(/^\{([a-z\-_.0-9]+)\}$/i);
3535
+ if (!matches) {
3536
+ return prepareTextNode({ h, context: this }, entry);
3537
+ }
3538
+ const argumentId = matches[1];
3539
+ const argument = this.arguments[argumentId];
3540
+ if (typeof argument === "object") {
3541
+ const { component, props } = argument;
3542
+ return h(typeof component === "string" ? resolveComponent(component) : component, {
3543
+ ...props,
3544
+ class: "rich-text--component"
3545
+ });
3546
+ }
3547
+ if (argument) {
3548
+ return h("span", { class: "rich-text--fallback" }, argument);
3549
+ }
3550
+ return entry;
3551
+ });
3552
+ return h("div", { class: "rich-text--wrapper" }, [
3553
+ h("div", {}, placeholders.flat()),
3554
+ this.referenceLimit > 0 ? h("div", { class: "rich-text--reference-widget" }, [
3555
+ h(NcReferenceList, {
3556
+ text: this.text,
3557
+ referenceData: this.references,
3558
+ interactive: this.referenceInteractive,
3559
+ interactiveOptIn: this.referenceInteractiveOptIn
3560
+ })
3561
+ ]) : null
3562
+ ]);
3563
+ },
3564
+ renderMarkdown() {
3565
+ const renderedMarkdown = unified().use(remarkParse).use(remarkAutolink, {
3566
+ autolink: this.autolink,
3567
+ useMarkdown: this.useMarkdown,
3568
+ useExtendedMarkdown: this.useExtendedMarkdown
3569
+ }).use(remarkUnescape).use(this.useExtendedMarkdown ? remarkGfm : void 0).use(breaks).use(remark2rehype, {
3570
+ handlers: {
3571
+ component(toHast, node2) {
3572
+ return toHast(node2, node2.component, { value: node2.value });
3573
+ }
3574
+ }
3575
+ }).use(this.useExtendedMarkdown ? rehypeHighlight.value : void 0).use(remarkPlaceholder).use(rehypeExternalLinks, {
3576
+ target: "_blank",
3577
+ rel: ["noopener noreferrer"]
3578
+ }).use(rehype2react, {
3579
+ Fragment,
3580
+ jsx: this.createElement,
3581
+ jsxs: this.createElement,
3582
+ elementAttributeNameCase: "html",
3583
+ prefix: false
3584
+ }).processSync(
3585
+ this.text.replace(/<[^>]+>/g, (match) => match.replace(/</g, "&lt;")).replace(/&gt;/gmi, ">")
3586
+ ).result;
3587
+ return h("div", { class: "rich-text--wrapper rich-text--wrapper-markdown" }, [
3588
+ renderedMarkdown,
3589
+ this.referenceLimit > 0 ? h("div", { class: "rich-text--reference-widget" }, [
3590
+ h(NcReferenceList, {
3591
+ text: this.text,
3592
+ referenceData: this.references,
3593
+ interactive: this.referenceInteractive,
3594
+ interactiveOptIn: this.referenceInteractiveOptIn
3595
+ })
3596
+ ]) : null
3597
+ ]);
3598
+ },
3599
+ createElement(type, props, key) {
3600
+ if (key) {
3601
+ props.key = key;
3602
+ }
3603
+ const children = props.children ?? [];
3604
+ delete props.children;
3605
+ if (!String(type).startsWith("#")) {
3606
+ let nestedNode = null;
3607
+ if (this.useExtendedMarkdown) {
3608
+ if (String(type) === "code" && !rehypeHighlight.value && props?.class?.includes("language")) {
3609
+ importRehypeHighlightLibrary();
3610
+ }
3611
+ if (String(type) === "li" && Array.isArray(children) && children[0].type === "input" && children[0].props.type === "checkbox") {
3612
+ const [inputNode, , ...labelParts] = children;
3613
+ const nestedNodeIndex = labelParts.findIndex((child) => ["ul", "ol", "li", "blockquote", "pre"].includes(child.type));
3614
+ if (nestedNodeIndex !== -1) {
3615
+ nestedNode = labelParts[nestedNodeIndex];
3616
+ labelParts.splice(nestedNodeIndex);
3617
+ }
3618
+ const id = this.parentId + "-markdown-input-" + createElementId();
3619
+ const propsToForward = { ...inputNode.props };
3620
+ delete propsToForward.checked;
3621
+ const inputComponent = h(NcCheckboxRadioSwitch, {
3622
+ ...propsToForward,
3623
+ modelValue: inputNode.props.checked,
3624
+ id,
3625
+ disabled: !this.interactive,
3626
+ "onUpdate:modelValue": () => {
3627
+ this.$emit("interact:todo", id);
3628
+ }
3629
+ }, { default: () => labelParts });
3630
+ return h(type, props, [inputComponent, nestedNode]);
3631
+ }
3632
+ }
3633
+ if (String(type) === "a") {
3634
+ const route = getRoute(this.$router, props.href);
3635
+ if (route) {
3636
+ delete props.href;
3637
+ delete props.target;
3638
+ return h(RouterLink, {
3639
+ ...props,
3640
+ to: route
3641
+ }, { default: () => children });
3642
+ }
3643
+ }
3644
+ return h(type, props, children);
3645
+ }
3646
+ const placeholder = this.arguments[type.slice(1)];
3647
+ if (!placeholder) {
3648
+ return h("span", { ...props, class: "rich-text--fallback" }, [`{${type.slice(1)}}`]);
3649
+ }
3650
+ if (!placeholder.component) {
3651
+ return h("span", { ...props }, [placeholder]);
3652
+ }
3653
+ return h(
3654
+ typeof placeholder.component === "string" ? resolveComponent(placeholder.component) : placeholder.component,
3655
+ {
3656
+ ...props,
3657
+ ...placeholder.props,
3658
+ class: "rich-text--component"
3659
+ },
3660
+ { default: () => children }
3661
+ );
3662
+ }
3663
+ },
3664
+ render() {
3665
+ return this.useMarkdown || this.useExtendedMarkdown ? this.renderMarkdown() : this.renderPlaintext();
3666
+ }
3667
+ };
3668
+ const NcRichText = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-958de8f1"]]);
3669
+ export {
3670
+ NcRichText as N,
3671
+ NcReferenceList as a
3672
+ };
3673
+ //# sourceMappingURL=NcRichText-4jIBSmap.mjs.map