@notectl/core 2.4.2 → 2.5.0

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 (415) hide show
  1. package/dist/chunks/AlignmentPlugin-C26pIVcw.mjs +2 -0
  2. package/dist/chunks/{AlignmentPlugin-Cp7HYGaH.mjs.map → AlignmentPlugin-C26pIVcw.mjs.map} +1 -1
  3. package/dist/chunks/BidiIsolationPlugin-nWd1NEF-.mjs +2 -0
  4. package/dist/chunks/{BidiIsolationPlugin-GWukKdgJ.mjs.map → BidiIsolationPlugin-nWd1NEF-.mjs.map} +1 -1
  5. package/dist/chunks/BlockquotePlugin-Bag42Zc0.mjs +2 -0
  6. package/dist/chunks/{BlockquotePlugin-CSL_7Yit.mjs.map → BlockquotePlugin-Bag42Zc0.mjs.map} +1 -1
  7. package/dist/chunks/CaretNavigationPlugin-DUAoHygg.mjs +2 -0
  8. package/dist/chunks/{CaretNavigationPlugin-BQPqqK4n.mjs.map → CaretNavigationPlugin-DUAoHygg.mjs.map} +1 -1
  9. package/dist/chunks/CodeBlockPlugin-Dk_J8NAl.mjs +2 -0
  10. package/dist/chunks/{CodeBlockPlugin-B4AcDJRK.mjs.map → CodeBlockPlugin-Dk_J8NAl.mjs.map} +1 -1
  11. package/dist/chunks/Commands-vqbwh6Ic.mjs +2 -0
  12. package/dist/chunks/{Commands-Bk7Cl1nH.mjs.map → Commands-vqbwh6Ic.mjs.map} +1 -1
  13. package/dist/chunks/DocumentParser-D4g5npEi.mjs +2 -0
  14. package/dist/chunks/DocumentParser-D4g5npEi.mjs.map +1 -0
  15. package/dist/chunks/EditorUI-DrQI95FW.mjs +2 -0
  16. package/dist/chunks/EditorUI-DrQI95FW.mjs.map +1 -0
  17. package/dist/chunks/FontPlugin-Bzlluh1_.mjs +2 -0
  18. package/dist/chunks/{FontPlugin-BcXNFqqO.mjs.map → FontPlugin-Bzlluh1_.mjs.map} +1 -1
  19. package/dist/chunks/FontSizePlugin-kv3zHG0f.mjs +2 -0
  20. package/dist/chunks/{FontSizePlugin-Dswra3oU.mjs.map → FontSizePlugin-kv3zHG0f.mjs.map} +1 -1
  21. package/dist/chunks/FormulaPlugin-20vW4Gge.mjs +2 -0
  22. package/dist/chunks/{FormulaPlugin-DVpLaKi5.mjs.map → FormulaPlugin-20vW4Gge.mjs.map} +1 -1
  23. package/dist/chunks/GapCursorPlugin-BPyNXY4H.mjs +2 -0
  24. package/dist/chunks/{GapCursorPlugin-QDGwnaRR.mjs.map → GapCursorPlugin-BPyNXY4H.mjs.map} +1 -1
  25. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs +2 -0
  26. package/dist/chunks/HTMLSanitization-BRipXyhI.mjs.map +1 -0
  27. package/dist/chunks/{HardBreakPlugin-gjCq8prD.mjs → HardBreakPlugin-lo8Mcg9G.mjs} +2 -2
  28. package/dist/chunks/{HardBreakPlugin-gjCq8prD.mjs.map → HardBreakPlugin-lo8Mcg9G.mjs.map} +1 -1
  29. package/dist/chunks/HeadingPlugin-CEZF5DBM.mjs +2 -0
  30. package/dist/chunks/{HeadingPlugin-B7EfynaH.mjs.map → HeadingPlugin-CEZF5DBM.mjs.map} +1 -1
  31. package/dist/chunks/HighlightPlugin-yH44UWoe.mjs +2 -0
  32. package/dist/chunks/{HighlightPlugin-LdO0INtJ.mjs.map → HighlightPlugin-yH44UWoe.mjs.map} +1 -1
  33. package/dist/chunks/HorizontalRulePlugin-SNNum-9V.mjs +2 -0
  34. package/dist/chunks/{HorizontalRulePlugin-YywXVZYr.mjs.map → HorizontalRulePlugin-SNNum-9V.mjs.map} +1 -1
  35. package/dist/chunks/ImagePlugin-aeqHr5zx.mjs +2 -0
  36. package/dist/chunks/{ImagePlugin-BAhZuVdE.mjs.map → ImagePlugin-aeqHr5zx.mjs.map} +1 -1
  37. package/dist/chunks/InlineCodePlugin-CIks06ti.mjs +2 -0
  38. package/dist/chunks/{InlineCodePlugin-Bu9-rE4B.mjs.map → InlineCodePlugin-CIks06ti.mjs.map} +1 -1
  39. package/dist/chunks/LinkPlugin-CFw22a9X.mjs +2 -0
  40. package/dist/chunks/LinkPlugin-CFw22a9X.mjs.map +1 -0
  41. package/dist/chunks/ListPlugin-ZNEx8pvk.mjs +2 -0
  42. package/dist/chunks/{ListPlugin-U1r4p_fE.mjs.map → ListPlugin-ZNEx8pvk.mjs.map} +1 -1
  43. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs +2 -0
  44. package/dist/chunks/LocaleLoader-DEpTFuVc.mjs.map +1 -0
  45. package/dist/chunks/{MarkdownHTMLRegistry-BunUDiza.mjs → MarkdownHTMLRegistry-Cj7N2wqs.mjs} +2 -2
  46. package/dist/chunks/{MarkdownHTMLRegistry-BunUDiza.mjs.map → MarkdownHTMLRegistry-Cj7N2wqs.mjs.map} +1 -1
  47. package/dist/chunks/{MarkdownParser-uX1p_GQk.mjs → MarkdownParser-JOfPSvGv.mjs} +2 -2
  48. package/dist/chunks/{MarkdownParser-uX1p_GQk.mjs.map → MarkdownParser-JOfPSvGv.mjs.map} +1 -1
  49. package/dist/chunks/{MarkdownSerializer--MrgJTdJ.mjs → MarkdownSerializer-Y6saYClE.mjs} +2 -2
  50. package/dist/chunks/{MarkdownSerializer--MrgJTdJ.mjs.map → MarkdownSerializer-Y6saYClE.mjs.map} +1 -1
  51. package/dist/chunks/PopupManager-DpxoBl54.mjs +2 -0
  52. package/dist/chunks/PopupManager-DpxoBl54.mjs.map +1 -0
  53. package/dist/chunks/PopupPositioning-CIqgpqlW.mjs.map +1 -1
  54. package/dist/chunks/PrintPlugin-CYkdUy-m.mjs +2 -0
  55. package/dist/chunks/{PrintPlugin-DAEiEyKQ.mjs.map → PrintPlugin-CYkdUy-m.mjs.map} +1 -1
  56. package/dist/chunks/{SchemaRegistry-Cs7rxafF.mjs → SchemaRegistry-CT3T7S1i.mjs} +2 -2
  57. package/dist/chunks/{SchemaRegistry-Cs7rxafF.mjs.map → SchemaRegistry-CT3T7S1i.mjs.map} +1 -1
  58. package/dist/chunks/{SelectionReplacement-vC1xhFS0.mjs → SelectionReplacement-Cj4FLlPz.mjs} +2 -2
  59. package/dist/chunks/{SelectionReplacement-vC1xhFS0.mjs.map → SelectionReplacement-Cj4FLlPz.mjs.map} +1 -1
  60. package/dist/chunks/{SelectionSync-BkjCwGp-.mjs → SelectionSync-8y0nbBHZ.mjs} +2 -2
  61. package/dist/chunks/{SelectionSync-BkjCwGp-.mjs.map → SelectionSync-8y0nbBHZ.mjs.map} +1 -1
  62. package/dist/chunks/SimpleMark-DPTsIl9w.mjs +2 -0
  63. package/dist/chunks/{SimpleMark-D6vz3Nfd.mjs.map → SimpleMark-DPTsIl9w.mjs.map} +1 -1
  64. package/dist/chunks/SmartPastePlugin-BSMHDDQ2.mjs +2 -0
  65. package/dist/chunks/{SmartPastePlugin-BHsYKbgd.mjs.map → SmartPastePlugin-BSMHDDQ2.mjs.map} +1 -1
  66. package/dist/chunks/StrikethroughPlugin-CqqIF3Zk.mjs +2 -0
  67. package/dist/chunks/{StrikethroughPlugin-v-VJZzUZ.mjs.map → StrikethroughPlugin-CqqIF3Zk.mjs.map} +1 -1
  68. package/dist/chunks/SuperSubPlugin-5ZFM6wdU.mjs +2 -0
  69. package/dist/chunks/{SuperSubPlugin-x1iPnZyt.mjs.map → SuperSubPlugin-5ZFM6wdU.mjs.map} +1 -1
  70. package/dist/chunks/{TableDimensions-BSEOEox2.mjs → TableDimensions-B-OWjTuW.mjs} +2 -2
  71. package/dist/chunks/{TableDimensions-BSEOEox2.mjs.map → TableDimensions-B-OWjTuW.mjs.map} +1 -1
  72. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs +2 -0
  73. package/dist/chunks/TablePlugin-D1Wg-pjl.mjs.map +1 -0
  74. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs +2 -0
  75. package/dist/chunks/TableSelectionTypes-t2cLhe16.mjs.map +1 -0
  76. package/dist/chunks/TextColorPlugin-Dwp7eW7F.mjs +2 -0
  77. package/dist/chunks/{TextColorPlugin-Bnl9of9E.mjs.map → TextColorPlugin-Dwp7eW7F.mjs.map} +1 -1
  78. package/dist/chunks/{TextDirectionAutoPlugin-DOH5cfyy.mjs → TextDirectionAutoPlugin-CkIETM5n.mjs} +2 -2
  79. package/dist/chunks/{TextDirectionAutoPlugin-DOH5cfyy.mjs.map → TextDirectionAutoPlugin-CkIETM5n.mjs.map} +1 -1
  80. package/dist/chunks/TextDirectionPlugin-DAcPR5Qc.mjs +2 -0
  81. package/dist/chunks/{TextDirectionPlugin-JwlR-R-b.mjs.map → TextDirectionPlugin-DAcPR5Qc.mjs.map} +1 -1
  82. package/dist/chunks/TextDirectionService-OFOU6r_s.mjs +2 -0
  83. package/dist/chunks/{TextDirectionService-BcX07mw2.mjs.map → TextDirectionService-OFOU6r_s.mjs.map} +1 -1
  84. package/dist/chunks/TextFormattingPlugin-vml-lduV.mjs +2 -0
  85. package/dist/chunks/{TextFormattingPlugin-Kc_UNoOz.mjs.map → TextFormattingPlugin-vml-lduV.mjs.map} +1 -1
  86. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs +2 -0
  87. package/dist/chunks/ToolbarPlugin-Cxmb0MFr.mjs.map +1 -0
  88. package/dist/chunks/VideoPlugin-lZCBlIon.mjs +2 -0
  89. package/dist/chunks/{VideoPlugin-DJXfuNA9.mjs.map → VideoPlugin-lZCBlIon.mjs.map} +1 -1
  90. package/dist/chunks/ar-Dp1oBWyG.mjs +2 -0
  91. package/dist/chunks/ar-Dp1oBWyG.mjs.map +1 -0
  92. package/dist/chunks/de-D3J8XPCR.mjs +2 -0
  93. package/dist/chunks/de-D3J8XPCR.mjs.map +1 -0
  94. package/dist/chunks/es-Bbz885DZ.mjs +2 -0
  95. package/dist/chunks/es-Bbz885DZ.mjs.map +1 -0
  96. package/dist/chunks/fr-GEgM1j3w.mjs +2 -0
  97. package/dist/chunks/fr-GEgM1j3w.mjs.map +1 -0
  98. package/dist/chunks/full-wDTdOuGt.mjs +2 -0
  99. package/dist/chunks/{full-BsWAZr1w.mjs.map → full-wDTdOuGt.mjs.map} +1 -1
  100. package/dist/chunks/hi-CKg8i4Mm.mjs +2 -0
  101. package/dist/chunks/hi-CKg8i4Mm.mjs.map +1 -0
  102. package/dist/chunks/minimal-FfmHwMGU.mjs +2 -0
  103. package/dist/chunks/{minimal-DO7LiFTa.mjs.map → minimal-FfmHwMGU.mjs.map} +1 -1
  104. package/dist/chunks/nl-2IdjTNeJ.mjs +2 -0
  105. package/dist/chunks/nl-2IdjTNeJ.mjs.map +1 -0
  106. package/dist/chunks/nl-B1i04NvZ.mjs +2 -0
  107. package/dist/chunks/nl-B1i04NvZ.mjs.map +1 -0
  108. package/dist/chunks/nl-BEmzpzKO.mjs +2 -0
  109. package/dist/chunks/nl-BEmzpzKO.mjs.map +1 -0
  110. package/dist/chunks/nl-B_U0D3Qq.mjs +2 -0
  111. package/dist/chunks/nl-B_U0D3Qq.mjs.map +1 -0
  112. package/dist/chunks/nl-C437Xz6z.mjs +2 -0
  113. package/dist/chunks/nl-C437Xz6z.mjs.map +1 -0
  114. package/dist/chunks/nl-C5P8Fogm.mjs +2 -0
  115. package/dist/chunks/nl-C5P8Fogm.mjs.map +1 -0
  116. package/dist/chunks/nl-CST62bzx.mjs +2 -0
  117. package/dist/chunks/nl-CST62bzx.mjs.map +1 -0
  118. package/dist/chunks/nl-CWQT-W-6.mjs +2 -0
  119. package/dist/chunks/nl-CWQT-W-6.mjs.map +1 -0
  120. package/dist/chunks/nl-CdpcDkbM.mjs +2 -0
  121. package/dist/chunks/nl-CdpcDkbM.mjs.map +1 -0
  122. package/dist/chunks/nl-CgYWZnga.mjs +2 -0
  123. package/dist/chunks/nl-CgYWZnga.mjs.map +1 -0
  124. package/dist/chunks/nl-Cr--x8bX.mjs +2 -0
  125. package/dist/chunks/nl-Cr--x8bX.mjs.map +1 -0
  126. package/dist/chunks/nl-Cwl5dxFZ.mjs +2 -0
  127. package/dist/chunks/nl-Cwl5dxFZ.mjs.map +1 -0
  128. package/dist/chunks/nl-Czjd9Bw9.mjs +2 -0
  129. package/dist/chunks/nl-Czjd9Bw9.mjs.map +1 -0
  130. package/dist/chunks/nl-DUOT2ZMQ.mjs +2 -0
  131. package/dist/chunks/nl-DUOT2ZMQ.mjs.map +1 -0
  132. package/dist/chunks/nl-DYnRYvZ5.mjs +2 -0
  133. package/dist/chunks/nl-DYnRYvZ5.mjs.map +1 -0
  134. package/dist/chunks/nl-DaNJ-ffX.mjs +2 -0
  135. package/dist/chunks/nl-DaNJ-ffX.mjs.map +1 -0
  136. package/dist/chunks/nl-DeOJ64xy.mjs +2 -0
  137. package/dist/chunks/nl-DeOJ64xy.mjs.map +1 -0
  138. package/dist/chunks/nl-DwZajfpP.mjs +2 -0
  139. package/dist/chunks/nl-DwZajfpP.mjs.map +1 -0
  140. package/dist/chunks/nl-Dyjc9M7o.mjs +2 -0
  141. package/dist/chunks/nl-Dyjc9M7o.mjs.map +1 -0
  142. package/dist/chunks/nl-GBpv7W4L.mjs +2 -0
  143. package/dist/chunks/nl-GBpv7W4L.mjs.map +1 -0
  144. package/dist/chunks/nl-HFfWJOEo.mjs +2 -0
  145. package/dist/chunks/nl-HFfWJOEo.mjs.map +1 -0
  146. package/dist/chunks/nl-KqmiCeD7.mjs +2 -0
  147. package/dist/chunks/nl-KqmiCeD7.mjs.map +1 -0
  148. package/dist/chunks/nl-_QT7e2Qt.mjs +2 -0
  149. package/dist/chunks/nl-_QT7e2Qt.mjs.map +1 -0
  150. package/dist/chunks/nl-i79IajbC.mjs +2 -0
  151. package/dist/chunks/nl-i79IajbC.mjs.map +1 -0
  152. package/dist/chunks/nl-lcZvrAz6.mjs +2 -0
  153. package/dist/chunks/nl-lcZvrAz6.mjs.map +1 -0
  154. package/dist/chunks/nl-tWJ2imhe.mjs +2 -0
  155. package/dist/chunks/nl-tWJ2imhe.mjs.map +1 -0
  156. package/dist/chunks/nl-xfiNOCgg.mjs +2 -0
  157. package/dist/chunks/nl-xfiNOCgg.mjs.map +1 -0
  158. package/dist/chunks/pt-DP5c76Vo.mjs +2 -0
  159. package/dist/chunks/pt-DP5c76Vo.mjs.map +1 -0
  160. package/dist/chunks/register-DSRtHVkk.mjs +3 -0
  161. package/dist/chunks/register-DSRtHVkk.mjs.map +1 -0
  162. package/dist/chunks/ru--iYEtsT5.mjs +2 -0
  163. package/dist/chunks/ru--iYEtsT5.mjs.map +1 -0
  164. package/dist/chunks/src-DDkRstYh.mjs +2 -0
  165. package/dist/chunks/src-DDkRstYh.mjs.map +1 -0
  166. package/dist/chunks/zh-DUS7JduA.mjs +2 -0
  167. package/dist/chunks/zh-DUS7JduA.mjs.map +1 -0
  168. package/dist/commands/Commands.d.ts +3 -0
  169. package/dist/commands/Commands.d.ts.map +1 -1
  170. package/dist/commands/CompositionCommands.d.ts +14 -8
  171. package/dist/commands/CompositionCommands.d.ts.map +1 -1
  172. package/dist/commands/CompositionFallback.d.ts +13 -0
  173. package/dist/commands/CompositionFallback.d.ts.map +1 -0
  174. package/dist/commands/CompositionRebase.d.ts +17 -10
  175. package/dist/commands/CompositionRebase.d.ts.map +1 -1
  176. package/dist/editor/locales/nl.d.ts +4 -0
  177. package/dist/editor/locales/nl.d.ts.map +1 -0
  178. package/dist/editor/styles/link.d.ts +2 -2
  179. package/dist/editor/styles/link.d.ts.map +1 -1
  180. package/dist/fonts.mjs +1 -1
  181. package/dist/full.mjs +1 -1
  182. package/dist/html.mjs +1 -1
  183. package/dist/i18n/Locale.d.ts +1 -0
  184. package/dist/i18n/Locale.d.ts.map +1 -1
  185. package/dist/input/CompositionController.d.ts.map +1 -1
  186. package/dist/input/HTMLLineBreaks.d.ts +14 -0
  187. package/dist/input/HTMLLineBreaks.d.ts.map +1 -0
  188. package/dist/input/HTMLParser.d.ts +1 -7
  189. package/dist/input/HTMLParser.d.ts.map +1 -1
  190. package/dist/input/PasteHTMLHandler.d.ts +0 -1
  191. package/dist/input/PasteHTMLHandler.d.ts.map +1 -1
  192. package/dist/markdown.mjs +1 -1
  193. package/dist/notectl-core.mjs +1 -1
  194. package/dist/notectl-core.umd.js +1 -1
  195. package/dist/notectl-core.umd.js.map +1 -1
  196. package/dist/plugins/PluginContextFactory.d.ts +1 -0
  197. package/dist/plugins/PluginContextFactory.d.ts.map +1 -1
  198. package/dist/plugins/PluginManager.d.ts +5 -0
  199. package/dist/plugins/PluginManager.d.ts.map +1 -1
  200. package/dist/plugins/alignment/locales/nl.d.ts +4 -0
  201. package/dist/plugins/alignment/locales/nl.d.ts.map +1 -0
  202. package/dist/plugins/alignment.mjs +1 -1
  203. package/dist/plugins/bidi-isolation/locales/nl.d.ts +4 -0
  204. package/dist/plugins/bidi-isolation/locales/nl.d.ts.map +1 -0
  205. package/dist/plugins/bidi-isolation.mjs +1 -1
  206. package/dist/plugins/blockquote/locales/nl.d.ts +4 -0
  207. package/dist/plugins/blockquote/locales/nl.d.ts.map +1 -0
  208. package/dist/plugins/blockquote.mjs +1 -1
  209. package/dist/plugins/caret-navigation/locales/nl.d.ts +4 -0
  210. package/dist/plugins/caret-navigation/locales/nl.d.ts.map +1 -0
  211. package/dist/plugins/caret-navigation.mjs +1 -1
  212. package/dist/plugins/code-block/locales/nl.d.ts +4 -0
  213. package/dist/plugins/code-block/locales/nl.d.ts.map +1 -0
  214. package/dist/plugins/code-block.mjs +1 -1
  215. package/dist/plugins/editor-ui/EditorUI.d.ts +50 -0
  216. package/dist/plugins/editor-ui/EditorUI.d.ts.map +1 -0
  217. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts +44 -0
  218. package/dist/plugins/editor-ui/EditorUIRuntime.d.ts.map +1 -0
  219. package/dist/plugins/editor-ui/index.d.ts +6 -0
  220. package/dist/plugins/editor-ui/index.d.ts.map +1 -0
  221. package/dist/plugins/font/locales/nl.d.ts +4 -0
  222. package/dist/plugins/font/locales/nl.d.ts.map +1 -0
  223. package/dist/plugins/font-size/locales/nl.d.ts +4 -0
  224. package/dist/plugins/font-size/locales/nl.d.ts.map +1 -0
  225. package/dist/plugins/font-size.mjs +1 -1
  226. package/dist/plugins/font.mjs +1 -1
  227. package/dist/plugins/formula/locales/nl.d.ts +4 -0
  228. package/dist/plugins/formula/locales/nl.d.ts.map +1 -0
  229. package/dist/plugins/formula.mjs +1 -1
  230. package/dist/plugins/gap-cursor/locales/nl.d.ts +4 -0
  231. package/dist/plugins/gap-cursor/locales/nl.d.ts.map +1 -0
  232. package/dist/plugins/gap-cursor.mjs +1 -1
  233. package/dist/plugins/hard-break.mjs +1 -1
  234. package/dist/plugins/heading/locales/nl.d.ts +4 -0
  235. package/dist/plugins/heading/locales/nl.d.ts.map +1 -0
  236. package/dist/plugins/heading.mjs +1 -1
  237. package/dist/plugins/highlight/locales/nl.d.ts +4 -0
  238. package/dist/plugins/highlight/locales/nl.d.ts.map +1 -0
  239. package/dist/plugins/highlight.mjs +1 -1
  240. package/dist/plugins/horizontal-rule/locales/nl.d.ts +4 -0
  241. package/dist/plugins/horizontal-rule/locales/nl.d.ts.map +1 -0
  242. package/dist/plugins/horizontal-rule.mjs +1 -1
  243. package/dist/plugins/image/locales/nl.d.ts +4 -0
  244. package/dist/plugins/image/locales/nl.d.ts.map +1 -0
  245. package/dist/plugins/image.mjs +1 -1
  246. package/dist/plugins/inline-code/locales/nl.d.ts +4 -0
  247. package/dist/plugins/inline-code/locales/nl.d.ts.map +1 -0
  248. package/dist/plugins/inline-code.mjs +1 -1
  249. package/dist/plugins/link/{LinkPreview.d.ts → LinkBubble.d.ts} +10 -7
  250. package/dist/plugins/link/LinkBubble.d.ts.map +1 -0
  251. package/dist/plugins/link/LinkBubbleContent.d.ts +4 -0
  252. package/dist/plugins/link/LinkBubbleContent.d.ts.map +1 -0
  253. package/dist/plugins/link/LinkInteractionController.d.ts +17 -3
  254. package/dist/plugins/link/LinkInteractionController.d.ts.map +1 -1
  255. package/dist/plugins/link/LinkLocale.d.ts +3 -0
  256. package/dist/plugins/link/LinkLocale.d.ts.map +1 -1
  257. package/dist/plugins/link/LinkPlugin.d.ts +0 -1
  258. package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
  259. package/dist/plugins/link/LinkRange.d.ts +12 -0
  260. package/dist/plugins/link/LinkRange.d.ts.map +1 -0
  261. package/dist/plugins/link/locales/ar.d.ts.map +1 -1
  262. package/dist/plugins/link/locales/de.d.ts.map +1 -1
  263. package/dist/plugins/link/locales/es.d.ts.map +1 -1
  264. package/dist/plugins/link/locales/fr.d.ts.map +1 -1
  265. package/dist/plugins/link/locales/hi.d.ts.map +1 -1
  266. package/dist/plugins/link/locales/nl.d.ts +4 -0
  267. package/dist/plugins/link/locales/nl.d.ts.map +1 -0
  268. package/dist/plugins/link/locales/pt.d.ts.map +1 -1
  269. package/dist/plugins/link/locales/ru.d.ts.map +1 -1
  270. package/dist/plugins/link/locales/zh.d.ts.map +1 -1
  271. package/dist/plugins/link.mjs +1 -1
  272. package/dist/plugins/list/locales/nl.d.ts +4 -0
  273. package/dist/plugins/list/locales/nl.d.ts.map +1 -0
  274. package/dist/plugins/list.mjs +1 -1
  275. package/dist/plugins/print/locales/nl.d.ts +4 -0
  276. package/dist/plugins/print/locales/nl.d.ts.map +1 -0
  277. package/dist/plugins/print.mjs +1 -1
  278. package/dist/plugins/shared/PopupManager.d.ts +15 -2
  279. package/dist/plugins/shared/PopupManager.d.ts.map +1 -1
  280. package/dist/plugins/shared/PopupPositioning.d.ts +2 -6
  281. package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -1
  282. package/dist/plugins/shared/index.d.ts +1 -1
  283. package/dist/plugins/shared/index.d.ts.map +1 -1
  284. package/dist/plugins/shared.mjs +1 -1
  285. package/dist/plugins/smart-paste/locales/nl.d.ts +4 -0
  286. package/dist/plugins/smart-paste/locales/nl.d.ts.map +1 -0
  287. package/dist/plugins/smart-paste.mjs +1 -1
  288. package/dist/plugins/strikethrough/locales/nl.d.ts +4 -0
  289. package/dist/plugins/strikethrough/locales/nl.d.ts.map +1 -0
  290. package/dist/plugins/strikethrough.mjs +1 -1
  291. package/dist/plugins/super-sub/locales/nl.d.ts +4 -0
  292. package/dist/plugins/super-sub/locales/nl.d.ts.map +1 -0
  293. package/dist/plugins/super-sub.mjs +1 -1
  294. package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
  295. package/dist/plugins/table/TableSelection.d.ts +4 -20
  296. package/dist/plugins/table/TableSelection.d.ts.map +1 -1
  297. package/dist/plugins/table/TableSelectionTypes.d.ts +21 -0
  298. package/dist/plugins/table/TableSelectionTypes.d.ts.map +1 -0
  299. package/dist/plugins/table/locales/nl.d.ts +4 -0
  300. package/dist/plugins/table/locales/nl.d.ts.map +1 -0
  301. package/dist/plugins/table.mjs +1 -1
  302. package/dist/plugins/text-color/locales/nl.d.ts +4 -0
  303. package/dist/plugins/text-color/locales/nl.d.ts.map +1 -0
  304. package/dist/plugins/text-color.mjs +1 -1
  305. package/dist/plugins/text-direction/locales/nl.d.ts +4 -0
  306. package/dist/plugins/text-direction/locales/nl.d.ts.map +1 -0
  307. package/dist/plugins/text-direction-auto.mjs +1 -1
  308. package/dist/plugins/text-direction.mjs +1 -1
  309. package/dist/plugins/text-formatting/locales/nl.d.ts +4 -0
  310. package/dist/plugins/text-formatting/locales/nl.d.ts.map +1 -0
  311. package/dist/plugins/text-formatting.mjs +1 -1
  312. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +2 -2
  313. package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
  314. package/dist/plugins/toolbar/ToolbarPlugin.d.ts +2 -1
  315. package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
  316. package/dist/plugins/toolbar/ToolbarPopupController.d.ts +8 -3
  317. package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
  318. package/dist/plugins/toolbar/ToolbarRegistry.d.ts +4 -0
  319. package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -1
  320. package/dist/plugins/toolbar/locales/nl.d.ts +4 -0
  321. package/dist/plugins/toolbar/locales/nl.d.ts.map +1 -0
  322. package/dist/plugins/toolbar.mjs +1 -1
  323. package/dist/plugins/video/locales/nl.d.ts +4 -0
  324. package/dist/plugins/video/locales/nl.d.ts.map +1 -0
  325. package/dist/plugins/video.mjs +1 -1
  326. package/dist/presets/full.mjs +1 -1
  327. package/dist/presets/minimal.mjs +1 -1
  328. package/dist/presets.mjs +1 -1
  329. package/dist/register.mjs +1 -1
  330. package/dist/serialization/DocumentParser.d.ts +2 -2
  331. package/dist/serialization/DocumentParser.d.ts.map +1 -1
  332. package/dist/serialization/HTMLParseRules.d.ts.map +1 -1
  333. package/dist/serialization/HTMLSanitization.d.ts +6 -0
  334. package/dist/serialization/HTMLSanitization.d.ts.map +1 -1
  335. package/dist/serialization/PreformattedText.d.ts +3 -0
  336. package/dist/serialization/PreformattedText.d.ts.map +1 -0
  337. package/dist/state/RangeMapping.d.ts +10 -0
  338. package/dist/state/RangeMapping.d.ts.map +1 -0
  339. package/dist/ui.d.ts +3 -0
  340. package/dist/ui.d.ts.map +1 -0
  341. package/dist/ui.mjs +1 -0
  342. package/dist/view/EditorInteraction.d.ts +23 -0
  343. package/dist/view/EditorInteraction.d.ts.map +1 -0
  344. package/dist/view/EditorView.d.ts +2 -0
  345. package/dist/view/EditorView.d.ts.map +1 -1
  346. package/dist/view/SelectionGeometry.d.ts +29 -0
  347. package/dist/view/SelectionGeometry.d.ts.map +1 -0
  348. package/dist/view/SelectionObserver.d.ts +19 -0
  349. package/dist/view/SelectionObserver.d.ts.map +1 -0
  350. package/dist/view/SelectionSync.d.ts +7 -0
  351. package/dist/view/SelectionSync.d.ts.map +1 -1
  352. package/package.json +6 -2
  353. package/dist/chunks/AlignmentPlugin-Cp7HYGaH.mjs +0 -2
  354. package/dist/chunks/BidiIsolationPlugin-GWukKdgJ.mjs +0 -2
  355. package/dist/chunks/BlockquotePlugin-CSL_7Yit.mjs +0 -2
  356. package/dist/chunks/CaretNavigationPlugin-BQPqqK4n.mjs +0 -2
  357. package/dist/chunks/CodeBlockPlugin-B4AcDJRK.mjs +0 -2
  358. package/dist/chunks/Commands-Bk7Cl1nH.mjs +0 -2
  359. package/dist/chunks/DocumentParser-C99N0MWF.mjs +0 -2
  360. package/dist/chunks/DocumentParser-C99N0MWF.mjs.map +0 -1
  361. package/dist/chunks/FontPlugin-BcXNFqqO.mjs +0 -2
  362. package/dist/chunks/FontSizePlugin-Dswra3oU.mjs +0 -2
  363. package/dist/chunks/FormulaPlugin-DVpLaKi5.mjs +0 -2
  364. package/dist/chunks/GapCursorPlugin-QDGwnaRR.mjs +0 -2
  365. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs +0 -2
  366. package/dist/chunks/HTMLSanitization-Ce9dVT1q.mjs.map +0 -1
  367. package/dist/chunks/HeadingPlugin-B7EfynaH.mjs +0 -2
  368. package/dist/chunks/HighlightPlugin-LdO0INtJ.mjs +0 -2
  369. package/dist/chunks/HorizontalRulePlugin-YywXVZYr.mjs +0 -2
  370. package/dist/chunks/ImagePlugin-BAhZuVdE.mjs +0 -2
  371. package/dist/chunks/InlineCodePlugin-Bu9-rE4B.mjs +0 -2
  372. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs +0 -2
  373. package/dist/chunks/LinkPlugin-CAUaWW5-.mjs.map +0 -1
  374. package/dist/chunks/ListPlugin-U1r4p_fE.mjs +0 -2
  375. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs +0 -2
  376. package/dist/chunks/PluginHelpers-B3gk3VB3.mjs.map +0 -1
  377. package/dist/chunks/PopupManager-Dxv0OVMo.mjs +0 -2
  378. package/dist/chunks/PopupManager-Dxv0OVMo.mjs.map +0 -1
  379. package/dist/chunks/PrintPlugin-DAEiEyKQ.mjs +0 -2
  380. package/dist/chunks/SimpleMark-D6vz3Nfd.mjs +0 -2
  381. package/dist/chunks/SmartPastePlugin-BHsYKbgd.mjs +0 -2
  382. package/dist/chunks/StrikethroughPlugin-v-VJZzUZ.mjs +0 -2
  383. package/dist/chunks/SuperSubPlugin-x1iPnZyt.mjs +0 -2
  384. package/dist/chunks/TablePlugin-CjKThPug.mjs +0 -2
  385. package/dist/chunks/TablePlugin-CjKThPug.mjs.map +0 -1
  386. package/dist/chunks/TextColorPlugin-Bnl9of9E.mjs +0 -2
  387. package/dist/chunks/TextDirectionPlugin-JwlR-R-b.mjs +0 -2
  388. package/dist/chunks/TextDirectionService-BcX07mw2.mjs +0 -2
  389. package/dist/chunks/TextFormattingPlugin-Kc_UNoOz.mjs +0 -2
  390. package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs +0 -2
  391. package/dist/chunks/ToolbarPlugin-CgZA2hz8.mjs.map +0 -1
  392. package/dist/chunks/VideoPlugin-DJXfuNA9.mjs +0 -2
  393. package/dist/chunks/ar-DhwCFHql.mjs +0 -2
  394. package/dist/chunks/ar-DhwCFHql.mjs.map +0 -1
  395. package/dist/chunks/de-CjLUbQmg.mjs +0 -2
  396. package/dist/chunks/de-CjLUbQmg.mjs.map +0 -1
  397. package/dist/chunks/es-CMSzvjOT.mjs +0 -2
  398. package/dist/chunks/es-CMSzvjOT.mjs.map +0 -1
  399. package/dist/chunks/fr-DB_OvHWH.mjs +0 -2
  400. package/dist/chunks/fr-DB_OvHWH.mjs.map +0 -1
  401. package/dist/chunks/full-BsWAZr1w.mjs +0 -2
  402. package/dist/chunks/hi-ChNQZZ1z.mjs +0 -2
  403. package/dist/chunks/hi-ChNQZZ1z.mjs.map +0 -1
  404. package/dist/chunks/minimal-DO7LiFTa.mjs +0 -2
  405. package/dist/chunks/pt-CI8t6oul.mjs +0 -2
  406. package/dist/chunks/pt-CI8t6oul.mjs.map +0 -1
  407. package/dist/chunks/register-DXLu8Njp.mjs +0 -3
  408. package/dist/chunks/register-DXLu8Njp.mjs.map +0 -1
  409. package/dist/chunks/ru-9WtNGZtl.mjs +0 -2
  410. package/dist/chunks/ru-9WtNGZtl.mjs.map +0 -1
  411. package/dist/chunks/src-5GKFQ2mQ.mjs +0 -2
  412. package/dist/chunks/src-5GKFQ2mQ.mjs.map +0 -1
  413. package/dist/chunks/zh-BrqJ4ywP.mjs +0 -2
  414. package/dist/chunks/zh-BrqJ4ywP.mjs.map +0 -1
  415. package/dist/plugins/link/LinkPreview.d.ts.map +0 -1
@@ -1,2 +0,0 @@
1
- import{i as t,l as e,o as n}from"./HTMLUtils-DTpsjZyK.mjs";import{I as i}from"./Document-ssR6hBzG.mjs";import{c as o,f as r,n as s}from"./Selection-DC6AOGgF.mjs";import{i as a}from"./TypeBrands-Ch9856Gb.mjs";import{i as l,n as c,r as p,t as u}from"./AttributedMarkCommands-DKHuhZA7.mjs";import{c as h,n as d,o as m}from"./PluginHelpers-B3gk3VB3.mjs";import{t as f}from"./EditorEventBoundary-zpYRxryo.mjs";import{t as g}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as v}from"./PopupManager-Dxv0OVMo.mjs";var k={label:"Link",tooltip:t=>`Insert Link (${t})`,removeLink:"Remove Link",removeLinkAria:"Remove link",urlPlaceholder:"https://...",urlAria:"Link URL",apply:"Apply",applyAria:"Apply link",invalidUrl:"Only http(s), mailto, tel, fragments, and relative paths are allowed.",openLink:"Open link",openLinkInNewTab:"Open link in new tab",closePreview:"Close link preview",previewOpened:"Link preview opened. Press Tab to open the link or Escape to dismiss."},b=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-DhwCFHql.mjs"),"./locales/de.ts":()=>import("./de-CjLUbQmg.mjs"),"./locales/es.ts":()=>import("./es-CMSzvjOT.mjs"),"./locales/fr.ts":()=>import("./fr-DB_OvHWH.mjs"),"./locales/hi.ts":()=>import("./hi-ChNQZZ1z.mjs"),"./locales/pt.ts":()=>import("./pt-CI8t6oul.mjs"),"./locales/ru.ts":()=>import("./ru-9WtNGZtl.mjs"),"./locales/zh.ts":()=>import("./zh-BrqJ4ywP.mjs")});async function w(t){return h(b,t,k)}function y(t,e){return e&&!t.startsWith("#")}function L(t,e){for(const i of n(e)){const e=t.id===i?t:Array.from(t.getElementsByTagName("*")).find(t=>t.id===i);if(e)return e.scrollIntoView(),!0}return!1}function x(t,n,i){const o=e(n);if(!o)return null;const r=t.createElement("a");return r.setAttribute("href",o),y(o,i)&&(r.target="_blank",r.rel="noopener noreferrer"),r}function C(t,e,n){const i=x(t.ownerDocument,e,n);if(!i)return!1;const o=i.getAttribute("href")??"";if(o.startsWith("#"))return L(t,o);i.hidden=!0,t.ownerDocument.body.appendChild(i);try{i.click()}finally{i.remove()}return!0}var A=class{container;locale;popups;handle=null;anchor=null;constructor(t,e){this.container=t,this.locale=e,this.popups=new v(t)}show(t){this.close();const e=t.getAttribute("href")??"",n=x(this.container.ownerDocument,e,!0);if(!n)return!1;const i=("_blank"===n.target?this.locale.openLinkInNewTab:this.locale.openLink)??("_blank"===n.target?k.openLinkInNewTab:k.openLink);n.className="notectl-link-preview__open";const o=document.createElement("span");o.textContent=i;const r=document.createElement("span");return r.className="notectl-link-preview__url",r.dir="ltr",r.textContent=n.getAttribute("href"),n.append(o,r),n.addEventListener("click",t=>{t.defaultPrevented||L(this.container,e)&&t.preventDefault()}),this.anchor=t,this.handle=this.popups.open({anchor:t,className:"notectl-link-preview",ariaRole:"dialog",ariaLabel:this.locale.label,autoFocus:!1,onClose:()=>{this.handle=null,this.anchor=null},content:t=>{const e=document.createElement("button");e.type="button",e.className="notectl-link-preview__close",e.textContent="×",e.setAttribute("aria-label",this.locale.closePreview??k.closePreview),e.addEventListener("click",()=>this.close(!0)),t.append(n,e),t.addEventListener("keydown",t=>{"Escape"===t.key&&(t.preventDefault(),t.stopPropagation(),this.close(!0))}),t.addEventListener("focusout",e=>{e.relatedTarget instanceof Node&&!t.contains(e.relatedTarget)&&this.close()})}}),!0}reposition(){this.handle&&this.anchor&&(this.anchor.isConnected&&this.isWithinContent(this.anchor)?this.popups.reposition(this.handle):this.close())}isOpen(){return null!==this.handle}focus(){const t=this.handle?.getElement().querySelector("a");return!!t&&(t.focus(),!0)}close(t=!1){const e=this.handle;return this.handle=null,this.anchor=null,e?.close({restoreFocusTo:t?this.container:null}),null!==e}destroy(){this.close(),this.popups.destroy()}isWithinContent(t){const e=t.getBoundingClientRect(),n=this.container.getBoundingClientRect();return e.bottom>=n.top&&e.top<=n.bottom}},E=/* @__PURE__ */new Set(["Control","Meta","Shift","Alt"]),_=class{context;locale;container;preview;layoutSources;handleLayoutChange=()=>{this.preview.reposition()};handleClick=t=>this.onClick(t);handleKeydown=t=>this.onKeydown(t);announcementPending=!1;constructor(t,e){this.context=t,this.locale=e,this.container=t.getContainer(),this.preview=new A(this.container,e),this.layoutSources=function(t){const e=t.ownerDocument.defaultView,n=[{target:t,type:"scroll",capture:!0},{target:t.ownerDocument,type:"scroll",capture:!0}];return e&&n.push({target:e,type:"resize",capture:!1}),e?.visualViewport&&n.push({target:e.visualViewport,type:"resize",capture:!1},{target:e.visualViewport,type:"scroll",capture:!1}),n}(this.container),this.container.addEventListener("click",this.handleClick),this.container.addEventListener("keydown",this.handleKeydown,!0);for(const n of this.layoutSources)n.target.addEventListener(n.type,this.handleLayoutChange,n.capture)}closePreview(){this.preview.close()}restorePreviewAnnouncement(){this.announcementPending&&this.preview.isOpen()&&(this.announcementPending=!1,this.context.hasAnnouncement()||this.announce())}destroy(){this.container.removeEventListener("click",this.handleClick),this.container.removeEventListener("keydown",this.handleKeydown,!0);for(const t of this.layoutSources)t.target.removeEventListener(t.type,this.handleLayoutChange,t.capture);this.preview.destroy()}onKeydown(t){if(f(t,this.container))return"Escape"===t.key&&this.preview.close()||"Tab"===t.key&&!t.shiftKey&&this.preview.focus()?(t.preventDefault(),void t.stopPropagation()):void(E.has(t.key)||this.preview.close())}onClick(t){if(!f(t,this.container))return;if(this.preview.close(),t.defaultPrevented||0!==t.button||t.altKey||t.shiftKey)return;const n=function(t,e){let n=e instanceof Element?e:e instanceof Node?e.parentElement:null;for(;n&&t.contains(n);){if(n instanceof HTMLAnchorElement)return n;if(n===t)break;n=n.parentElement}return null}(this.container,t.target);if(!n)return;const i=e(n.getAttribute("href")??"");if(!i)return void t.preventDefault();const r=t.ctrlKey||t.metaKey;if(r||!L(this.container,i)){if(!this.context.isReadOnly())return r?(t.preventDefault(),void C(this.container,i,!0)):void(i.startsWith("#")||(t.preventDefault(),t.detail>1||!o(this.context.getState().selection)||!1!==this.container.ownerDocument.getSelection()?.isCollapsed&&this.preview.show(n)&&(this.announcementPending=!0,this.announce())))}else t.preventDefault()}announce(){this.context.announce(this.locale.previewOpened??k.previewOpened)}},S={openInNewTab:!0},P=/(?:^|[^!])(\[([^\]\uFFFC]+)\]\(([^)\s\uFFFC]+)(?:\s+"([^"\uFFFC]*)")?\))$/,I=/(<([a-zA-Z][a-zA-Z0-9+.-]{1,31}:[^<>\s\uFFFC]+)>)$/,T=class{id="link";name="Link";priority=25;config;locale=k;interaction=null;constructor(t){this.config={...S,...t}}async init(t){this.locale=await m(t,this.config.locale,k,w),t.registerStyleSheet('\n.notectl-content[contenteditable="false"] a[href]:not([href=""]) {\n\tcursor: pointer;\n}\n.notectl-link-preview {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 4px;\n\tbox-sizing: border-box;\n\twidth: max-content;\n\tmax-width: min(360px, calc(100vw - 16px));\n\tmargin: 0;\n\tpadding: 6px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 4px 16px rgb(0 0 0 / 15%);\n\tfont: inherit;\n\tfont-size: 14px;\n\tline-height: 1.4;\n}\n.notectl-link-preview__open {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tmin-width: 0;\n\tmin-height: 44px;\n\tbox-sizing: border-box;\n\tpadding: 6px 8px;\n\tborder-radius: 4px;\n\tcolor: var(--notectl-fg);\n\ttext-decoration: none;\n\toverflow-wrap: anywhere;\n}\n.notectl-link-preview__open > :first-child {\n\ttext-decoration: underline;\n\ttext-underline-offset: 2px;\n}\n.notectl-link-preview__url {\n\tcolor: var(--notectl-fg-muted);\n\tfont-size: 12px;\n\tunicode-bidi: isolate;\n}\n.notectl-link-preview__close {\n\tflex: 0 0 44px;\n\twidth: 44px;\n\theight: 44px;\n\tpadding: 0;\n\tborder: 0;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: inherit;\n\tfont-size: 22px;\n\tcursor: pointer;\n}\n.notectl-link-preview :focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -2px;\n}\n@media (hover: hover) {\n\t.notectl-link-preview__open:hover,\n\t.notectl-link-preview__close:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n'),this.registerMarkSpec(t),this.registerCommands(t),this.registerKeymap(t),this.registerToolbarItem(t),!1!==this.config.inputRule&&this.registerInputRules(t),this.interaction?.destroy(),this.interaction=new _(t,this.locale)}destroy(){this.interaction?.destroy(),this.interaction=null}onStateChange(t,e){t.doc===e.doc?this.interaction?.restorePreviewAnnouncement():this.interaction?.closePreview()}onReadOnlyChange(){this.interaction?.closePreview()}registerInputRules(t){const n=(t,e,n,i,o,r,l)=>{const c={href:r};return l&&(c.title=l),t.transaction("input").deleteTextAt(e,n,i).insertText(e,n,o,[{type:a("link"),attrs:c}]).setSelection(s(e,n+o.length)).build()};t.registerInputRule({pattern:P,handler(t,i,s,a){const l=t.selection;if(!r(l)||!o(l))return null;const c=t.getBlock(l.anchor.blockId);if(!c||"code_block"===c.type)return null;const p=i[1],u=i[2],h=i[3],d=i[4];if(!p||!u||!h)return null;const m=e(h);return""===m?null:n(t,l.anchor.blockId,a-p.length,a,u,m,d)}}),t.registerInputRule({pattern:I,handler(t,i,s,a){const l=t.selection;if(!r(l)||!o(l))return null;const c=t.getBlock(l.anchor.blockId);if(!c||"code_block"===c.type)return null;const p=i[1],u=i[2];if(!p||!u)return null;const h=e(u);return""===h?null:n(t,l.anchor.blockId,a-p.length,a,u,h)}})}registerMarkSpec(n){const i=this.config.openInNewTab;n.registerMarkSpec({type:"link",rank:10,inclusive:!1,attrs:{href:{default:""},title:{default:""}},toDOM(t){const n=document.createElement("a"),o=e(String(t.attrs?.href??""));n.setAttribute("href",o);const r=String(t.attrs?.title??"");return r&&n.setAttribute("title",r),y(o,i)&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer")),n},toHTMLString:(n,o)=>{const r=e(String(n.attrs?.href??"")),s=t(r),a=String(n.attrs?.title??""),l=a?` title="${t(a)}"`:"";return y(r,i)?`<a href="${s}"${l} target="_blank" rel="noopener noreferrer">${o}</a>`:`<a href="${s}"${l}>${o}</a>`},parseHTML:[{tag:"a",getAttrs:t=>{const n=e(t.getAttribute("href")??""),i=t.getAttribute("title")??"";return i?{href:n,title:i}:{href:n}}}],sanitize:{tags:["a"],attrs:["href","title","target","rel"]}})}registerCommands(t){t.registerCommand("openLink",()=>{const e=c(t.getState(),"link",t=>t.attrs.href);if(null===e)return!1;const n=!t.isReadOnly()||this.config.openInNewTab;return C(t.getContainer(),e,n)},{readonlyAllowed:!0}),t.registerCommand("toggleLink",()=>{const e=t.getState();return this.toggleLink(t,e)}),t.registerCommand("setLink",()=>!1),t.registerCommand("removeLink",()=>{const e=t.getState();return this.removeLink(t,e)})}registerKeymap(t){t.registerKeymap({"Mod-K":()=>t.executeCommand("toggleLink")}),t.registerKeymap({"Alt-Enter":()=>t.executeCommand("openLink")},{priority:"navigation"})}registerToolbarItem(t){t.registerToolbarItem({id:"link",group:"insert",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(g("Mod-K")),command:"toggleLink",popupType:"custom",renderPopup:(t,e,n)=>{this.renderLinkPopup(t,e,n)},isActive:t=>this.isLinkActive(t),isEnabled:t=>!o(t.selection)||this.isLinkActive(t)})}isLinkActive(t){return p(t,"link")}toggleLink(t,e){return!!this.isLinkActive(e)&&this.removeLink(t,e)}addLink(t,e,n){const i=e.selection;if(!r(i))return!1;if(o(i))return!1;const s={type:a("link"),attrs:{href:n}};return d(t,u(e,s))}removeLink(t,e){const n=e.selection;if(!r(n))return!1;if(o(n)){const o=e.getBlock(n.anchor.blockId);if(!o)return!1;const r=[];let s=0;for(const t of o.children){if(!("text"in t))continue;const e=s+t.text.length;r.push({pos:s,end:e,hasLink:i(t.marks,a("link"))}),s=e}const l=r.findIndex(t=>n.anchor.offset>=t.pos&&n.anchor.offset<=t.end),c=l>=0?r[l]:void 0;if(-1===l||!c?.hasLink)return!1;let p=l;for(;p>0&&r[p-1]?.hasLink;)p--;let u=l;for(;u<r.length-1&&r[u+1]?.hasLink;)u++;const h=r[p],d=r[u];if(!h||!d)return!1;const m=h.pos,f=d.end,g=e.transaction("command");return g.removeMark(n.anchor.blockId,m,f,{type:a("link")}),g.setSelection(n),t.dispatch(g.build()),!0}return d(t,l(e,a("link")))}renderLinkPopup(t,n,i){t.classList.add("notectl-link-popup");const o=n.getState();if(this.isLinkActive(o)){const e=document.createElement("button");e.type="button",e.className="notectl-link-popup__button",e.textContent=this.locale.openLink??k.openLink,e.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),e.addEventListener("click",()=>{n.executeCommand("openLink"),i()}),t.appendChild(e);const o=document.createElement("button");o.type="button",o.className="notectl-link-popup__button",o.textContent=this.locale.removeLink,o.setAttribute("aria-label",this.locale.removeLinkAria),o.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),o.addEventListener("click",()=>{n.executeCommand("removeLink"),i(),n.getContainer().focus()}),t.appendChild(o)}else{const o=document.createElement("input");o.type="url",o.className="notectl-link-popup__input",o.placeholder=this.locale.urlPlaceholder,o.setAttribute("aria-label",this.locale.urlAria);const r=document.createElement("button");r.type="button",r.className="notectl-link-popup__button notectl-link-popup__button--apply",r.textContent=this.locale.apply,r.setAttribute("aria-label",this.locale.applyAria);const s=document.createElement("div");s.className="notectl-link-popup__error",s.setAttribute("role","alert"),s.hidden=!0;const a=()=>{const t=o.value.trim();if(""===t)return;const r=e(t);if(""===r)return s.textContent=this.locale.invalidUrl,s.hidden=!1,o.setAttribute("aria-invalid","true"),void o.focus();s.hidden=!0,o.removeAttribute("aria-invalid"),this.addLink(n,n.getState(),r),i(),n.getContainer().focus()};r.addEventListener("mousedown",t=>{t.preventDefault(),t.stopPropagation()}),r.addEventListener("click",()=>{a()}),o.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),a())}),o.addEventListener("input",()=>{s.hidden||(s.hidden=!0,o.removeAttribute("aria-invalid"))}),t.appendChild(o),t.appendChild(r),t.appendChild(s),requestAnimationFrame(()=>o.focus())}}};export{k as n,w as r,T as t};
2
- //# sourceMappingURL=LinkPlugin-CAUaWW5-.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LinkPlugin-CAUaWW5-.mjs","names":["escapeHTML","sanitizeHref","fragmentIdentifiers","hasMark","isCollapsed","isTextSelection","createCollapsedSelection","markType","removeAttributedMark","getMarkAttrAtSelection","isAttributedMarkActive","applyAttributedMark","loadLocaleModule","dispatchIfPresent","resolveLocale","isEventFromEditorContent","formatShortcut","PopupManager","LINK_LOCALE_EN","label","tooltip","shortcut","removeLink","removeLinkAria","urlPlaceholder","urlAria","apply","applyAria","invalidUrl","openLink","openLinkInNewTab","closePreview","previewOpened","localeModules","Object","assign","async","loadLinkLocale","lang","shouldOpenInNewTab","href","openInNewTab","startsWith","scrollToFragment","container","identifier","target","id","Array","from","getElementsByTagName","find","el","scrollIntoView","createNavigationLink","document","rawHref","link","createElement","setAttribute","rel","ownerDocument","getAttribute","hidden","body","appendChild","click","remove","LinkPreview","locale","popups","handle","anchor","constructor","this","show","close","className","action","textContent","address","dir","append","addEventListener","event","defaultPrevented","preventDefault","open","ariaRole","ariaLabel","autoFocus","onClose","content","popup","closeButton","type","key","stopPropagation","relatedTarget","Node","contains","reposition","isConnected","isWithinContent","isOpen","focus","getElement","querySelector","restoreFocus","restoreFocusTo","destroy","anchorRect","getBoundingClientRect","contentRect","bottom","top","MODIFIER_KEYS","Set","LinkInteractionController","context","preview","layoutSources","handleLayoutChange","handleClick","onClick","handleKeydown","onKeydown","announcementPending","getContainer","view","defaultView","sources","capture","push","visualViewport","collectLayoutSources","source","restorePreviewAnnouncement","hasAnnouncement","announce","removeEventListener","shiftKey","has","button","altKey","element","Element","parentElement","HTMLAnchorElement","findLinkAnchor","modified","ctrlKey","metaKey","isReadOnly","detail","getState","selection","getSelection","DEFAULT_CONFIG","LINK_RULE","AUTOLINK_RULE","LinkPlugin","name","priority","config","interaction","init","registerStyleSheet","registerMarkSpec","registerCommands","registerKeymap","registerToolbarItem","inputRule","registerInputRules","onStateChange","oldState","newState","doc","onReadOnlyChange","buildLink","state","blockId","start","end","text","title","attrs","transaction","deleteTextAt","insertText","setSelection","length","build","registerInputRule","pattern","handler","match","_start","sel","block","getBlock","expr","url","rank","inclusive","default","toDOM","mark","a","String","toHTMLString","safeHref","titleValue","titleAttr","parseHTML","tag","getAttrs","sanitize","tags","registerCommand","newTab","readonlyAllowed","toggleLink","executeCommand","group","icon","command","popupType","renderPopup","ctx","renderLinkPopup","isActive","isLinkActive","isEnabled","addLink","textChildren","pos","child","children","hasLink","marks","cursorIdx","findIndex","c","offset","cursorEntry","startIdx","endIdx","startEntry","endEntry","linkStart","linkEnd","builder","removeMark","dispatch","classList","add","openBtn","removeBtn","e","input","placeholder","applyBtn","errorMsg","applyLink","raw","value","trim","sanitized","removeAttribute","requestAnimationFrame"],"sources":["../../src/editor/styles/link.ts","../../src/plugins/link/LinkLocale.ts","../../src/plugins/link/LinkNavigation.ts","../../src/plugins/link/LinkPreview.ts","../../src/plugins/link/LinkInteractionController.ts","../../src/plugins/link/LinkPlugin.ts"],"sourcesContent":["/** Link preview styles; registered by LinkPlugin, including without a toolbar. */\nexport const LINK_CSS = `\n.notectl-content[contenteditable=\"false\"] a[href]:not([href=\"\"]) {\n\tcursor: pointer;\n}\n.notectl-link-preview {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 4px;\n\tbox-sizing: border-box;\n\twidth: max-content;\n\tmax-width: min(360px, calc(100vw - 16px));\n\tmargin: 0;\n\tpadding: 6px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 8px;\n\tbackground: var(--notectl-surface-overlay);\n\tcolor: var(--notectl-fg);\n\tbox-shadow: 0 4px 16px rgb(0 0 0 / 15%);\n\tfont: inherit;\n\tfont-size: 14px;\n\tline-height: 1.4;\n}\n.notectl-link-preview__open {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tmin-width: 0;\n\tmin-height: 44px;\n\tbox-sizing: border-box;\n\tpadding: 6px 8px;\n\tborder-radius: 4px;\n\tcolor: var(--notectl-fg);\n\ttext-decoration: none;\n\toverflow-wrap: anywhere;\n}\n.notectl-link-preview__open > :first-child {\n\ttext-decoration: underline;\n\ttext-underline-offset: 2px;\n}\n.notectl-link-preview__url {\n\tcolor: var(--notectl-fg-muted);\n\tfont-size: 12px;\n\tunicode-bidi: isolate;\n}\n.notectl-link-preview__close {\n\tflex: 0 0 44px;\n\twidth: 44px;\n\theight: 44px;\n\tpadding: 0;\n\tborder: 0;\n\tborder-radius: 4px;\n\tbackground: transparent;\n\tcolor: inherit;\n\tfont-size: 22px;\n\tcursor: pointer;\n}\n.notectl-link-preview :focus-visible {\n\toutline: 2px solid var(--notectl-focus-ring);\n\toutline-offset: -2px;\n}\n@media (hover: hover) {\n\t.notectl-link-preview__open:hover,\n\t.notectl-link-preview__close:hover {\n\t\tbackground: var(--notectl-hover-bg);\n\t}\n}\n`;\n","/**\n * Locale interface and default English locale for the LinkPlugin.\n */\n\nimport { type LocaleModuleMap, loadLocaleModule } from '../shared/LocaleLoader.js';\n\n// --- Locale Interface ---\n\nexport interface LinkLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly removeLink: string;\n\treadonly removeLinkAria: string;\n\treadonly urlPlaceholder: string;\n\treadonly urlAria: string;\n\treadonly apply: string;\n\treadonly applyAria: string;\n\treadonly invalidUrl: string;\n\t/** Optional for compatibility with existing custom locales; defaults to English. */\n\treadonly openLink?: string;\n\treadonly openLinkInNewTab?: string;\n\treadonly closePreview?: string;\n\t/** Screen reader announcement when a click or tap opens the non-modal preview. */\n\treadonly previewOpened?: string;\n}\n\n// --- Default English Locale ---\n\nexport const LINK_LOCALE_EN: Required<LinkLocale> = {\n\tlabel: 'Link',\n\ttooltip: (shortcut: string) => `Insert Link (${shortcut})`,\n\tremoveLink: 'Remove Link',\n\tremoveLinkAria: 'Remove link',\n\turlPlaceholder: 'https://...',\n\turlAria: 'Link URL',\n\tapply: 'Apply',\n\tapplyAria: 'Apply link',\n\tinvalidUrl: 'Only http(s), mailto, tel, fragments, and relative paths are allowed.',\n\topenLink: 'Open link',\n\topenLinkInNewTab: 'Open link in new tab',\n\tclosePreview: 'Close link preview',\n\tpreviewOpened: 'Link preview opened. Press Tab to open the link or Escape to dismiss.',\n};\n\n// --- Lazy Locale Loader ---\n\nconst localeModules: LocaleModuleMap<LinkLocale> = import.meta.glob<{\n\tdefault: LinkLocale;\n}>('./locales/*.ts', { eager: false });\n\nexport async function loadLinkLocale(lang: string): Promise<LinkLocale> {\n\treturn loadLocaleModule(localeModules, lang, LINK_LOCALE_EN);\n}\n","/** Safe link activation shared by editor gestures and link actions. */\n\nimport { fragmentIdentifiers, sanitizeHref } from '../../model/HTMLUtils.js';\n\n/** Fragment-only links always target this editor, including with a new-tab default. */\nexport function shouldOpenInNewTab(href: string, openInNewTab: boolean): boolean {\n\treturn openInNewTab && !href.startsWith('#');\n}\n\n/** Finds links through nested formatting without crossing the editor boundary. */\nexport function findLinkAnchor(\n\tcontainer: HTMLElement,\n\ttarget: EventTarget | null,\n): HTMLAnchorElement | null {\n\tlet element: Element | null =\n\t\ttarget instanceof Element ? target : target instanceof Node ? target.parentElement : null;\n\twhile (element && container.contains(element)) {\n\t\tif (element instanceof HTMLAnchorElement) return element;\n\t\tif (element === container) break;\n\t\telement = element.parentElement;\n\t}\n\treturn null;\n}\n\n/** Resolves semantic IDs inside this editor without interpolating URLs into selectors. */\nexport function scrollToFragment(container: HTMLElement, href: string): boolean {\n\tfor (const identifier of fragmentIdentifiers(href)) {\n\t\tconst target: Element | undefined =\n\t\t\tcontainer.id === identifier\n\t\t\t\t? container\n\t\t\t\t: Array.from(container.getElementsByTagName('*')).find((el) => el.id === identifier);\n\t\tif (target) {\n\t\t\ttarget.scrollIntoView();\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/** Creates a native navigation link; rejected and empty URLs never become active links. */\nexport function createNavigationLink(\n\tdocument: Document,\n\trawHref: string,\n\topenInNewTab: boolean,\n): HTMLAnchorElement | null {\n\tconst href: string = sanitizeHref(rawHref);\n\tif (!href) return null;\n\tconst link: HTMLAnchorElement = document.createElement('a');\n\tlink.setAttribute('href', href);\n\tif (shouldOpenInNewTab(href, openInNewTab)) {\n\t\tlink.target = '_blank';\n\t\tlink.rel = 'noopener noreferrer';\n\t}\n\treturn link;\n}\n\n/** Activates synchronously within the user gesture so popup blockers allow the navigation. */\nexport function openLink(container: HTMLElement, rawHref: string, openInNewTab: boolean): boolean {\n\tconst link: HTMLAnchorElement | null = createNavigationLink(\n\t\tcontainer.ownerDocument,\n\t\trawHref,\n\t\topenInNewTab,\n\t);\n\tif (!link) return false;\n\tconst href: string = link.getAttribute('href') ?? '';\n\tif (href.startsWith('#')) return scrollToFragment(container, href);\n\n\t// Outside contenteditable: native activation retains URL/base/protocol handling.\n\tlink.hidden = true;\n\tcontainer.ownerDocument.body.appendChild(link);\n\ttry {\n\t\tlink.click();\n\t} finally {\n\t\tlink.remove();\n\t}\n\treturn true;\n}\n","/** Non-modal link preview. Keeps the editing selection until an action is chosen. */\n\nimport { type PopupHandle, PopupManager } from '../shared/PopupManager.js';\nimport { LINK_LOCALE_EN, type LinkLocale } from './LinkLocale.js';\nimport { createNavigationLink, scrollToFragment } from './LinkNavigation.js';\n\nexport class LinkPreview {\n\tprivate readonly popups: PopupManager;\n\tprivate handle: PopupHandle | null = null;\n\tprivate anchor: HTMLAnchorElement | null = null;\n\n\tconstructor(\n\t\tprivate readonly container: HTMLElement,\n\t\tprivate readonly locale: LinkLocale,\n\t) {\n\t\tthis.popups = new PopupManager(container);\n\t}\n\n\t/**\n\t * Shows the preview for a link in the content. Returns `false` when the URL\n\t * is rejected. The author is mid-edit, so the open action always targets a\n\t * new tab regardless of how rendered links are configured.\n\t */\n\tshow(anchor: HTMLAnchorElement): boolean {\n\t\tthis.close();\n\t\tconst href: string = anchor.getAttribute('href') ?? '';\n\t\tconst link: HTMLAnchorElement | null = createNavigationLink(\n\t\t\tthis.container.ownerDocument,\n\t\t\thref,\n\t\t\ttrue,\n\t\t);\n\t\tif (!link) return false;\n\n\t\tconst label: string =\n\t\t\t(link.target === '_blank' ? this.locale.openLinkInNewTab : this.locale.openLink) ??\n\t\t\t(link.target === '_blank' ? LINK_LOCALE_EN.openLinkInNewTab : LINK_LOCALE_EN.openLink);\n\t\tlink.className = 'notectl-link-preview__open';\n\t\tconst action: HTMLSpanElement = document.createElement('span');\n\t\taction.textContent = label;\n\t\tconst address: HTMLSpanElement = document.createElement('span');\n\t\taddress.className = 'notectl-link-preview__url';\n\t\taddress.dir = 'ltr';\n\t\taddress.textContent = link.getAttribute('href');\n\t\tlink.append(action, address);\n\t\tlink.addEventListener('click', (event: MouseEvent): void => {\n\t\t\tif (event.defaultPrevented) return;\n\t\t\tif (scrollToFragment(this.container, href)) event.preventDefault();\n\t\t});\n\n\t\tthis.anchor = anchor;\n\t\tthis.handle = this.popups.open({\n\t\t\tanchor,\n\t\t\tclassName: 'notectl-link-preview',\n\t\t\tariaRole: 'dialog',\n\t\t\tariaLabel: this.locale.label,\n\t\t\tautoFocus: false,\n\t\t\tonClose: () => {\n\t\t\t\tthis.handle = null;\n\t\t\t\tthis.anchor = null;\n\t\t\t},\n\t\t\tcontent: (popup: HTMLElement): void => {\n\t\t\t\tconst closeButton: HTMLButtonElement = document.createElement('button');\n\t\t\t\tcloseButton.type = 'button';\n\t\t\t\tcloseButton.className = 'notectl-link-preview__close';\n\t\t\t\tcloseButton.textContent = '×';\n\t\t\t\tcloseButton.setAttribute(\n\t\t\t\t\t'aria-label',\n\t\t\t\t\tthis.locale.closePreview ?? LINK_LOCALE_EN.closePreview,\n\t\t\t\t);\n\t\t\t\tcloseButton.addEventListener('click', () => this.close(true));\n\t\t\t\tpopup.append(link, closeButton);\n\t\t\t\tpopup.addEventListener('keydown', (event: KeyboardEvent): void => {\n\t\t\t\t\tif (event.key !== 'Escape') return;\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\tthis.close(true);\n\t\t\t\t});\n\t\t\t\tpopup.addEventListener('focusout', (event: FocusEvent): void => {\n\t\t\t\t\tif (event.relatedTarget instanceof Node && !popup.contains(event.relatedTarget)) {\n\t\t\t\t\t\tthis.close();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t\treturn true;\n\t}\n\n\t/**\n\t * Follows the link through scrolling and resizing, such as the scroll a\n\t * virtual keyboard causes right after a tap. Closes once the link has left\n\t * the editor's visible area or the document.\n\t */\n\treposition(): void {\n\t\tif (!this.handle || !this.anchor) return;\n\t\tif (!this.anchor.isConnected || !this.isWithinContent(this.anchor)) {\n\t\t\tthis.close();\n\t\t\treturn;\n\t\t}\n\t\tthis.popups.reposition(this.handle);\n\t}\n\n\tisOpen(): boolean {\n\t\treturn this.handle !== null;\n\t}\n\n\t/** Moves from the editor into the preview on Tab without changing the document selection. */\n\tfocus(): boolean {\n\t\tconst link: HTMLAnchorElement | null | undefined = this.handle?.getElement().querySelector('a');\n\t\tif (!link) return false;\n\t\tlink.focus();\n\t\treturn true;\n\t}\n\n\tclose(restoreFocus = false): boolean {\n\t\tconst handle: PopupHandle | null = this.handle;\n\t\tthis.handle = null;\n\t\tthis.anchor = null;\n\t\thandle?.close({ restoreFocusTo: restoreFocus ? this.container : null });\n\t\treturn handle !== null;\n\t}\n\n\tdestroy(): void {\n\t\tthis.close();\n\t\tthis.popups.destroy();\n\t}\n\n\tprivate isWithinContent(anchor: HTMLAnchorElement): boolean {\n\t\tconst anchorRect: DOMRect = anchor.getBoundingClientRect();\n\t\tconst contentRect: DOMRect = this.container.getBoundingClientRect();\n\t\treturn anchorRect.bottom >= contentRect.top && anchorRect.top <= contentRect.bottom;\n\t}\n}\n","/** Owns link gestures and the preview lifecycle, independently of mark editing. */\n\nimport { sanitizeHref } from '../../model/HTMLUtils.js';\nimport { isCollapsed } from '../../model/Selection.js';\nimport { isEventFromEditorContent } from '../../platform/EditorEventBoundary.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { LINK_LOCALE_EN, type LinkLocale } from './LinkLocale.js';\nimport { findLinkAnchor, openLink, scrollToFragment } from './LinkNavigation.js';\nimport { LinkPreview } from './LinkPreview.js';\n\nconst MODIFIER_KEYS: ReadonlySet<string> = new Set(['Control', 'Meta', 'Shift', 'Alt']);\n\ninterface LayoutSource {\n\treadonly target: EventTarget;\n\treadonly type: 'scroll' | 'resize';\n\treadonly capture: boolean;\n}\n\nexport class LinkInteractionController {\n\tprivate readonly container: HTMLElement;\n\tprivate readonly preview: LinkPreview;\n\tprivate readonly layoutSources: readonly LayoutSource[];\n\tprivate readonly handleLayoutChange = (): void => {\n\t\tthis.preview.reposition();\n\t};\n\tprivate readonly handleClick = (event: MouseEvent): void => this.onClick(event);\n\tprivate readonly handleKeydown = (event: KeyboardEvent): void => this.onKeydown(event);\n\tprivate announcementPending = false;\n\n\tconstructor(\n\t\tprivate readonly context: PluginContext,\n\t\tprivate readonly locale: LinkLocale,\n\t) {\n\t\tthis.container = context.getContainer();\n\t\tthis.preview = new LinkPreview(this.container, locale);\n\t\tthis.layoutSources = collectLayoutSources(this.container);\n\t\tthis.container.addEventListener('click', this.handleClick);\n\t\tthis.container.addEventListener('keydown', this.handleKeydown, true);\n\t\tfor (const source of this.layoutSources) {\n\t\t\tsource.target.addEventListener(source.type, this.handleLayoutChange, source.capture);\n\t\t}\n\t}\n\n\tclosePreview(): void {\n\t\tthis.preview.close();\n\t}\n\n\t/**\n\t * The editor empties its live region on every transaction, including the\n\t * selection sync that follows the click which opened the preview. Repeats\n\t * the announcement once when that sync has wiped it.\n\t */\n\trestorePreviewAnnouncement(): void {\n\t\tif (!this.announcementPending || !this.preview.isOpen()) return;\n\t\tthis.announcementPending = false;\n\t\tif (!this.context.hasAnnouncement()) this.announce();\n\t}\n\n\tdestroy(): void {\n\t\tthis.container.removeEventListener('click', this.handleClick);\n\t\tthis.container.removeEventListener('keydown', this.handleKeydown, true);\n\t\tfor (const source of this.layoutSources) {\n\t\t\tsource.target.removeEventListener(source.type, this.handleLayoutChange, source.capture);\n\t\t}\n\t\tthis.preview.destroy();\n\t}\n\n\tprivate onKeydown(event: KeyboardEvent): void {\n\t\tif (!isEventFromEditorContent(event, this.container)) return;\n\t\tif (event.key === 'Escape' && this.preview.close()) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\treturn;\n\t\t}\n\t\tif (event.key === 'Tab' && !event.shiftKey && this.preview.focus()) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\treturn;\n\t\t}\n\t\tif (!MODIFIER_KEYS.has(event.key)) this.preview.close();\n\t}\n\n\tprivate onClick(event: MouseEvent): void {\n\t\tif (!isEventFromEditorContent(event, this.container)) return;\n\t\tthis.preview.close();\n\t\tif (event.defaultPrevented || event.button !== 0 || event.altKey || event.shiftKey) return;\n\t\tconst anchor: HTMLAnchorElement | null = findLinkAnchor(this.container, event.target);\n\t\tif (!anchor) return;\n\t\tconst href: string = sanitizeHref(anchor.getAttribute('href') ?? '');\n\t\tif (!href) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst modified: boolean = event.ctrlKey || event.metaKey;\n\t\tif (!modified && scrollToFragment(this.container, href)) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\t\t// Readonly links retain native navigation, modifiers, context menus and keyboard activation.\n\t\tif (this.context.isReadOnly()) return;\n\t\tif (modified) {\n\t\t\tevent.preventDefault();\n\t\t\topenLink(this.container, href, true);\n\t\t\treturn;\n\t\t}\n\t\tif (href.startsWith('#')) return;\n\n\t\tevent.preventDefault();\n\t\tif (event.detail > 1 || !isCollapsed(this.context.getState().selection)) return;\n\t\tif (this.container.ownerDocument.getSelection()?.isCollapsed === false) return;\n\t\tif (!this.preview.show(anchor)) return;\n\t\t// The preview takes no focus, so screen readers learn about it from the live region.\n\t\tthis.announcementPending = true;\n\t\tthis.announce();\n\t}\n\n\tprivate announce(): void {\n\t\tthis.context.announce(this.locale.previewOpened ?? LINK_LOCALE_EN.previewOpened);\n\t}\n}\n\n/**\n * Everything that can move a link on screen: scrolling inside the editor\n * (scroll does not cross the shadow boundary, so the content element needs\n * its own capture listener), scrolling the page, resizing the window, and the\n * visual viewport changes a virtual keyboard causes.\n */\nfunction collectLayoutSources(container: HTMLElement): readonly LayoutSource[] {\n\tconst view: Window | null = container.ownerDocument.defaultView;\n\tconst sources: LayoutSource[] = [\n\t\t{ target: container, type: 'scroll', capture: true },\n\t\t{ target: container.ownerDocument, type: 'scroll', capture: true },\n\t];\n\tif (view) sources.push({ target: view, type: 'resize', capture: false });\n\tif (view?.visualViewport) {\n\t\tsources.push(\n\t\t\t{ target: view.visualViewport, type: 'resize', capture: false },\n\t\t\t{ target: view.visualViewport, type: 'scroll', capture: false },\n\t\t);\n\t}\n\treturn sources;\n}\n","/**\n * LinkPlugin: registers a link mark type with href attribute,\n * editing and navigation commands, keyboard shortcuts, and toolbar popup.\n * Link gestures and the non-modal preview have their own lifecycle controller.\n */\n\nimport {\n\tapplyAttributedMark,\n\tgetMarkAttrAtSelection,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport { LINK_CSS } from '../../editor/styles/link.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { hasMark } from '../../model/Document.js';\nimport { escapeHTML, sanitizeHref } from '../../model/HTMLUtils.js';\nimport { createCollapsedSelection, isCollapsed, isTextSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { dispatchIfPresent, resolveLocale } from '../shared/PluginHelpers.js';\nimport { formatShortcut } from '../shared/ShortcutFormatting.js';\nimport { LinkInteractionController } from './LinkInteractionController.js';\nimport { LINK_LOCALE_EN, type LinkLocale, loadLinkLocale } from './LinkLocale.js';\nimport { openLink, shouldOpenInNewTab } from './LinkNavigation.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tlink: { href: string; title?: string };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface LinkConfig {\n\t/** Whether to add rel=\"noopener noreferrer\" and target=\"_blank\" by default. */\n\treadonly openInNewTab: boolean;\n\t/** Live Markdown shortcuts: `[text](url \"title\")` and `<url>` autolink. Default true. */\n\treadonly inputRule?: boolean;\n\treadonly locale?: LinkLocale;\n}\n\nconst DEFAULT_CONFIG: LinkConfig = {\n\topenInNewTab: true,\n};\n\n// The inline-node placeholder (U+FFFC) is excluded from every re-inserted\n// capture so a live link rule never spans an inline node nor writes the\n// sentinel back as literal text.\n/** `[text](url \"optional title\")`, not preceded by `!` (which would be an image). */\nconst LINK_RULE = /(?:^|[^!])(\\[([^\\]\\uFFFC]+)\\]\\(([^)\\s\\uFFFC]+)(?:\\s+\"([^\"\\uFFFC]*)\")?\\))$/;\n/** `<scheme:...>` autolink. */\nconst AUTOLINK_RULE = /(<([a-zA-Z][a-zA-Z0-9+.-]{1,31}:[^<>\\s\\uFFFC]+)>)$/;\n\n// --- Plugin ---\n\nexport class LinkPlugin implements Plugin {\n\treadonly id = 'link';\n\treadonly name = 'Link';\n\treadonly priority = 25;\n\n\tprivate readonly config: LinkConfig;\n\tprivate locale: LinkLocale = LINK_LOCALE_EN;\n\tprivate interaction: LinkInteractionController | null = null;\n\n\tconstructor(config?: Partial<LinkConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tasync init(context: PluginContext): Promise<void> {\n\t\tthis.locale = await resolveLocale(context, this.config.locale, LINK_LOCALE_EN, loadLinkLocale);\n\t\tcontext.registerStyleSheet(LINK_CSS);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerToolbarItem(context);\n\t\tif (this.config.inputRule !== false) {\n\t\t\tthis.registerInputRules(context);\n\t\t}\n\t\tthis.interaction?.destroy();\n\t\tthis.interaction = new LinkInteractionController(context, this.locale);\n\t}\n\n\tdestroy(): void {\n\t\tthis.interaction?.destroy();\n\t\tthis.interaction = null;\n\t}\n\n\tonStateChange(oldState: EditorState, newState: EditorState): void {\n\t\tif (oldState.doc !== newState.doc) {\n\t\t\tthis.interaction?.closePreview();\n\t\t\treturn;\n\t\t}\n\t\tthis.interaction?.restorePreviewAnnouncement();\n\t}\n\n\tonReadOnlyChange(): void {\n\t\tthis.interaction?.closePreview();\n\t}\n\n\t/**\n\t * Live Markdown link rules: `[text](url \"title\")` and `<url>` autolink. Bespoke\n\t * (not the shared wrapping-mark helper) because links carry an `href`/`title`\n\t * attribute and two capture groups (D6).\n\t */\n\tprivate registerInputRules(context: PluginContext): void {\n\t\tconst buildLink = (\n\t\t\tstate: EditorState,\n\t\t\tblockId: BlockNode['id'],\n\t\t\tstart: number,\n\t\t\tend: number,\n\t\t\ttext: string,\n\t\t\thref: string,\n\t\t\ttitle?: string,\n\t\t) => {\n\t\t\tconst attrs: Record<string, string> = { href };\n\t\t\tif (title) attrs.title = title;\n\t\t\treturn state\n\t\t\t\t.transaction('input')\n\t\t\t\t.deleteTextAt(blockId, start, end)\n\t\t\t\t.insertText(blockId, start, text, [{ type: markType('link'), attrs }])\n\t\t\t\t.setSelection(createCollapsedSelection(blockId, start + text.length))\n\t\t\t\t.build();\n\t\t};\n\n\t\tcontext.registerInputRule({\n\t\t\tpattern: LINK_RULE,\n\t\t\thandler(state, match, _start, end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel) || !isCollapsed(sel)) return null;\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type === 'code_block') return null;\n\n\t\t\t\tconst expr = match[1];\n\t\t\t\tconst text = match[2];\n\t\t\t\tconst rawHref = match[3];\n\t\t\t\tconst title = match[4];\n\t\t\t\tif (!expr || !text || !rawHref) return null;\n\t\t\t\tconst href: string = sanitizeHref(rawHref);\n\t\t\t\tif (href === '') return null;\n\n\t\t\t\treturn buildLink(state, sel.anchor.blockId, end - expr.length, end, text, href, title);\n\t\t\t},\n\t\t});\n\n\t\tcontext.registerInputRule({\n\t\t\tpattern: AUTOLINK_RULE,\n\t\t\thandler(state, match, _start, end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (!isTextSelection(sel) || !isCollapsed(sel)) return null;\n\t\t\t\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type === 'code_block') return null;\n\n\t\t\t\tconst expr = match[1];\n\t\t\t\tconst url = match[2];\n\t\t\t\tif (!expr || !url) return null;\n\t\t\t\tconst href: string = sanitizeHref(url);\n\t\t\t\tif (href === '') return null;\n\n\t\t\t\treturn buildLink(state, sel.anchor.blockId, end - expr.length, end, url, href);\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tconst openInNewTab = this.config.openInNewTab;\n\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'link',\n\t\t\trank: 10,\n\t\t\tinclusive: false,\n\t\t\tattrs: {\n\t\t\t\thref: { default: '' },\n\t\t\t\ttitle: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst a = document.createElement('a');\n\t\t\t\tconst href: string = sanitizeHref(String(mark.attrs?.href ?? ''));\n\t\t\t\ta.setAttribute('href', href);\n\t\t\t\tconst title: string = String(mark.attrs?.title ?? '');\n\t\t\t\tif (title) a.setAttribute('title', title);\n\t\t\t\tif (shouldOpenInNewTab(href, openInNewTab)) {\n\t\t\t\t\ta.setAttribute('target', '_blank');\n\t\t\t\t\ta.setAttribute('rel', 'noopener noreferrer');\n\t\t\t\t}\n\t\t\t\treturn a;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst safeHref: string = sanitizeHref(String(mark.attrs?.href ?? ''));\n\t\t\t\tconst href: string = escapeHTML(safeHref);\n\t\t\t\tconst titleValue: string = String(mark.attrs?.title ?? '');\n\t\t\t\tconst titleAttr: string = titleValue ? ` title=\"${escapeHTML(titleValue)}\"` : '';\n\t\t\t\tif (shouldOpenInNewTab(safeHref, openInNewTab)) {\n\t\t\t\t\treturn `<a href=\"${href}\"${titleAttr} target=\"_blank\" rel=\"noopener noreferrer\">${content}</a>`;\n\t\t\t\t}\n\t\t\t\treturn `<a href=\"${href}\"${titleAttr}>${content}</a>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'a',\n\t\t\t\t\tgetAttrs: (el) => {\n\t\t\t\t\t\t// Returning an empty href (instead of `false`) keeps the link mark\n\t\t\t\t\t\t// applied so the parser does not fall back to the core HTMLParser's\n\t\t\t\t\t\t// raw-href default; the empty value renders as a no-op anchor.\n\t\t\t\t\t\tconst href: string = sanitizeHref(el.getAttribute('href') ?? '');\n\t\t\t\t\t\tconst title: string = el.getAttribute('title') ?? '';\n\t\t\t\t\t\treturn title ? { href, title } : { href };\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['a'], attrs: ['href', 'title', 'target', 'rel'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand(\n\t\t\t'openLink',\n\t\t\t() => {\n\t\t\t\tconst href: string | null = getMarkAttrAtSelection(\n\t\t\t\t\tcontext.getState(),\n\t\t\t\t\t'link',\n\t\t\t\t\t(mark) => mark.attrs.href,\n\t\t\t\t);\n\t\t\t\tif (href === null) return false;\n\t\t\t\t// An author mid-edit keeps the editor; readers follow the configured target.\n\t\t\t\tconst newTab: boolean = context.isReadOnly() ? this.config.openInNewTab : true;\n\t\t\t\treturn openLink(context.getContainer(), href, newTab);\n\t\t\t},\n\t\t\t{ readonlyAllowed: true },\n\t\t);\n\t\tcontext.registerCommand('toggleLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.toggleLink(context, state);\n\t\t});\n\n\t\tcontext.registerCommand('setLink', () => {\n\t\t\t// setLink is called by the popup after URL input\n\t\t\t// The actual URL is set via the popup's custom render\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('removeLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.removeLink(context, state);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-K': () => context.executeCommand('toggleLink'),\n\t\t});\n\t\tcontext.registerKeymap(\n\t\t\t{ 'Alt-Enter': () => context.executeCommand('openLink') },\n\t\t\t{ priority: 'navigation' },\n\t\t);\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'link',\n\t\t\tgroup: 'insert',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-K')),\n\t\t\tcommand: 'toggleLink',\n\t\t\tpopupType: 'custom',\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\tthis.renderLinkPopup(container, ctx, onClose);\n\t\t\t},\n\t\t\tisActive: (state) => this.isLinkActive(state),\n\t\t\tisEnabled: (state) => !isCollapsed(state.selection) || this.isLinkActive(state),\n\t\t});\n\t}\n\n\tprivate isLinkActive(state: EditorState): boolean {\n\t\treturn isAttributedMarkActive(state, 'link');\n\t}\n\n\tprivate toggleLink(context: PluginContext, state: EditorState): boolean {\n\t\tif (this.isLinkActive(state)) {\n\t\t\treturn this.removeLink(context, state);\n\t\t}\n\t\t// Adding links requires the toolbar popup for URL input\n\t\treturn false;\n\t}\n\n\tprivate addLink(context: PluginContext, state: EditorState, href: string): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\t\tif (isCollapsed(sel)) return false;\n\n\t\tconst mark = { type: markType('link'), attrs: { href } };\n\t\treturn dispatchIfPresent(context, applyAttributedMark(state, mark));\n\t}\n\n\tprivate removeLink(context: PluginContext, state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (!isTextSelection(sel)) return false;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\t// Remove link from entire link span around cursor (plugin-specific extent scan)\n\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block) return false;\n\n\t\t\tconst textChildren: { pos: number; end: number; hasLink: boolean }[] = [];\n\t\t\tlet pos = 0;\n\t\t\tfor (const child of block.children) {\n\t\t\t\tif (!('text' in child)) continue;\n\t\t\t\tconst end = pos + child.text.length;\n\t\t\t\ttextChildren.push({ pos, end, hasLink: hasMark(child.marks, markType('link')) });\n\t\t\t\tpos = end;\n\t\t\t}\n\n\t\t\tconst cursorIdx = textChildren.findIndex(\n\t\t\t\t(c) => sel.anchor.offset >= c.pos && sel.anchor.offset <= c.end,\n\t\t\t);\n\t\t\tconst cursorEntry = cursorIdx >= 0 ? textChildren[cursorIdx] : undefined;\n\t\t\tif (cursorIdx === -1 || !cursorEntry?.hasLink) return false;\n\n\t\t\tlet startIdx = cursorIdx;\n\t\t\twhile (startIdx > 0 && textChildren[startIdx - 1]?.hasLink) {\n\t\t\t\tstartIdx--;\n\t\t\t}\n\n\t\t\tlet endIdx = cursorIdx;\n\t\t\twhile (endIdx < textChildren.length - 1 && textChildren[endIdx + 1]?.hasLink) {\n\t\t\t\tendIdx++;\n\t\t\t}\n\n\t\t\tconst startEntry = textChildren[startIdx];\n\t\t\tconst endEntry = textChildren[endIdx];\n\t\t\tif (!startEntry || !endEntry) return false;\n\n\t\t\tconst linkStart = startEntry.pos;\n\t\t\tconst linkEnd = endEntry.end;\n\n\t\t\tconst builder = state.transaction('command');\n\t\t\tbuilder.removeMark(sel.anchor.blockId, linkStart, linkEnd, { type: markType('link') });\n\t\t\tbuilder.setSelection(sel);\n\t\t\tcontext.dispatch(builder.build());\n\t\t\treturn true;\n\t\t}\n\n\t\t// Range selection: delegate to shared helper\n\t\treturn dispatchIfPresent(context, removeAttributedMark(state, markType('link')));\n\t}\n\n\tprivate renderLinkPopup(\n\t\tcontainer: HTMLElement,\n\t\tcontext: PluginContext,\n\t\tonClose: () => void,\n\t): void {\n\t\tcontainer.classList.add('notectl-link-popup');\n\n\t\tconst state = context.getState();\n\t\tconst isActive = this.isLinkActive(state);\n\n\t\tif (isActive) {\n\t\t\tconst openBtn: HTMLButtonElement = document.createElement('button');\n\t\t\topenBtn.type = 'button';\n\t\t\topenBtn.className = 'notectl-link-popup__button';\n\t\t\topenBtn.textContent = this.locale.openLink ?? LINK_LOCALE_EN.openLink;\n\t\t\topenBtn.addEventListener('mousedown', (event: MouseEvent): void => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\n\t\t\t});\n\t\t\topenBtn.addEventListener('click', (): void => {\n\t\t\t\tcontext.executeCommand('openLink');\n\t\t\t\tonClose();\n\t\t\t});\n\t\t\tcontainer.appendChild(openBtn);\n\t\t\t// Show remove link button\n\t\t\tconst removeBtn = document.createElement('button');\n\t\t\tremoveBtn.type = 'button';\n\t\t\tremoveBtn.className = 'notectl-link-popup__button';\n\t\t\tremoveBtn.textContent = this.locale.removeLink;\n\t\t\tremoveBtn.setAttribute('aria-label', this.locale.removeLinkAria);\n\t\t\tremoveBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t});\n\t\t\tremoveBtn.addEventListener('click', () => {\n\t\t\t\tcontext.executeCommand('removeLink');\n\t\t\t\tonClose();\n\t\t\t\tcontext.getContainer().focus();\n\t\t\t});\n\t\t\tcontainer.appendChild(removeBtn);\n\t\t} else {\n\t\t\t// Show URL input\n\t\t\tconst input = document.createElement('input');\n\t\t\tinput.type = 'url';\n\t\t\tinput.className = 'notectl-link-popup__input';\n\t\t\tinput.placeholder = this.locale.urlPlaceholder;\n\t\t\tinput.setAttribute('aria-label', this.locale.urlAria);\n\n\t\t\tconst applyBtn = document.createElement('button');\n\t\t\tapplyBtn.type = 'button';\n\t\t\tapplyBtn.className = 'notectl-link-popup__button notectl-link-popup__button--apply';\n\t\t\tapplyBtn.textContent = this.locale.apply;\n\t\t\tapplyBtn.setAttribute('aria-label', this.locale.applyAria);\n\n\t\t\tconst errorMsg = document.createElement('div');\n\t\t\terrorMsg.className = 'notectl-link-popup__error';\n\t\t\terrorMsg.setAttribute('role', 'alert');\n\t\t\terrorMsg.hidden = true;\n\n\t\t\tconst applyLink = (): void => {\n\t\t\t\tconst raw: string = input.value.trim();\n\t\t\t\tif (raw === '') return;\n\t\t\t\tconst sanitized: string = sanitizeHref(raw);\n\t\t\t\tif (sanitized === '') {\n\t\t\t\t\terrorMsg.textContent = this.locale.invalidUrl;\n\t\t\t\t\terrorMsg.hidden = false;\n\t\t\t\t\tinput.setAttribute('aria-invalid', 'true');\n\t\t\t\t\tinput.focus();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\terrorMsg.hidden = true;\n\t\t\t\tinput.removeAttribute('aria-invalid');\n\t\t\t\tthis.addLink(context, context.getState(), sanitized);\n\t\t\t\tonClose();\n\t\t\t\tcontext.getContainer().focus();\n\t\t\t};\n\n\t\t\tapplyBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t});\n\t\t\tapplyBtn.addEventListener('click', () => {\n\t\t\t\tapplyLink();\n\t\t\t});\n\n\t\t\tinput.addEventListener('keydown', (e) => {\n\t\t\t\tif (e.key === 'Enter') {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tapplyLink();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tinput.addEventListener('input', () => {\n\t\t\t\tif (!errorMsg.hidden) {\n\t\t\t\t\terrorMsg.hidden = true;\n\t\t\t\t\tinput.removeAttribute('aria-invalid');\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tcontainer.appendChild(input);\n\t\t\tcontainer.appendChild(applyBtn);\n\t\t\tcontainer.appendChild(errorMsg);\n\n\t\t\t// Auto-focus input\n\t\t\trequestAnimationFrame(() => input.focus());\n\t\t}\n\t}\n}\n"],"mappings":"Y,+eACA,IC2BakB,EAAuC,CACnDC,MAAO,OACPC,QAAUC,GAAqB,gBAAgBA,KAC/CC,WAAY,cACZC,eAAgB,cAChBC,eAAgB,cAChBC,QAAS,WACTC,MAAO,QACPC,UAAW,aACXC,WAAY,wEACZC,SAAU,YACVC,iBAAkB,uBAClBC,aAAc,qBACdC,cAAe,yEAKVC,iBAA6CC,OAAAC,OAAA,CAAA,kBAAA,WAAA,qBAAA,kBAAA,WAAA,qBAAA,kBAAA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6M,EAAS1L,UAAY,4BACrB0L,EAAS5M,aAAa,OAAQ,SAC9B4M,EAASxM,QAAS,EAElB,MAAMyM,EAAA,KACL,MAAMC,EAAcL,EAAMM,MAAMC,OAChC,GAAY,KAARF,EAAY,OAChB,MAAMG,EAAoB3Q,EAAawQ,GACvC,GAAkB,KAAdG,EAKH,OAJAL,EAASxL,YAAcL,KAAKL,OAAOzC,WACnC2O,EAASxM,QAAS,EAClBqM,EAAMzM,aAAa,eAAgB,aACnCyM,EAAM3J,QAGP8J,EAASxM,QAAS,EAClBqM,EAAMS,gBAAgB,gBACtBnM,KAAKgK,QAAQnH,EAASA,EAAQoC,WAAYiH,GAC1CjL,IACA4B,EAAQS,eAAevB,SAGxB6J,EAASnL,iBAAiB,YAAcgL,IACvCA,EAAE7K,iBACF6K,EAAElK,oBAEHqK,EAASnL,iBAAiB,QAAA,KACzBqL,MAGDJ,EAAMjL,iBAAiB,UAAYgL,IACpB,UAAVA,EAAEnK,MACLmK,EAAE7K,iBACFkL,OAIFJ,EAAMjL,iBAAiB,QAAA,KACjBoL,EAASxM,SACbwM,EAASxM,QAAS,EAClBqM,EAAMS,gBAAgB,mBAIxBjO,EAAUqB,YAAYmM,GACtBxN,EAAUqB,YAAYqM,GACtB1N,EAAUqB,YAAYsM,GAGtBO,sBAAA,IAA4BV,EAAM3J,QACnC,CACD,U"}
@@ -1,2 +0,0 @@
1
- import{B as t,D as e,E as n,_ as i,j as s,p as c}from"./Document-ssR6hBzG.mjs";import{c as o,f as r,n as l,p as a}from"./Selection-DC6AOGgF.mjs";import{a as d,t as h}from"./TypeBrands-Ch9856Gb.mjs";import{c as u}from"./BlockInsertion-CXfXqUZl.mjs";import{t as m}from"./RangeIterator-sJ_c9MNr.mjs";import{r as p}from"./AttrRegistry-Di936wMv.mjs";import{o as k,t as f}from"./Decoration-BoFcdSXk.mjs";import{c as b,o as g}from"./PluginHelpers-B3gk3VB3.mjs";import{c as y}from"./StyleRuntime-C0RSqKzG.mjs";import{n as v}from"./DomUtils-Bf7JLFlx.mjs";function x(t,e,n){return"checklist"===t?{listType:t,indent:e,checked:n??!1}:{listType:t,indent:e}}function I(t,e){const n=t.getBlock(e);if("list_item"===n?.type)return n;const i=t.getNodePath(e);if(i)for(let s=i.length-2;s>=0;s--){const e=i[s],n=e?t.getBlock(e):void 0;if("list_item"===n?.type)return n}}function T(t,n){const i=t.getBlock(n);if(!i||"list_item"!==i.type)return;const s=t.getNodePath(n);if(!s)return;const c=s.slice(0,-1),o=c[c.length-1],r=(o?e(t.getBlock(o)):t.doc.children).findIndex(t=>t.id===n);return r<0?void 0:{item:i,parentPath:c,index:r}}function w(t,n){t.removeNode(n.parentPath,n.index),e(n.item).forEach((e,i)=>{t.insertNode(n.parentPath,n.index+i,e)})}function B(e,n){const i=e.getState(),s=i.selection;return!!r(s)&&(s.anchor.blockId!==s.head.blockId?function(e,n,i){const s=n.selection;if(!r(s))return!1;const c=a(s,n.getBlockOrder()),o=C(n,c,i),l=n.transaction("command"),h=function(t,e){const n=[],i=/* @__PURE__ */new Set;return m(t,e,e=>{const s=t.getBlock(e);if(!s)return;const c=I(t,e)??s;i.has(c.id)||(i.add(c.id),n.push(c))}),n}(n,c);for(let r=h.length-1;r>=0;r--){const e=h[r];if(e)if(o)if(t(e))l.setBlockType(e.id,d("paragraph"));else{const t=T(n,e.id);t&&w(l,t)}else{const t=p(e,"list_item")?e.attrs.indent:0,n=p(e,"list_item")&&"checklist"===e.attrs.listType&&e.attrs.checked;l.setBlockType(e.id,d("list_item"),x(i,t,n))}}return l.setSelection(s),e.dispatch(l.build()),!0}(e,i,n):function(e,n,i){const s=n.selection;if(!r(s))return!1;const c=n.getBlock(s.anchor.blockId);if(!c)return!1;const o=I(n,s.anchor.blockId),l=o??c;if(o&&o.attrs?.listType===i){const i=n.transaction("command");if(t(o))i.setBlockType(o.id,d("paragraph"));else{const t=T(n,o.id);if(!t)return!1;w(i,t)}return i.setSelection(s),e.dispatch(i.build()),!0}const a=x(i,p(l,"list_item")?l.attrs.indent:0),h=n.transaction("command").setBlockType(l.id,d("list_item"),a).setSelection(s).build();return e.dispatch(h),!0}(e,i,n))}function L(t,e,n){const i=t.getState();if(!r(i.selection))return!1;if(i.selection.anchor.blockId!==i.selection.head.blockId)return function(t,e,n,i){const s=e.selection;if(!r(s))return!1;const c=a(s,e.getBlockOrder()),o=e.transaction("command");let l=!1;const h=/* @__PURE__ */new Set;return m(e,c,t=>{const s=I(e,t);if(!s||!p(s,"list_item"))return;if(h.has(s.id))return;h.add(s.id);const c=s.attrs.indent+n;c<0||c>i||(o.setBlockType(s.id,d("list_item"),x(s.attrs.listType,c,s.attrs.checked)),l=!0)}),!!l&&(o.setSelection(s),t.dispatch(o.build()),!0)}(t,i,e,n);const s=i.selection,c=I(i,s.anchor.blockId);if(!c||!p(c,"list_item"))return!1;const o=c.attrs.indent+e;if(o<0||o>n)return!1;const l=x(c.attrs.listType,o,c.attrs.checked),h=i.transaction("command").setBlockType(c.id,d("list_item"),l).setSelection(s).build();return t.dispatch(h),!0}function S(t,e){const{interactiveCheckboxes:n,targetId:i,locale:s}=e;if(t.isReadOnly()&&!n)return!1;const c=t.getState(),o=i??(r(c.selection)?c.selection.anchor.blockId:null);if(!o)return!1;const l=I(c,o);if(!l||!p(l,"list_item")||"checklist"!==l.attrs.listType)return!1;const a=!l.attrs.checked,h=x(l.attrs.listType,l.attrs.indent,a),u=c.transaction("command").setBlockType(l.id,d("list_item"),h).setSelection(c.selection);t.isReadOnly()&&n&&u.readonlyAllowed(),t.dispatch(u.build());const m=t.getState().getBlock(l.id);return!(!m||!p(m,"list_item")||"checklist"!==m.attrs.listType||m.attrs.checked!==a||(t.announce(a?s.checkedAnnouncement:s.uncheckedAnnouncement),0))}function C(t,e,n){let i=!0;return m(t,e,e=>{const s=I(t,e);s&&"list_item"===s.type&&s.attrs?.listType===n||(i=!1)}),i}var _=[{type:"bullet",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"/></svg>',inputPattern:/^[-*] $/,inputPrefix:"- "},{type:"ordered",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"/></svg>',inputPattern:/^\d+\. $/,inputPrefix:"1. "},{type:"checklist",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z"/></svg>',inputPattern:/^\[[ x]] $/,inputPrefix:"[ ] "}];function H(t,n){const i=t.getState();if(!r(i.selection))return!1;const s=i.selection;if(!o(s))return!1;const c=i.getBlock(s.anchor.blockId);if(!c)return!1;if("list_item"===c.type)return n({state:i,item:c,child:void 0,childIndex:-1,childCount:0,blockId:s.anchor.blockId,offset:s.anchor.offset});const l=i.getParent(s.anchor.blockId);if(!l||"list_item"!==l.type)return!1;const a=e(l),d=a.findIndex(t=>t.id===c.id);return!(d<0)&&n({state:i,item:l,child:c,childIndex:d,childCount:a.length,blockId:s.anchor.blockId,offset:s.anchor.offset})}var z={bulletList:"Bullet List",numberedList:"Numbered List",checklist:"Checklist",checkboxLabel:"To-do item",checkedAnnouncement:"Checked",uncheckedAnnouncement:"Unchecked"},A=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Cy_77yRf.mjs"),"./locales/de.ts":()=>import("./de-CaeEIyzV.mjs"),"./locales/es.ts":()=>import("./es-DFokqQst.mjs"),"./locales/fr.ts":()=>import("./fr-5HkMazAf.mjs"),"./locales/hi.ts":()=>import("./hi-BzbMD_cP.mjs"),"./locales/pt.ts":()=>import("./pt-CR4j8gtE.mjs"),"./locales/ru.ts":()=>import("./ru-DiwQV30V.mjs"),"./locales/zh.ts":()=>import("./zh-BQqf3wJZ.mjs")});async function j(t){return b(A,t,z)}var M="notectl-checklist-marker";function P(t,e){const n=document.createElement("span");return n.className=M,n.setAttribute("role","checkbox"),n.setAttribute("aria-checked",String(t)),n.setAttribute("aria-label",e),n.setAttribute("contenteditable","false"),n.setAttribute("data-widget","true"),n}function $(t,e){return{bullet:e.bulletList,ordered:e.numberedList,checklist:e.checklist}[t]}function D(t,e){if(!r(t.selection))return!1;if(t.selection.anchor.blockId!==t.selection.head.blockId){const n=a(t.selection,t.getBlockOrder());return C(t,n,e)}const n=I(t,t.selection.anchor.blockId);return"list_item"===n?.type&&n.attrs?.listType===e}var N={types:["bullet","ordered","checklist"],maxIndent:4},E=class{id="list";name="List";priority=35;config;locale;context=null;checkboxMouseDownHandler=null;checkboxClickHandler=null;constructor(t){this.config={...N,...t}}async init(t){this.context=t,this.locale=await g(t,this.config.locale,z,j);const e=this.getEnabledTypes();t.registerStyleSheet("\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0;\n\tpadding-inline-start: 24px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\t-webkit-user-select: none;\n\tuser-select: none;\n\tpointer-events: none;\n}\n\n/* Container items (#194): block children inherit the item's start padding.\n Trim the first/last child paragraph padding so the first text line sits on\n the marker's line and the item keeps the leaf item's vertical rhythm. */\n.notectl-list-item > p:first-of-type {\n\tpadding-top: 0;\n}\n\n.notectl-list-item > p:last-of-type {\n\tpadding-bottom: 0;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist — the marker is a real role=\"checkbox\" element (see ListMarker.ts)\n positioned over the reserved marker zone. inline-block keeps the parent's\n line-through (on checked items) from striking the glyph. */\n.notectl-checklist-marker {\n\tposition: absolute;\n\tinset-inline-start: 0;\n\tdisplay: inline-block;\n\twidth: 24px;\n\ttext-align: center;\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n\ttext-decoration: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.notectl-checklist-marker::before {\n\tcontent: '\\2610';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker {\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] .notectl-checklist-marker::before {\n\tcontent: '\\2611';\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n"),this.registerNodeSpec(t),function(t,e,n,i){for(const s of n)t.registerCommand(`toggleList:${s.type}`,()=>B(t,s.type));if(t.registerCommand("indentListItem",()=>L(t,1,e.maxIndent)),t.registerCommand("outdentListItem",()=>L(t,-1,e.maxIndent)),e.types.includes("checklist")){const n=()=>S(t,{interactiveCheckboxes:e.interactiveCheckboxes,locale:i});t.registerCommand("toggleChecklistItem",n,{readonlyAllowed:e.interactiveCheckboxes}),t.registerKeymap({"Mod-Enter":n},{priority:"navigation"})}t.registerKeymap({Tab:()=>L(t,1,e.maxIndent),"Shift-Tab":()=>L(t,-1,e.maxIndent)})}(t,this.config,e,this.locale),function(t){t.registerKeymap({Enter:()=>function(t){return H(t,e=>{if(e.child)return function(t,e,s){if(!u(s))return!1;if(e.childIndex!==e.childCount-1)return!1;const o=T(e.state,e.item.id);if(!o)return!1;const r=e.state.transaction("input");if(1===e.childCount)return w(r,o),r.setSelection(e.state.selection),t.dispatch(r.build()),!0;const a=p(e.item,"list_item")?e.item.attrs.listType:"bullet",h=p(e.item,"list_item")?e.item.attrs.indent:0,m=n(),k=c(d("list_item"),[i("")],m,x(a,h));return r.removeNode([...o.parentPath,e.item.id],e.childIndex).insertNode(o.parentPath,o.index+1,k).setSelection(l(m,0)),t.dispatch(r.build()),!0}(t,e,e.child);if(""===s(e.item)){const n=e.state.transaction("input").setBlockType(e.blockId,d("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0}const o=n(),r=x(p(e.item,"list_item")?e.item.attrs.listType:"bullet",p(e.item,"list_item")?e.item.attrs.indent:0),a=e.state.transaction("input").splitBlock(e.blockId,e.offset,o).setBlockType(o,d("list_item"),r).setSelection(l(o,0)).build();return t.dispatch(a),!0})}(t),Backspace:()=>function(t){return H(t,e=>{if(0!==e.offset)return!1;if(e.child){if(0!==e.childIndex)return!1;const n=T(e.state,e.item.id);if(!n)return!1;const i=e.state.transaction("input");return w(i,n),i.setSelection(e.state.selection),t.dispatch(i.build()),!0}const n=e.state.transaction("input").setBlockType(e.blockId,d("paragraph")).setSelection(e.state.selection).build();return t.dispatch(n),!0})}(t)})}(t),!1!==this.config.inputRule&&function(t,e){for(const n of e)t.registerInputRule({pattern:n.inputPattern,handler:(t,e,i,s)=>{const c=t.selection;if(!r(c))return null;if(!o(c))return null;const a=t.getBlock(c.anchor.blockId);if(!a||"paragraph"!==a.type)return null;if("list_item"===t.getParent(c.anchor.blockId)?.type)return null;const h=e[0]??"",u=h.length,m=x(n.type,0,h.includes("[x]"));return t.transaction("input").deleteTextAt(c.anchor.blockId,i,i+u).setBlockType(c.anchor.blockId,d("list_item"),m).setSelection(l(c.anchor.blockId,0)).build()}})}(t,e),function(t,e,n){for(const i of e)t.registerToolbarItem({id:`list-${i.type}`,group:"block",icon:i.icon,label:$(i.type,n),command:`toggleList:${i.type}`,isActive:t=>D(t,i.type)})}(t,e,this.locale),this.registerCheckboxHandlers(t)}decorations(t){const e=[];for(const n of t.getBlockOrder()){const i=t.getBlock(n);if(!i||!p(i,"list_item")||"checklist"!==i.attrs.listType)continue;const s=i.attrs.checked;e.push(k(n,0,()=>P(s,this.locale.checkboxLabel),{key:`checklist-marker:${s}`}))}return f.create(e)}destroy(){if(this.context){const t=this.context.getContainer();this.checkboxMouseDownHandler&&t.removeEventListener("mousedown",this.checkboxMouseDownHandler),this.checkboxClickHandler&&t.removeEventListener("click",this.checkboxClickHandler)}this.checkboxMouseDownHandler=null,this.checkboxClickHandler=null,this.context=null}registerNodeSpec(t){const e=this.locale.checkboxLabel;t.registerNodeSpec({type:"list_item",group:"block",content:{allow:["text","paragraph","heading","code_block","blockquote","horizontal_rule"]},attrs:{listType:{default:"bullet"},indent:{default:0},checked:{default:!1}},toDOM(t){const n=t.attrs?.listType??"bullet",i=t.attrs?.indent??0,s=t.attrs?.checked??!1,c=v("li",t.id);return c.setAttribute("role","listitem"),c.setAttribute("data-list-type",n),c.setAttribute("data-indent",String(i)),c.className=`notectl-list-item notectl-list-item--${n}`,i>0&&y(c,"marginLeft",24*i+"px"),"checklist"===n&&(c.setAttribute("data-checked",String(s)),c.appendChild(P(s,e))),c.setAttribute("aria-level",String(i+1)),c},wrapper(t){const e=t.attrs?.listType??"bullet";return{tag:"ordered"===e?"ol":"ul",key:`list-${e}`,className:`notectl-list notectl-list--${e}`,attrs:{role:"list"}}},toHTML(t,e){const n=t.attrs?.listType??"bullet",i=t.attrs?.checked??!1;return"checklist"===n?`<li role="checkbox" aria-checked="${String(i)}"><input type="checkbox" disabled${i?" checked":""}>${e||"<br>"}</li>`:`<li>${e||"<br>"}</li>`},parseHTML:[{tag:"li"}],sanitize:{tags:["ul","ol","li","input"],attrs:["type","disabled","checked","role","aria-checked"]}})}registerCheckboxHandlers(t){if(!this.config.types.includes("checklist"))return;const e=t=>{if(!(t instanceof HTMLElement))return null;const e=t.closest(`.${M}`);return e?e.closest(".notectl-list-item--checklist"):null};this.checkboxMouseDownHandler=n=>{t.isReadOnly()&&!this.config.interactiveCheckboxes||e(n.target)&&n.preventDefault()},this.checkboxClickHandler=n=>{if(t.isReadOnly()&&!this.config.interactiveCheckboxes)return;const i=e(n.target);if(!i)return;n.preventDefault();const s=i.getAttribute("data-block-id");s&&S(t,{interactiveCheckboxes:this.config.interactiveCheckboxes,targetId:h(s),locale:this.locale})};const n=t.getContainer();n.addEventListener("mousedown",this.checkboxMouseDownHandler),n.addEventListener("click",this.checkboxClickHandler)}getEnabledTypes(){return _.filter(t=>this.config.types.includes(t.type))}};export{z as n,j as r,E as t};
2
- //# sourceMappingURL=ListPlugin-U1r4p_fE.mjs.map
@@ -1,2 +0,0 @@
1
- import{d as e,f as n}from"./Selection-DC6AOGgF.mjs";import{n as t}from"./TypedKeys-CA4bfw9O.mjs";var r=class{resolvedLocale;constructor(e){this.resolvedLocale="browser"===e?"undefined"!=typeof navigator?navigator.language.split("-")[0]??"en":"en":e}getLocale(){return this.resolvedLocale}},o=new t("locale");async function c(e,n,t){if("en"===n)return t;const r=e[`./locales/${n}.ts`];if(!r)return t;try{return(await r()).default}catch{return t}}function s(e,n){return!!n&&(e.dispatch(n),!0)}function a(e){return e.charAt(0).toUpperCase()+e.slice(1)}function i(e){return`toggle${a(e)}`}async function l(e,n,t,r){if(n)return n;const c=e.getService(o)?.getLocale()??"en";return"en"===c?t:r(c)}function u(t){const r=t.selection;return e(r)?t.getBlock(r.nodeId):n(r)?t.getBlock(r.anchor.blockId):void 0}function d(t){const r=t.selection;return e(r)?r.nodeId:n(r)?r.anchor.blockId:void 0}function f(t){const r=t.selection;if(e(r))return[r.nodeId];if(!n(r))return[];const o=r.anchor.blockId,c=r.head.blockId;if(o===c)return[o];const s=t.getBlockOrder(),a=s.indexOf(o),i=s.indexOf(c);if(-1===a||-1===i)return[];const l=Math.min(a,i),u=Math.max(a,i);return s.slice(l,u+1)}export{f as a,c,d as i,r as l,s as n,l as o,u as r,i as s,a as t,o as u};
2
- //# sourceMappingURL=PluginHelpers-B3gk3VB3.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PluginHelpers-B3gk3VB3.mjs","names":["isNodeSelection","isTextSelection","ServiceKey","LocaleService","resolvedLocale","constructor","locale","this","navigator","language","split","getLocale","LocaleServiceKey","async","loadLocaleModule","modules","lang","fallback","loader","default","dispatchIfPresent","context","tr","dispatch","capitalize","s","charAt","toUpperCase","slice","toCommandName","markType","resolveLocale","configLocale","defaultLocale","getService","getSelectedBlock","state","sel","selection","getBlock","nodeId","anchor","blockId","getSelectedBlockId","getSelectedBlockIds","anchorId","headId","head","order","getBlockOrder","anchorIdx","indexOf","headIdx","from","Math","min","to","max"],"sources":["../../src/i18n/LocaleService.ts","../../src/plugins/shared/LocaleLoader.ts","../../src/plugins/shared/PluginHelpers.ts"],"sourcesContent":["/**\n * Global locale service that resolves the active language.\n * Registered as a system-level service before plugin init.\n */\n\nimport { ServiceKey } from '../model/TypedKeys.js';\n\nexport class LocaleService {\n\tprivate readonly resolvedLocale: string;\n\n\tconstructor(locale: string) {\n\t\tthis.resolvedLocale =\n\t\t\tlocale === 'browser'\n\t\t\t\t? typeof navigator !== 'undefined'\n\t\t\t\t\t? (navigator.language.split('-')[0] ?? 'en')\n\t\t\t\t\t: 'en'\n\t\t\t\t: locale;\n\t}\n\n\tgetLocale(): string {\n\t\treturn this.resolvedLocale;\n\t}\n}\n\nexport const LocaleServiceKey = new ServiceKey<LocaleService>('locale');\n","/**\n * Shared helper for loading plugin locale bundles.\n *\n * Rationale:\n * Every notectl plugin used to ship its own copy of a ~15-line locale\n * loader: English shortcut, glob lookup, lazy import, try/catch fallback.\n * The logic is identical across ~23 plugins — only the locale type and\n * the default value change. This helper centralizes the pattern so each\n * plugin's `XxxLocale.ts` shrinks to a handful of lines.\n *\n * Why the glob map still lives in the plugin:\n * `import.meta.glob` is statically resolved by the bundler **relative to\n * the file that calls it**. The helper therefore cannot build the glob\n * itself — each plugin must pass in its own `import.meta.glob(...)`\n * result, and the helper takes care of everything else.\n */\n\n/**\n * Signature of a single locale loader as produced by `import.meta.glob`.\n * The bundler wraps each matched module in a thunk returning a Promise\n * that resolves to an ES module whose default export is the locale.\n */\nexport type LocaleModuleLoader<TLocale> = () => Promise<{ default: TLocale }>;\n\n/**\n * Map from the path string emitted by `import.meta.glob` (e.g.\n * `./locales/de.ts`) to its corresponding lazy loader.\n */\nexport type LocaleModuleMap<TLocale> = Record<string, LocaleModuleLoader<TLocale>>;\n\n/**\n * Loads a plugin locale for the requested language with three fallbacks:\n *\n * 1. `lang === 'en'` — returns the default locale immediately, no import.\n * 2. No matching module in the map — returns the default locale.\n * 3. Module import throws — returns the default locale.\n *\n * This is the exact behavior every plugin needs; sharing it removes ~15\n * lines of boilerplate per plugin and guarantees consistent fallback\n * semantics across the entire editor.\n *\n * @param modules The `import.meta.glob('./locales/*.ts', ...)` map from\n * the caller's module. Passing this in from the plugin\n * is mandatory — globs are resolved at the call site.\n * @param lang IETF-style language tag, e.g. `'de'`, `'zh'`, `'en'`.\n * @param fallback English default locale to return when lookup or\n * import fails. Must already be a fully-formed locale.\n */\nexport async function loadLocaleModule<TLocale>(\n\tmodules: LocaleModuleMap<TLocale>,\n\tlang: string,\n\tfallback: TLocale,\n): Promise<TLocale> {\n\tif (lang === 'en') return fallback;\n\n\tconst loader: LocaleModuleLoader<TLocale> | undefined = modules[`./locales/${lang}.ts`];\n\tif (!loader) return fallback;\n\n\ttry {\n\t\tconst mod = await loader();\n\t\treturn mod.default;\n\t} catch {\n\t\treturn fallback;\n\t}\n}\n","/**\n * Shared helper utilities for plugins.\n * Common operations extracted to avoid code duplication across plugins.\n */\n\nimport { LocaleServiceKey } from '../../i18n/LocaleService.js';\nimport type { BlockNode } from '../../model/Document.js';\nimport { isNodeSelection, isTextSelection } from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { PluginContext } from '../Plugin.js';\n\n/**\n * Dispatches `tr` when it is non-null and reports whether anything happened.\n * Collapses the command body `if (tr) { dispatch(tr); return true; } return false;`\n * shared by mark toggle commands and attributed-mark operations into a single\n * call: `return dispatchIfPresent(context, tr);`.\n */\nexport function dispatchIfPresent(context: PluginContext, tr: Transaction | null): boolean {\n\tif (!tr) return false;\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n/** Capitalizes the first character of a string. */\nexport function capitalize(s: string): string {\n\treturn s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n/** Converts a mark type to its toggle command name (e.g. 'bold' → 'toggleBold'). */\nexport function toCommandName(markType: string): string {\n\treturn `toggle${capitalize(markType)}`;\n}\n\n/**\n * Resolves the locale for a plugin, using config override, default, or dynamic loader.\n * Plugins provide their config locale, a default English locale, and a loader for other languages.\n */\nexport async function resolveLocale<T>(\n\tcontext: PluginContext,\n\tconfigLocale: T | undefined,\n\tdefaultLocale: T,\n\tloader: (lang: string) => Promise<T>,\n): Promise<T> {\n\tif (configLocale) return configLocale;\n\tconst service = context.getService(LocaleServiceKey);\n\tconst lang: string = service?.getLocale() ?? 'en';\n\treturn lang === 'en' ? defaultLocale : loader(lang);\n}\n\n/** Returns the block under the cursor, handling both TextSelection and NodeSelection. */\nexport function getSelectedBlock(state: EditorState): BlockNode | undefined {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel)) return state.getBlock(sel.nodeId);\n\tif (isTextSelection(sel)) return state.getBlock(sel.anchor.blockId);\n\treturn undefined;\n}\n\n/** Returns the block ID under the cursor, handling both TextSelection and NodeSelection. */\nexport function getSelectedBlockId(state: EditorState): BlockId | undefined {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel)) return sel.nodeId;\n\tif (isTextSelection(sel)) return sel.anchor.blockId;\n\treturn undefined;\n}\n\n/**\n * Returns every leaf-block ID covered by the current selection, in document\n * order. A NodeSelection yields its single node; a collapsed or single-block\n * TextSelection yields one ID; a multi-block TextSelection yields the full\n * inclusive range from anchor to head. Used by block-attribute commands\n * (alignment, text direction) that must apply to the whole selection.\n */\nexport function getSelectedBlockIds(state: EditorState): BlockId[] {\n\tconst sel = state.selection;\n\n\tif (isNodeSelection(sel)) return [sel.nodeId];\n\tif (!isTextSelection(sel)) return [];\n\n\tconst anchorId: BlockId = sel.anchor.blockId;\n\tconst headId: BlockId = sel.head.blockId;\n\tif (anchorId === headId) return [anchorId];\n\n\tconst order: readonly BlockId[] = state.getBlockOrder();\n\tconst anchorIdx: number = order.indexOf(anchorId);\n\tconst headIdx: number = order.indexOf(headId);\n\tif (anchorIdx === -1 || headIdx === -1) return [];\n\n\tconst from: number = Math.min(anchorIdx, headIdx);\n\tconst to: number = Math.max(anchorIdx, headIdx);\n\treturn order.slice(from, to + 1) as BlockId[];\n}\n"],"mappings":"Y,qFAOA,IAAaG,EAAb,MACCC,eAEA,WAAAC,CAAYC,GACXC,KAAKH,eACO,YAAXE,EACwB,oBAAdE,UACLA,UAAUC,SAASC,MAAM,KAAK,IAAM,KACrC,KACDJ,CACL,CAEA,SAAAK,GACC,OAAOJ,KAAKH,cACb,GAGYQ,EAAmB,IAAIV,EAA0B,UCwB9DW,eAAsBC,EACrBC,EACAC,EACAC,GAEA,GAAa,OAATD,EAAe,OAAOC,EAE1B,MAAMC,EAAkDH,EAAQ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G,IAAIP,EAAWE,GACvC,OAAOJ,EAAMpB,MAAMyB,EAAMG,EAAK,EAC/B,Q"}
@@ -1,2 +0,0 @@
1
- import{n as e}from"./TypedKeys-CA4bfw9O.mjs";import{i as t}from"./Platform-ByobkiCc.mjs";import{a as s,i as n,t as o}from"./PopupPositioning-CIqgpqlW.mjs";var i=new e("popup"),r=class{stack=[];referenceNode;constructor(e){this.referenceNode=e}open(e){const t=document.createElement("div");t.className=e.className?`notectl-popup ${e.className}`:"notectl-popup",e.ariaRole&&t.setAttribute("role",e.ariaRole),e.ariaLabel&&t.setAttribute("aria-label",e.ariaLabel);const n=e.parent?this.findEntryByHandle(e.parent):null;let i;const r={close:e=>this.closeEntry(i,e),getElement:()=>t},c=s=>{const n=s.composedPath();if(!n.includes(t)){for(const e of this.stack)if(n.includes(e.element))return;e.anchor instanceof HTMLElement&&n.includes(e.anchor)||this.closeEntry(i)}};i={element:t,config:e,clickOutsideHandler:c,parent:n,listenerRegistrationTimer:null,documentListenerAttached:!1},this.stack.push(i);try{e.content(t,e=>this.closeEntry(i,e))}catch(a){throw this.removeEntry(i),a}if(!this.stack.includes(i))return r;const l=e.referenceNode??this.referenceNode;return o(t,l),s(t),this.positionEntry(i),i.listenerRegistrationTimer=setTimeout(()=>{i.listenerRegistrationTimer=null,this.stack.includes(i)&&(document.addEventListener("mousedown",c),i.documentListenerAttached=!0)},0),!1!==e.autoFocus&&this.focusFirstItem(t),r}close(){const e=this.stack[this.stack.length-1];e&&this.closeEntry(e)}closeAll(){for(;this.stack.length>0;){const e=this.stack[this.stack.length-1];e&&this.closeEntry(e)}}isOpen(){return this.stack.length>0}destroy(){this.closeAll()}closeEntry(e,t){const s=this.stack.indexOf(e);if(-1!==s){for(;this.stack.length>s+1;){const e=this.stack[this.stack.length-1];e&&this.removeEntry(e)}this.removeEntry(e),void 0!==t&&"restoreFocusTo"in t?t.restoreFocusTo?.focus():e.config.restoreFocusTo&&e.config.restoreFocusTo.focus(),e.config.onClose?.()}}removeEntry(e){const t=this.stack.indexOf(e);-1!==t&&(this.stack.splice(t,1),null!==e.listenerRegistrationTimer&&(clearTimeout(e.listenerRegistrationTimer),e.listenerRegistrationTimer=null),e.element.remove(),e.documentListenerAttached&&(document.removeEventListener("mousedown",e.clickOutsideHandler),e.documentListenerAttached=!1))}reposition(e){const t=this.findEntryByHandle(e);t&&this.positionEntry(t)}positionEntry(e){const t=e.config,s=t.anchor instanceof HTMLElement?t.anchor.getBoundingClientRect():t.anchor;n(e.element,s,{position:t.position??"below-start",isRtl:this.isRtlContext()})}findEntryByHandle(e){const t=e.getElement();return this.stack.find(e=>e.element===t)??null}isRtlContext(){return this.referenceNode instanceof HTMLElement&&t(this.referenceNode)}focusFirstItem(e){requestAnimationFrame(()=>{e.isConnected&&(e.querySelector('[role="menuitem"]')??e.querySelector('[role="option"]')??e.querySelector('[role="gridcell"]')??e.querySelector("input, textarea")??e.querySelector("button"))?.focus()})}};export{i as n,r as t};
2
- //# sourceMappingURL=PopupManager-Dxv0OVMo.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PopupManager-Dxv0OVMo.mjs","names":["ServiceKey","isRtlContext","promoteToTopLayer","positionPopup","appendToRoot","PopupServiceKey","PopupManager","stack","referenceNode","constructor","this","open","config","popup","document","createElement","className","ariaRole","setAttribute","ariaLabel","parentEntry","parent","findEntryByHandle","entry","handle","close","options","closeEntry","getElement","clickOutsideHandler","e","path","composedPath","includes","stackEntry","element","anchor","HTMLElement","listenerRegistrationTimer","documentListenerAttached","push","content","error","removeEntry","refNode","positionEntry","setTimeout","addEventListener","autoFocus","focusFirstItem","top","length","closeAll","isOpen","destroy","index","indexOf","child","restoreFocusTo","focus","onClose","splice","clearTimeout","remove","removeEventListener","reposition","anchorRect","getBoundingClientRect","position","isRtl","find","requestAnimationFrame","isConnected","querySelector"],"sources":["../../src/plugins/shared/PopupManager.ts"],"sourcesContent":["/**\n * Central popup lifecycle manager. Handles creation, positioning,\n * click-outside closing, Escape key, focus restoration, and popup stacking\n * for submenus/nested popups.\n */\n\nimport { isRtlContext } from '../../platform/Platform.js';\nimport { ServiceKey } from '../Plugin.js';\nimport {\n\ttype PopupPosition,\n\tappendToRoot,\n\tpositionPopup,\n\tpromoteToTopLayer,\n} from './PopupPositioning.js';\n\n// --- Types ---\n\n/** Options for overriding focus restoration when closing a popup. */\nexport interface PopupCloseOptions {\n\t/**\n\t * Override the default focus target on close.\n\t * - `HTMLElement` → focus that element instead of `config.restoreFocusTo`\n\t * - `null` → skip focus restoration entirely\n\t * - `undefined` / omitted → use default `config.restoreFocusTo`\n\t */\n\treadonly restoreFocusTo?: HTMLElement | null;\n}\n\nexport interface PopupConfig {\n\treadonly anchor: HTMLElement | DOMRect;\n\treadonly content: (container: HTMLElement, close: (options?: PopupCloseOptions) => void) => void;\n\treadonly className?: string;\n\treadonly ariaRole?: 'menu' | 'listbox' | 'grid' | 'dialog';\n\treadonly ariaLabel?: string;\n\t/** Focus the first control on open. Disable for non-modal previews while editing. */\n\treadonly autoFocus?: boolean;\n\treadonly restoreFocusTo?: HTMLElement;\n\treadonly onClose?: () => void;\n\treadonly position?: PopupPosition;\n\treadonly parent?: PopupHandle;\n\treadonly referenceNode?: Node;\n}\n\nexport interface PopupHandle {\n\tclose(options?: PopupCloseOptions): void;\n\tgetElement(): HTMLElement;\n}\n\nexport interface PopupServiceAPI {\n\topen(config: PopupConfig): PopupHandle;\n\tclose(): void;\n\tcloseAll(): void;\n\tisOpen(): boolean;\n}\n\nexport const PopupServiceKey = new ServiceKey<PopupServiceAPI>('popup');\n\n// --- Internal Entry ---\n\ninterface PopupEntry {\n\treadonly element: HTMLElement;\n\treadonly config: PopupConfig;\n\treadonly clickOutsideHandler: (e: MouseEvent) => void;\n\treadonly parent: PopupEntry | null;\n\tlistenerRegistrationTimer: ReturnType<typeof setTimeout> | null;\n\tdocumentListenerAttached: boolean;\n}\n\n// --- Manager ---\n\nexport class PopupManager implements PopupServiceAPI {\n\tprivate readonly stack: PopupEntry[] = [];\n\tprivate readonly referenceNode: Node;\n\n\tconstructor(referenceNode: Node) {\n\t\tthis.referenceNode = referenceNode;\n\t}\n\n\t/** Opens a popup with the given configuration. Returns a handle for closing it. */\n\topen(config: PopupConfig): PopupHandle {\n\t\tconst popup: HTMLDivElement = document.createElement('div');\n\t\tpopup.className = config.className ? `notectl-popup ${config.className}` : 'notectl-popup';\n\n\t\tif (config.ariaRole) {\n\t\t\tpopup.setAttribute('role', config.ariaRole);\n\t\t}\n\t\tif (config.ariaLabel) {\n\t\t\tpopup.setAttribute('aria-label', config.ariaLabel);\n\t\t}\n\n\t\tconst parentEntry: PopupEntry | null = config.parent\n\t\t\t? this.findEntryByHandle(config.parent)\n\t\t\t: null;\n\n\t\tlet entry!: PopupEntry;\n\t\tconst handle: PopupHandle = {\n\t\t\tclose: (options?: PopupCloseOptions) => this.closeEntry(entry, options),\n\t\t\tgetElement: () => popup,\n\t\t};\n\n\t\tconst clickOutsideHandler = (e: MouseEvent): void => {\n\t\t\tconst path: EventTarget[] = e.composedPath();\n\t\t\tif (path.includes(popup)) return;\n\n\t\t\t// Don't close if click is inside any ancestor popup in the stack\n\t\t\tfor (const stackEntry of this.stack) {\n\t\t\t\tif (path.includes(stackEntry.element)) return;\n\t\t\t}\n\n\t\t\t// Don't close if click is on the anchor element\n\t\t\tif (config.anchor instanceof HTMLElement && path.includes(config.anchor)) return;\n\n\t\t\tthis.closeEntry(entry);\n\t\t};\n\n\t\tentry = {\n\t\t\telement: popup,\n\t\t\tconfig,\n\t\t\tclickOutsideHandler,\n\t\t\tparent: parentEntry,\n\t\t\tlistenerRegistrationTimer: null,\n\t\t\tdocumentListenerAttached: false,\n\t\t};\n\n\t\tthis.stack.push(entry);\n\n\t\ttry {\n\t\t\tconfig.content(popup, (options?: PopupCloseOptions) => this.closeEntry(entry, options));\n\t\t} catch (error) {\n\t\t\tthis.removeEntry(entry);\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!this.stack.includes(entry)) {\n\t\t\treturn handle;\n\t\t}\n\n\t\tconst refNode: Node = config.referenceNode ?? this.referenceNode;\n\t\tappendToRoot(popup, refNode);\n\t\t// Promote to the top layer before measuring/positioning so the popup\n\t\t// escapes any ancestor stacking context in the host page.\n\t\tpromoteToTopLayer(popup);\n\n\t\tthis.positionEntry(entry);\n\n\t\tentry.listenerRegistrationTimer = setTimeout(() => {\n\t\t\tentry.listenerRegistrationTimer = null;\n\t\t\tif (!this.stack.includes(entry)) return;\n\t\t\tdocument.addEventListener('mousedown', clickOutsideHandler);\n\t\t\tentry.documentListenerAttached = true;\n\t\t}, 0);\n\n\t\tif (config.autoFocus !== false) this.focusFirstItem(popup);\n\n\t\treturn handle;\n\t}\n\n\t/** Closes the topmost popup in the stack. */\n\tclose(): void {\n\t\tconst top: PopupEntry | undefined = this.stack[this.stack.length - 1];\n\t\tif (top) {\n\t\t\tthis.closeEntry(top);\n\t\t}\n\t}\n\n\t/** Closes all open popups. */\n\tcloseAll(): void {\n\t\twhile (this.stack.length > 0) {\n\t\t\tconst top: PopupEntry | undefined = this.stack[this.stack.length - 1];\n\t\t\tif (top) {\n\t\t\t\tthis.closeEntry(top);\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Returns true if any popup is currently open. */\n\tisOpen(): boolean {\n\t\treturn this.stack.length > 0;\n\t}\n\n\t/** Cleans up all popups and event listeners. */\n\tdestroy(): void {\n\t\tthis.closeAll();\n\t}\n\n\t// --- Internal ---\n\n\tprivate closeEntry(entry: PopupEntry, options?: PopupCloseOptions): void {\n\t\tconst index: number = this.stack.indexOf(entry);\n\t\tif (index === -1) return;\n\n\t\t// Close all child popups first (anything above this entry in the stack)\n\t\twhile (this.stack.length > index + 1) {\n\t\t\tconst child: PopupEntry | undefined = this.stack[this.stack.length - 1];\n\t\t\tif (child) {\n\t\t\t\tthis.removeEntry(child);\n\t\t\t}\n\t\t}\n\n\t\tthis.removeEntry(entry);\n\n\t\tif (options !== undefined && 'restoreFocusTo' in options) {\n\t\t\toptions.restoreFocusTo?.focus();\n\t\t} else if (entry.config.restoreFocusTo) {\n\t\t\tentry.config.restoreFocusTo.focus();\n\t\t}\n\t\tentry.config.onClose?.();\n\t}\n\n\tprivate removeEntry(entry: PopupEntry): void {\n\t\tconst index: number = this.stack.indexOf(entry);\n\t\tif (index === -1) return;\n\n\t\tthis.stack.splice(index, 1);\n\t\tif (entry.listenerRegistrationTimer !== null) {\n\t\t\tclearTimeout(entry.listenerRegistrationTimer);\n\t\t\tentry.listenerRegistrationTimer = null;\n\t\t}\n\t\tentry.element.remove();\n\t\tif (entry.documentListenerAttached) {\n\t\t\tdocument.removeEventListener('mousedown', entry.clickOutsideHandler);\n\t\t\tentry.documentListenerAttached = false;\n\t\t}\n\t}\n\n\t/** Re-anchors an open popup after its anchor moved, for example through scrolling or resizing. */\n\treposition(handle: PopupHandle): void {\n\t\tconst entry: PopupEntry | null = this.findEntryByHandle(handle);\n\t\tif (entry) this.positionEntry(entry);\n\t}\n\n\tprivate positionEntry(entry: PopupEntry): void {\n\t\tconst config: PopupConfig = entry.config;\n\t\tconst anchorRect: DOMRect =\n\t\t\tconfig.anchor instanceof HTMLElement ? config.anchor.getBoundingClientRect() : config.anchor;\n\t\tpositionPopup(entry.element, anchorRect, {\n\t\t\tposition: config.position ?? 'below-start',\n\t\t\tisRtl: this.isRtlContext(),\n\t\t});\n\t}\n\n\tprivate findEntryByHandle(handle: PopupHandle): PopupEntry | null {\n\t\tconst element: HTMLElement = handle.getElement();\n\t\treturn this.stack.find((e) => e.element === element) ?? null;\n\t}\n\n\t/** Detects whether the editor context is RTL from the computed style. */\n\tprivate isRtlContext(): boolean {\n\t\tif (this.referenceNode instanceof HTMLElement) {\n\t\t\treturn isRtlContext(this.referenceNode);\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate focusFirstItem(popup: HTMLElement): void {\n\t\trequestAnimationFrame(() => {\n\t\t\tif (!popup.isConnected) return;\n\t\t\tconst firstFocusable: HTMLElement | null =\n\t\t\t\tpopup.querySelector('[role=\"menuitem\"]') ??\n\t\t\t\tpopup.querySelector('[role=\"option\"]') ??\n\t\t\t\tpopup.querySelector('[role=\"gridcell\"]') ??\n\t\t\t\t// `input, textarea` returns whichever comes first in the DOM, so a\n\t\t\t\t// popup whose primary field is a textarea (e.g. the formula editor's\n\t\t\t\t// LaTeX field) focuses that rather than a later text input.\n\t\t\t\tpopup.querySelector('input, textarea') ??\n\t\t\t\tpopup.querySelector('button');\n\t\t\tfirstFocusable?.focus();\n\t\t});\n\t}\n}\n"],"mappings":"Y,+IAuDA,IAAaK,EAAkB,IAAIL,EAA4B,SAelDM,EAAb,MACCC,MAAuC,GACvCC,cAEA,WAAAC,CAAYD,GACXE,KAAKF,cAAgBA,CACtB,CAGA,IAAAG,CAAKC,GACJ,MAAMC,EAAwBC,SAASC,cAAc,OACrDF,EAAMG,UAAYJ,EAAOI,UAAY,iBAAiBJ,EAAOI,YAAc,gBAEvEJ,EAAOK,UACVJ,EAAMK,aAAa,OAAQN,EAAOK,UAE/BL,EAAOO,WACVN,EAAMK,aAAa,aAAcN,EAAOO,WAGzC,MAAMC,EAAiCR,EAAOS,OAC3CX,KAAKY,kBAAkBV,EAAOS,QAC9B,KAEH,IAAIE,EACJ,MAAMC,EAAsB,CAC3BC,MAAQC,GAAgChB,KAAKiB,WAAWJ,EAAOG,GAC/DE,WAAA,IAAkBf,GAGbgB,EAAuBC,IAC5B,MAAMC,EAAsBD,EAAEE,eAC9B,IAAID,EAAKE,SAASpB,GAAlB,CAGA,IAAK,MAAMqB,KAAcxB,KAAKH,MAC7B,GAAIwB,EAAKE,SAASC,EAAWC,SAAU,OAIpCvB,EAAOwB,kBAAkBC,aAAeN,EAAKE,SAASrB,EAAOwB,SAEjE1B,KAAKiB,WAAWJ,EAVU,GAa3BA,EAAQ,CACPY,QAAStB,EACTD,SACAiB,sBACAR,OAAQD,EACRkB,0BAA2B,KAC3BC,0BAA0B,GAG3B7B,KAAKH,MAAMiC,KAAKjB,GAEhB,IACCX,EAAO6B,QAA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C,QAE7BpC,EAAMX,OAAOgD,WAjBK,CAkBnB,CAEA,WAAAjB,CAAoBpB,GACnB,MAAMgC,EAAgB7C,KAAKH,MAAMiD,QAAQjC,IAC3B,IAAVgC,IAEJ7C,KAAKH,MAAMsD,OAAON,EAAO,GACe,OAApChC,EAAMe,4BACTwB,aAAavC,EAAMe,2BACnBf,EAAMe,0BAA4B,MAEnCf,EAAMY,QAAQ4B,SACVxC,EAAMgB,2BACTzB,SAASkD,oBAAoB,YAAazC,EAAMM,qBAChDN,EAAMgB,0BAA2B,GAEnC,CAGA,UAAA0B,CAAWzC,GACV,MAAMD,EAA2Bb,KAAKY,kBAAkBE,GACpDD,GAAOb,KAAKmC,cAActB,EAC/B,CAEA,aAAAsB,CAAsBtB,GACrB,MAAMX,EAAsBW,EAAMX,OAC5BsD,EACLtD,EAAOwB,kBAAkBC,YAAczB,EAAOwB,OAAO+B,wBAA0BvD,EAAOwB,OACvFjC,EAAcoB,EAAMY,QAAS+B,EAAY,CACxCE,SAAUxD,EAAOwD,UAAY,cAC7BC,MAAO3D,KAAKT,gBAEd,CAEA,iBAAAqB,CAA0BE,GACzB,MAAMW,EAAuBX,EAAOI,aACpC,OAAOlB,KAAKH,MAAM+D,KAAMxC,GAAMA,EAAEK,UAAYA,IAAY,IACzD,CAGA,YAAAlC,GACC,OAAIS,KAAKF,yBAAyB6B,aAC1BpC,EAAaS,KAAKF,cAG3B,CAEA,cAAAyC,CAAuBpC,GACtB0D,sBAAA,KACM1D,EAAM2D,cAEV3D,EAAM4D,cAAc,sBACpB5D,EAAM4D,cAAc,oBACpB5D,EAAM4D,cAAc,sBAIpB5D,EAAM4D,cAAc,oBACpB5D,EAAM4D,cAAc,YACLd,SAElB,U"}
@@ -1,2 +0,0 @@
1
- import{i as t,o as e,r as n}from"./HTMLUtils-DTpsjZyK.mjs";import{a as o,d as r,f as s,h as i,i as a,n as c,r as l,s as u,v as d}from"./ThemeEngine-kIXtSRkI.mjs";import{n as f}from"./HTMLSanitization-Ce9dVT1q.mjs";import{c as p,o as h}from"./PluginHelpers-B3gk3VB3.mjs";import{i as m,l as g,n as y,s as b}from"./StyleRuntime-C0RSqKzG.mjs";import{t as v}from"./ShortcutFormatting-TwiufqeV.mjs";var $={label:"Print",tooltip:t=>`Print (${t})`,printingAnnouncement:"Printing"},S=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-Uzo1Azdw.mjs"),"./locales/de.ts":()=>import("./de-DcMhfRBu.mjs"),"./locales/es.ts":()=>import("./es-BJHF95J_.mjs"),"./locales/fr.ts":()=>import("./fr-KXmbys88.mjs"),"./locales/hi.ts":()=>import("./hi-l6DA-aOw.mjs"),"./locales/pt.ts":()=>import("./pt-C8sOyw0V.mjs"),"./locales/ru.ts":()=>import("./ru-B1m8J9dl.mjs"),"./locales/zh.ts":()=>import("./zh-dGSDBBzb.mjs")});async function w(t){return p(S,t,$)}var T=["h1","h2","h3","h4","h5","h6","p","div","span","br","hr","strong","b","em","i","u","s","sub","sup","small","ul","ol","li","table","thead","tbody","tr","th","td","img"],k=["style","class","src","alt","width","height","colspan","rowspan"];function C(t){const e="function"==typeof t?t():t;return f(e,{ALLOWED_TAGS:[...T],ALLOWED_ATTR:[...k]})}var j=/* @__PURE__ */new Set(["AREA","BASE","BR","COL","EMBED","HR","IMG","INPUT","LINK","META","PARAM","SOURCE","TRACK","WBR"]),A=/* @__PURE__ */new Set(["TABLE","THEAD","TBODY","TFOOT","TR"]),L=/* @__PURE__ */new Set(["AUDIO","CANVAS","EMBED","IFRAME","IMG","INPUT","METER","OBJECT","PROGRESS","SELECT","TEXTAREA","VIDEO"]);function E(t,e){let n;do{n=`${t}-${crypto.randomUUID()}`}while(e.has(n));return e.add(n),n}function x(t){const e=/* @__PURE__ */new Map;t.matches("[data-block-id][id]")&&""!==t.id&&e.set(t.id,t);for(const n of t.querySelectorAll("[data-block-id][id]")){const t=n.id;""===t||e.has(t)||e.set(t,n)}return e}function M(t,n){for(const o of e(n)){const e=t.get(o);if(e)return e}}function R(t,e,n,o){const r=E("notectl-print-destination",n),s=E("notectl-print-destination-slot",o),i=e.createElement("slot");i.name=s,i.setAttribute("data-notectl-print-destination-slot",""),function(t,e){if(j.has(t.tagName)||L.has(t.tagName))t.before(e);else{if(A.has(t.tagName)){const n=t.querySelector("th, td");if(n)return void n.insertBefore(e,n.firstChild);const o=t.closest("table");if(o?.parentNode)return void o.before(e)}t.insertBefore(e,t.firstChild)}}(t,i);const a=e.createElement("a");return a.id=r,a.setAttribute("href",`#${r}`),a.slot=s,a.tabIndex=-1,a.setAttribute("aria-hidden","true"),a.setAttribute("data-notectl-print-destination",""),function(t){for(const[e,n]of Object.entries({all:"initial",display:"block",position:"absolute",width:"0",height:"0",margin:"0",padding:"0",border:"0",overflow:"hidden","pointer-events":"none","font-size":"0","line-height":"0",color:"transparent",background:"transparent"}))t.style.setProperty(e,n,"important")}(a),{id:r,marker:a}}var B="notectl-host";function N(t){const e=Array.from(t.styleSheets),n=t.adoptedStyleSheets;return n&&e.push(...n),e}function H(t,e){const n=t[e]??'"';let o=e+1;for(;o<t.length;){const e=t[o]??"";if("\\"!==e){if(e===n)return o+1;o++}else o+=2}return t.length}function z(t,e){if("url("!==t.slice(e,e+4).toLowerCase())return!1;const n=e>0?t[e-1]??"":"";return!/[\w-]/.test(n)}function P(t,e){let n=e+4;for(;n<t.length&&/\s/.test(t[n]??"");)n++;const o=t[n]??"";let r;if('"'===o||"'"===o){const e=H(t,n);r=t.slice(n+1,e-1),n=e}else{const e=t.indexOf(")",n);if(-1===e)return null;r=t.slice(n,e).trim(),n=e}for(;n<t.length&&/\s/.test(t[n]??"");)n++;return")"!==t[n]?null:{end:n+1,url:(s=r,s.replace(/\\([0-9a-f]{1,6}\s?|[\s\S])/gi,(t,e)=>{const n=e.trim();if(/^[0-9a-f]{1,6}$/i.test(n)){const t=Number.parseInt(n,16);return t>0&&t<=1114111?String.fromCodePoint(t):"�"}return e}))};var s}function D(t,e,n){if(!e||!function(t){return!t.startsWith("#")&&!t.startsWith("//")&&!/^[a-z][a-z0-9+.-]*:/i.test(t)}(e))return t;try{return`url("${new URL(e,n).href}")`}catch{return t}}function q(t,e){if(!t.toLowerCase().includes("url("))return t;let n="",o=0;for(;o<t.length;){const r=t[o]??"";if('"'===r||"'"===r){const e=H(t,o);n+=t.slice(o,e),o=e;continue}if(z(t,o)){const r=P(t,o);if(r){n+=D(t.slice(o,r.end),r.url,e),o=r.end;continue}}n+=r,o++}return n}function I(t){return t.anonymousLayerCount+=1,`notectl-anonymous-${t.anonymousLayerCount}`}var O={media:[],layers:[],supports:[]};function U(t,e,n,o){const r=e.trim(),s=o?.trim()??"";return{media:r&&"all"!==r?[...t.media,r]:t.media,layers:null===n?t.layers:[...t.layers,""===n?null:n],supports:s?[...t.supports,s]:t.supports}}function W(t,e,n){const o=[B];for(const c of n.layers)o.push(c??I(t));const r=0===(s=n.supports).length?"":1===s.length?` supports(${s[0]})`:` supports(${s.map(t=>`(${t})`).join(" and ")})`;var s;const i=n.media.length?` ${n.media.join(" and ")}`:"";var a;t.segments.push({kind:"import",statement:`@import url("${a=e,a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}") layer(${o.join(".")})${r}${i};`})}function V(t,e){const n=e.trim();return n&&"all"!==n?`@media ${n} {\n${t}\n}`:t}function F(t,e){if(e.seen.has(t))return;if(e.seen.add(t),t.disabled)return;const n=U(O,t.media.mediaText,null,null);let o;try{o=t.cssRules}catch{return void(t.href&&W(e,t.href,n))}const r=t.href??e.baseURL,s=[];for(const a of o)3!==a.type?s.push(q(a.cssText,r)):G(a,e,s,n);const i=s.join("\n");i&&function(t,e){const n=t.segments[t.segments.length-1];"rules"!==n?.kind?t.segments.push({kind:"rules",css:e}):t.segments[t.segments.length-1]={kind:"rules",css:`${n.css}\n${e}`}}(e,V(i,t.media.mediaText))}function G(t,e,n,o){const r=t.layerName??null,s=t.supportsText??null,i=U(o,t.media.mediaText,r,s),a=t.styleSheet;if(a&&!e.seen.has(a)){let o;try{o=a.cssRules}catch{o=null}if(o){e.seen.add(a);const c=a.href??e.baseURL,l=[];for(const t of o)3!==t.type?l.push(q(t.cssText,c)):G(t,e,l,i);let u=l.join("\n");return void(u&&(null!==r&&(u=""===r?`@layer {\n${u}\n}`:`@layer ${r} {\n${u}\n}`),s?.trim()&&(u=`@supports (${s.trim()}) {\n${u}\n}`),n.push(V(u,t.media.mediaText))))}}const c=a?.href??t.href;c&&W(e,c,i)}var K="notectl-print",Y="notectl-custom";function _(t){return t.replace(/;$/gm," !important;")}function J(t){return _(c(u).replace(":host {",`${t} {`))}function X(t,e){const n=getComputedStyle(t),o=[];for(let r=0;r<n.length;r++){const t=n[r]??"";if(t.startsWith("--notectl-")){const e=n.getPropertyValue(t).trim();e&&o.push(` ${t}: ${e};`)}}return 0===o.length?"":`${e} {\n${o.join("\n")}\n}`}var Q=["","transparent","rgba(0, 0, 0, 0)"];function Z(t){let e=t;for(;e;){const t=getComputedStyle(e).getPropertyValue("background-color").trim();if(!Q.includes(t))return t;const n=e.getRootNode();e=e.parentElement??(n instanceof ShadowRoot?n.host:null)}return"#ffffff"}function tt(t,e,n="#ffffff",o="body"){const r=getComputedStyle(t),s=["font-family","font-size","font-weight","line-height","letter-spacing","word-spacing","color"],i=[" margin: 0;",` background: ${n};`];for(const a of s){if("color"===a&&e){i.push(` color: ${e};`);continue}const t=r.getPropertyValue(a).trim();t&&i.push(` ${a}: ${t};`)}return`${o} {\n${i.join("\n")}\n}`}var et=["display: block","position: static","inset: auto","width: auto","height: auto","min-width: 0","min-height: 0","max-width: none","max-height: none","margin: 0","padding: 0","border: none","border-radius: 0","outline: none","box-shadow: none","background: transparent","overflow: visible","transform: none","filter: none","opacity: 1","contain: none","float: none","visibility: visible","clip: auto","clip-path: none","content-visibility: visible"],nt=["display: block","visibility: visible","opacity: 1","position: static","height: auto","min-height: 0","max-height: none","overflow: visible","transform: none","filter: none","contain: none","clip: auto","clip-path: none","content-visibility: visible"];function ot(t){return[`${t} {`,...et.map(t=>` ${t} !important;`),"}"].join("\n")}function rt(t,e,n){const o=t.tagName.toLowerCase(),r=[],s=!1!==n.forceLightTheme,a=[ot(o),["html, body {",...nt.map(t=>` ${t} !important;`),"}"].join("\n")];if(s&&a.push(J(`:root, ${o}`)),!1!==n.printBackground&&a.push("* {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n}"),r.push(`@layer ${K} {\n${a.join("\n\n")}\n}`),!s){const e=X(t,`:root, ${o}`);e&&r.push(e)}const c=s?u.primitives.foreground:void 0,l=s?"#ffffff":Z(e);r.push(tt(t,c,l));const d=function(t){const e=[];if(t.margin?e.push(` margin: ${t.margin};`):t.paperSize&&e.push(" margin: 0;"),t.paperSize||t.orientation){const n=[t.paperSize?i(t.paperSize):"A4"];t.orientation&&n.push(t.orientation),e.push(` size: ${n.join(" ")};`)}return 0===e.length?"":`@page {\n${e.join("\n")}\n}`}(n);return d&&r.push(d),n.customCSS&&(r.push(n.customCSS),r.push(`@layer ${Y} {\n${n.customCSS}\n}`)),r.join("\n\n")}function st(t,e,n,o){const r=`${t.tagName.toLowerCase()}[${o}]`,s=!1!==n.forceLightTheme,i=[ot(r)];s&&i.push(J(r)),!1!==n.printBackground&&i.push(`${r}, ${r} * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n}`);const a=s?u.primitives.foreground:void 0,c=s?"#ffffff":Z(e);i.push(_(tt(t,a,c,r)));const l=[`@layer ${K} {\n${i.join("\n\n")}\n}`];if(!s){const e=X(t,r);e&&l.push(e)}return l.join("\n\n")}var it="data-notectl-print-fallback",at=["(function () {"," var head = document.head;"," if (head && head.querySelector('meta[name=\"notectl-print-export\"]')) {"," var bundles = document.querySelectorAll('template[data-notectl-print-styles]');"," for (var b = 0; b < bundles.length; b++) {"," if (bundles[b].content) head.appendChild(bundles[b].content);"," bundles[b].parentNode.removeChild(bundles[b]);"," }"," }"," var statics = document.querySelectorAll('[data-notectl-static]');"," for (var i = 0; i < statics.length; i++) {"," var host = statics[i];"," if (!host.shadowRoot && host.attachShadow) {"," for (var j = 0; j < host.children.length; j++) {"," var child = host.children[j];"," if (child.tagName !== 'TEMPLATE') continue;"," if (!child.getAttribute('shadowrootmode') || !child.content) continue;"," host.attachShadow({ mode: 'open' }).appendChild(child.content);"," host.removeChild(child);"," break;"," }"," }"," if (!host.shadowRoot) continue;"," var fallbacks = host.querySelectorAll('[data-notectl-print-fallback]');"," for (var k = 0; k < fallbacks.length; k++) {"," fallbacks[k].parentNode.removeChild(fallbacks[k]);"," }"," }","})();"].join("\n");function ct(t){return t.replace(/<\//g,"<\\/")}function lt(t,e){const o=[];for(const r of Array.from(t.attributes))e(r.name)&&o.push(""===r.value?r.name:`${r.name}="${n(r.value)}"`);return o.length>0?` ${o.join(" ")}`:""}function ut(t){return t?lt(t,t=>"class"===t||t.startsWith("data-")):""}function dt(t){const e=function(t){if(!(t instanceof HTMLElement))return"";const e=[];for(let n=0;n<t.style.length;n++){const o=t.style[n]??"";if(!o.startsWith("--notectl-"))continue;const r=t.style.getPropertyValue(o).trim();r&&e.push(`${o}: ${r}`)}return e.join("; ")}(t);return e?` style="${n(e)}"`:""}function ft(e){const o=e.host.ownerDocument,r=e.host.tagName.toLowerCase(),s="export"===e.variant,i=s?["style","id",d]:["style",d],a=(c=e.host,l=i,lt(c,t=>!l.includes(t)));var c,l;const u=e.carryThemeContext?dt(e.host):"",f=e.carryThemeContext?ut(o.documentElement)+dt(o.documentElement):"",p=e.carryThemeContext?ut(o.body)+dt(o.body):"",h=e.styleNonce?` nonce="${n(e.styleNonce)}"`:"",m=['<meta charset="utf-8">',`<title>${t(e.title)}</title>`];s&&m.push('<meta name="notectl-print-export">'),m.push(`<style${h}>@layer ${Y}, ${K}, ${B};</style>`),m.push(`<style${h}>${ct(e.documentCSS)}</style>`);const g=e.hostSegments.map(t=>{const e="import"===t.kind?t.statement:`@layer ${B} {\n${t.css}\n}`;return`<style${h}>${ct(e)}</style>`});s||m.push(...g);const y=s?`<template data-notectl-print-styles><style>${ct(e.standaloneCSS)}</style>${g.join("")}</template>`:"",b=s?`<div ${it}><style>@scope ([${it}]) {\n${ct(e.shadowCSS)}\n}</style>${e.fallbackContentHTML}</div>`:"",v=s?`<script>${at}<\/script>`:"",$=[`<${r}${a}${u} ${d}>`,'<template shadowrootmode="open">',`<style${h}>${ct(e.shadowCSS)}</style>`,e.contentHTML,"</template>",...b?[b]:[],...e.destinationMarkersHTML?[e.destinationMarkersHTML]:[],`</${r}>`,...y?[y]:[],...v?[v]:[]];return["<!DOCTYPE html>",`<html lang="${n(e.lang)}"${f}>`,"<head>",...m,"</head>",`<body${p}>`,...$,"</body>","</html>"].join("\n")}function pt(t,e,n,o){const r=/* @__PURE__ */new Set;function s(t){return t??{}}function i(r){const s={options:r,cancelled:!1};if(o.emit(a,s),s.cancelled)return null;const i=s.options,c=function(t,e){const n=[],o=function(t){const e=[],n=[];for(const o of t.adoptedStyleSheets){const t=m(o)?n:e;for(const e of o.cssRules)t.push(e.cssText)}return{base:e.join("\n"),runtime:n.join("\n")}}(t);o.base&&n.push(`@layer notectl-base {\n${o.base}\n}`),o.runtime&&n.push(o.runtime);const r=function(t){const e=[];e.push(".notectl-content { height: auto !important; max-height: none !important; min-height: 0 !important; overflow: visible !important; }"),t.paperSize&&e.push(".notectl-content { padding: 48px 56px !important; }");const n=[];return n.push("[data-notectl-no-print] { display: none !important; }"),n.push(".notectl-code-block { white-space: pre-wrap !important; word-break: break-all !important; page-break-inside: avoid; }"),n.push("img { page-break-inside: avoid; }"),n.push(".notectl-table { break-inside: avoid; }"),!1!==t.printBackground&&n.push("* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }"),e.push(`@media print {\n ${n.join("\n ")}\n}`),e.join("\n\n")}(e);return r&&n.push(r),e.customCSS&&n.push(e.customCSS),n.join("\n\n")}(t,i),u=function(t){const e={segments:[],seen:/* @__PURE__ */new Set,baseURL:t.ownerDocument.baseURI??"",anonymousLayerCount:0};for(const n of function(t){const e=[];let n=t.getRootNode();for(;n instanceof ShadowRoot;)e.push(n),n=n.host.getRootNode();return e.push(t.ownerDocument),e.reverse()}(t))for(const t of N(n))F(t,e);return e.segments}(e),f=function(t,e){const n=function(t){return(t.querySelector(".notectl-content")??t).cloneNode(!0)}(t);return function(t){t.removeAttribute("contenteditable");for(const e of["notectl-node-selected","notectl-content--empty","notectl-table-cell--selected"]){t.classList.remove(e);for(const n of t.querySelectorAll(`.${e}`))n.classList.remove(e)}t.removeAttribute("data-placeholder")}(n),function(t,e){if(e.excludeBlockTypes)for(const n of e.excludeBlockTypes){const e=t.querySelectorAll(`[data-block-type="${n}"]`);for(const t of e)t.remove()}if(e.pageBreakBefore)for(const n of e.pageBreakBefore){const e=t.querySelectorAll(`[data-block-type="${n}"]`);for(const t of e)b(t,{breakBefore:"page",pageBreakBefore:"always"})}}(n,e),function(t,e){if(e.header){const n=document.createElement("div");n.className="notectl-print-header",n.innerHTML=C(e.header),t.insertBefore(n,t.firstChild)}if(e.footer){const n=document.createElement("div");n.className="notectl-print-footer",n.innerHTML=C(e.footer),t.appendChild(n)}}(n,e),n}(n,i),p=f.cloneNode(!0);!function(t){const e=x(t);if(0===e.size)return;const n=/* @__PURE__ */new Set;""!==t.id&&n.add(t.id);for(const r of t.querySelectorAll("[id]"))n.add(r.id);const o=/* @__PURE__ */new Map;for(const r of function(t){const e=[];return t.matches("[data-block-id][id]")&&""!==t.id&&e.push(t),e.push(...t.querySelectorAll("[data-block-id][id]")),e}(t)){const t=E("notectl-print-fallback-destination",n);o.set(r,t),r.id=t}for(const r of t.querySelectorAll("a[href]")){const t=M(e,r.getAttribute("href")??""),n=t?o.get(t):void 0;n&&r.setAttribute("href",`#${n}`)}}(p);const h=p.outerHTML,g=function(t){const e=x(t);if(0===e.size)return{markers:[]};const n=t.ownerDocument,o=/* @__PURE__ */new Set;""!==t.id&&o.add(t.id);for(const a of t.querySelectorAll("[id]"))o.add(a.id);const r=/* @__PURE__ */new Set;for(const a of t.querySelectorAll("slot[name]"))r.add(a.name);const s=/* @__PURE__ */new Map,i=[];for(const a of t.querySelectorAll("a[href]")){const t=a.getAttribute("href")??"";if(!t.startsWith("#"))continue;const c=M(e,t);if(!c)continue;let l=s.get(c);l||(l=R(c,n,o,r),s.set(c,l),i.push(l.marker)),a.setAttribute("href",`#${l.id}`)}return{markers:i}}(f),y=f.outerHTML,v=g.markers.map(t=>t.outerHTML).join(""),$=i.title??"",S=e.ownerDocument,w=e.closest("[lang]")?.getAttribute("lang")??(S.documentElement.lang||"en"),T={documentCSS:st(e,n,i,d),standaloneCSS:rt(e,n,i),hostSegments:u,shadowCSS:c,host:e,contentHTML:y,fallbackContentHTML:h,destinationMarkersHTML:v,title:$,lang:w,carryThemeContext:!1===i.forceLightTheme,variant:"export"},k=ft(T),j={html:k};return o.emit(l,j),{html:k,input:T}}return{print(t){const e=i(s(t));if(!e)return;const o=ft({...e.input,documentCSS:e.input.standaloneCSS,variant:"internal",styleNonce:y(n)}),a=document.createElement("iframe");g(a,"position:fixed;left:-9999px;width:0;height:0;border:none"),document.body.appendChild(a);const c=a.contentDocument,l=a.contentWindow;if(!c||!l)return void document.body.removeChild(a);c.open(),c.write(o),c.close();const u=()=>{a.remove()},d=()=>{l.addEventListener("afterprint",u,{once:!0}),l.print()};if("complete"===c.readyState)return void d();let f=!1;const p=()=>{f||(f=!0,r.delete(h),window.clearTimeout(m),d())},h=()=>{f=!0,window.clearTimeout(m),l.removeEventListener("load",p),a.remove()},m=window.setTimeout(p,4e3);r.add(h),l.addEventListener("load",p,{once:!0})},toHTML:t=>i(s(t))?.html??"",dispose(){for(const t of r)t();r.clear()}}}var ht={print(){},toHTML:()=>"",dispose(){}},mt=class{id="print";name="Print";config;service=null;locale;constructor(t){this.config=t??{}}async init(t){this.locale=await h(t,this.config.locale,$,w);const e=t.getContainer(),n=e.getRootNode();if(n instanceof ShadowRoot){const o=n.host,r=t.getEventBus();this.service=pt(n,o,e,r)}else this.service=ht;t.registerService(o,this.service);const r=this.config.defaults??{},s=this.service,i=this.locale;t.registerCommand("print",()=>(t.announce(i.printingAnnouncement),s.print(r),!0));const a=this.config.keyBinding??"Mod-P";if(t.registerKeymap({[a]:()=>(t.executeCommand("print"),!0)}),!1!==this.config.showToolbarItem){const e=v(a);t.registerToolbarItem({id:"print",group:"actions",label:this.locale.label,tooltip:this.locale.tooltip(e),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>',command:"print"})}}destroy(){this.service?.dispose(),this.service=null}};export{$ as n,w as r,mt as t};
2
- //# sourceMappingURL=PrintPlugin-DAEiEyKQ.mjs.map
@@ -1,2 +0,0 @@
1
- import{i as o}from"./TypeBrands-Ch9856Gb.mjs";import{i as r,t as e}from"./MarkCommands-C0ps9h0z.mjs";import{n as t}from"./PluginHelpers-B3gk3VB3.mjs";function a(a,m){const i=o(m.markSpec.type);a.registerMarkSpec(m.markSpec),a.registerCommand(m.command,()=>t(a,r(a.getState(),i))),m.keyBinding&&a.registerKeymap({[m.keyBinding]:()=>a.executeCommand(m.command)}),m.toolbar&&a.registerToolbarItem({id:m.toolbar.id,group:m.toolbar.group,icon:m.toolbar.icon,label:m.toolbar.label,tooltip:m.toolbar.tooltip,command:m.command,isActive:o=>e(o,i)})}export{a as t};
2
- //# sourceMappingURL=SimpleMark-D6vz3Nfd.mjs.map
@@ -1,2 +0,0 @@
1
- import{E as t,_ as e,k as n,p as o}from"./Document-ssR6hBzG.mjs";import{n as s}from"./Selection-DC6AOGgF.mjs";import{a as c}from"./TypeBrands-Ch9856Gb.mjs";import{s as i}from"./BlockInsertion-CXfXqUZl.mjs";import{n as r}from"./TypedKeys-CA4bfw9O.mjs";import{c as a,o as l}from"./PluginHelpers-B3gk3VB3.mjs";import{n as d,t as u}from"./SelectionReplacement-vC1xhFS0.mjs";import{o as h}from"./xml-BsV44TrJ.mjs";import{i as m,o as g,r as f,t as p}from"./XmlSupport-3Za6SIqF.mjs";var x=/\n(?:[ \t]*\n)+/;function k(t,e){return!t.detection&&!e.detection||!(!t.detection||!e.detection)&&t.detection.language===e.detection.language}function j(t,e){const n=`${t.text}\n\n${e.text}`;if(!t.detection&&!e.detection)return{text:n,detection:null};const o=t.detection,s=e.detection;return{text:n,detection:{language:o.language,formattedText:`${o.formattedText}\n\n${s.formattedText}`,confidence:Math.max(o.confidence,s.confidence)}}}var b={detectedAsCodeBlock:t=>`Pasted as ${t} code block with syntax highlighting.`,detectedMixedContent:(t,e,n)=>{const o=[];if(t>0&&o.push(`${t} paragraph${t>1?"s":""}`),e>0){const t=n.join(", ");o.push(`${e} code block${e>1?"s":""} (${t})`)}return`Pasted as ${o.join(" and ")}.`}},C=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-BWOue6jG.mjs"),"./locales/de.ts":()=>import("./de-CTzAMkXC.mjs"),"./locales/es.ts":()=>import("./es-DDoqchUq.mjs"),"./locales/fr.ts":()=>import("./fr-eC0UdAPu.mjs"),"./locales/hi.ts":()=>import("./hi-DY55FuDK.mjs"),"./locales/pt.ts":()=>import("./pt-Bu7Mbz67.mjs"),"./locales/ru.ts":()=>import("./ru-DyCTlhjg.mjs"),"./locales/zh.ts":()=>import("./zh-D1HSmSOf.mjs")});async function B(t){return a(C,t,b)}var S=new r("smartPaste"),y=[g,m,f,p],P=class{id="smart-paste";name="Smart Paste";dependencies=["code-block"];config;detectors=[];context=null;locale=b;constructor(t){this.config={...t}}async init(t){this.context=t,this.locale=await l(t,this.config.locale,b,B);const e=t.getService(h);if(e){for(const t of y){const n=e.get(t.id);e.register(n?{...n,detection:t.detection}:t)}e.onRegister(t=>{t.detection&&this.detectors.push(t.detection)})}if(this.config.detectors)for(const n of this.config.detectors)this.detectors.push(n);t.registerPasteInterceptor(this.handlePaste,{name:"smart-paste",priority:50}),t.registerService(S,{registerDetector:t=>{this.detectors.push(t)}})}destroy(){this.context=null,this.detectors.length=0}handlePaste=(t,e,n)=>{const o=function(t,e){const n=t.split(x).map(t=>t.trim()).filter(t=>t.length>0);if(0===n.length)return null;let o=!1;const s=n.map(t=>{const n=function(t,e){let n=null;for(const o of e){const e=o.detect(t);e&&(null===n||e.confidence>n.confidence||e.confidence===n.confidence&&e.language<n.language)&&(n=e)}return n}(t,e);return n&&(o=!0),{text:t,detection:n}});return o?function(t){if(t.length<=1)return t;const e=[t[0]];for(let n=1;n<t.length;n++){const o=t[n],s=e[e.length-1];k(s,o)?e[e.length-1]=j(s,o):e.push(o)}return e}(s):null}(t,this.detectors);if(!o)return null;const s=n.transaction("paste"),c=d(n,s);if("code_block"===u(c)?.type)return null;const i={builder:s,target:c,selection:n.selection};return 1===o.length&&o[0]?.detection?this.handleSingleCodeBlock(i,o[0].detection):this.handleMixedContent(i,o)};handleSingleCodeBlock(t,e){const n=this.buildCodeBlockTransaction(t,e);return n&&this.context&&this.context.announce(this.locale.detectedAsCodeBlock(e.language)),n}buildCodeBlockTransaction(t,e){const{builder:n,target:o,selection:c}=t,r=this.createCodeBlockNode(e);return i(o.state,n,o.blockId,[r],c,this.context?.getSchemaRegistry())?(n.setSelection(s(r.id,e.formattedText.length)),n.build()):null}handleMixedContent(t,e){const n=this.buildMultiBlockTransaction(t,e);return n&&this.context&&this.announceMixedContent(e),n}buildMultiBlockTransaction(t,e){const{builder:o,selection:c}=t,{state:r,blockId:a}=t.target,l=e.map(t=>t.detection?this.createCodeBlockNode(t.detection):this.createParagraphNode(t.text));if(!i(r,o,a,l,c,this.context?.getSchemaRegistry()))return null;const d=l[l.length-1];return d&&o.setSelection(s(d.id,n(d))),o.build()}createCodeBlockNode(n){return o(c("code_block"),[e(n.formattedText)],t(),{language:n.language,backgroundColor:""})}createParagraphNode(n){return o(c("paragraph"),[e(n)],t())}announceMixedContent(t){let e=0,n=0;const o=[];for(const s of t)s.detection?(n++,o.includes(s.detection.language)||o.push(s.detection.language)):e++;this.context?.announce(this.locale.detectedMixedContent(e,n,o))}};export{B as i,S as n,b as r,P as t};
2
- //# sourceMappingURL=SmartPastePlugin-BHsYKbgd.mjs.map
@@ -1,2 +0,0 @@
1
- import{c as t,o as s}from"./PluginHelpers-B3gk3VB3.mjs";import{t as o}from"./MarkInputRule-DNneF2gp.mjs";import{t as r}from"./ShortcutFormatting-TwiufqeV.mjs";import{t as i}from"./SimpleMark-D6vz3Nfd.mjs";var e={label:"Strikethrough",tooltip:t=>`Strikethrough (${t})`},a=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-XmSFrtmd.mjs"),"./locales/de.ts":()=>import("./de-DViI26lG.mjs"),"./locales/es.ts":()=>import("./es-paXY7HFt.mjs"),"./locales/fr.ts":()=>import("./fr-ZsRdLuys.mjs"),"./locales/hi.ts":()=>import("./hi-CTWubxLY.mjs"),"./locales/pt.ts":()=>import("./pt-paXY7HFt.mjs"),"./locales/ru.ts":()=>import("./ru-Y11wuxOB.mjs"),"./locales/zh.ts":()=>import("./zh-C7iCgCRP.mjs")});async function l(s){return t(a,s,e)}var h={},m=class{id="strikethrough";name="Strikethrough";priority=22;config;locale;constructor(t){this.config={...h,...t}}async init(t){this.locale=await s(t,this.config.locale,e,l),i(t,{markSpec:{type:"strikethrough",rank:3,toDOM:()=>document.createElement("s"),toHTMLString:(t,s)=>`<s>${s}</s>`,parseHTML:[{tag:"s"},{tag:"strike"},{tag:"del"},{tag:"span",getAttrs:t=>!!t.style.textDecoration.includes("line-through")&&{}}],sanitize:{tags:["s"]}},command:"toggleStrikethrough",keyBinding:"Mod-Shift-X",toolbar:{id:"strikethrough",group:"format",icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"/></svg>',label:this.locale.label,tooltip:this.locale.tooltip(r("Mod-Shift-X"))}}),!1!==this.config.inputRule&&t.registerInputRule(o("strikethrough","~~"))}};export{e as n,l as r,m as t};
2
- //# sourceMappingURL=StrikethroughPlugin-v-VJZzUZ.mjs.map
@@ -1,2 +0,0 @@
1
- import{i as s}from"./TypeBrands-Ch9856Gb.mjs";import{i as t,t as e}from"./MarkCommands-C0ps9h0z.mjs";import{c as i,n as r,o,s as p}from"./PluginHelpers-B3gk3VB3.mjs";import{t as c}from"./ShortcutFormatting-TwiufqeV.mjs";var a={superscriptLabel:"Superscript",superscriptTooltip:s=>`Superscript (${s})`,subscriptLabel:"Subscript",subscriptTooltip:s=>`Subscript (${s})`},n=/* #__PURE__ */Object.assign({"./locales/ar.ts":()=>import("./ar-NV_puwI2.mjs"),"./locales/de.ts":()=>import("./de-BX4y4PlH.mjs"),"./locales/es.ts":()=>import("./es-BdpTTRuX.mjs"),"./locales/fr.ts":()=>import("./fr-CKjH6tJI.mjs"),"./locales/hi.ts":()=>import("./hi-DsdXcOB6.mjs"),"./locales/pt.ts":()=>import("./pt-OXa_IR4Q.mjs"),"./locales/ru.ts":()=>import("./ru-d68SZpEe.mjs"),"./locales/zh.ts":()=>import("./zh-BP97XjlS.mjs")});async function l(s){return i(n,s,a)}var u={superscript:!0,subscript:!0},m=[{type:"superscript",opposite:"subscript",configKey:"superscript",rank:4,tag:"sup",icon:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">','<path d="M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z"',' fill="none"/>','<path d="M9.64 7.64c.23-.5.36-1.05.36-1.64'," 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9"," 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83"," 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83",' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z" fill="none"/>','<path d="M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49'," 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02","-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88"," 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34"," 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53"," 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54","-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96"," 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56","-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46",'-.59-.46-.94z"/>','<path d="M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38',' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z"/>',"</svg>"].join(""),keyBinding:"Mod-.",toHTMLString:s=>`<sup>${s}</sup>`,parseHTML:[{tag:"sup"}],sanitize:{tags:["sup"]}},{type:"subscript",opposite:"superscript",configKey:"subscript",rank:4,tag:"sub",icon:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">','<path d="M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49'," 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02","-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88"," 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34"," 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53"," 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54","-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96"," 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56","-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46",'-.59-.46-.94z"/>','<path d="M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38',' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z"/>',"</svg>"].join(""),keyBinding:"Mod-,",toHTMLString:s=>`<sub>${s}</sub>`,parseHTML:[{tag:"sub"}],sanitize:{tags:["sub"]}}],g=class{id="super-sub";name="Superscript & Subscript";priority=23;config;locale;constructor(s){this.config={...u,...s}}async init(s){this.locale=await o(s,this.config.locale,a,l);const t=m.filter(s=>this.config[s.configKey]);for(const e of t)this.registerMark(s,e);this.registerKeymaps(s,t),this.registerExclusivityMiddleware(s,t),this.registerDisabledToolbarItems(s)}registerMark(i,o){const a=p(o.type),n=this.isToolbarVisible(o.configKey);if(i.registerMarkSpec({type:o.type,rank:o.rank,toDOM:()=>document.createElement(o.tag),toHTMLString:(s,t)=>o.toHTMLString(t),parseHTML:o.parseHTML,sanitize:o.sanitize}),i.registerCommand(a,()=>r(i,t(i.getState(),s(o.type)))),n){const t="superscript"===o.type?this.locale.superscriptLabel:this.locale.subscriptLabel,r="superscript"===o.type?this.locale.superscriptTooltip(c(o.keyBinding)):this.locale.subscriptTooltip(c(o.keyBinding));i.registerToolbarItem({id:o.type,group:"format",icon:o.icon,label:t,tooltip:r,command:a,isActive:t=>e(t,s(o.type))})}}registerKeymaps(s,t){const e={};for(const i of t){const t=p(i.type);e[i.keyBinding]=()=>s.executeCommand(t)}Object.keys(e).length>0&&s.registerKeymap(e)}registerExclusivityMiddleware(t,e){e.some(s=>"superscript"===s.type)&&e.some(s=>"subscript"===s.type)&&t.registerMiddleware((t,e,i)=>{let r=!1;const o=[];for(const c of t.steps){if("addMark"!==c.type){o.push(c);continue}const t=c.mark.type,e=m.find(s=>s.type===t);if(!e){o.push(c);continue}r=!0;const i={type:"removeMark",blockId:c.blockId,from:c.from,to:c.to,mark:{type:s(e.opposite)},...c.path?{path:c.path}:{}};o.push(i,c)}let p=t.storedMarksAfter;if(p){const s=p.some(s=>"superscript"===s.type),t=p.some(s=>"subscript"===s.type);if(s&&t){const s=p.findLastIndex(s=>"superscript"===s.type)>p.findLastIndex(s=>"subscript"===s.type)?"subscript":"superscript";p=p.filter(t=>t.type!==s),r=!0}}i(r?{...t,steps:o,storedMarksAfter:p}:t)},{name:"super-sub:exclusivity"})}registerDisabledToolbarItems(s){if(this.config.toolbar)for(const t of m){const e=this.config[t.configKey],i=this.config.toolbar[t.configKey]??!0;if(!e&&i){const e="superscript"===t.type?this.locale.superscriptLabel:this.locale.subscriptLabel;s.registerToolbarItem({id:t.type,group:"format",icon:t.icon,label:e,command:p(t.type),isEnabled:()=>!1})}}}isToolbarVisible(s){return!this.config.toolbar||(this.config.toolbar[s]??!0)}};export{a as n,l as r,g as t};
2
- //# sourceMappingURL=SuperSubPlugin-x1iPnZyt.mjs.map