@jackuait/blok 0.6.0-beta.2 → 0.6.0-beta.5

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 (233) hide show
  1. package/dist/blok.mjs +2 -2
  2. package/dist/chunks/{blok-DgRJH56D.mjs → blok-XA2L0_-K.mjs} +1216 -1178
  3. package/dist/chunks/{i18next-loader-DrgsjMmb.mjs → i18next-loader-Ci2zhA-n.mjs} +1 -1
  4. package/dist/chunks/{index-B3xelE-R.mjs → index-R38OiQ_d.mjs} +1 -1
  5. package/dist/chunks/{inline-tool-convert-I0Hy4UKl.mjs → inline-tool-convert-e3PyuxB6.mjs} +88 -73
  6. package/dist/chunks/{messages-C5b7hr_E.mjs → messages-1fC8IMyX.mjs} +16 -2
  7. package/dist/{messages-BPqWKx5Z.mjs → chunks/messages-49thXXGz.mjs} +16 -2
  8. package/dist/{messages-LvFKBBPa.mjs → chunks/messages-7W4d0DwD.mjs} +15 -1
  9. package/dist/{messages-Bn253WWC.mjs → chunks/messages-9SihnaXQ.mjs} +14 -0
  10. package/dist/{messages-Bf6Y3_GI.mjs → chunks/messages-B1Aww8q7.mjs} +16 -2
  11. package/dist/{messages-D00OjS2n.mjs → chunks/messages-B9fe4dQJ.mjs} +15 -1
  12. package/dist/{messages-pA5TvcAj.mjs → chunks/messages-BB5z9Uba.mjs} +14 -0
  13. package/dist/chunks/{messages-wdqp4610.mjs → messages-BC86qLvI.mjs} +17 -3
  14. package/dist/chunks/{messages-o24dK6CU.mjs → messages-BELRf6DU.mjs} +16 -2
  15. package/dist/chunks/{messages-CUZ1x1QD.mjs → messages-BFG6Wlgy.mjs} +16 -2
  16. package/dist/chunks/{messages-CQj2JU2j.mjs → messages-BGxiFoZf.mjs} +15 -1
  17. package/dist/{messages-B5puUm7R.mjs → chunks/messages-BL0tXcDf.mjs} +15 -1
  18. package/dist/{messages-CyDU5lz9.mjs → chunks/messages-BMv4xwIr.mjs} +16 -2
  19. package/dist/chunks/{messages-CkFT2gle.mjs → messages-BNe6LuHW.mjs} +14 -0
  20. package/dist/chunks/{messages-JGsXAReJ.mjs → messages-BU2nlrLK.mjs} +16 -2
  21. package/dist/chunks/{messages-srxrv8Yh.mjs → messages-BWF-zUpY.mjs} +17 -3
  22. package/dist/{messages-CXHd9SUK.mjs → chunks/messages-BYyy6Wqf.mjs} +14 -0
  23. package/dist/{messages-Cyi2AMmz.mjs → chunks/messages-Bfiw5w_W.mjs} +16 -2
  24. package/dist/chunks/{messages-B5jGUnOy.mjs → messages-Bmu_S7GM.mjs} +14 -0
  25. package/dist/chunks/{messages-BmKCChWZ.mjs → messages-BoJc_p1r.mjs} +14 -0
  26. package/dist/chunks/{messages-CvaqJFN-.mjs → messages-BogRq8lt.mjs} +15 -1
  27. package/dist/chunks/{messages-NP1myMGI.mjs → messages-BrPFGbM-.mjs} +14 -0
  28. package/dist/chunks/{messages-BiExzWJv.mjs → messages-C99mq906.mjs} +15 -1
  29. package/dist/chunks/{messages-BrJHUxQL.mjs → messages-CJdUsQ-c.mjs} +15 -1
  30. package/dist/{messages-CrsJ1TEJ.mjs → chunks/messages-CLhcMlTc.mjs} +15 -1
  31. package/dist/{messages-CnvW8Slp.mjs → chunks/messages-CMkNSDTo.mjs} +17 -3
  32. package/dist/chunks/{messages-B9Oba7sq.mjs → messages-CY8_RyFE.mjs} +15 -1
  33. package/dist/chunks/{messages-B5hdXZwA.mjs → messages-CZygwLwM.mjs} +15 -1
  34. package/dist/chunks/{messages-CVeWVKsV.mjs → messages-CnwibSvh.mjs} +14 -0
  35. package/dist/chunks/{messages-DbVquYKN.mjs → messages-CqWJcCbY.mjs} +14 -0
  36. package/dist/{messages-Dg92dXZ5.mjs → chunks/messages-CvGLfqmV.mjs} +14 -0
  37. package/dist/{messages-AHESHJm_.mjs → chunks/messages-CzTufCHu.mjs} +14 -0
  38. package/dist/chunks/{messages-Cj-t1bdy.mjs → messages-CznZadDf.mjs} +15 -1
  39. package/dist/chunks/{messages-DMQIHGRj.mjs → messages-D-ZtY5v0.mjs} +14 -0
  40. package/dist/chunks/{messages-rRSHQDCX.mjs → messages-D1Hv8XGo.mjs} +14 -0
  41. package/dist/chunks/{messages-0tDXLuyH.mjs → messages-D5C3J9qr.mjs} +15 -1
  42. package/dist/chunks/{messages-RvMHb2Ht.mjs → messages-D5iv1Kox.mjs} +16 -2
  43. package/dist/{messages-zSzDzXej.mjs → chunks/messages-DBRw-7Zc.mjs} +16 -2
  44. package/dist/chunks/{messages-CeCjVKMW.mjs → messages-DBn76jVV.mjs} +16 -2
  45. package/dist/{messages-DOlC_Tty.mjs → chunks/messages-DChXyvh2.mjs} +15 -1
  46. package/dist/chunks/{messages-C7I_AVH2.mjs → messages-DJDG55Vq.mjs} +16 -2
  47. package/dist/{messages-DDLgIPDF.mjs → chunks/messages-DLfR5bMd.mjs} +16 -2
  48. package/dist/{messages-CbhuIWRJ.mjs → chunks/messages-DT4dP5uK.mjs} +15 -1
  49. package/dist/chunks/{messages-B66ZSDCJ.mjs → messages-DhLKYm2j.mjs} +15 -1
  50. package/dist/{messages-BlpqL8vG.mjs → chunks/messages-DjvaFRqx.mjs} +16 -2
  51. package/dist/{messages-BA0rcTCY.mjs → chunks/messages-DnIhyAJk.mjs} +18 -4
  52. package/dist/chunks/{messages-DV6shA9b.mjs → messages-DnXLrlHh.mjs} +14 -0
  53. package/dist/chunks/{messages-DcKOuncK.mjs → messages-DprmQg6V.mjs} +16 -2
  54. package/dist/{messages-CJoBtXU6.mjs → chunks/messages-DqM1LFg5.mjs} +14 -0
  55. package/dist/chunks/{messages-CySyfkMU.mjs → messages-DsVNtdgM.mjs} +15 -1
  56. package/dist/chunks/{messages-DnbbyJT3.mjs → messages-Dz9L52ol.mjs} +16 -2
  57. package/dist/chunks/{messages-Cu08aLS3.mjs → messages-EL5ARzmK.mjs} +16 -2
  58. package/dist/chunks/{messages-Q4kc_ZtL.mjs → messages-JELdtT6E.mjs} +15 -1
  59. package/dist/{messages-DY94ykcE.mjs → chunks/messages-LPVfA-8K.mjs} +14 -0
  60. package/dist/{messages-Cr-RJ7YB.mjs → chunks/messages-O5tQus_0.mjs} +14 -0
  61. package/dist/chunks/{messages-CbMyJSzS.mjs → messages-Q7AO_FLv.mjs} +17 -3
  62. package/dist/chunks/{messages-GC2PhgV3.mjs → messages-QtoE8uEv.mjs} +15 -1
  63. package/dist/chunks/{messages-2_xedlYw.mjs → messages-R3hUSvr3.mjs} +15 -1
  64. package/dist/chunks/{messages-zS1AXZ0y.mjs → messages-UX4gkere.mjs} +15 -1
  65. package/dist/{messages-CUy1vn-b.mjs → chunks/messages-Xq8UmkVs.mjs} +14 -0
  66. package/dist/chunks/{messages-BBJgd5jG.mjs → messages-Z9nEU2xK.mjs} +16 -2
  67. package/dist/chunks/{messages-Cm9aLHeX.mjs → messages-_ErNTNhk.mjs} +15 -1
  68. package/dist/chunks/{messages-JZUhXTuV.mjs → messages-_ncGrKHh.mjs} +16 -2
  69. package/dist/chunks/{messages-ftMcCEuO.mjs → messages-kep5wtm4.mjs} +15 -1
  70. package/dist/chunks/{messages-DteYq0rv.mjs → messages-uKX8WBaD.mjs} +16 -2
  71. package/dist/chunks/{messages-Bdv-IkfG.mjs → messages-w7v1GNaE.mjs} +15 -1
  72. package/dist/{messages-BeUhMpsr.mjs → chunks/messages-wp_1b1hD.mjs} +15 -1
  73. package/dist/full.mjs +2 -2
  74. package/dist/locales.mjs +102 -88
  75. package/dist/{messages-C5b7hr_E.mjs → messages-1fC8IMyX.mjs} +16 -2
  76. package/dist/{chunks/messages-BPqWKx5Z.mjs → messages-49thXXGz.mjs} +16 -2
  77. package/dist/{chunks/messages-LvFKBBPa.mjs → messages-7W4d0DwD.mjs} +15 -1
  78. package/dist/{chunks/messages-Bn253WWC.mjs → messages-9SihnaXQ.mjs} +14 -0
  79. package/dist/{chunks/messages-Bf6Y3_GI.mjs → messages-B1Aww8q7.mjs} +16 -2
  80. package/dist/{chunks/messages-D00OjS2n.mjs → messages-B9fe4dQJ.mjs} +15 -1
  81. package/dist/{chunks/messages-pA5TvcAj.mjs → messages-BB5z9Uba.mjs} +14 -0
  82. package/dist/{messages-wdqp4610.mjs → messages-BC86qLvI.mjs} +17 -3
  83. package/dist/{messages-o24dK6CU.mjs → messages-BELRf6DU.mjs} +16 -2
  84. package/dist/{messages-CUZ1x1QD.mjs → messages-BFG6Wlgy.mjs} +16 -2
  85. package/dist/{messages-CQj2JU2j.mjs → messages-BGxiFoZf.mjs} +15 -1
  86. package/dist/{chunks/messages-B5puUm7R.mjs → messages-BL0tXcDf.mjs} +15 -1
  87. package/dist/{chunks/messages-CyDU5lz9.mjs → messages-BMv4xwIr.mjs} +16 -2
  88. package/dist/{messages-CkFT2gle.mjs → messages-BNe6LuHW.mjs} +14 -0
  89. package/dist/{messages-JGsXAReJ.mjs → messages-BU2nlrLK.mjs} +16 -2
  90. package/dist/{messages-srxrv8Yh.mjs → messages-BWF-zUpY.mjs} +17 -3
  91. package/dist/{chunks/messages-CXHd9SUK.mjs → messages-BYyy6Wqf.mjs} +14 -0
  92. package/dist/{chunks/messages-Cyi2AMmz.mjs → messages-Bfiw5w_W.mjs} +16 -2
  93. package/dist/{messages-B5jGUnOy.mjs → messages-Bmu_S7GM.mjs} +14 -0
  94. package/dist/{messages-BmKCChWZ.mjs → messages-BoJc_p1r.mjs} +14 -0
  95. package/dist/{messages-CvaqJFN-.mjs → messages-BogRq8lt.mjs} +15 -1
  96. package/dist/{messages-NP1myMGI.mjs → messages-BrPFGbM-.mjs} +14 -0
  97. package/dist/{messages-BiExzWJv.mjs → messages-C99mq906.mjs} +15 -1
  98. package/dist/{messages-BrJHUxQL.mjs → messages-CJdUsQ-c.mjs} +15 -1
  99. package/dist/{chunks/messages-CrsJ1TEJ.mjs → messages-CLhcMlTc.mjs} +15 -1
  100. package/dist/{chunks/messages-CnvW8Slp.mjs → messages-CMkNSDTo.mjs} +17 -3
  101. package/dist/{messages-B9Oba7sq.mjs → messages-CY8_RyFE.mjs} +15 -1
  102. package/dist/{messages-B5hdXZwA.mjs → messages-CZygwLwM.mjs} +15 -1
  103. package/dist/{messages-CVeWVKsV.mjs → messages-CnwibSvh.mjs} +14 -0
  104. package/dist/{messages-DbVquYKN.mjs → messages-CqWJcCbY.mjs} +14 -0
  105. package/dist/{chunks/messages-Dg92dXZ5.mjs → messages-CvGLfqmV.mjs} +14 -0
  106. package/dist/{chunks/messages-AHESHJm_.mjs → messages-CzTufCHu.mjs} +14 -0
  107. package/dist/{messages-Cj-t1bdy.mjs → messages-CznZadDf.mjs} +15 -1
  108. package/dist/{messages-DMQIHGRj.mjs → messages-D-ZtY5v0.mjs} +14 -0
  109. package/dist/{messages-rRSHQDCX.mjs → messages-D1Hv8XGo.mjs} +14 -0
  110. package/dist/{messages-0tDXLuyH.mjs → messages-D5C3J9qr.mjs} +15 -1
  111. package/dist/{messages-RvMHb2Ht.mjs → messages-D5iv1Kox.mjs} +16 -2
  112. package/dist/{chunks/messages-zSzDzXej.mjs → messages-DBRw-7Zc.mjs} +16 -2
  113. package/dist/{messages-CeCjVKMW.mjs → messages-DBn76jVV.mjs} +16 -2
  114. package/dist/{chunks/messages-DOlC_Tty.mjs → messages-DChXyvh2.mjs} +15 -1
  115. package/dist/{messages-C7I_AVH2.mjs → messages-DJDG55Vq.mjs} +16 -2
  116. package/dist/{chunks/messages-DDLgIPDF.mjs → messages-DLfR5bMd.mjs} +16 -2
  117. package/dist/{chunks/messages-CbhuIWRJ.mjs → messages-DT4dP5uK.mjs} +15 -1
  118. package/dist/{messages-B66ZSDCJ.mjs → messages-DhLKYm2j.mjs} +15 -1
  119. package/dist/{chunks/messages-BlpqL8vG.mjs → messages-DjvaFRqx.mjs} +16 -2
  120. package/dist/{chunks/messages-BA0rcTCY.mjs → messages-DnIhyAJk.mjs} +18 -4
  121. package/dist/{messages-DV6shA9b.mjs → messages-DnXLrlHh.mjs} +14 -0
  122. package/dist/{messages-DcKOuncK.mjs → messages-DprmQg6V.mjs} +16 -2
  123. package/dist/{chunks/messages-CJoBtXU6.mjs → messages-DqM1LFg5.mjs} +14 -0
  124. package/dist/{messages-CySyfkMU.mjs → messages-DsVNtdgM.mjs} +15 -1
  125. package/dist/{messages-DnbbyJT3.mjs → messages-Dz9L52ol.mjs} +16 -2
  126. package/dist/{messages-Cu08aLS3.mjs → messages-EL5ARzmK.mjs} +16 -2
  127. package/dist/{messages-Q4kc_ZtL.mjs → messages-JELdtT6E.mjs} +15 -1
  128. package/dist/{chunks/messages-DY94ykcE.mjs → messages-LPVfA-8K.mjs} +14 -0
  129. package/dist/{chunks/messages-Cr-RJ7YB.mjs → messages-O5tQus_0.mjs} +14 -0
  130. package/dist/{messages-CbMyJSzS.mjs → messages-Q7AO_FLv.mjs} +17 -3
  131. package/dist/{messages-GC2PhgV3.mjs → messages-QtoE8uEv.mjs} +15 -1
  132. package/dist/{messages-2_xedlYw.mjs → messages-R3hUSvr3.mjs} +15 -1
  133. package/dist/{messages-zS1AXZ0y.mjs → messages-UX4gkere.mjs} +15 -1
  134. package/dist/{chunks/messages-CUy1vn-b.mjs → messages-Xq8UmkVs.mjs} +14 -0
  135. package/dist/{messages-BBJgd5jG.mjs → messages-Z9nEU2xK.mjs} +16 -2
  136. package/dist/{messages-Cm9aLHeX.mjs → messages-_ErNTNhk.mjs} +15 -1
  137. package/dist/{messages-JZUhXTuV.mjs → messages-_ncGrKHh.mjs} +16 -2
  138. package/dist/{messages-ftMcCEuO.mjs → messages-kep5wtm4.mjs} +15 -1
  139. package/dist/{messages-DteYq0rv.mjs → messages-uKX8WBaD.mjs} +16 -2
  140. package/dist/{messages-Bdv-IkfG.mjs → messages-w7v1GNaE.mjs} +15 -1
  141. package/dist/{chunks/messages-BeUhMpsr.mjs → messages-wp_1b1hD.mjs} +15 -1
  142. package/dist/tools.mjs +943 -806
  143. package/package.json +5 -9
  144. package/src/components/i18n/locales/am/messages.json +15 -1
  145. package/src/components/i18n/locales/ar/messages.json +14 -0
  146. package/src/components/i18n/locales/az/messages.json +14 -0
  147. package/src/components/i18n/locales/bg/messages.json +14 -0
  148. package/src/components/i18n/locales/bn/messages.json +15 -1
  149. package/src/components/i18n/locales/bs/messages.json +15 -1
  150. package/src/components/i18n/locales/cs/messages.json +14 -0
  151. package/src/components/i18n/locales/da/messages.json +14 -0
  152. package/src/components/i18n/locales/de/messages.json +14 -0
  153. package/src/components/i18n/locales/dv/messages.json +15 -1
  154. package/src/components/i18n/locales/el/messages.json +15 -1
  155. package/src/components/i18n/locales/en/messages.json +14 -0
  156. package/src/components/i18n/locales/es/messages.json +14 -0
  157. package/src/components/i18n/locales/et/messages.json +14 -0
  158. package/src/components/i18n/locales/fa/messages.json +15 -1
  159. package/src/components/i18n/locales/fi/messages.json +15 -1
  160. package/src/components/i18n/locales/fil/messages.json +14 -0
  161. package/src/components/i18n/locales/fr/messages.json +15 -1
  162. package/src/components/i18n/locales/gu/messages.json +15 -1
  163. package/src/components/i18n/locales/he/messages.json +14 -0
  164. package/src/components/i18n/locales/hi/messages.json +15 -1
  165. package/src/components/i18n/locales/hr/messages.json +14 -0
  166. package/src/components/i18n/locales/hu/messages.json +14 -0
  167. package/src/components/i18n/locales/hy/messages.json +16 -2
  168. package/src/components/i18n/locales/id/messages.json +16 -2
  169. package/src/components/i18n/locales/it/messages.json +14 -0
  170. package/src/components/i18n/locales/ja/messages.json +14 -0
  171. package/src/components/i18n/locales/ka/messages.json +15 -1
  172. package/src/components/i18n/locales/km/messages.json +16 -2
  173. package/src/components/i18n/locales/kn/messages.json +16 -2
  174. package/src/components/i18n/locales/ko/messages.json +14 -0
  175. package/src/components/i18n/locales/ku/messages.json +16 -2
  176. package/src/components/i18n/locales/lo/messages.json +15 -1
  177. package/src/components/i18n/locales/lt/messages.json +15 -1
  178. package/src/components/i18n/locales/lv/messages.json +15 -1
  179. package/src/components/i18n/locales/mk/messages.json +16 -2
  180. package/src/components/i18n/locales/ml/messages.json +16 -2
  181. package/src/components/i18n/locales/mn/messages.json +16 -2
  182. package/src/components/i18n/locales/mr/messages.json +15 -1
  183. package/src/components/i18n/locales/ms/messages.json +16 -2
  184. package/src/components/i18n/locales/my/messages.json +16 -2
  185. package/src/components/i18n/locales/ne/messages.json +15 -1
  186. package/src/components/i18n/locales/nl/messages.json +15 -1
  187. package/src/components/i18n/locales/no/messages.json +16 -2
  188. package/src/components/i18n/locales/pa/messages.json +15 -1
  189. package/src/components/i18n/locales/pl/messages.json +14 -0
  190. package/src/components/i18n/locales/ps/messages.json +17 -3
  191. package/src/components/i18n/locales/pt/messages.json +14 -0
  192. package/src/components/i18n/locales/ro/messages.json +15 -1
  193. package/src/components/i18n/locales/ru/messages.json +14 -0
  194. package/src/components/i18n/locales/sd/messages.json +16 -2
  195. package/src/components/i18n/locales/si/messages.json +15 -1
  196. package/src/components/i18n/locales/sk/messages.json +15 -1
  197. package/src/components/i18n/locales/sl/messages.json +16 -2
  198. package/src/components/i18n/locales/sq/messages.json +16 -2
  199. package/src/components/i18n/locales/sr/messages.json +16 -2
  200. package/src/components/i18n/locales/sv/messages.json +16 -2
  201. package/src/components/i18n/locales/sw/messages.json +16 -2
  202. package/src/components/i18n/locales/ta/messages.json +16 -2
  203. package/src/components/i18n/locales/te/messages.json +15 -1
  204. package/src/components/i18n/locales/th/messages.json +15 -1
  205. package/src/components/i18n/locales/tr/messages.json +15 -1
  206. package/src/components/i18n/locales/ug/messages.json +16 -2
  207. package/src/components/i18n/locales/uk/messages.json +15 -1
  208. package/src/components/i18n/locales/ur/messages.json +15 -1
  209. package/src/components/i18n/locales/vi/messages.json +16 -2
  210. package/src/components/i18n/locales/yi/messages.json +16 -2
  211. package/src/components/i18n/locales/zh/messages.json +15 -1
  212. package/src/components/modules/api/blocks.ts +17 -2
  213. package/src/components/modules/blockEvents/composers/markdownShortcuts.ts +12 -1
  214. package/src/components/modules/toolbar/index.ts +29 -7
  215. package/src/components/modules/ui.ts +46 -68
  216. package/src/components/modules/uiControllers/controllers/blockHover.ts +40 -61
  217. package/src/components/ui/toolbox.ts +41 -6
  218. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +3 -1
  219. package/src/components/utils/popover/popover-desktop.ts +27 -8
  220. package/src/tools/table/index.ts +67 -70
  221. package/src/tools/table/table-add-controls.ts +25 -7
  222. package/src/tools/table/table-cell-blocks.ts +62 -0
  223. package/src/tools/table/table-cell-selection.ts +70 -46
  224. package/src/tools/table/table-core.ts +20 -15
  225. package/src/tools/table/table-grip-visuals.ts +4 -4
  226. package/src/tools/table/table-operations.ts +22 -5
  227. package/src/tools/table/table-restrictions.ts +64 -0
  228. package/src/tools/table/table-row-col-action-handler.ts +190 -0
  229. package/src/tools/table/table-row-col-controls.ts +91 -182
  230. package/src/tools/table/table-row-col-drag.ts +4 -4
  231. package/src/tools/table/table-row-col-popover.ts +225 -0
  232. package/src/tools/table/types.ts +2 -0
  233. package/types/utils/popover/popover.d.ts +7 -0
package/dist/tools.mjs CHANGED
@@ -1,17 +1,17 @@
1
- var Ee = Object.defineProperty, ke = Object.defineProperties;
2
- var xe = Object.getOwnPropertyDescriptors;
3
- var Et = Object.getOwnPropertySymbols;
4
- var Te = Object.prototype.hasOwnProperty, Le = Object.prototype.propertyIsEnumerable;
5
- var kt = (i, t, e) => t in i ? Ee(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, L = (i, t) => {
1
+ var ke = Object.defineProperty, xe = Object.defineProperties;
2
+ var Te = Object.getOwnPropertyDescriptors;
3
+ var xt = Object.getOwnPropertySymbols;
4
+ var Re = Object.prototype.hasOwnProperty, Le = Object.prototype.propertyIsEnumerable;
5
+ var Tt = (i, t, e) => t in i ? ke(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, x = (i, t) => {
6
6
  for (var e in t || (t = {}))
7
- Te.call(t, e) && kt(i, e, t[e]);
8
- if (Et)
9
- for (var e of Et(t))
10
- Le.call(t, e) && kt(i, e, t[e]);
7
+ Re.call(t, e) && Tt(i, e, t[e]);
8
+ if (xt)
9
+ for (var e of xt(t))
10
+ Le.call(t, e) && Tt(i, e, t[e]);
11
11
  return i;
12
- }, tt = (i, t) => ke(i, xe(t));
13
- import { t as v, D as E, am as Re, an as Be, _ as Ie, ao as De, ap as Ne, aq as Pe, ar as _e, as as He, at as Me, au as te, av as ee, aw as ne, o as Oe, p as xt, a5 as Tt, a3 as $e, J as se, ax as Ge, Q as oe, P as F, ay as We, az as qe, a0 as Lt, aA as Fe, aB as ze, aC as Ve, aD as Ue, aE as Ke, z as O, aF as je, aG as Xe, S as et, aH as Ye, l as Ze, a8 as Je } from "./chunks/inline-tool-convert-I0Hy4UKl.mjs";
14
- import { ab as fo } from "./chunks/inline-tool-convert-I0Hy4UKl.mjs";
12
+ }, tt = (i, t) => xe(i, Te(t));
13
+ import { t as v, D as E, am as Be, an as Ie, _ as De, ao as Ne, ap as He, aq as Pe, ar as _e, as as Oe, at as Me, au as Qt, av as te, aw as ee, o as We, p as Rt, a5 as Lt, a3 as $e, ax as Ge, J as ne, Q as se, P as q, ay as qe, az as Fe, a0 as oe, aA as ze, aB as Ve, aC as Ue, aD as Ke, aE as je, z as H, aF as Xe, aG as Ye, S as et, aH as Ze, l as Je, a8 as Qe } from "./chunks/inline-tool-convert-e3PyuxB6.mjs";
14
+ import { ab as xo } from "./chunks/inline-tool-convert-e3PyuxB6.mjs";
15
15
  const ie = (i) => {
16
16
  if (!i || !i.includes("data-blok-fake-background"))
17
17
  return i;
@@ -24,7 +24,7 @@ const ie = (i) => {
24
24
  s.removeChild(n);
25
25
  }
26
26
  }), t.innerHTML;
27
- }, at = [
27
+ }, dt = [
28
28
  "empty:before:pointer-events-none",
29
29
  "empty:before:text-gray-text",
30
30
  "empty:before:cursor-text",
@@ -33,7 +33,7 @@ const ie = (i) => {
33
33
  "[&[data-blok-empty=true]]:before:text-gray-text",
34
34
  "[&[data-blok-empty=true]]:before:cursor-text",
35
35
  "[&[data-blok-empty=true]]:before:content-[attr(data-placeholder)]"
36
- ], Qe = [
36
+ ], tn = [
37
37
  "empty:focus:before:pointer-events-none",
38
38
  "empty:focus:before:text-gray-text",
39
39
  "empty:focus:before:cursor-text",
@@ -42,22 +42,22 @@ const ie = (i) => {
42
42
  "[&[data-empty=true]:focus]:before:text-gray-text",
43
43
  "[&[data-empty=true]:focus]:before:cursor-text",
44
44
  "[&[data-empty=true]:focus]:before:content-[attr(data-blok-placeholder-active)]"
45
- ], tn = (i) => {
45
+ ], en = (i) => {
46
46
  const t = i.innerHTML.trim();
47
47
  return t === "" || t === "<br>";
48
- }, en = (i) => {
48
+ }, nn = (i) => {
49
49
  i.innerHTML === "<br>" && (i.innerHTML = "");
50
50
  const t = window.getSelection();
51
51
  if (!t) return;
52
52
  const e = document.createRange();
53
53
  e.selectNodeContents(i), e.collapse(!0), t.removeAllRanges(), t.addRange(e);
54
- }, nn = (i) => {
55
- tn(i) && en(i);
56
- }, wt = (i, t, e = "data-placeholder") => {
54
+ }, sn = (i) => {
55
+ en(i) && nn(i);
56
+ }, Et = (i, t, e = "data-placeholder") => {
57
57
  i.setAttribute(e, t != null ? t : "");
58
- const n = () => nn(i);
58
+ const n = () => sn(i);
59
59
  i.addEventListener("focus", n), i.addEventListener("input", n);
60
- }, sn = (i) => {
60
+ }, on = (i) => {
61
61
  const t = document.createElement("div");
62
62
  t.innerHTML = i.trim();
63
63
  const e = document.createDocumentFragment();
@@ -110,10 +110,10 @@ const ie = (i) => {
110
110
  t.className = v(
111
111
  this.api.styles.block,
112
112
  Q.WRAPPER_CLASSES,
113
- Qe
113
+ tn
114
114
  ), t.setAttribute(E.tool, "paragraph"), t.contentEditable = "false";
115
115
  const e = this.buildInlineStyles();
116
- return Object.keys(e).length > 0 && Object.assign(t.style, e), this._data.text && (t.innerHTML = this._data.text), this.readOnly ? t.setAttribute("data-blok-placeholder-active", this.api.i18n.t(this._placeholder)) : (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), wt(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
116
+ return Object.keys(e).length > 0 && Object.assign(t.style, e), this._data.text && (t.innerHTML = this._data.text), this.readOnly ? t.setAttribute("data-blok-placeholder-active", this.api.i18n.t(this._placeholder)) : (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), Et(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
117
117
  }
118
118
  /**
119
119
  * Return Tool's view
@@ -133,7 +133,7 @@ const ie = (i) => {
133
133
  if (!this._element)
134
134
  return;
135
135
  this._data.text += t.text;
136
- const e = sn(t.text);
136
+ const e = on(t.text);
137
137
  this._element.appendChild(e), this._element.normalize();
138
138
  }
139
139
  /**
@@ -224,7 +224,7 @@ const ie = (i) => {
224
224
  */
225
225
  static get toolbox() {
226
226
  return {
227
- icon: Re,
227
+ icon: Be,
228
228
  title: "Text",
229
229
  titleKey: "text",
230
230
  searchTerms: ["p", "paragraph", "plain"]
@@ -239,8 +239,8 @@ Q.WRAPPER_CLASSES = [
239
239
  "[&>p:first-of-type]:mt-0",
240
240
  "[&>p:last-of-type]:mb-0"
241
241
  ];
242
- let Rt = Q;
243
- const q = class q {
242
+ let Bt = Q;
243
+ const O = class O {
244
244
  /**
245
245
  * Render plugin's main Element and fill it with saved data
246
246
  *
@@ -326,10 +326,10 @@ const q = class q {
326
326
  */
327
327
  buildSettingsFromToolboxEntries(t) {
328
328
  return t.map((e) => {
329
- var c, d, h, u;
330
- const n = e.data, s = (c = n == null ? void 0 : n.level) != null ? c : this.defaultLevel.number, o = q.DEFAULT_LEVELS.find((f) => f.number === s), r = (d = o == null ? void 0 : o.name) != null ? d : `Heading ${s}`, l = this.resolveToolboxEntryTitle(e, r);
329
+ var c, d, h, p;
330
+ const n = e.data, s = (c = n == null ? void 0 : n.level) != null ? c : this.defaultLevel.number, o = O.DEFAULT_LEVELS.find((m) => m.number === s), r = (d = o == null ? void 0 : o.name) != null ? d : `Heading ${s}`, l = this.resolveToolboxEntryTitle(e, r);
331
331
  return {
332
- icon: (u = (h = e.icon) != null ? h : o == null ? void 0 : o.icon) != null ? u : Be,
332
+ icon: (p = (h = e.icon) != null ? h : o == null ? void 0 : o.icon) != null ? p : Ie,
333
333
  title: l,
334
334
  onActivate: () => this.setLevel(s),
335
335
  closeOnActivate: !0,
@@ -348,7 +348,7 @@ const q = class q {
348
348
  * @returns Resolved title string
349
349
  */
350
350
  resolveToolboxEntryTitle(t, e) {
351
- return Ie(this.api.i18n, t, e);
351
+ return De(this.api.i18n, t, e);
352
352
  }
353
353
  /**
354
354
  * Callback for Block's settings buttons
@@ -450,9 +450,9 @@ const q = class q {
450
450
  */
451
451
  getTag() {
452
452
  const t = document.createElement(this.currentLevel.tag);
453
- t.innerHTML = this._data.text || "", t.className = v(q.BASE_STYLES, this.currentLevel.styles, at);
453
+ t.innerHTML = this._data.text || "", t.className = v(O.BASE_STYLES, this.currentLevel.styles, dt);
454
454
  const { inlineStyles: e } = this.currentLevel;
455
- return e && Object.assign(t.style, e), t.setAttribute(E.tool, "header"), t.contentEditable = this.readOnly ? "false" : "true", this.readOnly ? t.setAttribute("data-placeholder", this.api.i18n.t(this._settings.placeholder || "")) : wt(t, this.api.i18n.t(this._settings.placeholder || "")), t;
455
+ return e && Object.assign(t.style, e), t.setAttribute(E.tool, "header"), t.contentEditable = this.readOnly ? "false" : "true", this.readOnly ? t.setAttribute("data-placeholder", this.api.i18n.t(this._settings.placeholder || "")) : Et(t, this.api.i18n.t(this._settings.placeholder || "")), t;
456
456
  }
457
457
  /**
458
458
  * Get current level
@@ -480,7 +480,7 @@ const q = class q {
480
480
  * @returns Level array
481
481
  */
482
482
  get levels() {
483
- const t = this._settings.levelOverrides || {}, e = q.DEFAULT_LEVELS.map((s) => {
483
+ const t = this._settings.levelOverrides || {}, e = O.DEFAULT_LEVELS.map((s) => {
484
484
  var l;
485
485
  const o = t[s.number] || {}, r = {};
486
486
  return o.size && (r.fontSize = o.size), o.marginTop && (r.marginTop = o.marginTop), o.marginBottom && (r.marginBottom = o.marginBottom), {
@@ -537,7 +537,7 @@ const q = class q {
537
537
  * @returns ToolboxConfig array with entries for H1-H6
538
538
  */
539
539
  static get toolbox() {
540
- return q.DEFAULT_LEVELS.map((t) => ({
540
+ return O.DEFAULT_LEVELS.map((t) => ({
541
541
  icon: t.icon,
542
542
  title: t.name,
543
543
  titleKey: t.nameKey,
@@ -548,16 +548,16 @@ const q = class q {
548
548
  }));
549
549
  }
550
550
  };
551
- q.BASE_STYLES = "py-[3px] px-[2px] m-0 !leading-[1.3] outline-none [&_p]:!p-0 [&_p]:!m-0 [&_div]:!p-0 [&_div]:!m-0", q.DEFAULT_LEVELS = [
552
- { number: 1, tag: "H1", nameKey: "tools.header.heading1", name: "Heading 1", icon: De, styles: "text-4xl font-bold mt-8 mb-1" },
553
- { number: 2, tag: "H2", nameKey: "tools.header.heading2", name: "Heading 2", icon: Ne, styles: "text-3xl font-semibold mt-6 mb-px" },
551
+ O.BASE_STYLES = "py-[3px] px-[2px] m-0 !leading-[1.3] outline-none [&_p]:!p-0 [&_p]:!m-0 [&_div]:!p-0 [&_div]:!m-0", O.DEFAULT_LEVELS = [
552
+ { number: 1, tag: "H1", nameKey: "tools.header.heading1", name: "Heading 1", icon: Ne, styles: "text-4xl font-bold mt-8 mb-1" },
553
+ { number: 2, tag: "H2", nameKey: "tools.header.heading2", name: "Heading 2", icon: He, styles: "text-3xl font-semibold mt-6 mb-px" },
554
554
  { number: 3, tag: "H3", nameKey: "tools.header.heading3", name: "Heading 3", icon: Pe, styles: "text-2xl font-semibold mt-4 mb-px" },
555
555
  { number: 4, tag: "H4", nameKey: "tools.header.heading4", name: "Heading 4", icon: _e, styles: "text-xl font-semibold mt-3 mb-px" },
556
- { number: 5, tag: "H5", nameKey: "tools.header.heading5", name: "Heading 5", icon: He, styles: "text-base font-semibold mt-3 mb-px" },
556
+ { number: 5, tag: "H5", nameKey: "tools.header.heading5", name: "Heading 5", icon: Oe, styles: "text-base font-semibold mt-3 mb-px" },
557
557
  { number: 6, tag: "H6", nameKey: "tools.header.heading6", name: "Heading 6", icon: Me, styles: "text-sm font-semibold mt-3 mb-px" }
558
558
  ];
559
- let Bt = q;
560
- const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl-0.5 leading-[1.6em]", ln = "flex items-start pl-0.5", an = "mt-1 w-4 mr-2 h-4 cursor-pointer accent-current", cn = "tools.list.placeholder", w = "list", re = {
559
+ let It = O;
560
+ const F = 24, rn = "outline-none py-[3px] mt-[2px] mb-px", ln = "outline-none pl-0.5 leading-[1.6em]", an = "flex items-start pl-0.5", cn = "mt-1 w-4 mr-2 h-4 cursor-pointer accent-current", dn = "tools.list.placeholder", w = "list", re = {
561
561
  contentContainer: "list-content-container",
562
562
  checklistContent: "list-checklist-content"
563
563
  }, le = (i, t) => {
@@ -569,7 +569,7 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
569
569
  configurable: !1
570
570
  });
571
571
  }, ae = (i) => {
572
- const { data: t, keydownHandler: e, readOnly: n } = i, s = dn(i), o = t.style === "checklist" ? un(i) : hn(i);
572
+ const { data: t, keydownHandler: e, readOnly: n } = i, s = hn(i), o = t.style === "checklist" ? pn(i) : un(i);
573
573
  s.appendChild(o), !n && e && s.addEventListener("keydown", e);
574
574
  const r = o.querySelector("[data-list-marker]"), l = o.querySelector('input[type="checkbox"]'), a = o.querySelector("[contenteditable]");
575
575
  return {
@@ -578,47 +578,47 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
578
578
  markerElement: r,
579
579
  checkboxElement: l
580
580
  };
581
- }, dn = (i) => {
581
+ }, hn = (i) => {
582
582
  var n;
583
583
  const { data: t } = i, e = document.createElement("div");
584
- return e.className = on, e.setAttribute(E.tool, w), e.setAttribute("data-list-style", t.style), e.setAttribute("data-list-depth", String((n = t.depth) != null ? n : 0)), t.start !== void 0 && t.start !== 1 && e.setAttribute("data-list-start", String(t.start)), e;
585
- }, hn = (i) => {
584
+ return e.className = rn, e.setAttribute(E.tool, w), e.setAttribute("data-list-style", t.style), e.setAttribute("data-list-depth", String((n = t.depth) != null ? n : 0)), t.start !== void 0 && t.start !== 1 && e.setAttribute("data-list-start", String(t.start)), e;
585
+ }, un = (i) => {
586
586
  var c;
587
587
  const { data: t, itemColor: e, itemSize: n, placeholder: s } = i, o = document.createElement("div");
588
- o.setAttribute("role", "listitem"), o.className = v(rn, "flex", ...at), e && (o.style.color = e), n && (o.style.fontSize = n);
588
+ o.setAttribute("role", "listitem"), o.className = v(ln, "flex", ...dt), e && (o.style.color = e), n && (o.style.fontSize = n);
589
589
  const r = (c = t.depth) != null ? c : 0;
590
- r > 0 && (o.style.marginLeft = `${r * V}px`);
591
- const l = pn(t.style, r);
590
+ r > 0 && (o.style.marginLeft = `${r * F}px`);
591
+ const l = gn(t.style, r);
592
592
  l.setAttribute("data-list-marker", "true"), l.setAttribute("data-blok-mutation-free", "true"), o.appendChild(l);
593
593
  const a = document.createElement("div");
594
- return a.className = v("flex-1 min-w-0 outline-none", ...at), a.setAttribute("data-blok-testid", re.contentContainer), a.contentEditable = i.readOnly ? "false" : "true", a.innerHTML = t.text, le(a, s), o.appendChild(a), o;
595
- }, un = (i) => {
594
+ return a.className = v("flex-1 min-w-0 outline-none", ...dt), a.setAttribute("data-blok-testid", re.contentContainer), a.contentEditable = i.readOnly ? "false" : "true", a.innerHTML = t.text, le(a, s), o.appendChild(a), o;
595
+ }, pn = (i) => {
596
596
  var d;
597
597
  const { data: t, itemColor: e, itemSize: n, placeholder: s, readOnly: o } = i, r = document.createElement("div");
598
- r.setAttribute("role", "listitem"), r.className = ln, e && (r.style.color = e), n && (r.style.fontSize = n);
598
+ r.setAttribute("role", "listitem"), r.className = an, e && (r.style.color = e), n && (r.style.fontSize = n);
599
599
  const l = (d = t.depth) != null ? d : 0;
600
- l > 0 && (r.style.marginLeft = `${l * V}px`);
600
+ l > 0 && (r.style.marginLeft = `${l * F}px`);
601
601
  const a = document.createElement("input");
602
- a.type = "checkbox", a.className = an, a.checked = !!t.checked, a.disabled = o;
602
+ a.type = "checkbox", a.className = cn, a.checked = !!t.checked, a.disabled = o;
603
603
  const c = document.createElement("div");
604
604
  return c.className = v(
605
605
  "flex-1 outline-none leading-[1.6em]",
606
606
  t.checked ? "line-through opacity-60" : "",
607
- ...at
607
+ ...dt
608
608
  ), c.setAttribute("data-blok-testid", re.checklistContent), c.setAttribute("data-checked", String(t.checked)), c.contentEditable = o ? "false" : "true", c.innerHTML = t.text, le(c, s), r.appendChild(a), r.appendChild(c), r;
609
- }, pn = (i, t) => {
609
+ }, gn = (i, t) => {
610
610
  const e = document.createElement("span");
611
611
  if (e.className = "flex-shrink-0 select-none", e.setAttribute("aria-hidden", "true"), e.contentEditable = "false", i === "ordered")
612
612
  e.textContent = "1.", e.className = v(e.className, "text-right"), e.style.paddingRight = "11px", e.style.minWidth = "fit-content";
613
613
  else {
614
- const n = gn(t);
614
+ const n = fn(t);
615
615
  e.textContent = n, e.className = v(e.className, "w-6 text-center flex justify-center"), e.style.paddingLeft = "1px", e.style.paddingRight = "13px", e.style.fontSize = "24px", e.style.fontFamily = "Arial";
616
616
  }
617
617
  return e;
618
- }, gn = (i) => {
618
+ }, fn = (i) => {
619
619
  const t = ["•", "◦", "▪"];
620
620
  return t[i % t.length];
621
- }, fn = (i) => {
621
+ }, mn = (i) => {
622
622
  const { data: t, readOnly: e, placeholder: n, itemColor: s, itemSize: o, element: r, setupItemPlaceholder: l, onCheckboxChange: a, keydownHandler: c } = i;
623
623
  if (!r) return null;
624
624
  const d = r.parentNode;
@@ -632,13 +632,13 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
632
632
  keydownHandler: c
633
633
  });
634
634
  if (h.contentElement && l(h.contentElement), h.checkboxElement && !e) {
635
- const u = h.checkboxElement;
636
- u.addEventListener("change", () => {
637
- a(u.checked, h.contentElement);
635
+ const p = h.checkboxElement;
636
+ p.addEventListener("change", () => {
637
+ a(p.checked, h.contentElement);
638
638
  });
639
639
  }
640
640
  return d.replaceChild(h.wrapper, r), h.wrapper;
641
- }, mn = (i, t, e) => {
641
+ }, Cn = (i, t, e) => {
642
642
  if (!t) return i;
643
643
  const n = e(), o = {
644
644
  text: n ? ie(n.innerHTML) : i.text,
@@ -646,18 +646,18 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
646
646
  checked: i.checked
647
647
  };
648
648
  return i.start !== void 0 && i.start !== 1 && (o.start = i.start), i.depth !== void 0 && i.depth > 0 && (o.depth = i.depth), o;
649
- }, Cn = (i, t, e, n, s) => {
650
- var m, y, b;
649
+ }, yn = (i, t, e, n, s) => {
650
+ var f, y, b;
651
651
  if (!e)
652
652
  return { newData: i, inPlace: !1 };
653
- const o = (m = i.depth) != null ? m : 0, r = (y = t.depth) != null ? y : 0, l = i.style, a = t.style;
653
+ const o = (f = i.depth) != null ? f : 0, r = (y = t.depth) != null ? y : 0, l = i.style, a = t.style;
654
654
  if (l !== a)
655
655
  return { newData: i, inPlace: !1 };
656
- const c = "depth" in t ? t.depth : 0, d = tt(L(L({}, i), t), {
656
+ const c = "depth" in t ? t.depth : 0, d = tt(x(x({}, i), t), {
657
657
  depth: c
658
658
  }), h = n();
659
659
  return h && typeof t.text == "string" && (h.innerHTML = t.text), o !== r ? (s.adjustDepthTo(r), s.updateMarkerForDepth(r, a), { newData: d, inPlace: !0 }) : (a === "checklist" && s.updateCheckboxState((b = t.checked) != null ? b : !1), { newData: d, inPlace: !0 });
660
- }, yn = (i, t) => {
660
+ }, bn = (i, t) => {
661
661
  const { element: e, getContentElement: n, parseHTML: s, data: o } = i;
662
662
  if (!e)
663
663
  return;
@@ -667,13 +667,13 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
667
667
  const l = s(t.text);
668
668
  r.appendChild(l), r.normalize();
669
669
  }
670
- }, bn = (i, t, e, n) => i.map((s) => ({
670
+ }, vn = (i, t, e, n) => i.map((s) => ({
671
671
  icon: s.icon,
672
672
  title: e(`toolNames.${s.titleKey}`),
673
673
  onActivate: () => n(s.style),
674
674
  closeOnActivate: !0,
675
675
  isActive: t === s.style
676
- })), vn = (i) => {
676
+ })), Sn = (i) => {
677
677
  if (!i)
678
678
  return;
679
679
  const e = (i.getAttribute("style") || "").match(/margin-left:\s*(\d+)px/);
@@ -681,7 +681,7 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
681
681
  return;
682
682
  const n = parseInt(e[1], 10);
683
683
  return n > 0 ? { left: n } : void 0;
684
- }, Sn = (i) => {
684
+ }, wn = (i) => {
685
685
  const t = i.closest("[data-list-depth]");
686
686
  if (!t)
687
687
  return;
@@ -689,11 +689,11 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
689
689
  if (e === null)
690
690
  return;
691
691
  const n = parseInt(e, 10);
692
- return n > 0 ? { left: n * V } : void 0;
693
- }, wn = (i) => {
694
- const t = i.closest('[role="listitem"]') || i.querySelector('[role="listitem"]'), e = vn(t);
695
- return e !== void 0 ? e : Sn(i);
696
- }, An = (i, t) => {
692
+ return n > 0 ? { left: n * F } : void 0;
693
+ }, An = (i) => {
694
+ const t = i.closest('[role="listitem"]') || i.querySelector('[role="listitem"]'), e = Sn(t);
695
+ return e !== void 0 ? e : wn(i);
696
+ }, En = (i, t) => {
697
697
  const e = document.createRange();
698
698
  if (e.setStart(i, 0), e.setEnd(t.startContainer, t.startOffset), !i.lastChild)
699
699
  return {
@@ -702,33 +702,33 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
702
702
  };
703
703
  const n = document.createRange();
704
704
  return n.setStart(t.endContainer, t.endOffset), n.setEndAfter(i.lastChild), {
705
- beforeContent: It(e.cloneContents()),
706
- afterContent: It(n.cloneContents())
705
+ beforeContent: Dt(e.cloneContents()),
706
+ afterContent: Dt(n.cloneContents())
707
707
  };
708
- }, It = (i) => {
708
+ }, Dt = (i) => {
709
709
  const t = document.createElement("div");
710
710
  return t.appendChild(i), t.innerHTML;
711
- }, En = (i) => {
711
+ }, kn = (i) => {
712
712
  const t = document.createElement("div");
713
713
  t.innerHTML = i.trim();
714
714
  const e = document.createDocumentFragment();
715
715
  return e.append(...Array.from(t.childNodes)), e;
716
- }, kn = (i, t) => {
716
+ }, xn = (i, t) => {
717
717
  const e = document.createRange();
718
718
  return e.selectNodeContents(i), e.setEnd(t.startContainer, t.startOffset), e.toString().length === 0;
719
- }, xn = (i, t) => {
719
+ }, Tn = (i, t) => {
720
720
  const e = document.createRange();
721
721
  e.selectNodeContents(i), e.setEnd(t.startContainer, t.startOffset);
722
722
  const n = e.toString().length === 0, s = document.createRange();
723
723
  s.selectNodeContents(i), s.setStart(t.endContainer, t.endOffset);
724
724
  const o = s.toString().length === 0;
725
725
  return n && o;
726
- }, Tn = (i) => {
726
+ }, Rn = (i) => {
727
727
  if (typeof i != "object" || i === null)
728
728
  return !1;
729
729
  const e = Object.entries(i).find(([n]) => n === "items");
730
730
  return e === void 0 ? !1 : Array.isArray(e[1]);
731
- }, Ln = (i) => typeof i == "object" && i !== null, Rn = (i) => typeof i == "string" ? i : "", Bn = (i, t) => i === "unordered" || i === "ordered" || i === "checklist" ? i : t, In = (i) => !!i, Dn = (i, t) => typeof i == "number" ? i : t, Nn = (i, t) => {
731
+ }, Ln = (i) => typeof i == "object" && i !== null, Bn = (i) => typeof i == "string" ? i : "", In = (i, t) => i === "unordered" || i === "ordered" || i === "checklist" ? i : t, Dn = (i) => !!i, Nn = (i, t) => typeof i == "number" ? i : t, Hn = (i, t) => {
732
732
  const e = t.defaultStyle || "unordered";
733
733
  if (!i || typeof i != "object")
734
734
  return {
@@ -737,9 +737,9 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
737
737
  checked: !1,
738
738
  depth: 0
739
739
  };
740
- if (Tn(i)) {
740
+ if (Rn(i)) {
741
741
  const n = i.items[0], s = (n == null ? void 0 : n.content) || "", o = (n == null ? void 0 : n.checked) || !1;
742
- return L({
742
+ return x({
743
743
  text: s,
744
744
  style: i.style || e,
745
745
  checked: !!o,
@@ -747,8 +747,8 @@ const V = 24, on = "outline-none py-[3px] mt-[2px] mb-px", rn = "outline-none pl
747
747
  }, i.start !== void 0 && i.start !== 1 ? { start: i.start } : {});
748
748
  }
749
749
  if (Ln(i)) {
750
- const n = Rn(i.text), s = Bn(i.style, e), o = In(i.checked), r = Dn(i.depth, 0), l = i.start, a = typeof l == "number" && l !== void 0 && l !== 1 ? l : void 0;
751
- return L({
750
+ const n = Bn(i.text), s = In(i.style, e), o = Dn(i.checked), r = Nn(i.depth, 0), l = i.start, a = typeof l == "number" && l !== void 0 && l !== 1 ? l : void 0;
751
+ return x({
752
752
  text: n,
753
753
  style: s,
754
754
  checked: o,
@@ -819,7 +819,7 @@ class ce {
819
819
  if (!t)
820
820
  return 0;
821
821
  const e = (o = (s = t.holder) == null ? void 0 : s.querySelector('[role="listitem"]')) == null ? void 0 : o.getAttribute("style"), n = e == null ? void 0 : e.match(/margin-left:\s*(\d+)px/);
822
- return n ? Math.round(parseInt(n[1], 10) / V) : 0;
822
+ return n ? Math.round(parseInt(n[1], 10) / F) : 0;
823
823
  }
824
824
  }
825
825
  const Pn = (i, t) => {
@@ -833,8 +833,8 @@ const Pn = (i, t) => {
833
833
  }, _n = (i, t, e) => {
834
834
  i && i.setAttribute("data-list-depth", String(e));
835
835
  const n = i == null ? void 0 : i.querySelector('[role="listitem"]');
836
- n instanceof HTMLElement && (n.style.marginLeft = e > 0 ? `${e * V}px` : ""), t.depth = e;
837
- }, de = (i, t) => t.getBlockDepth(i), he = (i, t) => t.getBlockStyle(i), Hn = (i, t) => t.getBulletCharacter(i), Dt = (i, t, e, n, s) => {
836
+ n instanceof HTMLElement && (n.style.marginLeft = e > 0 ? `${e * F}px` : ""), t.depth = e;
837
+ }, de = (i, t) => t.getBlockDepth(i), he = (i, t) => t.getBlockStyle(i), On = (i, t) => t.getBulletCharacter(i), Nt = (i, t, e, n, s) => {
838
838
  var r;
839
839
  const o = i && (r = n.getBlockIndex(i)) != null ? r : n.getCurrentBlockIndex();
840
840
  return o <= 0 ? 0 : s.getSiblingIndex(o, t, e);
@@ -849,10 +849,10 @@ const Pn = (i, t) => {
849
849
  n.style
850
850
  );
851
851
  return l === null ? 1 : o.getBlockStartValue(l);
852
- }, Nt = (i, t, e, n, s, o) => {
852
+ }, Ht = (i, t, e, n, s, o) => {
853
853
  const l = Mn(i, t, n, e, s, o) + i;
854
854
  return o.formatNumber(l, t);
855
- }, On = (i, t, e, n) => n.findGroupStart(i, t, e), ue = (i, t, e, n) => {
855
+ }, Wn = (i, t, e, n) => n.findGroupStart(i, t, e), ue = (i, t, e, n) => {
856
856
  if (!i)
857
857
  return;
858
858
  const s = i.holder, o = s == null ? void 0 : s.querySelector('[data-list-style="ordered"]');
@@ -864,8 +864,8 @@ const Pn = (i, t) => {
864
864
  const l = t.getBlockIndex(i.id);
865
865
  if (l == null)
866
866
  return;
867
- const a = de(i, e), c = he(i, n) || "ordered", d = n.getSiblingIndex(l, a, c), u = n.getGroupStartValue(l, a, d, c) + d, f = n.formatNumber(u, a);
868
- r.textContent = f;
867
+ const a = de(i, e), c = he(i, n) || "ordered", d = n.getSiblingIndex(l, a, c), p = n.getGroupStartValue(l, a, d, c) + d, m = n.formatNumber(p, a);
868
+ r.textContent = m;
869
869
  }, $n = (i, t, e, n, s, o, r, l) => {
870
870
  const a = (c) => {
871
871
  if (c >= t)
@@ -896,7 +896,7 @@ const Pn = (i, t) => {
896
896
  const r = o.holder;
897
897
  r != null && r.querySelector('[data-list-style="ordered"]') && ue(o, i, t, e);
898
898
  });
899
- }, Y = (i, t, e = "end") => {
899
+ }, j = (i, t, e = "end") => {
900
900
  requestAnimationFrame(() => {
901
901
  const n = t.holder;
902
902
  if (!n) return;
@@ -911,18 +911,18 @@ const Pn = (i, t) => {
911
911
  const r = document.createRange();
912
912
  e === "start" ? (r.setStart(s, 0), r.collapse(!0)) : (r.selectNodeContents(s), r.collapse(!1)), o.removeAllRanges(), o.addRange(r), i.caret.updateLastCaretAfterPosition();
913
913
  });
914
- }, Wn = async (i) => {
915
- var m;
914
+ }, qn = async (i) => {
915
+ var f;
916
916
  const { api: t, blockId: e, data: n, element: s, getContentElement: o } = i, r = window.getSelection();
917
917
  if (!r || !s) return;
918
918
  const l = o();
919
919
  if (!l) return;
920
920
  const a = l.innerHTML.trim();
921
921
  if (a === "" || a === "<br>") {
922
- await qn(i);
922
+ await Fn(i);
923
923
  return;
924
924
  }
925
- const c = r.getRangeAt(0), { beforeContent: d, afterContent: h } = An(l, c), u = e && (m = t.blocks.getBlockIndex(e)) != null ? m : t.blocks.getCurrentBlockIndex();
925
+ const c = r.getRangeAt(0), { beforeContent: d, afterContent: h } = En(l, c), p = e && (f = t.blocks.getBlockIndex(e)) != null ? f : t.blocks.getCurrentBlockIndex();
926
926
  if (!e) {
927
927
  l.innerHTML = d, n.text = d;
928
928
  const y = t.blocks.insert(w, {
@@ -930,11 +930,11 @@ const Pn = (i, t) => {
930
930
  style: n.style,
931
931
  checked: !1,
932
932
  depth: n.depth
933
- }, void 0, u + 1, !0);
934
- Y(t, y, "start");
933
+ }, void 0, p + 1, !0);
934
+ j(t, y, "start");
935
935
  return;
936
936
  }
937
- const f = t.blocks.splitBlock(
937
+ const m = t.blocks.splitBlock(
938
938
  e,
939
939
  { text: d },
940
940
  w,
@@ -944,10 +944,10 @@ const Pn = (i, t) => {
944
944
  checked: !1,
945
945
  depth: n.depth
946
946
  },
947
- u + 1
947
+ p + 1
948
948
  );
949
- n.text = d, Y(t, f, "start");
950
- }, qn = async (i) => {
949
+ n.text = d, j(t, m, "start");
950
+ }, Fn = async (i) => {
951
951
  const { api: t, blockId: e, getDepth: n } = i;
952
952
  if (n() > 0) {
953
953
  await pe(i);
@@ -956,28 +956,28 @@ const Pn = (i, t) => {
956
956
  if (e === void 0)
957
957
  return;
958
958
  const o = await t.blocks.convert(e, "paragraph", { text: "" });
959
- Y(t, o, "start");
960
- }, Fn = async (i, t) => {
959
+ j(t, o, "start");
960
+ }, zn = async (i, t) => {
961
961
  const { api: e, blockId: n, data: s, element: o, getContentElement: r, getDepth: l, syncContentFromDOM: a } = i, c = window.getSelection();
962
962
  if (!c || !o) return;
963
963
  const d = c.getRangeAt(0), h = r();
964
964
  if (!h) return;
965
965
  a();
966
- const u = s.text, f = l();
967
- if (xn(h, d) && !c.isCollapsed) {
966
+ const p = s.text, m = l();
967
+ if (Tn(h, d) && !c.isCollapsed) {
968
968
  t.preventDefault(), h.innerHTML = "", s.text = "";
969
969
  const b = document.createRange();
970
970
  b.setStart(h, 0), b.collapse(!0), c.removeAllRanges(), c.addRange(b);
971
971
  return;
972
972
  }
973
- if (!kn(h, d) || (t.preventDefault(), n === void 0))
973
+ if (!xn(h, d) || (t.preventDefault(), n === void 0))
974
974
  return;
975
- const y = await e.blocks.convert(n, "paragraph", { text: u });
976
- f > 0 && requestAnimationFrame(() => {
975
+ const y = await e.blocks.convert(n, "paragraph", { text: p });
976
+ m > 0 && requestAnimationFrame(() => {
977
977
  const b = y.holder;
978
- b && (b.style.marginLeft = `${f * V}px`, b.setAttribute("data-blok-depth", String(f)));
979
- }), Y(e, y, "start");
980
- }, zn = async (i, t) => {
978
+ b && (b.style.marginLeft = `${m * F}px`, b.setAttribute("data-blok-depth", String(m)));
979
+ }), j(e, y, "start");
980
+ }, Vn = async (i, t) => {
981
981
  const { api: e, blockId: n, data: s, syncContentFromDOM: o, getDepth: r } = i, l = e.blocks.getCurrentBlockIndex();
982
982
  if (l === 0) return;
983
983
  const a = e.blocks.getBlockByIndex(l - 1);
@@ -987,21 +987,21 @@ const Pn = (i, t) => {
987
987
  o();
988
988
  const h = c + 1;
989
989
  s.depth = h;
990
- const u = await e.blocks.update(n || "", tt(L({}, s), {
990
+ const p = await e.blocks.update(n || "", tt(x({}, s), {
991
991
  depth: h
992
992
  }));
993
- Y(e, u);
993
+ j(e, p);
994
994
  }, pe = async (i) => {
995
995
  const { api: t, blockId: e, data: n, syncContentFromDOM: s, getDepth: o } = i, r = o();
996
996
  if (r === 0) return;
997
997
  s();
998
998
  const l = r - 1;
999
999
  n.depth = l;
1000
- const a = await t.blocks.update(e || "", tt(L({}, n), {
1000
+ const a = await t.blocks.update(e || "", tt(x({}, n), {
1001
1001
  depth: l
1002
1002
  }));
1003
- Y(t, a);
1004
- }, Vn = (i) => {
1003
+ j(t, a);
1004
+ }, Un = (i) => {
1005
1005
  const { data: t, readOnly: e, placeholder: n, itemColor: s, itemSize: o, setupItemPlaceholder: r, onCheckboxChange: l, keydownHandler: a } = i, c = ae({
1006
1006
  data: t,
1007
1007
  readOnly: e,
@@ -1017,14 +1017,14 @@ const Pn = (i, t) => {
1017
1017
  });
1018
1018
  }
1019
1019
  return c.wrapper;
1020
- }, Un = (i) => {
1020
+ }, Kn = (i) => {
1021
1021
  const t = (e) => {
1022
1022
  if (e <= 0) return "";
1023
1023
  const n = e - 1;
1024
1024
  return t(Math.floor(n / 26)) + String.fromCharCode(97 + n % 26);
1025
1025
  };
1026
1026
  return t(i);
1027
- }, Kn = (i) => {
1027
+ }, jn = (i) => {
1028
1028
  const t = [
1029
1029
  [1e3, "m"],
1030
1030
  [900, "cm"],
@@ -1105,7 +1105,7 @@ class ge {
1105
1105
  */
1106
1106
  formatNumber(t, e) {
1107
1107
  const n = e % 3;
1108
- return n === 1 ? `${Un(t)}.` : n === 2 ? `${Kn(t)}.` : `${t}.`;
1108
+ return n === 1 ? `${Kn(t)}.` : n === 2 ? `${jn(t)}.` : `${t}.`;
1109
1109
  }
1110
1110
  /**
1111
1111
  * Get the start value for a list group.
@@ -1158,7 +1158,7 @@ class ge {
1158
1158
  if (!t)
1159
1159
  return 0;
1160
1160
  const e = (o = (s = t.holder) == null ? void 0 : s.querySelector('[role="listitem"]')) == null ? void 0 : o.getAttribute("style"), n = e == null ? void 0 : e.match(/margin-left:\s*(\d+)px/);
1161
- return n ? Math.round(parseInt(n[1], 10) / V) : 0;
1161
+ return n ? Math.round(parseInt(n[1], 10) / F) : 0;
1162
1162
  }
1163
1163
  /**
1164
1164
  * Get the style of a block by reading from its DOM.
@@ -1201,8 +1201,8 @@ class ge {
1201
1201
  return r < n ? e : r > n ? this.findGroupStartRecursive(t - 1, e, n, s) : this.getBlockStyle(o) !== s ? e : this.findGroupStartRecursive(t - 1, t, n, s);
1202
1202
  }
1203
1203
  }
1204
- const dt = { value: !1 };
1205
- class jn {
1204
+ const ut = { value: !1 };
1205
+ class Xn {
1206
1206
  constructor(t) {
1207
1207
  this.blocks = t, this.depthValidator = new ce(t), this.markerCalculator = new ge(t);
1208
1208
  }
@@ -1256,8 +1256,8 @@ class jn {
1256
1256
  * Uses a static flag to deduplicate multiple calls in the same frame.
1257
1257
  */
1258
1258
  scheduleUpdateAll() {
1259
- dt.value || (dt.value = !0, requestAnimationFrame(() => {
1260
- dt.value = !1, this.updateAllMarkers();
1259
+ ut.value || (ut.value = !0, requestAnimationFrame(() => {
1260
+ ut.value = !1, this.updateAllMarkers();
1261
1261
  }));
1262
1262
  }
1263
1263
  /**
@@ -1311,15 +1311,15 @@ class jn {
1311
1311
  if (o == null)
1312
1312
  return;
1313
1313
  const r = this.depthValidator.getBlockDepth(t), l = this.getBlockStyle(t) || "ordered", a = this.markerCalculator.getSiblingIndex(o, r, l), c = this.markerCalculator.getGroupStartValue(o, r, a, l), h = (a === 0 && c === 1 ? (() => {
1314
- const f = n.closest("[data-list-start]"), m = f == null ? void 0 : f.getAttribute("data-list-start");
1315
- if (!m) return c;
1316
- const y = parseInt(m, 10);
1314
+ const m = n.closest("[data-list-start]"), f = m == null ? void 0 : m.getAttribute("data-list-start");
1315
+ if (!f) return c;
1316
+ const y = parseInt(f, 10);
1317
1317
  return isNaN(y) ? c : y;
1318
- })() : c) + a, u = this.markerCalculator.formatNumber(h, r);
1319
- s.textContent = u;
1318
+ })() : c) + a, p = this.markerCalculator.formatNumber(h, r);
1319
+ s.textContent = p;
1320
1320
  }
1321
1321
  }
1322
- const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
1322
+ const Yn = (i) => i instanceof HTMLElement, Zn = /* @__PURE__ */ new Set([
1323
1323
  "decimal",
1324
1324
  "decimal-leading-zero",
1325
1325
  "lower-roman",
@@ -1350,12 +1350,12 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
1350
1350
  "telugu",
1351
1351
  "thai",
1352
1352
  "tibetan"
1353
- ]), Zn = /* @__PURE__ */ new Set([
1353
+ ]), Jn = /* @__PURE__ */ new Set([
1354
1354
  "disc",
1355
1355
  "circle",
1356
1356
  "square",
1357
1357
  "none"
1358
- ]), Jn = (i) => {
1358
+ ]), Qn = (i) => {
1359
1359
  const t = i.getAttribute("data-list-style");
1360
1360
  if (t === "ordered") return "ordered";
1361
1361
  if (t === "unordered") return "unordered";
@@ -1364,25 +1364,25 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
1364
1364
  const n = e.match(/list-style-type\s*:\s*([^;]+)/);
1365
1365
  if (!n) return null;
1366
1366
  const s = n[1].trim().toLowerCase();
1367
- return Yn.has(s) ? "ordered" : Zn.has(s) ? "unordered" : null;
1368
- }, Qn = (i, t) => {
1367
+ return Zn.has(s) ? "ordered" : Jn.has(s) ? "unordered" : null;
1368
+ }, ts = (i, t) => {
1369
1369
  const e = i.parentElement;
1370
1370
  if ((e == null ? void 0 : e.tagName) === "OL") return "ordered";
1371
1371
  if ((e == null ? void 0 : e.tagName) === "UL")
1372
1372
  return i.querySelector('input[type="checkbox"]') ? "checklist" : "unordered";
1373
- const n = Jn(i);
1373
+ const n = Qn(i);
1374
1374
  return n || t;
1375
- }, ts = (i) => {
1375
+ }, es = (i) => {
1376
1376
  const t = i.innerHTML || i.textContent || "", e = i.querySelector('input[type="checkbox"]'), n = e instanceof HTMLInputElement ? e.checked : !1;
1377
1377
  return { text: t, checked: n };
1378
- }, es = (i) => {
1378
+ }, ns = (i) => {
1379
1379
  const t = i.getAttribute("aria-level");
1380
1380
  if (t) {
1381
1381
  const e = parseInt(t, 10);
1382
1382
  return Math.max(0, e - 1);
1383
1383
  }
1384
1384
  return 0;
1385
- }, ns = () => ({
1385
+ }, ss = () => ({
1386
1386
  text: {
1387
1387
  br: !0,
1388
1388
  a: {
@@ -1394,7 +1394,7 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
1394
1394
  i: !0,
1395
1395
  mark: !0
1396
1396
  }
1397
- }), ss = () => ({
1397
+ }), os = () => ({
1398
1398
  tags: [
1399
1399
  {
1400
1400
  li: {
@@ -1405,7 +1405,7 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
1405
1405
  }
1406
1406
  }
1407
1407
  ]
1408
- }), os = () => ({
1408
+ }), is = () => ({
1409
1409
  export: (i) => i.text,
1410
1410
  import: (i) => ({
1411
1411
  text: i,
@@ -1417,23 +1417,23 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
1417
1417
  name: "bulletedList",
1418
1418
  titleKey: "bulletedList",
1419
1419
  style: "unordered",
1420
- icon: te
1420
+ icon: Qt
1421
1421
  },
1422
1422
  {
1423
1423
  name: "numberedList",
1424
1424
  titleKey: "numberedList",
1425
1425
  style: "ordered",
1426
- icon: ee
1426
+ icon: te
1427
1427
  },
1428
1428
  {
1429
1429
  name: "todoList",
1430
1430
  titleKey: "todoList",
1431
1431
  style: "checklist",
1432
- icon: ne
1432
+ icon: ee
1433
1433
  }
1434
- ], is = () => [
1434
+ ], rs = () => [
1435
1435
  {
1436
- icon: te,
1436
+ icon: Qt,
1437
1437
  title: "Bulleted list",
1438
1438
  titleKey: "bulletedList",
1439
1439
  data: { style: "unordered" },
@@ -1442,7 +1442,7 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
1442
1442
  shortcut: "-"
1443
1443
  },
1444
1444
  {
1445
- icon: ee,
1445
+ icon: te,
1446
1446
  title: "Numbered list",
1447
1447
  titleKey: "numberedList",
1448
1448
  data: { style: "ordered" },
@@ -1451,7 +1451,7 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
1451
1451
  shortcut: "1."
1452
1452
  },
1453
1453
  {
1454
- icon: ne,
1454
+ icon: ee,
1455
1455
  title: "To-do list",
1456
1456
  titleKey: "todoList",
1457
1457
  data: { style: "checklist" },
@@ -1460,18 +1460,18 @@ const Xn = (i) => i instanceof HTMLElement, Yn = /* @__PURE__ */ new Set([
1460
1460
  shortcut: "[]"
1461
1461
  }
1462
1462
  ];
1463
- class ao {
1463
+ class vo {
1464
1464
  constructor({ data: t, config: e, api: n, readOnly: s, block: o }) {
1465
1465
  this._element = null, this.handleBlockChanged = (r) => {
1466
1466
  var l;
1467
1467
  this.isBlockChangedEventPayload(r) && (r.event.type === "block-removed" || r.event.type === "block-added") && ((l = this.markerManager) == null || l.scheduleUpdateAll());
1468
- }, this.api = n, this.readOnly = s, this._settings = e || {}, this._data = this.normalizeData(t), this.depthValidator = new ce(n.blocks), this.markerCalculator = new ge(n.blocks), this.markerManager = this._data.style === "ordered" ? new jn(n.blocks) : null, o && (this.blockId = o.id), this._data.style === "ordered" && this.api.events.on("block changed", this.handleBlockChanged);
1468
+ }, this.api = n, this.readOnly = s, this._settings = e || {}, this._data = this.normalizeData(t), this.depthValidator = new ce(n.blocks), this.markerCalculator = new ge(n.blocks), this.markerManager = this._data.style === "ordered" ? new Xn(n.blocks) : null, o && (this.blockId = o.id), this._data.style === "ordered" && this.api.events.on("block changed", this.handleBlockChanged);
1469
1469
  }
1470
1470
  isBlockChangedEventPayload(t) {
1471
1471
  return typeof t == "object" && t !== null && "event" in t && typeof t.event == "object" && t.event !== null && "type" in t.event && typeof t.event.type == "string";
1472
1472
  }
1473
1473
  normalizeData(t) {
1474
- return Nn(t, this._settings);
1474
+ return Hn(t, this._settings);
1475
1475
  }
1476
1476
  get availableStyles() {
1477
1477
  const t = this._settings.styles;
@@ -1484,13 +1484,13 @@ class ao {
1484
1484
  return this._settings.itemSize;
1485
1485
  }
1486
1486
  get placeholder() {
1487
- return this.api.i18n.t(cn);
1487
+ return this.api.i18n.t(dn);
1488
1488
  }
1489
1489
  setupItemPlaceholder(t) {
1490
- this.readOnly || wt(t, this.placeholder);
1490
+ this.readOnly || Et(t, this.placeholder);
1491
1491
  }
1492
1492
  render() {
1493
- return this._element = Vn({
1493
+ return this._element = Un({
1494
1494
  data: this._data,
1495
1495
  readOnly: this.readOnly,
1496
1496
  placeholder: this.placeholder,
@@ -1535,12 +1535,12 @@ class ao {
1535
1535
  const t = (o = this._element) == null ? void 0 : o.querySelector("[data-list-marker]");
1536
1536
  if (!t)
1537
1537
  return;
1538
- const e = this.getDepth(), n = Dt(this.blockId, e, this._data.style, this.api.blocks, this.markerCalculator), s = Nt(n, e, this._data, this.blockId, this.api.blocks, this.markerCalculator);
1538
+ const e = this.getDepth(), n = Nt(this.blockId, e, this._data.style, this.api.blocks, this.markerCalculator), s = Ht(n, e, this._data, this.blockId, this.api.blocks, this.markerCalculator);
1539
1539
  t.textContent = s;
1540
1540
  }
1541
1541
  updateSiblingListMarkers() {
1542
1542
  var r;
1543
- const t = this.blockId ? (r = this.api.blocks.getBlockIndex(this.blockId)) != null ? r : this.api.blocks.getCurrentBlockIndex() : this.api.blocks.getCurrentBlockIndex(), e = this.getDepth(), n = this._data.style, s = this.api.blocks.getBlocksCount(), o = On(t, e, n, this.markerCalculator);
1543
+ const t = this.blockId ? (r = this.api.blocks.getBlockIndex(this.blockId)) != null ? r : this.api.blocks.getCurrentBlockIndex() : this.api.blocks.getCurrentBlockIndex(), e = this.getDepth(), n = this._data.style, s = this.api.blocks.getBlocksCount(), o = Wn(t, e, n, this.markerCalculator);
1544
1544
  $n(o, s, t, e, n, this.api.blocks, this.depthValidator, this.markerCalculator);
1545
1545
  }
1546
1546
  updateMarkerForDepth(t, e) {
@@ -1548,10 +1548,10 @@ class ao {
1548
1548
  const n = (s = this._element) == null ? void 0 : s.querySelector('[aria-hidden="true"]');
1549
1549
  if (n instanceof HTMLElement)
1550
1550
  if (e === "ordered") {
1551
- const o = Dt(this.blockId, t, this._data.style, this.api.blocks, this.markerCalculator), r = Nt(o, t, this._data, this.blockId, this.api.blocks, this.markerCalculator);
1551
+ const o = Nt(this.blockId, t, this._data.style, this.api.blocks, this.markerCalculator), r = Ht(o, t, this._data, this.blockId, this.api.blocks, this.markerCalculator);
1552
1552
  n.textContent = r;
1553
1553
  } else {
1554
- const o = Hn(t, this.markerCalculator);
1554
+ const o = On(t, this.markerCalculator);
1555
1555
  n.textContent = o;
1556
1556
  }
1557
1557
  }
@@ -1591,7 +1591,7 @@ class ao {
1591
1591
  syncContentFromDOM: this.syncContentFromDOM.bind(this),
1592
1592
  getDepth: this.getDepth.bind(this)
1593
1593
  };
1594
- await Wn(t);
1594
+ await qn(t);
1595
1595
  }
1596
1596
  async handleBackspace(t) {
1597
1597
  const e = {
@@ -1603,7 +1603,7 @@ class ao {
1603
1603
  syncContentFromDOM: this.syncContentFromDOM.bind(this),
1604
1604
  getDepth: this.getDepth.bind(this)
1605
1605
  };
1606
- await Fn(e, t);
1606
+ await zn(e, t);
1607
1607
  }
1608
1608
  async handleIndent() {
1609
1609
  const t = {
@@ -1615,7 +1615,7 @@ class ao {
1615
1615
  syncContentFromDOM: this.syncContentFromDOM.bind(this),
1616
1616
  getDepth: this.getDepth.bind(this)
1617
1617
  };
1618
- await zn(t, this.depthValidator);
1618
+ await Vn(t, this.depthValidator);
1619
1619
  }
1620
1620
  async handleOutdent() {
1621
1621
  const t = {
@@ -1641,7 +1641,7 @@ class ao {
1641
1641
  return Pn(this._element, this._data.style);
1642
1642
  }
1643
1643
  renderSettings() {
1644
- return bn(this.availableStyles, this._data.style, this.api.i18n.t, (t) => this.setStyle(t));
1644
+ return vn(this.availableStyles, this._data.style, this.api.i18n.t, (t) => this.setStyle(t));
1645
1645
  }
1646
1646
  setStyle(t) {
1647
1647
  const e = this._data.style;
@@ -1650,7 +1650,7 @@ class ao {
1650
1650
  });
1651
1651
  }
1652
1652
  rerender() {
1653
- const t = fn({
1653
+ const t = mn({
1654
1654
  data: this._data,
1655
1655
  readOnly: this.readOnly,
1656
1656
  placeholder: this.placeholder,
@@ -1669,10 +1669,10 @@ class ao {
1669
1669
  return typeof t.text == "string";
1670
1670
  }
1671
1671
  save() {
1672
- return mn(this._data, this._element, this.getContentElement.bind(this));
1672
+ return Cn(this._data, this._element, this.getContentElement.bind(this));
1673
1673
  }
1674
1674
  setData(t) {
1675
- const e = Cn(
1675
+ const e = yn(
1676
1676
  this._data,
1677
1677
  t,
1678
1678
  this._element,
@@ -1686,35 +1686,35 @@ class ao {
1686
1686
  return this._data = e.newData, e.inPlace;
1687
1687
  }
1688
1688
  merge(t) {
1689
- yn(
1689
+ bn(
1690
1690
  {
1691
1691
  data: this._data,
1692
1692
  element: this._element,
1693
1693
  getContentElement: this.getContentElement.bind(this),
1694
- parseHTML: En
1694
+ parseHTML: kn
1695
1695
  },
1696
1696
  t
1697
1697
  );
1698
1698
  }
1699
1699
  static get conversionConfig() {
1700
- return os();
1700
+ return is();
1701
1701
  }
1702
1702
  static get sanitize() {
1703
- return ns();
1703
+ return ss();
1704
1704
  }
1705
1705
  static get pasteConfig() {
1706
- return ss();
1706
+ return os();
1707
1707
  }
1708
1708
  onPaste(t) {
1709
1709
  const e = t.detail;
1710
1710
  if (!("data" in e)) return;
1711
1711
  const n = e.data;
1712
- if (!Xn(n))
1712
+ if (!Yn(n))
1713
1713
  return;
1714
- const { text: s, checked: o } = ts(n), r = es(n);
1714
+ const { text: s, checked: o } = es(n), r = ns(n);
1715
1715
  this._data = {
1716
1716
  text: s,
1717
- style: Qn(n, this._data.style),
1717
+ style: ts(n, this._data.style),
1718
1718
  checked: o,
1719
1719
  depth: r
1720
1720
  }, this.rerender();
@@ -1723,19 +1723,19 @@ class ao {
1723
1723
  return !0;
1724
1724
  }
1725
1725
  getContentOffset(t) {
1726
- return wn(t);
1726
+ return An(t);
1727
1727
  }
1728
1728
  static get toolbox() {
1729
- return is();
1729
+ return rs();
1730
1730
  }
1731
1731
  }
1732
- const rs = "data-blok-table-add-row", ls = "data-blok-table-add-col", _t = 150, as = 5, Ht = 40, Mt = [
1732
+ const ls = "data-blok-table-add-row", as = "data-blok-table-add-col", _t = 150, cs = 5, Ot = 40, Mt = [
1733
1733
  "flex",
1734
1734
  "items-center",
1735
1735
  "justify-center",
1736
1736
  "transition-opacity",
1737
1737
  "duration-150"
1738
- ], Ot = [
1738
+ ], Wt = [
1739
1739
  "flex",
1740
1740
  "items-center",
1741
1741
  "justify-center",
@@ -1744,9 +1744,9 @@ const rs = "data-blok-table-add-row", ls = "data-blok-table-add-col", _t = 150,
1744
1744
  "rounded-full",
1745
1745
  "group-hover/add:bg-gray-50"
1746
1746
  ], $t = "12";
1747
- class cs {
1747
+ class ds {
1748
1748
  constructor(t) {
1749
- this.rowHideTimeout = null, this.colHideTimeout = null, this.rowVisible = !1, this.colVisible = !1, this.dragState = null, this.wrapper = t.wrapper, this.grid = t.grid, this.boundAddRowClick = t.onAddRow, this.boundAddColClick = t.onAddColumn, this.onDragStart = t.onDragStart, this.onDragAddRow = t.onDragAddRow, this.onDragRemoveRow = t.onDragRemoveRow, this.onDragAddCol = t.onDragAddCol, this.onDragRemoveCol = t.onDragRemoveCol, this.onDragEnd = t.onDragEnd, this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseLeave = this.handleMouseLeave.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundRowPointerDown = (e) => this.handlePointerDown("row", e), this.boundColPointerDown = (e) => this.handlePointerDown("col", e), this.addRowBtn = this.createAddRowButton(), this.addColBtn = this.createAddColumnButton(), this.wrapper.appendChild(this.addRowBtn), this.grid.appendChild(this.addColBtn), this.syncRowButtonWidth(), this.wrapper.addEventListener("mousemove", this.boundMouseMove), this.wrapper.addEventListener("mouseleave", this.boundMouseLeave), this.addRowBtn.addEventListener("pointerdown", this.boundRowPointerDown), this.addColBtn.addEventListener("pointerdown", this.boundColPointerDown);
1749
+ this.rowHideTimeout = null, this.colHideTimeout = null, this.rowVisible = !1, this.colVisible = !1, this.dragState = null, this.wrapper = t.wrapper, this.grid = t.grid, this.i18n = t.i18n, this.boundAddRowClick = t.onAddRow, this.boundAddColClick = t.onAddColumn, this.onDragStart = t.onDragStart, this.onDragAddRow = t.onDragAddRow, this.onDragRemoveRow = t.onDragRemoveRow, this.onDragAddCol = t.onDragAddCol, this.onDragRemoveCol = t.onDragRemoveCol, this.onDragEnd = t.onDragEnd, this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseLeave = this.handleMouseLeave.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundRowPointerDown = (e) => this.handlePointerDown("row", e), this.boundColPointerDown = (e) => this.handlePointerDown("col", e), this.addRowBtn = this.createAddRowButton(), this.addColBtn = this.createAddColumnButton(), this.wrapper.appendChild(this.addRowBtn), this.grid.appendChild(this.addColBtn), this.syncRowButtonWidth(), this.wrapper.addEventListener("mousemove", this.boundMouseMove), this.wrapper.addEventListener("mouseleave", this.boundMouseLeave), this.addRowBtn.addEventListener("pointerdown", this.boundRowPointerDown), this.addColBtn.addEventListener("pointerdown", this.boundColPointerDown);
1750
1750
  }
1751
1751
  /**
1752
1752
  * Match the add-row button width to the grid's explicit width.
@@ -1771,8 +1771,11 @@ class cs {
1771
1771
  * Disables pointer events and hover effects during cell selection.
1772
1772
  */
1773
1773
  setInteractive(t) {
1774
- const e = t ? "" : "none";
1775
- this.addRowBtn.style.pointerEvents = e, this.addColBtn.style.pointerEvents = e;
1774
+ if (!t) {
1775
+ this.addRowBtn.style.pointerEvents = "none", this.addColBtn.style.pointerEvents = "none";
1776
+ return;
1777
+ }
1778
+ this.addRowBtn.style.pointerEvents = this.rowVisible ? "" : "none", this.addColBtn.style.pointerEvents = this.colVisible ? "" : "none";
1776
1779
  }
1777
1780
  destroy() {
1778
1781
  if (this.wrapper.removeEventListener("mousemove", this.boundMouseMove), this.wrapper.removeEventListener("mouseleave", this.boundMouseLeave), this.addRowBtn.removeEventListener("pointerdown", this.boundRowPointerDown), this.addColBtn.removeEventListener("pointerdown", this.boundColPointerDown), this.dragState) {
@@ -1803,7 +1806,7 @@ class cs {
1803
1806
  e === "row" ? this.onDragAddRow() : this.onDragAddCol(), this.dragState.addedCount++;
1804
1807
  for (; this.dragState.addedCount > l; )
1805
1808
  e === "row" ? this.onDragRemoveRow() : this.onDragRemoveCol(), this.dragState.addedCount--;
1806
- Math.abs(r) > as && !this.dragState.didDrag && (this.dragState.didDrag = !0, document.body.style.cursor = e === "row" ? "row-resize" : "col-resize", Oe(), this.onDragStart());
1809
+ Math.abs(r) > cs && !this.dragState.didDrag && (this.dragState.didDrag = !0, document.body.style.cursor = e === "row" ? "row-resize" : "col-resize", We(), this.onDragStart());
1807
1810
  }
1808
1811
  handlePointerUp(t) {
1809
1812
  if (!this.dragState)
@@ -1828,27 +1831,27 @@ class cs {
1828
1831
  }
1829
1832
  handleMouseMove(t) {
1830
1833
  const e = this.grid.getBoundingClientRect(), n = Math.abs(t.clientY - e.bottom), s = Math.abs(t.clientX - e.right);
1831
- n <= Ht ? this.showRow() : this.scheduleHideRow(), s <= Ht ? this.showCol() : this.scheduleHideCol();
1834
+ n <= Ot ? this.showRow() : this.scheduleHideRow(), s <= Ot ? this.showCol() : this.scheduleHideCol();
1832
1835
  }
1833
1836
  handleMouseLeave() {
1834
1837
  this.scheduleHideRow(), this.scheduleHideCol();
1835
1838
  }
1836
1839
  showRow() {
1837
- this.clearRowTimeout(), this.rowVisible || (this.addRowBtn.style.opacity = "1", this.rowVisible = !0);
1840
+ this.clearRowTimeout(), this.rowVisible || (this.addRowBtn.style.opacity = "1", this.addRowBtn.style.pointerEvents = "", this.rowVisible = !0);
1838
1841
  }
1839
1842
  showCol() {
1840
- this.clearColTimeout(), this.colVisible || (this.addColBtn.style.opacity = "1", this.colVisible = !0);
1843
+ this.clearColTimeout(), this.colVisible || (this.addColBtn.style.opacity = "1", this.addColBtn.style.pointerEvents = "", this.colVisible = !0);
1841
1844
  }
1842
1845
  scheduleHideRow() {
1843
1846
  var t;
1844
1847
  !this.rowVisible || this.rowHideTimeout !== null || ((t = this.dragState) == null ? void 0 : t.axis) === "row" || (this.rowHideTimeout = setTimeout(() => {
1845
- this.addRowBtn.style.opacity = "0", this.rowVisible = !1, this.rowHideTimeout = null;
1848
+ this.addRowBtn.style.opacity = "0", this.addRowBtn.style.pointerEvents = "none", this.rowVisible = !1, this.rowHideTimeout = null;
1846
1849
  }, _t));
1847
1850
  }
1848
1851
  scheduleHideCol() {
1849
1852
  var t;
1850
1853
  !this.colVisible || this.colHideTimeout !== null || ((t = this.dragState) == null ? void 0 : t.axis) === "col" || (this.colHideTimeout = setTimeout(() => {
1851
- this.addColBtn.style.opacity = "0", this.colVisible = !1, this.colHideTimeout = null;
1854
+ this.addColBtn.style.opacity = "0", this.addColBtn.style.pointerEvents = "none", this.colVisible = !1, this.colHideTimeout = null;
1852
1855
  }, _t));
1853
1856
  }
1854
1857
  clearRowTimeout() {
@@ -1859,20 +1862,20 @@ class cs {
1859
1862
  }
1860
1863
  createAddRowButton() {
1861
1864
  const t = document.createElement("div");
1862
- t.className = v(Mt, "group/add", "items-start", "cursor-row-resize"), t.setAttribute(rs, ""), t.setAttribute("contenteditable", "false"), t.style.opacity = "0", t.style.boxSizing = "content-box", t.style.width = "100%", t.style.height = "32px", t.style.padding = "4px 8px 0", t.style.marginLeft = "-8px";
1865
+ t.className = v(Mt, "group/add", "items-start", "cursor-row-resize"), t.setAttribute(ls, ""), t.setAttribute("contenteditable", "false"), t.style.opacity = "0", t.style.pointerEvents = "none", t.style.position = "absolute", t.style.left = "0", t.style.bottom = "-36px", t.style.boxSizing = "content-box", t.style.width = "100%", t.style.height = "32px", t.style.padding = "4px 8px 0", t.style.marginLeft = "-8px";
1863
1866
  const e = document.createElement("div");
1864
- return e.className = v(Ot), e.style.width = "100%", e.style.height = "16px", this.appendIcon(e), t.appendChild(e), xt(t, Tt([
1865
- "Click to add a new row",
1866
- "Drag to add or remove rows"
1867
+ return e.className = v(Wt), e.style.width = "100%", e.style.height = "16px", this.appendIcon(e), t.appendChild(e), Rt(t, Lt([
1868
+ this.i18n.t("tools.table.clickToAddRow"),
1869
+ this.i18n.t("tools.table.dragToAddRemoveRows")
1867
1870
  ]), { placement: "bottom", marginTop: -16 }), t;
1868
1871
  }
1869
1872
  createAddColumnButton() {
1870
1873
  const t = document.createElement("div");
1871
- t.className = v(Mt, "group/add", "justify-start", "cursor-col-resize"), t.setAttribute(ls, ""), t.setAttribute("contenteditable", "false"), t.style.opacity = "0", t.style.position = "absolute", t.style.right = "-36px", t.style.top = "0px", t.style.bottom = "0px", t.style.width = "32px";
1874
+ t.className = v(Mt, "group/add", "justify-start", "cursor-col-resize"), t.setAttribute(as, ""), t.setAttribute("contenteditable", "false"), t.style.opacity = "0", t.style.pointerEvents = "none", t.style.position = "absolute", t.style.right = "-36px", t.style.top = "0px", t.style.bottom = "0px", t.style.width = "32px";
1872
1875
  const e = document.createElement("div");
1873
- return e.className = v(Ot), e.style.width = "16px", e.style.height = "100%", this.appendIcon(e), t.appendChild(e), xt(t, Tt([
1874
- "Click to add a new column",
1875
- "Drag to add or remove columns"
1876
+ return e.className = v(Wt), e.style.width = "16px", e.style.height = "100%", this.appendIcon(e), t.appendChild(e), Rt(t, Lt([
1877
+ this.i18n.t("tools.table.clickToAddColumn"),
1878
+ this.i18n.t("tools.table.dragToAddRemoveColumns")
1876
1879
  ]), { placement: "bottom" }), t;
1877
1880
  }
1878
1881
  appendIcon(t) {
@@ -1881,20 +1884,21 @@ class cs {
1881
1884
  e && (e.setAttribute("width", $t), e.setAttribute("height", $t), e.setAttribute("viewBox", "0 0 24 24"), e.classList.add("text-gray-500", "pointer-events-none"));
1882
1885
  }
1883
1886
  }
1884
- const g = "data-blok-table-row", p = "data-blok-table-cell", $ = 1, nt = `${$}px solid #d1d5db`, ds = [
1887
+ const g = "data-blok-table-row", u = "data-blok-table-cell", P = 1, nt = `${P}px solid #d1d5db`, hs = [
1885
1888
  "flex"
1886
- ], hs = [
1889
+ ], us = [
1887
1890
  "py-1",
1888
1891
  "px-2",
1889
1892
  "min-h-[2em]",
1890
1893
  "outline-none",
1891
1894
  "leading-normal",
1892
- "text-sm"
1893
- ], us = (i) => {
1895
+ "text-sm",
1896
+ "cursor-text"
1897
+ ], ps = (i) => {
1894
1898
  const t = Math.round(100 / i * 100) / 100;
1895
1899
  return Array.from({ length: i }, () => t);
1896
1900
  };
1897
- class ps {
1901
+ class gs {
1898
1902
  constructor(t) {
1899
1903
  this.readOnly = t.readOnly;
1900
1904
  }
@@ -1904,7 +1908,7 @@ class ps {
1904
1908
  createGrid(t, e, n) {
1905
1909
  const s = document.createElement("div");
1906
1910
  s.style.borderTop = nt, s.style.borderLeft = nt;
1907
- const o = n != null ? n : us(e);
1911
+ const o = n != null ? n : ps(e);
1908
1912
  return Array.from({ length: t }).forEach(() => {
1909
1913
  s.appendChild(this.createRow(e, o));
1910
1914
  }), s;
@@ -1921,7 +1925,7 @@ class ps {
1921
1925
  getData(t) {
1922
1926
  const e = t.querySelectorAll(`[${g}]`), n = [];
1923
1927
  return e.forEach((s) => {
1924
- const o = s.querySelectorAll(`[${p}]`), r = [];
1928
+ const o = s.querySelectorAll(`[${u}]`), r = [];
1925
1929
  o.forEach((l) => {
1926
1930
  r.push(this.getCellContent(l));
1927
1931
  }), n.push(r);
@@ -1950,16 +1954,16 @@ class ps {
1950
1954
  * those widths and the new column is added in px mode. This prevents
1951
1955
  * existing columns from shrinking when the table is in percent mode.
1952
1956
  */
1953
- addColumn(t, e, n) {
1954
- const s = t.querySelectorAll(`[${g}]`), o = this.getColumnCount(t), r = n !== void 0 && n.length === o, l = r || this.detectWidthUnit(t) === "px";
1955
- return r && this.convertToPixelWidths(s, n), l ? (this.addColumnPx(s, o, e), !0) : (this.addColumnPercent(s, o, e), !0);
1957
+ addColumn(t, e, n, s) {
1958
+ const o = t.querySelectorAll(`[${g}]`), r = this.getColumnCount(t), l = n !== void 0 && n.length === r, a = l || this.detectWidthUnit(t) === "px";
1959
+ return l && this.convertToPixelWidths(o, n), a ? (this.addColumnPx(o, r, e, s), !0) : (this.addColumnPercent(o, r, e), !0);
1956
1960
  }
1957
1961
  /**
1958
1962
  * Convert all cells in each row to the given pixel widths
1959
1963
  */
1960
1964
  convertToPixelWidths(t, e) {
1961
1965
  t.forEach((n) => {
1962
- n.querySelectorAll(`[${p}]`).forEach((o, r) => {
1966
+ n.querySelectorAll(`[${u}]`).forEach((o, r) => {
1963
1967
  if (r < e.length) {
1964
1968
  const l = o;
1965
1969
  l.style.width = `${e[r]}px`;
@@ -1968,33 +1972,37 @@ class ps {
1968
1972
  });
1969
1973
  }
1970
1974
  /**
1971
- * Add column in px mode: keep existing widths, add new column at half the average width
1975
+ * Add column in px mode: keep existing widths, add new column at given width or half the average
1972
1976
  */
1973
- addColumnPx(t, e, n) {
1974
- const s = t[0], o = s == null ? void 0 : s.querySelectorAll(`[${p}]`), r = Array.from(o != null ? o : []).reduce(
1975
- (a, c) => a + (parseFloat(c.style.width) || 0),
1976
- 0
1977
- ), l = e > 0 ? Math.round(r / e / 2 * 100) / 100 : 0;
1978
- t.forEach((a) => {
1979
- const c = a.querySelectorAll(`[${p}]`), d = n === void 0 || n >= c.length, h = this.createCell(`${l}px`);
1980
- if (!d) {
1981
- a.insertBefore(h, c[n]);
1977
+ addColumnPx(t, e, n, s) {
1978
+ const o = s != null ? s : this.computeHalfAvgPxWidth(t, e);
1979
+ t.forEach((r) => {
1980
+ const l = r.querySelectorAll(`[${u}]`), a = n === void 0 || n >= l.length, c = this.createCell(`${o}px`);
1981
+ if (!a) {
1982
+ r.insertBefore(c, l[n]);
1982
1983
  return;
1983
1984
  }
1984
- a.appendChild(h);
1985
+ r.appendChild(c);
1985
1986
  });
1986
1987
  }
1988
+ computeHalfAvgPxWidth(t, e) {
1989
+ const n = t[0], s = n == null ? void 0 : n.querySelectorAll(`[${u}]`), o = Array.from(s != null ? s : []).reduce(
1990
+ (r, l) => r + (parseFloat(l.style.width) || 0),
1991
+ 0
1992
+ );
1993
+ return e > 0 ? Math.round(o / e / 2 * 100) / 100 : 0;
1994
+ }
1987
1995
  /**
1988
1996
  * Add column in % mode: shrink existing columns slightly and add new column at half the average width
1989
1997
  */
1990
1998
  addColumnPercent(t, e, n) {
1991
1999
  const o = 1 - 0.5 / e;
1992
2000
  t.forEach((r) => {
1993
- r.querySelectorAll(`[${p}]`).forEach((u) => {
1994
- const f = u, m = parseFloat(f.style.width) || 100 / e, y = Math.round(m * o * 100) / 100;
1995
- f.style.width = `${y}%`;
2001
+ r.querySelectorAll(`[${u}]`).forEach((p) => {
2002
+ const m = p, f = parseFloat(m.style.width) || 100 / e, y = Math.round(f * o * 100) / 100;
2003
+ m.style.width = `${y}%`;
1996
2004
  });
1997
- const a = Math.round(100 / e / 2 * 100) / 100, c = r.querySelectorAll(`[${p}]`), d = n === void 0 || n >= c.length, h = this.createCell(`${a}%`);
2005
+ const a = Math.round(100 / e / 2 * 100) / 100, c = r.querySelectorAll(`[${u}]`), d = n === void 0 || n >= c.length, h = this.createCell(`${a}%`);
1998
2006
  if (!d) {
1999
2007
  r.insertBefore(h, c[n]);
2000
2008
  return;
@@ -2007,7 +2015,7 @@ class ps {
2007
2015
  */
2008
2016
  deleteColumn(t, e) {
2009
2017
  t.querySelectorAll(`[${g}]`).forEach((s) => {
2010
- const o = s.querySelectorAll(`[${p}]`);
2018
+ const o = s.querySelectorAll(`[${u}]`);
2011
2019
  e >= o.length || o[e].remove();
2012
2020
  });
2013
2021
  }
@@ -2034,12 +2042,12 @@ class ps {
2034
2042
  if (e === n)
2035
2043
  return;
2036
2044
  t.querySelectorAll(`[${g}]`).forEach((o) => {
2037
- const r = Array.from(o.querySelectorAll(`[${p}]`));
2045
+ const r = Array.from(o.querySelectorAll(`[${u}]`));
2038
2046
  if (e >= r.length || n >= r.length)
2039
2047
  return;
2040
2048
  const l = r[e];
2041
2049
  l.remove();
2042
- const a = Array.from(o.querySelectorAll(`[${p}]`));
2050
+ const a = Array.from(o.querySelectorAll(`[${u}]`));
2043
2051
  n >= a.length ? o.appendChild(l) : o.insertBefore(l, a[n]);
2044
2052
  });
2045
2053
  }
@@ -2054,7 +2062,7 @@ class ps {
2054
2062
  */
2055
2063
  getColumnCount(t) {
2056
2064
  const e = t.querySelector(`[${g}]`);
2057
- return e ? e.querySelectorAll(`[${p}]`).length : 0;
2065
+ return e ? e.querySelectorAll(`[${u}]`).length : 0;
2058
2066
  }
2059
2067
  /**
2060
2068
  * Get a specific cell element
@@ -2063,7 +2071,7 @@ class ps {
2063
2071
  const s = t.querySelectorAll(`[${g}]`);
2064
2072
  if (e >= s.length)
2065
2073
  return null;
2066
- const o = s[e].querySelectorAll(`[${p}]`);
2074
+ const o = s[e].querySelectorAll(`[${u}]`);
2067
2075
  return n >= o.length ? null : o[n];
2068
2076
  }
2069
2077
  /**
@@ -2073,7 +2081,7 @@ class ps {
2073
2081
  const e = t.querySelector(`[${g}]`);
2074
2082
  if (!e)
2075
2083
  return [];
2076
- const n = e.querySelectorAll(`[${p}]`), s = [];
2084
+ const n = e.querySelectorAll(`[${u}]`), s = [];
2077
2085
  return n.forEach((o) => {
2078
2086
  const r = parseFloat(o.style.width);
2079
2087
  s.push(isNaN(r) ? 0 : r);
@@ -2083,7 +2091,7 @@ class ps {
2083
2091
  * Get cell content as block references
2084
2092
  */
2085
2093
  getCellContent(t) {
2086
- const e = t.querySelector(`[${B}]`);
2094
+ const e = t.querySelector(`[${k}]`);
2087
2095
  if (!e)
2088
2096
  return { blocks: [] };
2089
2097
  const n = e.querySelectorAll("[data-blok-id]");
@@ -2099,7 +2107,7 @@ class ps {
2099
2107
  const e = t.querySelector(`[${g}]`);
2100
2108
  if (!e)
2101
2109
  return "%";
2102
- const n = e.querySelector(`[${p}]`);
2110
+ const n = e.querySelector(`[${u}]`);
2103
2111
  return n && n.style.width.endsWith("px") ? "px" : "%";
2104
2112
  }
2105
2113
  /**
@@ -2109,7 +2117,7 @@ class ps {
2109
2117
  const e = t.querySelector(`[${g}]`);
2110
2118
  if (!e)
2111
2119
  return [];
2112
- const n = e.querySelectorAll(`[${p}]`);
2120
+ const n = e.querySelectorAll(`[${u}]`);
2113
2121
  return Array.from(n).map((s) => s.style.width);
2114
2122
  }
2115
2123
  /**
@@ -2117,7 +2125,7 @@ class ps {
2117
2125
  */
2118
2126
  createRow(t, e) {
2119
2127
  const n = document.createElement("div");
2120
- return n.className = v(ds), n.setAttribute(g, ""), Array.from({ length: t }).forEach((s, o) => {
2128
+ return n.className = v(hs), n.setAttribute(g, ""), Array.from({ length: t }).forEach((s, o) => {
2121
2129
  n.appendChild(this.createCell(e[o]));
2122
2130
  }), n;
2123
2131
  }
@@ -2126,20 +2134,20 @@ class ps {
2126
2134
  */
2127
2135
  createCell(t) {
2128
2136
  const e = document.createElement("div");
2129
- e.className = v(hs), e.style.borderRight = nt, e.style.borderBottom = nt, e.style.flexShrink = "0", e.style.overflow = "hidden", e.style.overflowWrap = "break-word", t !== void 0 && (e.style.width = typeof t == "string" ? t : `${t}%`), e.setAttribute(p, "");
2137
+ e.className = v(us), e.style.borderRight = nt, e.style.borderBottom = nt, e.style.flexShrink = "0", e.style.overflow = "hidden", e.style.overflowWrap = "break-word", t !== void 0 && (e.style.width = typeof t == "string" ? t : `${t}%`), e.setAttribute(u, "");
2130
2138
  const n = document.createElement("div");
2131
- return n.setAttribute(B, ""), e.appendChild(n), e;
2139
+ return n.setAttribute(k, ""), e.appendChild(n), e;
2132
2140
  }
2133
2141
  }
2134
- const fe = (i) => typeof i == "object" && i !== null && "blocks" in i, B = "data-blok-table-cell-blocks";
2135
- class gs {
2142
+ const Ct = (i) => typeof i == "object" && i !== null && "blocks" in i, k = "data-blok-table-cell-blocks";
2143
+ class fs {
2136
2144
  constructor(t) {
2137
2145
  this._activeCellWithBlocks = null, this.cellsPendingCheck = /* @__PURE__ */ new Set(), this.pendingCheckScheduled = !1, this.removedBlockCells = /* @__PURE__ */ new Map(), this.handleBlockMutation = (e) => {
2138
2146
  if (!this.isBlockMutationEvent(e))
2139
2147
  return;
2140
2148
  const { type: n, detail: s } = e.event;
2141
2149
  if (n === "block-removed") {
2142
- this.recordRemovedBlockCell(s), this.gridElement.querySelectorAll(`[${p}]`).forEach((h) => {
2150
+ this.recordRemovedBlockCell(s), this.gridElement.querySelectorAll(`[${u}]`).forEach((h) => {
2143
2151
  this.cellsPendingCheck.add(h);
2144
2152
  }), this.schedulePendingCellCheck();
2145
2153
  return;
@@ -2154,14 +2162,32 @@ class gs {
2154
2162
  this.claimBlockForCell(r, s.target.id), this.cellsPendingCheck.delete(r);
2155
2163
  return;
2156
2164
  }
2157
- const a = s.target.holder.closest(`[${B}]`);
2165
+ const a = s.target.holder.closest(`[${k}]`);
2158
2166
  if (a) {
2159
2167
  this.stripPlaceholders(a);
2160
2168
  return;
2161
2169
  }
2162
2170
  const c = this.findCellForNewBlock(o);
2163
2171
  c && (this.claimBlockForCell(c, s.target.id), this.cellsPendingCheck.delete(c));
2164
- }, this.api = t.api, this.gridElement = t.gridElement, this.onNavigateToCell = t.onNavigateToCell, this.api.events.on("block changed", this.handleBlockMutation);
2172
+ }, this.handleCellBlankSpaceClick = (e) => {
2173
+ const n = e.target;
2174
+ if (!n)
2175
+ return;
2176
+ const s = n.hasAttribute(u), o = n.hasAttribute(k);
2177
+ if (!s && !o)
2178
+ return;
2179
+ const r = s ? n : n.closest(`[${u}]`);
2180
+ if (!r)
2181
+ return;
2182
+ const l = s ? r.querySelector(`[${k}]`) : n;
2183
+ if (!l)
2184
+ return;
2185
+ const a = l.querySelectorAll("[data-blok-id]"), c = a[a.length - 1];
2186
+ if (!c)
2187
+ return;
2188
+ const d = c.getAttribute("data-blok-id");
2189
+ d && this.api.caret.setToBlock(d, "end");
2190
+ }, this.api = t.api, this.gridElement = t.gridElement, this.onNavigateToCell = t.onNavigateToCell, this.api.events.on("block changed", this.handleBlockMutation), this.gridElement.addEventListener("click", this.handleCellBlankSpaceClick);
2165
2191
  }
2166
2192
  /**
2167
2193
  * Get the currently active cell that contains blocks
@@ -2231,7 +2257,7 @@ class gs {
2231
2257
  const n = this.getCell(t.row, t.col);
2232
2258
  if (!n)
2233
2259
  return;
2234
- const s = n.querySelector(`[${B}]`);
2260
+ const s = n.querySelector(`[${k}]`);
2235
2261
  if (!s)
2236
2262
  return;
2237
2263
  const o = s.querySelectorAll('[contenteditable="true"]');
@@ -2272,20 +2298,20 @@ class gs {
2272
2298
  const r = e[o];
2273
2299
  if (!r)
2274
2300
  return;
2275
- const l = r.querySelectorAll(`[${p}]`), a = [];
2301
+ const l = r.querySelectorAll(`[${u}]`), a = [];
2276
2302
  s.forEach((c, d) => {
2277
2303
  const h = l[d];
2278
2304
  if (!h)
2279
2305
  return;
2280
- const u = h.querySelector(`[${B}]`);
2281
- if (u) {
2282
- if (fe(c))
2283
- this.mountBlocksInCell(u, c.blocks), a.push(c);
2306
+ const p = h.querySelector(`[${k}]`);
2307
+ if (p) {
2308
+ if (Ct(c))
2309
+ this.mountBlocksInCell(p, c.blocks), a.push(c);
2284
2310
  else {
2285
- const f = typeof c == "string" ? c : "", m = this.api.blocks.insert("paragraph", { text: f }, {}, this.api.blocks.getBlocksCount(), !1);
2286
- u.appendChild(m.holder), a.push({ blocks: [m.id] });
2311
+ const m = typeof c == "string" ? c : "", f = this.api.blocks.insert("paragraph", { text: m }, {}, this.api.blocks.getBlocksCount(), !1);
2312
+ p.appendChild(f.holder), a.push({ blocks: [f.id] });
2287
2313
  }
2288
- this.stripPlaceholders(u);
2314
+ this.stripPlaceholders(p);
2289
2315
  }
2290
2316
  }), n.push(a);
2291
2317
  }), n;
@@ -2317,7 +2343,7 @@ class gs {
2317
2343
  * Move a block's DOM holder into a cell's blocks container.
2318
2344
  */
2319
2345
  claimBlockForCell(t, e) {
2320
- const n = t.querySelector(`[${B}]`);
2346
+ const n = t.querySelector(`[${k}]`);
2321
2347
  if (!n)
2322
2348
  return;
2323
2349
  const s = this.api.blocks.getBlockIndex(e);
@@ -2341,7 +2367,7 @@ class gs {
2341
2367
  findCellForAdjacentBlock(t) {
2342
2368
  if (t < 0 || t >= this.api.blocks.getBlocksCount())
2343
2369
  return null;
2344
- const e = this.api.blocks.getBlockByIndex(t), n = e == null ? void 0 : e.holder.closest(`[${p}]`);
2370
+ const e = this.api.blocks.getBlockByIndex(t), n = e == null ? void 0 : e.holder.closest(`[${u}]`);
2345
2371
  return n && this.gridElement.contains(n) ? n : null;
2346
2372
  }
2347
2373
  /**
@@ -2349,7 +2375,7 @@ class gs {
2349
2375
  * If the blocks container is empty, insert an empty paragraph.
2350
2376
  */
2351
2377
  ensureCellHasBlock(t) {
2352
- const e = t.querySelector(`[${B}]`);
2378
+ const e = t.querySelector(`[${k}]`);
2353
2379
  if (!e || e.querySelector("[data-blok-id]") !== null)
2354
2380
  return;
2355
2381
  const s = this.api.blocks.insert("paragraph", { text: "" }, {}, this.api.blocks.getBlocksCount(), !0);
@@ -2363,7 +2389,7 @@ class gs {
2363
2389
  recordRemovedBlockCell(t) {
2364
2390
  if (t.index === void 0)
2365
2391
  return;
2366
- const e = t.target.holder.closest(`[${p}]`);
2392
+ const e = t.target.holder.closest(`[${u}]`);
2367
2393
  e && this.gridElement.contains(e) && this.removedBlockCells.set(t.index, e);
2368
2394
  }
2369
2395
  /**
@@ -2391,7 +2417,7 @@ class gs {
2391
2417
  getBlockIdsFromCells(t) {
2392
2418
  const e = [];
2393
2419
  return Array.from(t).forEach((s) => {
2394
- const o = s.querySelector(`[${B}]`);
2420
+ const o = s.querySelector(`[${k}]`);
2395
2421
  o && o.querySelectorAll("[data-blok-id]").forEach((r) => {
2396
2422
  const l = r.getAttribute("data-blok-id");
2397
2423
  l && e.push(l);
@@ -2406,28 +2432,36 @@ class gs {
2406
2432
  this.api.blocks.delete(n);
2407
2433
  });
2408
2434
  }
2435
+ /**
2436
+ * Delete all blocks managed by this table from the BlockManager.
2437
+ * Called before the table block itself is removed to prevent orphaned cell blocks.
2438
+ */
2439
+ deleteAllBlocks() {
2440
+ const t = this.gridElement.querySelectorAll(`[${u}]`), e = this.getBlockIdsFromCells(t);
2441
+ this.deleteBlocks(e);
2442
+ }
2409
2443
  /**
2410
2444
  * Clean up event listeners
2411
2445
  */
2412
2446
  destroy() {
2413
- this.api.events.off("block changed", this.handleBlockMutation), this._activeCellWithBlocks = null, this.cellsPendingCheck.clear(), this.removedBlockCells.clear();
2447
+ this.gridElement.removeEventListener("click", this.handleCellBlankSpaceClick), this.api.events.off("block changed", this.handleBlockMutation), this._activeCellWithBlocks = null, this.cellsPendingCheck.clear(), this.removedBlockCells.clear();
2414
2448
  }
2415
2449
  }
2416
- const K = 16, fs = [
2450
+ const X = 16, ms = [
2417
2451
  [2, 2],
2418
2452
  [8, 2],
2419
2453
  [2, 7],
2420
2454
  [8, 7],
2421
2455
  [2, 12],
2422
2456
  [8, 12]
2423
- ], ms = [
2457
+ ], Cs = [
2424
2458
  [2, 2],
2425
2459
  [7, 2],
2426
2460
  [12, 2],
2427
2461
  [2, 8],
2428
2462
  [7, 8],
2429
2463
  [12, 8]
2430
- ], me = (i) => {
2464
+ ], fe = (i) => {
2431
2465
  const t = document.createElementNS("http://www.w3.org/2000/svg", "svg"), e = i === "horizontal";
2432
2466
  t.setAttribute("width", e ? "14" : "10"), t.setAttribute("height", e ? "10" : "14"), t.setAttribute("viewBox", e ? "0 0 14 10" : "0 0 10 14"), t.setAttribute("fill", "currentColor"), t.classList.add(
2433
2467
  "opacity-0",
@@ -2436,21 +2470,21 @@ const K = 16, fs = [
2436
2470
  "text-gray-400",
2437
2471
  "pointer-events-none"
2438
2472
  );
2439
- const n = e ? ms : fs;
2473
+ const n = e ? Cs : ms;
2440
2474
  for (const [s, o] of n) {
2441
2475
  const r = document.createElementNS("http://www.w3.org/2000/svg", "circle");
2442
2476
  r.setAttribute("cx", String(s)), r.setAttribute("cy", String(o)), r.setAttribute("r", "1.5"), t.appendChild(r);
2443
2477
  }
2444
2478
  return t;
2445
- }, Cs = (i, t) => {
2446
- t === "col" ? i.style.height = `${K}px` : i.style.width = `${K}px`, i.classList.add("bg-gray-200"), i.classList.remove("bg-gray-300");
2479
+ }, ys = (i, t) => {
2480
+ t === "col" ? Object.assign(i.style, { height: `${X}px` }) : Object.assign(i.style, { width: `${X}px` }), i.classList.add("bg-gray-200"), i.classList.remove("bg-gray-300");
2447
2481
  const e = i.querySelector("svg");
2448
2482
  e && (e.classList.remove("opacity-0"), e.classList.add("opacity-100"));
2449
- }, Gt = (i, t, e) => {
2450
- t === "col" ? i.style.height = `${e}px` : i.style.width = `${e}px`, i.classList.remove("bg-gray-200"), i.classList.add("bg-gray-300");
2483
+ }, pt = (i, t, e) => {
2484
+ t === "col" ? Object.assign(i.style, { height: `${e}px` }) : Object.assign(i.style, { width: `${e}px` }), i.classList.remove("bg-gray-200"), i.classList.add("bg-gray-300");
2451
2485
  const n = i.querySelector("svg");
2452
2486
  n && (n.classList.add("opacity-0"), n.classList.remove("opacity-100"));
2453
- }, ht = "data-blok-table-cell-selected", ys = "2px solid #3b82f6", ut = "data-blok-table-selection-pill", bs = 16, vs = 20, Wt = 4, Ss = [
2487
+ }, gt = "data-blok-table-cell-selected", bs = "2px solid #3b82f6", ft = "data-blok-table-selection-pill", vs = 16, Ss = 20, Gt = 4, ws = [
2454
2488
  "absolute",
2455
2489
  "z-[3]",
2456
2490
  "rounded",
@@ -2463,20 +2497,20 @@ const K = 16, fs = [
2463
2497
  "overflow-hidden",
2464
2498
  "cursor-pointer",
2465
2499
  "bg-blue-500"
2466
- ], ws = (i) => i.style.userSelect === "none";
2467
- class As {
2500
+ ], As = (i) => i.style.userSelect === "none";
2501
+ class Es {
2468
2502
  constructor(t) {
2469
- this.anchorCell = null, this.extentCell = null, this.isSelecting = !1, this.hasSelection = !1, this.selectedCells = [], this.overlay = null, this.pill = null, this.pillPopover = null, this.grid = t.grid, this.rectangleSelection = t.rectangleSelection, this.onSelectionActiveChange = t.onSelectionActiveChange, this.onClearContent = t.onClearContent, this.grid.style.position = "relative", this.boundPointerDown = this.handlePointerDown.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundClearSelection = this.handleClearSelection.bind(this), this.boundCancelRectangle = this.handleCancelRectangle.bind(this), this.grid.addEventListener("pointerdown", this.boundPointerDown);
2503
+ this.anchorCell = null, this.extentCell = null, this.isSelecting = !1, this.hasSelection = !1, this.selectedCells = [], this.overlay = null, this.pill = null, this.pillPopover = null, this.grid = t.grid, this.rectangleSelection = t.rectangleSelection, this.onSelectionActiveChange = t.onSelectionActiveChange, this.onClearContent = t.onClearContent, this.i18n = t.i18n, this.grid.style.position = "relative", this.boundPointerDown = this.handlePointerDown.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundClearSelection = this.handleClearSelection.bind(this), this.boundCancelRectangle = this.handleCancelRectangle.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this), this.grid.addEventListener("pointerdown", this.boundPointerDown), document.addEventListener("keydown", this.boundKeyDown);
2470
2504
  }
2471
2505
  destroy() {
2472
- this.destroyPillPopover(), this.clearSelection(), this.grid.removeEventListener("pointerdown", this.boundPointerDown), document.removeEventListener("pointermove", this.boundPointerMove), document.removeEventListener("pointerup", this.boundPointerUp), document.removeEventListener("pointerdown", this.boundClearSelection), document.removeEventListener("mousemove", this.boundCancelRectangle, !0);
2506
+ this.destroyPillPopover(), this.clearSelection(), this.grid.removeEventListener("pointerdown", this.boundPointerDown), document.removeEventListener("pointermove", this.boundPointerMove), document.removeEventListener("pointerup", this.boundPointerUp), document.removeEventListener("pointerdown", this.boundClearSelection), document.removeEventListener("mousemove", this.boundCancelRectangle, !0), document.removeEventListener("keydown", this.boundKeyDown);
2473
2507
  }
2474
2508
  /**
2475
2509
  * Programmatically select an entire row.
2476
2510
  */
2477
2511
  selectRow(t) {
2478
2512
  var s, o;
2479
- const n = (o = (s = this.grid.querySelectorAll(`[${g}]`)[0]) == null ? void 0 : s.querySelectorAll(`[${p}]`).length) != null ? o : 0;
2513
+ const n = (o = (s = this.grid.querySelectorAll(`[${g}]`)[0]) == null ? void 0 : s.querySelectorAll(`[${u}]`).length) != null ? o : 0;
2480
2514
  n !== 0 && this.showProgrammaticSelection(t, 0, t, n - 1);
2481
2515
  }
2482
2516
  /**
@@ -2493,10 +2527,10 @@ class As {
2493
2527
  this.clearSelection();
2494
2528
  }
2495
2529
  handlePointerDown(t) {
2496
- if (ws(this.grid) || t.button !== 0)
2530
+ if (As(this.grid) || t.button !== 0)
2497
2531
  return;
2498
2532
  const e = t.target;
2499
- if (e.closest("[data-blok-table-grip]") || e.closest("[data-blok-table-resize]") || e.closest(`[${ut}]`))
2533
+ if (e.closest("[data-blok-table-grip]") || e.closest("[data-blok-table-resize]") || e.closest(`[${ft}]`))
2500
2534
  return;
2501
2535
  const n = this.resolveCellCoord(e);
2502
2536
  n && (this.hasSelection && this.clearSelection(), this.anchorCell = n, this.isSelecting = !1, document.addEventListener("mousemove", this.boundCancelRectangle, !0), document.addEventListener("pointermove", this.boundPointerMove), document.addEventListener("pointerup", this.boundPointerUp));
@@ -2532,7 +2566,11 @@ class As {
2532
2566
  }
2533
2567
  handleClearSelection(t) {
2534
2568
  const e = t.target;
2535
- e instanceof HTMLElement && e.closest(`[${ut}]`) || this.pillPopover === null && (document.removeEventListener("pointerdown", this.boundClearSelection), this.clearSelection());
2569
+ e instanceof HTMLElement && e.closest(`[${ft}]`) || this.pillPopover === null && (document.removeEventListener("pointerdown", this.boundClearSelection), this.clearSelection());
2570
+ }
2571
+ handleKeyDown(t) {
2572
+ var e;
2573
+ this.hasSelection && (t.key !== "Delete" && t.key !== "Backspace" || (t.preventDefault(), (e = this.onClearContent) == null || e.call(this, [...this.selectedCells]), this.clearSelection()));
2536
2574
  }
2537
2575
  clearSelection() {
2538
2576
  var e;
@@ -2541,7 +2579,7 @@ class As {
2541
2579
  }
2542
2580
  restoreModifiedCells() {
2543
2581
  this.destroyPillPopover(), this.selectedCells.forEach((t) => {
2544
- t.removeAttribute(ht);
2582
+ t.removeAttribute(gt);
2545
2583
  }), this.pill && (this.pill.remove(), this.pill = null), this.overlay && (this.overlay.remove(), this.overlay = null), this.selectedCells = [];
2546
2584
  }
2547
2585
  showProgrammaticSelection(t, e, n, s) {
@@ -2551,35 +2589,26 @@ class As {
2551
2589
  });
2552
2590
  }
2553
2591
  paintSelection() {
2554
- var D, N;
2592
+ var I, D;
2555
2593
  if (!this.anchorCell || !this.extentCell)
2556
2594
  return;
2557
- this.selectedCells.forEach((P) => {
2558
- P.removeAttribute(ht);
2595
+ this.selectedCells.forEach((M) => {
2596
+ M.removeAttribute(gt);
2559
2597
  }), this.selectedCells = [];
2560
2598
  const t = Math.min(this.anchorCell.row, this.extentCell.row), e = Math.max(this.anchorCell.row, this.extentCell.row), n = Math.min(this.anchorCell.col, this.extentCell.col), s = Math.max(this.anchorCell.col, this.extentCell.col), o = this.grid.querySelectorAll(`[${g}]`);
2561
- for (let P = t; P <= e; P++) {
2562
- const T = o[P];
2563
- if (!T)
2564
- continue;
2565
- const _ = T.querySelectorAll(`[${p}]`);
2566
- for (let H = n; H <= s; H++) {
2567
- const J = _[H];
2568
- J && (J.setAttribute(ht, ""), this.selectedCells.push(J));
2569
- }
2570
- }
2571
- const r = (D = o[t]) == null ? void 0 : D.querySelectorAll(`[${p}]`)[n], l = (N = o[e]) == null ? void 0 : N.querySelectorAll(`[${p}]`)[s];
2599
+ this.selectedCells = this.collectCellsInRange(o, t, e, n, s), this.selectedCells.forEach((M) => {
2600
+ M.setAttribute(gt, "");
2601
+ });
2602
+ const r = (I = o[t]) == null ? void 0 : I.querySelectorAll(`[${u}]`)[n], l = (D = o[e]) == null ? void 0 : D.querySelectorAll(`[${u}]`)[s];
2572
2603
  if (!r || !l)
2573
2604
  return;
2574
- const a = this.grid.getBoundingClientRect(), c = r.getBoundingClientRect(), d = l.getBoundingClientRect(), h = getComputedStyle(this.grid), u = parseFloat(h.borderTopWidth) || 0, f = parseFloat(h.borderLeftWidth) || 0;
2575
- let m = c.top - a.top - u, y = c.left - a.left - f;
2576
- const b = d.right - c.left + 1, I = d.bottom - c.top + 1;
2577
- m -= 1, y -= 1, this.overlay || (this.overlay = document.createElement("div"), this.overlay.setAttribute("data-blok-table-selection-overlay", ""), this.overlay.style.position = "absolute", this.overlay.style.border = ys, this.overlay.style.pointerEvents = "none", this.overlay.style.boxSizing = "border-box", this.overlay.style.borderRadius = "2px", this.grid.appendChild(this.overlay)), this.overlay.style.top = `${m}px`, this.overlay.style.left = `${y}px`, this.overlay.style.width = `${b}px`, this.overlay.style.height = `${I}px`, this.pill || (this.pill = this.createPill(), this.grid.appendChild(this.pill)), this.pill.style.left = `${y + b - 1}px`, this.pill.style.top = `${m + I / 2}px`;
2605
+ const a = this.grid.getBoundingClientRect(), c = r.getBoundingClientRect(), d = l.getBoundingClientRect(), h = getComputedStyle(this.grid), p = parseFloat(h.borderTopWidth) || 0, m = parseFloat(h.borderLeftWidth) || 0, f = d.right - c.left + 1, y = d.bottom - c.top + 1, b = c.top - a.top - p - 1, B = c.left - a.left - m - 1;
2606
+ this.overlay || (this.overlay = document.createElement("div"), this.overlay.setAttribute("data-blok-table-selection-overlay", ""), this.overlay.style.position = "absolute", this.overlay.style.border = bs, this.overlay.style.pointerEvents = "none", this.overlay.style.boxSizing = "border-box", this.overlay.style.borderRadius = "2px", this.grid.appendChild(this.overlay)), this.overlay.style.top = `${b}px`, this.overlay.style.left = `${B}px`, this.overlay.style.width = `${f}px`, this.overlay.style.height = `${y}px`, this.pill || (this.pill = this.createPill(), this.grid.appendChild(this.pill)), this.pill.style.left = `${B + f - 1}px`, this.pill.style.top = `${b + y / 2}px`;
2578
2607
  }
2579
2608
  createPill() {
2580
2609
  const t = document.createElement("div");
2581
- t.setAttribute(ut, ""), t.setAttribute("contenteditable", "false"), t.className = v(Ss), t.style.width = `${Wt}px`, t.style.height = `${vs}px`, t.style.pointerEvents = "auto", t.style.transform = "translate(-50%, -50%)", t.style.outline = "2px solid white";
2582
- const e = me("vertical");
2610
+ t.setAttribute(ft, ""), t.setAttribute("contenteditable", "false"), t.className = v(ws), t.style.width = `${Gt}px`, t.style.height = `${Ss}px`, t.style.pointerEvents = "auto", t.style.transform = "translate(-50%, -50%)", t.style.outline = "2px solid white";
2611
+ const e = fe("vertical");
2583
2612
  return e.classList.remove("text-gray-400"), e.classList.add("text-white"), t.appendChild(e), t.addEventListener("mouseenter", () => {
2584
2613
  this.pillPopover === null && this.expandPill();
2585
2614
  }), t.addEventListener("mouseleave", () => {
@@ -2595,7 +2624,7 @@ class As {
2595
2624
  const t = [
2596
2625
  {
2597
2626
  icon: Ge,
2598
- title: "Clear",
2627
+ title: this.i18n.t("tools.table.clearSelection"),
2599
2628
  closeOnActivate: !0,
2600
2629
  onActivate: () => {
2601
2630
  var e;
@@ -2603,25 +2632,25 @@ class As {
2603
2632
  }
2604
2633
  }
2605
2634
  ];
2606
- this.pillPopover = new se({
2635
+ this.pillPopover = new ne({
2607
2636
  items: t,
2608
2637
  trigger: this.pill,
2609
2638
  flippable: !0
2610
- }), this.pillPopover.on(oe.Closed, () => {
2639
+ }), this.pillPopover.on(se.Closed, () => {
2611
2640
  this.pillPopover !== null && (this.destroyPillPopover(), this.collapsePill());
2612
2641
  }), this.pillPopover.show();
2613
2642
  }
2614
2643
  expandPill() {
2615
2644
  if (!this.pill)
2616
2645
  return;
2617
- this.pill.style.width = `${bs}px`;
2646
+ this.pill.style.width = `${vs}px`;
2618
2647
  const t = this.pill.querySelector("svg");
2619
2648
  t && (t.classList.remove("opacity-0"), t.classList.add("opacity-100"));
2620
2649
  }
2621
2650
  collapsePill() {
2622
2651
  if (!this.pill)
2623
2652
  return;
2624
- this.pill.style.width = `${Wt}px`;
2653
+ this.pill.style.width = `${Gt}px`;
2625
2654
  const t = this.pill.querySelector("svg");
2626
2655
  t && (t.classList.add("opacity-0"), t.classList.remove("opacity-100"));
2627
2656
  }
@@ -2632,7 +2661,7 @@ class As {
2632
2661
  }
2633
2662
  }
2634
2663
  resolveCellCoord(t) {
2635
- const e = t.closest(`[${p}]`);
2664
+ const e = t.closest(`[${u}]`);
2636
2665
  if (!e)
2637
2666
  return null;
2638
2667
  const n = e.closest(`[${g}]`);
@@ -2641,69 +2670,78 @@ class As {
2641
2670
  const o = Array.from(this.grid.querySelectorAll(`[${g}]`)).indexOf(n);
2642
2671
  if (o < 0)
2643
2672
  return null;
2644
- const l = Array.from(n.querySelectorAll(`[${p}]`)).indexOf(e);
2673
+ const l = Array.from(n.querySelectorAll(`[${u}]`)).indexOf(e);
2645
2674
  return l < 0 ? null : { row: o, col: l };
2646
2675
  }
2647
2676
  clampExtentToEdge(t) {
2648
- var c, d, h, u, f, m;
2677
+ var c, d, h, p, m, f;
2649
2678
  if (!this.anchorCell || !this.isSelecting)
2650
2679
  return;
2651
- const e = this.grid.getBoundingClientRect(), n = this.grid.querySelectorAll(`[${g}]`), s = n.length, o = (d = (c = n[0]) == null ? void 0 : c.querySelectorAll(`[${p}]`).length) != null ? d : 0;
2680
+ const e = this.grid.getBoundingClientRect(), n = this.grid.querySelectorAll(`[${g}]`), s = n.length, o = (d = (c = n[0]) == null ? void 0 : c.querySelectorAll(`[${u}]`).length) != null ? d : 0;
2652
2681
  if (s === 0 || o === 0)
2653
2682
  return;
2654
- let r;
2655
- t.clientY < e.top ? r = 0 : t.clientY > e.bottom ? r = s - 1 : r = (u = (h = this.extentCell) == null ? void 0 : h.row) != null ? u : this.anchorCell.row;
2656
- let l;
2657
- t.clientX < e.left ? l = 0 : t.clientX > e.right ? l = o - 1 : l = (m = (f = this.extentCell) == null ? void 0 : f.col) != null ? m : this.anchorCell.col;
2658
- const a = { row: r, col: l };
2683
+ const r = this.clampAxis(t.clientY, e.top, e.bottom, s, (p = (h = this.extentCell) == null ? void 0 : h.row) != null ? p : this.anchorCell.row), l = this.clampAxis(t.clientX, e.left, e.right, o, (f = (m = this.extentCell) == null ? void 0 : m.col) != null ? f : this.anchorCell.col), a = { row: r, col: l };
2659
2684
  (!this.extentCell || this.extentCell.row !== a.row || this.extentCell.col !== a.col) && (this.extentCell = a, this.paintSelection());
2660
2685
  }
2686
+ collectCellsInRange(t, e, n, s, o) {
2687
+ return Array.from(t).slice(e, n + 1).flatMap((r) => {
2688
+ const l = r.querySelectorAll(`[${u}]`);
2689
+ return Array.from(l).slice(s, o + 1).filter((a) => a instanceof HTMLElement);
2690
+ });
2691
+ }
2692
+ /**
2693
+ * Clamp a pointer coordinate to an axis range, returning the edge index
2694
+ * when outside or the fallback when inside.
2695
+ */
2696
+ clampAxis(t, e, n, s, o) {
2697
+ return t < e ? 0 : t > n ? s - 1 : o;
2698
+ }
2661
2699
  }
2662
- const lt = (i) => {
2700
+ const J = (i) => {
2663
2701
  const t = i.querySelector(`[${g}]`);
2664
2702
  if (!t)
2665
2703
  return [];
2666
- const e = t.querySelectorAll(`[${p}]`);
2704
+ const e = t.querySelectorAll(`[${u}]`);
2667
2705
  return Array.from(e).map(
2668
2706
  (n) => n.getBoundingClientRect().width
2669
2707
  );
2670
- }, st = (i, t) => {
2708
+ }, ct = (i, t) => {
2671
2709
  const e = t.reduce((o, r) => o + r, 0), n = i;
2672
- n.style.width = `${e + $}px`, i.querySelectorAll(`[${g}]`).forEach((o) => {
2673
- o.querySelectorAll(`[${p}]`).forEach((l, a) => {
2710
+ n.style.width = `${e + P}px`, i.querySelectorAll(`[${g}]`).forEach((o) => {
2711
+ o.querySelectorAll(`[${u}]`).forEach((l, a) => {
2674
2712
  if (a < t.length) {
2675
2713
  const c = l;
2676
2714
  c.style.width = `${t[a]}px`;
2677
2715
  }
2678
2716
  });
2679
2717
  });
2680
- }, Es = (i, t) => {
2681
- const e = Array.from(i.querySelectorAll(`[${g}]`)), n = e.findIndex((r) => Array.from(r.querySelectorAll(`[${p}]`)).includes(t));
2718
+ }, ks = (i, t) => {
2719
+ const e = Array.from(i.querySelectorAll(`[${g}]`)), n = e.findIndex((r) => Array.from(r.querySelectorAll(`[${u}]`)).includes(t));
2682
2720
  if (n === -1)
2683
2721
  return null;
2684
- const o = Array.from(e[n].querySelectorAll(`[${p}]`)).indexOf(t);
2722
+ const o = Array.from(e[n].querySelectorAll(`[${u}]`)).indexOf(t);
2685
2723
  return { row: n, col: o };
2686
- }, Ce = (i) => {
2724
+ }, me = (i) => {
2687
2725
  var e;
2688
- const t = i.querySelector(`[${B}]`);
2726
+ const t = i.querySelector(`[${k}]`);
2689
2727
  return t ? ((e = t.textContent) != null ? e : "").trim().length === 0 : !0;
2690
- }, ks = (i, t) => {
2728
+ }, xs = (i, t) => {
2691
2729
  const n = i.querySelectorAll(`[${g}]`)[t];
2692
2730
  if (!n)
2693
2731
  return !0;
2694
- const s = n.querySelectorAll(`[${p}]`);
2695
- return Array.from(s).every((o) => Ce(o));
2696
- }, xs = (i, t) => {
2732
+ const s = n.querySelectorAll(`[${u}]`);
2733
+ return Array.from(s).every((o) => me(o));
2734
+ }, Ts = (i, t) => {
2697
2735
  const e = i.querySelectorAll(`[${g}]`);
2698
2736
  return Array.from(e).every((n) => {
2699
- const o = n.querySelectorAll(`[${p}]`)[t];
2700
- return !o || Ce(o);
2737
+ const o = n.querySelectorAll(`[${u}]`)[t];
2738
+ return !o || me(o);
2701
2739
  });
2702
- }, Ts = (i) => {
2740
+ }, Rs = (i) => {
2703
2741
  const t = i.querySelectorAll(`[${g}]`), e = t[0];
2704
2742
  if (!e)
2705
2743
  return;
2706
- const n = e.querySelectorAll(`[${p}]`), s = Array.from(n).reduce(
2744
+ const n = e.querySelectorAll(`[${u}]`), s = Array.from(n).reduce(
2707
2745
  (r, l) => r + (parseFloat(l.style.width) || 0),
2708
2746
  0
2709
2747
  );
@@ -2711,7 +2749,7 @@ const lt = (i) => {
2711
2749
  return;
2712
2750
  const o = 100 / s;
2713
2751
  t.forEach((r) => {
2714
- r.querySelectorAll(`[${p}]`).forEach((a) => {
2752
+ r.querySelectorAll(`[${u}]`).forEach((a) => {
2715
2753
  const c = a, d = parseFloat(c.style.width) || 0;
2716
2754
  c.style.width = `${Math.round(d * o * 100) / 100}%`;
2717
2755
  });
@@ -2721,73 +2759,74 @@ const lt = (i) => {
2721
2759
  return i;
2722
2760
  const n = [...i], [s] = n.splice(t, 1);
2723
2761
  return n.splice(e, 0, s), n;
2724
- }, Rs = (i, t) => {
2762
+ }, Bs = (i, t) => {
2725
2763
  if (!i)
2726
2764
  return i;
2727
2765
  const e = [...i];
2728
2766
  return e.splice(t, 1), e.length > 0 ? e : void 0;
2729
- }, qt = (i, t, e, n) => {
2767
+ }, Is = (i, t, e, n) => {
2730
2768
  var l;
2731
- const s = (l = e.colWidths) != null ? l : lt(i);
2732
- n.addColumn(i, t, s);
2733
- const o = Math.round(
2734
- s.reduce((a, c) => a + c, 0) / s.length / 2 * 100
2735
- ) / 100, r = [...s];
2769
+ const s = (l = e.colWidths) != null ? l : J(i), o = e.initialColWidth !== void 0 ? Math.round(e.initialColWidth / 2 * 100) / 100 : yt(s);
2770
+ n.addColumn(i, t, s, o);
2771
+ const r = [...s];
2736
2772
  return r.splice(t, 0, o), r;
2737
- }, Ft = (i) => Math.round(
2773
+ }, yt = (i) => Math.round(
2738
2774
  i.reduce((t, e) => t + e, 0) / i.length / 2 * 100
2739
- ) / 100, Bs = (i, t, e) => {
2775
+ ) / 100, Ds = (i) => i.length === 0 ? 0 : Math.round(i.reduce((t, e) => t + e, 0) / i.length * 100) / 100, Ns = (i, t, e) => {
2740
2776
  var o;
2741
2777
  if (!i)
2742
2778
  return [];
2743
2779
  const s = i.querySelectorAll(`[${g}]`)[e];
2744
- return s ? (o = t == null ? void 0 : t.getBlockIdsFromCells(s.querySelectorAll(`[${p}]`))) != null ? o : [] : [];
2745
- }, Is = (i, t, e) => {
2780
+ return s ? (o = t == null ? void 0 : t.getBlockIdsFromCells(s.querySelectorAll(`[${u}]`))) != null ? o : [] : [];
2781
+ }, Hs = (i, t, e) => {
2746
2782
  var o;
2747
2783
  if (!i)
2748
2784
  return [];
2749
2785
  const n = i.querySelectorAll(`[${g}]`), s = [];
2750
2786
  return n.forEach((r) => {
2751
- const l = r.querySelectorAll(`[${p}]`);
2787
+ const l = r.querySelectorAll(`[${u}]`);
2752
2788
  e < l.length && s.push(l[e]);
2753
2789
  }), (o = t == null ? void 0 : t.getBlockIdsFromCells(s)) != null ? o : [];
2754
- }, pt = (i, t, e, n) => {
2790
+ }, bt = (i, t, e, n) => {
2755
2791
  const o = i.querySelectorAll(`[${g}]`)[t];
2756
2792
  if (o && n) {
2757
- const r = o.querySelectorAll(`[${p}]`);
2793
+ const r = o.querySelectorAll(`[${u}]`);
2758
2794
  n.deleteBlocks(n.getBlockIdsFromCells(r));
2759
2795
  }
2760
2796
  e.deleteRow(i, t);
2761
- }, gt = (i, t, e, n, s) => {
2797
+ }, vt = (i, t, e, n, s) => {
2762
2798
  if (s) {
2763
2799
  const o = i.querySelectorAll(`[${g}]`), r = [];
2764
2800
  o.forEach((l) => {
2765
- const a = l.querySelectorAll(`[${p}]`);
2801
+ const a = l.querySelectorAll(`[${u}]`);
2766
2802
  t < a.length && r.push(a[t]);
2767
2803
  }), s.deleteBlocks(s.getBlockIdsFromCells(r));
2768
2804
  }
2769
- return n.deleteColumn(i, t), Rs(e, t);
2770
- }, W = (i, t) => {
2771
- i.querySelectorAll(`[${p}]`).forEach((n) => {
2805
+ return n.deleteColumn(i, t), Bs(e, t);
2806
+ }, V = (i, t) => {
2807
+ i.querySelectorAll(`[${u}]`).forEach((n) => {
2772
2808
  t == null || t.ensureCellHasBlock(n);
2773
2809
  });
2774
- }, Ds = (i, t, e) => {
2810
+ }, Ps = (i, t, e) => {
2775
2811
  const n = i.querySelectorAll(`[${g}]`);
2776
2812
  t.forEach((s, o) => {
2777
2813
  const r = n[o];
2778
2814
  if (!r)
2779
2815
  return;
2780
- const l = r.querySelectorAll(`[${p}]`);
2816
+ const l = r.querySelectorAll(`[${u}]`);
2781
2817
  s.forEach((a, c) => {
2782
2818
  const d = l[c];
2783
2819
  if (!d)
2784
2820
  return;
2785
- const h = d.querySelector(`[${B}]`);
2786
- if (h) {
2787
- if (!fe(a)) {
2788
- const u = typeof a == "string" ? a : "", f = e.blocks.insert(
2821
+ const h = d.querySelector(`[${k}]`);
2822
+ if (!h)
2823
+ return;
2824
+ const p = h.querySelectorAll("[data-blok-id]").length > 0;
2825
+ if (!(!Ct(a) && p)) {
2826
+ if (!Ct(a)) {
2827
+ const m = typeof a == "string" ? a : "", f = e.blocks.insert(
2789
2828
  "paragraph",
2790
- { text: u },
2829
+ { text: m },
2791
2830
  {},
2792
2831
  void 0,
2793
2832
  !0
@@ -2795,18 +2834,18 @@ const lt = (i) => {
2795
2834
  f != null && f.holder && h.appendChild(f.holder);
2796
2835
  return;
2797
2836
  }
2798
- for (const u of a.blocks) {
2799
- const f = e.blocks.getBlockIndex(u);
2837
+ for (const m of a.blocks) {
2838
+ const f = e.blocks.getBlockIndex(m);
2800
2839
  if (f === void 0)
2801
2840
  continue;
2802
- const m = e.blocks.getBlockByIndex(f);
2803
- m && h.appendChild(m.holder);
2841
+ const y = e.blocks.getBlockByIndex(f);
2842
+ y && h.appendChild(y.holder);
2804
2843
  }
2805
2844
  }
2806
2845
  });
2807
2846
  });
2808
- }, Ns = (i, t) => {
2809
- var l, a, c, d, h, u, f, m, y, b;
2847
+ }, _s = (i, t) => {
2848
+ var l, a, c, d, h, p, m, f, y, b;
2810
2849
  if (!(typeof i == "object" && i !== null && "content" in i))
2811
2850
  return {
2812
2851
  withHeadings: (l = t.withHeadings) != null ? l : !1,
@@ -2816,23 +2855,24 @@ const lt = (i) => {
2816
2855
  };
2817
2856
  const n = i, s = (d = (c = n.content) == null ? void 0 : c[0]) == null ? void 0 : d.length, o = n.colWidths, r = o && s && o.length === s ? o : void 0;
2818
2857
  return {
2819
- withHeadings: (u = (h = n.withHeadings) != null ? h : t.withHeadings) != null ? u : !1,
2820
- withHeadingColumn: (f = n.withHeadingColumn) != null ? f : !1,
2821
- stretched: (y = (m = n.stretched) != null ? m : t.stretched) != null ? y : !1,
2858
+ withHeadings: (p = (h = n.withHeadings) != null ? h : t.withHeadings) != null ? p : !1,
2859
+ withHeadingColumn: (m = n.withHeadingColumn) != null ? m : !1,
2860
+ stretched: (y = (f = n.stretched) != null ? f : t.stretched) != null ? y : !1,
2822
2861
  content: (b = n.content) != null ? b : [],
2823
- colWidths: r
2862
+ colWidths: r,
2863
+ initialColWidth: n.initialColWidth
2824
2864
  };
2825
- }, Ps = (i, t) => {
2865
+ }, Os = (i, t) => {
2826
2866
  i.addEventListener("keydown", (e) => {
2827
- const s = e.target.closest(`[${p}]`);
2867
+ const s = e.target.closest(`[${u}]`);
2828
2868
  if (!s)
2829
2869
  return;
2830
- const o = Es(i, s);
2870
+ const o = ks(i, s);
2831
2871
  o && (t == null || t.handleKeyDown(e, o));
2832
2872
  });
2833
- }, ye = ["overflow-x-auto", "pt-[9px]", "pl-[9px]"], zt = (i) => {
2834
- i == null || i.classList.add(...ye);
2835
- }, ot = (i, t) => {
2873
+ }, Ce = ["overflow-x-auto", "pt-[9px]", "pl-[9px]"], qt = (i) => {
2874
+ i == null || i.classList.add(...Ce);
2875
+ }, st = (i, t) => {
2836
2876
  if (!i)
2837
2877
  return;
2838
2878
  const e = i.firstElementChild;
@@ -2842,20 +2882,20 @@ const lt = (i) => {
2842
2882
  n.forEach((s) => {
2843
2883
  s.removeAttribute("data-blok-table-heading");
2844
2884
  }), t && n.length > 0 && n[0].setAttribute("data-blok-table-heading", "");
2845
- }, U = (i, t) => {
2885
+ }, z = (i, t) => {
2846
2886
  if (!i)
2847
2887
  return;
2848
2888
  const e = i.firstElementChild;
2849
2889
  if (!e)
2850
2890
  return;
2851
- e.querySelectorAll(`[${p}]`).forEach((s) => {
2891
+ e.querySelectorAll(`[${u}]`).forEach((s) => {
2852
2892
  s.removeAttribute("data-blok-table-heading-col");
2853
2893
  }), t && e.querySelectorAll(`[${g}]`).forEach((o) => {
2854
- const r = o.querySelector(`[${p}]`);
2894
+ const r = o.querySelector(`[${u}]`);
2855
2895
  r && r.setAttribute("data-blok-table-heading-col", "");
2856
2896
  });
2857
- }, Vt = "data-blok-table-resize", _s = "data-blok-table-cell", Hs = "data-blok-table-row", Ms = 50, ft = 16;
2858
- class Os {
2897
+ }, Ft = "data-blok-table-resize", Ms = "data-blok-table-cell", Ws = "data-blok-table-row", $s = 50, mt = 16;
2898
+ class Gs {
2859
2899
  constructor(t, e, n, s, o, r = !1) {
2860
2900
  this._enabled = !0, this.isDragging = !1, this.dragStartX = 0, this.dragColIndex = -1, this.startColWidth = 0, this.handles = [], this.gridEl = t, this.colWidths = [...e], this.onChange = n, this.onDragStart = s != null ? s : null, this.onDrag = o != null ? o : null, this.needsInitialApply = r, this.boundPointerDown = this.onPointerDown.bind(this), this.boundPointerMove = this.onPointerMove.bind(this), this.boundPointerUp = this.onPointerUp.bind(this), this.gridEl.style.position = "relative", r || this.applyWidths(), this.createHandles(), this.gridEl.addEventListener("pointerdown", this.boundPointerDown);
2861
2901
  }
@@ -2882,7 +2922,7 @@ class Os {
2882
2922
  }
2883
2923
  createHandle(t) {
2884
2924
  const e = document.createElement("div"), n = this.getHandleLeftPx(t);
2885
- return e.setAttribute(Vt, ""), e.setAttribute("data-col", String(t)), e.style.position = "absolute", e.style.top = `-${$}px`, e.style.bottom = "0px", e.style.width = `${ft}px`, e.style.left = `${n - ft / 2}px`, e.style.cursor = "col-resize", e.style.zIndex = "2", e.style.background = "linear-gradient(to right, transparent 7px, #3b82f6 7px, #3b82f6 9px, transparent 9px)", e.style.opacity = "0", e.style.transition = "opacity 150ms ease", e.setAttribute("contenteditable", "false"), e.addEventListener("mouseenter", () => {
2925
+ return e.setAttribute(Ft, ""), e.setAttribute("data-col", String(t)), e.style.position = "absolute", e.style.top = `-${P}px`, e.style.bottom = "0px", e.style.width = `${mt}px`, e.style.left = `${n - mt / 2}px`, e.style.cursor = "col-resize", e.style.zIndex = "2", e.style.background = "linear-gradient(to right, transparent 7px, #3b82f6 7px, #3b82f6 9px, transparent 9px)", e.style.opacity = "0", e.style.transition = "opacity 150ms ease", e.setAttribute("contenteditable", "false"), e.addEventListener("mouseenter", () => {
2886
2926
  this.isDragging || (e.style.opacity = "1");
2887
2927
  }), e.addEventListener("mouseleave", () => {
2888
2928
  this.isDragging || (e.style.opacity = "0");
@@ -2894,7 +2934,7 @@ class Os {
2894
2934
  updateHandlePositions() {
2895
2935
  this.handles.forEach((t, e) => {
2896
2936
  const n = this.getHandleLeftPx(e), s = t;
2897
- s.style.left = `${n - ft / 2}px`;
2937
+ s.style.left = `${n - mt / 2}px`;
2898
2938
  });
2899
2939
  }
2900
2940
  onPointerDown(t) {
@@ -2902,7 +2942,7 @@ class Os {
2902
2942
  if (!this._enabled)
2903
2943
  return;
2904
2944
  const e = t.target;
2905
- if (!e.hasAttribute(Vt))
2945
+ if (!e.hasAttribute(Ft))
2906
2946
  return;
2907
2947
  t.preventDefault(), this.needsInitialApply && (this.applyWidths(), this.updateHandlePositions(), this.needsInitialApply = !1);
2908
2948
  const n = e.getAttribute("data-col");
@@ -2912,7 +2952,7 @@ class Os {
2912
2952
  var o;
2913
2953
  if (!this.isDragging)
2914
2954
  return;
2915
- const e = t.clientX - this.dragStartX, n = this.startColWidth + e, s = Math.max(Ms, n);
2955
+ const e = t.clientX - this.dragStartX, n = this.startColWidth + e, s = Math.max($s, n);
2916
2956
  this.colWidths[this.dragColIndex] = s, this.applyWidths(), this.updateHandlePositions(), (o = this.onDrag) == null || o.call(this);
2917
2957
  }
2918
2958
  onPointerUp() {
@@ -2924,8 +2964,8 @@ class Os {
2924
2964
  }
2925
2965
  applyWidths() {
2926
2966
  const t = this.colWidths.reduce((n, s) => n + s, 0);
2927
- this.gridEl.style.width = `${t + $}px`, this.gridEl.querySelectorAll(`[${Hs}]`).forEach((n) => {
2928
- n.querySelectorAll(`[${_s}]`).forEach((o, r) => {
2967
+ this.gridEl.style.width = `${t + P}px`, this.gridEl.querySelectorAll(`[${Ws}]`).forEach((n) => {
2968
+ n.querySelectorAll(`[${Ms}]`).forEach((o, r) => {
2929
2969
  if (r < this.colWidths.length) {
2930
2970
  const l = o;
2931
2971
  l.style.width = `${this.colWidths[r]}px`;
@@ -2934,71 +2974,92 @@ class Os {
2934
2974
  });
2935
2975
  }
2936
2976
  }
2937
- const $s = [
2938
- "flex",
2939
- "items-center",
2940
- "select-none",
2941
- "border-none",
2942
- "bg-transparent",
2943
- "rounded-md",
2944
- "p-[var(--item-padding)]",
2945
- "text-text-primary",
2946
- "mb-px",
2947
- "cursor-pointer",
2948
- "can-hover:hover:bg-item-hover-bg"
2949
- ], Gs = [
2950
- "flex",
2951
- "items-center",
2952
- "justify-center",
2953
- "w-[26px]",
2954
- "h-[26px]",
2955
- "mr-2",
2956
- "[&_svg]:w-icon",
2957
- "[&_svg]:h-icon"
2958
- ], Ws = [
2959
- "mr-auto",
2960
- "truncate",
2961
- "text-sm",
2962
- "font-medium",
2963
- "leading-5"
2964
- ], qs = [
2965
- "relative",
2966
- "w-[34px]",
2967
- "h-[20px]",
2968
- "rounded-full",
2969
- "transition-colors",
2970
- "duration-200",
2971
- "shrink-0"
2972
- ], Fs = [
2973
- "absolute",
2974
- "top-[2px]",
2975
- "w-4",
2976
- "h-4",
2977
- "rounded-full",
2978
- "bg-white",
2979
- "shadow-sm",
2980
- "transition-[left]",
2981
- "duration-200"
2982
- ], Ut = (i) => {
2983
- const { icon: t, label: e, isActive: n, onToggle: s } = i, o = { active: n }, r = document.createElement("div");
2984
- r.className = v($s);
2985
- const l = document.createElement("div");
2986
- l.className = v(Gs), l.innerHTML = t, r.appendChild(l);
2987
- const a = document.createElement("span");
2988
- a.className = v(Ws), a.textContent = e, r.appendChild(a);
2989
- const c = document.createElement("div");
2990
- c.className = v(qs);
2991
- const d = document.createElement("div");
2992
- d.className = v(Fs), c.appendChild(d), r.appendChild(c);
2993
- const h = () => {
2994
- c.style.backgroundColor = o.active ? "#3b82f6" : "#d1d5db", d.style.left = o.active ? "16px" : "2px";
2977
+ const zt = (i, t, e) => (e.grid.addRow(i, t), V(i, e.cellBlocks), {
2978
+ pendingHighlight: { type: "row", index: t },
2979
+ moveSelection: null,
2980
+ colWidths: e.data.colWidths,
2981
+ withHeadings: e.data.withHeadings,
2982
+ withHeadingColumn: e.data.withHeadingColumn
2983
+ }), Vt = (i, t, e) => {
2984
+ const n = Is(i, t, e.data, e.grid);
2985
+ return V(i, e.cellBlocks), {
2986
+ pendingHighlight: { type: "col", index: t },
2987
+ moveSelection: null,
2988
+ colWidths: n,
2989
+ withHeadings: e.data.withHeadings,
2990
+ withHeadingColumn: e.data.withHeadingColumn
2995
2991
  };
2996
- return h(), r.addEventListener("click", (u) => {
2997
- u.stopPropagation(), o.active = !o.active, h(), s(o.active);
2998
- }), r;
2999
- }, Kt = 10, zs = "data-blok-table-drag-ghost", bt = (i) => {
2992
+ }, qs = (i, t, e, n) => (n.grid.moveRow(i, t, e), {
2993
+ pendingHighlight: null,
2994
+ moveSelection: { type: "row", index: e },
2995
+ colWidths: n.data.colWidths,
2996
+ withHeadings: n.data.withHeadings,
2997
+ withHeadingColumn: n.data.withHeadingColumn
2998
+ }), Fs = (i, t, e, n) => (n.grid.moveColumn(i, t, e), {
2999
+ pendingHighlight: null,
3000
+ moveSelection: { type: "col", index: e },
3001
+ colWidths: Ls(n.data.colWidths, t, e),
3002
+ withHeadings: n.data.withHeadings,
3003
+ withHeadingColumn: n.data.withHeadingColumn
3004
+ }), zs = (i, t, e) => {
3005
+ bt(i, t, e.grid, e.cellBlocks);
3006
+ const n = e.grid.getRowCount(i);
3007
+ return {
3008
+ pendingHighlight: { type: "row", index: t < n ? t : t - 1 },
3009
+ moveSelection: null,
3010
+ colWidths: e.data.colWidths,
3011
+ withHeadings: e.data.withHeadings,
3012
+ withHeadingColumn: e.data.withHeadingColumn
3013
+ };
3014
+ }, Vs = (i, t, e) => {
3015
+ const n = vt(i, t, e.data.colWidths, e.grid, e.cellBlocks);
3016
+ n ? ct(i, n) : Rs(i);
3017
+ const s = e.grid.getColumnCount(i);
3018
+ return {
3019
+ pendingHighlight: { type: "col", index: t < s ? t : t - 1 },
3020
+ moveSelection: null,
3021
+ colWidths: n,
3022
+ withHeadings: e.data.withHeadings,
3023
+ withHeadingColumn: e.data.withHeadingColumn
3024
+ };
3025
+ }, Us = (i, t, e) => {
3026
+ switch (t.type) {
3027
+ case "insert-row-above":
3028
+ return zt(i, t.index, e);
3029
+ case "insert-row-below":
3030
+ return zt(i, t.index + 1, e);
3031
+ case "insert-col-left":
3032
+ return Vt(i, t.index, e);
3033
+ case "insert-col-right":
3034
+ return Vt(i, t.index + 1, e);
3035
+ case "move-row":
3036
+ return qs(i, t.fromIndex, t.toIndex, e);
3037
+ case "move-col":
3038
+ return Fs(i, t.fromIndex, t.toIndex, e);
3039
+ case "delete-row":
3040
+ return zs(i, t.index, e);
3041
+ case "delete-col":
3042
+ return Vs(i, t.index, e);
3043
+ case "toggle-heading":
3044
+ return {
3045
+ pendingHighlight: { type: "row", index: 0 },
3046
+ moveSelection: null,
3047
+ colWidths: e.data.colWidths,
3048
+ withHeadings: !e.data.withHeadings,
3049
+ withHeadingColumn: e.data.withHeadingColumn
3050
+ };
3051
+ case "toggle-heading-column":
3052
+ return {
3053
+ pendingHighlight: { type: "col", index: 0 },
3054
+ moveSelection: null,
3055
+ colWidths: e.data.colWidths,
3056
+ withHeadings: e.data.withHeadings,
3057
+ withHeadingColumn: !e.data.withHeadingColumn
3058
+ };
3059
+ }
3060
+ }, Ut = 10, Ks = "data-blok-table-drag-ghost", St = (i) => {
3000
3061
  const t = i.querySelector(`[${g}]`);
3001
- return t ? Array.from(t.querySelectorAll(`[${p}]`)).reduce(
3062
+ return t ? Array.from(t.querySelectorAll(`[${u}]`)).reduce(
3002
3063
  (n, s) => {
3003
3064
  const o = n[n.length - 1];
3004
3065
  return [...n, o + s.offsetWidth];
@@ -3006,7 +3067,7 @@ const $s = [
3006
3067
  [0]
3007
3068
  ) : [0];
3008
3069
  };
3009
- class Vs {
3070
+ class js {
3010
3071
  constructor(t) {
3011
3072
  var e;
3012
3073
  this.isDragging = !1, this.dragType = null, this.dragFromIndex = -1, this.dragStartX = 0, this.dragStartY = 0, this.dropIndicator = null, this.dragOverlayCells = [], this.ghostEl = null, this.ghostOffsetX = 0, this.ghostOffsetY = 0, this.resolveTracking = null, this.grid = t.grid, this.onAction = t.onAction, this.onDragStateChange = (e = t.onDragStateChange) != null ? e : null, this.boundDocPointerMove = this.handleDocPointerMove.bind(this), this.boundDocPointerUp = this.handleDocPointerUp.bind(this);
@@ -3030,7 +3091,7 @@ class Vs {
3030
3091
  }
3031
3092
  handleDocPointerMove(t) {
3032
3093
  const e = Math.abs(t.clientX - this.dragStartX), n = Math.abs(t.clientY - this.dragStartY);
3033
- !this.isDragging && (e > Kt || n > Kt) && (this.isDragging = !0, this.startDrag()), this.isDragging && (this.updateDragIndicator(t), this.updateGhostPosition(t));
3094
+ !this.isDragging && (e > Ut || n > Ut) && (this.isDragging = !0, this.startDrag()), this.isDragging && (this.updateDragIndicator(t), this.updateGhostPosition(t));
3034
3095
  }
3035
3096
  handleDocPointerUp(t) {
3036
3097
  var e, n;
@@ -3052,28 +3113,28 @@ class Vs {
3052
3113
  const e = t[this.dragFromIndex];
3053
3114
  if (!e)
3054
3115
  return;
3055
- e.querySelectorAll(`[${p}]`).forEach((s) => {
3116
+ e.querySelectorAll(`[${u}]`).forEach((s) => {
3056
3117
  const o = s;
3057
- o.style.backgroundColor = "#dbeafe", o.style.opacity = "0.6", this.dragOverlayCells.push(o);
3118
+ o.style.backgroundColor = "#f3f4f6", o.style.opacity = "0.7", this.dragOverlayCells.push(o);
3058
3119
  });
3059
3120
  }
3060
3121
  highlightColumnCells(t) {
3061
3122
  t.forEach((e) => {
3062
- const n = e.querySelectorAll(`[${p}]`);
3123
+ const n = e.querySelectorAll(`[${u}]`);
3063
3124
  if (this.dragFromIndex >= n.length)
3064
3125
  return;
3065
3126
  const s = n[this.dragFromIndex];
3066
- s.style.backgroundColor = "#dbeafe", s.style.opacity = "0.6", this.dragOverlayCells.push(s);
3127
+ s.style.backgroundColor = "#f3f4f6", s.style.opacity = "0.7", this.dragOverlayCells.push(s);
3067
3128
  });
3068
3129
  }
3069
3130
  createDropIndicator() {
3070
3131
  this.dropIndicator = document.createElement("div");
3071
3132
  const t = this.dropIndicator.style;
3072
3133
  if (t.position = "absolute", t.backgroundColor = "#3b82f6", t.borderRadius = "1.5px", t.zIndex = "5", t.pointerEvents = "none", this.dropIndicator.setAttribute("contenteditable", "false"), this.dragType === "row")
3073
- t.height = "3px", t.left = `${-$}px`, t.right = "0", t.transition = "top 100ms ease";
3134
+ t.height = "3px", t.left = `${-P}px`, t.right = "0", t.transition = "top 100ms ease";
3074
3135
  else {
3075
3136
  const e = this.grid.querySelectorAll(`[${g}]`), n = e[e.length - 1], s = n ? n.offsetTop + n.offsetHeight : 0;
3076
- t.width = "3px", t.top = `${-$}px`, t.height = `${s + $}px`, t.transition = "left 100ms ease";
3137
+ t.width = "3px", t.top = `${-P}px`, t.height = `${s + P}px`, t.transition = "left 100ms ease";
3077
3138
  }
3078
3139
  this.grid.appendChild(this.dropIndicator);
3079
3140
  }
@@ -3097,7 +3158,7 @@ class Vs {
3097
3158
  var r;
3098
3159
  if (!this.dropIndicator)
3099
3160
  return;
3100
- const n = t.clientX - e.left, s = this.getColDropIndex(n), o = bt(this.grid);
3161
+ const n = t.clientX - e.left, s = this.getColDropIndex(n), o = St(this.grid);
3101
3162
  this.dropIndicator.style.left = `${((r = o[s]) != null ? r : 0) - 1.5}px`;
3102
3163
  }
3103
3164
  finishDrag(t) {
@@ -3118,7 +3179,7 @@ class Vs {
3118
3179
  }
3119
3180
  createGhost() {
3120
3181
  const t = document.createElement("div");
3121
- t.setAttribute(zs, ""), t.setAttribute("contenteditable", "false");
3182
+ t.setAttribute(Ks, ""), t.setAttribute("contenteditable", "false");
3122
3183
  const e = t.style;
3123
3184
  e.position = "fixed", e.pointerEvents = "none", e.opacity = "0.5", e.zIndex = "50", e.borderRadius = "4px", e.overflow = "hidden", e.boxShadow = "0 4px 12px rgba(0,0,0,0.15)", this.ghostEl = t;
3124
3185
  const n = this.getSourceRect();
@@ -3136,7 +3197,7 @@ class Vs {
3136
3197
  const t = this.grid.querySelectorAll(`[${g}]`), e = t[0], n = t[t.length - 1];
3137
3198
  if (!e || !n)
3138
3199
  return null;
3139
- const s = e.querySelectorAll(`[${p}]`)[this.dragFromIndex], o = n.querySelectorAll(`[${p}]`)[this.dragFromIndex];
3200
+ const s = e.querySelectorAll(`[${u}]`)[this.dragFromIndex], o = n.querySelectorAll(`[${u}]`)[this.dragFromIndex];
3140
3201
  if (!s || !o)
3141
3202
  return null;
3142
3203
  const r = s.getBoundingClientRect(), l = o.getBoundingClientRect();
@@ -3147,7 +3208,7 @@ class Vs {
3147
3208
  if (!e || !this.ghostEl)
3148
3209
  return;
3149
3210
  const n = this.ghostEl.style;
3150
- n.display = "flex", n.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${p}]`).forEach((o) => {
3211
+ n.display = "flex", n.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${u}]`).forEach((o) => {
3151
3212
  var a;
3152
3213
  const r = o, l = r.cloneNode(!0);
3153
3214
  l.style.width = `${r.offsetWidth}px`, l.style.flexShrink = "0", l.removeAttribute("contenteditable"), (a = this.ghostEl) == null || a.appendChild(l);
@@ -3159,7 +3220,7 @@ class Vs {
3159
3220
  const t = this.grid.querySelectorAll(`[${g}]`), e = this.ghostEl.style;
3160
3221
  e.display = "flex", e.flexDirection = "column", t.forEach((n) => {
3161
3222
  var l;
3162
- const s = n.querySelectorAll(`[${p}]`);
3223
+ const s = n.querySelectorAll(`[${u}]`);
3163
3224
  if (this.dragFromIndex >= s.length)
3164
3225
  return;
3165
3226
  const o = s[this.dragFromIndex], r = o.cloneNode(!0);
@@ -3192,11 +3253,177 @@ class Vs {
3192
3253
  return 0;
3193
3254
  }
3194
3255
  getColDropIndex(t) {
3195
- const n = bt(this.grid).map((o) => Math.abs(t - o)), s = Math.min(...n);
3256
+ const n = St(this.grid).map((o) => Math.abs(t - o)), s = Math.min(...n);
3196
3257
  return n.indexOf(s);
3197
3258
  }
3198
3259
  }
3199
- const jt = "data-blok-table-grip", mt = "data-blok-table-grip-col", Xt = "data-blok-table-grip-row", Us = 150, Ks = 24, Ct = 4, yt = 4, js = 20, it = [
3260
+ const Xs = [
3261
+ "flex",
3262
+ "items-center",
3263
+ "select-none",
3264
+ "border-none",
3265
+ "bg-transparent",
3266
+ "rounded-md",
3267
+ "p-[var(--item-padding)]",
3268
+ "text-text-primary",
3269
+ "mb-px",
3270
+ "cursor-pointer",
3271
+ "can-hover:hover:bg-item-hover-bg"
3272
+ ], Ys = [
3273
+ "flex",
3274
+ "items-center",
3275
+ "justify-center",
3276
+ "w-[26px]",
3277
+ "h-[26px]",
3278
+ "mr-2",
3279
+ "[&_svg]:w-icon",
3280
+ "[&_svg]:h-icon"
3281
+ ], Zs = [
3282
+ "mr-auto",
3283
+ "truncate",
3284
+ "text-sm",
3285
+ "font-medium",
3286
+ "leading-5"
3287
+ ], Js = [
3288
+ "relative",
3289
+ "w-[34px]",
3290
+ "h-[20px]",
3291
+ "rounded-full",
3292
+ "transition-colors",
3293
+ "duration-200",
3294
+ "shrink-0"
3295
+ ], Qs = [
3296
+ "absolute",
3297
+ "top-[2px]",
3298
+ "w-4",
3299
+ "h-4",
3300
+ "rounded-full",
3301
+ "bg-white",
3302
+ "shadow-sm",
3303
+ "transition-[left]",
3304
+ "duration-200"
3305
+ ], ye = (i) => {
3306
+ const { icon: t, label: e, isActive: n, onToggle: s } = i, o = { active: n }, r = document.createElement("div");
3307
+ r.className = v(Xs);
3308
+ const l = document.createElement("div");
3309
+ l.className = v(Ys), l.innerHTML = t, r.appendChild(l);
3310
+ const a = document.createElement("span");
3311
+ a.className = v(Zs), a.textContent = e, r.appendChild(a);
3312
+ const c = document.createElement("div");
3313
+ c.className = v(Js);
3314
+ const d = document.createElement("div");
3315
+ d.className = v(Qs), c.appendChild(d), r.appendChild(c);
3316
+ const h = () => {
3317
+ c.style.backgroundColor = o.active ? "#3b82f6" : "#d1d5db", d.style.left = o.active ? "16px" : "2px";
3318
+ };
3319
+ return h(), r.addEventListener("click", (p) => {
3320
+ p.stopPropagation(), o.active = !o.active, h(), s(o.active);
3321
+ }), r;
3322
+ }, to = (i, t) => {
3323
+ const e = i === 0 ? [
3324
+ {
3325
+ type: q.Html,
3326
+ element: ye({
3327
+ icon: Ue,
3328
+ label: t.i18n.t("tools.table.headerColumn"),
3329
+ isActive: t.isHeadingColumn(),
3330
+ onToggle: () => {
3331
+ t.onAction({ type: "toggle-heading-column" });
3332
+ }
3333
+ })
3334
+ },
3335
+ { type: q.Separator }
3336
+ ] : [], n = [
3337
+ {
3338
+ icon: qe,
3339
+ title: t.i18n.t("tools.table.insertColumnLeft"),
3340
+ closeOnActivate: !0,
3341
+ onActivate: () => {
3342
+ t.onAction({ type: "insert-col-left", index: i });
3343
+ }
3344
+ },
3345
+ {
3346
+ icon: Fe,
3347
+ title: t.i18n.t("tools.table.insertColumnRight"),
3348
+ closeOnActivate: !0,
3349
+ onActivate: () => {
3350
+ t.onAction({ type: "insert-col-right", index: i });
3351
+ }
3352
+ }
3353
+ ], s = t.getColumnCount() > 1, o = [
3354
+ { type: q.Separator },
3355
+ {
3356
+ icon: oe,
3357
+ title: t.i18n.t("tools.table.deleteColumn"),
3358
+ isDestructive: !0,
3359
+ isDisabled: !s,
3360
+ closeOnActivate: !0,
3361
+ onActivate: () => {
3362
+ t.onAction({ type: "delete-col", index: i });
3363
+ }
3364
+ }
3365
+ ];
3366
+ return [...e, ...n, ...o];
3367
+ }, eo = (i, t) => {
3368
+ const e = i === 0 ? [
3369
+ {
3370
+ type: q.Html,
3371
+ element: ye({
3372
+ icon: Ke,
3373
+ label: t.i18n.t("tools.table.headerRow"),
3374
+ isActive: t.isHeadingRow(),
3375
+ onToggle: () => {
3376
+ t.onAction({ type: "toggle-heading" });
3377
+ }
3378
+ })
3379
+ },
3380
+ { type: q.Separator }
3381
+ ] : [], n = [
3382
+ {
3383
+ icon: ze,
3384
+ title: t.i18n.t("tools.table.insertRowAbove"),
3385
+ closeOnActivate: !0,
3386
+ onActivate: () => {
3387
+ t.onAction({ type: "insert-row-above", index: i });
3388
+ }
3389
+ },
3390
+ {
3391
+ icon: Ve,
3392
+ title: t.i18n.t("tools.table.insertRowBelow"),
3393
+ closeOnActivate: !0,
3394
+ onActivate: () => {
3395
+ t.onAction({ type: "insert-row-below", index: i });
3396
+ }
3397
+ }
3398
+ ], s = t.getRowCount() > 1, o = [
3399
+ { type: q.Separator },
3400
+ {
3401
+ icon: oe,
3402
+ title: t.i18n.t("tools.table.deleteRow"),
3403
+ isDestructive: !0,
3404
+ isDisabled: !s,
3405
+ closeOnActivate: !0,
3406
+ onActivate: () => {
3407
+ t.onAction({ type: "delete-row", index: i });
3408
+ }
3409
+ }
3410
+ ];
3411
+ return [...e, ...n, ...o];
3412
+ }, no = (i, t, e, n, s) => {
3413
+ s.destroyPopover(), s.clearHideTimeout();
3414
+ const o = i === "col" ? e.col[t] : e.row[t];
3415
+ if (!o)
3416
+ return { popover: null, grip: null };
3417
+ const r = i === "col" ? to(t, n) : eo(t, n), l = new ne({
3418
+ items: r,
3419
+ trigger: o,
3420
+ flippable: !0
3421
+ });
3422
+ return l.on(se.Closed, () => {
3423
+ var a;
3424
+ s.destroyPopover(), s.applyVisibleClasses(o), s.scheduleHideAll(), (a = s.onGripPopoverClose) == null || a.call(s);
3425
+ }), s.hideAllGripsExcept(o), s.applyActiveClasses(o), i === "col" ? o.style.height = `${X}px` : o.style.width = `${X}px`, { popover: l, grip: o };
3426
+ }, Kt = "data-blok-table-grip", ot = "data-blok-table-grip-col", jt = "data-blok-table-grip-row", so = 150, oo = 24, it = 4, rt = 4, io = 20, lt = [
3200
3427
  "absolute",
3201
3428
  "z-[3]",
3202
3429
  "rounded",
@@ -3209,23 +3436,23 @@ const jt = "data-blok-table-grip", mt = "data-blok-table-grip-col", Xt = "data-b
3209
3436
  "items-center",
3210
3437
  "justify-center",
3211
3438
  "overflow-hidden"
3212
- ], Yt = [
3439
+ ], Xt = [
3213
3440
  "bg-gray-300",
3214
3441
  "opacity-0",
3215
3442
  "pointer-events-none"
3216
- ], Xs = [
3443
+ ], ro = [
3217
3444
  "bg-gray-300",
3218
3445
  "opacity-100",
3219
3446
  "pointer-events-auto"
3220
- ], Ys = [
3447
+ ], lo = [
3221
3448
  "bg-blue-500",
3222
3449
  "text-white",
3223
3450
  "opacity-100",
3224
3451
  "pointer-events-auto"
3225
3452
  ];
3226
- class Zs {
3453
+ class ao {
3227
3454
  constructor(t) {
3228
- this.colGrips = [], this.rowGrips = [], this.activePopover = null, this.activePopoverGrip = null, this.lockedGrip = null, this.hideTimeout = null, this.activeColGripIndex = -1, this.activeRowGripIndex = -1, this.grid = t.grid, this.getColumnCount = t.getColumnCount, this.getRowCount = t.getRowCount, this.isHeadingRow = t.isHeadingRow, this.isHeadingColumn = t.isHeadingColumn, this.onAction = t.onAction, this.onGripClick = t.onGripClick, this.onGripPopoverClose = t.onGripPopoverClose, this.drag = new Vs({
3455
+ this.colGrips = [], this.rowGrips = [], this.popoverState = { popover: null, grip: null }, this.lockedGrip = null, this.hideTimeout = null, this.activeColGripIndex = -1, this.activeRowGripIndex = -1, this.isInsideTable = !1, this.rowResizeObserver = null, this.grid = t.grid, this.getColumnCount = t.getColumnCount, this.getRowCount = t.getRowCount, this.isHeadingRow = t.isHeadingRow, this.isHeadingColumn = t.isHeadingColumn, this.onAction = t.onAction, this.onGripClick = t.onGripClick, this.onGripPopoverClose = t.onGripPopoverClose, this.i18n = t.i18n, this.drag = new js({
3229
3456
  grid: this.grid,
3230
3457
  onAction: this.onAction,
3231
3458
  onDragStateChange: (e, n) => {
@@ -3246,7 +3473,7 @@ class Zs {
3246
3473
  */
3247
3474
  setActiveGrip(t, e) {
3248
3475
  const n = t === "col" ? this.colGrips[e] : this.rowGrips[e];
3249
- n && (this.unlockGrip(), this.hideAllGripsExcept(n), this.applyActiveClasses(n), t === "col" ? n.style.height = `${K}px` : n.style.width = `${K}px`, this.lockedGrip = n, requestAnimationFrame(() => {
3476
+ n && (this.unlockGrip(), this.hideAllGripsExcept(n), this.applyActiveClasses(n), t === "col" ? n.style.height = `${X}px` : n.style.width = `${X}px`, this.lockedGrip = n, requestAnimationFrame(() => {
3250
3477
  document.addEventListener("pointerdown", this.boundUnlockGrip);
3251
3478
  }));
3252
3479
  }
@@ -3267,19 +3494,20 @@ class Zs {
3267
3494
  }), Array.from({ length: e }).forEach((n, s) => {
3268
3495
  const o = this.createGripElement("row", s);
3269
3496
  this.rowGrips.push(o), this.grid.appendChild(o);
3270
- }), this.positionGrips();
3497
+ }), this.positionGrips(), this.observeRowHeights();
3271
3498
  }
3272
3499
  destroyGrips() {
3273
- this.colGrips.forEach((t) => t.remove()), this.rowGrips.forEach((t) => t.remove()), this.colGrips = [], this.rowGrips = [], this.activeColGripIndex = -1, this.activeRowGripIndex = -1;
3500
+ var t;
3501
+ (t = this.rowResizeObserver) == null || t.disconnect(), this.rowResizeObserver = null, this.colGrips.forEach((e) => e.remove()), this.rowGrips.forEach((e) => e.remove()), this.colGrips = [], this.rowGrips = [], this.activeColGripIndex = -1, this.activeRowGripIndex = -1, this.isInsideTable = !1;
3274
3502
  }
3275
3503
  createGripElement(t, e) {
3276
3504
  const n = document.createElement("div");
3277
- n.className = v(it, Yt), n.setAttribute(jt, ""), n.setAttribute(t === "col" ? mt : Xt, String(e)), n.setAttribute("contenteditable", "false");
3278
- const s = t === "col" ? Ks : yt, o = t === "col" ? Ct : js, r = t === "col" ? Ct : yt;
3279
- return n.style.width = `${s}px`, n.style.height = `${o}px`, n.style.transform = "translate(-50%, -50%)", n.style.outline = "2px solid white", n.appendChild(me(t === "col" ? "horizontal" : "vertical")), n.addEventListener("pointerdown", this.boundPointerDown), n.addEventListener("mouseenter", () => {
3280
- this.isGripInteractionLocked() || Cs(n, t);
3505
+ n.className = v(lt, Xt), n.setAttribute(Kt, ""), n.setAttribute(t === "col" ? ot : jt, String(e)), n.setAttribute("contenteditable", "false");
3506
+ const s = t === "col" ? oo : rt, o = t === "col" ? it : io, r = t === "col" ? it : rt;
3507
+ return n.style.width = `${s}px`, n.style.height = `${o}px`, n.style.transform = "translate(-50%, -50%)", n.style.outline = "2px solid white", n.appendChild(fe(t === "col" ? "horizontal" : "vertical")), n.addEventListener("pointerdown", this.boundPointerDown), n.addEventListener("mouseenter", () => {
3508
+ this.isGripInteractionLocked() || ys(n, t);
3281
3509
  }), n.addEventListener("mouseleave", () => {
3282
- this.isGripInteractionLocked() || Gt(n, t, r);
3510
+ this.isGripInteractionLocked() || pt(n, t, r);
3283
3511
  }), n;
3284
3512
  }
3285
3513
  /**
@@ -3290,31 +3518,43 @@ class Zs {
3290
3518
  const t = this.grid.querySelectorAll(`[${g}]`);
3291
3519
  if (!t[0])
3292
3520
  return;
3293
- const n = bt(this.grid);
3521
+ const n = St(this.grid);
3294
3522
  this.colGrips.forEach((s, o) => {
3295
3523
  if (o + 1 >= n.length)
3296
3524
  return;
3297
3525
  const r = (n[o] + n[o + 1]) / 2, l = s.style;
3298
- l.top = `${-$ / 2}px`, l.left = `${r}px`;
3526
+ l.top = `${-P / 2}px`, l.left = `${r}px`;
3299
3527
  }), this.rowGrips.forEach((s, o) => {
3300
3528
  if (o >= t.length)
3301
3529
  return;
3302
3530
  const r = t[o], l = r.offsetTop + r.offsetHeight / 2, a = s.style;
3303
- a.left = `${-$ / 2}px`, a.top = `${l}px`;
3531
+ a.left = `${-P / 2}px`, a.top = `${l}px`;
3532
+ });
3533
+ }
3534
+ /**
3535
+ * Set up ResizeObserver to watch for row height changes and reposition grips.
3536
+ */
3537
+ observeRowHeights() {
3538
+ var e;
3539
+ (e = this.rowResizeObserver) == null || e.disconnect(), this.rowResizeObserver = new ResizeObserver(() => {
3540
+ this.positionGrips();
3541
+ }), this.grid.querySelectorAll(`[${g}]`).forEach((n) => {
3542
+ var s;
3543
+ (s = this.rowResizeObserver) == null || s.observe(n);
3304
3544
  });
3305
3545
  }
3306
3546
  isGripInteractionLocked() {
3307
- return this.activePopover !== null || this.lockedGrip !== null;
3547
+ return this.popoverState.popover !== null || this.lockedGrip !== null;
3308
3548
  }
3309
3549
  handleMouseOver(t) {
3310
3550
  if (this.isGripInteractionLocked())
3311
3551
  return;
3312
- const n = t.target.closest(`[${p}]`);
3552
+ const n = t.target.closest(`[${u}]`);
3313
3553
  if (!n)
3314
3554
  return;
3315
3555
  this.clearHideTimeout();
3316
3556
  const s = this.getCellPosition(n);
3317
- s && (this.showColGrip(s.col), this.showRowGrip(s.row));
3557
+ s && (this.showColGrip(s.col), this.showRowGrip(s.row), this.isInsideTable = !0);
3318
3558
  }
3319
3559
  handleMouseLeave() {
3320
3560
  this.isGripInteractionLocked() || this.scheduleHideAll();
@@ -3326,7 +3566,7 @@ class Zs {
3326
3566
  const s = Array.from(this.grid.querySelectorAll(`[${g}]`)).indexOf(e);
3327
3567
  if (s < 0)
3328
3568
  return null;
3329
- const r = Array.from(e.querySelectorAll(`[${p}]`)).indexOf(t);
3569
+ const r = Array.from(e.querySelectorAll(`[${u}]`)).indexOf(t);
3330
3570
  return r < 0 ? null : { row: s, col: r };
3331
3571
  }
3332
3572
  /**
@@ -3338,14 +3578,14 @@ class Zs {
3338
3578
  const e = t ? "" : "none";
3339
3579
  [...this.colGrips, ...this.rowGrips].forEach((n) => {
3340
3580
  const s = n;
3341
- !t && n === this.activePopoverGrip || (s.style.display = e);
3581
+ !t && n === this.popoverState.grip || (s.style.display = e);
3342
3582
  });
3343
3583
  }
3344
3584
  /**
3345
3585
  * Immediately hide all grips (no delay). Used when resize drag starts.
3346
3586
  */
3347
3587
  hideAllGrips() {
3348
- this.clearHideTimeout(), this.hideColGrip(), this.hideRowGrip();
3588
+ this.clearHideTimeout(), this.hideColGrip(), this.hideRowGrip(), this.isInsideTable = !1;
3349
3589
  }
3350
3590
  showColGrip(t) {
3351
3591
  this.activeColGripIndex !== t && (this.hideColGrip(), this.activeColGripIndex = t, this.applyVisibleClasses(this.colGrips[t]));
@@ -3360,13 +3600,13 @@ class Zs {
3360
3600
  this.activeRowGripIndex >= 0 && this.activeRowGripIndex < this.rowGrips.length && this.applyIdleClasses(this.rowGrips[this.activeRowGripIndex]), this.activeRowGripIndex = -1;
3361
3601
  }
3362
3602
  applyVisibleClasses(t) {
3363
- const e = t;
3364
- e.className = v(it, Xs), e.setAttribute("data-blok-table-grip-visible", "");
3365
- const n = e.querySelector("svg");
3366
- n && (n.classList.remove("text-white"), n.classList.add("text-gray-400"));
3603
+ const e = t, n = e.hasAttribute(ot);
3604
+ pt(e, n ? "col" : "row", n ? it : rt), this.isInsideTable && (e.style.transition = "none"), e.className = v(lt, ro), e.setAttribute("data-blok-table-grip-visible", ""), this.isInsideTable && (e.offsetHeight, e.style.transition = "");
3605
+ const r = e.querySelector("svg");
3606
+ r && (r.classList.remove("text-white"), r.classList.add("text-gray-400"));
3367
3607
  }
3368
3608
  applyActiveClasses(t) {
3369
- t.className = v(it, Ys), t.setAttribute("data-blok-table-grip-visible", "");
3609
+ Object.assign(t, { className: v(lt, lo) }), t.setAttribute("data-blok-table-grip-visible", "");
3370
3610
  const e = t.querySelector("svg");
3371
3611
  e && (e.classList.remove("text-gray-400", "opacity-0"), e.classList.add("text-white", "opacity-100"));
3372
3612
  }
@@ -3376,8 +3616,8 @@ class Zs {
3376
3616
  });
3377
3617
  }
3378
3618
  applyIdleClasses(t) {
3379
- const e = t, n = e.hasAttribute(mt);
3380
- Gt(e, n ? "col" : "row", n ? Ct : yt), e.className = v(it, Yt), e.removeAttribute("data-blok-table-grip-visible");
3619
+ const e = t, n = e.hasAttribute(ot), s = n ? "col" : "row", o = 12, r = n ? it + o : rt + o;
3620
+ this.isInsideTable && (e.style.transition = "none"), pt(e, s, r), e.className = v(lt, Xt), e.removeAttribute("data-blok-table-grip-visible"), this.isInsideTable && (e.offsetHeight, e.style.transition = "");
3381
3621
  }
3382
3622
  handleDragStateChange(t, e) {
3383
3623
  [...this.colGrips, ...this.rowGrips].forEach((n) => {
@@ -3387,15 +3627,15 @@ class Zs {
3387
3627
  }
3388
3628
  scheduleHideAll() {
3389
3629
  this.hideTimeout = setTimeout(() => {
3390
- this.hideColGrip(), this.hideRowGrip(), this.hideTimeout = null;
3391
- }, Us);
3630
+ this.hideColGrip(), this.hideRowGrip(), this.isInsideTable = !1, this.hideTimeout = null;
3631
+ }, so);
3392
3632
  }
3393
3633
  clearHideTimeout() {
3394
3634
  this.hideTimeout !== null && (clearTimeout(this.hideTimeout), this.hideTimeout = null);
3395
3635
  }
3396
3636
  // ── Click / Drag discrimination ──────────────────────────────
3397
3637
  handlePointerDown(t) {
3398
- const n = t.target.closest(`[${jt}]`);
3638
+ const n = t.target.closest(`[${Kt}]`);
3399
3639
  if (!n)
3400
3640
  return;
3401
3641
  t.preventDefault(), t.stopPropagation();
@@ -3405,141 +3645,58 @@ class Zs {
3405
3645
  });
3406
3646
  }
3407
3647
  detectGripType(t) {
3408
- const e = t.getAttribute(mt);
3648
+ const e = t.getAttribute(ot);
3409
3649
  if (e !== null)
3410
3650
  return { type: "col", index: Number(e) };
3411
- const n = t.getAttribute(Xt);
3651
+ const n = t.getAttribute(jt);
3412
3652
  return n !== null ? { type: "row", index: Number(n) } : null;
3413
3653
  }
3414
3654
  // ── Popover menus ────────────────────────────────────────────
3415
3655
  openPopover(t, e) {
3416
- var o;
3417
- this.destroyPopover(), this.clearHideTimeout();
3418
- const n = t === "col" ? this.colGrips[e] : this.rowGrips[e];
3419
- if (!n)
3420
- return;
3421
- const s = t === "col" ? this.buildColumnMenu(e) : this.buildRowMenu(e);
3422
- this.activePopover = new se({
3423
- items: s,
3424
- trigger: n,
3425
- flippable: !0
3426
- }), this.activePopoverGrip = n, this.activePopover.on(oe.Closed, () => {
3427
- var r;
3428
- this.activePopover !== null && (this.destroyPopover(), this.applyVisibleClasses(n), this.scheduleHideAll(), (r = this.onGripPopoverClose) == null || r.call(this));
3429
- }), this.hideAllGripsExcept(n), this.applyActiveClasses(n), t === "col" ? n.style.height = `${K}px` : n.style.width = `${K}px`, this.activePopover.show(), (o = this.onGripClick) == null || o.call(this, t, e);
3430
- }
3431
- destroyPopover() {
3432
- if (this.activePopover !== null) {
3433
- const t = this.activePopover;
3434
- this.activePopover = null, this.activePopoverGrip = null, t.destroy();
3435
- }
3436
- }
3437
- buildColumnMenu(t) {
3438
- const e = t === 0 ? [
3439
- {
3440
- type: F.Html,
3441
- element: Ut({
3442
- icon: Ve,
3443
- label: "Header column",
3444
- isActive: this.isHeadingColumn(),
3445
- onToggle: () => {
3446
- this.onAction({ type: "toggle-heading-column" });
3447
- }
3448
- })
3449
- },
3450
- { type: F.Separator }
3451
- ] : [], n = [
3656
+ var n, s;
3657
+ this.popoverState = no(
3658
+ t,
3659
+ e,
3660
+ { col: this.colGrips, row: this.rowGrips },
3452
3661
  {
3453
- icon: We,
3454
- title: "Insert Column Left",
3455
- closeOnActivate: !0,
3456
- onActivate: () => {
3457
- this.onAction({ type: "insert-col-left", index: t });
3458
- }
3662
+ getColumnCount: this.getColumnCount,
3663
+ getRowCount: this.getRowCount,
3664
+ isHeadingRow: this.isHeadingRow,
3665
+ isHeadingColumn: this.isHeadingColumn,
3666
+ onAction: this.onAction,
3667
+ i18n: this.i18n
3459
3668
  },
3460
3669
  {
3461
- icon: qe,
3462
- title: "Insert Column Right",
3463
- closeOnActivate: !0,
3464
- onActivate: () => {
3465
- this.onAction({ type: "insert-col-right", index: t });
3466
- }
3670
+ clearHideTimeout: () => this.clearHideTimeout(),
3671
+ hideAllGripsExcept: (o) => this.hideAllGripsExcept(o),
3672
+ applyActiveClasses: (o) => this.applyActiveClasses(o),
3673
+ applyVisibleClasses: (o) => this.applyVisibleClasses(o),
3674
+ scheduleHideAll: () => this.scheduleHideAll(),
3675
+ destroyPopover: () => this.destroyPopover(),
3676
+ onGripPopoverClose: this.onGripPopoverClose
3467
3677
  }
3468
- ], s = this.getColumnCount() > 1, o = [
3469
- { type: F.Separator },
3470
- {
3471
- icon: Lt,
3472
- title: "Delete",
3473
- isDestructive: !0,
3474
- isDisabled: !s,
3475
- closeOnActivate: !0,
3476
- onActivate: () => {
3477
- this.onAction({ type: "delete-col", index: t });
3478
- }
3479
- }
3480
- ];
3481
- return [...e, ...n, ...o];
3678
+ ), (n = this.popoverState.popover) == null || n.show(), (s = this.onGripClick) == null || s.call(this, t, e);
3482
3679
  }
3483
- buildRowMenu(t) {
3484
- const e = t === 0 ? [
3485
- {
3486
- type: F.Html,
3487
- element: Ut({
3488
- icon: Ue,
3489
- label: "Header row",
3490
- isActive: this.isHeadingRow(),
3491
- onToggle: () => {
3492
- this.onAction({ type: "toggle-heading" });
3493
- }
3494
- })
3495
- },
3496
- { type: F.Separator }
3497
- ] : [], n = [
3498
- {
3499
- icon: Fe,
3500
- title: "Insert Row Above",
3501
- closeOnActivate: !0,
3502
- onActivate: () => {
3503
- this.onAction({ type: "insert-row-above", index: t });
3504
- }
3505
- },
3506
- {
3507
- icon: ze,
3508
- title: "Insert Row Below",
3509
- closeOnActivate: !0,
3510
- onActivate: () => {
3511
- this.onAction({ type: "insert-row-below", index: t });
3512
- }
3513
- }
3514
- ], s = this.getRowCount() > 1, o = [
3515
- { type: F.Separator },
3516
- {
3517
- icon: Lt,
3518
- title: "Delete",
3519
- isDestructive: !0,
3520
- isDisabled: !s,
3521
- closeOnActivate: !0,
3522
- onActivate: () => {
3523
- this.onAction({ type: "delete-row", index: t });
3524
- }
3525
- }
3526
- ];
3527
- return [...e, ...n, ...o];
3680
+ destroyPopover() {
3681
+ if (this.popoverState.popover !== null) {
3682
+ const t = this.popoverState.popover;
3683
+ this.popoverState = { popover: null, grip: null }, t.destroy();
3684
+ }
3528
3685
  }
3529
3686
  }
3530
- const Js = 3, Qs = 3, to = [
3687
+ const co = 3, ho = 3, uo = [
3531
3688
  "my-2",
3532
3689
  "pr-5"
3533
- ], eo = [
3690
+ ], po = [
3534
3691
  "relative"
3535
3692
  ];
3536
- class co {
3693
+ class So {
3537
3694
  constructor({ data: t, config: e, api: n, readOnly: s, block: o }) {
3538
- this.resize = null, this.addControls = null, this.rowColControls = null, this.cellBlocks = null, this.cellSelection = null, this.element = null, this.pendingHighlight = null, this.api = n, this.readOnly = s, this.config = e != null ? e : {}, this.data = Ns(t, e != null ? e : {}), this.grid = new ps({ readOnly: s }), this.blockId = o == null ? void 0 : o.id;
3695
+ this.resize = null, this.addControls = null, this.rowColControls = null, this.cellBlocks = null, this.cellSelection = null, this.element = null, this.pendingHighlight = null, this.api = n, this.readOnly = s, this.config = e != null ? e : {}, this.data = _s(t, e != null ? e : {}), this.grid = new gs({ readOnly: s }), this.blockId = o == null ? void 0 : o.id;
3539
3696
  }
3540
3697
  static get toolbox() {
3541
3698
  return {
3542
- icon: Ke,
3699
+ icon: je,
3543
3700
  title: "Table",
3544
3701
  titleKey: "tools.table.title",
3545
3702
  searchTerms: ["table", "grid", "spreadsheet"]
@@ -3570,31 +3727,35 @@ class co {
3570
3727
  render() {
3571
3728
  var o;
3572
3729
  const t = document.createElement("div");
3573
- t.className = v(to, !this.readOnly && eo, this.data.colWidths && ye), t.setAttribute(E.tool, "table"), this.readOnly && t.setAttribute("data-blok-table-readonly", "");
3574
- const e = this.data.content.length || this.config.rows || Js, n = ((o = this.data.content[0]) == null ? void 0 : o.length) || this.config.cols || Qs, s = this.grid.createGrid(e, n, this.data.colWidths);
3575
- return this.data.content.length > 0 && this.grid.fillGrid(s, this.data.content), this.data.colWidths && st(s, this.data.colWidths), t.appendChild(s), this.element = t, this.data.withHeadings && ot(this.element, this.data.withHeadings), this.data.withHeadingColumn && U(this.element, this.data.withHeadingColumn), this.readOnly || (this.initCellBlocks(s), Ps(s, this.cellBlocks)), t;
3730
+ t.className = v(uo, !this.readOnly && po, this.data.colWidths && Ce), t.setAttribute(E.tool, "table"), this.readOnly && t.setAttribute("data-blok-table-readonly", "");
3731
+ const e = this.data.content.length || this.config.rows || co, n = ((o = this.data.content[0]) == null ? void 0 : o.length) || this.config.cols || ho, s = this.grid.createGrid(e, n, this.data.colWidths);
3732
+ return this.data.content.length > 0 && this.grid.fillGrid(s, this.data.content), this.data.colWidths && ct(s, this.data.colWidths), t.appendChild(s), this.element = t, this.data.withHeadings && st(this.element, this.data.withHeadings), this.data.withHeadingColumn && z(this.element, this.data.withHeadingColumn), this.readOnly || (this.initCellBlocks(s), Os(s, this.cellBlocks)), t;
3576
3733
  }
3577
3734
  rendered() {
3578
- var e, n;
3735
+ var e, n, s;
3579
3736
  if (!this.element)
3580
3737
  return;
3581
3738
  const t = this.element.firstElementChild;
3582
3739
  if (t) {
3583
3740
  if (this.readOnly) {
3584
- Ds(t, this.data.content, this.api);
3741
+ Ps(t, this.data.content, this.api);
3585
3742
  return;
3586
3743
  }
3587
- this.data.content = (n = (e = this.cellBlocks) == null ? void 0 : e.initializeCells(this.data.content)) != null ? n : this.data.content, this.initResize(t), this.initAddControls(t), this.initRowColControls(t), this.initCellSelection(t);
3744
+ if (this.data.content = (n = (e = this.cellBlocks) == null ? void 0 : e.initializeCells(this.data.content)) != null ? n : this.data.content, this.data.initialColWidth === void 0) {
3745
+ const o = (s = this.data.colWidths) != null ? s : J(t);
3746
+ this.data.initialColWidth = o.length > 0 ? Ds(o) : void 0;
3747
+ }
3748
+ this.initResize(t), this.initAddControls(t), this.initRowColControls(t), this.initCellSelection(t);
3588
3749
  }
3589
3750
  }
3590
3751
  save(t) {
3591
3752
  const e = t.firstElementChild, n = this.data.colWidths, s = this.readOnly ? this.data.content : this.grid.getData(e);
3592
- return L({
3753
+ return x(x({
3593
3754
  withHeadings: this.data.withHeadings,
3594
3755
  withHeadingColumn: this.data.withHeadingColumn,
3595
3756
  stretched: this.data.stretched,
3596
3757
  content: s
3597
- }, n ? { colWidths: n } : {});
3758
+ }, n ? { colWidths: n } : {}), this.data.initialColWidth !== void 0 ? { initialColWidth: this.data.initialColWidth } : {});
3598
3759
  }
3599
3760
  validate(t) {
3600
3761
  return t.content.length > 0;
@@ -3602,11 +3763,11 @@ class co {
3602
3763
  onPaste(t) {
3603
3764
  var d, h;
3604
3765
  const e = t.detail.data, n = e.querySelectorAll("tr"), s = [];
3605
- n.forEach((u) => {
3606
- const f = u.querySelectorAll("td, th"), m = [];
3607
- f.forEach((y) => {
3608
- m.push(y.innerHTML);
3609
- }), m.length > 0 && s.push(m);
3766
+ n.forEach((p) => {
3767
+ const m = p.querySelectorAll("td, th"), f = [];
3768
+ m.forEach((y) => {
3769
+ f.push(y.innerHTML);
3770
+ }), f.length > 0 && s.push(f);
3610
3771
  });
3611
3772
  const o = e.querySelector("thead") !== null, r = ((d = n[0]) == null ? void 0 : d.querySelector("th")) !== null, l = o || r;
3612
3773
  if (this.data = {
@@ -3622,73 +3783,78 @@ class co {
3622
3783
  !this.readOnly && c && (this.initResize(c), this.initAddControls(c), this.initRowColControls(c));
3623
3784
  }
3624
3785
  destroy() {
3625
- var t, e, n, s, o;
3626
- (t = this.resize) == null || t.destroy(), this.resize = null, (e = this.addControls) == null || e.destroy(), this.addControls = null, (n = this.rowColControls) == null || n.destroy(), this.rowColControls = null, (s = this.cellBlocks) == null || s.destroy(), this.cellBlocks = null, (o = this.cellSelection) == null || o.destroy(), this.cellSelection = null, this.element = null;
3786
+ var t, e, n, s, o, r;
3787
+ (t = this.cellBlocks) == null || t.deleteAllBlocks(), (e = this.resize) == null || e.destroy(), this.resize = null, (n = this.addControls) == null || n.destroy(), this.addControls = null, (s = this.rowColControls) == null || s.destroy(), this.rowColControls = null, (o = this.cellBlocks) == null || o.destroy(), this.cellBlocks = null, (r = this.cellSelection) == null || r.destroy(), this.cellSelection = null, this.element = null;
3627
3788
  }
3628
3789
  deleteRowWithCleanup(t) {
3629
3790
  var n;
3630
3791
  const e = (n = this.element) == null ? void 0 : n.firstElementChild;
3631
- e && pt(e, t, this.grid, this.cellBlocks);
3792
+ e && bt(e, t, this.grid, this.cellBlocks);
3632
3793
  }
3633
3794
  deleteColumnWithCleanup(t) {
3634
3795
  var n;
3635
3796
  const e = (n = this.element) == null ? void 0 : n.firstElementChild;
3636
- e && (this.data.colWidths = gt(e, t, this.data.colWidths, this.grid, this.cellBlocks));
3797
+ e && (this.data.colWidths = vt(e, t, this.data.colWidths, this.grid, this.cellBlocks));
3637
3798
  }
3638
3799
  getBlockIdsInRow(t) {
3639
- return Bs(this.element, this.cellBlocks, t);
3800
+ return Ns(this.element, this.cellBlocks, t);
3640
3801
  }
3641
3802
  getBlockIdsInColumn(t) {
3642
- return Is(this.element, this.cellBlocks, t);
3803
+ return Hs(this.element, this.cellBlocks, t);
3643
3804
  }
3644
3805
  initAddControls(t) {
3645
- var e;
3646
- (e = this.addControls) == null || e.destroy(), this.element && (this.addControls = new cs({
3806
+ var n;
3807
+ if ((n = this.addControls) == null || n.destroy(), !this.element)
3808
+ return;
3809
+ const e = { addedCols: 0 };
3810
+ this.addControls = new ds({
3647
3811
  wrapper: this.element,
3648
3812
  grid: t,
3813
+ i18n: this.api.i18n,
3649
3814
  onAddRow: () => {
3650
- var n, s;
3651
- this.grid.addRow(t), W(t, this.cellBlocks), ot(this.element, this.data.withHeadings), U(this.element, this.data.withHeadingColumn), this.initResize(t), (n = this.addControls) == null || n.syncRowButtonWidth(), (s = this.rowColControls) == null || s.refresh();
3815
+ var s, o;
3816
+ this.grid.addRow(t), V(t, this.cellBlocks), st(this.element, this.data.withHeadings), z(this.element, this.data.withHeadingColumn), this.initResize(t), (s = this.addControls) == null || s.syncRowButtonWidth(), (o = this.rowColControls) == null || o.refresh();
3652
3817
  },
3653
3818
  onAddColumn: () => {
3654
- var o, r, l;
3655
- const n = (o = this.data.colWidths) != null ? o : lt(t), s = Ft(n);
3656
- this.grid.addColumn(t, void 0, n), this.data.colWidths = [...n, s], W(t, this.cellBlocks), U(this.element, this.data.withHeadingColumn), this.initResize(t), (r = this.addControls) == null || r.syncRowButtonWidth(), (l = this.rowColControls) == null || l.refresh();
3819
+ var r, l, a;
3820
+ const s = (r = this.data.colWidths) != null ? r : J(t), o = this.data.initialColWidth !== void 0 ? Math.round(this.data.initialColWidth / 2 * 100) / 100 : yt(s);
3821
+ this.grid.addColumn(t, void 0, s, o), this.data.colWidths = [...s, o], V(t, this.cellBlocks), z(this.element, this.data.withHeadingColumn), this.initResize(t), (l = this.addControls) == null || l.syncRowButtonWidth(), (a = this.rowColControls) == null || a.refresh();
3657
3822
  },
3658
3823
  onDragStart: () => {
3659
- var n, s;
3660
- this.resize && (this.resize.enabled = !1), (n = this.rowColControls) == null || n.hideAllGrips(), (s = this.rowColControls) == null || s.setGripsDisplay(!1);
3824
+ var s, o;
3825
+ this.resize && (this.resize.enabled = !1), (s = this.rowColControls) == null || s.hideAllGrips(), (o = this.rowColControls) == null || o.setGripsDisplay(!1);
3661
3826
  },
3662
3827
  onDragAddRow: () => {
3663
- this.grid.addRow(t), W(t, this.cellBlocks), ot(this.element, this.data.withHeadings), U(this.element, this.data.withHeadingColumn);
3828
+ this.grid.addRow(t), V(t, this.cellBlocks), st(this.element, this.data.withHeadings), z(this.element, this.data.withHeadingColumn);
3664
3829
  },
3665
3830
  onDragRemoveRow: () => {
3666
- const n = this.grid.getRowCount(t);
3667
- n > 1 && ks(t, n - 1) && pt(t, n - 1, this.grid, this.cellBlocks);
3831
+ const s = this.grid.getRowCount(t);
3832
+ s > 1 && xs(t, s - 1) && bt(t, s - 1, this.grid, this.cellBlocks);
3668
3833
  },
3669
3834
  onDragAddCol: () => {
3670
- var o;
3671
- const n = (o = this.data.colWidths) != null ? o : lt(t), s = Ft(n);
3672
- this.grid.addColumn(t, void 0, n), this.data.colWidths = [...n, s], st(t, this.data.colWidths), W(t, this.cellBlocks), U(this.element, this.data.withHeadingColumn), this.initResize(t);
3835
+ var r;
3836
+ const s = (r = this.data.colWidths) != null ? r : J(t), o = this.data.initialColWidth !== void 0 ? Math.round(this.data.initialColWidth / 2 * 100) / 100 : yt(s);
3837
+ this.grid.addColumn(t, void 0, s, o), this.data.colWidths = [...s, o], ct(t, this.data.colWidths), V(t, this.cellBlocks), z(this.element, this.data.withHeadingColumn), this.initResize(t), e.addedCols++, this.element && (this.element.scrollLeft = this.element.scrollWidth);
3673
3838
  },
3674
3839
  onDragRemoveCol: () => {
3675
- const n = this.grid.getColumnCount(t);
3676
- n <= 1 || !xs(t, n - 1) || (this.data.colWidths = gt(t, n - 1, this.data.colWidths, this.grid, this.cellBlocks), this.data.colWidths && st(t, this.data.colWidths), this.initResize(t));
3840
+ const s = this.grid.getColumnCount(t);
3841
+ s <= 1 || !Ts(t, s - 1) || (this.data.colWidths = vt(t, s - 1, this.data.colWidths, this.grid, this.cellBlocks), this.data.colWidths && ct(t, this.data.colWidths), this.initResize(t), e.addedCols--);
3677
3842
  },
3678
3843
  onDragEnd: () => {
3679
- var n, s;
3680
- this.initResize(t), (n = this.addControls) == null || n.syncRowButtonWidth(), (s = this.rowColControls) == null || s.refresh(), this.element && (this.element.scrollLeft = 0);
3844
+ var s, o;
3845
+ this.initResize(t), (s = this.addControls) == null || s.syncRowButtonWidth(), (o = this.rowColControls) == null || o.refresh(), this.element && (this.element.scrollLeft = e.addedCols > 0 ? this.element.scrollWidth : 0), e.addedCols = 0;
3681
3846
  }
3682
- }));
3847
+ });
3683
3848
  }
3684
3849
  initRowColControls(t) {
3685
3850
  var e;
3686
- (e = this.rowColControls) == null || e.destroy(), this.element && (this.rowColControls = new Zs({
3851
+ (e = this.rowColControls) == null || e.destroy(), this.element && (this.rowColControls = new ao({
3687
3852
  grid: t,
3688
3853
  getColumnCount: () => this.grid.getColumnCount(t),
3689
3854
  getRowCount: () => this.grid.getRowCount(t),
3690
3855
  isHeadingRow: () => this.data.withHeadings,
3691
3856
  isHeadingColumn: () => this.data.withHeadingColumn,
3857
+ i18n: this.api.i18n,
3692
3858
  onAction: (n) => this.handleRowColAction(t, n),
3693
3859
  onDragStateChange: (n) => {
3694
3860
  var s;
@@ -3712,57 +3878,27 @@ class co {
3712
3878
  }));
3713
3879
  }
3714
3880
  handleRowColAction(t, e) {
3715
- var n, s;
3716
- switch (e.type) {
3717
- case "insert-row-above":
3718
- this.grid.addRow(t, e.index), W(t, this.cellBlocks), this.pendingHighlight = { type: "row", index: e.index };
3719
- break;
3720
- case "insert-row-below":
3721
- this.grid.addRow(t, e.index + 1), W(t, this.cellBlocks), this.pendingHighlight = { type: "row", index: e.index + 1 };
3722
- break;
3723
- case "insert-col-left":
3724
- this.data.colWidths = qt(t, e.index, this.data, this.grid), W(t, this.cellBlocks), this.pendingHighlight = { type: "col", index: e.index };
3725
- break;
3726
- case "insert-col-right":
3727
- this.data.colWidths = qt(t, e.index + 1, this.data, this.grid), W(t, this.cellBlocks), this.pendingHighlight = { type: "col", index: e.index + 1 };
3728
- break;
3729
- case "move-row":
3730
- this.grid.moveRow(t, e.fromIndex, e.toIndex);
3731
- break;
3732
- case "move-col":
3733
- this.grid.moveColumn(t, e.fromIndex, e.toIndex), this.data.colWidths = Ls(this.data.colWidths, e.fromIndex, e.toIndex);
3734
- break;
3735
- case "delete-row": {
3736
- pt(t, e.index, this.grid, this.cellBlocks);
3737
- const o = this.grid.getRowCount(t), r = e.index < o ? e.index : e.index - 1;
3738
- this.pendingHighlight = { type: "row", index: r };
3739
- break;
3740
- }
3741
- case "delete-col": {
3742
- this.data.colWidths = gt(t, e.index, this.data.colWidths, this.grid, this.cellBlocks), this.data.colWidths ? st(t, this.data.colWidths) : Ts(t);
3743
- const o = this.grid.getColumnCount(t), r = e.index < o ? e.index : e.index - 1;
3744
- this.pendingHighlight = { type: "col", index: r };
3745
- break;
3746
- }
3747
- case "toggle-heading":
3748
- this.data.withHeadings = !this.data.withHeadings, this.pendingHighlight = { type: "row", index: 0 };
3749
- break;
3750
- case "toggle-heading-column":
3751
- this.data.withHeadingColumn = !this.data.withHeadingColumn, this.pendingHighlight = { type: "col", index: 0 };
3752
- break;
3753
- }
3754
- ot(this.element, this.data.withHeadings), U(this.element, this.data.withHeadingColumn), this.initResize(t), (n = this.addControls) == null || n.syncRowButtonWidth(), (s = this.rowColControls) == null || s.refresh();
3881
+ var r, l, a, c, d;
3882
+ const n = Us(
3883
+ t,
3884
+ e,
3885
+ { grid: this.grid, data: this.data, cellBlocks: this.cellBlocks }
3886
+ );
3887
+ if (this.data.colWidths = n.colWidths, this.data.withHeadings = n.withHeadings, this.data.withHeadingColumn = n.withHeadingColumn, this.pendingHighlight = n.pendingHighlight, st(this.element, this.data.withHeadings), z(this.element, this.data.withHeadingColumn), this.initResize(t), (r = this.addControls) == null || r.syncRowButtonWidth(), (l = this.rowColControls) == null || l.refresh(), !n.moveSelection)
3888
+ return;
3889
+ const { type: s, index: o } = n.moveSelection;
3890
+ s === "row" ? (a = this.cellSelection) == null || a.selectRow(o) : (c = this.cellSelection) == null || c.selectColumn(o), (d = this.rowColControls) == null || d.setActiveGrip(s, o);
3755
3891
  }
3756
3892
  initResize(t) {
3757
3893
  var s, o;
3758
3894
  (s = this.resize) == null || s.destroy();
3759
- const e = this.data.colWidths === void 0, n = (o = this.data.colWidths) != null ? o : lt(t);
3760
- e || zt(this.element), this.resize = new Os(
3895
+ const e = this.data.colWidths === void 0, n = (o = this.data.colWidths) != null ? o : J(t);
3896
+ e || qt(this.element), this.resize = new Gs(
3761
3897
  t,
3762
3898
  n,
3763
3899
  (r) => {
3764
3900
  var l;
3765
- this.data.colWidths = r, zt(this.element), (l = this.rowColControls) == null || l.positionGrips();
3901
+ this.data.colWidths = r, qt(this.element), (l = this.rowColControls) == null || l.positionGrips();
3766
3902
  },
3767
3903
  () => {
3768
3904
  var r;
@@ -3777,7 +3913,7 @@ class co {
3777
3913
  }
3778
3914
  initCellBlocks(t) {
3779
3915
  var e;
3780
- this.cellBlocks = new gs({
3916
+ this.cellBlocks = new fs({
3781
3917
  api: this.api,
3782
3918
  gridElement: t,
3783
3919
  tableBlockId: (e = this.blockId) != null ? e : ""
@@ -3787,10 +3923,11 @@ class co {
3787
3923
  var n;
3788
3924
  (n = this.cellSelection) == null || n.destroy();
3789
3925
  const e = this.api.rectangleSelection;
3790
- this.cellSelection = new As({
3926
+ this.cellSelection = new Es({
3791
3927
  grid: t,
3792
3928
  rectangleSelection: e,
3793
3929
  // Pass reference
3930
+ i18n: this.api.i18n,
3794
3931
  onSelectionActiveChange: (s) => {
3795
3932
  var o, r;
3796
3933
  this.resize && (this.resize.enabled = !s), (o = this.addControls) == null || o.setInteractive(!s), (r = this.rowColControls) == null || r.setGripsDisplay(!s);
@@ -3804,10 +3941,10 @@ class co {
3804
3941
  });
3805
3942
  }
3806
3943
  }
3807
- const z = (i) => {
3944
+ const G = (i) => {
3808
3945
  const t = i.tagName;
3809
3946
  return t === "B" || t === "STRONG";
3810
- }, ct = (i) => !!(i && i.nodeType === Node.ELEMENT_NODE && z(i)), be = (i) => i.textContent.length === 0, M = (i) => i ? i.nodeType === Node.ELEMENT_NODE && z(i) ? G(i) : M(i.parentNode) : null, G = (i) => {
3947
+ }, ht = (i) => !!(i && i.nodeType === Node.ELEMENT_NODE && G(i)), be = (i) => i.textContent.length === 0, N = (i) => i ? i.nodeType === Node.ELEMENT_NODE && G(i) ? _(i) : N(i.parentNode) : null, _ = (i) => {
3811
3948
  if (i.tagName === "STRONG")
3812
3949
  return i;
3813
3950
  const t = document.createElement("strong");
@@ -3816,7 +3953,7 @@ const z = (i) => {
3816
3953
  }); i.firstChild; )
3817
3954
  t.appendChild(i.firstChild);
3818
3955
  return i.replaceWith(t), t;
3819
- }, no = (i) => {
3956
+ }, go = (i) => {
3820
3957
  const t = i.nextSibling;
3821
3958
  if ((t == null ? void 0 : t.nodeType) === Node.TEXT_NODE)
3822
3959
  return t;
@@ -3825,20 +3962,20 @@ const z = (i) => {
3825
3962
  return null;
3826
3963
  const n = i.ownerDocument.createTextNode("");
3827
3964
  return e.insertBefore(n, t), n;
3828
- }, so = (i) => {
3965
+ }, fo = (i) => {
3829
3966
  if (!i.boldElement.isConnected)
3830
3967
  return null;
3831
- const t = G(i.boldElement), e = i.boundary, s = e.isConnected && e.previousSibling === t ? e : no(t);
3968
+ const t = _(i.boldElement), e = i.boundary, s = e.isConnected && e.previousSibling === t ? e : go(t);
3832
3969
  return s ? {
3833
3970
  boundary: s,
3834
3971
  boldElement: t
3835
3972
  } : null;
3836
- }, vt = (i, t) => i ? i === t || t.contains(i) : !1, S = {
3973
+ }, wt = (i, t) => i ? i === t || t.contains(i) : !1, S = {
3837
3974
  COLLAPSED_LENGTH: "data-blok-bold-collapsed-length",
3838
3975
  COLLAPSED_ACTIVE: "data-blok-bold-collapsed-active",
3839
3976
  PREV_LENGTH: "data-blok-bold-prev-length",
3840
3977
  LEADING_WHITESPACE: "data-blok-bold-leading-ws"
3841
- }, R = class R {
3978
+ }, L = class L {
3842
3979
  constructor() {
3843
3980
  this.records = /* @__PURE__ */ new Set();
3844
3981
  }
@@ -3846,13 +3983,13 @@ const z = (i) => {
3846
3983
  * Get the singleton instance
3847
3984
  */
3848
3985
  static getInstance() {
3849
- return R.instance || (R.instance = new R()), R.instance;
3986
+ return L.instance || (L.instance = new L()), L.instance;
3850
3987
  }
3851
3988
  /**
3852
3989
  * Reset the singleton instance (for testing)
3853
3990
  */
3854
3991
  static reset() {
3855
- R.instance && R.instance.records.clear(), R.instance = null;
3992
+ L.instance && L.instance.records.clear(), L.instance = null;
3856
3993
  }
3857
3994
  /**
3858
3995
  * Check if there are any active exit records
@@ -3921,7 +4058,7 @@ const z = (i) => {
3921
4058
  * @param boldElement - The bold element to exit from
3922
4059
  */
3923
4060
  exit(t, e) {
3924
- const n = G(e), s = n.parentNode;
4061
+ const n = _(e), s = n.parentNode;
3925
4062
  if (s)
3926
4063
  return be(n) ? this.removeEmptyBoldElement(t, n, s) : this.exitBoldWithContent(t, n, s);
3927
4064
  }
@@ -3951,7 +4088,7 @@ const z = (i) => {
3951
4088
  maintain() {
3952
4089
  if (typeof document != "undefined")
3953
4090
  for (const t of Array.from(this.records)) {
3954
- const e = so(t);
4091
+ const e = fo(t);
3955
4092
  if (!e) {
3956
4093
  this.records.delete(t);
3957
4094
  continue;
@@ -3977,8 +4114,8 @@ const z = (i) => {
3977
4114
  checkForRecordDeletion(t) {
3978
4115
  const { boundary: e, boldElement: n, allowedLength: s } = t, o = e.textContent, r = o.replace(/\u200B/g, ""), l = o.startsWith("​"), a = /^\s/.test(r), c = t.hasTypedContent && !l && n.textContent.length <= s, d = t.hasLeadingSpace && t.hasTypedContent && !a;
3979
4116
  if (c && d) {
3980
- const h = o.replace(/^[\u200B\s]+/, ""), u = t.leadingWhitespace || " ";
3981
- e.textContent = `${u}${h}`;
4117
+ const h = o.replace(/^[\u200B\s]+/, ""), p = t.leadingWhitespace || " ";
4118
+ e.textContent = `${p}${h}`;
3982
4119
  }
3983
4120
  c && this.records.delete(t);
3984
4121
  }
@@ -3988,33 +4125,33 @@ const z = (i) => {
3988
4125
  */
3989
4126
  synchronize(t) {
3990
4127
  var r, l;
3991
- const e = (r = t == null ? void 0 : t.anchorNode) != null ? r : t == null ? void 0 : t.focusNode, n = e && e.nodeType === Node.ELEMENT_NODE ? e : e == null ? void 0 : e.parentElement, s = (l = n == null ? void 0 : n.closest(O(E.editor))) != null ? l : n == null ? void 0 : n.ownerDocument;
4128
+ const e = (r = t == null ? void 0 : t.anchorNode) != null ? r : t == null ? void 0 : t.focusNode, n = e && e.nodeType === Node.ELEMENT_NODE ? e : e == null ? void 0 : e.parentElement, s = (l = n == null ? void 0 : n.closest(H(E.editor))) != null ? l : n == null ? void 0 : n.ownerDocument;
3992
4129
  if (!s)
3993
4130
  return;
3994
4131
  const o = `strong[${S.COLLAPSED_ACTIVE}="true"]`;
3995
4132
  s.querySelectorAll(o).forEach((a) => {
3996
- var At;
4133
+ var kt;
3997
4134
  const c = a.getAttribute(S.PREV_LENGTH), d = a.previousSibling;
3998
4135
  if (!c || !d || d.nodeType !== Node.TEXT_NODE)
3999
4136
  return;
4000
4137
  const h = Number(c);
4001
4138
  if (!Number.isFinite(h))
4002
4139
  return;
4003
- const u = d, f = u.textContent;
4004
- if (f.length <= h)
4140
+ const p = d, m = p.textContent;
4141
+ if (m.length <= h)
4005
4142
  return;
4006
- const m = f.slice(0, h), y = f.slice(h);
4007
- u.textContent = m;
4143
+ const f = m.slice(0, h), y = m.slice(h);
4144
+ p.textContent = f;
4008
4145
  const b = y.match(/^[\u00A0\s]+/);
4009
4146
  if (b && !a.hasAttribute(S.LEADING_WHITESPACE) && a.setAttribute(S.LEADING_WHITESPACE, b[0]), y.length === 0)
4010
4147
  return;
4011
- const I = a.textContent, D = I + y, N = (At = a.getAttribute(S.LEADING_WHITESPACE)) != null ? At : "", T = N.length > 0 && I.length === 0 && !D.startsWith(N) ? N + D : D, _ = document.createTextNode(T);
4148
+ const B = a.textContent, I = B + y, D = (kt = a.getAttribute(S.LEADING_WHITESPACE)) != null ? kt : "", W = D.length > 0 && B.length === 0 && !I.startsWith(D) ? D + I : I, $ = document.createTextNode(W);
4012
4149
  for (; a.firstChild; )
4013
4150
  a.removeChild(a.firstChild);
4014
- if (a.appendChild(_), !(t != null && t.isCollapsed) || !vt(t.focusNode, u))
4151
+ if (a.appendChild($), !(t != null && t.isCollapsed) || !wt(t.focusNode, p))
4015
4152
  return;
4016
- const H = document.createRange(), J = _.textContent.length;
4017
- H.setStart(_, J), H.collapse(!0), t.removeAllRanges(), t.addRange(H);
4153
+ const Z = document.createRange(), Ee = $.textContent.length;
4154
+ Z.setStart($, Ee), Z.collapse(!0), t.removeAllRanges(), t.addRange(Z);
4018
4155
  });
4019
4156
  }
4020
4157
  /**
@@ -4026,27 +4163,27 @@ const z = (i) => {
4026
4163
  const e = (r = t == null ? void 0 : t.anchorNode) != null ? r : t == null ? void 0 : t.focusNode;
4027
4164
  if (!e)
4028
4165
  return;
4029
- const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement, s = n == null ? void 0 : n.closest(O(E.editor));
4166
+ const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement, s = n == null ? void 0 : n.closest(H(E.editor));
4030
4167
  if (!s)
4031
4168
  return;
4032
4169
  s.querySelectorAll(`strong[${S.COLLAPSED_LENGTH}]`).forEach((l) => {
4033
- var N, P;
4170
+ var D, M;
4034
4171
  const a = l.getAttribute(S.COLLAPSED_LENGTH);
4035
4172
  if (!a)
4036
4173
  return;
4037
4174
  const c = Number(a), d = l.textContent;
4038
4175
  if (!Number.isFinite(c))
4039
4176
  return;
4040
- const h = d.length > c, u = h ? this.splitCollapsedBoldText(l, c, d) : null, f = l.getAttribute(S.PREV_LENGTH), m = f ? Number(f) : NaN, y = l.previousSibling, b = (y == null ? void 0 : y.nodeType) === Node.TEXT_NODE ? y : null, I = (N = b == null ? void 0 : b.textContent) != null ? N : "", D = !!(f && Number.isFinite(m) && b && I.length > m);
4041
- if (D && b) {
4042
- const T = I.slice(0, m), _ = I.slice(m);
4043
- b.textContent = T;
4044
- const H = document.createTextNode(_);
4045
- (P = l.parentNode) == null || P.insertBefore(H, l.nextSibling);
4177
+ const h = d.length > c, p = h ? this.splitCollapsedBoldText(l, c, d) : null, m = l.getAttribute(S.PREV_LENGTH), f = m ? Number(m) : NaN, y = l.previousSibling, b = (y == null ? void 0 : y.nodeType) === Node.TEXT_NODE ? y : null, B = (D = b == null ? void 0 : b.textContent) != null ? D : "", I = !!(m && Number.isFinite(f) && b && B.length > f);
4178
+ if (I && b) {
4179
+ const W = B.slice(0, f), $ = B.slice(f);
4180
+ b.textContent = W;
4181
+ const Z = document.createTextNode($);
4182
+ (M = l.parentNode) == null || M.insertBefore(Z, l.nextSibling);
4046
4183
  }
4047
- if (D && l.removeAttribute(S.PREV_LENGTH), t != null && t.isCollapsed && u && vt(t.focusNode, l)) {
4048
- const T = document.createRange(), _ = u.textContent.length;
4049
- T.setStart(u, _), T.collapse(!0), t.removeAllRanges(), t.addRange(T);
4184
+ if (I && l.removeAttribute(S.PREV_LENGTH), t != null && t.isCollapsed && p && wt(t.focusNode, l)) {
4185
+ const W = document.createRange(), $ = p.textContent.length;
4186
+ W.setStart(p, $), W.collapse(!0), t.removeAllRanges(), t.addRange(W);
4050
4187
  }
4051
4188
  h && l.removeAttribute(S.COLLAPSED_LENGTH);
4052
4189
  });
@@ -4106,7 +4243,7 @@ const z = (i) => {
4106
4243
  const e = t.getRangeAt(0);
4107
4244
  if (!e.collapsed)
4108
4245
  return;
4109
- const n = M(e.startContainer);
4246
+ const n = N(e.startContainer);
4110
4247
  (n == null ? void 0 : n.getAttribute(S.COLLAPSED_ACTIVE)) !== "true" && (this.moveCaretFromElementContainer(t, e) || this.moveCaretFromTextContainer(t, e));
4111
4248
  }
4112
4249
  /**
@@ -4165,7 +4302,7 @@ const z = (i) => {
4165
4302
  this.setCaret(t, n, o.length);
4166
4303
  return;
4167
4304
  }
4168
- const l = M(n);
4305
+ const l = N(n);
4169
4306
  if (!l || e.startOffset !== n.textContent.length)
4170
4307
  return;
4171
4308
  const a = this.ensureFollowingTextNode(l, l.nextSibling);
@@ -4211,22 +4348,22 @@ const z = (i) => {
4211
4348
  return e.tagName === "STRONG" || e.tagName === "B";
4212
4349
  }
4213
4350
  };
4214
- R.instance = null;
4215
- let A = R;
4216
- const oo = {
4351
+ L.instance = null;
4352
+ let A = L;
4353
+ const mo = {
4217
4354
  convertLegacyTags: !0,
4218
4355
  normalizeWhitespace: !0,
4219
4356
  removeEmpty: !0,
4220
4357
  mergeAdjacent: !0,
4221
4358
  preserveNode: null
4222
4359
  };
4223
- class x {
4360
+ class R {
4224
4361
  /**
4225
4362
  * Create a new normalization pass with specified options
4226
4363
  * @param options - Configuration for the normalization pass
4227
4364
  */
4228
4365
  constructor(t) {
4229
- this.options = L(L({}, oo), t);
4366
+ this.options = x(x({}, mo), t);
4230
4367
  }
4231
4368
  /**
4232
4369
  * Run normalization on a scoped element
@@ -4244,10 +4381,10 @@ class x {
4244
4381
  * @param options - Optional normalization configuration
4245
4382
  */
4246
4383
  static normalizeAroundSelection(t, e) {
4247
- const n = x.findScopeFromSelection(t);
4384
+ const n = R.findScopeFromSelection(t);
4248
4385
  if (!n)
4249
4386
  return;
4250
- new x(e).run(n);
4387
+ new R(e).run(n);
4251
4388
  }
4252
4389
  /**
4253
4390
  * Phase 1: Traverse the scope and normalize text nodes while collecting elements
@@ -4292,7 +4429,7 @@ class x {
4292
4429
  processCollectedElements(t, e) {
4293
4430
  this.options.convertLegacyTags && t.forEach((n) => {
4294
4431
  if (n.isConnected) {
4295
- const s = G(n);
4432
+ const s = _(n);
4296
4433
  e.push(s);
4297
4434
  }
4298
4435
  }), e.forEach((n) => {
@@ -4322,7 +4459,7 @@ class x {
4322
4459
  * @returns true if the element is empty and doesn't contain the preserved node
4323
4460
  */
4324
4461
  isEmptyAndSafe(t) {
4325
- return !(t.textContent.length === 0) || A.getInstance().isActivePlaceholder(t) ? !1 : !(this.options.preserveNode && vt(this.options.preserveNode, t));
4462
+ return !(t.textContent.length === 0) || A.getInstance().isActivePlaceholder(t) ? !1 : !(this.options.preserveNode && wt(this.options.preserveNode, t));
4326
4463
  }
4327
4464
  /**
4328
4465
  * Merge a <strong> element with adjacent <strong> siblings
@@ -4330,12 +4467,12 @@ class x {
4330
4467
  */
4331
4468
  mergeWithAdjacent(t) {
4332
4469
  const e = t.previousSibling;
4333
- if (e && ct(e)) {
4470
+ if (e && ht(e)) {
4334
4471
  this.mergeStrongNodes(e, t);
4335
4472
  return;
4336
4473
  }
4337
4474
  const n = t.nextSibling;
4338
- n && ct(n) && this.mergeStrongNodes(t, n);
4475
+ n && ht(n) && this.mergeStrongNodes(t, n);
4339
4476
  }
4340
4477
  /**
4341
4478
  * Merge two <strong> elements by moving children from right to left
@@ -4343,7 +4480,7 @@ class x {
4343
4480
  * @param right - The right strong element to merge from
4344
4481
  */
4345
4482
  mergeStrongNodes(t, e) {
4346
- const n = G(t), s = G(e);
4483
+ const n = _(t), s = _(e);
4347
4484
  for (; s.firstChild; )
4348
4485
  n.appendChild(s.firstChild);
4349
4486
  s.remove();
@@ -4361,11 +4498,11 @@ class x {
4361
4498
  const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
4362
4499
  if (!n)
4363
4500
  return null;
4364
- const s = (l = n.closest('[data-blok-component="paragraph"]')) != null ? l : n.closest(O(E.elementContent));
4365
- return s || n.closest(O(E.editor));
4501
+ const s = (l = n.closest('[data-blok-component="paragraph"]')) != null ? l : n.closest(H(E.elementContent));
4502
+ return s || n.closest(H(E.editor));
4366
4503
  }
4367
4504
  }
4368
- const k = class k {
4505
+ const T = class T {
4369
4506
  constructor() {
4370
4507
  this.handlers = /* @__PURE__ */ new Map(), this.listenersRegistered = !1, this.handleSelectionChange = () => {
4371
4508
  const t = this.getSelection();
@@ -4398,13 +4535,13 @@ const k = class k {
4398
4535
  * Get the singleton instance
4399
4536
  */
4400
4537
  static getInstance() {
4401
- return k.instance || (k.instance = new k()), k.instance;
4538
+ return T.instance || (T.instance = new T()), T.instance;
4402
4539
  }
4403
4540
  /**
4404
4541
  * Reset the singleton instance (for testing)
4405
4542
  */
4406
4543
  static reset() {
4407
- k.instance && (k.instance.removeListeners(), k.instance.handlers.clear()), k.instance = null;
4544
+ T.instance && (T.instance.removeListeners(), T.instance.handlers.clear()), T.instance = null;
4408
4545
  }
4409
4546
  /**
4410
4547
  * Register a handler for an inline tool
@@ -4456,9 +4593,9 @@ const k = class k {
4456
4593
  return !(e.meta && !o || e.ctrl && !t.ctrlKey);
4457
4594
  }
4458
4595
  };
4459
- k.instance = null;
4460
- let St = k;
4461
- const io = (i, t) => {
4596
+ T.instance = null;
4597
+ let At = T;
4598
+ const Co = (i, t) => {
4462
4599
  try {
4463
4600
  return i.intersectsNode(t);
4464
4601
  } catch (e) {
@@ -4471,21 +4608,21 @@ const io = (i, t) => {
4471
4608
  i.commonAncestorContainer,
4472
4609
  NodeFilter.SHOW_TEXT,
4473
4610
  {
4474
- acceptNode: (t) => io(i, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
4611
+ acceptNode: (t) => Co(i, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
4475
4612
  }
4476
- ), Z = (i, t) => i ? i.nodeType === Node.ELEMENT_NODE && t(i) ? i : Z(i.parentNode, t) : null, Se = (i, t) => Z(i, t) !== null, we = (i, t, e = {}) => {
4613
+ ), Y = (i, t) => i ? i.nodeType === Node.ELEMENT_NODE && t(i) ? i : Y(i.parentNode, t) : null, Se = (i, t) => Y(i, t) !== null, we = (i, t, e = {}) => {
4477
4614
  if (i.collapsed)
4478
- return Z(i.startContainer, t) !== null;
4615
+ return Y(i.startContainer, t) !== null;
4479
4616
  const n = ve(i), s = [];
4480
4617
  for (; n.nextNode(); ) {
4481
4618
  const o = n.currentNode, r = o.textContent;
4482
4619
  e.ignoreWhitespace && r.trim().length === 0 || r.length !== 0 && s.push(o);
4483
4620
  }
4484
- return s.length === 0 ? Z(i.startContainer, t) !== null : s.every((o) => Se(o, t));
4621
+ return s.length === 0 ? Y(i.startContainer, t) !== null : s.every((o) => Se(o, t));
4485
4622
  }, Ae = (i, t) => {
4486
4623
  const e = /* @__PURE__ */ new Set(), n = ve(i);
4487
4624
  for (; n.nextNode(); ) {
4488
- const s = Z(n.currentNode, t);
4625
+ const s = Y(n.currentNode, t);
4489
4626
  s && e.add(s);
4490
4627
  }
4491
4628
  return Array.from(e);
@@ -4513,7 +4650,7 @@ const io = (i, t) => {
4513
4650
  static initializeGlobalListeners() {
4514
4651
  if (typeof document == "undefined")
4515
4652
  return !1;
4516
- const t = St.getInstance();
4653
+ const t = At.getInstance();
4517
4654
  return t.hasHandler("bold") || (t.register("bold", {
4518
4655
  shortcut: { key: "b", meta: !0 },
4519
4656
  onShortcut: (e, n) => {
@@ -4526,7 +4663,7 @@ const io = (i, t) => {
4526
4663
  onInput: (e, n) => {
4527
4664
  C.refreshSelectionState("input");
4528
4665
  },
4529
- onBeforeInput: (e) => e.inputType !== "formatBold" ? !1 : (x.normalizeAroundSelection(window.getSelection()), !0),
4666
+ onBeforeInput: (e) => e.inputType !== "formatBold" ? !1 : (R.normalizeAroundSelection(window.getSelection()), !0),
4530
4667
  isRelevant: (e) => C.isSelectionInsideBlok(e)
4531
4668
  }), C.guardKeydownListenerRegistered || (document.addEventListener("keydown", (e) => {
4532
4669
  A.getInstance().guardBoundaryKeydown(e);
@@ -4538,7 +4675,7 @@ const io = (i, t) => {
4538
4675
  * @param right - The right strong element to merge from
4539
4676
  */
4540
4677
  static mergeStrongNodes(t, e) {
4541
- const n = G(t), s = G(e);
4678
+ const n = _(t), s = _(e);
4542
4679
  for (; s.firstChild; )
4543
4680
  n.appendChild(s.firstChild);
4544
4681
  return s.remove(), n;
@@ -4548,7 +4685,7 @@ const io = (i, t) => {
4548
4685
  */
4549
4686
  render() {
4550
4687
  return {
4551
- icon: je,
4688
+ icon: Xe,
4552
4689
  name: "bold",
4553
4690
  onActivate: () => {
4554
4691
  this.toggleBold();
@@ -4592,11 +4729,11 @@ const io = (i, t) => {
4592
4729
  s && n && (s.removeAllRanges(), s.addRange(n));
4593
4730
  const o = this.findBoldElementFromRangeOrSelection(n, s);
4594
4731
  if (!o) {
4595
- x.normalizeAroundSelection(s), this.notifySelectionChange();
4732
+ R.normalizeAroundSelection(s), this.notifySelectionChange();
4596
4733
  return;
4597
4734
  }
4598
4735
  const r = this.mergeAdjacentBold(o);
4599
- this.selectElementContents(r), x.normalizeAroundSelection(s), this.notifySelectionChange();
4736
+ this.selectElementContents(r), R.normalizeAroundSelection(s), this.notifySelectionChange();
4600
4737
  }
4601
4738
  /**
4602
4739
  * Remove bold tags (<strong>) while preserving content
@@ -4610,7 +4747,7 @@ const io = (i, t) => {
4610
4747
  s.setAttribute("data-blok-bold-marker", `unwrap-${C.markerSequence++}`), s.appendChild(o), this.removeNestedBold(s), t.insertNode(s);
4611
4748
  const r = document.createRange();
4612
4749
  for (r.selectNodeContents(s), n.removeAllRanges(), n.addRange(r); ; ) {
4613
- const d = M(s);
4750
+ const d = N(s);
4614
4751
  if (!d)
4615
4752
  break;
4616
4753
  this.moveMarkerOutOfBold(s, d);
@@ -4619,7 +4756,7 @@ const io = (i, t) => {
4619
4756
  this.unwrapElement(s), (l && a ? (() => {
4620
4757
  const d = document.createRange();
4621
4758
  return d.setStartBefore(l), d.setEndAfter(a), n.removeAllRanges(), n.addRange(d), d;
4622
- })() : void 0) || n.removeAllRanges(), x.normalizeAroundSelection(n), e.forEach((d) => {
4759
+ })() : void 0) || n.removeAllRanges(), R.normalizeAroundSelection(n), e.forEach((d) => {
4623
4760
  be(d) && d.remove();
4624
4761
  }), this.notifySelectionChange();
4625
4762
  }
@@ -4685,7 +4822,7 @@ const io = (i, t) => {
4685
4822
  * @param options.ignoreWhitespace - Whether to ignore whitespace-only text nodes
4686
4823
  */
4687
4824
  isRangeBold(t, e) {
4688
- return we(t, z, e);
4825
+ return we(t, G, e);
4689
4826
  }
4690
4827
  /**
4691
4828
  * Remove nested bold tags from a root node
@@ -4717,20 +4854,20 @@ const io = (i, t) => {
4717
4854
  */
4718
4855
  findBoldElementFromRangeOrSelection(t, e) {
4719
4856
  if (!t)
4720
- return e ? M(e.focusNode) : null;
4721
- const n = M(t.startContainer);
4857
+ return e ? N(e.focusNode) : null;
4858
+ const n = N(t.startContainer);
4722
4859
  if (n)
4723
4860
  return n;
4724
- const s = M(t.commonAncestorContainer);
4725
- return s || (t.startContainer.nodeType === Node.ELEMENT_NODE && z(t.startContainer) ? t.startContainer : null);
4861
+ const s = N(t.commonAncestorContainer);
4862
+ return s || (t.startContainer.nodeType === Node.ELEMENT_NODE && G(t.startContainer) ? t.startContainer : null);
4726
4863
  }
4727
4864
  /**
4728
4865
  * Merge adjacent bold elements into a single element
4729
4866
  * @param element - The bold element to merge with adjacent elements
4730
4867
  */
4731
4868
  mergeAdjacentBold(t) {
4732
- const e = G(t), n = e.previousSibling, s = n && n.nodeType === Node.ELEMENT_NODE && z(n) ? C.mergeStrongNodes(n, e) : e, o = s.nextSibling;
4733
- return o && o.nodeType === Node.ELEMENT_NODE && z(o) ? C.mergeStrongNodes(s, o) : s;
4869
+ const e = _(t), n = e.previousSibling, s = n && n.nodeType === Node.ELEMENT_NODE && G(n) ? C.mergeStrongNodes(n, e) : e, o = s.nextSibling;
4870
+ return o && o.nodeType === Node.ELEMENT_NODE && G(o) ? C.mergeStrongNodes(s, o) : s;
4734
4871
  }
4735
4872
  /**
4736
4873
  * Toggle bold formatting for a collapsed selection (caret position)
@@ -4740,13 +4877,13 @@ const io = (i, t) => {
4740
4877
  const t = window.getSelection();
4741
4878
  if (!t || t.rangeCount === 0)
4742
4879
  return;
4743
- const e = t.getRangeAt(0), n = M(e.startContainer), s = (() => {
4880
+ const e = t.getRangeAt(0), n = N(e.startContainer), s = (() => {
4744
4881
  if (n && n.getAttribute(A.ATTR.COLLAPSED_ACTIVE) !== "true")
4745
4882
  return A.getInstance().exit(t, n);
4746
4883
  const o = n != null ? n : C.getBoundaryBold(e);
4747
4884
  return o ? A.getInstance().exit(t, o) : this.startCollapsedBold(e);
4748
4885
  })();
4749
- document.dispatchEvent(new Event("selectionchange")), s && (t.removeAllRanges(), t.addRange(s)), x.normalizeAroundSelection(t), this.notifySelectionChange();
4886
+ document.dispatchEvent(new Event("selectionchange")), s && (t.removeAllRanges(), t.addRange(s)), R.normalizeAroundSelection(t), this.notifySelectionChange();
4750
4887
  }
4751
4888
  /**
4752
4889
  * Insert a bold wrapper at the caret so newly typed text becomes bold
@@ -4754,7 +4891,7 @@ const io = (i, t) => {
4754
4891
  */
4755
4892
  startCollapsedBold(t) {
4756
4893
  const n = A.getInstance().enter(t, (o) => this.mergeAdjacentBold(o)), s = window.getSelection();
4757
- return x.normalizeAroundSelection(s), s && n && (s.removeAllRanges(), s.addRange(n)), this.notifySelectionChange(), n;
4894
+ return R.normalizeAroundSelection(s), s && n && (s.removeAllRanges(), s.addRange(n)), this.notifySelectionChange(), n;
4758
4895
  }
4759
4896
  /**
4760
4897
  * Notify listeners that the selection state has changed
@@ -4769,7 +4906,7 @@ const io = (i, t) => {
4769
4906
  const t = window.getSelection();
4770
4907
  if (!t)
4771
4908
  return;
4772
- const e = t.anchorNode, n = (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE ? e : e == null ? void 0 : e.parentElement, s = n == null ? void 0 : n.closest(O(E.editor));
4909
+ const e = t.anchorNode, n = (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE ? e : e == null ? void 0 : e.parentElement, s = n == null ? void 0 : n.closest(H(E.editor));
4773
4910
  if (!s)
4774
4911
  return;
4775
4912
  const o = s.querySelector("[data-blok-testid=inline-toolbar]");
@@ -4786,7 +4923,7 @@ const io = (i, t) => {
4786
4923
  */
4787
4924
  static refreshSelectionState(t) {
4788
4925
  const e = window.getSelection();
4789
- A.getInstance().enforceLengths(e), A.getInstance().maintain(), A.getInstance().synchronize(e), x.normalizeAroundSelection(e, { normalizeWhitespace: !1 }), t === "input" && e && A.getInstance().moveCaretAfterBoundaryBold(e);
4926
+ A.getInstance().enforceLengths(e), A.getInstance().maintain(), A.getInstance().synchronize(e), R.normalizeAroundSelection(e, { normalizeWhitespace: !1 }), t === "input" && e && A.getInstance().moveCaretAfterBoundaryBold(e);
4790
4927
  }
4791
4928
  /**
4792
4929
  * Ensure mutation observer is registered to convert legacy <b> tags
@@ -4799,7 +4936,7 @@ const io = (i, t) => {
4799
4936
  C.isProcessingMutation = !0;
4800
4937
  try {
4801
4938
  const n = (s) => {
4802
- s && new x({ mergeAdjacent: !1, removeEmpty: !1, normalizeWhitespace: !1 }).run(s);
4939
+ s && new R({ mergeAdjacent: !1, removeEmpty: !1, normalizeWhitespace: !1 }).run(s);
4803
4940
  };
4804
4941
  e.forEach((s) => {
4805
4942
  s.addedNodes.forEach((o) => {
@@ -4824,7 +4961,7 @@ const io = (i, t) => {
4824
4961
  */
4825
4962
  static findBlokScopeFromNode(t) {
4826
4963
  const e = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement;
4827
- return !e || typeof e.closest != "function" ? null : e.closest(`${O(E.interface)}, ${O(E.editor)}`);
4964
+ return !e || typeof e.closest != "function" ? null : e.closest(`${H(E.interface)}, ${H(E.editor)}`);
4828
4965
  }
4829
4966
  /**
4830
4967
  * Get a bold element at the boundary of a collapsed range
@@ -4842,11 +4979,11 @@ const io = (i, t) => {
4842
4979
  static getBoundaryBoldForText(t, e) {
4843
4980
  const n = e.textContent.length;
4844
4981
  if (t.startOffset === n)
4845
- return M(e);
4982
+ return N(e);
4846
4983
  if (t.startOffset !== 0)
4847
4984
  return null;
4848
4985
  const s = e.previousSibling;
4849
- return ct(s) ? s : null;
4986
+ return ht(s) ? s : null;
4850
4987
  }
4851
4988
  /**
4852
4989
  * Get boundary bold when caret container is an element
@@ -4857,7 +4994,7 @@ const io = (i, t) => {
4857
4994
  if (t.startOffset <= 0)
4858
4995
  return null;
4859
4996
  const n = e.childNodes[t.startOffset - 1];
4860
- return ct(n) ? n : null;
4997
+ return ht(n) ? n : null;
4861
4998
  }
4862
4999
  /**
4863
5000
  * Check if a selection is inside the blok
@@ -4868,7 +5005,7 @@ const io = (i, t) => {
4868
5005
  if (!e)
4869
5006
  return !1;
4870
5007
  const n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
4871
- return !!(n != null && n.closest(O(E.editor)));
5008
+ return !!(n != null && n.closest(H(E.editor)));
4872
5009
  }
4873
5010
  /**
4874
5011
  * Get HTML content of a range with bold tags removed
@@ -4893,15 +5030,15 @@ const io = (i, t) => {
4893
5030
  * @param range - The range to search for bold ancestors
4894
5031
  */
4895
5032
  collectBoldAncestors(t) {
4896
- return Ae(t, z);
5033
+ return Ae(t, G);
4897
5034
  }
4898
5035
  };
4899
5036
  C.isInline = !0, C.title = "Bold", C.titleKey = "bold", C.markerSequence = 0, C.isProcessingMutation = !1, C.instances = /* @__PURE__ */ new Set(), C.guardKeydownListenerRegistered = !1, C.shortcut = "CMD+B";
4900
- let Zt = C;
4901
- const rt = (i) => {
5037
+ let Yt = C;
5038
+ const at = (i) => {
4902
5039
  const t = i.tagName;
4903
5040
  return t === "I" || t === "EM";
4904
- }, j = class j {
5041
+ }, U = class U {
4905
5042
  /**
4906
5043
  * Sanitizer Rule
4907
5044
  * Leave <i> and <em> tags
@@ -4918,7 +5055,7 @@ const rt = (i) => {
4918
5055
  */
4919
5056
  render() {
4920
5057
  return {
4921
- icon: Xe,
5058
+ icon: Ye,
4922
5059
  name: "italic",
4923
5060
  onActivate: () => {
4924
5061
  this.toggleItalic();
@@ -4977,7 +5114,7 @@ const rt = (i) => {
4977
5114
  * @param options - Options for checking italic status
4978
5115
  */
4979
5116
  isRangeItalic(t, e) {
4980
- return we(t, rt, e);
5117
+ return we(t, at, e);
4981
5118
  }
4982
5119
  /**
4983
5120
  * Wrap selection with <i> tag
@@ -5017,21 +5154,21 @@ const rt = (i) => {
5017
5154
  * @param node - The node to check
5018
5155
  */
5019
5156
  hasItalicParent(t) {
5020
- return Se(t, rt);
5157
+ return Se(t, at);
5021
5158
  }
5022
5159
  /**
5023
5160
  * Find an italic element in the parent chain
5024
5161
  * @param node - The node to start searching from
5025
5162
  */
5026
5163
  findItalicElement(t) {
5027
- return Z(t, rt);
5164
+ return Y(t, at);
5028
5165
  }
5029
5166
  /**
5030
5167
  * Collect all italic ancestor elements within a range
5031
5168
  * @param range - The range to search for italic ancestors
5032
5169
  */
5033
5170
  collectItalicAncestors(t) {
5034
- return Ae(t, rt);
5171
+ return Ae(t, at);
5035
5172
  }
5036
5173
  /**
5037
5174
  * Get HTML content of a range with italic tags removed
@@ -5118,9 +5255,9 @@ const rt = (i) => {
5118
5255
  n.insertBefore(l, e.nextSibling), n.insertBefore(t, l);
5119
5256
  }
5120
5257
  };
5121
- j.isInline = !0, j.title = "Italic", j.titleKey = "italic", j.shortcut = "CMD+I";
5122
- let Jt = j;
5123
- const X = class X {
5258
+ U.isInline = !0, U.title = "Italic", U.titleKey = "italic", U.shortcut = "CMD+I";
5259
+ let Zt = U;
5260
+ const K = class K {
5124
5261
  /**
5125
5262
  * @param api - Blok API
5126
5263
  */
@@ -5155,7 +5292,7 @@ const X = class X {
5155
5292
  */
5156
5293
  render() {
5157
5294
  return {
5158
- icon: Ye,
5295
+ icon: Ze,
5159
5296
  name: "link",
5160
5297
  isActive: () => !!this.selection.findParentTag("A"),
5161
5298
  children: {
@@ -5163,7 +5300,7 @@ const X = class X {
5163
5300
  width: "200px",
5164
5301
  items: [
5165
5302
  {
5166
- type: F.Html,
5303
+ type: q.Html,
5167
5304
  // Input is created in constructor, so it's always available here
5168
5305
  element: this.nodes.input
5169
5306
  }
@@ -5214,7 +5351,7 @@ const X = class X {
5214
5351
  */
5215
5352
  getButtonElement() {
5216
5353
  const t = document.querySelector(
5217
- `${O(E.interface, Je)} [data-blok-item-name="link"]`
5354
+ `${H(E.interface, Qe)} [data-blok-item-name="link"]`
5218
5355
  );
5219
5356
  return t && t !== this.nodes.button && (t.addEventListener("click", this.handleButtonClick, !0), this.nodes.button = t), t;
5220
5357
  }
@@ -5271,7 +5408,7 @@ const X = class X {
5271
5408
  this.notifier.show({
5272
5409
  message: this.i18n.t("tools.link.invalidLink"),
5273
5410
  style: "error"
5274
- }), Ze("Incorrect Link pasted", "warn", e);
5411
+ }), Je("Incorrect Link pasted", "warn", e);
5275
5412
  return;
5276
5413
  }
5277
5414
  const n = this.prepareLink(e);
@@ -5348,27 +5485,27 @@ const X = class X {
5348
5485
  t && t.setAttribute(e, n ? "true" : "false");
5349
5486
  }
5350
5487
  };
5351
- X.isInline = !0, X.title = "Link", X.titleKey = "link", X.shortcut = "CMD+K";
5352
- let Qt = X;
5353
- const ho = {
5488
+ K.isInline = !0, K.title = "Link", K.titleKey = "link", K.shortcut = "CMD+K";
5489
+ let Jt = K;
5490
+ const wo = {
5354
5491
  paragraph: { preserveBlank: !0 },
5355
5492
  header: {},
5356
5493
  list: {},
5357
5494
  table: {}
5358
- }, uo = {
5495
+ }, Ao = {
5359
5496
  bold: {},
5360
5497
  italic: {},
5361
5498
  link: {}
5362
5499
  };
5363
5500
  export {
5364
- Zt as Bold,
5365
- fo as Convert,
5366
- Bt as Header,
5367
- Jt as Italic,
5368
- Qt as Link,
5369
- ao as List,
5370
- Rt as Paragraph,
5371
- co as Table,
5372
- ho as defaultBlockTools,
5373
- uo as defaultInlineTools
5501
+ Yt as Bold,
5502
+ xo as Convert,
5503
+ It as Header,
5504
+ Zt as Italic,
5505
+ Jt as Link,
5506
+ vo as List,
5507
+ Bt as Paragraph,
5508
+ So as Table,
5509
+ wo as defaultBlockTools,
5510
+ Ao as defaultInlineTools
5374
5511
  };