@jackuait/blok 0.4.1 → 0.4.3-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/README.md +136 -17
  2. package/codemod/README.md +45 -7
  3. package/codemod/migrate-editorjs-to-blok.js +951 -92
  4. package/codemod/test.js +780 -77
  5. package/dist/blok.mjs +5 -2
  6. package/dist/chunks/blok-8ptWuVZC.mjs +12838 -0
  7. package/dist/chunks/i18next-CugVlwWp.mjs +1292 -0
  8. package/dist/chunks/i18next-loader-bLawSYRV.mjs +43 -0
  9. package/dist/{index-CBkApZKo.mjs → chunks/index-5nYtWZD2.mjs} +2 -2
  10. package/dist/chunks/inline-tool-convert-CvMDAIzb.mjs +1988 -0
  11. package/dist/chunks/messages-2434tVOK.mjs +47 -0
  12. package/dist/chunks/messages-3DcCwXMF.mjs +47 -0
  13. package/dist/chunks/messages-4kMwVAKY.mjs +47 -0
  14. package/dist/chunks/messages-57uL5htT.mjs +47 -0
  15. package/dist/chunks/messages-76-iJV9Q.mjs +47 -0
  16. package/dist/chunks/messages-8p86Eyf2.mjs +47 -0
  17. package/dist/chunks/messages-BBX0p0Pi.mjs +47 -0
  18. package/dist/chunks/messages-BCm2eudQ.mjs +47 -0
  19. package/dist/chunks/messages-BFiUomgG.mjs +47 -0
  20. package/dist/chunks/messages-BIPNHHAV.mjs +47 -0
  21. package/dist/chunks/messages-BUlwu9mo.mjs +47 -0
  22. package/dist/chunks/messages-BX-DPa-z.mjs +47 -0
  23. package/dist/chunks/messages-BextV3Qh.mjs +47 -0
  24. package/dist/chunks/messages-BiPSFlUG.mjs +47 -0
  25. package/dist/chunks/messages-BiXe9G-O.mjs +47 -0
  26. package/dist/chunks/messages-Bl5z_Igo.mjs +47 -0
  27. package/dist/chunks/messages-BnsE97ku.mjs +47 -0
  28. package/dist/chunks/messages-BoO8gsVD.mjs +47 -0
  29. package/dist/chunks/messages-BqWaOGMn.mjs +47 -0
  30. package/dist/chunks/messages-BqkL2_Ro.mjs +47 -0
  31. package/dist/chunks/messages-BvCkXKX-.mjs +47 -0
  32. package/dist/chunks/messages-C6tbPLoj.mjs +47 -0
  33. package/dist/chunks/messages-CA6T3-gQ.mjs +47 -0
  34. package/dist/chunks/messages-CFFPFdWP.mjs +47 -0
  35. package/dist/chunks/messages-CFrKE-TN.mjs +47 -0
  36. package/dist/chunks/messages-CHz8VlG-.mjs +47 -0
  37. package/dist/chunks/messages-CLixzySl.mjs +47 -0
  38. package/dist/chunks/messages-CV7OM_qk.mjs +47 -0
  39. package/dist/chunks/messages-CXHt3eCC.mjs +47 -0
  40. package/dist/chunks/messages-CbmsBrB0.mjs +47 -0
  41. package/dist/chunks/messages-Ceo1KtFx.mjs +47 -0
  42. package/dist/chunks/messages-Cm0LJLtB.mjs +47 -0
  43. package/dist/chunks/messages-CmymP_Ar.mjs +47 -0
  44. package/dist/chunks/messages-D0ohMB5H.mjs +47 -0
  45. package/dist/chunks/messages-D3GrDwXh.mjs +47 -0
  46. package/dist/chunks/messages-D3vTzIpL.mjs +47 -0
  47. package/dist/chunks/messages-D5WeksbV.mjs +47 -0
  48. package/dist/chunks/messages-DGaab4EP.mjs +47 -0
  49. package/dist/chunks/messages-DKha57ZU.mjs +47 -0
  50. package/dist/chunks/messages-DOaujgMW.mjs +47 -0
  51. package/dist/chunks/messages-DVbPLd_0.mjs +47 -0
  52. package/dist/chunks/messages-D_FCyfW6.mjs +47 -0
  53. package/dist/chunks/messages-Dd5iZN3c.mjs +47 -0
  54. package/dist/chunks/messages-DehM7135.mjs +47 -0
  55. package/dist/chunks/messages-Dg1OHftD.mjs +47 -0
  56. package/dist/chunks/messages-Di6Flq-b.mjs +47 -0
  57. package/dist/chunks/messages-Dqhhex6e.mjs +47 -0
  58. package/dist/chunks/messages-DueVe0F1.mjs +47 -0
  59. package/dist/chunks/messages-Dx3eFwI0.mjs +47 -0
  60. package/dist/chunks/messages-FOtiUoKl.mjs +47 -0
  61. package/dist/chunks/messages-FTOZNhRD.mjs +47 -0
  62. package/dist/chunks/messages-IQxGfQIV.mjs +47 -0
  63. package/dist/chunks/messages-JF2fzCkK.mjs +47 -0
  64. package/dist/chunks/messages-MOGl7I5v.mjs +47 -0
  65. package/dist/chunks/messages-QgYhPL-3.mjs +47 -0
  66. package/dist/chunks/messages-WYWIbQwo.mjs +47 -0
  67. package/dist/chunks/messages-a6A_LgDv.mjs +47 -0
  68. package/dist/chunks/messages-bSf31LJi.mjs +47 -0
  69. package/dist/chunks/messages-diGozhTn.mjs +47 -0
  70. package/dist/chunks/messages-er-kd-VO.mjs +47 -0
  71. package/dist/chunks/messages-ez3w5NBn.mjs +47 -0
  72. package/dist/chunks/messages-f3uXjegd.mjs +47 -0
  73. package/dist/chunks/messages-ohwI1UGv.mjs +47 -0
  74. package/dist/chunks/messages-p9BZJaFV.mjs +47 -0
  75. package/dist/chunks/messages-qIQ4L4rw.mjs +47 -0
  76. package/dist/chunks/messages-qWkXPggi.mjs +47 -0
  77. package/dist/chunks/messages-w5foGze_.mjs +47 -0
  78. package/dist/full.mjs +50 -0
  79. package/dist/locales.mjs +227 -0
  80. package/dist/messages-2434tVOK.mjs +47 -0
  81. package/dist/messages-3DcCwXMF.mjs +47 -0
  82. package/dist/messages-4kMwVAKY.mjs +47 -0
  83. package/dist/messages-57uL5htT.mjs +47 -0
  84. package/dist/messages-76-iJV9Q.mjs +47 -0
  85. package/dist/messages-8p86Eyf2.mjs +47 -0
  86. package/dist/messages-BBX0p0Pi.mjs +47 -0
  87. package/dist/messages-BCm2eudQ.mjs +47 -0
  88. package/dist/messages-BFiUomgG.mjs +47 -0
  89. package/dist/messages-BIPNHHAV.mjs +47 -0
  90. package/dist/messages-BUlwu9mo.mjs +47 -0
  91. package/dist/messages-BX-DPa-z.mjs +47 -0
  92. package/dist/messages-BextV3Qh.mjs +47 -0
  93. package/dist/messages-BiPSFlUG.mjs +47 -0
  94. package/dist/messages-BiXe9G-O.mjs +47 -0
  95. package/dist/messages-Bl5z_Igo.mjs +47 -0
  96. package/dist/messages-BnsE97ku.mjs +47 -0
  97. package/dist/messages-BoO8gsVD.mjs +47 -0
  98. package/dist/messages-BqWaOGMn.mjs +47 -0
  99. package/dist/messages-BqkL2_Ro.mjs +47 -0
  100. package/dist/messages-BvCkXKX-.mjs +47 -0
  101. package/dist/messages-C6tbPLoj.mjs +47 -0
  102. package/dist/messages-CA6T3-gQ.mjs +47 -0
  103. package/dist/messages-CFFPFdWP.mjs +47 -0
  104. package/dist/messages-CFrKE-TN.mjs +47 -0
  105. package/dist/messages-CHz8VlG-.mjs +47 -0
  106. package/dist/messages-CLixzySl.mjs +47 -0
  107. package/dist/messages-CV7OM_qk.mjs +47 -0
  108. package/dist/messages-CXHt3eCC.mjs +47 -0
  109. package/dist/messages-CbmsBrB0.mjs +47 -0
  110. package/dist/messages-Ceo1KtFx.mjs +47 -0
  111. package/dist/messages-Cm0LJLtB.mjs +47 -0
  112. package/dist/messages-CmymP_Ar.mjs +47 -0
  113. package/dist/messages-D0ohMB5H.mjs +47 -0
  114. package/dist/messages-D3GrDwXh.mjs +47 -0
  115. package/dist/messages-D3vTzIpL.mjs +47 -0
  116. package/dist/messages-D5WeksbV.mjs +47 -0
  117. package/dist/messages-DGaab4EP.mjs +47 -0
  118. package/dist/messages-DKha57ZU.mjs +47 -0
  119. package/dist/messages-DOaujgMW.mjs +47 -0
  120. package/dist/messages-DVbPLd_0.mjs +47 -0
  121. package/dist/messages-D_FCyfW6.mjs +47 -0
  122. package/dist/messages-Dd5iZN3c.mjs +47 -0
  123. package/dist/messages-DehM7135.mjs +47 -0
  124. package/dist/messages-Dg1OHftD.mjs +47 -0
  125. package/dist/messages-Di6Flq-b.mjs +47 -0
  126. package/dist/messages-Dqhhex6e.mjs +47 -0
  127. package/dist/messages-DueVe0F1.mjs +47 -0
  128. package/dist/messages-Dx3eFwI0.mjs +47 -0
  129. package/dist/messages-FOtiUoKl.mjs +47 -0
  130. package/dist/messages-FTOZNhRD.mjs +47 -0
  131. package/dist/messages-IQxGfQIV.mjs +47 -0
  132. package/dist/messages-JF2fzCkK.mjs +47 -0
  133. package/dist/messages-MOGl7I5v.mjs +47 -0
  134. package/dist/messages-QgYhPL-3.mjs +47 -0
  135. package/dist/messages-WYWIbQwo.mjs +47 -0
  136. package/dist/messages-a6A_LgDv.mjs +47 -0
  137. package/dist/messages-bSf31LJi.mjs +47 -0
  138. package/dist/messages-diGozhTn.mjs +47 -0
  139. package/dist/messages-er-kd-VO.mjs +47 -0
  140. package/dist/messages-ez3w5NBn.mjs +47 -0
  141. package/dist/messages-f3uXjegd.mjs +47 -0
  142. package/dist/messages-ohwI1UGv.mjs +47 -0
  143. package/dist/messages-p9BZJaFV.mjs +47 -0
  144. package/dist/messages-qIQ4L4rw.mjs +47 -0
  145. package/dist/messages-qWkXPggi.mjs +47 -0
  146. package/dist/messages-w5foGze_.mjs +47 -0
  147. package/dist/tools.mjs +3073 -0
  148. package/dist/vendor.LICENSE.txt +59 -156
  149. package/package.json +60 -15
  150. package/src/blok.ts +267 -0
  151. package/src/components/__module.ts +139 -0
  152. package/src/components/block/api.ts +155 -0
  153. package/src/components/block/index.ts +1427 -0
  154. package/src/components/block-tunes/block-tune-delete.ts +51 -0
  155. package/src/components/blocks.ts +338 -0
  156. package/src/components/constants/data-attributes.ts +342 -0
  157. package/src/components/constants.ts +76 -0
  158. package/src/components/core.ts +392 -0
  159. package/src/components/dom.ts +773 -0
  160. package/src/components/domIterator.ts +189 -0
  161. package/src/components/errors/critical.ts +5 -0
  162. package/src/components/events/BlockChanged.ts +16 -0
  163. package/src/components/events/BlockHovered.ts +21 -0
  164. package/src/components/events/BlockSettingsClosed.ts +12 -0
  165. package/src/components/events/BlockSettingsOpened.ts +12 -0
  166. package/src/components/events/BlokMobileLayoutToggled.ts +15 -0
  167. package/src/components/events/FakeCursorAboutToBeToggled.ts +17 -0
  168. package/src/components/events/FakeCursorHaveBeenSet.ts +17 -0
  169. package/src/components/events/HistoryStateChanged.ts +19 -0
  170. package/src/components/events/RedactorDomChanged.ts +14 -0
  171. package/src/components/events/index.ts +46 -0
  172. package/src/components/flipper.ts +481 -0
  173. package/src/components/i18n/i18next-loader.ts +84 -0
  174. package/src/components/i18n/lightweight-i18n.ts +86 -0
  175. package/src/components/i18n/locales/TRANSLATION_GUIDELINES.md +113 -0
  176. package/src/components/i18n/locales/am/messages.json +44 -0
  177. package/src/components/i18n/locales/ar/messages.json +44 -0
  178. package/src/components/i18n/locales/az/messages.json +44 -0
  179. package/src/components/i18n/locales/bg/messages.json +44 -0
  180. package/src/components/i18n/locales/bn/messages.json +44 -0
  181. package/src/components/i18n/locales/bs/messages.json +44 -0
  182. package/src/components/i18n/locales/cs/messages.json +44 -0
  183. package/src/components/i18n/locales/da/messages.json +44 -0
  184. package/src/components/i18n/locales/de/messages.json +44 -0
  185. package/src/components/i18n/locales/dv/messages.json +44 -0
  186. package/src/components/i18n/locales/el/messages.json +44 -0
  187. package/src/components/i18n/locales/en/messages.json +44 -0
  188. package/src/components/i18n/locales/es/messages.json +44 -0
  189. package/src/components/i18n/locales/et/messages.json +44 -0
  190. package/src/components/i18n/locales/fa/messages.json +44 -0
  191. package/src/components/i18n/locales/fi/messages.json +44 -0
  192. package/src/components/i18n/locales/fil/messages.json +44 -0
  193. package/src/components/i18n/locales/fr/messages.json +44 -0
  194. package/src/components/i18n/locales/gu/messages.json +44 -0
  195. package/src/components/i18n/locales/he/messages.json +44 -0
  196. package/src/components/i18n/locales/hi/messages.json +44 -0
  197. package/src/components/i18n/locales/hr/messages.json +44 -0
  198. package/src/components/i18n/locales/hu/messages.json +44 -0
  199. package/src/components/i18n/locales/hy/messages.json +44 -0
  200. package/src/components/i18n/locales/id/messages.json +44 -0
  201. package/src/components/i18n/locales/index.ts +225 -0
  202. package/src/components/i18n/locales/it/messages.json +44 -0
  203. package/src/components/i18n/locales/ja/messages.json +44 -0
  204. package/src/components/i18n/locales/ka/messages.json +44 -0
  205. package/src/components/i18n/locales/km/messages.json +44 -0
  206. package/src/components/i18n/locales/kn/messages.json +44 -0
  207. package/src/components/i18n/locales/ko/messages.json +44 -0
  208. package/src/components/i18n/locales/ku/messages.json +44 -0
  209. package/src/components/i18n/locales/lo/messages.json +44 -0
  210. package/src/components/i18n/locales/lt/messages.json +44 -0
  211. package/src/components/i18n/locales/lv/messages.json +44 -0
  212. package/src/components/i18n/locales/mk/messages.json +44 -0
  213. package/src/components/i18n/locales/ml/messages.json +44 -0
  214. package/src/components/i18n/locales/mn/messages.json +44 -0
  215. package/src/components/i18n/locales/mr/messages.json +44 -0
  216. package/src/components/i18n/locales/ms/messages.json +44 -0
  217. package/src/components/i18n/locales/my/messages.json +44 -0
  218. package/src/components/i18n/locales/ne/messages.json +44 -0
  219. package/src/components/i18n/locales/nl/messages.json +44 -0
  220. package/src/components/i18n/locales/no/messages.json +44 -0
  221. package/src/components/i18n/locales/pa/messages.json +44 -0
  222. package/src/components/i18n/locales/pl/messages.json +44 -0
  223. package/src/components/i18n/locales/ps/messages.json +44 -0
  224. package/src/components/i18n/locales/pt/messages.json +44 -0
  225. package/src/components/i18n/locales/ro/messages.json +44 -0
  226. package/src/components/i18n/locales/ru/messages.json +44 -0
  227. package/src/components/i18n/locales/sd/messages.json +44 -0
  228. package/src/components/i18n/locales/si/messages.json +44 -0
  229. package/src/components/i18n/locales/sk/messages.json +44 -0
  230. package/src/components/i18n/locales/sl/messages.json +44 -0
  231. package/src/components/i18n/locales/sq/messages.json +44 -0
  232. package/src/components/i18n/locales/sr/messages.json +44 -0
  233. package/src/components/i18n/locales/sv/messages.json +44 -0
  234. package/src/components/i18n/locales/sw/messages.json +44 -0
  235. package/src/components/i18n/locales/ta/messages.json +44 -0
  236. package/src/components/i18n/locales/te/messages.json +44 -0
  237. package/src/components/i18n/locales/th/messages.json +44 -0
  238. package/src/components/i18n/locales/tr/messages.json +44 -0
  239. package/src/components/i18n/locales/ug/messages.json +44 -0
  240. package/src/components/i18n/locales/uk/messages.json +44 -0
  241. package/src/components/i18n/locales/ur/messages.json +44 -0
  242. package/src/components/i18n/locales/vi/messages.json +44 -0
  243. package/src/components/i18n/locales/yi/messages.json +44 -0
  244. package/src/components/i18n/locales/zh/messages.json +44 -0
  245. package/src/components/icons/index.ts +242 -0
  246. package/src/components/inline-tools/inline-tool-bold.ts +2213 -0
  247. package/src/components/inline-tools/inline-tool-convert.ts +141 -0
  248. package/src/components/inline-tools/inline-tool-italic.ts +500 -0
  249. package/src/components/inline-tools/inline-tool-link.ts +539 -0
  250. package/src/components/modules/api/blocks.ts +363 -0
  251. package/src/components/modules/api/caret.ts +125 -0
  252. package/src/components/modules/api/events.ts +51 -0
  253. package/src/components/modules/api/history.ts +73 -0
  254. package/src/components/modules/api/i18n.ts +33 -0
  255. package/src/components/modules/api/index.ts +39 -0
  256. package/src/components/modules/api/inlineToolbar.ts +33 -0
  257. package/src/components/modules/api/listeners.ts +56 -0
  258. package/src/components/modules/api/notifier.ts +46 -0
  259. package/src/components/modules/api/readonly.ts +39 -0
  260. package/src/components/modules/api/sanitizer.ts +30 -0
  261. package/src/components/modules/api/saver.ts +52 -0
  262. package/src/components/modules/api/selection.ts +48 -0
  263. package/src/components/modules/api/styles.ts +72 -0
  264. package/src/components/modules/api/toolbar.ts +79 -0
  265. package/src/components/modules/api/tools.ts +16 -0
  266. package/src/components/modules/api/tooltip.ts +67 -0
  267. package/src/components/modules/api/ui.ts +36 -0
  268. package/src/components/modules/blockEvents.ts +1375 -0
  269. package/src/components/modules/blockManager.ts +1348 -0
  270. package/src/components/modules/blockSelection.ts +708 -0
  271. package/src/components/modules/caret.ts +853 -0
  272. package/src/components/modules/crossBlockSelection.ts +329 -0
  273. package/src/components/modules/dragManager.ts +1141 -0
  274. package/src/components/modules/history.ts +1098 -0
  275. package/src/components/modules/i18n.ts +325 -0
  276. package/src/components/modules/index.ts +139 -0
  277. package/src/components/modules/modificationsObserver.ts +147 -0
  278. package/src/components/modules/paste.ts +1092 -0
  279. package/src/components/modules/readonly.ts +136 -0
  280. package/src/components/modules/rectangleSelection.ts +668 -0
  281. package/src/components/modules/renderer.ts +155 -0
  282. package/src/components/modules/saver.ts +283 -0
  283. package/src/components/modules/toolbar/blockSettings.ts +776 -0
  284. package/src/components/modules/toolbar/index.ts +1311 -0
  285. package/src/components/modules/toolbar/inline.ts +956 -0
  286. package/src/components/modules/tools.ts +589 -0
  287. package/src/components/modules/ui.ts +1179 -0
  288. package/src/components/polyfills.ts +113 -0
  289. package/src/components/selection.ts +1189 -0
  290. package/src/components/tools/base.ts +274 -0
  291. package/src/components/tools/block.ts +291 -0
  292. package/src/components/tools/collection.ts +67 -0
  293. package/src/components/tools/factory.ts +85 -0
  294. package/src/components/tools/inline.ts +71 -0
  295. package/src/components/tools/tune.ts +33 -0
  296. package/src/components/ui/toolbox.ts +497 -0
  297. package/src/components/utils/announcer.ts +205 -0
  298. package/src/components/utils/api.ts +20 -0
  299. package/src/components/utils/bem.ts +26 -0
  300. package/src/components/utils/blocks.ts +284 -0
  301. package/src/components/utils/caret.ts +1067 -0
  302. package/src/components/utils/data-model-transform.ts +382 -0
  303. package/src/components/utils/events.ts +117 -0
  304. package/src/components/utils/keyboard.ts +60 -0
  305. package/src/components/utils/listeners.ts +296 -0
  306. package/src/components/utils/mutations.ts +39 -0
  307. package/src/components/utils/notifier/draw.ts +190 -0
  308. package/src/components/utils/notifier/index.ts +66 -0
  309. package/src/components/utils/notifier/types.ts +1 -0
  310. package/src/components/utils/notifier.ts +77 -0
  311. package/src/components/utils/placeholder.ts +140 -0
  312. package/src/components/utils/popover/components/hint/hint.const.ts +10 -0
  313. package/src/components/utils/popover/components/hint/hint.ts +46 -0
  314. package/src/components/utils/popover/components/hint/index.ts +6 -0
  315. package/src/components/utils/popover/components/popover-header/index.ts +2 -0
  316. package/src/components/utils/popover/components/popover-header/popover-header.const.ts +8 -0
  317. package/src/components/utils/popover/components/popover-header/popover-header.ts +80 -0
  318. package/src/components/utils/popover/components/popover-header/popover-header.types.ts +14 -0
  319. package/src/components/utils/popover/components/popover-item/index.ts +13 -0
  320. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.const.ts +50 -0
  321. package/src/components/utils/popover/components/popover-item/popover-item-default/popover-item-default.ts +666 -0
  322. package/src/components/utils/popover/components/popover-item/popover-item-html/popover-item-html.const.ts +14 -0
  323. package/src/components/utils/popover/components/popover-item/popover-item-html/popover-item-html.ts +136 -0
  324. package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.const.ts +20 -0
  325. package/src/components/utils/popover/components/popover-item/popover-item-separator/popover-item-separator.ts +117 -0
  326. package/src/components/utils/popover/components/popover-item/popover-item.ts +187 -0
  327. package/src/components/utils/popover/components/search-input/index.ts +2 -0
  328. package/src/components/utils/popover/components/search-input/search-input.const.ts +8 -0
  329. package/src/components/utils/popover/components/search-input/search-input.ts +181 -0
  330. package/src/components/utils/popover/components/search-input/search-input.types.ts +30 -0
  331. package/src/components/utils/popover/index.ts +13 -0
  332. package/src/components/utils/popover/popover-abstract.ts +448 -0
  333. package/src/components/utils/popover/popover-desktop.ts +643 -0
  334. package/src/components/utils/popover/popover-inline.ts +338 -0
  335. package/src/components/utils/popover/popover-mobile.ts +201 -0
  336. package/src/components/utils/popover/popover.const.ts +81 -0
  337. package/src/components/utils/popover/utils/popover-states-history.ts +72 -0
  338. package/src/components/utils/promise-queue.ts +43 -0
  339. package/src/components/utils/sanitizer.ts +537 -0
  340. package/src/components/utils/scroll-locker.ts +87 -0
  341. package/src/components/utils/shortcut.ts +231 -0
  342. package/src/components/utils/shortcuts.ts +113 -0
  343. package/src/components/utils/tools.ts +105 -0
  344. package/src/components/utils/tooltip.ts +642 -0
  345. package/src/components/utils/tw.ts +241 -0
  346. package/src/components/utils.ts +1081 -0
  347. package/src/env.d.ts +13 -0
  348. package/src/full.ts +69 -0
  349. package/src/locales.ts +51 -0
  350. package/src/stories/Block.stories.ts +498 -0
  351. package/src/stories/EditorModes.stories.ts +505 -0
  352. package/src/stories/Header.stories.ts +137 -0
  353. package/src/stories/InlineToolbar.stories.ts +498 -0
  354. package/src/stories/List.stories.ts +259 -0
  355. package/src/stories/Notifier.stories.ts +340 -0
  356. package/src/stories/Paragraph.stories.ts +112 -0
  357. package/src/stories/Placeholder.stories.ts +319 -0
  358. package/src/stories/Popover.stories.ts +844 -0
  359. package/src/stories/Selection.stories.ts +250 -0
  360. package/src/stories/StubBlock.stories.ts +156 -0
  361. package/src/stories/Toolbar.stories.ts +223 -0
  362. package/src/stories/Toolbox.stories.ts +166 -0
  363. package/src/stories/Tooltip.stories.ts +198 -0
  364. package/src/stories/helpers.ts +463 -0
  365. package/src/styles/main.css +123 -0
  366. package/src/tools/header/index.ts +570 -0
  367. package/src/tools/index.ts +38 -0
  368. package/src/tools/list/index.ts +1803 -0
  369. package/src/tools/paragraph/index.ts +411 -0
  370. package/src/tools/stub/index.ts +107 -0
  371. package/src/types-internal/blok-modules.d.ts +87 -0
  372. package/src/types-internal/html-janitor.d.ts +28 -0
  373. package/src/types-internal/module-config.d.ts +11 -0
  374. package/src/variants/all-locales.ts +155 -0
  375. package/src/variants/blok-maximum.ts +20 -0
  376. package/src/variants/blok-minimum.ts +243 -0
  377. package/types/api/blocks.d.ts +1 -1
  378. package/types/api/i18n.d.ts +5 -3
  379. package/types/api/selection.d.ts +6 -0
  380. package/types/api/styles.d.ts +0 -5
  381. package/types/configs/blok-config.d.ts +21 -0
  382. package/types/configs/i18n-config.d.ts +52 -2
  383. package/types/configs/i18n-dictionary.d.ts +16 -90
  384. package/types/data-attributes.d.ts +169 -0
  385. package/types/data-formats/output-data.d.ts +15 -0
  386. package/types/full.d.ts +80 -0
  387. package/types/index.d.ts +9 -24
  388. package/types/locales.d.ts +59 -0
  389. package/types/tools/adapters/inline-tool-adapter.d.ts +10 -0
  390. package/types/tools/block-tool.d.ts +9 -0
  391. package/types/tools/list.d.ts +25 -18
  392. package/types/tools/tool-settings.d.ts +8 -1
  393. package/types/tools/tool.d.ts +6 -0
  394. package/types/tools-entry.d.ts +49 -0
  395. package/types/utils/popover/popover-item.d.ts +0 -5
  396. package/dist/blok-BwPfU8ro.mjs +0 -21510
  397. package/dist/blok.umd.js +0 -198
package/dist/blok.umd.js DELETED
@@ -1,198 +0,0 @@
1
- (function(Q,$){typeof exports=="object"&&typeof module!="undefined"?module.exports=$():typeof define=="function"&&define.amd?define($):(Q=typeof globalThis!="undefined"?globalThis:Q||self,Q.Blok=$())})(this,(function(){"use strict";var rk=Object.defineProperty,sk=Object.defineProperties;var ik=Object.getOwnPropertyDescriptors;var Bn=Object.getOwnPropertySymbols;var Eh=Object.prototype.hasOwnProperty,Sh=Object.prototype.propertyIsEnumerable;var Ch=(Q,$,pe)=>$ in Q?rk(Q,$,{enumerable:!0,configurable:!0,writable:!0,value:pe}):Q[$]=pe,q=(Q,$)=>{for(var pe in $||($={}))Eh.call($,pe)&&Ch(Q,pe,$[pe]);if(Bn)for(var pe of Bn($))Sh.call($,pe)&&Ch(Q,pe,$[pe]);return Q},Se=(Q,$)=>sk(Q,ik($));var Ah=(Q,$)=>{var pe={};for(var Oe in Q)Eh.call(Q,Oe)&&$.indexOf(Oe)<0&&(pe[Oe]=Q[Oe]);if(Q!=null&&Bn)for(var Oe of Bn(Q))$.indexOf(Oe)<0&&Sh.call(Q,Oe)&&(pe[Oe]=Q[Oe]);return pe};var Ct;var Q=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function $(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var pe,Oe;function Ih(){if(Oe)return pe;Oe=1;function s(){}return pe=Object.assign(s,{default:s,register:s,revert:function(){},__esModule:!0}),pe}Ih(),typeof Element.prototype.scrollIntoViewIfNeeded=="undefined"&&(Element.prototype.scrollIntoViewIfNeeded=function(s){const e=s!=null?s:!0,t=this.parentElement;if(!t)return;const o=window.getComputedStyle(t,null),n=parseInt(o.getPropertyValue("border-top-width")),r=parseInt(o.getPropertyValue("border-left-width")),i=this.offsetTop-t.offsetTop<t.scrollTop,a=this.offsetTop-t.offsetTop+this.clientHeight-n>t.scrollTop+t.clientHeight,l=this.offsetLeft-t.offsetLeft<t.scrollLeft,c=this.offsetLeft-t.offsetLeft+this.clientWidth-r>t.scrollLeft+t.clientWidth,d=i&&!a;(i||a)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-n+this.clientHeight/2),(l||c)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-r+this.clientWidth/2),(i||a||l||c)&&!e&&this.scrollIntoView(d)});const Nh=globalThis.setTimeout.bind(globalThis),Rh=globalThis.clearTimeout.bind(globalThis),To=new Map,Oh=s=>{const e=Number(s);return Number.isFinite(e)&&e>0?e:Date.now()};typeof window.requestIdleCallback=="undefined"&&(window.requestIdleCallback=function(s){const e=Date.now(),t={},o=Nh(()=>{const r=t.value;typeof r=="number"&&To.delete(r),s({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1),n=Oh(o);return t.value=n,To.set(n,o),n}),typeof window.cancelIdleCallback=="undefined"&&(window.cancelIdleCallback=function(s){const e=To.get(s);e!==void 0&&(To.delete(s),Rh(e)),globalThis.clearTimeout(s)});const _h="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Mh=(s=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(s|=0));for(;s--;)e+=_h[t[s]&63];return e};var xn,Aa;function Lh(){if(Aa)return xn;Aa=1;var s="Expected a function";function e(t,o,n){if(typeof t!="function")throw new TypeError(s);return setTimeout(function(){t.apply(void 0,n)},o)}return xn=e,xn}var Cn,Ia;function Na(){if(Ia)return Cn;Ia=1;function s(e){return e}return Cn=s,Cn}var En,Ra;function Dh(){if(Ra)return En;Ra=1;function s(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)}return En=s,En}var Sn,Oa;function Ph(){if(Oa)return Sn;Oa=1;var s=Dh(),e=Math.max;function t(o,n,r){return n=e(n===void 0?o.length-1:n,0),function(){for(var i=arguments,a=-1,l=e(i.length-n,0),c=Array(l);++a<l;)c[a]=i[n+a];a=-1;for(var d=Array(n+1);++a<n;)d[a]=i[a];return d[n]=r(c),s(o,this,d)}}return Sn=t,Sn}var An,_a;function Fh(){if(_a)return An;_a=1;function s(e){return function(){return e}}return An=s,An}var In,Ma;function La(){if(Ma)return In;Ma=1;var s=typeof Q=="object"&&Q&&Q.Object===Object&&Q;return In=s,In}var Nn,Da;function qe(){if(Da)return Nn;Da=1;var s=La(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=s||e||Function("return this")();return Nn=t,Nn}var Rn,Pa;function Bo(){if(Pa)return Rn;Pa=1;var s=qe(),e=s.Symbol;return Rn=e,Rn}var On,Fa;function Hh(){if(Fa)return On;Fa=1;var s=Bo(),e=Object.prototype,t=e.hasOwnProperty,o=e.toString,n=s?s.toStringTag:void 0;function r(i){var a=t.call(i,n),l=i[n];try{i[n]=void 0;var c=!0}catch(u){}var d=o.call(i);return c&&(a?i[n]=l:delete i[n]),d}return On=r,On}var _n,Ha;function qh(){if(Ha)return _n;Ha=1;var s=Object.prototype,e=s.toString;function t(o){return e.call(o)}return _n=t,_n}var Mn,qa;function Ze(){if(qa)return Mn;qa=1;var s=Bo(),e=Hh(),t=qh(),o="[object Null]",n="[object Undefined]",r=s?s.toStringTag:void 0;function i(a){return a==null?a===void 0?n:o:r&&r in Object(a)?e(a):t(a)}return Mn=i,Mn}var Ln,za;function We(){if(za)return Ln;za=1;function s(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Ln=s,Ln}var Dn,ja;function xo(){if(ja)return Dn;ja=1;var s=Ze(),e=We(),t="[object AsyncFunction]",o="[object Function]",n="[object GeneratorFunction]",r="[object Proxy]";function i(a){if(!e(a))return!1;var l=s(a);return l==o||l==n||l==t||l==r}return Dn=i,Dn}var Pn,Ua;function zh(){if(Ua)return Pn;Ua=1;var s=qe(),e=s["__core-js_shared__"];return Pn=e,Pn}var Fn,Ka;function jh(){if(Ka)return Fn;Ka=1;var s=zh(),e=(function(){var o=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""})();function t(o){return!!e&&e in o}return Fn=t,Fn}var Hn,Wa;function Ga(){if(Wa)return Hn;Wa=1;var s=Function.prototype,e=s.toString;function t(o){if(o!=null){try{return e.call(o)}catch(n){}try{return o+""}catch(n){}}return""}return Hn=t,Hn}var qn,$a;function Uh(){if($a)return qn;$a=1;var s=xo(),e=jh(),t=We(),o=Ga(),n=/[\\^$.*+?()[\]{}|]/g,r=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,l=i.toString,c=a.hasOwnProperty,d=RegExp("^"+l.call(c).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function u(h){if(!t(h)||e(h))return!1;var p=s(h)?d:r;return p.test(o(h))}return qn=u,qn}var zn,Va;function Kh(){if(Va)return zn;Va=1;function s(e,t){return e==null?void 0:e[t]}return zn=s,zn}var jn,Ya;function gt(){if(Ya)return jn;Ya=1;var s=Uh(),e=Kh();function t(o,n){var r=e(o,n);return s(r)?r:void 0}return jn=t,jn}var Un,Xa;function Za(){if(Xa)return Un;Xa=1;var s=gt(),e=(function(){try{var t=s(Object,"defineProperty");return t({},"",{}),t}catch(o){}})();return Un=e,Un}var Kn,Ja;function Wh(){if(Ja)return Kn;Ja=1;var s=Fh(),e=Za(),t=Na(),o=e?function(n,r){return e(n,"toString",{configurable:!0,enumerable:!1,value:s(r),writable:!0})}:t;return Kn=o,Kn}var Wn,Qa;function Gh(){if(Qa)return Wn;Qa=1;var s=800,e=16,t=Date.now;function o(n){var r=0,i=0;return function(){var a=t(),l=e-(a-i);if(i=a,l>0){if(++r>=s)return arguments[0]}else r=0;return n.apply(void 0,arguments)}}return Wn=o,Wn}var Gn,el;function $h(){if(el)return Gn;el=1;var s=Wh(),e=Gh(),t=e(s);return Gn=t,Gn}var $n,tl;function ol(){if(tl)return $n;tl=1;var s=Na(),e=Ph(),t=$h();function o(n,r){return t(e(n,r,s),n+"")}return $n=o,$n}var Vn,nl;function Vh(){if(nl)return Vn;nl=1;var s=/\s/;function e(t){for(var o=t.length;o--&&s.test(t.charAt(o)););return o}return Vn=e,Vn}var Yn,rl;function Yh(){if(rl)return Yn;rl=1;var s=Vh(),e=/^\s+/;function t(o){return o&&o.slice(0,s(o)+1).replace(e,"")}return Yn=t,Yn}var Xn,sl;function Ge(){if(sl)return Xn;sl=1;function s(e){return e!=null&&typeof e=="object"}return Xn=s,Xn}var Zn,il;function Xh(){if(il)return Zn;il=1;var s=Ze(),e=Ge(),t="[object Symbol]";function o(n){return typeof n=="symbol"||e(n)&&s(n)==t}return Zn=o,Zn}var Jn,al;function ll(){if(al)return Jn;al=1;var s=Yh(),e=We(),t=Xh(),o=NaN,n=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;function l(c){if(typeof c=="number")return c;if(t(c))return o;if(e(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=e(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=s(c);var u=r.test(c);return u||i.test(c)?a(c.slice(2),u?2:8):n.test(c)?o:+c}return Jn=l,Jn}var Qn,cl;function Zh(){if(cl)return Qn;cl=1;var s=Lh(),e=ol(),t=ll(),o=e(function(n,r,i){return s(n,t(r)||0,i)});return Qn=o,Qn}var Jh=Zh();const Qh=$(Jh);var er,dl;function ef(){if(dl)return er;dl=1;var s=Ze(),e=Ge(),t="[object Boolean]";function o(n){return n===!0||n===!1||e(n)&&s(n)==t}return er=o,er}var tf=ef();const of=$(tf);var tr,ul;function Co(){if(ul)return tr;ul=1;var s=Object.prototype;function e(t){var o=t&&t.constructor,n=typeof o=="function"&&o.prototype||s;return t===n}return tr=e,tr}var or,hl;function fl(){if(hl)return or;hl=1;function s(e,t){return function(o){return e(t(o))}}return or=s,or}var nr,pl;function nf(){if(pl)return nr;pl=1;var s=fl(),e=s(Object.keys,Object);return nr=e,nr}var rr,gl;function ml(){if(gl)return rr;gl=1;var s=Co(),e=nf(),t=Object.prototype,o=t.hasOwnProperty;function n(r){if(!s(r))return e(r);var i=[];for(var a in Object(r))o.call(r,a)&&a!="constructor"&&i.push(a);return i}return rr=n,rr}var sr,bl;function rf(){if(bl)return sr;bl=1;var s=gt(),e=qe(),t=s(e,"DataView");return sr=t,sr}var ir,vl;function ar(){if(vl)return ir;vl=1;var s=gt(),e=qe(),t=s(e,"Map");return ir=t,ir}var lr,kl;function sf(){if(kl)return lr;kl=1;var s=gt(),e=qe(),t=s(e,"Promise");return lr=t,lr}var cr,yl;function af(){if(yl)return cr;yl=1;var s=gt(),e=qe(),t=s(e,"Set");return cr=t,cr}var dr,wl;function lf(){if(wl)return dr;wl=1;var s=gt(),e=qe(),t=s(e,"WeakMap");return dr=t,dr}var ur,Tl;function hr(){if(Tl)return ur;Tl=1;var s=rf(),e=ar(),t=sf(),o=af(),n=lf(),r=Ze(),i=Ga(),a="[object Map]",l="[object Object]",c="[object Promise]",d="[object Set]",u="[object WeakMap]",h="[object DataView]",p=i(s),f=i(e),g=i(t),b=i(o),k=i(n),y=r;return(s&&y(new s(new ArrayBuffer(1)))!=h||e&&y(new e)!=a||t&&y(t.resolve())!=c||o&&y(new o)!=d||n&&y(new n)!=u)&&(y=function(T){var C=r(T),N=C==l?T.constructor:void 0,x=N?i(N):"";if(x)switch(x){case p:return h;case f:return a;case g:return c;case b:return d;case k:return u}return C}),ur=y,ur}var fr,Bl;function cf(){if(Bl)return fr;Bl=1;var s=Ze(),e=Ge(),t="[object Arguments]";function o(n){return e(n)&&s(n)==t}return fr=o,fr}var pr,xl;function gr(){if(xl)return pr;xl=1;var s=cf(),e=Ge(),t=Object.prototype,o=t.hasOwnProperty,n=t.propertyIsEnumerable,r=s((function(){return arguments})())?s:function(i){return e(i)&&o.call(i,"callee")&&!n.call(i,"callee")};return pr=r,pr}var mr,Cl;function At(){if(Cl)return mr;Cl=1;var s=Array.isArray;return mr=s,mr}var br,El;function Sl(){if(El)return br;El=1;var s=9007199254740991;function e(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=s}return br=e,br}var vr,Al;function It(){if(Al)return vr;Al=1;var s=xo(),e=Sl();function t(o){return o!=null&&e(o.length)&&!s(o)}return vr=t,vr}var Kt={exports:{}},kr,Il;function df(){if(Il)return kr;Il=1;function s(){return!1}return kr=s,kr}Kt.exports;var Nl;function Eo(){return Nl||(Nl=1,(function(s,e){var t=qe(),o=df(),n=e&&!e.nodeType&&e,r=n&&!0&&s&&!s.nodeType&&s,i=r&&r.exports===n,a=i?t.Buffer:void 0,l=a?a.isBuffer:void 0,c=l||o;s.exports=c})(Kt,Kt.exports)),Kt.exports}var yr,Rl;function uf(){if(Rl)return yr;Rl=1;var s=Ze(),e=Sl(),t=Ge(),o="[object Arguments]",n="[object Array]",r="[object Boolean]",i="[object Date]",a="[object Error]",l="[object Function]",c="[object Map]",d="[object Number]",u="[object Object]",h="[object RegExp]",p="[object Set]",f="[object String]",g="[object WeakMap]",b="[object ArrayBuffer]",k="[object DataView]",y="[object Float32Array]",T="[object Float64Array]",C="[object Int8Array]",N="[object Int16Array]",x="[object Int32Array]",E="[object Uint8Array]",w="[object Uint8ClampedArray]",_="[object Uint16Array]",F="[object Uint32Array]",O={};O[y]=O[T]=O[C]=O[N]=O[x]=O[E]=O[w]=O[_]=O[F]=!0,O[o]=O[n]=O[b]=O[r]=O[k]=O[i]=O[a]=O[l]=O[c]=O[d]=O[u]=O[h]=O[p]=O[f]=O[g]=!1;function Y(L){return t(L)&&e(L.length)&&!!O[s(L)]}return yr=Y,yr}var wr,Ol;function hf(){if(Ol)return wr;Ol=1;function s(e){return function(t){return e(t)}}return wr=s,wr}var Wt={exports:{}};Wt.exports;var _l;function ff(){return _l||(_l=1,(function(s,e){var t=La(),o=e&&!e.nodeType&&e,n=o&&!0&&s&&!s.nodeType&&s,r=n&&n.exports===o,i=r&&t.process,a=(function(){try{var l=n&&n.require&&n.require("util").types;return l||i&&i.binding&&i.binding("util")}catch(c){}})();s.exports=a})(Wt,Wt.exports)),Wt.exports}var Tr,Ml;function So(){if(Ml)return Tr;Ml=1;var s=uf(),e=hf(),t=ff(),o=t&&t.isTypedArray,n=o?e(o):s;return Tr=n,Tr}var Br,Ll;function pf(){if(Ll)return Br;Ll=1;var s=ml(),e=hr(),t=gr(),o=At(),n=It(),r=Eo(),i=Co(),a=So(),l="[object Map]",c="[object Set]",d=Object.prototype,u=d.hasOwnProperty;function h(p){if(p==null)return!0;if(n(p)&&(o(p)||typeof p=="string"||typeof p.splice=="function"||r(p)||a(p)||t(p)))return!p.length;var f=e(p);if(f==l||f==c)return!p.size;if(i(p))return!s(p).length;for(var g in p)if(u.call(p,g))return!1;return!0}return Br=h,Br}var gf=pf();const mf=$(gf);var xr,Dl;function bf(){if(Dl)return xr;Dl=1;function s(){this.__data__=[],this.size=0}return xr=s,xr}var Cr,Pl;function Gt(){if(Pl)return Cr;Pl=1;function s(e,t){return e===t||e!==e&&t!==t}return Cr=s,Cr}var Er,Fl;function Ao(){if(Fl)return Er;Fl=1;var s=Gt();function e(t,o){for(var n=t.length;n--;)if(s(t[n][0],o))return n;return-1}return Er=e,Er}var Sr,Hl;function vf(){if(Hl)return Sr;Hl=1;var s=Ao(),e=Array.prototype,t=e.splice;function o(n){var r=this.__data__,i=s(r,n);if(i<0)return!1;var a=r.length-1;return i==a?r.pop():t.call(r,i,1),--this.size,!0}return Sr=o,Sr}var Ar,ql;function kf(){if(ql)return Ar;ql=1;var s=Ao();function e(t){var o=this.__data__,n=s(o,t);return n<0?void 0:o[n][1]}return Ar=e,Ar}var Ir,zl;function yf(){if(zl)return Ir;zl=1;var s=Ao();function e(t){return s(this.__data__,t)>-1}return Ir=e,Ir}var Nr,jl;function wf(){if(jl)return Nr;jl=1;var s=Ao();function e(t,o){var n=this.__data__,r=s(n,t);return r<0?(++this.size,n.push([t,o])):n[r][1]=o,this}return Nr=e,Nr}var Rr,Ul;function Io(){if(Ul)return Rr;Ul=1;var s=bf(),e=vf(),t=kf(),o=yf(),n=wf();function r(i){var a=-1,l=i==null?0:i.length;for(this.clear();++a<l;){var c=i[a];this.set(c[0],c[1])}}return r.prototype.clear=s,r.prototype.delete=e,r.prototype.get=t,r.prototype.has=o,r.prototype.set=n,Rr=r,Rr}var Or,Kl;function Tf(){if(Kl)return Or;Kl=1;var s=Io();function e(){this.__data__=new s,this.size=0}return Or=e,Or}var _r,Wl;function Bf(){if(Wl)return _r;Wl=1;function s(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o}return _r=s,_r}var Mr,Gl;function xf(){if(Gl)return Mr;Gl=1;function s(e){return this.__data__.get(e)}return Mr=s,Mr}var Lr,$l;function Cf(){if($l)return Lr;$l=1;function s(e){return this.__data__.has(e)}return Lr=s,Lr}var Dr,Vl;function No(){if(Vl)return Dr;Vl=1;var s=gt(),e=s(Object,"create");return Dr=e,Dr}var Pr,Yl;function Ef(){if(Yl)return Pr;Yl=1;var s=No();function e(){this.__data__=s?s(null):{},this.size=0}return Pr=e,Pr}var Fr,Xl;function Sf(){if(Xl)return Fr;Xl=1;function s(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return Fr=s,Fr}var Hr,Zl;function Af(){if(Zl)return Hr;Zl=1;var s=No(),e="__lodash_hash_undefined__",t=Object.prototype,o=t.hasOwnProperty;function n(r){var i=this.__data__;if(s){var a=i[r];return a===e?void 0:a}return o.call(i,r)?i[r]:void 0}return Hr=n,Hr}var qr,Jl;function If(){if(Jl)return qr;Jl=1;var s=No(),e=Object.prototype,t=e.hasOwnProperty;function o(n){var r=this.__data__;return s?r[n]!==void 0:t.call(r,n)}return qr=o,qr}var zr,Ql;function Nf(){if(Ql)return zr;Ql=1;var s=No(),e="__lodash_hash_undefined__";function t(o,n){var r=this.__data__;return this.size+=this.has(o)?0:1,r[o]=s&&n===void 0?e:n,this}return zr=t,zr}var jr,ec;function Rf(){if(ec)return jr;ec=1;var s=Ef(),e=Sf(),t=Af(),o=If(),n=Nf();function r(i){var a=-1,l=i==null?0:i.length;for(this.clear();++a<l;){var c=i[a];this.set(c[0],c[1])}}return r.prototype.clear=s,r.prototype.delete=e,r.prototype.get=t,r.prototype.has=o,r.prototype.set=n,jr=r,jr}var Ur,tc;function Of(){if(tc)return Ur;tc=1;var s=Rf(),e=Io(),t=ar();function o(){this.size=0,this.__data__={hash:new s,map:new(t||e),string:new s}}return Ur=o,Ur}var Kr,oc;function _f(){if(oc)return Kr;oc=1;function s(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return Kr=s,Kr}var Wr,nc;function Ro(){if(nc)return Wr;nc=1;var s=_f();function e(t,o){var n=t.__data__;return s(o)?n[typeof o=="string"?"string":"hash"]:n.map}return Wr=e,Wr}var Gr,rc;function Mf(){if(rc)return Gr;rc=1;var s=Ro();function e(t){var o=s(this,t).delete(t);return this.size-=o?1:0,o}return Gr=e,Gr}var $r,sc;function Lf(){if(sc)return $r;sc=1;var s=Ro();function e(t){return s(this,t).get(t)}return $r=e,$r}var Vr,ic;function Df(){if(ic)return Vr;ic=1;var s=Ro();function e(t){return s(this,t).has(t)}return Vr=e,Vr}var Yr,ac;function Pf(){if(ac)return Yr;ac=1;var s=Ro();function e(t,o){var n=s(this,t),r=n.size;return n.set(t,o),this.size+=n.size==r?0:1,this}return Yr=e,Yr}var Xr,lc;function cc(){if(lc)return Xr;lc=1;var s=Of(),e=Mf(),t=Lf(),o=Df(),n=Pf();function r(i){var a=-1,l=i==null?0:i.length;for(this.clear();++a<l;){var c=i[a];this.set(c[0],c[1])}}return r.prototype.clear=s,r.prototype.delete=e,r.prototype.get=t,r.prototype.has=o,r.prototype.set=n,Xr=r,Xr}var Zr,dc;function Ff(){if(dc)return Zr;dc=1;var s=Io(),e=ar(),t=cc(),o=200;function n(r,i){var a=this.__data__;if(a instanceof s){var l=a.__data__;if(!e||l.length<o-1)return l.push([r,i]),this.size=++a.size,this;a=this.__data__=new t(l)}return a.set(r,i),this.size=a.size,this}return Zr=n,Zr}var Jr,uc;function hc(){if(uc)return Jr;uc=1;var s=Io(),e=Tf(),t=Bf(),o=xf(),n=Cf(),r=Ff();function i(a){var l=this.__data__=new s(a);this.size=l.size}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=o,i.prototype.has=n,i.prototype.set=r,Jr=i,Jr}var Qr,fc;function Hf(){if(fc)return Qr;fc=1;var s="__lodash_hash_undefined__";function e(t){return this.__data__.set(t,s),this}return Qr=e,Qr}var es,pc;function qf(){if(pc)return es;pc=1;function s(e){return this.__data__.has(e)}return es=s,es}var ts,gc;function zf(){if(gc)return ts;gc=1;var s=cc(),e=Hf(),t=qf();function o(n){var r=-1,i=n==null?0:n.length;for(this.__data__=new s;++r<i;)this.add(n[r])}return o.prototype.add=o.prototype.push=e,o.prototype.has=t,ts=o,ts}var os,mc;function jf(){if(mc)return os;mc=1;function s(e,t){for(var o=-1,n=e==null?0:e.length;++o<n;)if(t(e[o],o,e))return!0;return!1}return os=s,os}var ns,bc;function Uf(){if(bc)return ns;bc=1;function s(e,t){return e.has(t)}return ns=s,ns}var rs,vc;function kc(){if(vc)return rs;vc=1;var s=zf(),e=jf(),t=Uf(),o=1,n=2;function r(i,a,l,c,d,u){var h=l&o,p=i.length,f=a.length;if(p!=f&&!(h&&f>p))return!1;var g=u.get(i),b=u.get(a);if(g&&b)return g==a&&b==i;var k=-1,y=!0,T=l&n?new s:void 0;for(u.set(i,a),u.set(a,i);++k<p;){var C=i[k],N=a[k];if(c)var x=h?c(N,C,k,a,i,u):c(C,N,k,i,a,u);if(x!==void 0){if(x)continue;y=!1;break}if(T){if(!e(a,function(E,w){if(!t(T,w)&&(C===E||d(C,E,l,c,u)))return T.push(w)})){y=!1;break}}else if(!(C===N||d(C,N,l,c,u))){y=!1;break}}return u.delete(i),u.delete(a),y}return rs=r,rs}var ss,yc;function wc(){if(yc)return ss;yc=1;var s=qe(),e=s.Uint8Array;return ss=e,ss}var is,Tc;function Bc(){if(Tc)return is;Tc=1;function s(e){var t=-1,o=Array(e.size);return e.forEach(function(n,r){o[++t]=[r,n]}),o}return is=s,is}var as,xc;function Cc(){if(xc)return as;xc=1;function s(e){var t=-1,o=Array(e.size);return e.forEach(function(n){o[++t]=n}),o}return as=s,as}var ls,Ec;function Kf(){if(Ec)return ls;Ec=1;var s=Bo(),e=wc(),t=Gt(),o=kc(),n=Bc(),r=Cc(),i=1,a=2,l="[object Boolean]",c="[object Date]",d="[object Error]",u="[object Map]",h="[object Number]",p="[object RegExp]",f="[object Set]",g="[object String]",b="[object Symbol]",k="[object ArrayBuffer]",y="[object DataView]",T=s?s.prototype:void 0,C=T?T.valueOf:void 0;function N(x,E,w,_,F,O,Y){switch(w){case y:if(x.byteLength!=E.byteLength||x.byteOffset!=E.byteOffset)return!1;x=x.buffer,E=E.buffer;case k:return!(x.byteLength!=E.byteLength||!O(new e(x),new e(E)));case l:case c:case h:return t(+x,+E);case d:return x.name==E.name&&x.message==E.message;case p:case g:return x==E+"";case u:var L=n;case f:var J=_&i;if(L||(L=r),x.size!=E.size&&!J)return!1;var re=Y.get(x);if(re)return re==E;_|=a,Y.set(x,E);var se=o(L(x),L(E),_,F,O,Y);return Y.delete(x),se;case b:if(C)return C.call(x)==C.call(E)}return!1}return ls=N,ls}var cs,Sc;function Wf(){if(Sc)return cs;Sc=1;function s(e,t){for(var o=-1,n=t.length,r=e.length;++o<n;)e[r+o]=t[o];return e}return cs=s,cs}var ds,Ac;function Gf(){if(Ac)return ds;Ac=1;var s=Wf(),e=At();function t(o,n,r){var i=n(o);return e(o)?i:s(i,r(o))}return ds=t,ds}var us,Ic;function $f(){if(Ic)return us;Ic=1;function s(e,t){for(var o=-1,n=e==null?0:e.length,r=0,i=[];++o<n;){var a=e[o];t(a,o,e)&&(i[r++]=a)}return i}return us=s,us}var hs,Nc;function Vf(){if(Nc)return hs;Nc=1;function s(){return[]}return hs=s,hs}var fs,Rc;function Yf(){if(Rc)return fs;Rc=1;var s=$f(),e=Vf(),t=Object.prototype,o=t.propertyIsEnumerable,n=Object.getOwnPropertySymbols,r=n?function(i){return i==null?[]:(i=Object(i),s(n(i),function(a){return o.call(i,a)}))}:e;return fs=r,fs}var ps,Oc;function Xf(){if(Oc)return ps;Oc=1;function s(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n}return ps=s,ps}var gs,_c;function Mc(){if(_c)return gs;_c=1;var s=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(o,n){var r=typeof o;return n=n==null?s:n,!!n&&(r=="number"||r!="symbol"&&e.test(o))&&o>-1&&o%1==0&&o<n}return gs=t,gs}var ms,Lc;function Dc(){if(Lc)return ms;Lc=1;var s=Xf(),e=gr(),t=At(),o=Eo(),n=Mc(),r=So(),i=Object.prototype,a=i.hasOwnProperty;function l(c,d){var u=t(c),h=!u&&e(c),p=!u&&!h&&o(c),f=!u&&!h&&!p&&r(c),g=u||h||p||f,b=g?s(c.length,String):[],k=b.length;for(var y in c)(d||a.call(c,y))&&!(g&&(y=="length"||p&&(y=="offset"||y=="parent")||f&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||n(y,k)))&&b.push(y);return b}return ms=l,ms}var bs,Pc;function Fc(){if(Pc)return bs;Pc=1;var s=Dc(),e=ml(),t=It();function o(n){return t(n)?s(n):e(n)}return bs=o,bs}var vs,Hc;function Zf(){if(Hc)return vs;Hc=1;var s=Gf(),e=Yf(),t=Fc();function o(n){return s(n,t,e)}return vs=o,vs}var ks,qc;function Jf(){if(qc)return ks;qc=1;var s=Zf(),e=1,t=Object.prototype,o=t.hasOwnProperty;function n(r,i,a,l,c,d){var u=a&e,h=s(r),p=h.length,f=s(i),g=f.length;if(p!=g&&!u)return!1;for(var b=p;b--;){var k=h[b];if(!(u?k in i:o.call(i,k)))return!1}var y=d.get(r),T=d.get(i);if(y&&T)return y==i&&T==r;var C=!0;d.set(r,i),d.set(i,r);for(var N=u;++b<p;){k=h[b];var x=r[k],E=i[k];if(l)var w=u?l(E,x,k,i,r,d):l(x,E,k,r,i,d);if(!(w===void 0?x===E||c(x,E,a,l,d):w)){C=!1;break}N||(N=k=="constructor")}if(C&&!N){var _=r.constructor,F=i.constructor;_!=F&&"constructor"in r&&"constructor"in i&&!(typeof _=="function"&&_ instanceof _&&typeof F=="function"&&F instanceof F)&&(C=!1)}return d.delete(r),d.delete(i),C}return ks=n,ks}var ys,zc;function Qf(){if(zc)return ys;zc=1;var s=hc(),e=kc(),t=Kf(),o=Jf(),n=hr(),r=At(),i=Eo(),a=So(),l=1,c="[object Arguments]",d="[object Array]",u="[object Object]",h=Object.prototype,p=h.hasOwnProperty;function f(g,b,k,y,T,C){var N=r(g),x=r(b),E=N?d:n(g),w=x?d:n(b);E=E==c?u:E,w=w==c?u:w;var _=E==u,F=w==u,O=E==w;if(O&&i(g)){if(!i(b))return!1;N=!0,_=!1}if(O&&!_)return C||(C=new s),N||a(g)?e(g,b,k,y,T,C):t(g,b,E,k,y,T,C);if(!(k&l)){var Y=_&&p.call(g,"__wrapped__"),L=F&&p.call(b,"__wrapped__");if(Y||L){var J=Y?g.value():g,re=L?b.value():b;return C||(C=new s),T(J,re,k,y,C)}}return O?(C||(C=new s),o(g,b,k,y,T,C)):!1}return ys=f,ys}var ws,jc;function ep(){if(jc)return ws;jc=1;var s=Qf(),e=Ge();function t(o,n,r,i,a){return o===n?!0:o==null||n==null||!e(o)&&!e(n)?o!==o&&n!==n:s(o,n,r,i,t,a)}return ws=t,ws}var Ts,Uc;function tp(){if(Uc)return Ts;Uc=1;var s=ep();function e(t,o){return s(t,o)}return Ts=e,Ts}var op=tp();const np=$(op);var rp=xo();const sp=$(rp);var Bs,Kc;function ip(){if(Kc)return Bs;Kc=1;var s=Ze(),e=Ge(),t="[object Number]";function o(n){return typeof n=="number"||e(n)&&s(n)==t}return Bs=o,Bs}var ap=ip();const lp=$(ap);var xs,Wc;function Gc(){if(Wc)return xs;Wc=1;var s=fl(),e=s(Object.getPrototypeOf,Object);return xs=e,xs}var Cs,$c;function Vc(){if($c)return Cs;$c=1;var s=Ze(),e=Gc(),t=Ge(),o="[object Object]",n=Function.prototype,r=Object.prototype,i=n.toString,a=r.hasOwnProperty,l=i.call(Object);function c(d){if(!t(d)||s(d)!=o)return!1;var u=e(d);if(u===null)return!0;var h=a.call(u,"constructor")&&u.constructor;return typeof h=="function"&&h instanceof h&&i.call(h)==l}return Cs=c,Cs}var cp=Vc();const dp=$(cp);var Es,Yc;function Xc(){if(Yc)return Es;Yc=1;var s=Ze(),e=At(),t=Ge(),o="[object String]";function n(r){return typeof r=="string"||!e(r)&&t(r)&&s(r)==o}return Es=n,Es}var up=Xc();const hp=$(up);var Ss,Zc;function fp(){if(Zc)return Ss;Zc=1;function s(e){return e===void 0}return Ss=s,Ss}var pp=fp();const gp=$(pp);var As,Jc;function Is(){if(Jc)return As;Jc=1;var s=Za();function e(t,o,n){o=="__proto__"&&s?s(t,o,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[o]=n}return As=e,As}var Ns,Qc;function ed(){if(Qc)return Ns;Qc=1;var s=Is(),e=Gt();function t(o,n,r){(r!==void 0&&!e(o[n],r)||r===void 0&&!(n in o))&&s(o,n,r)}return Ns=t,Ns}var Rs,td;function mp(){if(td)return Rs;td=1;function s(e){return function(t,o,n){for(var r=-1,i=Object(t),a=n(t),l=a.length;l--;){var c=a[e?l:++r];if(o(i[c],c,i)===!1)break}return t}}return Rs=s,Rs}var Os,od;function bp(){if(od)return Os;od=1;var s=mp(),e=s();return Os=e,Os}var $t={exports:{}};$t.exports;var nd;function vp(){return nd||(nd=1,(function(s,e){var t=qe(),o=e&&!e.nodeType&&e,n=o&&!0&&s&&!s.nodeType&&s,r=n&&n.exports===o,i=r?t.Buffer:void 0,a=i?i.allocUnsafe:void 0;function l(c,d){if(d)return c.slice();var u=c.length,h=a?a(u):new c.constructor(u);return c.copy(h),h}s.exports=l})($t,$t.exports)),$t.exports}var _s,rd;function kp(){if(rd)return _s;rd=1;var s=wc();function e(t){var o=new t.constructor(t.byteLength);return new s(o).set(new s(t)),o}return _s=e,_s}var Ms,sd;function yp(){if(sd)return Ms;sd=1;var s=kp();function e(t,o){var n=o?s(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}return Ms=e,Ms}var Ls,id;function ad(){if(id)return Ls;id=1;function s(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o<n;)t[o]=e[o];return t}return Ls=s,Ls}var Ds,ld;function wp(){if(ld)return Ds;ld=1;var s=We(),e=Object.create,t=(function(){function o(){}return function(n){if(!s(n))return{};if(e)return e(n);o.prototype=n;var r=new o;return o.prototype=void 0,r}})();return Ds=t,Ds}var Ps,cd;function Tp(){if(cd)return Ps;cd=1;var s=wp(),e=Gc(),t=Co();function o(n){return typeof n.constructor=="function"&&!t(n)?s(e(n)):{}}return Ps=o,Ps}var Fs,dd;function Bp(){if(dd)return Fs;dd=1;var s=It(),e=Ge();function t(o){return e(o)&&s(o)}return Fs=t,Fs}var Hs,ud;function hd(){if(ud)return Hs;ud=1;function s(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}return Hs=s,Hs}var qs,fd;function xp(){if(fd)return qs;fd=1;var s=Is(),e=Gt(),t=Object.prototype,o=t.hasOwnProperty;function n(r,i,a){var l=r[i];(!(o.call(r,i)&&e(l,a))||a===void 0&&!(i in r))&&s(r,i,a)}return qs=n,qs}var zs,pd;function Cp(){if(pd)return zs;pd=1;var s=xp(),e=Is();function t(o,n,r,i){var a=!r;r||(r={});for(var l=-1,c=n.length;++l<c;){var d=n[l],u=i?i(r[d],o[d],d,r,o):void 0;u===void 0&&(u=o[d]),a?e(r,d,u):s(r,d,u)}return r}return zs=t,zs}var js,gd;function Ep(){if(gd)return js;gd=1;function s(e){var t=[];if(e!=null)for(var o in Object(e))t.push(o);return t}return js=s,js}var Us,md;function Sp(){if(md)return Us;md=1;var s=We(),e=Co(),t=Ep(),o=Object.prototype,n=o.hasOwnProperty;function r(i){if(!s(i))return t(i);var a=e(i),l=[];for(var c in i)c=="constructor"&&(a||!n.call(i,c))||l.push(c);return l}return Us=r,Us}var Ks,bd;function vd(){if(bd)return Ks;bd=1;var s=Dc(),e=Sp(),t=It();function o(n){return t(n)?s(n,!0):e(n)}return Ks=o,Ks}var Ws,kd;function Ap(){if(kd)return Ws;kd=1;var s=Cp(),e=vd();function t(o){return s(o,e(o))}return Ws=t,Ws}var Gs,yd;function Ip(){if(yd)return Gs;yd=1;var s=ed(),e=vp(),t=yp(),o=ad(),n=Tp(),r=gr(),i=At(),a=Bp(),l=Eo(),c=xo(),d=We(),u=Vc(),h=So(),p=hd(),f=Ap();function g(b,k,y,T,C,N,x){var E=p(b,y),w=p(k,y),_=x.get(w);if(_){s(b,y,_);return}var F=N?N(E,w,y+"",b,k,x):void 0,O=F===void 0;if(O){var Y=i(w),L=!Y&&l(w),J=!Y&&!L&&h(w);F=w,Y||L||J?i(E)?F=E:a(E)?F=o(E):L?(O=!1,F=e(w,!0)):J?(O=!1,F=t(w,!0)):F=[]:u(w)||r(w)?(F=E,r(E)?F=f(E):(!d(E)||c(E))&&(F=n(w))):O=!1}O&&(x.set(w,F),C(F,w,T,N,x),x.delete(w)),s(b,y,F)}return Gs=g,Gs}var $s,wd;function Np(){if(wd)return $s;wd=1;var s=hc(),e=ed(),t=bp(),o=Ip(),n=We(),r=vd(),i=hd();function a(l,c,d,u,h){l!==c&&t(c,function(p,f){if(h||(h=new s),n(p))o(l,c,f,d,a,u,h);else{var g=u?u(i(l,f),p,f+"",l,c,h):void 0;g===void 0&&(g=p),e(l,f,g)}},r)}return $s=a,$s}var Vs,Td;function Rp(){if(Td)return Vs;Td=1;var s=Gt(),e=It(),t=Mc(),o=We();function n(r,i,a){if(!o(a))return!1;var l=typeof i;return(l=="number"?e(a)&&t(i,a.length):l=="string"&&i in a)?s(a[i],r):!1}return Vs=n,Vs}var Ys,Bd;function Op(){if(Bd)return Ys;Bd=1;var s=ol(),e=Rp();function t(o){return s(function(n,r){var i=-1,a=r.length,l=a>1?r[a-1]:void 0,c=a>2?r[2]:void 0;for(l=o.length>3&&typeof l=="function"?(a--,l):void 0,c&&e(r[0],r[1],c)&&(l=a<3?void 0:l,a=1),n=Object(n);++i<a;){var d=r[i];d&&o(n,d,i,l)}return n})}return Ys=t,Ys}var Xs,xd;function _p(){if(xd)return Xs;xd=1;var s=Np(),e=Op(),t=e(function(o,n,r,i){s(o,n,r,i)});return Xs=t,Xs}var Mp=_p();const Lp=$(Mp);var Zs,Cd;function Dp(){if(Cd)return Zs;Cd=1;var s=qe(),e=function(){return s.Date.now()};return Zs=e,Zs}var Js,Ed;function Pp(){if(Ed)return Js;Ed=1;var s=We(),e=Dp(),t=ll(),o="Expected a function",n=Math.max,r=Math.min;function i(a,l,c){var d,u,h,p,f,g,b=0,k=!1,y=!1,T=!0;if(typeof a!="function")throw new TypeError(o);l=t(l)||0,s(c)&&(k=!!c.leading,y="maxWait"in c,h=y?n(t(c.maxWait)||0,l):h,T="trailing"in c?!!c.trailing:T);function C(L){var J=d,re=u;return d=u=void 0,b=L,p=a.apply(re,J),p}function N(L){return b=L,f=setTimeout(w,l),k?C(L):p}function x(L){var J=L-g,re=L-b,se=l-J;return y?r(se,h-re):se}function E(L){var J=L-g,re=L-b;return g===void 0||J>=l||J<0||y&&re>=h}function w(){var L=e();if(E(L))return _(L);f=setTimeout(w,x(L))}function _(L){return f=void 0,T&&d?C(L):(d=u=void 0,p)}function F(){f!==void 0&&clearTimeout(f),b=0,d=g=u=f=void 0}function O(){return f===void 0?p:_(e())}function Y(){var L=e(),J=E(L);if(d=arguments,u=this,g=L,J){if(f===void 0)return N(g);if(y)return clearTimeout(f),f=setTimeout(w,l),C(g)}return f===void 0&&(f=setTimeout(w,l)),p}return Y.cancel=F,Y.flush=O,Y}return Js=i,Js}var Qs,Sd;function Fp(){if(Sd)return Qs;Sd=1;var s=Pp(),e=We(),t="Expected a function";function o(n,r,i){var a=!0,l=!0;if(typeof n!="function")throw new TypeError(t);return e(i)&&(a="leading"in i?!!i.leading:a,l="trailing"in i?!!i.trailing:l),s(n,r,{leading:a,maxWait:r,trailing:l})}return Qs=o,Qs}var Hp=Fp();const qp=$(Hp);var ei,Ad;function zp(){if(Ad)return ei;Ad=1;function s(e){for(var t,o=[];!(t=e.next()).done;)o.push(t.value);return o}return ei=s,ei}var ti,Id;function jp(){if(Id)return ti;Id=1;function s(e){return e.split("")}return ti=s,ti}var oi,Nd;function Up(){if(Nd)return oi;Nd=1;var s="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",n=e+t+o,r="\\ufe0e\\ufe0f",i="\\u200d",a=RegExp("["+i+s+n+r+"]");function l(c){return a.test(c)}return oi=l,oi}var ni,Rd;function Kp(){if(Rd)return ni;Rd=1;var s="\\ud800-\\udfff",e="\\u0300-\\u036f",t="\\ufe20-\\ufe2f",o="\\u20d0-\\u20ff",n=e+t+o,r="\\ufe0e\\ufe0f",i="["+s+"]",a="["+n+"]",l="\\ud83c[\\udffb-\\udfff]",c="(?:"+a+"|"+l+")",d="[^"+s+"]",u="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",f=c+"?",g="["+r+"]?",b="(?:"+p+"(?:"+[d,u,h].join("|")+")"+g+f+")*",k=g+f+b,y="(?:"+[d+a+"?",a,u,h,i].join("|")+")",T=RegExp(l+"(?="+l+")|"+y+k,"g");function C(N){return N.match(T)||[]}return ni=C,ni}var ri,Od;function Wp(){if(Od)return ri;Od=1;var s=jp(),e=Up(),t=Kp();function o(n){return e(n)?t(n):s(n)}return ri=o,ri}var si,_d;function Gp(){if(_d)return si;_d=1;function s(e,t){for(var o=-1,n=e==null?0:e.length,r=Array(n);++o<n;)r[o]=t(e[o],o,e);return r}return si=s,si}var ii,Md;function $p(){if(Md)return ii;Md=1;var s=Gp();function e(t,o){return s(o,function(n){return t[n]})}return ii=e,ii}var ai,Ld;function Vp(){if(Ld)return ai;Ld=1;var s=$p(),e=Fc();function t(o){return o==null?[]:s(o,e(o))}return ai=t,ai}var li,Dd;function Yp(){if(Dd)return li;Dd=1;var s=Bo(),e=ad(),t=hr(),o=It(),n=Xc(),r=zp(),i=Bc(),a=Cc(),l=Wp(),c=Vp(),d="[object Map]",u="[object Set]",h=s?s.iterator:void 0;function p(f){if(!f)return[];if(o(f))return n(f)?l(f):e(f);if(h&&f[h])return r(f[h]());var g=t(f),b=g==d?i:g==u?a:c;return b(f)}return li=p,li}var Xp=Yp();const Zp=$(Xp);var Pd=(s=>(s.VERBOSE="VERBOSE",s.INFO="INFO",s.WARN="WARN",s.ERROR="ERROR",s))(Pd||{});const Oo=()=>"0.4.1",I={BACKSPACE:8,TAB:9,ENTER:13,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46},Jp={LEFT:0},Qp=1e8,eg=16,_e=(()=>{try{return Function("return this")()}catch(s){return}})();_e&&typeof _e.window=="undefined"&&(_e.window=_e);const _o=()=>{if(_e!=null&&_e.window)return _e.window},Fd=()=>{if(_e!=null&&_e.navigator)return _e.navigator;const s=_o();return s==null?void 0:s.navigator},Vt=(s,e,t="log",o,n="color: inherit")=>{const r=typeof console=="undefined"?void 0:console;if(!r||typeof r[t]!="function")return;const i=["info","log","warn","error"].includes(t),a=[];switch(Vt.logLevel){case"ERROR":if(t!=="error")return;break;case"WARN":if(!["error","warn"].includes(t))return;break;case"INFO":if(!i||s)return;break}o&&a.push(o);const l=`Blok ${Oo()}`,c=`line-height: 1em;
2
- color: #006FEA;
3
- display: inline-block;
4
- font-size: 11px;
5
- line-height: 1em;
6
- background-color: #fff;
7
- padding: 4px 9px;
8
- border-radius: 30px;
9
- border: 1px solid rgba(56, 138, 229, 0.16);
10
- margin: 4px 5px 4px 0;`,d=s?i?(a.unshift(c,n),`%c${l}%c ${e}`):`( ${l} )${e}`:e,u=i?o!==void 0?[`${d} %o`,...a]:[d,...a]:[d];try{r[t](...u)}catch(h){}};Vt.logLevel="VERBOSE";const tg=s=>{Vt.logLevel=s},U=(s,e="log",t,o)=>{Vt(!1,s,e,t,o)},Me=(s,e="log",t,o)=>{Vt(!0,s,e,t,o)},V=s=>sp(s),Z=s=>dp(s),ze=s=>hp(s),Hd=s=>of(s),qd=s=>lp(s),og=function(s){return gp(s)},ae=s=>mf(s),zd=s=>Zp(s),Mo=(s,e)=>function(...t){Qh(()=>s.apply(this,t),e)},ng=s=>{var e;return(e=s.name.split(".").pop())!=null?e:""},rg=s=>/^[-\w]+\/([-+\w]+|\*)$/.test(s),jd=(s,e,t)=>{const o={timeoutId:null};return function(...n){const r=()=>{o.timeoutId=null,s.apply(this,n)};o.timeoutId!==null&&clearTimeout(o.timeoutId),o.timeoutId=setTimeout(r,e)}},ci=(s,e,t)=>qp(s,e,t),Ud=()=>{var n,r;const s={win:!1,mac:!1,x11:!1,linux:!1},e=Fd(),t=(r=(n=e==null?void 0:e.userAgent)==null?void 0:n.toLowerCase())!=null?r:"",o=t?Object.keys(s).find(i=>t.indexOf(i)!==-1):void 0;return o!==void 0&&(s[o]=!0),s},Lo=s=>s&&s.slice(0,1).toUpperCase()+s.slice(1),sg=(s,e)=>{if(Array.isArray(e))return e},Yt=(s,...e)=>!Z(s)||e.length===0?s:e.reduce((t,o)=>Z(o)?Lp(t,o,sg):t,s),Kd=s=>{const e=Ud(),t=s.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi," + ");return e.mac?t.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN")},ig=s=>{try{return new URL(s).href}catch(t){}const e=_o();return s.substring(0,2)==="//"?e?`${e.location.protocol}${s}`:s:e?`${e.location.origin}${s}`:s},ag=()=>Mh(10),lg=s=>{const e=_o();e&&e.open(s,"_blank")},cg=(s="")=>`${s}${Math.floor(Math.random()*Qp).toString(eg)}`,Wd=650,st=()=>{const s=_o();return!s||typeof s.matchMedia!="function"?!1:s.matchMedia(`(max-width: ${Wd}px)`).matches},di=(()=>{var l;const s=Fd();if(!s)return!1;const e=s.userAgent||"",t=s.userAgentData,o=t==null?void 0:t.platform;if(/iP(ad|hone|od)/.test(e)||o!==void 0&&o!==""&&/iP(ad|hone|od)/.test(o))return!0;const n=((l=s.maxTouchPoints)!=null?l:0)>1,r=()=>s.platform,i=o!==void 0&&o!==""?o:void 0;return(n?i!=null?i:r():void 0)==="MacIntel"})(),dg=(s,e)=>np(s,e);class v{static isSingleTag(e){return!!e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return!!e&&["BR","WBR"].includes(e.tagName)}static isValidClassName(e){if(e===""||/\s/.test(e))return!1;try{return document.createElement("div").classList.add(e),!0}catch(t){return!1}}static safelyAddClasses(e,t){const o=[],n=[];for(const r of t)v.isValidClassName(r)?o.push(r):n.push(r);if(o.length>0&&e.classList.add(...o),n.length>0){const r=e.className,i=r?`${r} ${n.join(" ")}`:n.join(" ");e.setAttribute("class",i)}}static make(e,t=null,o={}){const n=document.createElement(e);if(Array.isArray(t)){const r=t.filter(i=>i!==void 0&&i!=="").flatMap(i=>i.split(" ")).filter(i=>i!=="");v.safelyAddClasses(n,r)}if(typeof t=="string"&&t!==""){const r=t.split(" ").filter(i=>i!=="");v.safelyAddClasses(n,r)}for(const r in o){if(!Object.prototype.hasOwnProperty.call(o,r))continue;const i=o[r];if(i!=null){if(r in n){n[r]=i;continue}n.setAttribute(r,String(i))}}return n}static text(e){return document.createTextNode(e)}static append(e,t){Array.isArray(t)?t.forEach(o=>e.appendChild(o)):e.appendChild(t)}static prepend(e,t){Array.isArray(t)?[...t].reverse().forEach(n=>e.prepend(n)):e.prepend(t)}static find(e=document,t){return e.querySelector(t)}static get(e){return document.getElementById(e)}static findAll(e=document,t){return e.querySelectorAll(t)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(t=>`input[type="${t}"]`).join(", ")}static findAllInputs(e){return zd(e.querySelectorAll(v.allInputsSelector)).reduce((t,o)=>v.isNativeInput(o)||v.containsOnlyInlineElements(o)?[...t,o]:[...t,...v.getDeepestBlockElements(o)],[])}static getDeepestNode(e,t=!1){var d;const o=t?"lastChild":"firstChild",n=t?"previousSibling":"nextSibling";if(e===null||e.nodeType!==Node.ELEMENT_NODE)return e;const r=e[o];if(r===null)return e;const i=r;if(!(v.isSingleTag(i)&&!v.isNativeInput(i)&&!v.isLineBreakTag(i)))return this.getDeepestNode(i,t);const l=i[n];if(l)return this.getDeepestNode(l,t);const c=(d=i.parentNode)==null?void 0:d[n];return c?this.getDeepestNode(c,t):i.parentNode}static isElement(e){return qd(e)?!1:e!=null&&e.nodeType!=null&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return qd(e)?!1:e!=null&&e.nodeType!=null&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){const t=["INPUT","TEXTAREA"];return e!=null&&typeof e.tagName=="string"?t.includes(e.tagName):!1}static canSetCaret(e){return v.isNativeInput(e)?!new Set(["file","checkbox","radio","hidden","submit","button","image","reset"]).has(e.type):v.isContentEditable(e)}static isNodeEmpty(e,t){var r,i;if(this.isSingleTag(e)&&!this.isLineBreakTag(e))return!1;const o=this.isElement(e)&&this.isNativeInput(e)?e.value:(r=e.textContent)==null?void 0:r.replace("​",""),n=t?o==null?void 0:o.replace(new RegExp(t,"g"),""):o;return((i=n==null?void 0:n.length)!=null?i:0)===0}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e,t){const o=[e];for(;o.length>0;){const n=o.shift();if(n){if(this.isLeaf(n)&&!this.isNodeEmpty(n,t))return!1;n.childNodes&&o.push(...Array.from(n.childNodes))}}return!0}static isHTMLString(e){const t=v.make("div");return t.innerHTML=e,t.childElementCount>0}static getContentLength(e){var t,o;return v.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:(o=(t=e.textContent)==null?void 0:t.length)!=null?o:0}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){const t=ze(e)?(()=>{const n=document.createElement("div");return n.innerHTML=e,n})():e,o=n=>!v.blockElements.includes(n.tagName.toLowerCase())&&Array.from(n.children).every(o);return Array.from(t.children).every(o)}static getDeepestBlockElements(e){return v.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((t,o)=>[...t,...v.getDeepestBlockElements(o)],[])}static getHolder(e){if(!ze(e))return e;const t=document.getElementById(e);if(t!==null)return t;throw new Error(`Element with id "${e}" not found`)}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static offset(e){const t=e.getBoundingClientRect(),o=window.scrollX||document.documentElement.scrollLeft,n=window.scrollY||document.documentElement.scrollTop,r=t.top+n,i=t.left+o;return{top:r,left:i,bottom:r+t.height,right:i+t.width}}static getNodeByOffset(e,t){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n=(c,d,u,h)=>{var b;if(!c&&u){const k=d-h,y=Math.max(t-k,0),T=Math.min(y,h);return{node:u,offset:T}}if(!c)return{node:null,offset:0};const f=((b=c.textContent)!=null?b:"").length;return d+f>=t?{node:c,offset:Math.min(t-d,f)}:n(o.nextNode(),d+f,c,f)},r=o.nextNode(),{node:i,offset:a}=n(r,0,null,0);if(!i)return{node:null,offset:0};const l=i.textContent;return!l||l.length===0?{node:null,offset:0}:{node:i,offset:a}}}const ui=s=>!/[^\t\n\r \u200B]/.test(s),Gd=s=>{s.setAttribute("data-blok-empty",v.isEmpty(s)?"true":"false")},$d={ui:{blockTunes:{toggler:{"Drag to move":"","Click to open the menu":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{"Click to add below":"","Option-click to add above":"","Ctrl-click to add above":""}},popover:{Filter:"","Nothing found":"","Convert to":""}},toolNames:{Text:"",Link:"",Bold:"",Italic:"","Bulleted list":"","Numbered list":"",Checklist:""},tools:{link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""},list:{"Bulleted list":"","Numbered list":"",Checklist:"",List:""}},blockTunes:{delete:{Delete:""},moveUp:{"Move up":""},moveDown:{"Move down":""}}},ht=class ht{static ui(e,t){return ht._t(e,t)}static t(e,t){return ht._t(e,t)}static setDictionary(e){ht.currentDictionary=e}static _t(e,t){const o=ht.getNamespace(e);return!o||!o[t]?t:o[t]}static getNamespace(e){return e.split(".").reduce((o,n)=>{if(!o||!Object.keys(o).length)return{};const r=o[n];return typeof r=="string"?{}:r},ht.currentDictionary)}};ht.currentDictionary=$d;let oe=ht;class Xt extends Error{}class Zt{constructor(){this.subscribers={}}on(e,t){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(t)}once(e,t){e in this.subscribers||(this.subscribers[e]=[]);const o=n=>{const r=t(n),i=this.subscribers[e].indexOf(o);return i!==-1&&this.subscribers[e].splice(i,1),r};this.subscribers[e].push(o)}emit(e,t){ae(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,n)=>{const r=n(o);return r!==void 0?r:o},t)}off(e,t){const o=this.subscribers[e];if(o===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}const n=o.indexOf(t);n!==-1&&o.splice(n,1)}destroy(){this.subscribers={}}}const $e=function(e){return Object.setPrototypeOf(this,{get id(){return e.id},get name(){return e.name},get config(){return e.config},get holder(){return e.holder},get isEmpty(){return e.isEmpty},get selected(){return e.selected},set stretched(o){e.setStretchState(o)},get stretched(){return e.stretched},get focusable(){return e.focusable},call(o,n){return e.call(o,n)},save(){return e.save()},validate(o){return e.validate(o)},dispatchChange(){e.dispatchChange()},getActiveToolboxEntry(){return e.getActiveToolboxEntry()}}),Object.defineProperties(this,{id:{get(){return e.id},enumerable:!0,configurable:!0},name:{get(){return e.name},enumerable:!0,configurable:!0}}),this};class Jt{constructor(){this.allListeners=[]}on(e,t,o,n=!1){if(this.findOne(e,t,o,n))return;const i=cg("l"),a={id:i,element:e,eventType:t,handler:o,options:n};return this.allListeners.push(a),e.addEventListener(t,o,n),i}off(e,t,o,n){const r=this.findAll(e,t,o,n);r.forEach((i,a)=>{const l=this.allListeners.indexOf(r[a]);l>-1&&(this.allListeners.splice(l,1),i.element.removeEventListener(i.eventType,i.handler,i.options))})}offById(e){const t=this.findById(e);if(!t)return;t.element.removeEventListener(t.eventType,t.handler,t.options);const o=this.allListeners.indexOf(t);o>-1&&this.allListeners.splice(o,1)}findOne(e,t,o,n){var i;return(i=this.findAll(e,t,o,n)[0])!=null?i:null}findAll(e,t,o,n){return e?this.findByEventTarget(e).filter(i=>{const a=t===void 0||i.eventType===t,l=o===void 0||i.handler===o,c=this.areOptionsEqual(i.options,n);return a&&l&&c}):[]}removeAll(){this.allListeners.forEach(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(t=>t.element===e)}findByType(e){return this.allListeners.filter(t=>t.eventType===e)}findByHandler(e){return this.allListeners.filter(t=>t.handler===e)}findById(e){return this.allListeners.find(t=>t.id===e)}normalizeListenerOptions(e){var t,o,n;return typeof e=="boolean"?{capture:e,once:!1,passive:!1}:e?{capture:(t=e.capture)!=null?t:!1,once:(o=e.once)!=null?o:!1,passive:(n=e.passive)!=null?n:!1,signal:e.signal}:{capture:!1,once:!1,passive:!1}}areOptionsEqual(e,t){if(t===void 0)return!0;const o=this.normalizeListenerOptions(e),n=this.normalizeListenerOptions(t);return o.capture===n.capture&&o.once===n.once&&o.passive===n.passive&&o.signal===n.signal}}class K{constructor({config:e,eventsDispatcher:t}){if(this.nodes={},this.listeners=new Jt,this.readOnlyMutableListeners={on:(o,n,r,i=!1)=>{const a=this.listeners.on(o,n,r,i);a&&this.mutableListenerIds.push(a)},clearAll:()=>{for(const o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===K)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=t,this.Blok={}}set state(e){this.Blok=e}removeAllNodes(){for(const e in this.nodes){const t=this.nodes[e];t instanceof HTMLElement&&t.remove()}}get isRtl(){var e;return((e=this.config.i18n)==null?void 0:e.direction)==="rtl"}}const ug=(s,e)=>{const t=new Array(s.length+e.length);for(let o=0;o<s.length;o++)t[o]=s[o];for(let o=0;o<e.length;o++)t[s.length+o]=e[o];return t},hg=(s,e)=>({classGroupId:s,validator:e}),Vd=(s=new Map,e=null,t)=>({nextPart:s,validators:e,classGroupId:t}),Do="-",Yd=[],fg="arbitrary..",pg=s=>{const e=mg(s),{conflictingClassGroups:t,conflictingClassGroupModifiers:o}=s;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return gg(i);const a=i.split(Do),l=a[0]===""&&a.length>1?1:0;return Xd(a,l,e)},getConflictingClassGroupIds:(i,a)=>{if(a){const l=o[i],c=t[i];return l?c?ug(c,l):l:c||Yd}return t[i]||Yd}}},Xd=(s,e,t)=>{if(s.length-e===0)return t.classGroupId;const n=s[e],r=t.nextPart.get(n);if(r){const c=Xd(s,e+1,r);if(c)return c}const i=t.validators;if(i===null)return;const a=e===0?s.join(Do):s.slice(e).join(Do),l=i.length;for(let c=0;c<l;c++){const d=i[c];if(d.validator(a))return d.classGroupId}},gg=s=>s.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=s.slice(1,-1),t=e.indexOf(":"),o=e.slice(0,t);return o?fg+o:void 0})(),mg=s=>{const{theme:e,classGroups:t}=s;return bg(t,e)},bg=(s,e)=>{const t=Vd();for(const o in s){const n=s[o];hi(n,t,o,e)}return t},hi=(s,e,t,o)=>{const n=s.length;for(let r=0;r<n;r++){const i=s[r];vg(i,e,t,o)}},vg=(s,e,t,o)=>{if(typeof s=="string"){kg(s,e,t);return}if(typeof s=="function"){yg(s,e,t,o);return}wg(s,e,t,o)},kg=(s,e,t)=>{const o=s===""?e:Zd(e,s);o.classGroupId=t},yg=(s,e,t,o)=>{if(Tg(s)){hi(s(o),e,t,o);return}e.validators===null&&(e.validators=[]),e.validators.push(hg(t,s))},wg=(s,e,t,o)=>{const n=Object.entries(s),r=n.length;for(let i=0;i<r;i++){const[a,l]=n[i];hi(l,Zd(e,a),t,o)}},Zd=(s,e)=>{let t=s;const o=e.split(Do),n=o.length;for(let r=0;r<n;r++){const i=o[r];let a=t.nextPart.get(i);a||(a=Vd(),t.nextPart.set(i,a)),t=a}return t},Tg=s=>"isThemeGetter"in s&&s.isThemeGetter===!0,Bg=s=>{if(s<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),o=Object.create(null);const n=(r,i)=>{t[r]=i,e++,e>s&&(e=0,o=t,t=Object.create(null))};return{get(r){let i=t[r];if(i!==void 0)return i;if((i=o[r])!==void 0)return n(r,i),i},set(r,i){r in t?t[r]=i:n(r,i)}}},fi="!",Jd=":",xg=[],Qd=(s,e,t,o,n)=>({modifiers:s,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:o,isExternal:n}),Cg=s=>{const{prefix:e,experimentalParseClassName:t}=s;let o=n=>{const r=[];let i=0,a=0,l=0,c;const d=n.length;for(let g=0;g<d;g++){const b=n[g];if(i===0&&a===0){if(b===Jd){r.push(n.slice(l,g)),l=g+1;continue}if(b==="/"){c=g;continue}}b==="["?i++:b==="]"?i--:b==="("?a++:b===")"&&a--}const u=r.length===0?n:n.slice(l);let h=u,p=!1;u.endsWith(fi)?(h=u.slice(0,-1),p=!0):u.startsWith(fi)&&(h=u.slice(1),p=!0);const f=c&&c>l?c-l:void 0;return Qd(r,p,h,f)};if(e){const n=e+Jd,r=o;o=i=>i.startsWith(n)?r(i.slice(n.length)):Qd(xg,!1,i,void 0,!0)}if(t){const n=o;o=r=>t({className:r,parseClassName:n})}return o},Eg=s=>{const e=new Map;return s.orderSensitiveModifiers.forEach((t,o)=>{e.set(t,1e6+o)}),t=>{const o=[];let n=[];for(let r=0;r<t.length;r++){const i=t[r],a=i[0]==="[",l=e.has(i);a||l?(n.length>0&&(n.sort(),o.push(...n),n=[]),o.push(i)):n.push(i)}return n.length>0&&(n.sort(),o.push(...n)),o}},Sg=s=>q({cache:Bg(s.cacheSize),parseClassName:Cg(s),sortModifiers:Eg(s)},pg(s)),Ag=/\s+/,Ig=(s,e)=>{const{parseClassName:t,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:r}=e,i=[],a=s.trim().split(Ag);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[c],{isExternal:u,modifiers:h,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:g}=t(d);if(u){l=d+(l.length>0?" "+l:l);continue}let b=!!g,k=o(b?f.substring(0,g):f);if(!k){if(!b){l=d+(l.length>0?" "+l:l);continue}if(k=o(f),!k){l=d+(l.length>0?" "+l:l);continue}b=!1}const y=h.length===0?"":h.length===1?h[0]:r(h).join(":"),T=p?y+fi:y,C=T+k;if(i.indexOf(C)>-1)continue;i.push(C);const N=n(k,b);for(let x=0;x<N.length;++x){const E=N[x];i.push(T+E)}l=d+(l.length>0?" "+l:l)}return l},eu=(...s)=>{let e=0,t,o,n="";for(;e<s.length;)(t=s[e++])&&(o=tu(t))&&(n&&(n+=" "),n+=o);return n},tu=s=>{if(typeof s=="string")return s;let e,t="";for(let o=0;o<s.length;o++)s[o]&&(e=tu(s[o]))&&(t&&(t+=" "),t+=e);return t},Ng=(s,...e)=>{let t,o,n,r;const i=l=>{const c=e.reduce((d,u)=>u(d),s());return t=Sg(c),o=t.cache.get,n=t.cache.set,r=a,a(l)},a=l=>{const c=o(l);if(c)return c;const d=Ig(l,t);return n(l,d),d};return r=i,(...l)=>r(eu(...l))},Rg=[],ue=s=>{const e=t=>t[s]||Rg;return e.isThemeGetter=!0,e},ou=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nu=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Og=/^\d+\/\d+$/,_g=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mg=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Lg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Dg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Pg=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nt=s=>Og.test(s),z=s=>!!s&&!Number.isNaN(Number(s)),it=s=>!!s&&Number.isInteger(Number(s)),pi=s=>s.endsWith("%")&&z(s.slice(0,-1)),Je=s=>_g.test(s),Fg=()=>!0,Hg=s=>Mg.test(s)&&!Lg.test(s),ru=()=>!1,qg=s=>Dg.test(s),zg=s=>Pg.test(s),jg=s=>!S(s)&&!A(s),Ug=s=>Rt(s,cu,ru),S=s=>ou.test(s),mt=s=>Rt(s,du,Hg),gi=s=>Rt(s,Vg,z),su=s=>Rt(s,au,ru),Kg=s=>Rt(s,lu,zg),Po=s=>Rt(s,uu,qg),A=s=>nu.test(s),Qt=s=>Ot(s,du),Wg=s=>Ot(s,Yg),iu=s=>Ot(s,au),Gg=s=>Ot(s,cu),$g=s=>Ot(s,lu),Fo=s=>Ot(s,uu,!0),Rt=(s,e,t)=>{const o=ou.exec(s);return o?o[1]?e(o[1]):t(o[2]):!1},Ot=(s,e,t=!1)=>{const o=nu.exec(s);return o?o[1]?e(o[1]):t:!1},au=s=>s==="position"||s==="percentage",lu=s=>s==="image"||s==="url",cu=s=>s==="length"||s==="size"||s==="bg-size",du=s=>s==="length",Vg=s=>s==="number",Yg=s=>s==="family-name",uu=s=>s==="shadow",j=Ng(()=>{const s=ue("color"),e=ue("font"),t=ue("text"),o=ue("font-weight"),n=ue("tracking"),r=ue("leading"),i=ue("breakpoint"),a=ue("container"),l=ue("spacing"),c=ue("radius"),d=ue("shadow"),u=ue("inset-shadow"),h=ue("text-shadow"),p=ue("drop-shadow"),f=ue("blur"),g=ue("perspective"),b=ue("aspect"),k=ue("ease"),y=ue("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...C(),A,S],x=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],w=()=>[A,S,l],_=()=>[Nt,"full","auto",...w()],F=()=>[it,"none","subgrid",A,S],O=()=>["auto",{span:["full",it,A,S]},it,A,S],Y=()=>[it,"auto",A,S],L=()=>["auto","min","max","fr",A,S],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],re=()=>["start","end","center","stretch","center-safe","end-safe"],se=()=>["auto",...w()],He=()=>[Nt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],M=()=>[s,A,S],vn=()=>[...C(),iu,su,{position:[A,S]}],Ea=()=>["no-repeat",{repeat:["","x","y","space","round"]}],yo=()=>["auto","cover","contain",Gg,Ug,{size:[A,S]}],wo=()=>[pi,Qt,mt],Be=()=>["","none","full",c,A,S],Re=()=>["",z,Qt,mt],kn=()=>["solid","dashed","dotted","double"],Bh=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ge=()=>[z,pi,iu,su],xh=()=>["","none",f,A,S],yn=()=>["none",z,A,S],wn=()=>["none",z,A,S],Sa=()=>[z,A,S],Tn=()=>[Nt,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Je],breakpoint:[Je],color:[Fg],container:[Je],"drop-shadow":[Je],ease:["in","out","in-out"],font:[jg],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Je],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Je],shadow:[Je],spacing:["px",z],text:[Je],"text-shadow":[Je],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nt,S,A,b]}],container:["container"],columns:[{columns:[z,S,A,a]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{start:_()}],end:[{end:_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[it,"auto",A,S]}],basis:[{basis:[Nt,"full","auto",a,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[z,Nt,"auto","initial","none",S]}],grow:[{grow:["",z,A,S]}],shrink:[{shrink:["",z,A,S]}],order:[{order:[it,"first","last","none",A,S]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...re(),"normal"]}],"justify-self":[{"justify-self":["auto",...re()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...re(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...re(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...re(),"baseline"]}],"place-self":[{"place-self":["auto",...re()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:se()}],mx:[{mx:se()}],my:[{my:se()}],ms:[{ms:se()}],me:[{me:se()}],mt:[{mt:se()}],mr:[{mr:se()}],mb:[{mb:se()}],ml:[{ml:se()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:He()}],w:[{w:[a,"screen",...He()]}],"min-w":[{"min-w":[a,"screen","none",...He()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...He()]}],h:[{h:["screen","lh",...He()]}],"min-h":[{"min-h":["screen","lh","none",...He()]}],"max-h":[{"max-h":["screen","lh",...He()]}],"font-size":[{text:["base",t,Qt,mt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,A,gi]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",pi,S]}],"font-family":[{font:[Wg,S,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,A,S]}],"line-clamp":[{"line-clamp":[z,"none",A,gi]}],leading:[{leading:[r,...w()]}],"list-image":[{"list-image":["none",A,S]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",A,S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...kn(),"wavy"]}],"text-decoration-thickness":[{decoration:[z,"from-font","auto",A,mt]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[z,"auto",A,S]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",A,S]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",A,S]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:vn()}],"bg-repeat":[{bg:Ea()}],"bg-size":[{bg:yo()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},it,A,S],radial:["",A,S],conic:[it,A,S]},$g,Kg]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:wo()}],"gradient-via-pos":[{via:wo()}],"gradient-to-pos":[{to:wo()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:Be()}],"rounded-s":[{"rounded-s":Be()}],"rounded-e":[{"rounded-e":Be()}],"rounded-t":[{"rounded-t":Be()}],"rounded-r":[{"rounded-r":Be()}],"rounded-b":[{"rounded-b":Be()}],"rounded-l":[{"rounded-l":Be()}],"rounded-ss":[{"rounded-ss":Be()}],"rounded-se":[{"rounded-se":Be()}],"rounded-ee":[{"rounded-ee":Be()}],"rounded-es":[{"rounded-es":Be()}],"rounded-tl":[{"rounded-tl":Be()}],"rounded-tr":[{"rounded-tr":Be()}],"rounded-br":[{"rounded-br":Be()}],"rounded-bl":[{"rounded-bl":Be()}],"border-w":[{border:Re()}],"border-w-x":[{"border-x":Re()}],"border-w-y":[{"border-y":Re()}],"border-w-s":[{"border-s":Re()}],"border-w-e":[{"border-e":Re()}],"border-w-t":[{"border-t":Re()}],"border-w-r":[{"border-r":Re()}],"border-w-b":[{"border-b":Re()}],"border-w-l":[{"border-l":Re()}],"divide-x":[{"divide-x":Re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...kn(),"hidden","none"]}],"divide-style":[{divide:[...kn(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...kn(),"none","hidden"]}],"outline-offset":[{"outline-offset":[z,A,S]}],"outline-w":[{outline:["",z,Qt,mt]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,Fo,Po]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",u,Fo,Po]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:Re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[z,mt]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":Re()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",h,Fo,Po]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[z,A,S]}],"mix-blend":[{"mix-blend":[...Bh(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Bh()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[z]}],"mask-image-linear-from-pos":[{"mask-linear-from":ge()}],"mask-image-linear-to-pos":[{"mask-linear-to":ge()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":ge()}],"mask-image-t-to-pos":[{"mask-t-to":ge()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":ge()}],"mask-image-r-to-pos":[{"mask-r-to":ge()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":ge()}],"mask-image-b-to-pos":[{"mask-b-to":ge()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":ge()}],"mask-image-l-to-pos":[{"mask-l-to":ge()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":ge()}],"mask-image-x-to-pos":[{"mask-x-to":ge()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":ge()}],"mask-image-y-to-pos":[{"mask-y-to":ge()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[A,S]}],"mask-image-radial-from-pos":[{"mask-radial-from":ge()}],"mask-image-radial-to-pos":[{"mask-radial-to":ge()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[z]}],"mask-image-conic-from-pos":[{"mask-conic-from":ge()}],"mask-image-conic-to-pos":[{"mask-conic-to":ge()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:vn()}],"mask-repeat":[{mask:Ea()}],"mask-size":[{mask:yo()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",A,S]}],filter:[{filter:["","none",A,S]}],blur:[{blur:xh()}],brightness:[{brightness:[z,A,S]}],contrast:[{contrast:[z,A,S]}],"drop-shadow":[{"drop-shadow":["","none",p,Fo,Po]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",z,A,S]}],"hue-rotate":[{"hue-rotate":[z,A,S]}],invert:[{invert:["",z,A,S]}],saturate:[{saturate:[z,A,S]}],sepia:[{sepia:["",z,A,S]}],"backdrop-filter":[{"backdrop-filter":["","none",A,S]}],"backdrop-blur":[{"backdrop-blur":xh()}],"backdrop-brightness":[{"backdrop-brightness":[z,A,S]}],"backdrop-contrast":[{"backdrop-contrast":[z,A,S]}],"backdrop-grayscale":[{"backdrop-grayscale":["",z,A,S]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[z,A,S]}],"backdrop-invert":[{"backdrop-invert":["",z,A,S]}],"backdrop-opacity":[{"backdrop-opacity":[z,A,S]}],"backdrop-saturate":[{"backdrop-saturate":[z,A,S]}],"backdrop-sepia":[{"backdrop-sepia":["",z,A,S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",A,S]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[z,"initial",A,S]}],ease:[{ease:["linear","initial",k,A,S]}],delay:[{delay:[z,A,S]}],animate:[{animate:["none",y,A,S]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,A,S]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:yn()}],"rotate-x":[{"rotate-x":yn()}],"rotate-y":[{"rotate-y":yn()}],"rotate-z":[{"rotate-z":yn()}],scale:[{scale:wn()}],"scale-x":[{"scale-x":wn()}],"scale-y":[{"scale-y":wn()}],"scale-z":[{"scale-z":wn()}],"scale-3d":["scale-3d"],skew:[{skew:Sa()}],"skew-x":[{"skew-x":Sa()}],"skew-y":[{"skew-y":Sa()}],transform:[{transform:[A,S,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Tn()}],"translate-x":[{"translate-x":Tn()}],"translate-y":[{"translate-y":Tn()}],"translate-z":[{"translate-z":Tn()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",A,S]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",A,S]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[z,Qt,mt,gi]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}}),me=eu,Xg=180,Zg=400,_t="data-blok-interface",Jg="blok",Qg="inline-toolbar",mi="tooltip",hu="[data-blok-interface=blok]",fu="[data-blok-interface=inline-toolbar]";typeof process!="undefined"&&process.platform?process.platform==="darwin"?"Meta":"Control":typeof navigator!="undefined"&&navigator.userAgent.toLowerCase().includes("mac")?"Meta":"Control";const em="data-blok-element",bi="[data-blok-element]",tm="data-blok-element-content",vi="[data-blok-element-content]",om="data-blok-editor",Ae="[data-blok-editor]",nm="data-blok-redactor",pu="[data-blok-redactor]",rm="data-blok-narrow",sm="data-blok-rtl",im="data-blok-fake-cursor",gu="[data-blok-fake-cursor]",am="data-blok-overlay",lm="data-blok-overlay-container",cm="data-blok-overlay-rectangle",dm="data-blok-toolbar",mu="[data-blok-toolbar]",um="data-blok-settings-toggler",hm="data-blok-drag-handle",fm="[data-blok-drag-handle]",Ho="data-blok-tool",pm="data-blok-stub",gm="data-blok-stub-info",mm="data-blok-stub-title",bm="data-blok-stub-subtitle",ki="data-blok-selected",yi="data-blok-stretched",vm="data-blok-empty",bu="data-blok-dragging",vu="data-blok-toolbox-opened";class R{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.fakeBackgroundElements=[]}static get anchorNode(){const e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){const e=window.getSelection();if(!e)return null;const t=e.anchorNode;return t?v.isElement(t)?t:t.parentElement:null}static get anchorOffset(){const e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){const e=window.getSelection();return e?e.isCollapsed:null}static get isAtBlok(){return this.isSelectionAtBlok(R.get())}static isSelectionAtBlok(e){if(!e)return!1;const t=e.anchorNode||e.focusNode,o=t&&t.nodeType===Node.TEXT_NODE?t.parentNode:t,n=o&&o instanceof Element?o.closest(pu):null;return n?n.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtBlok(e){if(!e)return;const t=e.startContainer&&e.startContainer.nodeType===Node.TEXT_NODE?e.startContainer.parentNode:e.startContainer,o=t&&t instanceof Element?t.closest(pu):null;return o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){const e=R.get();return!!(e!=null&&e.anchorNode)}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){const e=document.selection,t={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control"){const a=e.createRange();return t.x=a.boundingLeft,t.y=a.boundingTop,t.width=a.boundingWidth,t.height=a.boundingHeight,t}const o=window.getSelection();if(!o)return U("Method window.getSelection returned null","warn"),t;if(o.rangeCount===null||isNaN(o.rangeCount))return U("Method SelectionUtils.rangeCount is not supported","warn"),t;if(o.rangeCount===0)return t;const n=o.getRangeAt(0).cloneRange(),r=n.getBoundingClientRect();if(r.x===0&&r.y===0){const i=document.createElement("span");i.appendChild(document.createTextNode("​")),n.insertNode(i);const a=i.getBoundingClientRect(),l=i.parentNode;return l==null||l.removeChild(i),l==null||l.normalize(),a}return r}static get text(){var t;const e=window.getSelection();return(t=e==null?void 0:e.toString())!=null?t:""}static get(){return window.getSelection()}static setCursor(e,t=0){const o=document.createRange(),n=window.getSelection(),r=v.isNativeInput(e);if(r&&!v.canSetCaret(e))return e.getBoundingClientRect();if(r){const i=e;return i.focus(),i.selectionStart=t,i.selectionEnd=t,i.getBoundingClientRect()}return o.setStart(e,t),o.setEnd(e,t),n?(n.removeAllRanges(),n.addRange(o),o.getBoundingClientRect()):e.getBoundingClientRect()}static isRangeInsideContainer(e){const t=R.range;return t===null?!1:e.contains(t.startContainer)}static addFakeCursor(){const e=R.range;if(e===null)return;const t=v.make("span");t.setAttribute(im,""),t.setAttribute("data-blok-mutation-free","true"),e.collapse(),e.insertNode(t)}static isFakeCursorInsideContainer(e){return v.find(e,gu)!==null}static removeFakeCursor(e=document.body){const t=v.find(e,gu);t&&t.remove()}removeFakeBackground(){this.removeTrackedFakeBackgroundElements(),this.removeOrphanedFakeBackgroundElements(),this.isFakeBackgroundEnabled=!1}removeTrackedFakeBackgroundElements(){var r;if(!this.fakeBackgroundElements.length)return;const e=this.fakeBackgroundElements[0],t=this.fakeBackgroundElements[this.fakeBackgroundElements.length-1],o=e.firstChild,n=t.lastChild;if(this.fakeBackgroundElements.forEach(i=>{this.unwrapFakeBackground(i)}),o&&n){const i=document.createRange();i.setStart(o,0),i.setEnd(n,((r=n.textContent)==null?void 0:r.length)||0),this.savedSelectionRange=i}this.fakeBackgroundElements=[]}removeOrphanedFakeBackgroundElements(){document.querySelectorAll('[data-blok-fake-background="true"]').forEach(t=>{this.unwrapFakeBackground(t)})}setFakeBackground(){this.removeFakeBackground();const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);if(t.collapsed)return;const o=this.collectTextNodes(t);if(o.length===0)return;const n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset;if(this.fakeBackgroundElements=[],o.forEach(c=>{var k,y;const d=document.createRange(),u=c===n,h=c===i,p=u?r:0,f=(y=(k=c.textContent)==null?void 0:k.length)!=null?y:0,g=h?a:f;if(p===g)return;d.setStart(c,p),d.setEnd(c,g);const b=this.wrapRangeWithFakeBackground(d);b&&this.fakeBackgroundElements.push(b)}),!this.fakeBackgroundElements.length)return;const l=document.createRange();l.setStartBefore(this.fakeBackgroundElements[0]),l.setEndAfter(this.fakeBackgroundElements[this.fakeBackgroundElements.length-1]),e.removeAllRanges(),e.addRange(l),this.isFakeBackgroundEnabled=!0}collectTextNodes(e){const t=[],{commonAncestorContainer:o}=e;if(o.nodeType===Node.TEXT_NODE)return t.push(o),t;const n=document.createTreeWalker(o,NodeFilter.SHOW_TEXT,{acceptNode:r=>e.intersectsNode(r)&&r.textContent&&r.textContent.length>0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT});for(;n.nextNode();)t.push(n.currentNode);return t}wrapRangeWithFakeBackground(e){if(e.collapsed)return null;const t=v.make("span");t.setAttribute("data-blok-testid","fake-background"),t.setAttribute("data-blok-fake-background","true"),t.setAttribute("data-blok-mutation-free","true"),t.style.backgroundColor="#a8d6ff",t.style.color="inherit",t.style.display="inline",t.style.padding="0",t.style.margin="0";const o=e.extractContents();return o.childNodes.length===0?null:(t.appendChild(o),e.insertNode(t),t)}unwrapFakeBackground(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}save(){this.savedSelectionRange=R.range}restore(){if(!this.savedSelectionRange)return;const e=window.getSelection();e&&(e.removeAllRanges(),e.addRange(this.savedSelectionRange))}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){const e=window.getSelection();if(!e||!e.focusNode)return;const t=document.createRange();t.selectNodeContents(e.focusNode),t.collapse(!1),e.removeAllRanges(),e.addRange(t)}findParentTag(e,t,o=10){const n=window.getSelection();if(!n||!n.anchorNode||!n.focusNode)return null;const r=[n.anchorNode,n.focusNode],i=a=>{const l=(c,d)=>{if(d<=0||!c)return null;const u=c.nodeType===Node.ELEMENT_NODE&&c.tagName===e,h=!t||c.classList&&c.classList.contains(t);if(u&&h)return c;if(!c.parentNode)return null;const p=c.parentNode,f=!t||p.classList&&p.classList.contains(t);return p.tagName===e&&f?p:l(p,d-1)};return l(a,o)};for(const a of r){const l=i(a);if(l)return l}return null}expandToTag(e){const t=window.getSelection();if(!t)return;t.removeAllRanges();const o=document.createRange();o.selectNodeContents(e),t.addRange(o)}}const km=(s,e)=>{const{type:t,target:o,addedNodes:n,removedNodes:r}=s;return s.type==="attributes"&&s.attributeName==="data-blok-empty"?!1:e.contains(o)?!0:t!=="childList"?!1:Array.from(n).some(l=>l===e)?!0:Array.from(r).some(l=>l===e)},wi="redactor dom changed",eo="block changed",ku="fake cursor is about to be toggled",yu="fake cursor have been set",to="blok mobile layout toggled",Ti="block-settings-opened",Bi="block-settings-closed",ym="history:state-changed",oo=(s,e)=>{if(!s.conversionConfig)return!1;const t=s.conversionConfig[e];return V(t)||ze(t)},qo=(s,e)=>oo(s.tool,e),wu=(s,e)=>Object.entries(s).some((([t,o])=>e[t]&&dg(e[t],o))),xi=async(s,e)=>{const o=(await s.save()).data,n=e.find(r=>r.name===s.name);return n!==void 0&&!oo(n,"export")?[]:e.reduce((r,i)=>{if(!oo(i,"import")||i.toolbox===void 0)return r;const a=i.toolbox.filter(l=>{if(ae(l)||l.icon===void 0)return!1;const c=l.data!==void 0;return!(c&&wu(l.data,o)||!c&&i.name===s.name)});return r.push(Se(q({},i),{toolbox:a})),r},[])},Tu=(s,e)=>s.mergeable?s.name===e.name?!0:qo(e,"export")&&qo(s,"import"):!1,wm=async(s,e)=>{if(s.length===0)return[];if(s.length===1)return xi(s[0],e);for(const o of s){const n=e.find(r=>r.name===o.name);if(n!==void 0&&!oo(n,"export"))return[]}const t=new Set(s.map(o=>o.name));return e.reduce((o,n)=>{if(!oo(n,"import")||n.toolbox===void 0)return o;const r=n.toolbox.filter(i=>!(ae(i)||i.icon===void 0||!(i.data!==void 0)&&t.size===1&&t.has(n.name)));return r.length>0&&o.push(Se(q({},n),{toolbox:r})),o},[])},Tm=(s,e)=>{const t=e==null?void 0:e.export;return V(t)?t(s):ze(t)?s[t]:(t!==void 0&&U("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")},Bu=(s,e,t)=>{const o=e==null?void 0:e.import;return V(o)?o(s,t):ze(o)?{[o]:s}:(o!==void 0&&U("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})};var le=(s=>(s.Default="default",s.Separator="separator",s.Html="html",s))(le||{}),Qe=(s=>(s.RENDERED="rendered",s.MOVED="moved",s.UPDATED="updated",s.REMOVED="removed",s.ON_PASTE="onPaste",s))(Qe||{});const Fe=class Fe extends Zt{constructor({id:e=ag(),data:t,tool:o,readOnly:n,tunesData:r},i){super(),this.cachedInputs=[],this.lastSavedTunes={},this.toolRenderedElement=null,this.contentElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.readyResolver=null,this.unavailableTunesData={},this.inputIndex=0,this.blokEventBus=null,this.redactorDomChangedCallback=()=>{},this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(l=void 0)=>{const c=l===void 0,d=l instanceof InputEvent;!c&&!d&&this.detectToolRootChange(l),(c||d?!0:!(l.length>0&&l.every(p=>{const{addedNodes:f,removedNodes:g,target:b}=p;return[...Array.from(f),...Array.from(g),b].every(y=>{var C;const T=v.isElement(y)?y:(C=y.parentElement)!=null?C:null;return T===null?!1:T.closest('[data-blok-mutation-free="true"]')!==null})})))&&(this.dropInputsCache(),this.updateCurrentInput(),this.toggleInputsEmptyMark(),this.call("updated"),this.emit("didMutated",this))},this.ready=new Promise(l=>{this.readyResolver=l}),this.name=o.name,this.id=e,this.settings=o.settings,this.config=this.settings,this.blokEventBus=i||null,this.blockAPI=new $e(this),this.lastSavedData=t!=null?t:{},this.lastSavedTunes=r!=null?r:{},this.tool=o,this.toolInstance=o.create(t,this.blockAPI,n),this.tunes=o.tunes,this.composeTunes(r);const a=this.compose();if(a==null)throw new Error(`Tool "${this.name}" did not return a block holder element during render()`);this.holder=a,window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents(),this.toggleInputsEmptyMark()})}call(e,t){const o=this.toolInstance[e];if(V(o))try{o.call(this.toolInstance,t)}catch(n){const r=n instanceof Error?n.message:String(n);U(`Error during '${e}' call: ${r}`,"error")}}async mergeWith(e){if(!V(this.toolInstance.merge))throw new Error(`Block tool "${this.name}" does not support merging`);await this.toolInstance.merge(e)}async save(){const e=await this.extractToolData();if(e===void 0)return;const t=q({},this.unavailableTunesData);[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([r,i])=>{if(V(i.save))try{t[r]=i.save()}catch(a){U(`Tune ${i.constructor.name} save method throws an Error %o`,"warn",a)}});const o=window.performance.now();this.lastSavedData=e,this.lastSavedTunes=q({},t);const n=window.performance.now();return{id:this.id,tool:this.name,data:e,tunes:t,time:n-o}}async extractToolData(){try{const e=await this.toolInstance.save(this.pluginsContent);if(!this.isEmpty||e===void 0||e===null||typeof e!="object")return e;const t=q({},e),o=n=>{const r=t[n];if(typeof r!="string")return;const i=document.createElement("div");i.innerHTML=r,v.isEmpty(i)&&(t[n]="")};return o("text"),o("html"),t}catch(e){const t=e instanceof Error?e:new Error(String(e));U(`Saving process for ${this.name} tool failed due to the ${t}`,"log",t);return}}async validate(e){return this.toolInstance.validate instanceof Function?await this.toolInstance.validate(e):!0}getTunes(){const e=[],t=[],o=(i,a)=>{if(i){if(v.isElement(i)){a.push({type:le.Html,element:i});return}if(Array.isArray(i)){a.push(...i);return}a.push(i)}},n=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[];return o(n,e),[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(i=>i.render()).forEach(i=>{o(i,t)}),{toolTunes:e,commonTunes:t}}updateCurrentInput(){var r;const e=R.anchorNode,t=document.activeElement,o=i=>{if(!i)return;const a=i instanceof HTMLElement?i:i.parentElement;if(a===null)return;const l=this.inputs.find(u=>u===a||u.contains(a));if(l!==void 0)return l;const c=a.closest(v.allInputsSelector);if(!(c instanceof HTMLElement))return;const d=this.inputs.find(u=>u===c);if(d!==void 0)return d};if(v.isNativeInput(t)){this.currentInput=t;return}const n=(r=o(e))!=null?r:t instanceof HTMLElement?o(t):void 0;if(n!==void 0){this.currentInput=n;return}t instanceof HTMLElement&&this.inputs.includes(t)&&(this.currentInput=t)}dispatchChange(){this.didMutated()}async setData(e){const t=this.toolInstance.setData;if(typeof t=="function")try{return await t.call(this.toolInstance,e),this.lastSavedData=e,!0}catch(i){return U(`Tool ${this.name} setData failed: ${i instanceof Error?i.message:String(i)}`,"warn"),!1}const o=this.toolRenderedElement;if(!o)return!1;const n="text"in e&&typeof e.text=="string",r=o.getAttribute("contenteditable")==="true";return n&&r?(o.innerHTML=e.text,this.lastSavedData=e,this.dropInputsCache(),this.toggleInputsEmptyMark(),this.call("updated"),!0):!1}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),V(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){const e=this.tool.toolbox;if(!e)return;if(e.length===1)return Promise.resolve(e[0]);const t=await this.data;return e.find(o=>wu(o.data,t))}async exportDataAsString(){const e=await this.data;return Tm(e,this.tool.conversionConfig)}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;const e=v.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){if(e===void 0)return;const t=this.inputs.findIndex(o=>o===e||o.contains(e));t!==-1&&(this.inputIndex=t)}get firstInput(){return this.inputs[0]}get lastInput(){const e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!ae(e.data)?e.data:{})}get preservedData(){var e;return(e=this.lastSavedData)!=null?e:{}}get preservedTunes(){var e;return(e=this.lastSavedTunes)!=null?e:{}}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return V(this.toolInstance.merge)}get focusable(){return this.inputs.length!==0}get isEmpty(){const e=v.isEmpty(this.pluginsContent,"/"),t=!this.hasMedia;return e&&t}get hasMedia(){const e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set selected(e){var n,r;if(e?this.holder.setAttribute(ki,"true"):this.holder.removeAttribute(ki),this.contentElement){const i=this.stretched?Fe.styles.contentStretched:"";this.contentElement.className=e?j(Fe.styles.content,Fe.styles.contentSelected):j(Fe.styles.content,i)}const t=e===!0&&R.isRangeInsideContainer(this.holder),o=e===!1&&R.isFakeCursorInsideContainer(this.holder);!t&&!o||((n=this.blokEventBus)==null||n.emit(ku,{state:e}),t&&R.addFakeCursor(),o&&R.removeFakeCursor(this.holder),(r=this.blokEventBus)==null||r.emit(yu,{state:e}))}get selected(){return this.holder.getAttribute(ki)==="true"}setStretchState(e){e?this.holder.setAttribute(yi,"true"):this.holder.removeAttribute(yi),this.contentElement&&!this.selected&&(this.contentElement.className=e?j(Fe.styles.content,Fe.styles.contentStretched):Fe.styles.content)}set stretched(e){this.setStretchState(e)}get stretched(){return this.holder.getAttribute(yi)==="true"}get pluginsContent(){if(this.toolRenderedElement===null)throw new Error("Block pluginsContent is not yet initialized");return this.toolRenderedElement}compose(){var r;const e=v.make("div",Fe.styles.wrapper),t=v.make("div",Fe.styles.content);this.contentElement=t,e.setAttribute(em,""),t.setAttribute(tm,""),t.setAttribute("data-blok-testid","block-content");const o=this.toolInstance.render();e.setAttribute("data-blok-testid","block-wrapper"),this.name&&!e.hasAttribute("data-blok-component")&&e.setAttribute("data-blok-component",this.name),e.setAttribute("data-blok-id",this.id),o instanceof Promise?o.then(i=>{var a;this.toolRenderedElement=i,this.addToolDataAttributes(i,e),t.appendChild(i),(a=this.readyResolver)==null||a.call(this)}).catch(i=>{var a;U("Tool render promise rejected: %o","error",i),(a=this.readyResolver)==null||a.call(this)}):(this.toolRenderedElement=o,this.addToolDataAttributes(o,e),t.appendChild(o),(r=this.readyResolver)==null||r.call(this));const n=[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].reduce((i,a)=>{if(V(a.wrap))try{return a.wrap(i)}catch(l){return U(`Tune ${a.constructor.name} wrap method throws an Error %o`,"warn",l),i}return i},t);return e.appendChild(n),e}addToolDataAttributes(e,t){var a;this.name&&!t.hasAttribute("data-blok-component")&&t.setAttribute("data-blok-component",this.name);const o="data-blok-placeholder",n=(a=this.config)==null?void 0:a.placeholder,r=typeof n=="string"?n.trim():"",i=["empty:before:pointer-events-none","empty:before:text-gray-text","empty:before:cursor-text","empty:before:content-[attr(data-blok-placeholder)]","[&[data-blok-empty=true]]:before:pointer-events-none","[&[data-blok-empty=true]]:before:text-gray-text","[&[data-blok-empty=true]]:before:cursor-text","[&[data-blok-empty=true]]:before:content-[attr(data-blok-placeholder)]"];if(r.length>0){e.setAttribute(o,r),e.classList.add(...i);return}n===!1&&e.hasAttribute(o)&&e.removeAttribute(o)}composeTunes(e){Array.from(this.tunes.values()).forEach(t=>{(t.isInternal?this.defaultTunesInstances:this.tunesInstances).set(t.name,t.create(e[t.name],this.blockAPI))}),Object.entries(e).forEach(([t,o])=>{this.tunesInstances.has(t)||(this.unavailableTunesData[t]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),v.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),v.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=t=>{const{mutations:o}=t,n=this.toolRenderedElement;if(n===null)return;const r=o.filter(i=>km(i,n));r.length>0&&this.didMutated(r)},(e=this.blokEventBus)==null||e.on(wi,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.blokEventBus)==null||e.off(wi,this.redactorDomChangedCallback)}refreshToolRootElement(){const e=this.holder.querySelector(vi);if(!e)return;const t=e.firstElementChild;t&&t!==this.toolRenderedElement&&(this.toolRenderedElement=t,this.dropInputsCache())}detectToolRootChange(e){const t=this.toolRenderedElement;t!==null&&e.forEach(o=>{if(Array.from(o.removedNodes).includes(t)){const r=o.addedNodes[o.addedNodes.length-1];this.toolRenderedElement=r}})}dropInputsCache(){this.cachedInputs=[]}toggleInputsEmptyMark(){this.inputs.forEach(Gd)}};Fe.styles={wrapper:"relative opacity-100 animate-fade-in first:mt-0 [&_a]:cursor-pointer [&_a]:underline [&_a]:text-link [&_b]:font-bold [&_i]:italic",content:"relative mx-auto transition-colors duration-150 ease-out max-w-content",contentSelected:"bg-selection [&_[contenteditable]]:select-none [&_img]:opacity-55 [&_[data-blok-tool=stub]]:opacity-55",contentStretched:"max-w-none"};let no=Fe;class Bm extends K{constructor(){super(...arguments),this.insert=(e,t={},o={},n,r,i,a)=>{const l=e!=null?e:this.config.defaultBlock,c=this.Blok.BlockManager.insert({id:a,tool:l,data:t,index:n,needToFocus:r,replace:i});return new $e(c)},this.composeBlockData=async e=>{const t=this.Blok.Tools.blockTools.get(e);if(t===void 0)throw new Error(`Block Tool with type "${e}" not found`);return new no({tool:t,api:this.Blok.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,t,o)=>{const{BlockManager:n}=this.Blok,r=n.getBlockById(e);if(r===void 0)throw new Error(`Block with id "${e}" not found`);const i=await n.update(r,t,o);return new $e(i)},this.convert=async(e,t,o)=>{var u,h;const{BlockManager:n,Tools:r}=this.Blok,i=n.getBlockById(e);if(!i)throw new Error(`Block with id "${e}" not found`);const a=r.blockTools.get(i.name),l=r.blockTools.get(t);if(!l)throw new Error(`Block Tool with type "${t}" not found`);const c=((u=a==null?void 0:a.conversionConfig)==null?void 0:u.export)!==void 0,d=((h=l.conversionConfig)==null?void 0:h.import)!==void 0;if(c&&d){const p=await n.convert(i,t,o);return new $e(p)}else{const p=[c?!1:Lo(i.name),d?!1:Lo(t)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${i.name}" to "${t}" is not possible. ${p} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,t=this.Blok.BlockManager.blocks.length-1)=>{this.validateIndex(t);const o=e.map(({id:n,type:r,data:i})=>this.Blok.BlockManager.composeBlock({id:n,tool:r||this.config.defaultBlock,data:i}));return this.Blok.BlockManager.insertMany(o,t),o.map(n=>new $e(n))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),move:(e,t)=>this.move(e,t),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),getBlockByElement:e=>this.getBlockByElement(e),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert,stretchBlock:(e,t=!0)=>this.stretchBlock(e,t)}}getBlocksCount(){return this.Blok.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Blok.BlockManager.currentBlockIndex}getBlockIndex(e){const t=this.Blok.BlockManager.getBlockById(e);if(!t){Me("There is no block with id `"+e+"`","warn");return}return this.Blok.BlockManager.getBlockIndex(t)}getBlockByIndex(e){const t=this.Blok.BlockManager.getBlockByIndex(e);if(t===void 0){Me("There is no block at index `"+e+"`","warn");return}return new $e(t)}getById(e){const t=this.Blok.BlockManager.getBlockById(e);return t===void 0?(Me("There is no block with id `"+e+"`","warn"),null):new $e(t)}getBlockByElement(e){const t=this.Blok.BlockManager.getBlock(e);if(t===void 0){Me("There is no block corresponding to element `"+e+"`","warn");return}return new $e(t)}move(e,t){this.Blok.BlockManager.move(e,t)}delete(e=this.Blok.BlockManager.currentBlockIndex){const t=this.Blok.BlockManager.getBlockByIndex(e);if(t===void 0){Me(`There is no block at index \`${e}\``,"warn");return}try{this.Blok.BlockManager.removeBlock(t)}catch(o){Me(o,"warn");return}this.Blok.BlockManager.blocks.length===0&&this.Blok.BlockManager.insert(),this.Blok.BlockManager.currentBlock&&this.Blok.Caret.setToBlock(this.Blok.BlockManager.currentBlock,this.Blok.Caret.positions.END),this.Blok.Toolbar.close()}async clear(){await this.Blok.BlockManager.clear(!0),this.Blok.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");this.Blok.ModificationsObserver.disable(),await this.Blok.BlockManager.clear(),await this.Blok.Renderer.render(e.blocks),this.Blok.ModificationsObserver.enable()}async renderFromHTML(e){return await this.Blok.BlockManager.clear(),this.Blok.Paste.processText(e,!0)}stretchBlock(e,t=!0){const o=this.Blok.BlockManager.getBlockByIndex(e);o&&o.setStretchState(t)}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}}const xm=(s,e)=>typeof s=="number"?e.BlockManager.getBlockByIndex(s):typeof s=="string"?e.BlockManager.getBlockById(s):e.BlockManager.getBlockById(s.id);class Cm extends K{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Blok.Caret.positions.DEFAULT,t=0)=>this.Blok.BlockManager.firstBlock?(this.Blok.Caret.setToBlock(this.Blok.BlockManager.firstBlock,e,t),!0):!1,this.setToLastBlock=(e=this.Blok.Caret.positions.DEFAULT,t=0)=>this.Blok.BlockManager.lastBlock?(this.Blok.Caret.setToBlock(this.Blok.BlockManager.lastBlock,e,t),!0):!1,this.setToPreviousBlock=(e=this.Blok.Caret.positions.DEFAULT,t=0)=>this.Blok.BlockManager.previousBlock?(this.Blok.Caret.setToBlock(this.Blok.BlockManager.previousBlock,e,t),!0):!1,this.setToNextBlock=(e=this.Blok.Caret.positions.DEFAULT,t=0)=>this.Blok.BlockManager.nextBlock?(this.Blok.Caret.setToBlock(this.Blok.BlockManager.nextBlock,e,t),!0):!1,this.setToBlock=(e,t=this.Blok.Caret.positions.DEFAULT,o=0)=>{const n=xm(e,this.Blok);return n===void 0?!1:(this.Blok.Caret.setToBlock(n,t,o),!0)},this.focus=(e=!1)=>e?this.setToLastBlock(this.Blok.Caret.positions.END):this.setToFirstBlock(this.Blok.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}}class Em extends K{get methods(){return{emit:(e,t)=>this.emit(e,t),off:(e,t)=>this.off(e,t),on:(e,t)=>this.on(e,t)}}on(e,t){this.eventsDispatcher.on(e,t)}emit(e,t){this.eventsDispatcher.emit(e,t)}off(e,t){this.eventsDispatcher.off(e,t)}}class Ci extends K{static getNamespace(e,t){return t?`blockTunes.${e}`:`tools.${e}`}get methods(){return{t:e=>(Me("I18n.t() method can be accessed only from Tools","warn"),"")}}getMethodsForTool(e,t){return Object.assign(this.methods,{t:o=>oe.t(Ci.getNamespace(e,t),o)})}}class Sm extends K{get methods(){return{blocks:this.Blok.BlocksAPI.methods,caret:this.Blok.CaretAPI.methods,tools:this.Blok.ToolsAPI.methods,events:this.Blok.EventsAPI.methods,history:this.Blok.HistoryAPI.methods,listeners:this.Blok.ListenersAPI.methods,notifier:this.Blok.NotifierAPI.methods,sanitizer:this.Blok.SanitizerAPI.methods,saver:this.Blok.SaverAPI.methods,selection:this.Blok.SelectionAPI.methods,styles:this.Blok.StylesAPI.classes,toolbar:this.Blok.ToolbarAPI.methods,inlineToolbar:this.Blok.InlineToolbarAPI.methods,tooltip:this.Blok.TooltipAPI.methods,i18n:this.Blok.I18nAPI.methods,readOnly:this.Blok.ReadOnlyAPI.methods,ui:this.Blok.UiAPI.methods}}getMethodsForTool(e,t){return Object.assign(this.methods,{i18n:this.Blok.I18nAPI.getMethodsForTool(e,t)})}}class Am extends K{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Blok.InlineToolbar.tryToShow()}close(){this.Blok.InlineToolbar.close()}}class Im extends K{get methods(){return{on:(e,t,o,n)=>this.on(e,t,o,n),off:(e,t,o,n)=>this.off(e,t,o,n),offById:e=>this.offById(e)}}on(e,t,o,n){return this.listeners.on(e,t,o,n)}off(e,t,o,n){this.listeners.off(e,t,o,n)}offById(e){this.listeners.offById(e)}}class Nm{constructor(){this.notifierModule=null,this.loadingPromise=null}loadNotifierModule(){return this.notifierModule!==null?Promise.resolve(this.notifierModule):(this.loadingPromise===null&&(this.loadingPromise=Promise.resolve().then(()=>nk).then(e=>{var o;const t=(o=e==null?void 0:e.default)!=null?o:e;if(!this.isNotifierModule(t))throw new Error('notifier module does not expose a "show" method.');return this.notifierModule=t,t}).catch(e=>{throw this.loadingPromise=null,e})),this.loadingPromise)}show(e){this.loadNotifierModule().then(t=>{t.show(e)}).catch(t=>{console.error("[Blok] Failed to display notification. Reason:",t)})}isNotifierModule(e){return typeof e=="object"&&e!==null&&"show"in e&&typeof e.show=="function"}}class Rm extends K{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.notifier=new Nm}get methods(){return{show:e=>this.show(e)}}show(e){return this.notifier.show(e)}}class Om extends K{get methods(){const e=()=>this.isEnabled;return{toggle:t=>this.toggle(t),get isEnabled(){return e()}}}toggle(e){return this.Blok.ReadOnly.toggle(e)}get isEnabled(){return this.Blok.ReadOnly.isEnabled}}var zo={exports:{}},_m=zo.exports,xu;function Mm(){return xu||(xu=1,(function(s,e){(function(t,o){s.exports=o()})(_m,function(){function t(u){var h=u.tags,p=Object.keys(h),f=p.map(function(g){return typeof h[g]}).every(function(g){return g==="object"||g==="boolean"||g==="function"});if(!f)throw new Error("The configuration was invalid");this.config=u}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function n(u){return o.indexOf(u.nodeName)!==-1}var r=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function i(u){return r.indexOf(u.nodeName)!==-1}t.prototype.clean=function(u){const h=document.implementation.createHTMLDocument(),p=h.createElement("div");return p.innerHTML=u,this._sanitize(h,p),p.innerHTML},t.prototype._sanitize=function(u,h){var p=a(u,h),f=p.firstChild();if(f)do{if(f.nodeType===Node.TEXT_NODE)if(f.data.trim()===""&&(f.previousElementSibling&&n(f.previousElementSibling)||f.nextElementSibling&&n(f.nextElementSibling))){h.removeChild(f),this._sanitize(u,h);break}else continue;if(f.nodeType===Node.COMMENT_NODE){h.removeChild(f),this._sanitize(u,h);break}var g=i(f),b;g&&(b=Array.prototype.some.call(f.childNodes,n));var k=!!h.parentNode,y=n(h)&&n(f)&&k,T=f.nodeName.toLowerCase(),C=l(this.config,T,f),N=g&&b;if(N||c(f,C)||!this.config.keepNestedBlockElements&&y){if(!(f.nodeName==="SCRIPT"||f.nodeName==="STYLE"))for(;f.childNodes.length>0;)h.insertBefore(f.childNodes[0],f);h.removeChild(f),this._sanitize(u,h);break}for(var x=0;x<f.attributes.length;x+=1){var E=f.attributes[x];d(E,C,f)&&(f.removeAttribute(E.name),x=x-1)}this._sanitize(u,f)}while(f=p.nextSibling())};function a(u,h){return u.createTreeWalker(h,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function l(u,h,p){return typeof u.tags[h]=="function"?u.tags[h](p):u.tags[h]}function c(u,h){return typeof h=="undefined"?!0:typeof h=="boolean"?!h:!1}function d(u,h,p){var f=u.name.toLowerCase();return h===!0?!1:typeof h[f]=="function"?!h[f](u.value,p):typeof h[f]=="undefined"||h[f]===!1?!0:typeof h[f]=="string"?h[f]!==u.value:!1}return t})})(zo)),zo.exports}var Lm=Mm();const Dm=$(Lm),Pm=/^\s*(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)/i,Fm=/\s*(?:href|src)\s*=\s*(?:"\s*(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)[^"]*"|'\s*(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)[^']*|(?:javascript\s*:|data\s*:\s*text\s*\/\s*html)[^ \t\r\n>]*)/gi,Ei=(s,e,t={})=>s.map(o=>{const n=V(e)?e(o.tool):e,r=n!=null?n:{};return Z(r)&&ae(r)&&ae(t)?o:Se(q({},o),{data:Si(o.data,r,t)})}),Ve=(s,e={})=>{const t={tags:e};return new Dm(t).clean(s)},Si=(s,e,t)=>Array.isArray(s)?Hm(s,e,t):Z(s)?qm(s,e,t):ze(s)?zm(s,e,t):s,Hm=(s,e,t)=>s.map(o=>Si(o,e,t)),qm=(s,e,t)=>{const o={},n=s;for(const r in s){if(!Object.prototype.hasOwnProperty.call(s,r))continue;const i=n[r],a=Z(e)?e:void 0,l=a==null?void 0:a[r],c=l!==void 0&&jm(l)?l:e;o[r]=Si(i,c,t)}return o},zm=(s,e,t)=>{const o=Vm(e,t);if(o){const n=Ve(s,o);return Ai(Eu(n,o))}if(!ae(t)){const n=Ve(s,t);return Ai(Eu(n,t))}return Ai(s)},jm=s=>Z(s)||Hd(s)||V(s),Um=s=>s?Pm.test(s):!1,Ai=s=>{if(!s||s.indexOf("<")===-1)return s;if(typeof document!="undefined"){const e=document.createElement("template");return e.innerHTML=s,e.content.querySelectorAll("[href],[src]").forEach(o=>{["href","src"].forEach(n=>{const r=o.getAttribute(n);Um(r)&&o.removeAttribute(n)})}),e.innerHTML}return s.replace(Fm,"")},Ii=s=>{if(ae(s))return{};const e={};for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=bt(s[t]));return e},Cu=s=>function(t){const o=s.call(this,t);return o==null?{}:o},Km=new Set(["class","id","title","role","dir","lang"]),Wm=s=>{const e=s.toLowerCase();return e.startsWith("data-")||e.startsWith("aria-")||Km.has(e)},Gm=s=>{const e={};return Array.from(s.attributes).forEach(t=>{Wm(t.name)&&(e[t.name]=!0)}),e},bt=s=>s===!0?Cu(Gm):s===!1?!1:V(s)?Cu(s):ze(s)?s:Z(s)?Yt({},s):s,$m=(s,e)=>{if(ae(s))return Ii(e);const t={};for(const o in s){if(!Object.prototype.hasOwnProperty.call(s,o))continue;const n=s[o],r=e?e[o]:void 0;if(V(r)){t[o]=bt(r);continue}if(V(n)){t[o]=bt(n);continue}if(Z(n)&&Z(r)){t[o]=Yt({},r,n);continue}if(r!==void 0){t[o]=bt(r);continue}t[o]=bt(n)}return t},Vm=(s,e)=>Z(s)&&!V(s)?$m(e,s):s===!1?{}:ae(e)?null:Ii(e),Ni=(s,...e)=>{if(ae(s))return Object.assign({},...e);const t=Ii(s);return e.forEach(o=>{if(o)for(const n in o){if(!Object.prototype.hasOwnProperty.call(o,n))continue;const r=o[n];if(!Object.prototype.hasOwnProperty.call(t,n))continue;const i=t[n];if(V(r)){t[n]=r;continue}if(!(r===!0&&V(i))){if(r===!0){const a=Z(i)&&!V(i);t[n]=a?Yt({},i):bt(r);continue}if(Z(r)&&Z(i)){t[n]=Yt({},i,r);continue}t[n]=bt(r)}}}),t},Eu=(s,e)=>{if(typeof document=="undefined"||!s||s.indexOf("<")===-1)return s;const t=Object.entries(e).filter(([,n])=>V(n));if(t.length===0)return s;const o=document.createElement("template");return o.innerHTML=s,t.forEach(([n,r])=>{o.content.querySelectorAll(n).forEach(a=>{const l=r(a);if(!(Hd(l)||V(l)||l==null))for(const[c,d]of Object.entries(l)){if(d===!1){a.removeAttribute(c);continue}d!==!0&&ze(d)&&a.setAttribute(c,d)}})}),o.innerHTML};class Ym extends K{get methods(){return{clean:(e,t)=>this.clean(e,t)}}clean(e,t){return Ve(e,t)}}class Xm extends K{get methods(){return{save:()=>this.save()}}async save(){var r,i;const e="Blok's content can not be saved in read-only mode";if(this.Blok.ReadOnly.isEnabled)throw Me(e,"warn"),new Error(e);const t=await this.Blok.Saver.save();if(t!==void 0)return t;const o=(i=(r=this.Blok.Saver).getLastSaveError)==null?void 0:i.call(r);if(o instanceof Error)throw o;const n=o!==void 0?String(o):"Blok's content can not be saved because collecting data failed";throw new Error(n)}}class Zm extends K{constructor(){super(...arguments),this.selectionUtils=new R}get methods(){return{findParentTag:(e,t)=>this.findParentTag(e,t),expandToTag:e=>this.expandToTag(e),save:()=>this.selectionUtils.save(),restore:()=>this.selectionUtils.restore(),setFakeBackground:()=>this.selectionUtils.setFakeBackground(),removeFakeBackground:()=>this.selectionUtils.removeFakeBackground()}}findParentTag(e,t){return this.selectionUtils.findParentTag(e,t)}expandToTag(e){this.selectionUtils.expandToTag(e)}}class Jm extends K{get methods(){return{getBlockTools:()=>Array.from(this.Blok.Tools.blockTools.values())}}}class Qm extends K{get classes(){return{block:"blok-block",inlineToolButton:"blok-inline-tool-button",inlineToolButtonActive:"blok-inline-tool-button--active",input:"blok-input",loader:"blok-loader",button:"blok-button",settingsButton:"blok-settings-button",settingsButtonActive:"blok-settings-button--active",settingsButtonFocused:"blok-settings-button--focused",settingsButtonFocusedAnimated:"blok-settings-button--focused-animated"}}}class eb extends K{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Blok.Toolbar.moveAndOpen()}close(){this.Blok.Toolbar.close()}toggleBlockSettings(e){if(this.Blok.BlockManager.currentBlockIndex===-1){Me("Could't toggle the Toolbar because there is no block selected ","warn");return}(e!=null?e:!this.Blok.BlockSettings.opened)?(this.Blok.Toolbar.moveAndOpen(),this.Blok.BlockSettings.open()):this.Blok.BlockSettings.close()}toggleToolbox(e){if(this.Blok.BlockManager.currentBlockIndex===-1){Me("Could't toggle the Toolbox because there is no block selected ","warn");return}(e!=null?e:!this.Blok.Toolbar.toolbox.opened)?(this.Blok.Toolbar.moveAndOpen(),this.Blok.Toolbar.toolbox.open()):this.Blok.Toolbar.toolbox.close()}}const Ri=10,tb="tooltip",ob="aria-hidden",nb="false",rb="true",sb="visibility",ib="visible",ab="hidden",ft=class ft{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=Ri,this.offsetLeft=Ri,this.offsetRight=Ri,this.showingTimeout=null,this.hidingDelay=0,this.hidingTimeout=null,this.ariaObserver=null,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:me("absolute z-overlay top-0 left-0","bg-tooltip-bg opacity-0","select-none pointer-events-none","transition-[opacity,transform] duration-[50ms,70ms] ease-in","rounded-lg shadow-tooltip","will-change-[opacity,top,left]","before:content-[''] before:absolute before:inset-0 before:bg-tooltip-bg before:-z-10 before:rounded-lg","mobile:hidden").split(" "),tooltipContent:me("px-2.5 py-1.5","text-tooltip-font text-xs text-center","tracking-[0.02em] leading-[1em]").split(" "),tooltipShown:["opacity-100","transform-none"],placement:{left:["-translate-x-[5px]"],bottom:["translate-y-[5px]"],right:["translate-x-[5px]"],top:["-translate-y-[5px]"]}}}static getInstance(){return ft.instance||(ft.instance=new ft),ft.instance}show(e,t,o={}){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&(clearTimeout(this.hidingTimeout),this.hidingTimeout=null);const r=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},o);if(r.hidingDelay&&(this.hidingDelay=r.hidingDelay),!this.nodes.content||(this.nodes.content.innerHTML="",this.nodes.content.appendChild(this.createContentNode(t)),!this.nodes.wrapper))return;const i=Object.values(this.CSS.placement).flatMap(a=>Array.isArray(a)?a:[a]);switch(this.nodes.wrapper.classList.remove(...i),r.placement){case"top":this.placeTop(e,r);break;case"left":this.placeLeft(e,r);break;case"right":this.placeRight(e,r);break;case"bottom":default:this.placeBottom(e,r);break}if(r&&r.delay){this.showingTimeout=setTimeout(()=>{if(this.nodes.wrapper){const a=Array.isArray(this.CSS.tooltipShown)?this.CSS.tooltipShown:[this.CSS.tooltipShown];this.nodes.wrapper.classList.add(...a),this.updateTooltipVisibility()}this.showed=!0},r.delay);return}if(this.nodes.wrapper){const a=Array.isArray(this.CSS.tooltipShown)?this.CSS.tooltipShown:[this.CSS.tooltipShown];this.nodes.wrapper.classList.add(...a),this.updateTooltipVisibility()}this.showed=!0}createContentNode(e){if(typeof e=="string")return document.createTextNode(e);if(e instanceof Node)return e;throw Error("[Blok Tooltip] Wrong type of «content» passed. It should be an instance of Node or String. But "+typeof e+" given.")}hide(e=!1){const t=!!this.hidingDelay&&!e;if(t&&this.hidingTimeout&&clearTimeout(this.hidingTimeout),t){this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay);return}if(this.nodes.wrapper){const o=Array.isArray(this.CSS.tooltipShown)?this.CSS.tooltipShown:[this.CSS.tooltipShown];this.nodes.wrapper.classList.remove(...o),this.updateTooltipVisibility()}this.showed=!1,this.showingTimeout&&(clearTimeout(this.showingTimeout),this.showingTimeout=null)}onHover(e,t,o={}){e.addEventListener("mouseenter",()=>{const n=document.querySelector('[data-blok-popover-opened="true"]');n!==null&&!n.contains(e)||this.show(e,t,o)}),e.addEventListener("mouseleave",()=>{this.hide()})}destroy(){var e;(e=this.ariaObserver)==null||e.disconnect(),this.ariaObserver=null,this.nodes.wrapper&&this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll),ft.instance=null}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.wrapper.setAttribute(_t,mi),this.nodes.wrapper.setAttribute("data-blok-testid","tooltip"),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.nodes.content.setAttribute("data-blok-testid","tooltip-content"),this.nodes.wrapper&&this.nodes.content&&(this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper),this.ensureTooltipAttributes())}updateTooltipVisibility(){if(!this.nodes.wrapper)return;const e=Array.isArray(this.CSS.tooltipShown)?this.CSS.tooltipShown[0]:this.CSS.tooltipShown,t=this.nodes.wrapper.classList.contains(e);this.nodes.wrapper.style.setProperty(sb,t?ib:ab),this.nodes.wrapper.setAttribute(ob,t?nb:rb),this.nodes.wrapper.setAttribute("data-blok-shown",t?"true":"false")}watchTooltipVisibility(){var e;this.nodes.wrapper&&((e=this.ariaObserver)==null||e.disconnect(),this.updateTooltipVisibility(),this.ariaObserver=new MutationObserver(()=>{this.updateTooltipVisibility()}),this.ariaObserver.observe(this.nodes.wrapper,{attributes:!0,attributeFilter:["class"]}))}ensureTooltipAttributes(){this.nodes.wrapper&&((!this.nodes.wrapper.hasAttribute(_t)||this.nodes.wrapper.getAttribute(_t)!==mi)&&this.nodes.wrapper.setAttribute(_t,mi),this.nodes.wrapper.setAttribute("role",tb),this.watchTooltipVisibility())}placeBottom(e,t){var i;if(!this.nodes.wrapper)return;const o=e.getBoundingClientRect(),n=o.left+e.clientWidth/2-this.nodes.wrapper.offsetWidth/2,r=o.bottom+this.getScrollTop()+this.offsetTop+((i=t.marginTop)!=null?i:0);this.applyPlacement("bottom",n,r)}placeTop(e,t){if(!this.nodes.wrapper)return;const o=e.getBoundingClientRect(),n=o.left+e.clientWidth/2-this.nodes.wrapper.offsetWidth/2,r=o.top+this.getScrollTop()-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",n,r)}placeLeft(e,t){var i;if(!this.nodes.wrapper)return;const o=e.getBoundingClientRect(),n=o.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-((i=t.marginLeft)!=null?i:0),r=o.top+this.getScrollTop()+e.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",n,r)}placeRight(e,t){var i;if(!this.nodes.wrapper)return;const o=e.getBoundingClientRect(),n=o.right+this.offsetRight+((i=t.marginRight)!=null?i:0),r=o.top+this.getScrollTop()+e.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",n,r)}applyPlacement(e,t,o){if(!this.nodes.wrapper)return;const n=Array.isArray(this.CSS.placement[e])?this.CSS.placement[e]:[this.CSS.placement[e]];this.nodes.wrapper.classList.add(...n),this.nodes.wrapper.setAttribute("data-blok-placement",e),this.nodes.wrapper.style.left=`${t}px`,this.nodes.wrapper.style.top=`${o}px`}getScrollTop(){var e,t,o;return typeof window.scrollY=="number"?window.scrollY:(o=(t=(e=document.documentElement)==null?void 0:e.scrollTop)!=null?t:document.body.scrollTop)!=null?o:0}make(e,t=null,o={}){const n=document.createElement(e);Array.isArray(t)&&n.classList.add(...t),typeof t=="string"&&n.classList.add(t);for(const r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r]);return n}append(e,t){Array.isArray(t)?t.forEach(o=>e.appendChild(o)):e.appendChild(t)}prepend(e,t){Array.isArray(t)?t.reverse().forEach(n=>e.prepend(n)):e.prepend(t)}};ft.instance=null;let Oi=ft;const jo=()=>Oi.getInstance(),lb=(s,e,t)=>{jo().show(s,e,t!=null?t:{})},ro=(s=!1)=>{jo().hide(s)},Uo=(s,e,t)=>{jo().onHover(s,e,t!=null?t:{})},cb=()=>{jo().destroy()};class db extends K{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t})}get methods(){return{show:(e,t,o)=>this.show(e,t,o),hide:()=>this.hide(),onHover:(e,t,o)=>this.onHover(e,t,o)}}show(e,t,o){lb(e,t,o)}hide(){ro()}onHover(e,t,o){Uo(e,t,o)}}class ub extends K{get methods(){return{nodes:this.blokNodes}}get blokNodes(){return{wrapper:this.Blok.UI.nodes.wrapper,redactor:this.Blok.UI.nodes.redactor}}}class hb extends K{get methods(){return{undo:()=>this.undo(),redo:()=>this.redo(),canUndo:()=>this.canUndo(),canRedo:()=>this.canRedo(),clear:()=>this.clear(),captureInitialState:()=>this.captureInitialState()}}async undo(){return this.Blok.History.undo()}async redo(){return this.Blok.History.redo()}canUndo(){return this.Blok.History.canUndo()}canRedo(){return this.Blok.History.canRedo()}clear(){this.Blok.History.clear()}async captureInitialState(){return this.Blok.History.captureInitialState()}}const Su=(s,e)=>{const t={};return Object.entries(s).forEach(([o,n])=>{if(!Z(n)){t[o]=n;return}const r=e?`${e}.${o}`:o;if(!Object.values(n).every(a=>ze(a))){t[o]=Su(n,r);return}t[o]=r}),t},he=Su($d),xt=class xt{constructor(e,t){this.cursor=-1,this.items=[],this.items=e!=null?e:[],this.focusedCssClass=t}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(e){e<this.items.length&&e>=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass),this.items[this.cursor].setAttribute("data-blok-focused","true"))}setItems(e){this.items=e}hasItems(){return this.items.length>0}next(){this.cursor=this.leafNodesAndReturnIndex(xt.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(xt.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.items[this.cursor].removeAttribute("data-blok-focused"),this.cursor=-1)}leafNodesAndReturnIndex(e){if(this.items.length===0)return this.cursor;const t=e===xt.directions.RIGHT?-1:0,o=this.cursor===-1?t:this.cursor;o!==-1&&(this.items[o].classList.remove(this.focusedCssClass),this.items[o].removeAttribute("data-blok-focused"));const n=e===xt.directions.RIGHT?(o+1)%this.items.length:(this.items.length+o-1)%this.items.length;return v.canSetCaret(this.items[n])&&Mo(()=>R.setCursor(this.items[n]),50)(),this.items[n].classList.add(this.focusedCssClass),this.items[n].setAttribute("data-blok-focused","true"),n}};xt.directions={RIGHT:"right",LEFT:"left"};let vt=xt;class at{constructor(e){var t,o;this.iterator=null,this.activated=!1,this.skipNextTabFocus=!1,this.flipCallbacks=[],this.onKeyDown=n=>{var c,d;const r=n.target;if(this.shouldSkipTarget(r,n))return;const i=this.getKeyCode(n),a=i===I.LEFT||i===I.RIGHT||i===I.UP||i===I.DOWN;if(!(n.shiftKey&&a||!this.isEventReadyForHandling(n))&&!(i===I.ENTER&&!((c=this.iterator)!=null&&c.currentItem)))switch(n.stopPropagation(),n.stopImmediatePropagation(),i!==null&&at.usedKeys.includes(i)&&n.preventDefault(),i){case I.TAB:this.handleTabPress(n);break;case I.LEFT:this.onArrowLeftCallback&&this.onArrowLeftCallback();break;case I.UP:this.flipLeft();break;case I.RIGHT:(d=this.iterator)!=null&&d.currentItem&&this.currentItemHasChildren()&&this.handleEnterPress(n);break;case I.DOWN:this.flipRight();break;case I.ENTER:this.handleEnterPress(n);break}},this.iterator=new vt(e.items||[],(t=e.focusedItemClass)!=null?t:""),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||at.usedKeys,this.handleContentEditableTargets=(o=e.handleContentEditableTargets)!=null?o:!1,this.onArrowLeftCallback=e.onArrowLeft}get isActivated(){return this.activated}static get usedKeys(){return[I.TAB,I.LEFT,I.RIGHT,I.ENTER,I.UP,I.DOWN]}activate(e,t){var o,n;this.activated=!0,e&&((o=this.iterator)==null||o.setItems(e)),t!==void 0&&((n=this.iterator)==null||n.setCursor(t)),document.addEventListener("keydown",this.onKeyDown,!0),window.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),this.skipNextTabFocus=!1,document.removeEventListener("keydown",this.onKeyDown,!0),window.removeEventListener("keydown",this.onKeyDown,!0)}focusFirst(){this.dropCursor(),this.flipRight()}focusItem(e){const t=this.iterator;if(t&&t.hasItems()){if(e<0){t.dropCursor();return}!t.currentItem&&e===0&&(this.skipNextTabFocus=!0),t.setCursor(e)}}flipLeft(){var e;(e=this.iterator)==null||e.previous(),this.flipCallback()}flipRight(){var e;(e=this.iterator)==null||e.next(),this.flipCallback()}hasFocus(){var e;return!!((e=this.iterator)!=null&&e.currentItem)}currentItemHasChildren(){var t;const e=(t=this.iterator)==null?void 0:t.currentItem;return e?e.hasAttribute("data-blok-has-children"):!1}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(t=>t!==e)}dropCursor(){var e;(e=this.iterator)==null||e.dropCursor()}getKeyCode(e){var o;return(o={Tab:I.TAB,Enter:I.ENTER,ArrowLeft:I.LEFT,ArrowRight:I.RIGHT,ArrowUp:I.UP,ArrowDown:I.DOWN}[e.key])!=null?o:null}isEventReadyForHandling(e){const t=this.getKeyCode(e);return this.activated&&t!==null&&this.allowedKeys.includes(t)}setHandleContentEditableTargets(e){this.handleContentEditableTargets=e}handleTabPress(e){const o=e.shiftKey?vt.directions.LEFT:vt.directions.RIGHT;if(this.skipNextTabFocus){this.skipNextTabFocus=!1;return}switch(o){case vt.directions.RIGHT:this.flipRight();break;case vt.directions.LEFT:this.flipLeft();break}}handleExternalKeydown(e){this.onKeyDown(e)}handleEnterPress(e){var t,o;this.activated&&((t=this.iterator)!=null&&t.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),V(this.activateCallback)&&((o=this.iterator)!=null&&o.currentItem)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){var e,t,o;(e=this.iterator)!=null&&e.currentItem&&((o=(t=this.iterator.currentItem).scrollIntoViewIfNeeded)==null||o.call(t)),this.flipCallbacks.forEach(n=>n())}shouldSkipTarget(e,t){if(!e)return!1;const o=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement,n=t.key==="Tab"||t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="Enter"||t.key==="ArrowRight"||t.key==="ArrowLeft",r=e.getAttribute("data-blok-flipper-navigation-target")==="true"&&n,i=e.isContentEditable,a=e.closest('[data-blok-link-tool-input-opened="true"]')!==null,l=i&&!this.handleContentEditableTargets;return o&&!r||l||a}}const so={root:"",alignedStart:"text-start",alignedCenter:"text-center",title:"",description:"opacity-60 mt-[3px]"};class fb{constructor(e){const t=e.alignment==="center"?"center":"start";this.nodes={root:v.make("div",[so.root,t==="center"?so.alignedCenter:so.alignedStart]),title:v.make("div",so.title,{textContent:e.title})},this.nodes.root.setAttribute("data-alignment",t),this.nodes.root.appendChild(this.nodes.title),e.description!==void 0&&(this.nodes.description=v.make("div",so.description,{textContent:e.description}),this.nodes.root.appendChild(this.nodes.description))}getElement(){return this.nodes.root}}class _i{constructor(e){this.params=e}get name(){if(this.params!==void 0&&"name"in this.params)return this.params.name}destroy(){ro()}onChildrenOpen(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onOpen)=="function"&&this.params.children.onOpen()}onChildrenClose(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onClose)=="function"&&this.params.children.onClose()}handleClick(){var e,t;this.params!==void 0&&"onActivate"in this.params&&((t=(e=this.params).onActivate)==null||t.call(e,this.params))}addHint(e,t){const o=new fb(t);Uo(e,o.getElement(),{placement:t.position,hidingDelay:100})}getMountElement(){return this.getElement()}get children(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.items)!==void 0?this.params.children.items:[]}get hasChildren(){return this.children.length>0}get isChildrenOpen(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.isOpen)===!0}get isChevronHidden(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.hideChevron)===!0}get isChildrenFlippable(){var e;return!(this.params===void 0||!("children"in this.params)||((e=this.params.children)==null?void 0:e.isFlippable)===!1)}get isChildrenSearchable(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.searchable)===!0}get closeOnActivate(){return this.params!==void 0&&"closeOnActivate"in this.params&&this.params.closeOnActivate}get isActive(){return this.params===void 0||!("isActive"in this.params)?!1:typeof this.params.isActive=="function"?this.params.isActive():this.params.isActive===!0}}const et={item:'flex items-center select-none border-none bg-transparent rounded-md p-[var(--item-padding)] text-text-primary mb-px can-hover:hover:cursor-pointer can-hover:hover:bg-item-hover-bg [&[data-blok-force-hover]]:cursor-pointer [&[data-blok-force-hover]]:bg-item-hover-bg [&[data-blok-focused="true"]]:bg-item-focus-bg [&[data-blok-popover-item-no-hover]]:hover:bg-transparent [&[data-blok-popover-item-no-hover]]:cursor-default',itemActive:"bg-icon-active-bg text-icon-active-text",itemDisabled:"cursor-default pointer-events-none text-text-secondary",icon:"flex items-center justify-center w-[26px] h-[26px] [&_svg]:w-icon [&_svg]:h-icon",focused:"is-focused"},pb={item:"rounded p-1"},gb={item:"rounded-md p-[3px] mobile:p-1"},ee={item:"data-blok-popover-item",icon:"data-blok-popover-item-icon",iconTool:"data-blok-tool",iconChevronRight:"data-blok-popover-item-icon-chevron-right",title:"data-blok-popover-item-title",secondaryTitle:"data-blok-popover-item-secondary-title",active:"data-blok-popover-item-active",hidden:"data-blok-hidden",confirmation:"data-blok-popover-item-confirmation",noHover:"data-blok-popover-item-no-hover",noFocus:"data-blok-popover-item-no-focus",focused:"data-blok-focused",wobble:"data-blok-popover-item-wobble",disabled:"data-blok-disabled",hasChildren:"data-blok-has-children"},Au=`
11
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
12
- <path d="m4.5 15 11-11m0 11L4.5 4" stroke="currentColor" stroke-linecap="round"/>
13
- </svg>
14
- `,mb=`
15
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
16
- <path
17
- d="M5.5 11h4.9231c.6528 0 1.2789-.3161 1.7405-.8787.4617-.56259.721-1.32565.721-2.1213 0-.79565-.2593-1.55871-.721-2.12132C11.702 5.31607 11.0759 5 10.4231 5H5.5v6Zm0 0h5.5385c.6528 0 1.2789.3161 1.7405.8787.4617.5626.721 1.3257.721 2.1213 0 .7956-.2593 1.5587-.721 2.1213-.4616.5626-1.0877.8787-1.7405.8787H5.5v-6Z"
18
- stroke="currentColor"
19
- stroke-width="1.25"
20
- stroke-linecap="round"
21
- stroke-linejoin="round"
22
- />
23
- </svg>
24
- `,bb=`
25
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
26
- <path
27
- d="M8.5 5h6m-10 12h6m1-12-4 12"
28
- stroke="currentColor"
29
- stroke-linecap="round"
30
- stroke-linejoin="round"
31
- />
32
- </svg>
33
- `,vb=`
34
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
35
- <path
36
- d="m9.98288 15.0959-.91628.9157c-.29867.3092-.65593.5559-1.05095.7255-.39502.1697-.81987.259-1.24978.2628-.4299.0037-.85625-.0782-1.25415-.241-.39791-.1628-.75941-.4032-1.06341-.7072-.304-.304-.54441-.6655-.70721-1.0634-.16279-.3979-.24471-.8243-.24098-1.2542.00374-.4299.09306-.8547.26274-1.2497.16969-.3951.41635-.7523.72558-1.051l.91499-.9163m8.24197.9156.9163-.9156c.6028-.60809.9402-1.43021.9383-2.28645-.0019-.85625-.3429-1.67688-.9483-2.28234-.6055-.60546-1.4261-.94643-2.2823-.9483-.8563-.00188-1.6784.3355-2.28652.9383l-.91628.91563M7.258 13.2413l4.5328-4.53278"
37
- stroke="currentColor"
38
- stroke-width=".784151"
39
- stroke-linecap="round"
40
- stroke-linejoin="round"
41
- />
42
- </svg>
43
- `,kb=`
44
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
45
- <path
46
- d="M15.5 14.003h-3v-3.0004m-9-6.00078h3v3.0004m1.55478-3.80901A5.2170862 5.2170862 0 0 1 9.5 4.00014c1.1682.00058 2.3059.37321 3.2481 1.06388.9422.69067 1.64 1.66348 1.9923 2.77744.3523 1.11396.3407 2.31114-.033 3.41814-.3738 1.1069-1.0903 2.0661-2.0457 2.7384m-1.7165.8088c-.4703.1317-.9568.1967-1.4452.1931-1.16819-.0006-2.30585-.3733-3.24807-1.0639-.94222-.6907-1.64004-1.6635-1.99232-2.7775-.35229-1.1139-.34072-2.31114.03302-3.41808.37375-1.10694 1.09024-2.06608 2.04563-2.73841"
47
- stroke="currentColor"
48
- stroke-miterlimit="10"
49
- stroke-linecap="round"
50
- />
51
- </svg>
52
- `,yb=`
53
- <svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
54
- <path
55
- d="M8 6c0-.55228.44772-1 1-1s1 .44772 1 1-.44772 1-1 1-1-.44772-1-1Zm0 6c0-.5523.44772-1 1-1s1 .4477 1 1-.44772 1-1 1-1-.4477-1-1Zm0 6c0-.5523.44772-1 1-1s1 .4477 1 1-.44772 1-1 1-1-.4477-1-1Zm6-12c0-.55228.4477-1 1-1s1 .44772 1 1-.4477 1-1 1-1-.44772-1-1Zm0 6c0-.5523.4477-1 1-1s1 .4477 1 1-.4477 1-1 1-1-.4477-1-1Zm0 6c0-.5523.4477-1 1-1s1 .4477 1 1-.4477 1-1 1-1-.4477-1-1Z"
56
- fill="currentColor"
57
- />
58
- </svg>
59
- `,wb=`
60
- <svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg">
61
- <path d="M4.5 11.0711h14.1421m-7.071 7.071V4" stroke="currentColor" stroke-linecap="round"/>
62
- </svg>
63
- `,Tb=`
64
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
65
- <path d="m12.5 5-5 5 5 5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
66
- </svg>
67
- `,Bb=`
68
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
69
- <path d="m7.5 15 5-5-5-5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
70
- </svg>
71
- `,xb=`
72
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
73
- <path
74
- d="m17.5 17.5-5-5m1.6667-4.16667c0 .76605-.1509 1.52459-.4441 2.23237-.2931.7077-.7228 1.3507-1.2645 1.8924-.5417.5417-1.1847.9714-1.8924 1.2645-.70778.2932-1.46632.4441-2.23237.4441-.76604 0-1.52458-.1509-2.23232-.4441-.70773-.2931-1.35079-.7228-1.89247-1.2645-.54167-.5417-.97135-1.1847-1.2645-1.8924C2.65088 9.85792 2.5 9.09938 2.5 8.33333c0-1.54709.61458-3.03082 1.70854-4.12479C5.30251 3.11458 6.78624 2.5 8.33333 2.5c1.5471 0 3.03087.61458 4.12477 1.70854 1.094 1.09397 1.7086 2.5777 1.7086 4.12479Z"
75
- stroke="currentColor"
76
- stroke-linecap="round"
77
- stroke-linejoin="round"
78
- />
79
- </svg>
80
- `,Cb=`
81
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
82
- <path
83
- d="M3.33334 10H10m-6.66666 5V5M10 15V5m4.1667 5 2.5-1.66667V15"
84
- stroke="currentColor"
85
- stroke-linecap="round"
86
- stroke-linejoin="round"
87
- />
88
- </svg>
89
- `,Eb=`
90
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
91
- <path
92
- d="M3.33334 10H10m-6.66666 5V5M10 15V5m7.5 10h-3.3333c0-3.3333 3.3333-2.5 3.3333-5 0-1.25-1.6667-2.08333-3.3333-.83333"
93
- stroke="currentColor"
94
- stroke-linecap="round"
95
- stroke-linejoin="round"
96
- />
97
- </svg>
98
- `,Sb=`
99
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
100
- <path
101
- d="M3.33334 10H10m-6.66666 5V5M10 15V5m4.5833 3.75C16 7.91667 17.5 8.75 17.5 10c0 .442-.1756.866-.4882 1.1785-.3125.3126-.7364.4882-1.1785.4882.4421 0 .866.1756 1.1785.4881.3126.3126.4882.7365.4882 1.1785 0 1.5-1.6667 2.5-3.3333 1.25"
102
- stroke="currentColor"
103
- stroke-linecap="round"
104
- stroke-linejoin="round"
105
- />
106
- </svg>
107
- `,Ab=`
108
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
109
- <path
110
- d="M10 15V5M14.1667 8.33333V10.8333C14.1667 11.0543 14.2545 11.2663 14.4107 11.4226C14.567 11.5789 14.779 11.6667 15 11.6667H17.5M17.5 8.33333V15M3.33334 10H10M3.33334 15V5"
111
- stroke="black"
112
- stroke-linecap="round"
113
- stroke-linejoin="round"
114
- />
115
- </svg>
116
- `,Ib=`
117
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
118
- <path
119
- d="M3.33334 10H10M3.33334 15V5M10 15V5M17.5 8.33333H14.1667V10.8333H15.25C16.5 10.8333 17.5 11.75 17.5 12.9167C17.5 14.0833 16.5 15 15.25 15C14.8333 15 14.5 14.9167 14.1667 14.75"
120
- stroke="black"
121
- stroke-linecap="round"
122
- stroke-linejoin="round"
123
- />
124
- </svg>
125
- `,Nb=`
126
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
127
- <path
128
- d="M3.33334 10H10m-6.66666 5V5M10 15V5m4.1667 8.3333c0 .9205.7462 1.6667 1.6666 1.6667.9205 0 1.6667-.7462 1.6667-1.6667 0-.9204-.7462-1.6666-1.6667-1.6666-.9204 0-1.6666.7462-1.6666 1.6666Zm0 0c0-2.0833.8333-3.3333 2.5-4.99997"
129
- stroke="currentColor"
130
- stroke-linecap="round"
131
- stroke-linejoin="round"
132
- />
133
- </svg>
134
- `,Rb=`
135
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
136
- <path
137
- d="M6.5 10h6.6667M6.5 15V5m6.6667 10V5"
138
- stroke="currentColor"
139
- stroke-linecap="round"
140
- stroke-linejoin="round"
141
- />
142
- </svg>
143
- `,Ob=`
144
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
145
- <path
146
- d="M14.5 7.28571V6h-9v1.28571M10 6v9m0 0H8.71429M10 15h1.2857"
147
- stroke="currentColor"
148
- stroke-linecap="round"
149
- stroke-linejoin="round"
150
- />
151
- </svg>
152
- `,_b=`
153
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
154
- <path
155
- d="M18.5667 18H1.5l8.5333-16 8.5334 16Z"
156
- stroke="currentColor"
157
- stroke-width="1.06667"
158
- stroke-linecap="round"
159
- stroke-linejoin="round"
160
- />
161
- <rect x="9.75" y="14.25" width=".5" height=".5" rx=".25" fill="currentColor" stroke="currentColor" stroke-width=".5"/>
162
- <rect x="9.75" y="8.25" width=".5" height="4.5" rx=".25" fill="currentColor" stroke="currentColor" stroke-width=".5"/>
163
- </svg>
164
- `,Iu=`
165
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
166
- <path
167
- d="M8 5h9M8 10h9M8 15h9M4 5h.01M4 10h.01M4 15h.01"
168
- stroke="currentColor"
169
- stroke-linecap="round"
170
- stroke-linejoin="round"
171
- />
172
- </svg>
173
- `,Nu=`
174
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
175
- <path
176
- d="M8 5h9M8 10h9M8 15h9M4.5 4v2.5M3.5 6.5h2M3.5 10h1.5l-1.5 2h2M3.5 14.5v1c0 .2761.22386.5.5.5h1c.27614 0 .5-.2239.5-.5v-.5c0-.2761-.22386-.5-.5-.5H4c-.27614 0-.5-.2239-.5-.5v-.5c0-.2761.22386-.5.5-.5h1c.27614 0 .5.2239.5.5"
177
- stroke="currentColor"
178
- stroke-linecap="round"
179
- stroke-linejoin="round"
180
- />
181
- </svg>
182
- `,Ru=`
183
- <svg width="20" height="20" fill="none" xmlns="http://www.w3.org/2000/svg">
184
- <path
185
- d="M10 5h7M10 10h7M10 15h7M3 5l1 1 2-2M3 10l1 1 2-2M3 15l1 1 2-2"
186
- stroke="currentColor"
187
- stroke-linecap="round"
188
- stroke-linejoin="round"
189
- />
190
- </svg>
191
- `;class tt extends _i{constructor(e,t){super(e),this.params=e,this.nodes={root:null,icon:null,titleEl:null,secondaryLabelEl:null,chevron:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{this.setNoFocus(!1)},this.removeSpecialHoverBehavior=()=>{this.setNoHover(!1)},this.renderParams=t,this.nodes.root=this.createRootElement(e,t)}get isDisabled(){return this.params.isDisabled===!0}get toggle(){return this.params.toggle}get title(){return this.params.title||this.params.label}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root===null?!1:this.nodes.root.hasAttribute(ee.focused)}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled&&this.confirmationState!==null){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){if(this.nodes.root===null)return;const t=this.nodes.root.hasAttribute(ee.active),o=e!==void 0?e:!t;this.setActive(o)}toggleHidden(e){this.setHidden(e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}createRootElement(e,t){var i,a,l,c;const o=(i=t==null?void 0:t.wrapperTag)!=null?i:"div",n=document.createElement(o);return o==="button"&&n.setAttribute("type","button"),n.className=this.getContainerClass(),n.setAttribute(ee.item,""),n.setAttribute("data-blok-testid","popover-item"),e.name&&n.setAttribute("data-blok-item-name",e.name),e.dataset&&Object.entries(e.dataset).forEach(([d,u])=>{n.setAttribute(`data-${d}`,u)}),e.isDisabled&&n.setAttribute(ee.disabled,"true"),this.isActive&&n.setAttribute(ee.active,"true"),this.hasChildren&&n.setAttribute(ee.hasChildren,"true"),this.createContentElements(n,e,t),e.hint!==void 0&&((a=t==null?void 0:t.hint)==null?void 0:a.enabled)!==!1&&e.hint!==void 0&&this.addHint(n,Se(q({},e.hint),{position:((l=t==null?void 0:t.hint)==null?void 0:l.position)||"right",alignment:((c=t==null?void 0:t.hint)==null?void 0:c.alignment)||"center"})),n}createContentElements(e,t,o){var c,d,u;const n=(c=o==null?void 0:o.iconWithGap)!=null?c:!0,r=(d=o==null?void 0:o.isInline)!=null?d:!1,i=(u=o==null?void 0:o.isNestedInline)!=null?u:!1,a=t.title||t.label;if(t.icon&&(this.nodes.icon=this.createIconElement(t.icon,n,r,i),e.appendChild(this.nodes.icon)),a!==void 0){const h=document.createElement("div");h.className="mr-auto truncate text-sm font-medium leading-5",h.setAttribute(ee.title,""),h.setAttribute("data-blok-testid","popover-item-title"),h.textContent=a,e.appendChild(h),this.nodes.titleEl=h}if(t.secondaryLabel){const h=document.createElement("div");h.className="whitespace-nowrap pr-1.5 text-xs -tracking-widest text-text-secondary opacity-60",h.setAttribute(ee.secondaryTitle,""),h.setAttribute("data-blok-testid","popover-item-secondary-title"),h.textContent=t.secondaryLabel,e.appendChild(h),this.nodes.secondaryLabelEl=h}if(this.hasChildren&&!this.isChevronHidden){const h=document.createElement("div");h.className=this.getChevronClass(r),h.setAttribute(ee.icon,""),h.setAttribute(ee.iconChevronRight,""),h.setAttribute("data-blok-testid","popover-item-chevron-right"),h.innerHTML=Bb,e.appendChild(h),this.nodes.chevron=h}}createIconElement(e,t,o,n){const r=document.createElement("div");return r.className=this.getIconClass(t,o,n,!1),r.setAttribute(ee.icon,""),r.setAttribute("data-blok-testid","popover-item-icon"),r.innerHTML=e,t&&r.setAttribute(ee.iconTool,""),r}getContainerClass(){var o,n,r,i;const e=(n=(o=this.renderParams)==null?void 0:o.isInline)!=null?n:!1,t=(i=(r=this.renderParams)==null?void 0:r.isNestedInline)!=null?i:!1;return j(et.item,e&&pb.item,t&&gb.item,this.isActive&&et.itemActive,this.params.isDisabled&&et.itemDisabled)}getIconClass(e,t,o,n){return j(et.icon,t&&"w-auto h-auto [&_svg]:w-icon [&_svg]:h-icon mobile:[&_svg]:w-icon-mobile mobile:[&_svg]:h-icon-mobile",o&&"w-toolbox-btn h-toolbox-btn",e&&"mr-2",e&&t&&"shadow-none bg-transparent !mr-0",e&&o&&"!mr-2",n&&"animate-wobble")}getChevronClass(e){return j(et.icon,e&&"rotate-90")}setActive(e){this.nodes.root&&(e?(this.nodes.root.setAttribute(ee.active,"true"),this.nodes.root.classList.add(...et.itemActive.split(" "))):(this.nodes.root.removeAttribute(ee.active),this.nodes.root.classList.remove(...et.itemActive.split(" "))))}setHidden(e){this.nodes.root&&(e?(this.nodes.root.setAttribute(ee.hidden,"true"),this.nodes.root.classList.add("!hidden")):(this.nodes.root.removeAttribute(ee.hidden),this.nodes.root.classList.remove("!hidden")))}setFocused(e){this.nodes.root&&(e?(this.nodes.root.setAttribute(ee.focused,"true"),this.nodes.root.classList.add("!bg-item-focus-bg")):(this.nodes.root.removeAttribute(ee.focused),this.nodes.root.classList.remove("!bg-item-focus-bg")))}setNoHover(e){this.nodes.root&&(e?this.nodes.root.setAttribute(ee.noHover,"true"):this.nodes.root.removeAttribute(ee.noHover))}setNoFocus(e){this.nodes.root&&(e?this.nodes.root.setAttribute(ee.noFocus,"true"):this.nodes.root.removeAttribute(ee.noFocus))}enableConfirmationMode(e){if(this.nodes.root===null)return;const t=Se(q(q({},this.params),e),{confirmation:"confirmation"in e?e.confirmation:void 0});this.setConfirmation(t),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}setConfirmation(e){if(this.nodes.root){if(e===null){this.clearConfirmationState();return}this.applyConfirmationState(e)}}clearConfirmationState(){this.nodes.root&&(this.nodes.root.removeAttribute(ee.confirmation),this.nodes.root.classList.remove("!bg-item-confirm-bg","!text-white"),this.restoreOriginalIcon(),this.restoreOriginalTitle(),this.restoreOriginalSecondaryLabel())}applyConfirmationState(e){this.nodes.root&&(this.nodes.root.setAttribute(ee.confirmation,"true"),this.nodes.root.classList.add("!bg-item-confirm-bg","!text-white"),this.updateIcon(e.icon),this.updateTitle(e),this.updateSecondaryLabel(e.secondaryLabel))}restoreOriginalIcon(){!this.nodes.icon||!this.params.icon||(this.nodes.icon.innerHTML=this.params.icon)}restoreOriginalTitle(){const e=this.params.title||this.params.label;!this.nodes.titleEl||e===void 0||(this.nodes.titleEl.textContent=e)}restoreOriginalSecondaryLabel(){var e;this.nodes.secondaryLabelEl&&(this.nodes.secondaryLabelEl.textContent=(e=this.params.secondaryLabel)!=null?e:"",this.nodes.secondaryLabelEl.style.display=this.params.secondaryLabel?"":"none")}updateIcon(e){!this.nodes.icon||!e||(this.nodes.icon.innerHTML=e)}updateTitle(e){const t=e.title||e.label;!this.nodes.titleEl||t===void 0||(this.nodes.titleEl.textContent=t)}updateSecondaryLabel(e){this.nodes.secondaryLabelEl&&(this.nodes.secondaryLabelEl.textContent=e!=null?e:"",this.nodes.secondaryLabelEl.style.display=e?"":"none")}disableConfirmationMode(){this.nodes.root!==null&&(this.setConfirmation(null),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior())}enableSpecialHoverAndFocusBehavior(){var e;this.setNoHover(!0),this.setNoFocus(!0),(e=this.nodes.root)==null||e.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){var e;this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),(e=this.nodes.root)==null||e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){var t;if(!("confirmation"in e)||e.confirmation===void 0)try{(t=e.onActivate)==null||t.call(e,e),this.disableConfirmationMode()}catch(o){this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){this.triggerWobble()}triggerWobble(){var r,i,a,l,c,d;if(!this.nodes.icon)return;const e=(i=(r=this.renderParams)==null?void 0:r.isInline)!=null?i:!1,t=(l=(a=this.renderParams)==null?void 0:a.isNestedInline)!=null?l:!1,o=(d=(c=this.renderParams)==null?void 0:c.iconWithGap)!=null?d:!0;this.nodes.icon.setAttribute(ee.wobble,"true"),this.nodes.icon.className=this.getIconClass(o,e,t,!0);const n=()=>{this.nodes.icon&&(this.nodes.icon.removeAttribute(ee.wobble),this.nodes.icon.className=this.getIconClass(o,e,t,!1))};this.nodes.icon.addEventListener("animationend",n,{once:!0})}getIconElement(){return this.nodes.icon}}const kt={container:"py-1 px-[3px]",containerHidden:"hidden",line:"h-px w-full bg-popover-border"},Ko={container:"px-1 py-0",line:"h-full w-px",nestedContainer:"py-1 px-[3px]",nestedLine:"w-full h-px"},Wo={root:"data-blok-popover-item-separator",line:"data-blok-popover-item-separator-line",hidden:"data-blok-hidden"};class Ou extends _i{constructor(e){var t,o;super(),this.nodes={root:null,line:null},this.isInline=(t=e==null?void 0:e.isInline)!=null?t:!1,this.isNestedInline=(o=e==null?void 0:e.isNestedInline)!=null?o:!1,this.nodes.root=this.createRootElement()}getElement(){return this.nodes.root}toggleHidden(e){if(!this.nodes.root)return;const t=this.getContainerClass(!1),o=this.getContainerClass(!0);this.nodes.root.className=e?o:t,e?this.nodes.root.setAttribute(Wo.hidden,"true"):this.nodes.root.removeAttribute(Wo.hidden)}getContainerClass(e){const t=kt.container;return this.isNestedInline?j(t,Ko.nestedContainer,e&&kt.containerHidden):this.isInline?j(t,Ko.container,e&&kt.containerHidden):j(t,e&&kt.containerHidden)}getLineClass(){return this.isNestedInline?j(kt.line,Ko.nestedLine):this.isInline?j(kt.line,Ko.line):kt.line}createRootElement(){const e=document.createElement("div");e.className=this.getContainerClass(!1),e.setAttribute(Wo.root,""),e.setAttribute("data-blok-testid","popover-item-separator");const t=document.createElement("div");return t.className=this.getLineClass(),t.setAttribute(Wo.line,""),e.appendChild(t),this.nodes.line=t,e}}var Le=(s=>(s.Closed="closed",s.ClosedOnActivate="closed-on-activate",s))(Le||{});const Mi={root:"",rootHidden:"hidden"},_u={root:"flex items-center"},Li={root:"data-blok-popover-item-html",hidden:"data-blok-hidden"};class io extends _i{constructor(e,t){var o;super(e),this.nodes={root:null},this.isHidden=!1,this.isInline=(o=t==null?void 0:t.isInline)!=null?o:!1,this.nodes.root=this.createRootElement(e,t)}getElement(){return this.nodes.root}toggleHidden(e){this.isHidden=e,this.updateRootClasses(),this.nodes.root&&(e?this.nodes.root.setAttribute(Li.hidden,"true"):this.nodes.root.removeAttribute(Li.hidden))}getControls(){if(!this.nodes.root)return[];const e=this.nodes.root.querySelectorAll(`button, ${v.allInputsSelector}`);return Array.from(e)}updateRootClasses(){this.nodes.root&&(this.nodes.root.className=j(Mi.root,this.isInline&&_u.root,this.isHidden&&Mi.rootHidden))}createRootElement(e,t){var n,r,i;const o=document.createElement("div");return o.className=j(Mi.root,this.isInline&&_u.root),o.setAttribute(Li.root,""),o.setAttribute("data-blok-testid","popover-item-html"),e.name&&o.setAttribute("data-blok-item-name",e.name),o.appendChild(e.element),e.hint!==void 0&&((n=t==null?void 0:t.hint)==null?void 0:n.enabled)!==!1&&this.addHint(o,Se(q({},e.hint),{position:((r=t==null?void 0:t.hint)==null?void 0:r.position)||"right",alignment:((i=t==null?void 0:t.hint)==null?void 0:i.alignment)||"center"})),o}}const fe={popoverContainer:"absolute flex flex-col overflow-hidden box-border opacity-0 pointer-events-none p-0 border-none z-[4] max-h-0 min-w-[var(--width)] w-[var(--width)] rounded-lg shadow-[0_3px_15px_-3px_theme(colors.popover-shadow)] left-[var(--popover-left)] top-[var(--popover-top)] bg-popover-bg",popoverContainerMobile:"fixed max-w-none rounded-[10px] min-w-[calc(100%-var(--offset)*2)] inset-[auto_var(--offset)_calc(var(--offset)+env(safe-area-inset-bottom))_var(--offset)]",popoverContainerOpened:"opacity-100 pointer-events-auto p-1 max-h-[var(--max-height)] border border-popover-border animate-[panelShowing_100ms_ease]",popoverOverlay:"hidden bg-dark",items:"overflow-y-auto overscroll-contain"},Mt={popover:"relative",popoverContainer:"flex-row top-0 min-w-max w-max p-1 mobile:absolute"},X={popover:"data-blok-popover",popoverContainer:"data-blok-popover-container",popoverItems:"data-blok-popover-items",popoverOverlay:"data-blok-popover-overlay",popoverInline:"data-blok-popover-inline",nested:"data-blok-nested",nestedLevel:"data-blok-nested-level",opened:"data-blok-popover-opened",openTop:"data-blok-popover-open-top",openLeft:"data-blok-popover-open-left",overlayHidden:"data-blok-overlay-hidden",nothingFoundDisplayed:"data-blok-nothing-found-displayed"},Mb=s=>`level-${s}`;var De=(s=>(s.NestingLevel="--nesting-level",s.PopoverHeight="--popover-height",s.InlinePopoverWidth="--inline-popover-width",s.PopoverTop="--popover-top",s.PopoverLeft="--popover-left",s.TriggerItemLeft="--trigger-item-left",s.TriggerItemTop="--trigger-item-top",s))(De||{});class Mu extends Zt{constructor(e,t={}){super(),this.params=e,this.itemsRenderParams=t,this.listeners=new Jt,this.messages={nothingFound:"Nothing found",search:"Search"},this.items=this.buildItems(e.items),e.messages&&(this.messages=q(q({},this.messages),e.messages)),this.nodes=this.createPopoverDOM(),this.appendItemElements(),this.nodes.popoverContainer&&this.listeners.on(this.nodes.popoverContainer,"click",o=>this.handleClick(o))}get itemsDefault(){return this.items.filter(e=>e instanceof tt)}getElement(){return this.nodes.popover}getMountElement(){return this.nodes.popover}show(){const e=this.nodes.popover;e!==null&&!e.isConnected&&document.body.appendChild(e),this.nodes.popover.setAttribute(X.opened,"true"),this.nodes.popoverContainer.classList.add(...fe.popoverContainerOpened.split(" ")),this.itemsDefault.forEach(t=>this.refreshItemActiveState(t)),this.search!==void 0&&this.search.focus()}hide(){this.nodes.popover.removeAttribute(X.opened),this.nodes.popover.removeAttribute(X.openTop),this.nodes.popover.removeAttribute(X.openLeft),this.nodes.popoverContainer.classList.remove(...fe.popoverContainerOpened.split(" ")),this.itemsDefault.forEach(e=>e.reset()),this.search!==void 0&&this.search.clear(),this.emit(Le.Closed)}destroy(){var e,t;this.items.forEach(o=>o.destroy()),(e=this.nodes.popover)==null||e.remove(),this.listeners.removeAll(),(t=this.search)==null||t.destroy()}activateItemByName(e){const t=this.items.find(o=>o.name===e);t!==void 0&&this.handleItemClick(t)}buildItems(e){return e.map(t=>{switch(t.type){case le.Separator:return new Ou(this.itemsRenderParams[le.Separator]);case le.Html:return new io(t,this.itemsRenderParams[le.Html]);default:return new tt(t,this.itemsRenderParams[le.Default])}})}getTargetItem(e){return this.items.filter(t=>t instanceof tt||t instanceof io).find(t=>{const o=t.getElement();return o===null?!1:e.composedPath().includes(o)})}handleItemClick(e){if(!(e instanceof tt&&e.isDisabled)){if(e.hasChildren){this.showNestedItems(e),this.callHandleClickIfPresent(e);return}this.itemsDefault.filter(t=>t!==e).forEach(t=>t.reset()),this.callHandleClickIfPresent(e),this.toggleItemActivenessIfNeeded(e),this.refreshItemActiveState(e),e.closeOnActivate===!0&&(this.hide(),this.emit(Le.ClosedOnActivate))}}handleClick(e){const t=this.getTargetItem(e);t!==void 0&&this.handleItemClick(t)}toggleItemActivenessIfNeeded(e){if(!(e instanceof tt)||(e.toggle===!0&&e.toggleActive(),typeof e.toggle!="string"))return;const t=this.itemsDefault.filter(o=>o.toggle===e.toggle);if(t.length===1){e.toggleActive();return}t.forEach(o=>{o.toggleActive(o===e)})}refreshItemActiveState(e){e instanceof tt&&e.toggle===void 0&&e.toggleActive(e.isActive)}callHandleClickIfPresent(e){"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick()}toggleNothingFoundMessage(e){e?(this.nodes.nothingFoundMessage.classList.remove("hidden"),this.nodes.nothingFoundMessage.setAttribute(X.nothingFoundDisplayed,"true")):(this.nodes.nothingFoundMessage.classList.add("hidden"),this.nodes.nothingFoundMessage.removeAttribute(X.nothingFoundDisplayed))}setOpenTop(e){e?this.nodes.popover.setAttribute(X.openTop,"true"):this.nodes.popover.removeAttribute(X.openTop)}setOpenLeft(e){e?this.nodes.popover.setAttribute(X.openLeft,"true"):this.nodes.popover.removeAttribute(X.openLeft)}hasNode(e){return this.nodes.popover.contains(e)}createPopoverDOM(){var r;const e=document.createElement("div");this.params.class&&(e.className=this.params.class),e.setAttribute(X.popover,""),this.params.class&&e.setAttribute("data-blok-popover-custom-class",this.params.class),e.setAttribute("data-blok-testid","popover"),e.style.setProperty("--width","200px"),e.style.setProperty("--item-padding","3px"),e.style.setProperty("--item-height","calc(1.25rem + 2 * var(--item-padding))"),e.style.setProperty("--popover-top","calc(100% + 0.5rem)"),e.style.setProperty("--popover-left","0"),e.style.setProperty("--nested-popover-overlap","0.25rem");const t=document.createElement("div");t.className=fe.popoverContainer,t.setAttribute(X.popoverContainer,""),t.setAttribute("data-blok-testid","popover-container");const o=document.createElement("div");o.className=j("cursor-default text-sm leading-5 font-medium whitespace-nowrap overflow-hidden text-ellipsis text-gray-text p-[3px]","hidden"),o.setAttribute("data-blok-testid","popover-nothing-found"),o.textContent=(r=this.messages.nothingFound)!=null?r:"Nothing found";const n=document.createElement("div");return n.className=fe.items,n.setAttribute(X.popoverItems,""),n.setAttribute("data-blok-testid","popover-items"),t.appendChild(o),t.appendChild(n),e.appendChild(t),{popover:e,popoverContainer:t,nothingFoundMessage:o,items:n}}appendItemElements(){this.items.forEach(e=>{var o,n,r;const t=(n=(o=e.getMountElement)==null?void 0:o.call(e))!=null?n:e.getElement();t!==null&&((r=this.nodes.items)==null||r.appendChild(t))})}}var Di=(s=>(s.Search="search",s))(Di||{});const Pi={wrapper:"bg-[#F8F8F8] border border-[rgba(226,226,229,0.20)] rounded p-0.5 grid grid-cols-[auto_auto_1fr] grid-rows-[auto]",icon:"w-toolbox-btn h-toolbox-btn flex items-center justify-center mr-2 [&_svg]:w-icon [&_svg]:h-icon [&_svg]:text-gray-text",input:"text-sm outline-none font-medium font-inherit border-0 bg-transparent m-0 p-0 leading-[22px] min-w-[calc(100%-theme('spacing.6')-10px)] placeholder:text-gray-text placeholder:font-medium"};class Lb extends Zt{constructor({items:e,placeholder:t}){super(),this.searchQuery="",this.handleValueChange=()=>{this.applySearch(this.input.value)},this.listeners=new Jt,this.items=e,this.wrapper=v.make("div",Pi.wrapper),this.wrapper.setAttribute("data-blok-testid","popover-search-field");const o=v.make("div",Pi.icon,{innerHTML:xb});this.input=v.make("input",Pi.input,{type:"search",placeholder:t,tabIndex:-1}),this.input.setAttribute("data-blok-flipper-navigation-target","true"),this.input.setAttribute("data-blok-testid","popover-search-input"),this.wrapper.appendChild(o),this.wrapper.appendChild(this.input),this.overrideValueProperty(),["input","keyup","search","change"].forEach(r=>{this.listeners.on(this.input,r,this.handleValueChange)})}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value=""}applySearch(e){this.searchQuery!==e&&(this.searchQuery=e,this.emit(Di.Search,{query:e,items:this.foundItems}))}overrideValueProperty(){var n,r;const e=Object.getPrototypeOf(this.input),t=Object.getOwnPropertyDescriptor(e,"value");if((t==null?void 0:t.set)===void 0||t.get===void 0)return;const o=this.applySearch.bind(this);Object.defineProperty(this.input,"value",{configurable:(n=t.configurable)!=null?n:!0,enumerable:(r=t.enumerable)!=null?r:!1,get(){var i,a;return(a=(i=t.get)==null?void 0:i.call(this))!=null?a:""},set(i){var a;(a=t.set)==null||a.call(this,i),o(i)}})}destroy(){this.listeners.removeAll()}get foundItems(){return this.items.filter(e=>this.checkItem(e))}checkItem(e){var n,r;const t=((n=e.title)==null?void 0:n.toLowerCase())||"",o=(r=this.searchQuery)==null?void 0:r.toLowerCase();return o!==void 0?t.includes(o):!1}}class Lt extends Mu{constructor(e,t){super(e,t),this.nestingLevel=0,this.nestedPopoverTriggerItem=null,this.previouslyHoveredItem=null,this.scopeElement=document.body,this.hide=()=>{var o;super.hide(),this.destroyNestedPopoverIfExists(),(o=this.flipper)==null||o.deactivate(),this.previouslyHoveredItem=null},this.onFlip=()=>{const o=this.itemsDefault.find(n=>n.isFocused);o==null||o.onFocus()},this.onSearch=o=>{var a;const n=o.query==="",r=o.items.length===0;this.items.forEach(l=>{const c=l instanceof tt,d=l instanceof Ou||l instanceof io,u=c?!o.items.includes(l):d&&(r||!n);l.toggleHidden(u)}),this.toggleNothingFoundMessage(r);const i=o.query===""?this.flippableElements:o.items.map(l=>l.getElement());(a=this.flipper)!=null&&a.isActivated&&(this.flipper.deactivate(),this.flipper.activate(i))},e.trigger&&(this.trigger=e.trigger),e.nestingLevel!==void 0&&(this.nestingLevel=e.nestingLevel),this.nestingLevel>0&&this.nodes.popover.setAttribute(X.nested,"true"),e.scopeElement!==void 0&&(this.scopeElement=e.scopeElement),this.nodes.popoverContainer!==null&&this.listeners.on(this.nodes.popoverContainer,"mouseover",o=>this.handleHover(o)),e.searchable&&this.addSearch(),e.flippable!==!1&&(e.flipper!==void 0?(e.flipper.deactivate(),e.flipper.removeOnFlip(this.onFlip),this.flipper=e.flipper):this.flipper=new at({items:this.flippableElements,focusedItemClass:et.focused,allowedKeys:[I.TAB,I.UP,I.DOWN,I.ENTER,I.RIGHT,I.LEFT],onArrowLeft:e.onNavigateBack}),this.flipper.onFlip(this.onFlip))}hasFocus(){return this.flipper===void 0?!1:this.flipper.hasFocus()}get scrollTop(){return this.nodes.items===null?0:this.nodes.items.scrollTop}get offsetTop(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetTop}show(){var t;const e=this.getMountElement();if(this.trigger&&e&&document.body.appendChild(e),this.trigger){const{top:o,left:n}=this.calculatePosition();this.nodes.popover.style.position="absolute",this.nodes.popover.style.top=`${o}px`,this.nodes.popover.style.left=`${n}px`,this.nodes.popover.style.setProperty(De.PopoverTop,"0px"),this.nodes.popover.style.setProperty(De.PopoverLeft,"0px")}this.nodes.popover.style.setProperty(De.PopoverHeight,this.size.height+"px"),!this.trigger&&!this.shouldOpenBottom&&(this.setOpenTop(!0),this.nodes.popover.style.setProperty(De.PopoverTop,"calc(-1 * (0.5rem + var(--popover-height)))")),!this.trigger&&!this.shouldOpenRight&&(this.setOpenLeft(!0),this.nodes.popover.style.setProperty(De.PopoverLeft,"calc(-1 * var(--width) + 100%)")),super.show(),(t=this.flipper)==null||t.activate(this.flippableElements),requestAnimationFrame(()=>{this.focusInitialElement()})}focusInitialElement(){var e;if(this.search){this.search.focus();return}(e=this.flipper)==null||e.focusFirst()}calculatePosition(){if(!this.trigger)return{top:0,left:0};const e=this.trigger.getBoundingClientRect(),t=this.size,o=window.innerWidth,n=window.innerHeight,r=8,i=e.bottom+r+window.scrollY,l=e.bottom+r+t.height>n+window.scrollY&&e.top-r-t.height>window.scrollY?e.top-r-t.height+window.scrollY:i,c=e.left+window.scrollX,u=c+t.width>o+window.scrollX?Math.max(0,e.right-t.width+window.scrollX):c;return{top:l,left:u}}destroy(){this.hide(),super.destroy()}hasNode(e){return super.hasNode(e)?!0:this.nestedPopover!==void 0&&this.nestedPopover!==null?this.nestedPopover.hasNode(e):!1}showNestedItems(e){this.nestedPopover!==null&&this.nestedPopover!==void 0||(this.nestedPopoverTriggerItem=e,this.showNestedPopoverForItem(e))}handleHover(e){const t=this.getTargetItem(e);t!==void 0&&this.previouslyHoveredItem!==t&&(this.destroyNestedPopoverIfExists(),this.previouslyHoveredItem=t,t.hasChildren&&this.showNestedPopoverForItem(t))}setTriggerItemPosition(e,t){var a;const o=t.getElement(),n=(o?o.offsetTop:0)-this.scrollTop,r=this.offsetTop+n;((a=e.querySelector(`[${X.popover}]`))!=null?a:e).style.setProperty(De.TriggerItemTop,r+"px")}destroyNestedPopoverIfExists(){var t,o,n;if(this.nestedPopover===void 0||this.nestedPopover===null)return;const e=(t=this.nestedPopoverTriggerItem)==null?void 0:t.getElement();this.nestedPopover.off(Le.ClosedOnActivate,this.hide),this.nestedPopover.hide(),this.nestedPopover.destroy(),this.nestedPopover.getElement().remove(),this.nestedPopover=null,(o=this.flipper)==null||o.activate(this.flippableElements),requestAnimationFrame(()=>{this.focusAfterNestedPopoverClose(e)}),(n=this.nestedPopoverTriggerItem)==null||n.onChildrenClose()}focusAfterNestedPopoverClose(e){var o;if(!e||!this.flipper){(o=this.flipper)==null||o.focusFirst();return}const t=this.flippableElements.indexOf(e);if(t!==-1){this.flipper.focusItem(t);return}this.flipper.focusFirst()}showNestedPopoverForItem(e){var n;this.nestedPopover=new Lt({searchable:e.isChildrenSearchable,items:e.children,nestingLevel:this.nestingLevel+1,flippable:e.isChildrenFlippable,messages:this.messages,onNavigateBack:this.destroyNestedPopoverIfExists.bind(this)}),e.onChildrenOpen(),this.nestedPopover.on(Le.ClosedOnActivate,this.hide);const t=this.nestedPopover.getMountElement(),o=this.nestedPopover.getElement();return this.nodes.popover.appendChild(t),this.setTriggerItemPosition(t,e),o.style.setProperty(De.NestingLevel,this.nestedPopover.nestingLevel.toString()),this.applyNestedPopoverPositioning(t),this.nestedPopover.show(),(n=this.flipper)==null||n.deactivate(),this.nestedPopover}applyNestedPopoverPositioning(e){var i;const t=e.querySelector(`[${X.popoverContainer}]`);if(!t)return;const o=(i=e.querySelector(`[${X.popover}]`))!=null?i:e,n=this.nodes.popover.hasAttribute(X.openTop),r=this.nodes.popover.hasAttribute(X.openLeft);t.style.position="absolute",r?o.style.setProperty(De.PopoverLeft,"calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)"):o.style.setProperty(De.PopoverLeft,"calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)))"),n?t.style.top="calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + 0.5rem + var(--nested-popover-overlap))":t.style.top="calc(var(--trigger-item-top) - var(--nested-popover-overlap))"}get shouldOpenBottom(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popoverContainer.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),o=this.size.height,n=e.top+o,r=e.top-o,i=Math.min(window.innerHeight,t.bottom);return r<t.top||n<=i}get shouldOpenRight(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popover.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),o=this.size.width,n=e.right+o,r=e.left-o,i=Math.min(window.innerWidth,t.right);return r<t.left||n<=i}get size(){var n;if(this._size)return this._size;const e={height:0,width:0};if(this.nodes.popover===null)return e;const t=this.nodes.popover.cloneNode(!0);t.style.visibility="hidden",t.style.position="absolute",t.style.top="-1000px",t.setAttribute(X.opened,"true"),(n=t.querySelector(`[${X.nested}]`))==null||n.remove(),document.body.appendChild(t);const o=t.querySelector(`[${X.popoverContainer}]`);return e.height=o.offsetHeight,e.width=o.offsetWidth,t.remove(),this._size=e,e}get flippableElements(){return this.items.flatMap(t=>this.getFlippableElementsForItem(t)).filter(t=>t!=null)}getFlippableElementsForItem(e){if(e instanceof io){const o=e.getElement();return o?[o]:[]}if(!(e instanceof tt))return[];if(e.isDisabled)return[];const t=e.getElement();return t?[t]:[]}addSearch(){this.search=new Lb({items:this.itemsDefault,placeholder:this.messages.search}),this.search.on(Di.Search,this.onSearch);const e=this.search.getElement();e.classList.add("mb-1.5"),this.nodes.popoverContainer.insertBefore(e,this.nodes.popoverContainer.firstChild)}}const Db="38px",Pb="46px";class Lu extends Lt{constructor(e){var o;const t=!st();super(q({},e),{[le.Default]:{wrapperTag:"button",hint:{position:"top",alignment:"center",enabled:t},iconWithGap:!1,isInline:!0},[le.Html]:{hint:{position:"top",alignment:"center",enabled:t},isInline:!0},[le.Separator]:{isInline:!0}}),this.hide=()=>{var n;this.setOpenTop(!1),this.setOpenLeft(!1),this.itemsDefault.forEach(r=>r.reset()),this.search!==void 0&&this.search.clear(),this.destroyNestedPopoverIfExists(),(n=this.flipper)==null||n.deactivate(),this.nodes.popover.className=j(Mt.popover),this.nodes.popoverContainer&&(this.nodes.popoverContainer.className=j(fe.popoverContainer,Mt.popoverContainer),this.nodes.popoverContainer.style.height=""),this.emit(Le.Closed)},this.nodes.popover.className=j(Mt.popover),this.nodes.popoverContainer&&(this.nodes.popoverContainer.className=j(fe.popoverContainer,Mt.popoverContainer)),this.nodes.items&&(this.nodes.items.className=j(fe.items,"flex")),this.nodes.popover.style.setProperty("--height",Db),this.nodes.popover.style.setProperty("--height-mobile",Pb),this.nodes.popover.setAttribute(X.popoverInline,""),(o=this.flipper)==null||o.setHandleContentEditableTargets(!0),this.items.forEach(n=>{!(n instanceof tt)&&!(n instanceof io)||n.hasChildren&&n.isChildrenOpen&&this.showNestedItems(n)})}get offsetLeft(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetLeft}show(){var t;if(super.show(),this.nodes.popover.className=j(Mt.popover,"inline-block"),this.nodes.popoverContainer){this.nodes.popoverContainer.className=j(fe.popoverContainer,fe.popoverContainerOpened,Mt.popoverContainer,"animate-none");const o=st()?"var(--height-mobile)":"var(--height)";this.nodes.popoverContainer.style.height=o}const e=this.nestingLevel===0?(t=this.nodes.popoverContainer)==null?void 0:t.getBoundingClientRect():void 0;if(e!==void 0){const o=`${e.width}px`,n=`${e.height}px`;this.nodes.popover.style.setProperty(De.InlinePopoverWidth,o),this.nodes.popover.style.width=o,this.nodes.popover.style.height=n}requestAnimationFrame(()=>{var o,n;(o=this.flipper)==null||o.deactivate(),(n=this.flipper)==null||n.activate(this.flippableElements)})}handleHover(){}setTriggerItemPosition(e,t){const o=t.getElement(),n=o?o.offsetLeft:0,r=this.offsetLeft+n;e.style.setProperty(De.TriggerItemLeft,r+"px")}showNestedItems(e){if(this.nestedPopoverTriggerItem===e){this.destroyNestedPopoverIfExists(),this.nestedPopoverTriggerItem=null;return}super.showNestedItems(e)}showNestedPopoverForItem(e){var a;const t=super.showNestedPopoverForItem(e),o=t.getElement();(a=t.flipper)==null||a.setHandleContentEditableTargets(!0),requestAnimationFrame(()=>{var l;(l=t.flipper)==null||l.focusItem(-1)});const n=o.querySelector(`[${X.popoverContainer}]`);n&&(n.className=j(n.className,"h-fit p-1.5 flex-col"));const r=o.querySelector(`[${X.popoverItems}]`);r&&(r.className=j(r.className,"block w-full"));const i=l=>{var c,d;if(!(l.key!=="Tab"||l.shiftKey)){if(this.nestedPopover!==t){document.removeEventListener("keydown",i,!0);return}l.preventDefault(),l.stopPropagation(),(c=t.flipper)==null||c.activate(t.flippableElements),(d=t.flipper)==null||d.focusFirst(),document.removeEventListener("keydown",i,!0)}};if(document.addEventListener("keydown",i,!0),t.on(Le.Closed,()=>{document.removeEventListener("keydown",i,!0)}),o.setAttribute(X.nestedLevel,Mb(t.nestingLevel)),t.nestingLevel===1&&n){n.className=j(n.className,"left-0");const l=st()?"calc(var(--height-mobile) + 3px)":"calc(var(--height) + 3px)";n.style.top=l}return t}handleItemClick(e){var t;e!==this.nestedPopoverTriggerItem&&((t=this.nestedPopoverTriggerItem)==null||t.handleClick(),super.destroyNestedPopoverIfExists()),super.handleItemClick(e)}}const we=class we{constructor(){this.scrollPosition=null}lock(){di?this.lockHard():(document.body.classList.add(we.CSS.overflowHidden),document.body.setAttribute(we.DATA_ATTR.scrollLocked,"true"))}unlock(){di?this.unlockHard():(document.body.classList.remove(we.CSS.overflowHidden),document.body.removeAttribute(we.DATA_ATTR.scrollLocked))}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(we.CSS.overflowHidden,we.CSS.fixed,we.CSS.wFull),document.body.style.top="calc(-1 * var(--window-scroll-offset))",document.body.setAttribute(we.DATA_ATTR.scrollLockedHard,"true")}unlockHard(){document.body.classList.remove(we.CSS.overflowHidden,we.CSS.fixed,we.CSS.wFull),document.body.style.top="",document.body.removeAttribute(we.DATA_ATTR.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};we.CSS={overflowHidden:"overflow-hidden",fixed:"fixed",wFull:"w-full"},we.DATA_ATTR={scrollLocked:"data-blok-scroll-locked",scrollLockedHard:"data-blok-scroll-locked-hard"};let Fi=we;const Hi={root:"flex items-center mb-2 mt-1",text:"text-lg font-semibold text-text-primary",backButton:"border-0 bg-transparent w-9 h-9 text-text-primary cursor-pointer [&_svg]:block [&_svg]:w-7 [&_svg]:h-7"},qi={root:"data-blok-popover-header",text:"data-blok-popover-header-text",backButton:"data-blok-popover-header-back-button"};class Fb{constructor({text:e,onBackButtonClick:t}){this.listeners=new Jt,this.text=e,this.onBackButtonClick=t,this.nodes={root:v.make("div",[Hi.root],{"data-blok-testid":"popover-header",[qi.root]:""}),backButton:v.make("button",[Hi.backButton],{"data-blok-testid":"popover-header-back-button",[qi.backButton]:""}),text:v.make("div",[Hi.text],{"data-blok-testid":"popover-header-text",[qi.text]:""})},this.nodes.backButton.innerHTML=Tb,this.nodes.root.appendChild(this.nodes.backButton),this.listeners.on(this.nodes.backButton,"click",this.onBackButtonClick),this.nodes.text.innerText=this.text,this.nodes.root.appendChild(this.nodes.text)}getElement(){return this.nodes.root}destroy(){this.nodes.root.remove(),this.listeners.destroy()}}class Hb{constructor(){this.history=[]}push(e){this.history.push(e)}pop(){return this.history.pop()}get currentTitle(){return this.history.length===0?"":this.history[this.history.length-1].title}get currentItems(){return this.history.length===0?[]:this.history[this.history.length-1].items}reset(){for(;this.history.length>1;)this.pop()}}class Du extends Mu{constructor(e){super(e,{[le.Default]:{hint:{enabled:!1}},[le.Html]:{hint:{enabled:!1}}}),this.scrollLocker=new Fi,this.history=new Hb,this.isHidden=!0,this.nodes.overlay=v.make("div",[fe.popoverOverlay],{[X.popoverOverlay]:"",[X.overlayHidden]:"","data-blok-testid":"popover-overlay"}),this.nodes.popover.insertBefore(this.nodes.overlay,this.nodes.popover.firstChild),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.history.push({items:e.items}),this.nodes.popoverContainer.style.setProperty("--offset","5px"),this.nodes.popoverContainer.className=j(fe.popoverContainer,fe.popoverContainerMobile)}show(){this.nodes.overlay.removeAttribute(X.overlayHidden),this.nodes.overlay.className=j(fe.popoverOverlay,"fixed inset-0 block visible z-[3] opacity-50 transition-opacity duration-[120ms] ease-in will-change-[opacity]"),super.show(),this.nodes.popoverContainer.className=j(fe.popoverContainer,fe.popoverContainerMobile,fe.popoverContainerOpened,"animate-[panelShowingMobile_250ms_ease]"),this.scrollLocker.lock(),this.isHidden=!1}hide(){this.isHidden||(super.hide(),this.nodes.overlay.setAttribute(X.overlayHidden,""),this.nodes.overlay.className=fe.popoverOverlay,this.nodes.popoverContainer.className=j(fe.popoverContainer,fe.popoverContainerMobile),this.scrollLocker.unlock(),this.history.reset(),this.isHidden=!0)}destroy(){super.destroy(),this.scrollLocker.unlock()}showNestedItems(e){this.updateItemsAndHeader(e.children,e.title),this.history.push({title:e.title,items:e.children})}updateItemsAndHeader(e,t){var r,i;this.header!==null&&this.header!==void 0&&(this.header.destroy(),this.header=null);const o=t!==void 0;o&&(this.header=new Fb({text:t,onBackButtonClick:()=>{this.history.pop(),this.updateItemsAndHeader(this.history.currentItems,this.history.currentTitle)}}));const n=(i=(r=this.header)==null?void 0:r.getElement())!=null?i:null;o&&n!==null&&this.nodes.popoverContainer.insertBefore(n,this.nodes.popoverContainer.firstChild),this.items.forEach(a=>{var l,c;return(c=(l=a.getMountElement)==null?void 0:l.call(a))==null?void 0:c.remove()}),this.items=this.buildItems(e),this.items.forEach(a=>{var c,d,u;const l=(d=(c=a.getMountElement)==null?void 0:c.call(a))!=null?d:a.getElement();l!==null&&((u=this.nodes.items)==null||u.appendChild(l))})}}class qb extends K{constructor(){super(...arguments),this.opened=!1,this.selection=new R,this.popover=null,this.flipperInstance=new at({focusedItemClass:et.focused,allowedKeys:[I.TAB,I.UP,I.DOWN,I.ENTER,I.RIGHT,I.LEFT]}),this.flipperKeydownHandler=null,this.flipperKeydownSource=null,this.close=()=>{this.opened&&(this.opened=!1,R.isAtBlok||this.selection.restore(),this.selection.clearSaved(),this.detachFlipperKeydownListener(),this.clearBlockSelectionOnClose(),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(Le.Closed,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null))},this.onPopoverClose=()=>{this.close()}}get events(){return{opened:Ti,closed:Bi}}get CSS(){return{settings:""}}get flipper(){return this.flipperInstance}make(){this.nodes.wrapper=v.make("div"),this.nodes.wrapper.setAttribute("data-blok-testid","block-tunes-wrapper"),this.eventsDispatcher.on(to,this.close)}destroy(){this.detachFlipperKeydownListener(),this.removeAllNodes(),this.listeners.destroy(),this.eventsDispatcher.off(to,this.close)}async open(e,t){const o=this.Blok.BlockSelection.selectedBlocks,n=o.length>1,r=n?o[0]:e!=null?e:this.Blok.BlockManager.currentBlock;if(r===void 0)return;this.opened=!0,this.selection.save(),n||(this.Blok.BlockSelection.selectBlock(r),this.Blok.BlockSelection.clearCache());const{toolTunes:i,commonTunes:a}=r.getTunes();this.eventsDispatcher.emit(this.events.opened);const l=st()?Du:Lt,c={searchable:!0,trigger:t||this.nodes.wrapper,items:await this.getTunesItems(r,a,i),scopeElement:this.Blok.API.methods.ui.nodes.redactor,messages:{nothingFound:oe.ui(he.ui.popover,"Nothing found"),search:oe.ui(he.ui.popover,"Filter")}};l===Lt&&(c.flipper=this.flipperInstance),this.popover=new l(c),this.popover.getElement().setAttribute("data-blok-testid","block-tunes-popover"),this.popover.on(Le.Closed,this.onPopoverClose),this.popover.show(),this.attachFlipperKeydownListener(r)}getElement(){return this.nodes.wrapper}contains(e){var t,o;return!!((t=this.nodes.wrapper)!=null&&t.contains(e)||(o=this.popover)!=null&&o.hasNode(e))}async getTunesItems(e,t,o){const n=[],r=this.Blok.BlockSelection.selectedBlocks,i=r.length>1;!i&&o!==void 0&&o.length>0&&(n.push(...o),n.push({type:le.Separator}));const a=Array.from(this.Blok.Tools.blockTools.values()),c=(i?await wm(r.map(d=>new $e(d)),a):await xi(e,a)).reduce((d,u)=>(u.toolbox===void 0||u.toolbox.forEach(h=>{var f,g;const p=(f=h.title)!=null?f:u.name;d.push({icon:h.icon,title:oe.t(he.toolNames,p),name:(g=h.name)!=null?g:u.name,closeOnActivate:!0,onActivate:async()=>{const{Caret:b,Toolbar:k}=this.Blok,y=await this.convertBlock(e,r,i,u,h.data);k.close(),y&&b.setToBlock(y,b.positions.END)}})}),d),[]);return c.length>0&&(n.push({icon:kb,name:"convert-to",title:oe.ui(he.ui.popover,"Convert to"),children:{items:c}}),n.push({type:le.Separator})),i?n.push({icon:Au,title:oe.t(he.blockTunes.delete,"Delete"),name:"delete",closeOnActivate:!0,onActivate:()=>{const{BlockManager:d,Caret:u,Toolbar:h}=this.Blok;d.removeSelectedBlocks()!==void 0&&d.blocks.length===0&&d.insert();const f=d.currentBlock;f&&u.setToBlock(f,u.positions.END),h.close()}}):n.push(...t),n}clearBlockSelectionOnClose(){if(this.Blok.CrossBlockSelection.isCrossBlockSelectionStarted)return;if(this.Blok.BlockSelection.selectedBlocks.length>1){this.Blok.BlockSelection.allBlocksSelected=!1;return}const o=this.Blok.BlockManager.currentBlock;o&&this.Blok.BlockSelection.unselectBlock(o)}async convertBlock(e,t,o,n,r){const{BlockManager:i}=this.Blok;if(o)return this.convertMultipleBlocks(t,n.name,r);const a=await this.getExplodableItems(e);return!this.canToolMergeMultipleItems(n)&&a!==null?this.convertMultiItemBlockToSeparateBlocks(e,n.name,r):i.convert(e,n.name,r)}async convertMultipleBlocks(e,t,o){const{Tools:n}=this.Blok;if(e.length===0)return null;const r=n.blockTools.get(t);return r&&this.canToolMergeMultipleItems(r)?this.convertBlocksToSingleMergedBlock(e,t,o):this.convertBlocksIndividually(e,t,o)}canToolMergeMultipleItems(e){const t=e.conversionConfig;if(!(t!=null&&t.import))return!1;try{const o=typeof t.import=="function"?t.import(`line1
192
- line2`,e.settings):{[t.import]:`line1
193
- line2`};return Array.isArray(o==null?void 0:o.items)&&o.items.length>1}catch(o){return!1}}async convertBlocksToSingleMergedBlock(e,t,o){var p,f;const{BlockManager:n}=this.Blok,r=[];for(const g of e)try{const b=await g.exportDataAsString();r.push(b)}catch(b){}if(r.length===0)return null;const i=e[0],a=r.join(`
194
- `),l=this.Blok.Tools.blockTools.get(t);if(!l)return null;const c=typeof((p=l.conversionConfig)==null?void 0:p.import)=="function"?l.conversionConfig.import(a,l.settings):{[(f=l.conversionConfig)==null?void 0:f.import]:a},d=o?Object.assign(c,o):c,u=n.replace(i,t,d),h=e.slice(1);for(const g of h)await n.removeBlock(g,!1);return u}async convertBlocksIndividually(e,t,o){const{BlockManager:n}=this.Blok,r=[];for(const i of e){const a=await this.convertBlockSafely(n,i,t,o);a&&r.push(a)}return r.length>0?r[r.length-1]:null}async convertBlockSafely(e,t,o,n){try{return await e.convert(t,o,n)}catch(r){return console.warn(`Failed to convert block ${t.id}:`,r),null}}async getExplodableItems(e){try{const t=await e.data;if(!Array.isArray(t==null?void 0:t.items)||t.items.length<=1)return null;const o=n=>{const r=[];for(const i of n)i.content!==void 0&&i.content!==""&&r.push(i.content),Array.isArray(i.items)&&i.items.length>0&&r.push(...o(i.items));return r};return o(t.items)}catch(t){return null}}async convertMultiItemBlockToSeparateBlocks(e,t,o){var u;const{BlockManager:n,Tools:r}=this.Blok,i=await this.getExplodableItems(e);if(!i||i.length===0)return null;const a=r.blockTools.get(t),l=(u=a==null?void 0:a.conversionConfig)==null?void 0:u.import;if(!l)return null;const c=n.getBlockIndex(e);await n.removeBlock(e,!1);const d=i.map((h,p)=>{const f=typeof l=="function"?l(h,a==null?void 0:a.settings):{[l]:h},g=o?Object.assign(f,o):f;return n.insert({tool:t,data:g,index:c+p,needToFocus:!1})});return d.length>0?d[d.length-1]:null}attachFlipperKeydownListener(e){this.detachFlipperKeydownListener();const t=e==null?void 0:e.pluginsContent;t instanceof HTMLElement&&(this.flipperInstance.setHandleContentEditableTargets(!0),this.flipperKeydownHandler=o=>{this.flipperInstance.handleExternalKeydown(o)},t.addEventListener("keydown",this.flipperKeydownHandler,!0),this.flipperKeydownSource=t)}detachFlipperKeydownListener(){this.flipperKeydownSource!==null&&this.flipperKeydownHandler!==null&&this.flipperKeydownSource.removeEventListener("keydown",this.flipperKeydownHandler,!0),this.flipperInstance.setHandleContentEditableTargets(!1),this.flipperKeydownSource=null,this.flipperKeydownHandler=null}}const Pu={SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]},zb={0:"Digit0",1:"Digit1",2:"Digit2",3:"Digit3",4:"Digit4",5:"Digit5",6:"Digit6",7:"Digit7",8:"Digit8",9:"Digit9",A:"KeyA",B:"KeyB",C:"KeyC",D:"KeyD",E:"KeyE",F:"KeyF",G:"KeyG",H:"KeyH",I:"KeyI",J:"KeyJ",K:"KeyK",L:"KeyL",M:"KeyM",N:"KeyN",O:"KeyO",P:"KeyP",Q:"KeyQ",R:"KeyR",S:"KeyS",T:"KeyT",U:"KeyU",V:"KeyV",W:"KeyW",X:"KeyX",Y:"KeyY",Z:"KeyZ",BACKSPACE:"Backspace",ENTER:"Enter",ESCAPE:"Escape",LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown",INSERT:"Insert",DELETE:"Delete",".":"Period"},jb=s=>Object.keys(Pu).find(t=>Pu[t].includes(s));class Ub{constructor(e){this.commands={SHIFT:!1,CMD:!1,ALT:!1},this.keys={},this.name=e.name,this.element=e.on,this.callback=e.callback,this.parseShortcutName(e.name),this.executeShortcut=t=>{this.execute(t)},this.element.addEventListener("keydown",this.executeShortcut,!1)}remove(){this.element.removeEventListener("keydown",this.executeShortcut)}parseShortcutName(e){const t=e.split("+");for(const o of t){const n=o.toUpperCase(),r=jb(n);r!==void 0?this.commands[r]=!0:this.keys[n]=!0}}checkModifiers(e){const t={CMD:e.ctrlKey||e.metaKey,SHIFT:e.shiftKey,ALT:e.altKey};return Object.keys(this.commands).every(n=>this.commands[n]===t[n])}checkKeys(e){return Object.keys(this.keys).every(o=>{const n=zb[o];return e.code===n})}execute(e){const t=this.checkModifiers(e),o=this.checkKeys(e);t&&o&&this.callback(e)}}let Kb=class{constructor(){this.registeredShortcuts=new Map}add(e){if(this.findShortcut(e.on,e.name))throw Error(`Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.`);const o=new Ub({name:e.name,on:e.on,callback:e.handler}),n=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[...n,o])}remove(e,t){const o=this.findShortcut(e,t);if(!o)return;o.remove();const n=this.registeredShortcuts.get(e);if(!n)return;const r=n.filter(i=>i!==o);if(r.length===0){this.registeredShortcuts.delete(e);return}this.registeredShortcuts.set(e,r)}findShortcut(e,t){return(this.registeredShortcuts.get(e)||[]).find(({name:n})=>n===t)}};const je=new Kb;var Go=(s=>(s.Opened="toolbox-opened",s.Closed="toolbox-closed",s.BlockAdded="toolbox-block-added",s))(Go||{});class Wb extends Zt{constructor({api:e,tools:t,i18nLabels:o,triggerElement:n}){super(),this.opened=!1,this.listeners=new Jt,this.popover=null,this.handleMobileLayoutToggle=()=>{this.destroyPopover(),this.initPopover()},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=e,this.tools=t,this.i18nLabels=o,this.triggerElement=n,this.enableShortcuts(),this.nodes={toolbox:v.make("div")},this.nodes.toolbox.setAttribute("data-blok-testid","toolbox"),this.initPopover(),this.api.events.on(to,this.handleMobileLayoutToggle)}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:""}}getElement(){return this.nodes.toolbox}contains(e){var t;return!!(this.nodes.toolbox.contains(e)||(t=this.popover)!=null&&t.getElement().contains(e))}hasFocus(){if(this.popover!==null)return"hasFocus"in this.popover?this.popover.hasFocus():void 0}destroy(){var e;super.destroy(),this.nodes&&this.nodes.toolbox&&this.nodes.toolbox.remove(),this.removeAllShortcuts(),(e=this.popover)==null||e.off(Le.Closed,this.onPopoverClose),this.listeners.destroy(),this.api.events.off(to,this.handleMobileLayoutToggle)}async toolButtonActivated(e,t){await this.insertNewBlock(e,t)}open(){var e;this.isEmpty||((e=this.popover)==null||e.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var e;(e=this.popover)==null||e.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}initPopover(){const e=st()?Du:Lt;this.popover=new e({scopeElement:this.api.ui.nodes.redactor,trigger:this.triggerElement||this.nodes.toolbox,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(Le.Closed,this.onPopoverClose),this.popover.getElement().setAttribute("data-blok-testid","toolbox-popover")}destroyPopover(){this.popover!==null&&(this.popover.hide(),this.popover.off(Le.Closed,this.onPopoverClose),this.popover.destroy(),this.popover=null),this.nodes.toolbox!==null&&(this.nodes.toolbox.innerHTML="")}get toolsToBeDisplayed(){if(this._toolsToBeDisplayed)return this._toolsToBeDisplayed;const e=[];return this.tools.forEach(t=>{t.toolbox&&e.push(t)}),this._toolsToBeDisplayed=e,e}get toolboxItemsToBeDisplayed(){if(this._toolboxItemsToBeDisplayed)return this._toolboxItemsToBeDisplayed;const e=(o,n,r=!0)=>{var i;return{icon:o.icon,title:oe.t(he.toolNames,o.title||Lo(n.name)),name:(i=o.name)!=null?i:n.name,onActivate:()=>{this.toolButtonActivated(n.name,o.data)},secondaryLabel:n.shortcut&&r?Kd(n.shortcut):""}},t=this.toolsToBeDisplayed.reduce((o,n)=>{const{toolbox:r}=n;return r===void 0||(Array.isArray(r)?r:[r]).forEach((a,l)=>{o.push(e(a,n,l===0))}),o},[]);return this._toolboxItemsToBeDisplayed=t,t}enableShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const t=e.shortcut;t&&this.enableShortcutForTool(e.name,t)})}enableShortcutForTool(e,t){je.add({name:t,on:this.api.ui.nodes.redactor,handler:async o=>{o.preventDefault();const n=this.api.blocks.getCurrentBlockIndex(),r=this.api.blocks.getBlockByIndex(n);if(r)try{const i=await this.api.blocks.convert(r.id,e);this.api.caret.setToBlock(i,"end");return}catch(i){}await this.insertNewBlock(e)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const t=e.shortcut;t&&je.remove(this.api.ui.nodes.redactor,t)})}async insertNewBlock(e,t){const o=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(o);if(!n)return;const r=n.isEmpty?o:o+1,a=t!==void 0&&Object.keys(t).length>0?Object.assign(await this.api.blocks.composeBlockData(e),t):void 0,l=this.api.blocks.insert(e,a,void 0,r,void 0,n.isEmpty);this.api.caret.setToBlock(r),this.emit("toolbox-block-added",{block:l}),this.api.toolbar.close()}}const Fu="block hovered",$o=1e3;class Gb extends K{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.hoveredBlock=null,this.toolboxInstance=null,this.settingsTogglerMouseDownPosition=null,this.plusButtonMouseDownPosition=null,this.lastToolbarY=null,this.onBlockSettingsOpen=()=>{var o;(o=this.nodes.settingsToggler)==null||o.classList.add(this.CSS.settingsTogglerOpened)},this.onBlockSettingsClose=()=>{var o;(o=this.nodes.settingsToggler)==null||o.classList.remove(this.CSS.settingsTogglerOpened)},this.onBlockChanged=o=>{var r;!this.opened||!this.hoveredBlock||this.Blok.BlockSettings.opened||(r=this.toolboxInstance)!=null&&r.opened||o.event.detail.target.id!==this.hoveredBlock.id||this.repositionToolbar()}}get CSS(){return{toolbar:me("absolute left-0 right-0 top-0 transition-opacity duration-100 ease-linear will-change-[opacity,top]"),toolbarOpened:"block",toolbarClosed:"hidden",content:me("relative mx-auto max-w-content"),actions:me("absolute flex opacity-0 pr-[5px]","right-full","mobile:right-auto","group-data-[blok-rtl=true]:right-auto group-data-[blok-rtl=true]:left-[calc(-1*theme(width.toolbox-btn))]","mobile:group-data-[blok-rtl=true]:ml-0 mobile:group-data-[blok-rtl=true]:mr-auto mobile:group-data-[blok-rtl=true]:pr-0 mobile:group-data-[blok-rtl=true]:pl-[10px]"),actionsOpened:"opacity-100",plusButton:me("text-dark cursor-pointer w-toolbox-btn h-toolbox-btn rounded-[7px] inline-flex justify-center items-center select-none","shrink-0","[&_svg]:h-6 [&_svg]:w-6","can-hover:hover:bg-bg-light","mobile:bg-white mobile:border mobile:border-[#e8e8eb] mobile:shadow-overlay-pane mobile:rounded-[6px] mobile:z-[2]","mobile:w-toolbox-btn-mobile mobile:h-toolbox-btn-mobile","group-data-[blok-rtl=true]:right-[calc(-1*theme(width.toolbox-btn))] group-data-[blok-rtl=true]:left-auto","not-mobile:group-data-[blok-narrow=true]:left-[5px]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:left-0 not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:right-[5px]"),plusButtonShortcutKey:"text-white",settingsToggler:me("text-dark cursor-pointer w-toolbox-btn h-toolbox-btn rounded-[7px] inline-flex justify-center items-center select-none","cursor-pointer select-none","[&_svg]:h-6 [&_svg]:w-6","active:cursor-grabbing","can-hover:hover:bg-bg-light can-hover:hover:cursor-grab","group-data-[blok-toolbox-opened=true]:can-hover:hover:cursor-pointer","mobile:bg-white mobile:border mobile:border-[#e8e8eb] mobile:shadow-overlay-pane mobile:rounded-[6px] mobile:z-[2]","mobile:w-toolbox-btn-mobile mobile:h-toolbox-btn-mobile","not-mobile:w-6"),settingsTogglerHidden:"hidden",settingsTogglerOpened:me("can-hover:hover:cursor-pointer")}}get opened(){var e,t;return(t=(e=this.nodes.wrapper)==null?void 0:e.classList.contains(this.CSS.toolbarOpened))!=null?t:!1}contains(e){var t,o;return!!((t=this.nodes.wrapper)!=null&&t.contains(e)||(o=this.toolboxInstance)!=null&&o.contains(e)||this.Blok.BlockSettings.contains(e))}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var t;(t=this.toolboxInstance)==null||t.close()},open:()=>{if(this.toolboxInstance===null){U("toolbox.open() called before initialization is finished","warn");return}this.hoveredBlock&&(this.Blok.BlockManager.currentBlock=this.hoveredBlock),this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){U("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var t;return(t=this.toolboxInstance)==null?void 0:t.hasFocus()}}}get blockActions(){return{hide:()=>{var e,t;(e=this.nodes.actions)==null||e.classList.remove(this.CSS.actionsOpened),(t=this.nodes.actions)==null||t.removeAttribute("data-blok-opened")},show:()=>{var e,t;(e=this.nodes.actions)==null||e.classList.add(this.CSS.actionsOpened),(t=this.nodes.actions)==null||t.setAttribute("data-blok-opened","true")}}}get blockTunesToggler(){return{hide:()=>{var e;return(e=this.nodes.settingsToggler)==null?void 0:e.classList.add(this.CSS.settingsTogglerHidden)},show:()=>{var e;return(e=this.nodes.settingsToggler)==null?void 0:e.classList.remove(this.CSS.settingsTogglerHidden)}}}toggleReadOnly(e){e?(this.destroy(),this.Blok.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(async()=>{await this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e){if(this.toolboxInstance===null){U("Can't open Toolbar since Blok initialization is not finished yet","warn");return}this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Blok.BlockSettings.opened&&this.Blok.BlockSettings.close();const t=e!=null?e:this.Blok.BlockManager.currentBlock;if(!t)return;this.hoveredBlock=t,this.lastToolbarY=null;const{wrapper:o,plusButton:n}=this.nodes;if(!o||!n)return;const r=t.holder,{isMobile:i}=this.Blok.UI,a=this.calculateToolbarY(t,n,i),l=Math.floor(a);this.lastToolbarY=l,o.style.top=`${l}px`,r.appendChild(o);const c=t.getTunes(),d=c.toolTunes.length>0||c.commonTunes.length>0;this.Blok.BlockManager.blocks.length===1&&t.isEmpty&&!d?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}moveAndOpenForMultipleBlocks(e){const t=this.Blok.BlockSelection.selectedBlocks;if(t.length<2)return;if(this.toolboxInstance===null){U("Can't open Toolbar since Blok initialization is not finished yet","warn");return}this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Blok.BlockSettings.opened&&this.Blok.BlockSettings.close();const o=e!=null?e:t[0];this.hoveredBlock=o,this.lastToolbarY=null;const{wrapper:n,plusButton:r}=this.nodes;if(!n||!r)return;const i=o.holder,a=Math.floor(this.calculateToolbarY(o,r,!1));this.lastToolbarY=a,n.style.top=`${a}px`,i.appendChild(n),this.blockTunesToggler.show(),this.open()}close(){var e,t,o,n;this.Blok.ReadOnly.isEnabled||((e=this.nodes.wrapper)==null||e.classList.remove(this.CSS.toolbarOpened),(t=this.nodes.wrapper)==null||t.classList.add(this.CSS.toolbarClosed),(o=this.nodes.wrapper)==null||o.removeAttribute("data-blok-opened"),this.blockActions.hide(),(n=this.toolboxInstance)==null||n.close(),this.Blok.BlockSettings.close(),this.nodes.plusButton&&(this.nodes.plusButton.style.display=""),this.reset())}reset(){this.lastToolbarY=null,this.nodes.wrapper&&(this.nodes.wrapper.style.top="unset",this.Blok.UI.nodes.wrapper.appendChild(this.nodes.wrapper))}open(e=!0){var t,o,n;(t=this.nodes.wrapper)==null||t.classList.remove(this.CSS.toolbarClosed),(o=this.nodes.wrapper)==null||o.classList.add(this.CSS.toolbarOpened),(n=this.nodes.wrapper)==null||n.setAttribute("data-blok-opened","true"),e?this.blockActions.show():this.blockActions.hide()}async make(){const e=v.make("div",[this.CSS.toolbar,this.CSS.toolbarClosed,"group-data-[blok-dragging=true]:pointer-events-none"]);this.nodes.wrapper=e,e.setAttribute(dm,""),e.setAttribute("data-blok-testid","toolbar");const t=v.make("div",this.CSS.content),o=v.make("div",[this.CSS.actions,"not-mobile:group-data-[blok-narrow=true]:right-[calc(-1*theme(spacing.narrow-mode-right-padding)-5px)]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:right-auto","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:left-[calc(-1*theme(spacing.narrow-mode-right-padding)-5px)]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:left-[-5px]"]);this.nodes.content=t,this.nodes.actions=o,o.setAttribute("data-blok-testid","toolbar-actions"),v.append(e,t),v.append(t,o);const n=v.make("div",this.CSS.plusButton,{innerHTML:wb});n.setAttribute("data-blok-testid","plus-button"),this.nodes.plusButton=n,v.append(o,n),this.readOnlyMutableListeners.on(n,"mousedown",g=>{const b=g;this.plusButtonMouseDownPosition={x:b.clientX,y:b.clientY}},!0),this.readOnlyMutableListeners.on(n,"mouseup",g=>{g.stopPropagation();const b=g,k=this.plusButtonMouseDownPosition;this.plusButtonMouseDownPosition=null,!(k===null||Math.abs(b.clientX-k.x)>$o||Math.abs(b.clientY-k.y)>$o)&&(ro(!0),this.plusButtonClicked())},!0);const r=v.make("div"),i=g=>{const b=document.createDocumentFragment(),k=g.indexOf(" ");if(k>0){const y=g.substring(0,k),T=g.substring(k);b.appendChild(v.make("span",this.CSS.plusButtonShortcutKey,{textContent:y})),b.appendChild(document.createTextNode(T))}else b.appendChild(document.createTextNode(g));return b};r.appendChild(i(oe.ui(he.ui.toolbar.toolbox,"Click to add below"))),r.appendChild(v.make("br"));const l=Ud().win?oe.ui(he.ui.toolbar.toolbox,"Ctrl-click to add above"):oe.ui(he.ui.toolbar.toolbox,"Option-click to add above");r.appendChild(i(l)),Uo(n,r,{hidingDelay:400});const c=v.make("span",[this.CSS.settingsToggler,"group-data-[blok-dragging=true]:cursor-grabbing"],{innerHTML:yb});c.setAttribute(um,""),c.setAttribute(hm,""),c.setAttribute("data-blok-testid","settings-toggler"),this.nodes.settingsToggler=c,v.append(o,c);const d=v.make("div"),u=g=>{const b=v.make("div"),[k,...y]=g.split(" "),T=v.make("span",null,{textContent:k});return T.style.color="white",b.appendChild(T),y.length>0&&b.appendChild(v.text(" "+y.join(" "))),b},h=oe.ui(he.ui.blockTunes.toggler,"Drag to move"),p=oe.ui(he.ui.blockTunes.toggler,"Click to open the menu");d.appendChild(u(h)),d.appendChild(u(p)),Uo(c,d,{hidingDelay:400}),v.append(o,this.makeToolbox());const f=this.Blok.BlockSettings.getElement();if(!f)throw new Error("Block Settings element was not created");v.append(o,f),v.append(this.Blok.UI.nodes.wrapper,e)}makeToolbox(){this.toolboxInstance=new Wb({api:this.Blok.API.methods,tools:this.Blok.Tools.blockTools,i18nLabels:{filter:oe.ui(he.ui.popover,"Filter"),nothingFound:oe.ui(he.ui.popover,"Nothing found")},triggerElement:this.nodes.plusButton}),this.toolboxInstance.on(Go.Opened,()=>{this.Blok.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier),this.Blok.UI.nodes.wrapper.setAttribute(vu,"true")}),this.toolboxInstance.on(Go.Closed,()=>{this.Blok.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier),this.Blok.UI.nodes.wrapper.removeAttribute(vu)}),this.toolboxInstance.on(Go.BlockAdded,({block:t})=>{const{BlockManager:o,Caret:n}=this.Blok,r=o.getBlockById(t.id);if(!r||r.inputs.length!==0)return;if(r===o.lastBlock){o.insertAtEnd(),n.setToBlock(o.lastBlock);return}const i=o.nextBlock;i&&n.setToBlock(i)});const e=this.toolboxInstance.getElement();if(e===null)throw new Error("Toolbox element was not created");return e}plusButtonClicked(){var e,t;this.hoveredBlock&&(this.Blok.BlockManager.currentBlock=this.hoveredBlock),this.Blok.BlockSettings.opened&&this.Blok.BlockSettings.close(),this.Blok.BlockSelection.anyBlockSelected&&this.Blok.BlockSelection.clearSelection(),(e=R.get())==null||e.removeAllRanges(),(t=this.toolboxInstance)==null||t.toggle()}enableModuleBindings(){const e=this.nodes.settingsToggler;e&&(this.readOnlyMutableListeners.on(e,"mousedown",t=>{t.stopPropagation(),ro(!0);const o=t;this.settingsTogglerMouseDownPosition={x:o.clientX,y:o.clientY}},!0),this.readOnlyMutableListeners.on(e,"mouseup",t=>{var i;t.stopPropagation();const o=t,n=this.settingsTogglerMouseDownPosition;this.settingsTogglerMouseDownPosition=null,!(n===null||Math.abs(o.clientX-n.x)>$o||Math.abs(o.clientY-n.y)>$o)&&(this.settingsTogglerClicked(),(i=this.toolboxInstance)!=null&&i.opened&&this.toolboxInstance.close())},!0)),st()||this.eventsDispatcher.on(Fu,t=>{var a;const o=t.block;if(!(o instanceof no)||this.Blok.BlockSettings.opened||(a=this.toolboxInstance)!=null&&a.opened)return;const n=this.Blok.BlockSelection.selectedBlocks,r=n.length>1,i=r&&n.some(l=>l===o);if(r&&i){this.moveAndOpenForMultipleBlocks(o);return}r||this.moveAndOpen(o)}),this.eventsDispatcher.on(Ti,this.onBlockSettingsOpen),this.eventsDispatcher.on(Bi,this.onBlockSettingsClose),this.eventsDispatcher.on(eo,this.onBlockChanged)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll(),this.eventsDispatcher.off(Ti,this.onBlockSettingsOpen),this.eventsDispatcher.off(Bi,this.onBlockSettingsClose),this.eventsDispatcher.off(eo,this.onBlockChanged)}calculateToolbarY(e,t,o){const r=e.holder.getBoundingClientRect(),a=e.pluginsContent.getBoundingClientRect().top-r.top,l=window.getComputedStyle(e.pluginsContent),c=parseInt(l.paddingTop,10)||0,d=parseFloat(l.lineHeight)||24,u=parseInt(window.getComputedStyle(t).height,10);return o?a-u:a+c+d/2-u/2}repositionToolbar(){const{wrapper:e,plusButton:t}=this.nodes;if(!e||!t||!this.hoveredBlock)return;const o=Math.floor(this.calculateToolbarY(this.hoveredBlock,t,this.Blok.UI.isMobile));(this.lastToolbarY===null||Math.abs(o-this.lastToolbarY)>2)&&(this.lastToolbarY=o,e.style.top=`${o}px`)}settingsTogglerClicked(){var t;const e=(t=this.hoveredBlock)!=null?t:this.Blok.BlockManager.currentBlock;e&&(this.hoveredBlock=e,this.Blok.BlockManager.currentBlock=e,this.Blok.BlockSettings.opened?this.Blok.BlockSettings.close():this.Blok.BlockSettings.open(e,this.nodes.settingsToggler))}async drawUI(){this.Blok.BlockSettings.make(),await this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy()}}var yt=(s=>(s[s.Block=0]="Block",s[s.Inline=1]="Inline",s[s.Tune=2]="Tune",s))(yt||{}),Vo=(s=>(s.Shortcut="shortcut",s.Toolbox="toolbox",s.EnabledInlineTools="inlineToolbar",s.EnabledBlockTunes="tunes",s.Config="config",s))(Vo||{}),Hu=(s=>(s.Shortcut="shortcut",s.SanitizeConfig="sanitize",s))(Hu||{}),Dt=(s=>(s.IsEnabledLineBreaks="enableLineBreaks",s.Toolbox="toolbox",s.ConversionConfig="conversionConfig",s.IsReadOnlySupported="isReadOnlySupported",s.PasteConfig="pasteConfig",s))(Dt||{}),qu=(s=>(s.IsInline="isInline",s.Title="title",s.IsReadOnlySupported="isReadOnlySupported",s))(qu||{}),zi=(s=>(s.IsTune="isTune",s))(zi||{});class ji{constructor({name:e,constructable:t,config:o,api:n,isDefault:r,isInternal:i=!1,defaultPlaceholder:a}){this.api=n,this.name=e,this.constructable=t,this.config=o,this.isDefault=r,this.isInternal=i,this.defaultPlaceholder=a}get settings(){var t;const e=(t=this.config.config)!=null?t:{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(V(this.constructable.reset))return this.constructable.reset()}prepare(){const e=this.constructable.prepare;if(!V(e))return;const t={toolName:this.name,config:this.settings};return e.call(this.constructable,t)}get shortcut(){const e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===yt.Inline}isBlock(){return this.type===yt.Block}isTune(){return this.type===yt.Tune}}class $b extends K{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.opened=!1,this.popover=null,this.toolbarVerticalMargin=st()?20:6,this.initialized=!1,this.initializationScheduled=!1,this.tools=new Map,this.registeredShortcuts=new Map,this.shortcutsRegistered=!1,this.shortcutRegistrationScheduled=!1,this.listeners.on(document,"keydown",o=>{const n=o;n.shiftKey&&(n.key==="ArrowDown"||n.key==="ArrowUp")&&this.tryToShow()},!0),this.scheduleInitialization(),this.tryRegisterShortcuts()}set state(e){super.state=e,this.tryRegisterShortcuts()}initialize(){var e,t,o;if(!this.initialized){if(!((o=(t=(e=this.Blok)==null?void 0:e.UI)==null?void 0:t.nodes)!=null&&o.wrapper)||this.Blok.Tools===void 0){this.scheduleInitialization();return}this.make(),this.tryRegisterShortcuts(),this.initialized=!0}}tryRegisterShortcuts(){var t;if(this.shortcutsRegistered)return;if(((t=this.Blok)==null?void 0:t.Tools)===void 0){this.scheduleShortcutRegistration();return}this.registerInitialShortcuts()&&(this.shortcutsRegistered=!0)}scheduleShortcutRegistration(){if(this.shortcutsRegistered||this.shortcutRegistrationScheduled)return;this.shortcutRegistrationScheduled=!0;const e=()=>{this.shortcutRegistrationScheduled=!1,this.tryRegisterShortcuts()};typeof window!="undefined"&&typeof window.setTimeout=="function"?window.setTimeout(e,0):e()}scheduleInitialization(){if(this.initialized||this.initializationScheduled)return;this.initializationScheduled=!0;const e=()=>{this.initializationScheduled=!1,this.initialize()},t=()=>{window.setTimeout(e,0)};typeof window!="undefined"&&"requestIdleCallback"in window?window.requestIdleCallback(()=>{t()},{timeout:2e3}):t()}async tryToShow(e=!1){e&&this.close(),this.initialize(),this.allowedToShow()&&(await this.open(),this.Blok.Toolbar.close())}close(){var o,n,r,i,a,l,c,d;if(!this.opened)return;this.tools=new Map,this.opened=!1,this.popover&&((n=(o=this.popover).hide)==null||n.call(o),(i=(r=this.popover).destroy)==null||i.call(r),this.popover=null),this.nodes.wrapper&&(this.nodes.wrapper.innerHTML="");const e=Lu.mock,t=(l=(a=e==null?void 0:e.results)==null?void 0:a.at(-1))==null?void 0:l.value;t&&((c=t.hide)==null||c.call(t),(d=t.destroy)==null||d.call(t))}containsNode(e){return this.nodes.wrapper===void 0?!1:!!(this.nodes.wrapper.contains(e)||this.popover!==null&&this.popover.hasNode(e))}destroy(){var e,t,o,n;this.popover&&((t=(e=this.popover).hide)==null||t.call(e),(n=(o=this.popover).destroy)==null||n.call(o),this.popover=null),this.removeAllNodes()}make(){this.nodes.wrapper=v.make("div",j("absolute top-0 left-0 z-[3] opacity-100 visible","transition-opacity duration-[250ms] ease-out","will-change-[opacity,left,top]","[&_[hidden]]:!hidden")),this.nodes.wrapper.setAttribute(_t,Qg),this.nodes.wrapper.setAttribute("data-blok-testid","inline-toolbar"),v.append(this.Blok.UI.nodes.wrapper,this.nodes.wrapper)}async open(){var i,a,l,c,d,u,h,p,f,g,b,k,y,T,C,N,x,E,w,_,F;if(this.opened||(this.initialize(),this.opened=!0,this.popover&&((a=(i=this.popover).hide)==null||a.call(i),(c=(l=this.popover).destroy)==null||c.call(l),this.popover=null),this.createToolsInstances(),!this.nodes.wrapper))return;this.nodes.wrapper.innerHTML="";const e=await this.buildPopoverItems(),t=(f=(p=(h=(u=(d=this.Blok.API)==null?void 0:d.methods)==null?void 0:u.ui)==null?void 0:h.nodes)==null?void 0:p.redactor)!=null?f:this.Blok.UI.nodes.redactor;this.popover=new Lu({items:e,scopeElement:t,messages:{nothingFound:oe.ui(he.ui.popover,"Nothing found"),search:oe.ui(he.ui.popover,"Filter")}});const o=(T=(b=(g=this.popover).getMountElement)==null?void 0:b.call(g))!=null?T:(y=(k=this.popover).getElement)==null?void 0:y.call(k),n=(N=(C=this.popover).getElement)==null?void 0:N.call(C),r=(w=(E=(x=this.popover.size)==null?void 0:x.width)!=null?E:n==null?void 0:n.getBoundingClientRect().width)!=null?w:0;this.applyPosition(r),o&&this.nodes.wrapper&&this.nodes.wrapper.appendChild(o),(F=(_=this.popover).show)==null||F.call(_)}async buildPopoverItems(){const e=[],t=Array.from(this.tools.entries());for(const[o,[n,r]]of t.entries()){const i=await r.render(),a=this.getToolShortcut(n.name),l=a!==void 0?Kd(a):void 0,c=oe.t(he.toolNames,n.title||Lo(n.name)),d=Array.isArray(i)?i:[i],u=o===0;for(const h of d){const p=this.processPopoverItem(h,n.name,c,l,u);e.push(...p)}}return e}processPopoverItem(e,t,o,n,r){const i=[],a={name:t,hint:{title:o,description:n}};if(e instanceof HTMLElement)return i;if(e.type===le.Html)return i.push(Se(q(q({},a),e),{type:le.Html})),i;if(e.type===le.Separator)return i.push({type:le.Separator}),i;const l=Se(q(q({},a),e),{type:le.Default});return i.push(l),"children"in l&&r&&i.push({type:le.Separator}),i}applyPosition(e){if(!this.nodes.wrapper)return;const t=this.Blok.UI.nodes.wrapper.getBoundingClientRect(),o=this.Blok.UI.contentRect,n=R.rect,r={x:n.x-t.x,y:n.y+n.height-t.top+this.toolbarVerticalMargin};r.x+e+t.x>o.right&&(r.x=o.right-e-t.x),this.nodes.wrapper.style.left=Math.floor(r.x)+"px",this.nodes.wrapper.style.top=Math.floor(r.y)+"px"}allowedToShow(){const e=["IMG","INPUT"],t=this.resolveSelection(),o=R.text;if(!t||!t.anchorNode||t.isCollapsed||o.length<1)return!1;const n=v.isElement(t.anchorNode)?t.anchorNode:t.anchorNode.parentElement;if(n===null||t!==null&&e.includes(n.tagName))return!1;const r=v.isElement(t.anchorNode)?t.anchorNode:t.anchorNode.parentElement,i=r?this.Blok.BlockManager.getBlock(r):null,a=i!=null?i:this.Blok.BlockManager.currentBlock;if(a==null||this.getTools().some(f=>a.tool.inlineTools.has(f.name))===!1)return!1;const d="[contenteditable]";if(n.closest(d)!==null)return!0;const h=a.holder;return h&&(h.matches(d)?h:h.closest(d))?!0:this.Blok.ReadOnly.isEnabled?R.isSelectionAtBlok(t):!1}getTools(){var o;const e=(o=this.Blok.BlockManager.currentBlock)!=null?o:(()=>{const n=this.resolveSelection(),r=n==null?void 0:n.anchorNode;if(!r)return null;const i=v.isElement(r)?r:r.parentElement;return i?this.Blok.BlockManager.getBlock(i):null})();return e?Array.from(e.tool.inlineTools.values()).filter(n=>!(this.Blok.ReadOnly.isEnabled&&n.isReadOnlySupported!==!0)):[]}createToolsInstances(){this.tools=new Map,this.getTools().forEach(t=>{const o=t.create();this.tools.set(t,o)})}tryEnableShortcut(e,t){if(t!==void 0)try{this.enableShortcuts(e,t)}catch(o){}}getToolShortcut(e){const{Tools:t}=this.Blok,o=t.inlineTools.get(e),n=t.internal.inlineTools;return Array.from(n.keys()).includes(e)?this.inlineTools[e][Hu.Shortcut]:o==null?void 0:o.shortcut}enableShortcuts(e,t){const o=this.registeredShortcuts.get(e);o!==t&&(this.isShortcutTakenByAnotherTool(e,t)||(o!==void 0&&(je.remove(document,o),this.registeredShortcuts.delete(e)),je.add({name:t,handler:n=>{const{currentBlock:r}=this.Blok.BlockManager;r&&r.tool.enabledInlineTools!==!1&&(n.preventDefault(),this.activateToolByShortcut(e))},on:document}),this.registeredShortcuts.set(e,t)))}isShortcutTakenByAnotherTool(e,t){return Array.from(this.registeredShortcuts.entries()).some(([o,n])=>o!==e&&n===t)}async activateToolByShortcut(e){if(this.opened||await this.tryToShow(),this.popover){this.popover.activateItemByName(e);return}this.invokeToolActionDirectly(e)}invokeToolActionDirectly(e){const t=this.Blok.Tools.inlineTools.get(e);if(!t)return;const n=t.create().render(),r=Array.isArray(n)?n:[n];for(const i of r)if("onActivate"in i&&typeof i.onActivate=="function"){i.onActivate(i);return}}get inlineTools(){const e={};return Array.from(this.Blok.Tools.inlineTools.entries()).forEach(([t,o])=>{e[t]=o.create()}),e}registerInitialShortcuts(){var o;const e=(o=this.Blok.Tools)==null?void 0:o.inlineTools;if(!e)return this.scheduleShortcutRegistration(),!1;const t=Array.from(e.keys());return t.length===0?(this.scheduleShortcutRegistration(),!1):(t.forEach(n=>{const r=this.getToolShortcut(n);this.tryEnableShortcut(n,r)}),!0)}resolveSelection(){const e=R.selection;if(e!==void 0)return e;const t=R.instance;return t!==void 0?t:R.get()}}const Ui=" ",Ki=new WeakSet,Wi=()=>{var i,a;const s=window.getSelection();if(s===null)return[null,0];const e=s.focusNode,t=s.focusOffset;if(e===null)return[null,0];if(e.nodeType===Node.TEXT_NODE||e.childNodes.length===0)return[e,t];const o=e.childNodes[t];if(o!==void 0)return[o,0];const n=(i=e.childNodes[t-1])!=null?i:null,r=(a=n==null?void 0:n.textContent)!=null?a:null;return[n,r!==null?r.length:0]},zu=s=>{var t;if(!(s instanceof HTMLElement)||v.isSingleTag(s)||v.isNativeInput(s))return!1;if(s.childNodes.length===0)return!0;const e=(t=s.textContent)!=null?t:"";return e.includes(Ui)||!ui(e)?!1:Array.from(s.children).every(o=>zu(o))},ju=typeof window!="undefined"&&typeof window.MutationObserver!="undefined"?new window.MutationObserver(s=>{for(const e of s){const t=e.nextSibling;e.removedNodes.forEach(o=>{var l,c,d;if(!(o instanceof Element)||!zu(o))return;const n=t instanceof Text?t:null;if(n===null||!n.isConnected)return;const r=n.parentElement;if(!((l=r==null?void 0:r.isContentEditable)!=null&&l))return;const i=(d=(c=n.textContent)==null?void 0:c[0])!=null?d:null;(i===Ui||i===" ")&&Ki.add(n)})}}):null,Uu=new WeakSet,Ku=s=>{if(ju===null||Uu.has(s))return;const e=()=>{s.body!==null&&(ju.observe(s.body,{childList:!0,subtree:!0}),Uu.add(s))};s.readyState==="loading"?s.addEventListener("DOMContentLoaded",e,{once:!0}):e()};typeof window!="undefined"&&typeof window.document!="undefined"&&Ku(window.document);const Vb=s=>{var n,r;Ku(s.ownerDocument);const[e,t]=Wi();if(e===null||!s.contains(e)||e.nodeType===Node.TEXT_NODE&&t<((n=e.textContent)!=null?n:"").length)return null;const o=document.createTreeWalker(s,NodeFilter.SHOW_TEXT);for(o.currentNode=e;;){const i=o.nextNode();if(i===null)return null;const a=(r=i.textContent)!=null?r:"";if(a.length===0)continue;const l=a[0];if(!(l===Ui||l===" ")||i===e)return null;const d=document.createRange();try{d.setStart(e,t),d.setEnd(i,0)}catch(g){return null}const u=d.cloneContents(),h=document.createElement("div");h.appendChild(u);const p=Array.from(h.querySelectorAll("*")).some(g=>{var k;const b=(k=g.textContent)!=null?k:"";return b.length===0||ui(b)}),f=Ki.has(i);if(!(!p&&!f))return f&&Ki.delete(i),{node:i,offset:0}}},Wu=(s,e,t,o)=>{const n=document.createRange();o==="left"?(n.selectNodeContents(s),n.setEnd(e,t)):(n.selectNodeContents(s),n.setStart(e,t));const r=n.cloneContents(),i=document.createElement("div");i.appendChild(r);const a=i.textContent||"";if(i.querySelectorAll("img, br, hr, input, area, base, col, embed, link, meta, param, source, track, wbr").length>0)return!1;const c=a.includes(" ")||i.innerHTML.includes("&nbsp;")||n.toString().includes(" "),d=e.nodeType===Node.TEXT_NODE&&(o==="left"?(e.textContent||"").slice(0,t):(e.textContent||"").slice(t)).includes(" ");if(c||d)return!1;i.style.position="absolute",i.style.visibility="hidden",i.style.height="auto",i.style.width="auto",i.style.whiteSpace=window.getComputedStyle(s).whiteSpace,document.body.appendChild(i);const u=i.getBoundingClientRect().width;return document.body.removeChild(i),!(u>0||!ui(a)||window.getComputedStyle(s).whiteSpace.startsWith("pre")&&a.length>0)},Yo=s=>{var i;const e=v.getDeepestNode(s);if(e===null||v.isEmpty(s))return!0;if(v.isNativeInput(e))return e.selectionEnd===0;if(v.isEmpty(s))return!0;const[t,o]=Wi();if(t===null)return!1;const n=window.getSelection(),r=(i=n==null?void 0:n.focusNode)!=null?i:null;return r!==null&&r!==s&&!(r.nodeType===Node.TEXT_NODE&&r.parentNode===s)?!1:Wu(s,t,o,"left")},Xo=s=>{const e=v.getDeepestNode(s,!0);if(e===null)return!0;if(v.isNativeInput(e))return e.selectionEnd===e.value.length;const[t,o]=Wi();return t===null?!1:Wu(s,t,o,"right")},Yb=(s,e=!0)=>{var u,h,p,f;if(v.isNativeInput(s)){s.focus();const g=e?0:s.value.length;s.setSelectionRange(g,g);return}const t=document.createRange(),o=window.getSelection();if(!o)return;const n=(g,b=!1)=>{const k=document.createTextNode("");b?g.insertBefore(k,g.firstChild):g.appendChild(k),t.setStart(k,0),t.setEnd(k,0)},r=(g,b)=>{if(g===null)return null;if(g.nodeType===Node.TEXT_NODE)return g;const k=b?g.firstChild:g.lastChild;return r(k,b)},i=s.childNodes,a=e?(u=i[0])!=null?u:null:(h=i[i.length-1])!=null?h:null,l=r(a,e);if(a===null){n(s),o.removeAllRanges(),o.addRange(t);return}if(l===null||l.nodeType!==Node.TEXT_NODE){n(s,e),o.removeAllRanges(),o.addRange(t);return}const c=(f=(p=l.textContent)==null?void 0:p.length)!=null?f:0,d=e?0:c;t.setStart(l,d),t.setEnd(l,d),o.removeAllRanges(),o.addRange(t)},Gu={Backspace:I.BACKSPACE,Delete:I.DELETE,Enter:I.ENTER,Tab:I.TAB,ArrowDown:I.DOWN,ArrowRight:I.RIGHT,ArrowUp:I.UP,ArrowLeft:I.LEFT},Xb=new Set(["Enter","Process","Spacebar","Space","Dead"]),Zo='[contenteditable="true"], textarea, input',pt=class pt extends K{keydown(e){if(this.handleNavigationModeKeys(e))return;if(e.key==="Escape"){this.handleEscapeToEnableNavigation(e);return}if(this.beforeKeydownProcessing(e),this.handleSelectedBlocksDeletion(e)||e.defaultPrevented)return;switch(this.getKeyCode(e)){case I.BACKSPACE:this.backspace(e);break;case I.DELETE:this.delete(e);break;case I.ENTER:this.enter(e);break;case I.DOWN:case I.RIGHT:this.arrowRightAndDown(e);break;case I.UP:case I.LEFT:this.arrowLeftAndUp(e);break;case I.TAB:this.tabPressed(e);break}e.key==="/"&&!e.ctrlKey&&!e.metaKey&&this.slashPressed(e),e.code==="Slash"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.commandSlashPressed())}handleSelectedBlocksDeletion(e){const{BlockSelection:t,BlockManager:o,Caret:n,BlockSettings:r}=this.Blok;if(r.contains(e.target))return!1;const i=e.key==="Backspace"||e.key==="Delete",a=R.isSelectionExists,l=R.isCollapsed===!0;if(!(i&&t.anyBlockSelected&&(!a||l)))return!1;const d=o.removeSelectedBlocks();if(d!==void 0){const u=o.insertDefaultBlockAtIndex(d,!0);n.setToBlock(u,n.positions.START)}return t.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),!0}handleEscapeToEnableNavigation(e){const{BlockSelection:t,BlockSettings:o,InlineToolbar:n,Toolbar:r}=this.Blok;o.opened||n.opened||r.toolbox.opened||t.anyBlockSelected||(e.preventDefault(),r.close(),t.enableNavigationMode())}handleNavigationModeKeys(e){const{BlockSelection:t}=this.Blok;if(!t.navigationModeEnabled)return!1;switch(e.key){case"ArrowDown":return e.preventDefault(),e.stopPropagation(),t.navigateNext(),!0;case"ArrowUp":return e.preventDefault(),e.stopPropagation(),t.navigatePrevious(),!0;case"Enter":return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.disableNavigationMode(!0),!0;case"Escape":return e.preventDefault(),e.stopPropagation(),t.disableNavigationMode(!1),!0;default:return this.isPrintableKeyEvent(e)&&t.disableNavigationMode(!0),!1}}beforeKeydownProcessing(e){!this.needToolbarClosing(e)||!this.isPrintableKeyEvent(e)||(this.Blok.Toolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey)||this.Blok.BlockSelection.clearSelection(e)}keyup(e){e.shiftKey||this.Blok.UI.checkEmptiness()}input(e){e.inputType!=="insertText"||e.data!==" "||this.handleListShortcut()}handleListShortcut(){var g;const{BlockManager:e,Caret:t,Tools:o}=this.Blok,n=e.currentBlock;if(!n||!n.tool.isDefault||!o.blockTools.get("list"))return;const i=n.currentInput;if(!i)return;const a=i.textContent||"",l=pt.CHECKLIST_PATTERN.exec(a);if(l){const b=((g=l[1])==null?void 0:g.toLowerCase())==="x",k=e.replace(n,"list",{style:"checklist",items:[{content:"",checked:b}]});t.setToBlock(k,t.positions.START);return}if(pt.UNORDERED_LIST_PATTERN.exec(a)){const b=e.replace(n,"list",{style:"unordered",items:[{content:"",checked:!1}]});t.setToBlock(b,t.positions.START);return}const d=pt.ORDERED_LIST_PATTERN.exec(a);if(!d)return;const u=parseInt(d[1],10),p={style:"ordered",items:[{content:"",checked:!1}]};u!==1&&(p.start=u);const f=e.replace(n,"list",p);t.setToBlock(f,t.positions.START)}handleCommandC(e){const{BlockSelection:t}=this.Blok;t.anyBlockSelected&&t.copySelectedBlocks(e)}handleCommandX(e){const{BlockSelection:t,BlockManager:o,Caret:n}=this.Blok;t.anyBlockSelected&&t.copySelectedBlocks(e).then(()=>{const r=o.removeSelectedBlocks();if(r!==void 0){const i=o.insertDefaultBlockAtIndex(r,!0);n.setToBlock(i,n.positions.START)}t.clearSelection(e)}).catch(()=>{})}tabPressed(e){const{InlineToolbar:t,Caret:o}=this.Blok;if(t.opened)return;(e.shiftKey?o.navigatePrevious(!0):o.navigateNext(!0))&&e.preventDefault()}commandSlashPressed(){this.Blok.BlockSelection.selectedBlocks.length>1||this.activateBlockSettings()}slashPressed(e){if(!this.Blok.UI.nodes.wrapper.contains(e.target))return;const o=this.Blok.BlockManager.currentBlock;o!=null&&o.isEmpty&&(e.preventDefault(),this.Blok.Caret.insertContentAtCaretPosition("/"),this.activateToolbox())}enter(e){const{BlockManager:t,UI:o}=this.Blok,n=t.currentBlock;if(n===void 0||n.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey&&!di)return;const r=n.currentInput!==void 0&&Yo(n.currentInput)&&!n.hasMedia?(this.Blok.BlockManager.insertDefaultBlockAtIndex(this.Blok.BlockManager.currentBlockIndex),n):n.currentInput&&Xo(n.currentInput)?this.Blok.BlockManager.insertDefaultBlockAtIndex(this.Blok.BlockManager.currentBlockIndex+1):this.Blok.BlockManager.split();this.Blok.Caret.setToBlock(r),this.Blok.Toolbar.moveAndOpen(r),e.preventDefault()}backspace(e){const{BlockManager:t,Caret:o}=this.Blok,{currentBlock:n,previousBlock:r}=t;if(n===void 0||!R.isCollapsed||!n.currentInput||!Yo(n.currentInput))return;if(e.preventDefault(),this.Blok.Toolbar.close(),!(n.currentInput===n.firstInput)){o.navigatePrevious();return}if(r===null)return;if(r.isEmpty){t.removeBlock(r);return}if(n.isEmpty){t.removeBlock(n);const l=t.currentBlock;l&&o.setToBlock(l,o.positions.END);return}Tu(r,n)?this.mergeBlocks(r,n):o.setToBlock(r,o.positions.END)}delete(e){const{BlockManager:t,Caret:o}=this.Blok,{currentBlock:n,nextBlock:r}=t;if(n===void 0||!R.isCollapsed||!n.currentInput||!Xo(n.currentInput))return;if(e.preventDefault(),this.Blok.Toolbar.close(),!(n.currentInput===n.lastInput)){o.navigateNext();return}if(r===null)return;if(r.isEmpty){t.removeBlock(r);return}if(n.isEmpty){t.removeBlock(n),o.setToBlock(r,o.positions.START);return}Tu(n,r)?this.mergeBlocks(n,r):o.setToBlock(r,o.positions.START)}mergeBlocks(e,t){const{BlockManager:o,Toolbar:n}=this.Blok;e.lastInput!==void 0&&(Yb(e.lastInput,!1),o.mergeBlocks(e,t).then(()=>{n.close()}).catch(()=>{}))}arrowRightAndDown(e){var k;const t=this.getKeyCode(e);if(t===null)return;const o=at.usedKeys.includes(t)&&(!e.shiftKey||t===I.TAB);if(this.Blok.UI.someToolbarOpened&&o)return;e.shiftKey||this.Blok.Toolbar.close();const n=R.get();n!=null&&n.anchorNode&&!this.Blok.BlockSelection.anyBlockSelected&&this.Blok.BlockManager.setCurrentBlockByChildNode(n.anchorNode);const{currentBlock:r}=this.Blok.BlockManager,i=e.target,a=document.activeElement instanceof HTMLElement?document.activeElement:null,l=[r==null?void 0:r.inputs.find(y=>i!==null&&y.contains(i)),r==null?void 0:r.inputs.find(y=>a!==null&&y.contains(a)),i==null?void 0:i.closest(Zo),a==null?void 0:a.closest(Zo)],c=(k=r==null?void 0:r.currentInput)!=null?k:l.find(y=>y instanceof HTMLElement),u=(c!==void 0?Xo(c):void 0)||this.Blok.BlockSelection.anyBlockSelected,h=e.shiftKey&&t===I.DOWN;if(h&&u){this.Blok.CrossBlockSelection.toggleBlockSelectedState();return}h&&this.Blok.InlineToolbar.tryToShow();const f=t===I.RIGHT&&!e.shiftKey&&!this.isRtl&&c instanceof HTMLElement?Vb(c):null;if(f!==null){R.setCursor(f.node,f.offset),e.preventDefault();return}if(t===I.DOWN||t===I.RIGHT&&!this.isRtl?this.Blok.Caret.navigateNext():this.Blok.Caret.navigatePrevious()){e.preventDefault();return}Mo(()=>{this.Blok.BlockManager.currentBlock&&this.Blok.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Blok.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){var g;const t=this.Blok.UI.someToolbarOpened,o=this.getKeyCode(e);if(o===null||t&&at.usedKeys.includes(o)&&(!e.shiftKey||o===I.TAB))return;t&&this.Blok.UI.closeAllToolbars(),e.shiftKey||this.Blok.Toolbar.close();const n=window.getSelection();n!=null&&n.anchorNode&&!this.Blok.BlockSelection.anyBlockSelected&&this.Blok.BlockManager.setCurrentBlockByChildNode(n.anchorNode);const{currentBlock:r}=this.Blok.BlockManager,i=e.target,a=document.activeElement instanceof HTMLElement?document.activeElement:null,l=[r==null?void 0:r.inputs.find(b=>i!==null&&b.contains(i)),r==null?void 0:r.inputs.find(b=>a!==null&&b.contains(a)),i==null?void 0:i.closest(Zo),a==null?void 0:a.closest(Zo)],c=(g=r==null?void 0:r.currentInput)!=null?g:l.find(b=>b instanceof HTMLElement),u=(c!==void 0?Yo(c):void 0)||this.Blok.BlockSelection.anyBlockSelected,h=e.shiftKey&&o===I.UP;if(h&&u){this.Blok.CrossBlockSelection.toggleBlockSelectedState(!1);return}if(h&&this.Blok.InlineToolbar.tryToShow(),o===I.UP||o===I.LEFT&&!this.isRtl?this.Blok.Caret.navigatePrevious():this.Blok.Caret.navigateNext()){e.preventDefault();return}Mo(()=>{this.Blok.BlockManager.currentBlock&&this.Blok.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Blok.BlockSelection.clearSelection(e)}needToolbarClosing(e){const t=this.getKeyCode(e),o=t===I.ENTER,n=t===I.TAB,r=o&&this.Blok.Toolbar.toolbox.opened,i=o&&this.Blok.BlockSettings.opened,a=o&&this.Blok.InlineToolbar.opened,l=n;return!(e.shiftKey||l||r||i||a)}activateToolbox(){this.Blok.Toolbar.opened||this.Blok.Toolbar.moveAndOpen(),this.Blok.Toolbar.toolbox.open()}activateBlockSettings(){this.Blok.Toolbar.opened||this.Blok.Toolbar.moveAndOpen(),this.Blok.BlockSettings.opened||Promise.resolve(this.Blok.BlockSettings.open()).catch(()=>{})}getKeyCode(e){const t=e.key&&Gu[e.key];if(t!==void 0&&typeof t=="number")return t;const o=e.code&&Gu[e.code];return o!==void 0&&typeof o=="number"?o:null}isPrintableKeyEvent(e){return e.key?e.key.length===1||Xb.has(e.key):!1}};pt.ORDERED_LIST_PATTERN=/^(\d+)[.)]\s$/,pt.CHECKLIST_PATTERN=/^\[(x|X| )?\]\s$/,pt.UNORDERED_LIST_PATTERN=/^[-*]\s$/;let Gi=pt;class $i{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return zd(this.workingArea.children)}static set(e,t,o){return isNaN(Number(t))?(Reflect.set(e,t,o),!0):(e.insert(+t,o),!0)}static get(e,t){return isNaN(Number(t))?Reflect.get(e,t):e.get(+t)}push(e){this.blocks.push(e),this.insertToDOM(e)}move(e,t,o=!1){const n=this.blocks.splice(t,1)[0];if(!o){const i=e-1,a=Math.max(0,i),l=this.blocks[a],c=e>0?"afterend":"beforebegin";this.insertToDOM(n,c,l)}this.blocks.splice(e,0,n);const r=this.composeBlockEvent("move",{fromIndex:t,toIndex:e});n.call(Qe.MOVED,r)}insert(e,t,o=!1){if(!this.length){this.push(t);return}const n=e>this.length?this.length:e;o&&(this.blocks[n].holder.remove(),this.blocks[n].call(Qe.REMOVED));const r=o?1:0;if(this.blocks.splice(n,r,t),n>0){const a=this.blocks[n-1];this.insertToDOM(t,"afterend",a);return}const i=this.blocks[n+1];if(i!==void 0){this.insertToDOM(t,"beforebegin",i);return}this.insertToDOM(t)}replace(e,t){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(t.holder),this.blocks[e]=t}insertMany(e,t){const o=new DocumentFragment;for(const n of e)o.appendChild(n.holder);if(!this.length){this.blocks.push(...e),this.workingArea.appendChild(o),e.forEach(n=>n.call(Qe.RENDERED));return}if(t>0){const n=Math.min(t-1,this.length-1);this.blocks[n].holder.after(o)}t===0&&this.workingArea.prepend(o),this.blocks.splice(t,0,...e),e.forEach(n=>n.call(Qe.RENDERED))}remove(e){const t=isNaN(e)?this.length-1:e;this.blocks[t].holder.remove(),this.blocks[t].call(Qe.REMOVED),this.blocks.splice(t,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(Qe.REMOVED)),this.blocks.length=0}insertAfter(e,t){const o=this.blocks.indexOf(e);this.insert(o+1,t)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,t,o){t&&o!==void 0?o.holder.insertAdjacentElement(t,e.holder):this.workingArea.appendChild(e.holder),e.call(Qe.RENDERED)}composeBlockEvent(e,t){return new CustomEvent(e,{detail:t})}}function $u(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(s);e&&(o=o.filter(function(n){return Object.getOwnPropertyDescriptor(s,n).enumerable})),t.push.apply(t,o)}return t}function Ye(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$u(Object(t),!0).forEach(function(o){Zb(s,o,t[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):$u(Object(t)).forEach(function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(t,o))})}return s}function Jo(s){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jo=function(e){return typeof e}:Jo=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jo(s)}function Zb(s,e,t){return e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function ot(){return ot=Object.assign||function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(s[o]=t[o])}return s},ot.apply(this,arguments)}function Jb(s,e){if(s==null)return{};var t={},o=Object.keys(s),n,r;for(r=0;r<o.length;r++)n=o[r],!(e.indexOf(n)>=0)&&(t[n]=s[n]);return t}function Qb(s,e){if(s==null)return{};var t=Jb(s,e),o,n;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(s);for(n=0;n<r.length;n++)o=r[n],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(s,o)&&(t[o]=s[o])}return t}var ev="1.15.6";function nt(s){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(s)}var rt=nt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),ao=nt(/Edge/i),Vu=nt(/firefox/i),lo=nt(/safari/i)&&!nt(/chrome/i)&&!nt(/android/i),Vi=nt(/iP(ad|od|hone)/i),Yu=nt(/chrome/i)&&nt(/android/i),Xu={capture:!1,passive:!1};function G(s,e,t){s.addEventListener(e,t,!rt&&Xu)}function W(s,e,t){s.removeEventListener(e,t,!rt&&Xu)}function Qo(s,e){if(e){if(e[0]===">"&&(e=e.substring(1)),s)try{if(s.matches)return s.matches(e);if(s.msMatchesSelector)return s.msMatchesSelector(e);if(s.webkitMatchesSelector)return s.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function Zu(s){return s.host&&s!==document&&s.host.nodeType?s.host:s.parentNode}function Ue(s,e,t,o){if(s){t=t||document;do{if(e!=null&&(e[0]===">"?s.parentNode===t&&Qo(s,e):Qo(s,e))||o&&s===t)return s;if(s===t)break}while(s=Zu(s))}return null}var Ju=/\s+/g;function Ie(s,e,t){if(s&&e)if(s.classList)s.classList[t?"add":"remove"](e);else{var o=(" "+s.className+" ").replace(Ju," ").replace(" "+e+" "," ");s.className=(o+(t?" "+e:"")).replace(Ju," ")}}function D(s,e,t){var o=s&&s.style;if(o){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(s,""):s.currentStyle&&(t=s.currentStyle),e===void 0?t:t[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=t+(typeof t=="string"?"":"px")}}function Pt(s,e){var t="";if(typeof s=="string")t=s;else do{var o=D(s,"transform");o&&o!=="none"&&(t=o+" "+t)}while(!e&&(s=s.parentNode));var n=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return n&&new n(t)}function Qu(s,e,t){if(s){var o=s.getElementsByTagName(e),n=0,r=o.length;if(t)for(;n<r;n++)t(o[n],n);return o}return[]}function Xe(){var s=document.scrollingElement;return s||document.documentElement}function ce(s,e,t,o,n){if(!(!s.getBoundingClientRect&&s!==window)){var r,i,a,l,c,d,u;if(s!==window&&s.parentNode&&s!==Xe()?(r=s.getBoundingClientRect(),i=r.top,a=r.left,l=r.bottom,c=r.right,d=r.height,u=r.width):(i=0,a=0,l=window.innerHeight,c=window.innerWidth,d=window.innerHeight,u=window.innerWidth),(e||t)&&s!==window&&(n=n||s.parentNode,!rt))do if(n&&n.getBoundingClientRect&&(D(n,"transform")!=="none"||t&&D(n,"position")!=="static")){var h=n.getBoundingClientRect();i-=h.top+parseInt(D(n,"border-top-width")),a-=h.left+parseInt(D(n,"border-left-width")),l=i+r.height,c=a+r.width;break}while(n=n.parentNode);if(o&&s!==window){var p=Pt(n||s),f=p&&p.a,g=p&&p.d;p&&(i/=g,a/=f,u/=f,d/=g,l=i+d,c=a+u)}return{top:i,left:a,bottom:l,right:c,width:u,height:d}}}function eh(s,e,t){for(var o=lt(s,!0),n=ce(s)[e];o;){var r=ce(o)[t],i=void 0;if(i=n>=r,!i)return o;if(o===Xe())break;o=lt(o,!1)}return!1}function Ft(s,e,t,o){for(var n=0,r=0,i=s.children;r<i.length;){if(i[r].style.display!=="none"&&i[r]!==P.ghost&&(o||i[r]!==P.dragged)&&Ue(i[r],t.draggable,s,!1)){if(n===e)return i[r];n++}r++}return null}function Yi(s,e){for(var t=s.lastElementChild;t&&(t===P.ghost||D(t,"display")==="none"||e&&!Qo(t,e));)t=t.previousElementSibling;return t||null}function Pe(s,e){var t=0;if(!s||!s.parentNode)return-1;for(;s=s.previousElementSibling;)s.nodeName.toUpperCase()!=="TEMPLATE"&&s!==P.clone&&(!e||Qo(s,e))&&t++;return t}function th(s){var e=0,t=0,o=Xe();if(s)do{var n=Pt(s),r=n.a,i=n.d;e+=s.scrollLeft*r,t+=s.scrollTop*i}while(s!==o&&(s=s.parentNode));return[e,t]}function tv(s,e){for(var t in s)if(s.hasOwnProperty(t)){for(var o in e)if(e.hasOwnProperty(o)&&e[o]===s[t][o])return Number(t)}return-1}function lt(s,e){if(!s||!s.getBoundingClientRect)return Xe();var t=s,o=!1;do if(t.clientWidth<t.scrollWidth||t.clientHeight<t.scrollHeight){var n=D(t);if(t.clientWidth<t.scrollWidth&&(n.overflowX=="auto"||n.overflowX=="scroll")||t.clientHeight<t.scrollHeight&&(n.overflowY=="auto"||n.overflowY=="scroll")){if(!t.getBoundingClientRect||t===document.body)return Xe();if(o||e)return t;o=!0}}while(t=t.parentNode);return Xe()}function ov(s,e){if(s&&e)for(var t in e)e.hasOwnProperty(t)&&(s[t]=e[t]);return s}function Xi(s,e){return Math.round(s.top)===Math.round(e.top)&&Math.round(s.left)===Math.round(e.left)&&Math.round(s.height)===Math.round(e.height)&&Math.round(s.width)===Math.round(e.width)}var co;function oh(s,e){return function(){if(!co){var t=arguments,o=this;t.length===1?s.call(o,t[0]):s.apply(o,t),co=setTimeout(function(){co=void 0},e)}}}function nv(){clearTimeout(co),co=void 0}function nh(s,e,t){s.scrollLeft+=e,s.scrollTop+=t}function rh(s){var e=window.Polymer,t=window.jQuery||window.Zepto;return e&&e.dom?e.dom(s).cloneNode(!0):t?t(s).clone(!0)[0]:s.cloneNode(!0)}function sh(s,e,t){var o={};return Array.from(s.children).forEach(function(n){var r,i,a,l;if(!(!Ue(n,e.draggable,s,!1)||n.animated||n===t)){var c=ce(n);o.left=Math.min((r=o.left)!==null&&r!==void 0?r:1/0,c.left),o.top=Math.min((i=o.top)!==null&&i!==void 0?i:1/0,c.top),o.right=Math.max((a=o.right)!==null&&a!==void 0?a:-1/0,c.right),o.bottom=Math.max((l=o.bottom)!==null&&l!==void 0?l:-1/0,c.bottom)}}),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var xe="Sortable"+new Date().getTime();function rv(){var s=[],e;return{captureAnimationState:function(){if(s=[],!!this.options.animation){var o=[].slice.call(this.el.children);o.forEach(function(n){if(!(D(n,"display")==="none"||n===P.ghost)){s.push({target:n,rect:ce(n)});var r=Ye({},s[s.length-1].rect);if(n.thisAnimationDuration){var i=Pt(n,!0);i&&(r.top-=i.f,r.left-=i.e)}n.fromRect=r}})}},addAnimationState:function(o){s.push(o)},removeAnimationState:function(o){s.splice(tv(s,{target:o}),1)},animateAll:function(o){var n=this;if(!this.options.animation){clearTimeout(e),typeof o=="function"&&o();return}var r=!1,i=0;s.forEach(function(a){var l=0,c=a.target,d=c.fromRect,u=ce(c),h=c.prevFromRect,p=c.prevToRect,f=a.rect,g=Pt(c,!0);g&&(u.top-=g.f,u.left-=g.e),c.toRect=u,c.thisAnimationDuration&&Xi(h,u)&&!Xi(d,u)&&(f.top-u.top)/(f.left-u.left)===(d.top-u.top)/(d.left-u.left)&&(l=iv(f,h,p,n.options)),Xi(u,d)||(c.prevFromRect=d,c.prevToRect=u,l||(l=n.options.animation),n.animate(c,f,u,l)),l&&(r=!0,i=Math.max(i,l),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},l),c.thisAnimationDuration=l)}),clearTimeout(e),r?e=setTimeout(function(){typeof o=="function"&&o()},i):typeof o=="function"&&o(),s=[]},animate:function(o,n,r,i){if(i){D(o,"transition",""),D(o,"transform","");var a=Pt(this.el),l=a&&a.a,c=a&&a.d,d=(n.left-r.left)/(l||1),u=(n.top-r.top)/(c||1);o.animatingX=!!d,o.animatingY=!!u,D(o,"transform","translate3d("+d+"px,"+u+"px,0)"),this.forRepaintDummy=sv(o),D(o,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),D(o,"transform","translate3d(0,0,0)"),typeof o.animated=="number"&&clearTimeout(o.animated),o.animated=setTimeout(function(){D(o,"transition",""),D(o,"transform",""),o.animated=!1,o.animatingX=!1,o.animatingY=!1},i)}}}}function sv(s){return s.offsetWidth}function iv(s,e,t,o){return Math.sqrt(Math.pow(e.top-s.top,2)+Math.pow(e.left-s.left,2))/Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))*o.animation}var Ht=[],Zi={initializeByDefault:!0},uo={mount:function(e){for(var t in Zi)Zi.hasOwnProperty(t)&&!(t in e)&&(e[t]=Zi[t]);Ht.forEach(function(o){if(o.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),Ht.push(e)},pluginEvent:function(e,t,o){var n=this;this.eventCanceled=!1,o.cancel=function(){n.eventCanceled=!0};var r=e+"Global";Ht.forEach(function(i){t[i.pluginName]&&(t[i.pluginName][r]&&t[i.pluginName][r](Ye({sortable:t},o)),t.options[i.pluginName]&&t[i.pluginName][e]&&t[i.pluginName][e](Ye({sortable:t},o)))})},initializePlugins:function(e,t,o,n){Ht.forEach(function(a){var l=a.pluginName;if(!(!e.options[l]&&!a.initializeByDefault)){var c=new a(e,t,e.options);c.sortable=e,c.options=e.options,e[l]=c,ot(o,c.defaults)}});for(var r in e.options)if(e.options.hasOwnProperty(r)){var i=this.modifyOption(e,r,e.options[r]);typeof i!="undefined"&&(e.options[r]=i)}},getEventProperties:function(e,t){var o={};return Ht.forEach(function(n){typeof n.eventProperties=="function"&&ot(o,n.eventProperties.call(t[n.pluginName],e))}),o},modifyOption:function(e,t,o){var n;return Ht.forEach(function(r){e[r.pluginName]&&r.optionListeners&&typeof r.optionListeners[t]=="function"&&(n=r.optionListeners[t].call(e[r.pluginName],o))}),n}};function av(s){var e=s.sortable,t=s.rootEl,o=s.name,n=s.targetEl,r=s.cloneEl,i=s.toEl,a=s.fromEl,l=s.oldIndex,c=s.newIndex,d=s.oldDraggableIndex,u=s.newDraggableIndex,h=s.originalEvent,p=s.putSortable,f=s.extraEventProperties;if(e=e||t&&t[xe],!!e){var g,b=e.options,k="on"+o.charAt(0).toUpperCase()+o.substr(1);window.CustomEvent&&!rt&&!ao?g=new CustomEvent(o,{bubbles:!0,cancelable:!0}):(g=document.createEvent("Event"),g.initEvent(o,!0,!0)),g.to=i||t,g.from=a||t,g.item=n||t,g.clone=r,g.oldIndex=l,g.newIndex=c,g.oldDraggableIndex=d,g.newDraggableIndex=u,g.originalEvent=h,g.pullMode=p?p.lastPutMode:void 0;var y=Ye(Ye({},f),uo.getEventProperties(o,e));for(var T in y)g[T]=y[T];t&&t.dispatchEvent(g),b[k]&&b[k].call(e,g)}}var lv=["evt"],Ce=function(e,t){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=o.evt,r=Qb(o,lv);uo.pluginEvent.bind(P)(e,t,Ye({dragEl:B,parentEl:ie,ghostEl:H,rootEl:te,nextEl:wt,lastDownEl:en,cloneEl:ne,cloneHidden:ct,dragStarted:fo,putSortable:be,activeSortable:P.active,originalEvent:n,oldIndex:qt,oldDraggableIndex:ho,newIndex:Ne,newDraggableIndex:dt,hideGhostForTarget:hh,unhideGhostForTarget:fh,cloneNowHidden:function(){ct=!0},cloneNowShown:function(){ct=!1},dispatchSortableEvent:function(a){Te({sortable:t,name:a,originalEvent:n})}},r))};function Te(s){av(Ye({putSortable:be,cloneEl:ne,targetEl:B,rootEl:te,oldIndex:qt,oldDraggableIndex:ho,newIndex:Ne,newDraggableIndex:dt},s))}var B,ie,H,te,wt,en,ne,ct,qt,Ne,ho,dt,tn,be,zt=!1,on=!1,nn=[],Tt,Ke,Ji,Qi,ih,ah,fo,jt,po,go=!1,rn=!1,sn,ke,ea=[],ta=!1,an=[],ln=typeof document!="undefined",cn=Vi,lh=ao||rt?"cssFloat":"float",cv=ln&&!Yu&&!Vi&&"draggable"in document.createElement("div"),ch=(function(){if(ln){if(rt)return!1;var s=document.createElement("x");return s.style.cssText="pointer-events:auto",s.style.pointerEvents==="auto"}})(),dh=function(e,t){var o=D(e),n=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),r=Ft(e,0,t),i=Ft(e,1,t),a=r&&D(r),l=i&&D(i),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+ce(r).width,d=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+ce(i).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&a.float&&a.float!=="none"){var u=a.float==="left"?"left":"right";return i&&(l.clear==="both"||l.clear===u)?"vertical":"horizontal"}return r&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||c>=n&&o[lh]==="none"||i&&o[lh]==="none"&&c+d>n)?"vertical":"horizontal"},dv=function(e,t,o){var n=o?e.left:e.top,r=o?e.right:e.bottom,i=o?e.width:e.height,a=o?t.left:t.top,l=o?t.right:t.bottom,c=o?t.width:t.height;return n===a||r===l||n+i/2===a+c/2},uv=function(e,t){var o;return nn.some(function(n){var r=n[xe].options.emptyInsertThreshold;if(!(!r||Yi(n))){var i=ce(n),a=e>=i.left-r&&e<=i.right+r,l=t>=i.top-r&&t<=i.bottom+r;if(a&&l)return o=n}}),o},uh=function(e){function t(r,i){return function(a,l,c,d){var u=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(r==null&&(i||u))return!0;if(r==null||r===!1)return!1;if(i&&r==="clone")return r;if(typeof r=="function")return t(r(a,l,c,d),i)(a,l,c,d);var h=(i?a:l).options.group.name;return r===!0||typeof r=="string"&&r===h||r.join&&r.indexOf(h)>-1}}var o={},n=e.group;(!n||Jo(n)!="object")&&(n={name:n}),o.name=n.name,o.checkPull=t(n.pull,!0),o.checkPut=t(n.put),o.revertClone=n.revertClone,e.group=o},hh=function(){!ch&&H&&D(H,"display","none")},fh=function(){!ch&&H&&D(H,"display","")};ln&&!Yu&&document.addEventListener("click",function(s){if(on)return s.preventDefault(),s.stopPropagation&&s.stopPropagation(),s.stopImmediatePropagation&&s.stopImmediatePropagation(),on=!1,!1},!0);var Bt=function(e){if(B){e=e.touches?e.touches[0]:e;var t=uv(e.clientX,e.clientY);if(t){var o={};for(var n in e)e.hasOwnProperty(n)&&(o[n]=e[n]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[xe]._onDragOver(o)}}},hv=function(e){B&&B.parentNode[xe]._isOutsideThisEl(e.target)};function P(s,e){if(!(s&&s.nodeType&&s.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(s));this.el=s,this.options=e=ot({},e),s[xe]=this;var t={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(s.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return dh(s,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(i,a){i.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:P.supportPointer!==!1&&"PointerEvent"in window&&(!lo||Vi),emptyInsertThreshold:5};uo.initializePlugins(this,s,t);for(var o in t)!(o in e)&&(e[o]=t[o]);uh(e);for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this));this.nativeDraggable=e.forceFallback?!1:cv,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?G(s,"pointerdown",this._onTapStart):(G(s,"mousedown",this._onTapStart),G(s,"touchstart",this._onTapStart)),this.nativeDraggable&&(G(s,"dragover",this),G(s,"dragenter",this)),nn.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ot(this,rv())}P.prototype={constructor:P,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(jt=null)},_getDirection:function(e,t){return typeof this.options.direction=="function"?this.options.direction.call(this,e,t,B):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,o=this.el,n=this.options,r=n.preventOnFilter,i=e.type,a=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,l=(a||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,d=n.filter;if(yv(o),!B&&!(/mousedown|pointerdown/.test(i)&&e.button!==0||n.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&lo&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=Ue(l,n.draggable,o,!1),!(l&&l.animated)&&en!==l)){if(qt=Pe(l),ho=Pe(l,n.draggable),typeof d=="function"){if(d.call(this,e,l,this)){Te({sortable:t,rootEl:c,name:"filter",targetEl:l,toEl:o,fromEl:o}),Ce("filter",t,{evt:e}),r&&e.preventDefault();return}}else if(d&&(d=d.split(",").some(function(u){if(u=Ue(c,u.trim(),o,!1),u)return Te({sortable:t,rootEl:u,name:"filter",targetEl:l,fromEl:o,toEl:o}),Ce("filter",t,{evt:e}),!0}),d)){r&&e.preventDefault();return}n.handle&&!Ue(c,n.handle,o,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(e,t,o){var n=this,r=n.el,i=n.options,a=r.ownerDocument,l;if(o&&!B&&o.parentNode===r){var c=ce(o);if(te=r,B=o,ie=B.parentNode,wt=B.nextSibling,en=o,tn=i.group,P.dragged=B,Tt={target:B,clientX:(t||e).clientX,clientY:(t||e).clientY},ih=Tt.clientX-c.left,ah=Tt.clientY-c.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,B.style["will-change"]="all",l=function(){if(Ce("delayEnded",n,{evt:e}),P.eventCanceled){n._onDrop();return}n._disableDelayedDragEvents(),!Vu&&n.nativeDraggable&&(B.draggable=!0),n._triggerDragStart(e,t),Te({sortable:n,name:"choose",originalEvent:e}),Ie(B,i.chosenClass,!0)},i.ignore.split(",").forEach(function(d){Qu(B,d.trim(),oa)}),G(a,"dragover",Bt),G(a,"mousemove",Bt),G(a,"touchmove",Bt),i.supportPointer?(G(a,"pointerup",n._onDrop),!this.nativeDraggable&&G(a,"pointercancel",n._onDrop)):(G(a,"mouseup",n._onDrop),G(a,"touchend",n._onDrop),G(a,"touchcancel",n._onDrop)),Vu&&this.nativeDraggable&&(this.options.touchStartThreshold=4,B.draggable=!0),Ce("delayStart",this,{evt:e}),i.delay&&(!i.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(ao||rt))){if(P.eventCanceled){this._onDrop();return}i.supportPointer?(G(a,"pointerup",n._disableDelayedDrag),G(a,"pointercancel",n._disableDelayedDrag)):(G(a,"mouseup",n._disableDelayedDrag),G(a,"touchend",n._disableDelayedDrag),G(a,"touchcancel",n._disableDelayedDrag)),G(a,"mousemove",n._delayedDragTouchMoveHandler),G(a,"touchmove",n._delayedDragTouchMoveHandler),i.supportPointer&&G(a,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(l,i.delay)}else l()}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){B&&oa(B),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;W(e,"mouseup",this._disableDelayedDrag),W(e,"touchend",this._disableDelayedDrag),W(e,"touchcancel",this._disableDelayedDrag),W(e,"pointerup",this._disableDelayedDrag),W(e,"pointercancel",this._disableDelayedDrag),W(e,"mousemove",this._delayedDragTouchMoveHandler),W(e,"touchmove",this._delayedDragTouchMoveHandler),W(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||e.pointerType=="touch"&&e,!this.nativeDraggable||t?this.options.supportPointer?G(document,"pointermove",this._onTouchMove):t?G(document,"touchmove",this._onTouchMove):G(document,"mousemove",this._onTouchMove):(G(B,"dragend",this),G(te,"dragstart",this._onDragStart));try{document.selection?un(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(o){}},_dragStarted:function(e,t){if(zt=!1,te&&B){Ce("dragStarted",this,{evt:t}),this.nativeDraggable&&G(document,"dragover",hv);var o=this.options;!e&&Ie(B,o.dragClass,!1),Ie(B,o.ghostClass,!0),P.active=this,e&&this._appendGhost(),Te({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Ke){this._lastX=Ke.clientX,this._lastY=Ke.clientY,hh();for(var e=document.elementFromPoint(Ke.clientX,Ke.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Ke.clientX,Ke.clientY),e!==t);)t=e;if(B.parentNode[xe]._isOutsideThisEl(e),t)do{if(t[xe]){var o=void 0;if(o=t[xe]._onDragOver({clientX:Ke.clientX,clientY:Ke.clientY,target:e,rootEl:t}),o&&!this.options.dragoverBubble)break}e=t}while(t=Zu(t));fh()}},_onTouchMove:function(e){if(Tt){var t=this.options,o=t.fallbackTolerance,n=t.fallbackOffset,r=e.touches?e.touches[0]:e,i=H&&Pt(H,!0),a=H&&i&&i.a,l=H&&i&&i.d,c=cn&&ke&&th(ke),d=(r.clientX-Tt.clientX+n.x)/(a||1)+(c?c[0]-ea[0]:0)/(a||1),u=(r.clientY-Tt.clientY+n.y)/(l||1)+(c?c[1]-ea[1]:0)/(l||1);if(!P.active&&!zt){if(o&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(H){i?(i.e+=d-(Ji||0),i.f+=u-(Qi||0)):i={a:1,b:0,c:0,d:1,e:d,f:u};var h="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");D(H,"webkitTransform",h),D(H,"mozTransform",h),D(H,"msTransform",h),D(H,"transform",h),Ji=d,Qi=u,Ke=r}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!H){var e=this.options.fallbackOnBody?document.body:te,t=ce(B,!0,cn,!0,e),o=this.options;if(cn){for(ke=e;D(ke,"position")==="static"&&D(ke,"transform")==="none"&&ke!==document;)ke=ke.parentNode;ke!==document.body&&ke!==document.documentElement?(ke===document&&(ke=Xe()),t.top+=ke.scrollTop,t.left+=ke.scrollLeft):ke=Xe(),ea=th(ke)}H=B.cloneNode(!0),Ie(H,o.ghostClass,!1),Ie(H,o.fallbackClass,!0),Ie(H,o.dragClass,!0),D(H,"transition",""),D(H,"transform",""),D(H,"box-sizing","border-box"),D(H,"margin",0),D(H,"top",t.top),D(H,"left",t.left),D(H,"width",t.width),D(H,"height",t.height),D(H,"opacity","0.8"),D(H,"position",cn?"absolute":"fixed"),D(H,"zIndex","100000"),D(H,"pointerEvents","none"),P.ghost=H,e.appendChild(H),D(H,"transform-origin",ih/parseInt(H.style.width)*100+"% "+ah/parseInt(H.style.height)*100+"%")}},_onDragStart:function(e,t){var o=this,n=e.dataTransfer,r=o.options;if(Ce("dragStart",this,{evt:e}),P.eventCanceled){this._onDrop();return}Ce("setupClone",this),P.eventCanceled||(ne=rh(B),ne.removeAttribute("id"),ne.draggable=!1,ne.style["will-change"]="",this._hideClone(),Ie(ne,this.options.chosenClass,!1),P.clone=ne),o.cloneId=un(function(){Ce("clone",o),!P.eventCanceled&&(o.options.removeCloneOnHide||te.insertBefore(ne,B),o._hideClone(),Te({sortable:o,name:"clone"}))}),!t&&Ie(B,r.dragClass,!0),t?(on=!0,o._loopId=setInterval(o._emulateDragOver,50)):(W(document,"mouseup",o._onDrop),W(document,"touchend",o._onDrop),W(document,"touchcancel",o._onDrop),n&&(n.effectAllowed="move",r.setData&&r.setData.call(o,n,B)),G(document,"drop",o),D(B,"transform","translateZ(0)")),zt=!0,o._dragStartId=un(o._dragStarted.bind(o,t,e)),G(document,"selectstart",o),fo=!0,window.getSelection().removeAllRanges(),lo&&D(document.body,"user-select","none")},_onDragOver:function(e){var t=this.el,o=e.target,n,r,i,a=this.options,l=a.group,c=P.active,d=tn===l,u=a.sort,h=be||c,p,f=this,g=!1;if(ta)return;function b(M,vn){Ce(M,f,Ye({evt:e,isOwner:d,axis:p?"vertical":"horizontal",revert:i,dragRect:n,targetRect:r,canSort:u,fromSortable:h,target:o,completed:y,onMove:function(yo,wo){return dn(te,t,B,n,yo,ce(yo),e,wo)},changed:T},vn))}function k(){b("dragOverAnimationCapture"),f.captureAnimationState(),f!==h&&h.captureAnimationState()}function y(M){return b("dragOverCompleted",{insertion:M}),M&&(d?c._hideClone():c._showClone(f),f!==h&&(Ie(B,be?be.options.ghostClass:c.options.ghostClass,!1),Ie(B,a.ghostClass,!0)),be!==f&&f!==P.active?be=f:f===P.active&&be&&(be=null),h===f&&(f._ignoreWhileAnimating=o),f.animateAll(function(){b("dragOverAnimationComplete"),f._ignoreWhileAnimating=null}),f!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(o===B&&!B.animated||o===t&&!o.animated)&&(jt=null),!a.dragoverBubble&&!e.rootEl&&o!==document&&(B.parentNode[xe]._isOutsideThisEl(e.target),!M&&Bt(e)),!a.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),g=!0}function T(){Ne=Pe(B),dt=Pe(B,a.draggable),Te({sortable:f,name:"change",toEl:t,newIndex:Ne,newDraggableIndex:dt,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),o=Ue(o,a.draggable,t,!0),b("dragOver"),P.eventCanceled)return g;if(B.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||f._ignoreWhileAnimating===o)return y(!1);if(on=!1,c&&!a.disabled&&(d?u||(i=ie!==te):be===this||(this.lastPutMode=tn.checkPull(this,c,B,e))&&l.checkPut(this,c,B,e))){if(p=this._getDirection(e,o)==="vertical",n=ce(B),b("dragOverValid"),P.eventCanceled)return g;if(i)return ie=te,k(),this._hideClone(),b("revert"),P.eventCanceled||(wt?te.insertBefore(B,wt):te.appendChild(B)),y(!0);var C=Yi(t,a.draggable);if(!C||mv(e,p,this)&&!C.animated){if(C===B)return y(!1);if(C&&t===e.target&&(o=C),o&&(r=ce(o)),dn(te,t,B,n,o,r,e,!!o)!==!1)return k(),C&&C.nextSibling?t.insertBefore(B,C.nextSibling):t.appendChild(B),ie=t,T(),y(!0)}else if(C&&gv(e,p,this)){var N=Ft(t,0,a,!0);if(N===B)return y(!1);if(o=N,r=ce(o),dn(te,t,B,n,o,r,e,!1)!==!1)return k(),t.insertBefore(B,N),ie=t,T(),y(!0)}else if(o.parentNode===t){r=ce(o);var x=0,E,w=B.parentNode!==t,_=!dv(B.animated&&B.toRect||n,o.animated&&o.toRect||r,p),F=p?"top":"left",O=eh(o,"top","top")||eh(B,"top","top"),Y=O?O.scrollTop:void 0;jt!==o&&(E=r[F],go=!1,rn=!_&&a.invertSwap||w),x=bv(e,o,r,p,_?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,rn,jt===o);var L;if(x!==0){var J=Pe(B);do J-=x,L=ie.children[J];while(L&&(D(L,"display")==="none"||L===H))}if(x===0||L===o)return y(!1);jt=o,po=x;var re=o.nextElementSibling,se=!1;se=x===1;var He=dn(te,t,B,n,o,r,e,se);if(He!==!1)return(He===1||He===-1)&&(se=He===1),ta=!0,setTimeout(pv,30),k(),se&&!re?t.appendChild(B):o.parentNode.insertBefore(B,se?re:o),O&&nh(O,0,Y-O.scrollTop),ie=B.parentNode,E!==void 0&&!rn&&(sn=Math.abs(E-ce(o)[F])),T(),y(!0)}if(t.contains(B))return y(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){W(document,"mousemove",this._onTouchMove),W(document,"touchmove",this._onTouchMove),W(document,"pointermove",this._onTouchMove),W(document,"dragover",Bt),W(document,"mousemove",Bt),W(document,"touchmove",Bt)},_offUpEvents:function(){var e=this.el.ownerDocument;W(e,"mouseup",this._onDrop),W(e,"touchend",this._onDrop),W(e,"pointerup",this._onDrop),W(e,"pointercancel",this._onDrop),W(e,"touchcancel",this._onDrop),W(document,"selectstart",this)},_onDrop:function(e){var t=this.el,o=this.options;if(Ne=Pe(B),dt=Pe(B,o.draggable),Ce("drop",this,{evt:e}),ie=B&&B.parentNode,Ne=Pe(B),dt=Pe(B,o.draggable),P.eventCanceled){this._nulling();return}zt=!1,rn=!1,go=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),na(this.cloneId),na(this._dragStartId),this.nativeDraggable&&(W(document,"drop",this),W(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),lo&&D(document.body,"user-select",""),D(B,"transform",""),e&&(fo&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),H&&H.parentNode&&H.parentNode.removeChild(H),(te===ie||be&&be.lastPutMode!=="clone")&&ne&&ne.parentNode&&ne.parentNode.removeChild(ne),B&&(this.nativeDraggable&&W(B,"dragend",this),oa(B),B.style["will-change"]="",fo&&!zt&&Ie(B,be?be.options.ghostClass:this.options.ghostClass,!1),Ie(B,this.options.chosenClass,!1),Te({sortable:this,name:"unchoose",toEl:ie,newIndex:null,newDraggableIndex:null,originalEvent:e}),te!==ie?(Ne>=0&&(Te({rootEl:ie,name:"add",toEl:ie,fromEl:te,originalEvent:e}),Te({sortable:this,name:"remove",toEl:ie,originalEvent:e}),Te({rootEl:ie,name:"sort",toEl:ie,fromEl:te,originalEvent:e}),Te({sortable:this,name:"sort",toEl:ie,originalEvent:e})),be&&be.save()):Ne!==qt&&Ne>=0&&(Te({sortable:this,name:"update",toEl:ie,originalEvent:e}),Te({sortable:this,name:"sort",toEl:ie,originalEvent:e})),P.active&&((Ne==null||Ne===-1)&&(Ne=qt,dt=ho),Te({sortable:this,name:"end",toEl:ie,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){Ce("nulling",this),te=B=ie=H=wt=ne=en=ct=Tt=Ke=fo=Ne=dt=qt=ho=jt=po=be=tn=P.dragged=P.ghost=P.clone=P.active=null,an.forEach(function(e){e.checked=!0}),an.length=Ji=Qi=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":B&&(this._onDragOver(e),fv(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],t,o=this.el.children,n=0,r=o.length,i=this.options;n<r;n++)t=o[n],Ue(t,i.draggable,this.el,!1)&&e.push(t.getAttribute(i.dataIdAttr)||kv(t));return e},sort:function(e,t){var o={},n=this.el;this.toArray().forEach(function(r,i){var a=n.children[i];Ue(a,this.options.draggable,n,!1)&&(o[r]=a)},this),t&&this.captureAnimationState(),e.forEach(function(r){o[r]&&(n.removeChild(o[r]),n.appendChild(o[r]))}),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return Ue(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var o=this.options;if(t===void 0)return o[e];var n=uo.modifyOption(this,e,t);typeof n!="undefined"?o[e]=n:o[e]=t,e==="group"&&uh(o)},destroy:function(){Ce("destroy",this);var e=this.el;e[xe]=null,W(e,"mousedown",this._onTapStart),W(e,"touchstart",this._onTapStart),W(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(W(e,"dragover",this),W(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),nn.splice(nn.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!ct){if(Ce("hideClone",this),P.eventCanceled)return;D(ne,"display","none"),this.options.removeCloneOnHide&&ne.parentNode&&ne.parentNode.removeChild(ne),ct=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(ct){if(Ce("showClone",this),P.eventCanceled)return;B.parentNode==te&&!this.options.group.revertClone?te.insertBefore(ne,B):wt?te.insertBefore(ne,wt):te.appendChild(ne),this.options.group.revertClone&&this.animate(B,ne),D(ne,"display",""),ct=!1}}};function fv(s){s.dataTransfer&&(s.dataTransfer.dropEffect="move"),s.cancelable&&s.preventDefault()}function dn(s,e,t,o,n,r,i,a){var l,c=s[xe],d=c.options.onMove,u;return window.CustomEvent&&!rt&&!ao?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=e,l.from=s,l.dragged=t,l.draggedRect=o,l.related=n||e,l.relatedRect=r||ce(e),l.willInsertAfter=a,l.originalEvent=i,s.dispatchEvent(l),d&&(u=d.call(c,l,i)),u}function oa(s){s.draggable=!1}function pv(){ta=!1}function gv(s,e,t){var o=ce(Ft(t.el,0,t.options,!0)),n=sh(t.el,t.options,H),r=10;return e?s.clientX<n.left-r||s.clientY<o.top&&s.clientX<o.right:s.clientY<n.top-r||s.clientY<o.bottom&&s.clientX<o.left}function mv(s,e,t){var o=ce(Yi(t.el,t.options.draggable)),n=sh(t.el,t.options,H),r=10;return e?s.clientX>n.right+r||s.clientY>o.bottom&&s.clientX>o.left:s.clientY>n.bottom+r||s.clientX>o.right&&s.clientY>o.top}function bv(s,e,t,o,n,r,i,a){var l=o?s.clientY:s.clientX,c=o?t.height:t.width,d=o?t.top:t.left,u=o?t.bottom:t.right,h=!1;if(!i){if(a&&sn<c*n){if(!go&&(po===1?l>d+c*r/2:l<u-c*r/2)&&(go=!0),go)h=!0;else if(po===1?l<d+sn:l>u-sn)return-po}else if(l>d+c*(1-n)/2&&l<u-c*(1-n)/2)return vv(e)}return h=h||i,h&&(l<d+c*r/2||l>u-c*r/2)?l>d+c/2?1:-1:0}function vv(s){return Pe(B)<Pe(s)?1:-1}function kv(s){for(var e=s.tagName+s.className+s.src+s.href+s.textContent,t=e.length,o=0;t--;)o+=e.charCodeAt(t);return o.toString(36)}function yv(s){an.length=0;for(var e=s.getElementsByTagName("input"),t=e.length;t--;){var o=e[t];o.checked&&an.push(o)}}function un(s){return setTimeout(s,0)}function na(s){return clearTimeout(s)}ln&&G(document,"touchmove",function(s){(P.active||zt)&&s.cancelable&&s.preventDefault()}),P.utils={on:G,off:W,css:D,find:Qu,is:function(e,t){return!!Ue(e,t,e,!1)},extend:ov,throttle:oh,closest:Ue,toggleClass:Ie,clone:rh,index:Pe,nextTick:un,cancelNextTick:na,detectDirection:dh,getChild:Ft,expando:xe},P.get=function(s){return s[xe]},P.mount=function(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];e[0].constructor===Array&&(e=e[0]),e.forEach(function(o){if(!o.prototype||!o.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));o.utils&&(P.utils=Ye(Ye({},P.utils),o.utils)),uo.mount(o)})},P.create=function(s,e){return new P(s,e)},P.version=ev;var de=[],mo,ra,sa=!1,ia,aa,hn,bo;function wv(){function s(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return s.prototype={dragStarted:function(t){var o=t.originalEvent;this.sortable.nativeDraggable?G(document,"dragover",this._handleAutoScroll):this.options.supportPointer?G(document,"pointermove",this._handleFallbackAutoScroll):o.touches?G(document,"touchmove",this._handleFallbackAutoScroll):G(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(t){var o=t.originalEvent;!this.options.dragOverBubble&&!o.rootEl&&this._handleAutoScroll(o)},drop:function(){this.sortable.nativeDraggable?W(document,"dragover",this._handleAutoScroll):(W(document,"pointermove",this._handleFallbackAutoScroll),W(document,"touchmove",this._handleFallbackAutoScroll),W(document,"mousemove",this._handleFallbackAutoScroll)),ph(),fn(),nv()},nulling:function(){hn=ra=mo=sa=bo=ia=aa=null,de.length=0},_handleFallbackAutoScroll:function(t){this._handleAutoScroll(t,!0)},_handleAutoScroll:function(t,o){var n=this,r=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,a=document.elementFromPoint(r,i);if(hn=t,o||this.options.forceAutoScrollFallback||ao||rt||lo){la(t,this.options,a,o);var l=lt(a,!0);sa&&(!bo||r!==ia||i!==aa)&&(bo&&ph(),bo=setInterval(function(){var c=lt(document.elementFromPoint(r,i),!0);c!==l&&(l=c,fn()),la(t,n.options,c,o)},10),ia=r,aa=i)}else{if(!this.options.bubbleScroll||lt(a,!0)===Xe()){fn();return}la(t,this.options,lt(a,!1),!1)}}},ot(s,{pluginName:"scroll",initializeByDefault:!0})}function fn(){de.forEach(function(s){clearInterval(s.pid)}),de=[]}function ph(){clearInterval(bo)}var la=oh(function(s,e,t,o){if(e.scroll){var n=(s.touches?s.touches[0]:s).clientX,r=(s.touches?s.touches[0]:s).clientY,i=e.scrollSensitivity,a=e.scrollSpeed,l=Xe(),c=!1,d;ra!==t&&(ra=t,fn(),mo=e.scroll,d=e.scrollFn,mo===!0&&(mo=lt(t,!0)));var u=0,h=mo;do{var p=h,f=ce(p),g=f.top,b=f.bottom,k=f.left,y=f.right,T=f.width,C=f.height,N=void 0,x=void 0,E=p.scrollWidth,w=p.scrollHeight,_=D(p),F=p.scrollLeft,O=p.scrollTop;p===l?(N=T<E&&(_.overflowX==="auto"||_.overflowX==="scroll"||_.overflowX==="visible"),x=C<w&&(_.overflowY==="auto"||_.overflowY==="scroll"||_.overflowY==="visible")):(N=T<E&&(_.overflowX==="auto"||_.overflowX==="scroll"),x=C<w&&(_.overflowY==="auto"||_.overflowY==="scroll"));var Y=N&&(Math.abs(y-n)<=i&&F+T<E)-(Math.abs(k-n)<=i&&!!F),L=x&&(Math.abs(b-r)<=i&&O+C<w)-(Math.abs(g-r)<=i&&!!O);if(!de[u])for(var J=0;J<=u;J++)de[J]||(de[J]={});(de[u].vx!=Y||de[u].vy!=L||de[u].el!==p)&&(de[u].el=p,de[u].vx=Y,de[u].vy=L,clearInterval(de[u].pid),(Y!=0||L!=0)&&(c=!0,de[u].pid=setInterval(function(){o&&this.layer===0&&P.active._onTouchMove(hn);var re=de[this.layer].vy?de[this.layer].vy*a:0,se=de[this.layer].vx?de[this.layer].vx*a:0;typeof d=="function"&&d.call(P.dragged.parentNode[xe],se,re,s,hn,de[this.layer].el)!=="continue"||nh(de[this.layer].el,se,re)}.bind({layer:u}),24))),u++}while(e.bubbleScroll&&h!==l&&(h=lt(h,!1)));sa=c}},30),gh=function(e){var t=e.originalEvent,o=e.putSortable,n=e.dragEl,r=e.activeSortable,i=e.dispatchSortableEvent,a=e.hideGhostForTarget,l=e.unhideGhostForTarget;if(t){var c=o||r;a();var d=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,u=document.elementFromPoint(d.clientX,d.clientY);l(),c&&!c.el.contains(u)&&(i("spill"),this.onSpill({dragEl:n,putSortable:o}))}};function ca(){}ca.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var n=Ft(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(t,n):this.sortable.el.appendChild(t),this.sortable.animateAll(),o&&o.animateAll()},drop:gh},ot(ca,{pluginName:"revertOnSpill"});function da(){}da.prototype={onSpill:function(e){var t=e.dragEl,o=e.putSortable,n=o||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:gh},ot(da,{pluginName:"removeOnSpill"}),P.mount(new wv),P.mount(da,ca);const mh="block-removed",Tv="block-added",Bv="block-moved",bh="block-changed";class vh{constructor(){this.tail=Promise.resolve()}get completed(){return this.failure?Promise.reject(this.failure):this.tail}add(e){if(this.failure)return Promise.reject(this.failure);const t=this.tail.then(()=>e());return this.tail=t.catch(o=>{this.failure=o}),t}}class xv extends K{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null,this.sortable=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this.blocksStore[0]}get lastBlock(){return this.blocksStore[this.blocksStore.length-1]}get currentBlock(){return this.blocksStore[this.currentBlockIndex]}set currentBlock(e){if(e===void 0){this.unsetCurrentBlock();return}this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){if(this.currentBlockIndex===this.blocksStore.length-1)return null;const t=this.blocksStore[this.currentBlockIndex+1];return t!=null?t:null}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(t=>!!t.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(t=>!!t.inputs.length)}get previousBlock(){if(this.currentBlockIndex===0)return null;const t=this.blocksStore[this.currentBlockIndex-1];return t!=null?t:null}get blocks(){return this.blocksStore.array}get isBlokEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){const e=new $i(this.Blok.UI.nodes.redactor);this._blocks=new Proxy(e,{set:$i.set,get:$i.get}),this.listeners.on(document,"copy",t=>{this.Blok.BlockEvents.handleCommandC(t)}),this.sortable=new P(this.Blok.UI.nodes.redactor,{animation:150,forceFallback:!0,handle:fm,onStart:()=>{this.Blok.UI.nodes.wrapper.setAttribute(bu,"true"),ro(!0)},onEnd:t=>{this.Blok.UI.nodes.wrapper.removeAttribute(bu),!(t.newIndex===void 0||t.oldIndex===void 0)&&this.move(t.newIndex,t.oldIndex,!0)}})}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:t={},id:o=void 0,tunes:n={}}){const r=this.Blok.ReadOnly.isEnabled,i=this.Blok.Tools.blockTools.get(e);if(i===void 0)throw new Error(`Could not compose Block. Tool «${e}» not found.`);const a=new no({id:o,data:t,tool:i,api:this.Blok.API,readOnly:r,tunesData:n},this.eventsDispatcher);return r||window.requestIdleCallback(()=>{this.bindBlockEvents(a)},{timeout:2e3}),a}insert({id:e=void 0,tool:t,data:o,index:n,needToFocus:r=!0,replace:i=!1,tunes:a}={}){const l=n!=null?n:this.currentBlockIndex+(i?0:1),c=t!=null?t:this.config.defaultBlock;if(c===void 0)throw new Error("Could not insert Block. Tool name is not specified.");const d={tool:c};e!==void 0&&(d.id=e),o!==void 0&&(d.data=o),a!==void 0&&(d.tunes=a);const u=this.composeBlock(d),h=i?this.getBlockByIndex(l):void 0;if(i&&h===void 0)throw new Error(`Could not replace Block at index ${l}. Block not found.`);return i&&h!==void 0&&this.blockDidMutated(mh,h,{index:l}),this.blocksStore.insert(l,u,i),this.blockDidMutated(Tv,u,{index:l}),r&&(this.currentBlockIndex=l),!r&&l<=this.currentBlockIndex&&this.currentBlockIndex++,u}insertMany(e,t=0){this.blocksStore.insertMany(e,t)}async update(e,t,o){if(!t&&!o)return e;const n=await e.data,r=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},n,t!=null?t:{}),tunes:o!=null?o:e.tunes}),i=this.getBlockIndex(e);return this.blocksStore.replace(i,r),this.blockDidMutated(bh,r,{index:i}),r}replace(e,t,o){const n=this.getBlockIndex(e);return this.insert({tool:t,data:o,index:n,replace:!0})}get blocksStore(){if(this._blocks===null)throw new Error("BlockManager: blocks store is not initialized. Call prepare() before accessing blocks.");return this._blocks}async paste(e,t,o=!1){const n=this.insert({tool:e,replace:o});try{await n.ready,n.call(Qe.ON_PASTE,t),n.refreshToolRootElement()}catch(r){U(`${e}: onPaste callback call is failed`,"error",r)}return n}insertDefaultBlockAtIndex(e,t=!1){const o=this.config.defaultBlock;if(o===void 0)throw new Error("Could not insert default Block. Default block tool is not defined in the configuration.");return this.insert({tool:o,index:e,needToFocus:t})}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,t){const o=async i=>{await e.mergeWith(i),await this.removeBlock(t),this.currentBlockIndex=this.blocksStore.indexOf(e)},n=e.name===t.name&&e.mergeable,r=n?await t.data:void 0;if(n&&ae(r)){console.error("Could not merge Block. Failed to extract original Block data.");return}if(n&&r!==void 0){const[i]=Ei([{data:r,tool:t.name}],e.tool.sanitizeConfig,this.config.sanitizer);await o(i.data);return}if(e.mergeable&&qo(t,"export")&&qo(e,"import")){const i=await t.exportDataAsString(),a=Ve(i,e.tool.sanitizeConfig),l=Bu(a,e.tool.conversionConfig);await o(l)}}removeBlock(e,t=!0){return new Promise(o=>{const n=this.blocksStore.indexOf(e);if(!this.validateIndex(n))throw new Error("Can't find a Block to remove");this.blocksStore.remove(n),e.destroy(),this.blockDidMutated(mh,e,{index:n}),this.currentBlockIndex>=n&&this.currentBlockIndex--;const r=this.blocks.length===0;r&&this.unsetCurrentBlock(),r&&t&&this.insert(),!r&&n===0&&(this.currentBlockIndex=0),o()})}removeSelectedBlocks(){const e=this.blocks.map((t,o)=>({block:t,index:o})).filter(({block:t})=>t.selected).sort((t,o)=>o.index-t.index);return e.forEach(({block:t})=>{this.removeBlock(t,!1)}),e.length>0?e[e.length-1].index:void 0}removeAllBlocks(){const e=n=>{n<0||(this.blocksStore.remove(n),e(n-1))};e(this.blocksStore.length-1),this.unsetCurrentBlock(),this.insert();const t=this.currentBlock,o=t==null?void 0:t.firstInput;o!==void 0&&o.focus()}split(){const e=this.Blok.Caret.extractFragmentFromCaretPosition(),t=v.make("div");t.appendChild(e);const o={text:v.isEmpty(t)?"":t.innerHTML};return this.insert({data:o})}getBlockByIndex(e){const t=e===-1?this.blocksStore.length-1:e;return this.blocksStore[t]}getBlockIndex(e){return this.blocksStore.indexOf(e)}getBlockById(e){return this.blocksStore.array.find(t=>t.id===e)}getBlock(e){const t=v.isElement(e)?e:e.parentNode;if(!t)return;const o=this.blocksStore.nodes,n=t.closest(bi);if(!n)return;const r=o.indexOf(n);if(r>=0)return this.blocksStore[r]}setCurrentBlockByChildNode(e){const t=v.isElement(e)?e:e.parentNode;if(!t)return;const o=t.closest(bi);if(!o)return;const n=o.closest(Ae);if(!(n==null?void 0:n.isEqualNode(this.Blok.UI.nodes.wrapper))||!(o instanceof HTMLElement))return;this.currentBlockIndex=this.blocksStore.nodes.indexOf(o);const i=this.currentBlock;return i==null||i.updateCurrentInput(),i}getBlockByChildNode(e){if(!(e instanceof Node))return;const t=v.isElement(e)?e:e.parentNode;if(!t)return;const o=t.closest(bi);if(o)return this.blocks.find(n=>n.holder===o)}move(e,t=this.currentBlockIndex,o=!1){if(isNaN(e)||isNaN(t)){U("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(t)){U("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this.blocksStore.move(e,t,o),this.currentBlockIndex=e;const n=this.currentBlock;if(n===void 0)throw new Error(`Could not move Block. Block at index ${e} is not available.`);this.blockDidMutated(Bv,n,{fromIndex:t,toIndex:e})}async convert(e,t,o){const n=await e.save();if(!n||n.data===void 0)throw new Error("Could not convert Block. Failed to extract original Block data.");const r=this.Blok.Tools.blockTools.get(t);if(!r)throw new Error(`Could not convert Block. Tool «${t}» not found.`);const i=await e.exportDataAsString(),a=Ve(i,Ni(this.config.sanitizer,r.sanitizeConfig)),l=Bu(a,r.conversionConfig,r.settings),c=o?Object.assign(l,o):l;return this.replace(e,r.name,c)}unsetCurrentBlock(){this.currentBlockIndex=-1}async clear(e=!1){const t=new vh;[...this.blocks].forEach(n=>{t.add(async()=>{await this.removeBlock(n,!1)})}),await t.completed,this.unsetCurrentBlock(),e&&this.insert(),this.Blok.UI.checkEmptiness()}async destroy(){this.sortable&&(this.sortable.destroy(),this.sortable=null),await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){const{BlockEvents:t}=this.Blok;this.readOnlyMutableListeners.on(e.holder,"keydown",o=>{o instanceof KeyboardEvent&&t.keydown(o)}),this.readOnlyMutableListeners.on(e.holder,"keyup",o=>{o instanceof KeyboardEvent&&t.keyup(o)}),this.readOnlyMutableListeners.on(e.holder,"input",o=>{o instanceof InputEvent&&t.input(o)}),e.on("didMutated",o=>this.blockDidMutated(bh,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>{this.Blok.BlockEvents.handleCommandX(e)}),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this.blocksStore.length)}blockDidMutated(e,t,o){const n=q({target:new $e(t)},o),r=new CustomEvent(e,{detail:q({},n)});return Object.prototype.propertyIsEnumerable.call(r,"type")||Object.defineProperty(r,"type",{value:e,enumerable:!0,configurable:!0}),Object.prototype.propertyIsEnumerable.call(r,"detail")||Object.defineProperty(r,"detail",{value:n,enumerable:!0,configurable:!0}),this.eventsDispatcher.emit(eo,{event:r}),t}}class Cv extends K{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this._navigationModeEnabled=!1,this.navigationFocusIndex=-1,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1,this.selection=new R}get sanitizerConfig(){const e={p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}};return Ni(this.config.sanitizer,e)}get allBlocksSelected(){const{BlockManager:e}=this.Blok;return e.blocks.every(t=>t.selected===!0)}set allBlocksSelected(e){const{BlockManager:t}=this.Blok;for(const o of t.blocks)o.selected=e;this.clearCache()}get anyBlockSelected(){const{BlockManager:e}=this.Blok;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(t=>t.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Blok.BlockManager.blocks.filter(e=>e.selected)}get navigationModeEnabled(){return this._navigationModeEnabled}get navigationFocusedBlock(){if(!(!this._navigationModeEnabled||this.navigationFocusIndex<0))return this.Blok.BlockManager.getBlockByIndex(this.navigationFocusIndex)}prepare(){this.selection=new R,je.add({name:"CMD+A",handler:e=>{const{BlockManager:t,ReadOnly:o}=this.Blok;if(o.isEnabled){e.preventDefault(),this.selectAllBlocks();return}t.currentBlock&&this.handleCommandA(e)},on:this.Blok.UI.nodes.redactor})}toggleReadOnly(){const e=R.get();e==null||e.removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){const{BlockManager:t}=this.Blok,o=typeof e=="number"?t.getBlockByIndex(e):t.currentBlock;o&&(o.selected=!1,this.clearCache())}clearSelection(e,t=!1){const{RectangleSelection:o}=this.Blok;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1,this._navigationModeEnabled&&this.disableNavigationMode();const n=e&&e instanceof KeyboardEvent,r=e,i=n&&r.key&&r.key.length===1;this.anyBlockSelected&&n&&i&&!R.isSelectionExists&&this.replaceSelectedBlocksWithPrintableKey(e),this.Blok.CrossBlockSelection.clear(e),t&&this.selection.restore(),o.isRectActivated()&&this.Blok.RectangleSelection.clearSelection(),this.anyBlockSelected&&(this.allBlocksSelected=!1)}async copySelectedBlocks(e){e.preventDefault();const t=e.clipboardData;if(!t)return;const o=v.make("div"),n=[];this.selectedBlocks.forEach(a=>{var p;const l=Ve(a.holder.innerHTML,this.sanitizerConfig),c=v.make("div");c.innerHTML=l;const d=(p=c.textContent)!=null?p:"";if(n.push(d),!Array.from(c.childNodes).some(f=>f.nodeType===Node.ELEMENT_NODE)&&d.trim().length>0){const f=v.make("p");f.innerHTML=c.innerHTML,o.appendChild(f)}else for(;c.firstChild;)o.appendChild(c.firstChild)});const r=n.join(`
195
-
196
- `),i=o.innerHTML;t.setData("text/plain",r),t.setData("text/html",i);try{const a=await Promise.all(this.selectedBlocks.map(l=>l.save()));t.setData(this.Blok.Paste.MIME_TYPE,JSON.stringify(a))}catch(a){}}selectBlockByIndex(e){const{BlockManager:t}=this.Blok,o=t.getBlockByIndex(e);o!==void 0&&this.selectBlock(o)}selectBlock(e){this.selection.save();const t=R.get();t==null||t.removeAllRanges();const o=e;o.selected=!0,this.clearCache(),this.Blok.InlineToolbar.close()}unselectBlock(e){const t=e;t.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}enableNavigationMode(){const{BlockManager:e}=this.Blok;if(this._navigationModeEnabled)return;this._navigationModeEnabled=!0;const t=e.currentBlockIndex>=0?e.currentBlockIndex:0;this.setNavigationFocus(t)}disableNavigationMode(e=!1){if(!this._navigationModeEnabled)return;const t=this.navigationFocusedBlock;if(t&&t.holder.removeAttribute("data-blok-navigation-focused"),this._navigationModeEnabled=!1,e&&t){const{Caret:o,BlockManager:n}=this.Blok;n.currentBlockIndex=this.navigationFocusIndex,o.setToBlock(t,o.positions.END)}this.navigationFocusIndex=-1}navigateNext(){if(!this._navigationModeEnabled)return!1;const{BlockManager:e}=this.Blok,t=this.navigationFocusIndex+1;return t>=e.blocks.length?!1:(this.setNavigationFocus(t),!0)}navigatePrevious(){if(!this._navigationModeEnabled)return!1;const e=this.navigationFocusIndex-1;return e<0?!1:(this.setNavigationFocus(e),!0)}setNavigationFocus(e){const{BlockManager:t}=this.Blok,o=t.getBlockByIndex(e);if(!o)return;const n=this.navigationFocusedBlock;n&&n.holder.removeAttribute("data-blok-navigation-focused"),this.navigationFocusIndex=e,o.holder.setAttribute("data-blok-navigation-focused","true");const r=R.get();r==null||r.removeAllRanges(),document.activeElement instanceof HTMLElement&&document.activeElement.blur(),o.holder.scrollIntoView({behavior:"smooth",block:"nearest"})}destroy(){je.remove(this.Blok.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Blok.RectangleSelection.clearSelection(),v.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}const t=this.Blok.BlockManager.getBlock(e.target);if(!t)return;const o=t.inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}if(this.needToSelectAll){e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1;return}this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(t),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save();const e=R.get();e==null||e.removeAllRanges(),this.allBlocksSelected=!0,this.Blok.InlineToolbar.close()}replaceSelectedBlocksWithPrintableKey(e){const{BlockManager:t,Caret:o}=this.Blok,n=t.removeSelectedBlocks();if(n===void 0)return;t.insertDefaultBlockAtIndex(n,!0);const r=t.currentBlock;r&&o.setToBlock(r),Mo(()=>{const i=e.key;o.insertContentAtCaretPosition(i.length>1?"":i)},20)()}}const Ev=127,kh=s=>{for(const e of s){if(e.trim().length===0)continue;if(e>="0"&&e<="9"||e.toLowerCase()!==e.toUpperCase())return!1;const t=e.codePointAt(0);if(typeof t=="number"&&t>Ev)return!1}return!0},yh=s=>{var e;return s.nodeType===Node.TEXT_NODE?[s]:(e=s.hasChildNodes)!=null&&e.call(s)?Array.from(s.childNodes).flatMap(t=>yh(t)):[]},Sv=s=>{var n,r;const e=yh(s);if(e.length===0)return null;const t=e[e.length-1],o=(n=[...e].reverse().find(i=>{var a;return!kh((a=i.textContent)!=null?a:"")}))!=null?n:null;return o&&o!==t&&kh((r=t.textContent)!=null?r:"")&&o.parentNode!==s?o:t};class ua extends K{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get DATA_ATTR(){return{shadowCaret:"data-blok-shadow-caret"}}setToBlock(e,t=this.positions.DEFAULT,o=0){var u;const{BlockManager:n,BlockSelection:r}=this.Blok;if(r.clearSelection(),!e.focusable){(u=window.getSelection())==null||u.removeAllRanges(),r.selectBlock(e),n.currentBlock=e;return}const a=t===this.positions.START?e.firstInput:t===this.positions.END?e.lastInput:e.currentInput;if(!a)return;const l=h=>{if(t===this.positions.START)return{node:v.getDeepestNode(h,!1),offset:0};if(t===this.positions.END)return this.resolveEndPositionNode(h);const{node:p,offset:f}=v.getNodeByOffset(h,o);return p?{node:p,offset:f}:{node:v.getDeepestNode(h,!1),offset:0}},{node:c,offset:d}=l(a);c&&(this.set(c,d),n.setCurrentBlockByChildNode(e.holder),n.currentBlock.currentInput=a)}resolveEndPositionNode(e){const t=v.getDeepestNode(e,!0);if(t instanceof HTMLElement&&v.isNativeInput(t))return{node:t,offset:v.getContentLength(t)};const o=Sv(e);return o?{node:o,offset:v.getContentLength(o)}:t?{node:t,offset:v.getContentLength(t)}:{node:null,offset:0}}setToInput(e,t=this.positions.DEFAULT,o=0){const{currentBlock:n}=this.Blok.BlockManager;this.setCaretToInputPosition(e,t,o),n&&(n.currentInput=e)}setCaretToInputPosition(e,t,o){if(t===this.positions.START){this.setCaretToStart(e);return}if(t===this.positions.END){this.setCaretToEnd(e);return}this.setCaretToOffset(e,o)}setCaretToStart(e){const t=v.getDeepestNode(e,!1);t&&this.set(t,0)}setCaretToEnd(e){const t=v.getDeepestNode(e,!0);t&&this.set(t,v.getContentLength(t))}setCaretToOffset(e,t){const{node:o,offset:n}=v.getNodeByOffset(e,t);if(o){this.set(o,n);return}this.setCaretToEnd(e)}set(e,t=0){const{top:n,bottom:r}=R.setCursor(e,t),{innerHeight:i}=window;if(n<0){window.scrollBy(0,n-30);return}r>i&&window.scrollBy(0,r-i+30)}setToTheLastBlock(){const e=this.Blok.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{const t=this.Blok.BlockManager.insertAtEnd();this.setToBlock(t)}}extractFragmentFromCaretPosition(){var i;const e=R.get();if(!e||!e.rangeCount)return;const t=e.getRangeAt(0),o=this.Blok.BlockManager.currentBlock;if(!o)return;const n=o.currentInput;if(t.deleteContents(),!n)return;if(v.isNativeInput(n)){const a=n,l=document.createDocumentFragment(),c=(i=a.selectionStart)!=null?i:0,d=a.value.substring(0,c),u=a.value.substring(c);return l.textContent=u,a.value=d,l}const r=t.cloneRange();return r.selectNodeContents(n),r.setStart(t.endContainer,t.endOffset),r.extractContents()}navigateNext(e=!1){const{BlockManager:t}=this.Blok,{currentBlock:o,nextBlock:n}=t;if(o===void 0)return!1;const{nextInput:r,currentInput:i}=o,a=i!==void 0?Xo(i):void 0,l=e||a||!o.focusable;if(r&&l)return this.setToInput(r,this.positions.START),!0;const d=n!==null?n:o.tool.isDefault||!l?null:t.insertAtEnd();return d!==null&&l?(this.setToBlock(d,this.positions.START),!0):!1}navigatePrevious(e=!1){const{currentBlock:t,previousBlock:o}=this.Blok.BlockManager;if(!t)return!1;const{previousInput:n,currentInput:r}=t,i=r!==void 0?Yo(r):void 0,a=e||i||!t.focusable;return n&&a?(this.setToInput(n,this.positions.END),!0):o!==null&&a?(this.setToBlock(o,this.positions.END),!0):!1}createShadow(e){const t=document.createElement("span");t.setAttribute(ua.DATA_ATTR.shadowCaret,""),t.setAttribute("data-blok-testid","shadow-caret"),e.insertAdjacentElement("beforeend",t)}restoreCaret(e){const t=e.querySelector('[data-blok-testid="shadow-caret"]');if(!t)return;new R().expandToTag(t);const n=document.createRange();n.selectNode(t),n.extractContents()}insertContentAtCaretPosition(e){const t=document.createDocumentFragment(),o=document.createElement("div"),n=R.get(),r=R.range;if(!n||!r)return;o.innerHTML=e,Array.from(o.childNodes).forEach(c=>t.appendChild(c)),t.childNodes.length===0&&t.appendChild(new Text);const i=t.lastChild;r.deleteContents(),r.insertNode(t);const a=document.createRange(),l=i.nodeType===Node.TEXT_NODE?i:i.firstChild;l!==null&&l.textContent!==null&&a.setStart(l,l.textContent.length),n.removeAllRanges(),n.addRange(a)}}class Av extends K{constructor(){super(...arguments),this.firstSelectedBlock=null,this.lastSelectedBlock=null,this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp),this.isCrossBlockSelectionStarted&&this.Blok.Toolbar.moveAndOpenForMultipleBlocks()},this.onMouseOver=e=>{var a;const t=e,{BlockManager:o,BlockSelection:n}=this.Blok;if(t.relatedTarget===null&&t.target===null)return;const r=o.getBlockByChildNode(t.relatedTarget)||this.lastSelectedBlock,i=o.getBlockByChildNode(t.target);if(!(!r||!i)&&i!==r){if(this.firstSelectedBlock&&r===this.firstSelectedBlock){(a=R.get())==null||a.removeAllRanges(),r.selected=!0,i.selected=!0,n.clearCache();return}if(this.firstSelectedBlock&&i===this.firstSelectedBlock){r.selected=!1,i.selected=!1,n.clearCache();return}this.Blok.InlineToolbar.close(),this.toggleBlocksSelectedState(r,i),this.lastSelectedBlock=i}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==Jp.LEFT)return;const{BlockManager:t}=this.Blok,o=t.getBlock(e.target);o&&(this.firstSelectedBlock=o,this.lastSelectedBlock=o,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp))}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){var a;const{BlockManager:t,BlockSelection:o}=this.Blok,n=t.currentBlock;if(!this.lastSelectedBlock&&!n||(!this.lastSelectedBlock&&n&&(this.lastSelectedBlock=this.firstSelectedBlock=n),this.firstSelectedBlock===this.lastSelectedBlock&&this.firstSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),(a=R.get())==null||a.removeAllRanges(),this.Blok.Toolbar.close()),!this.lastSelectedBlock))return;const r=t.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),i=t.blocks[r];i&&(this.lastSelectedBlock.selected!==i.selected?(i.selected=!0,o.clearCache(),this.Blok.Toolbar.close()):(this.lastSelectedBlock.selected=!1,o.clearCache(),this.Blok.Toolbar.close()),this.lastSelectedBlock=i,this.Blok.InlineToolbar.close(),i.holder.scrollIntoView({block:"nearest"}),this.isCrossBlockSelectionStarted&&this.Blok.Toolbar.moveAndOpenForMultipleBlocks())}clear(e){const{BlockManager:t,BlockSelection:o,Caret:n}=this.Blok;if(!this.firstSelectedBlock||!this.lastSelectedBlock)return;const r=t.blocks.indexOf(this.firstSelectedBlock),i=t.blocks.indexOf(this.lastSelectedBlock);if(!o.anyBlockSelected||r===-1||i===-1){this.firstSelectedBlock=this.lastSelectedBlock=null;return}if(e&&e instanceof KeyboardEvent)switch(e.key){case"ArrowDown":case"ArrowRight":n.setToBlock(t.blocks[Math.max(r,i)],n.positions.END);break;case"ArrowUp":case"ArrowLeft":n.setToBlock(t.blocks[Math.min(r,i)],n.positions.START);break;default:n.setToBlock(t.blocks[Math.max(r,i)],n.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){const{UI:t}=this.Blok;R.isCollapsed||this.Blok.BlockSelection.clearSelection(e),t.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Blok.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,t){const{BlockManager:o,BlockSelection:n}=this.Blok,r=o.blocks.indexOf(e),i=o.blocks.indexOf(t),a=e.selected!==t.selected,l=Math.min(r,i),c=Math.max(r,i);for(const d of Array.from({length:c-l+1},(u,h)=>l+h)){const u=o.blocks[d];u!==this.firstSelectedBlock&&u!==(a?e:t)&&(o.blocks[d].selected=!o.blocks[d].selected,n.clearCache())}this.Blok.Toolbar.close()}}class Iv extends K{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=Zg,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(eo,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(ku,()=>{this.disable()}),this.eventsDispatcher.on(yu,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Blok.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!V(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{const t=Array.from(this.batchingOnChangeQueue.values());if(t.length===0)return;const o=t.length===1?t[0]:t;this.config.onChange&&this.config.onChange(this.Blok.API.methods,o),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(wi,{mutations:e})}}const wh=new Set(["table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","ul","ol","li","dl","dt","dd"]),mn=class mn extends K{constructor(){super(...arguments),this.MIME_TYPE="application/x-blok",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.handlePasteEventWrapper=e=>{this.handlePasteEvent(e)},this.processTool=e=>{try{if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!e.hasOnPasteHandler)return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(t){U(`Paste handling for «${e.name}» Tool hasn't been set up because of the error`,"warn",t)}},this.handlePasteEvent=async e=>{const{BlockManager:t,Toolbar:o}=this.Blok,n=t.setCurrentBlockByChildNode(e.target);!n||e.target&&this.isNativeBehaviour(e.target)&&e.clipboardData&&!e.clipboardData.types.includes("Files")||this.exceptionList.includes(n.name)||(e.preventDefault(),e.clipboardData&&await this.processDataTransfer(e.clipboardData),o.close())}}async prepare(){this.processTools()}shouldReplaceCurrentBlockForFile(e){const{BlockManager:t}=this.Blok,o=t.currentBlock;return o?e&&o.name===e?!0:!!o.tool.isDefault&&o.isEmpty:!1}getStructuralTagsSanitizeConfig(e){var n;const t={},o=[e];for(;o.length>0;){const r=o.pop();if(!r)continue;const i=r.tagName.toLowerCase();wh.has(i)&&(t[i]=(n=t[i])!=null?n:{}),o.push(...Array.from(r.children))}return t}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}containsFiles(e){var o;if(Array.from(e.types).includes("Files")||(o=e.files)!=null&&o.length)return!0;try{const n=e.types;if(typeof(n==null?void 0:n.contains)=="function"&&n.contains("Files"))return!0}catch(n){}return!1}async processDataTransfer(e){const{Tools:t}=this.Blok;if(this.containsFiles(e)&&!ae(this.toolsFiles)){await this.processFiles(e.files);return}const n=e.getData(this.MIME_TYPE),r=e.getData("text/plain"),a=e.getData("text/html");if(n)try{this.insertBlokData(JSON.parse(n));return}catch(f){}const l=Object.fromEntries(Object.keys(this.toolsTags).map(f=>{var g;return[f.toLowerCase(),(g=this.toolsTags[f].sanitizationConfig)!=null?g:{}]})),c=t.getAllInlineToolsSanitizeConfig(),d=Ni(this.config.sanitizer,l,c,{br:{}}),u=Ve(a,d),h=v.isHTMLString(u);!u.trim()||u.trim()===r||!h?await this.processText(r):await this.processText(u,!0)}async processText(e,t=!1){var a,l;const{Caret:o,BlockManager:n}=this.Blok,r=t?this.processHTML(e):this.processPlain(e);if(!r.length)return;if(r.length>1){const d=!!((a=n.currentBlock)!=null&&a.tool.isDefault)&&!!((l=n.currentBlock)!=null&&l.isEmpty);for(const[u,h]of r.entries())await this.insertBlock(h,u===0&&d);n.currentBlock&&o.setToBlock(n.currentBlock,o.positions.END);return}const[i]=r;if(i.isBlock){await this.processSingleBlock(i);return}await this.processInlinePaste(i)}setCallback(){this.listeners.on(this.Blok.UI.nodes.holder,"paste",this.handlePasteEventWrapper)}unsetCallback(){this.listeners.off(this.Blok.UI.nodes.holder,"paste",this.handlePasteEventWrapper)}processTools(){const e=this.Blok.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return ze(e)?[e]:Z(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;const t=e.pasteConfig.tags||[],o=[];t.forEach(n=>{const r=this.collectTagNames(n);o.push(...r),r.forEach(i=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,i)){U(`Paste handler for «${e.name}» Tool on «${i}» tag is skipped because it is already used by «${this.toolsTags[i].tool.name}» Tool.`,"warn");return}const a=Z(n)?n[i]:void 0;this.toolsTags[i.toUpperCase()]={tool:e,sanitizationConfig:a}})}),this.tagsByTool[e.name]=o.map(n=>n.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;const{files:t={}}=e.pasteConfig,{extensions:o,mimeTypes:n}=t;if(!o&&!n)return;const r=o==null?[]:Array.isArray(o)?o:(U(`«extensions» property of the paste config for «${e.name}» Tool should be an array`),[]),i=n==null?[]:Array.isArray(n)?n.filter(a=>rg(a)?!0:(U(`MIME type value «${a}» for the «${e.name}» Tool is not a valid MIME type`,"warn"),!1)):(U(`«mimeTypes» property of the paste config for «${e.name}» Tool should be an array`),[]);this.toolsFiles[e.name]={extensions:r,mimeTypes:i}}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||ae(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([t,o])=>{o instanceof RegExp||U(`Pattern ${o} for «${e.name}» Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:t,pattern:o,tool:e})})}isNativeBehaviour(e){return v.isNativeInput(e)}async processFiles(e){var i;const{BlockManager:t}=this.Blok,n=(await Promise.all(Array.from(e).map(a=>this.processFile(a)))).filter(a=>a!=null);if(n.length===0)return;const r=this.shouldReplaceCurrentBlockForFile((i=n[0])==null?void 0:i.type);for(const[a,l]of n.entries())await t.paste(l.type,l.event,a===0&&r)}async processFile(e){const t=ng(e),o=Object.entries(this.toolsFiles).find(([i,{mimeTypes:a,extensions:l}])=>{const[c,d]=e.type.split("/"),u=l.find(p=>p.toLowerCase()===t.toLowerCase()),h=a.find(p=>{const[f,g]=p.split("/");return f===c&&(g===d||g==="*")});return u!==void 0||h!==void 0});if(!o)return;const[n]=o;return{event:this.composePasteEvent("file",{file:e}),type:n}}processHTML(e){const{Tools:t}=this.Blok,o=v.make("DIV");return o.innerHTML=e,this.getNodes(o).map(r=>{var b;const i=(()=>{var k;switch(r.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:{const y=v.make("div");return y.appendChild(r),{content:y,tool:t.defaultTool,isBlock:!1}}case Node.ELEMENT_NODE:{const y=r,T=this.toolsTags[y.tagName];return{content:y,tool:(k=T==null?void 0:T.tool)!=null?k:t.defaultTool,isBlock:!0}}default:return null}})();if(!i)return null;const{content:a,tool:l,isBlock:c}=i,u=(l.pasteConfig===!1?[]:((b=l.pasteConfig)==null?void 0:b.tags)||[]).reduce((k,y)=>{const T=this.collectTagNames(y),C=q({},k);return T.forEach(N=>{const x=Z(y)?y[N]:null;C[N.toLowerCase()]=x!=null?x:{}}),C},{}),h=this.getStructuralTagsSanitizeConfig(a),p=Object.assign({},h,u,l.baseSanitizeConfig),f=(()=>{if(a.tagName.toLowerCase()!=="table")return a.innerHTML=Ve(a.innerHTML,p),a;const k=Ve(a.outerHTML,p),T=v.make("div",void 0,{innerHTML:k}).firstChild;return!T||!(T instanceof HTMLElement)?null:T})();if(!f)return null;const g=this.composePasteEvent("tag",{data:f});return{content:f,isBlock:c,tool:l.name,event:g}}).filter(r=>{if(!r)return!1;const i=v.isEmpty(r.content),a=v.isSingleTag(r.content);return!i||a})}processPlain(e){const{defaultBlock:t}=this.config;if(!e)return[];const o=t;return e.split(/\r?\n/).filter(n=>n.trim()).map(n=>{const r=v.make("div");r.textContent=n;const i=this.composePasteEvent("tag",{data:r});return{content:r,tool:o,isBlock:!1,event:i}})}async processSingleBlock(e){const{Caret:t,BlockManager:o}=this.Blok,{currentBlock:n}=o;if(!n||e.tool!==n.name||!v.containsOnlyInlineElements(e.content.innerHTML)){await this.insertBlock(e,n?n.tool.isDefault&&n.isEmpty:!1);return}t.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){var c,d;const{BlockManager:t,Caret:o}=this.Blok,{content:n}=e,r=(d=(c=t.currentBlock)==null?void 0:c.tool.isDefault)!=null?d:!1,i=n.textContent,l=r&&i!==null&&i.length<mn.PATTERN_PROCESSING_MAX_LENGTH&&i!==null?await this.processPattern(i):void 0;if(l){const u=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty,h=await t.paste(l.tool,l.event,u);o.setToBlock(h,o.positions.END);return}if(t.currentBlock&&t.currentBlock.currentInput){const u=t.currentBlock.tool.baseSanitizeConfig;o.insertContentAtCaretPosition(Ve(n.innerHTML,u))}else await this.insertBlock(e)}async processPattern(e){const t=this.toolsPatterns.find(n=>{const r=n.pattern.exec(e);return r?e===r.shift():!1});return t?{event:this.composePasteEvent("pattern",{key:t.key,data:e}),tool:t.tool.name}:void 0}async insertBlock(e,t=!1){const{BlockManager:o,Caret:n}=this.Blok,{currentBlock:r}=o;if(t&&r&&r.isEmpty){const a=await o.paste(e.tool,e.event,!0);n.setToBlock(a,n.positions.END);return}const i=await o.paste(e.tool,e.event);n.setToBlock(i,n.positions.END)}insertBlokData(e){const{BlockManager:t,Caret:o,Tools:n}=this.Blok;Ei(e,i=>{var a,l;return(l=(a=n.blockTools.get(i))==null?void 0:a.sanitizeConfig)!=null?l:{}},this.config.sanitizer).forEach(({tool:i,data:a},l)=>{var u,h;const c=l===0&&!!((u=t.currentBlock)!=null&&u.tool.isDefault)&&!!((h=t.currentBlock)!=null&&h.isEmpty),d=t.insert({tool:i,data:a,replace:c});o.setToBlock(d,o.positions.END)})}processElementNode(e,t,o){var f,g;const n=Object.keys(this.toolsTags),r=e,i=this.toolsTags[r.tagName],a=i==null?void 0:i.tool,l=(g=this.tagsByTool[(f=a==null?void 0:a.name)!=null?f:""])!=null?g:[],c=n.includes(r.tagName),d=v.blockElements.includes(r.tagName.toLowerCase()),u=wh.has(r.tagName.toLowerCase()),h=Array.from(r.children).some(({tagName:b})=>n.includes(b)&&!l.includes(b)),p=Array.from(r.children).some(({tagName:b})=>v.blockElements.includes(b.toLowerCase()));if(!d&&!c&&!h)return o.appendChild(r),[...t,o];if(c&&!h||d&&!p&&!h||u&&!h)return[...t,o,r]}getNodes(e){const t=Array.from(e.childNodes),o=(n,r)=>{if(v.isEmpty(r)&&!v.isSingleTag(r))return n;const i=n[n.length-1],a=i!==void 0&&v.isFragment(i),{destNode:l,remainingNodes:c}=a?{destNode:i,remainingNodes:n.slice(0,-1)}:{destNode:new DocumentFragment,remainingNodes:n};if(r.nodeType===Node.TEXT_NODE)return l.appendChild(r),[...c,l];if(r.nodeType!==Node.ELEMENT_NODE)return[...c,l];const d=this.processElementNode(r,c,l);if(d)return d;const u=Array.from(r.childNodes).reduce(o,[]);return[...c,...u]};return t.reduce(o,[])}composePasteEvent(e,t){return new CustomEvent(e,{detail:t})}};mn.PATTERN_PROCESSING_MAX_LENGTH=450;let ha=mn;class Nv extends K{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){const{Tools:e}=this.Blok,{blockTools:t}=e,o=[];Array.from(t.entries()).forEach(([n,r])=>{r.isReadOnlySupported||o.push(n)}),this.toolsDontSupportReadOnly=o,this.config.readOnly===!0&&o.length>0&&this.throwCriticalError(),await this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,t=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();const o=this.readOnlyEnabled;this.readOnlyEnabled=e;for(const r of Object.values(this.Blok))r!=null&&typeof r.toggleReadOnly=="function"&&r.toggleReadOnly(e);if(o===e)return this.readOnlyEnabled;if(t)return this.readOnlyEnabled;this.Blok.ModificationsObserver.disable();const n=await this.Blok.Saver.save();return n===void 0?(this.Blok.ModificationsObserver.enable(),this.readOnlyEnabled):(await this.Blok.BlockManager.clear(),await this.Blok.Renderer.render(n.blocks),this.Blok.ModificationsObserver.enable(),this.readOnlyEnabled)}throwCriticalError(){throw new Xt(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}}class Rv extends K{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.rectCrossesBlocks=!1,this.overlayRectangle=null,this.listenerIds=[]}static get CSS(){return{overlay:"",overlayContainer:"",rect:"",topScrollZone:"",bottomScrollZone:""}}prepare(){this.enableModuleBindings()}startSelection(e,t){const o=this.getScrollLeft(),n=this.getScrollTop(),r=document.elementFromPoint(e-o,t-n);if(!r)return;r.closest(mu)||(this.Blok.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);const a=[vi,mu,fu],l=r.closest(Ae),c=a.some(d=>!!r.closest(d));!l||c||(this.Blok.Toolbar.close(),this.mousedown=!0,this.startX=e,this.startY=t)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle!==null&&(this.overlayRectangle.style.display="none")}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){const{container:e}=this.genHTML();this.listeners.on(e,"mousedown",n=>{this.processMouseDown(n)},!1);const t=ci(n=>{n instanceof MouseEvent&&this.processMouseMove(n)},10);this.listeners.on(document.body,"mousemove",t,{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()});const o=ci(n=>{this.processScroll(n)},10);this.listeners.on(window,"scroll",o,{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){if(e.button!==this.MAIN_MOUSE_BUTTON)return;e.target.closest(v.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY)}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.Blok.BlockSelection.selectedBlocks.length>1&&this.Blok.Toolbar.moveAndOpenForMultipleBlocks(),this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){const{UI:e}=this.Blok,t=e.nodes.holder.querySelector(Ae),o=v.make("div",["fixed","inset-0","z-overlay","pointer-events-none","overflow-hidden"],{}),n=v.make("div",["relative","pointer-events-auto","z-0"],{}),r=v.make("div",["absolute","pointer-events-none","bg-selection-highlight","border","border-transparent"],{});if(o.setAttribute(am,""),n.setAttribute(lm,""),r.setAttribute(cm,""),o.setAttribute("data-blok-testid","overlay"),r.setAttribute("data-blok-testid","overlay-rectangle"),!t)throw new Error("RectangleSelection: blok wrapper not found");return n.appendChild(r),o.appendChild(n),t.appendChild(o),this.overlayRectangle=r,{container:t,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;const t=this.getScrollTop();window.scrollBy(0,e),this.mouseY+=this.getScrollTop()-t,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;const t=this.overlayRectangle;if(t===null)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);const{rightPos:o,leftPos:n,index:r}=this.genInfoForMouseSelection(),i=this.startX>o&&this.mouseX>o,a=this.startX<n&&this.mouseX<n;if(this.rectCrossesBlocks=!(i||a),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),t.style.display="block"),this.updateRectangleSize(),this.Blok.Toolbar.close(),r===void 0)return;this.trySelectNextBlock(r),this.inverseSelection();const l=R.get();l&&l.removeAllRanges()}shrinkRectangleToPoint(){if(this.overlayRectangle===null)return;const e=this.getScrollLeft(),t=this.getScrollTop();this.overlayRectangle.style.left=`${this.startX-e}px`,this.overlayRectangle.style.top=`${this.startY-t}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-t}px)`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-e}px)`}inverseSelection(){if(this.stackOfSelected.length===0)return;const e=this.Blok.BlockManager.getBlockByIndex(this.stackOfSelected[0]);if(!e)return;const t=e.selected;if(this.rectCrossesBlocks&&!t)for(const o of this.stackOfSelected)this.Blok.BlockSelection.selectBlockByIndex(o);if(!this.rectCrossesBlocks&&t)for(const o of this.stackOfSelected)this.Blok.BlockSelection.unSelectBlockByIndex(o)}updateRectangleSize(){if(this.overlayRectangle===null)return;const e=this.getScrollLeft(),t=this.getScrollTop();this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-t}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-t}px)`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-t}px)`,this.overlayRectangle.style.top=`${this.mouseY-t}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-e}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-e}px)`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-e}px)`,this.overlayRectangle.style.left=`${this.mouseX-e}px`)}genInfoForMouseSelection(){var f;const t=document.body.offsetWidth/2,o=this.getScrollTop(),n=this.mouseY-o,r=document.elementFromPoint(t,n),i=(f=this.Blok.BlockManager.lastBlock)==null?void 0:f.holder,a=i==null?void 0:i.querySelector(vi),c=(a?Number.parseInt(window.getComputedStyle(a).width,10):0)/2,d=t-c,u=t+c;if(!r)return{index:void 0,leftPos:d,rightPos:u};const h=this.Blok.BlockManager.getBlockByChildNode(r);return{index:h!==void 0?this.Blok.BlockManager.blocks.findIndex(g=>g.holder===h.holder):void 0,leftPos:d,rightPos:u}}getScrollTop(){var e,t,o,n;return typeof window.scrollY=="number"?window.scrollY:(n=(o=(e=document.documentElement)==null?void 0:e.scrollTop)!=null?o:(t=document.body)==null?void 0:t.scrollTop)!=null?n:0}getScrollLeft(){var e,t,o,n;return typeof window.scrollX=="number"?window.scrollX:(n=(o=(e=document.documentElement)==null?void 0:e.scrollLeft)!=null?o:(t=document.body)==null?void 0:t.scrollLeft)!=null?n:0}addBlockInSelection(e){this.rectCrossesBlocks&&this.Blok.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){const t=this.stackOfSelected.length,o=this.stackOfSelected[t-1];if(o===e)return;const r=this.stackOfSelected[t-2],i=r!==void 0&&o!==void 0?o-r>0:!1,a=t<=1,l=o!==void 0&&e>o&&i,c=o!==void 0&&e<o&&t>1&&!i,u=!(l||c||a);if(!u&&(o===void 0||e>o)){const f=o!==void 0?o+1:e;Array.from({length:e-f+1},(g,b)=>f+b).forEach(g=>{this.addBlockInSelection(g)});return}if(!u&&o!==void 0&&e<o){Array.from({length:o-e},(f,g)=>o-1-g).forEach(f=>{this.addBlockInSelection(f)});return}if(!u)return;const h=f=>o===void 0?!1:e>o?e>f:e<f,p=[];for(const f of[...this.stackOfSelected].reverse()){if(!h(f))break;this.rectCrossesBlocks&&this.Blok.BlockSelection.unSelectBlockByIndex(f),p.push(f)}p.length>0&&this.stackOfSelected.splice(this.stackOfSelected.length-p.length,p.length)}}class Ov extends K{render(e){return new Promise(t=>{const{Tools:o,BlockManager:n}=this.Blok;if(e.length===0)n.insert();else{const r=e.map(i=>{const{tunes:a,id:l}=i,c=i.type,d=o.available.has(c)?{tool:c,data:i.data}:(Me(`Tool «${c}» is not found. Check 'tools' property at the Blok config.`,"warn"),{tool:o.stubTool,data:this.composeStubDataForTool(c,i.data,l)});return((h,p)=>{try{return n.composeBlock({id:l,tool:h,data:p,tunes:a})}catch(f){U(`Block «${h}» skipped because of plugins error`,"error",{data:p,error:f});const g=this.composeStubDataForTool(h,p,l);return n.composeBlock({id:l,tool:o.stubTool,data:g,tunes:a})}})(d.tool,d.data)});n.insertMany(r)}window.requestIdleCallback(()=>{t()},{timeout:2e3})})}composeStubDataForTool(e,t,o){const{Tools:n}=this.Blok,r=(()=>{if(!n.unavailable.has(e))return e;const i=n.unavailable.get(e).toolbox;return i!==void 0&&i[0].title!==void 0?i[0].title:e})();return{savedData:{id:o,type:e,data:t},title:r}}}class _v extends K{async save(){const{BlockManager:e,Tools:t}=this.Blok,o=e.blocks;if(o.length===1&&o[0].isEmpty)return{time:+new Date,blocks:[],version:Oo()};const n=o.map(r=>this.getSavedData(r));this.lastSaveError=void 0;try{const r=await Promise.all(n),i=this.sanitizeExtractedData(r,a=>{var l;return(l=t.blockTools.get(a))==null?void 0:l.sanitizeConfig},this.config.sanitizer);return this.makeOutput(i)}catch(r){this.lastSaveError=r;const i=r instanceof Error?r:new Error(String(r));Me("Saving failed due to the Error %o","error",i);return}}async getSavedData(e){const t=await e.save(),o=e.name,n=(t==null?void 0:t.data)!==void 0?t:this.getPreservedSavedData(e);if(n===void 0)return{tool:o,isValid:!1};const r=await e.validate(n.data);return Se(q({},n),{isValid:r})}makeOutput(e){const t=[];return e.forEach(({id:o,tool:n,data:r,tunes:i,isValid:a})=>{if(!a){U(`Block «${n}» skipped because saved data is invalid`);return}if(n===void 0||r===void 0){U("Block skipped because saved data is missing required fields");return}if(n===this.Blok.Tools.stubTool&&this.isStubSavedData(r)){t.push(r);return}if(n===this.Blok.Tools.stubTool){U("Stub block data is malformed and was skipped");return}const l=i===void 0||ae(i),c=q({id:o,type:n,data:r},!l&&{tunes:i});t.push(c)}),{time:+new Date,blocks:t,version:Oo()}}sanitizeExtractedData(e,t,o){const n=[];if(e.forEach((a,l)=>{this.hasSanitizableData(a)&&n.push({index:l,data:a})}),n.length===0)return e;const r=Ei(n.map(({data:a})=>a),t,o),i=e.map(a=>q({},a));return n.forEach(({index:a},l)=>{const c=r[l];i[a]=Se(q({},i[a]),{data:c.data})}),i}hasSanitizableData(e){return e.data!==void 0&&typeof e.tool=="string"}isStubSavedData(e){if(!Z(e))return!1;const t=e;return typeof t.type=="string"&&t.data!==void 0}getLastSaveError(){return this.lastSaveError}getPreservedSavedData(e){const t=e.preservedData;if(ae(t))return;const o=e.preservedTunes;return Se(q({id:e.id,tool:e.name,data:t},ae(o)?{}:{tunes:o}),{time:0})}}const vo=["empty:before:pointer-events-none","empty:before:text-gray-text","empty:before:cursor-text","empty:before:content-[attr(data-placeholder)]","[&[data-blok-empty=true]]:before:pointer-events-none","[&[data-blok-empty=true]]:before:text-gray-text","[&[data-blok-empty=true]]:before:cursor-text","[&[data-blok-empty=true]]:before:content-[attr(data-placeholder)]"],Mv=["empty:before:pointer-events-none","empty:before:text-gray-text","empty:before:cursor-text","empty:before:content-[attr(data-placeholder-active)]","[&[data-empty=true]]:before:pointer-events-none","[&[data-empty=true]]:before:text-gray-text","[&[data-empty=true]]:before:cursor-text","[&[data-empty=true]]:before:content-[attr(data-placeholder-active)]"],Lv=s=>{const e=s.innerHTML.trim();return e===""||e==="<br>"},Dv=s=>{s.innerHTML==="<br>"&&(s.innerHTML="");const e=window.getSelection();if(!e)return;const t=document.createRange();t.selectNodeContents(s),t.collapse(!0),e.removeAllRanges(),e.addRange(t)},Pv=s=>{Lv(s)&&Dv(s)},fa=(s,e,t="data-placeholder")=>{s.setAttribute(t,e!=null?e:"");const o=()=>Pv(s);s.addEventListener("focus",o),s.addEventListener("input",o)},Fv=s=>{const e=document.createElement("div");e.innerHTML=s.trim();const t=document.createDocumentFragment();return t.append(...Array.from(e.childNodes)),t},ko=class ko{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:t,api:o,readOnly:n}){var r,i,a;this.api=o,this.readOnly=n,this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=(r=t==null?void 0:t.placeholder)!=null?r:ko.DEFAULT_PLACEHOLDER,this._data=e!=null?e:{text:""},this._element=null,this._preserveBlank=(i=t==null?void 0:t.preserveBlank)!=null?i:!1,this._styles=(a=t==null?void 0:t.styles)!=null?a:{}}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;const{textContent:t}=this._element;t===""&&(this._element.innerHTML="")}buildInlineStyles(){const e={};return this._styles.size&&(e.fontSize=this._styles.size),this._styles.lineHeight&&(e.lineHeight=this._styles.lineHeight),this._styles.marginTop&&(e.marginTop=this._styles.marginTop),this._styles.marginBottom&&(e.marginBottom=this._styles.marginBottom),e}drawView(){const e=document.createElement("DIV");e.className=j(this.api.styles.block,ko.WRAPPER_CLASSES,Mv),e.setAttribute(Ho,"paragraph"),e.contentEditable="false";const t=this.buildInlineStyles();return Object.keys(t).length>0&&Object.assign(e.style,t),this._data.text&&(e.innerHTML=this._data.text),this.readOnly?e.setAttribute("data-placeholder-active",this.api.i18n.t(this._placeholder)):(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp),fa(e,this.api.i18n.t(this._placeholder),"data-placeholder-active")),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;const t=Fv(e.text);this._element.appendChild(t),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:this.stripFakeBackgroundElements(e.innerHTML)}}stripFakeBackgroundElements(e){if(!e||!e.includes("data-blok-fake-background"))return e;const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll('[data-blok-fake-background="true"]').forEach(n=>{const r=n.parentNode;if(r){for(;n.firstChild;)r.insertBefore(n.firstChild,n);r.removeChild(n)}}),t.innerHTML}onPaste(e){const t=e.detail;if(!("data"in t))return;const n={text:t.data.innerHTML};this._data=n,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:Ob,title:"Text"}}};ko.WRAPPER_CLASSES=["leading-[1.6em]","outline-none","mt-[2px]","mb-px","[&>p:first-of-type]:mt-0","[&>p:last-of-type]:mb-0"];let pn=ko;const ve=class ve{constructor({data:e,config:t,api:o,readOnly:n}){this._element=null,this.api=o,this.readOnly=n,this._settings=t||{},this._data=this.normalizeData(e)}normalizeData(e){const t=this._settings.defaultStyle||"unordered";if(!e||typeof e!="object")return{style:t,items:[{content:"",checked:!1}]};const o=e.style||t;if(!Array.isArray(e.items))return q({style:o,items:[{content:"",checked:!1}]},e.start!==void 0&&e.start!==1?{start:e.start}:{});const n=e.items.length>0?e.items.map(r=>this.normalizeItem(r)):[{content:"",checked:!1}];return q({style:o,items:n},e.start!==void 0&&e.start!==1?{start:e.start}:{})}normalizeItem(e){if(typeof e=="string")return{content:e,checked:!1};const t={content:e.content||"",checked:!!e.checked};return e.items&&Array.isArray(e.items)&&e.items.length>0&&(t.items=e.items.map(o=>this.normalizeItem(o))),t}get currentStyleConfig(){return ve.STYLE_CONFIGS.find(e=>e.style===this._data.style)||ve.STYLE_CONFIGS[0]}get availableStyles(){const e=this._settings.styles;return!e||e.length===0?ve.STYLE_CONFIGS:ve.STYLE_CONFIGS.filter(t=>e.includes(t.style))}get itemColor(){return this._settings.itemColor}get itemSize(){return this._settings.itemSize}get placeholder(){return this.api.i18n.t(ve.DEFAULT_PLACEHOLDER)}applyItemStyles(e){const t=e;this.itemColor&&(t.style.color=this.itemColor),this.itemSize&&(t.style.fontSize=this.itemSize)}setupItemPlaceholder(e){this.readOnly||fa(e,this.placeholder)}render(){return this._element=this.createListElement(),this._element}createListElement(){const{style:e,items:t}=this._data,o=document.createElement("div");o.className=ve.BASE_STYLES,o.setAttribute(Ho,"list"),o.setAttribute("data-list-style",e);const n=e==="checklist"?this.createChecklistContent(t):this.createStandardListContent(t,e);return o.appendChild(n),this.readOnly||o.addEventListener("keydown",this.handleKeyDown.bind(this)),o}createStandardListContent(e,t,o=[]){var a;const n=o.length,r=document.createElement("div");r.setAttribute("role","list"),r.className="pl-0.5";const i=t==="ordered"&&n===0&&(a=this._data.start)!=null?a:1;return t==="ordered"&&r.setAttribute("data-list-start",String(i)),e.forEach((l,c)=>{r.appendChild(this.createListItem(l,c,o,i))}),r}createChecklistContent(e,t=[]){const o=document.createElement("div");return o.setAttribute("role","list"),o.className="space-y-0.5",e.forEach((n,r)=>{const i=[...t,r];if(o.appendChild(this.createChecklistItem(n,r,i)),n.items&&n.items.length>0){const a=this.createChecklistContent(n.items,i);a.className="pl-6 space-y-0.5",o.appendChild(a)}}),o}createListItem(e,t,o=[],n=1){const r=document.createElement("div");r.setAttribute("role","listitem"),r.className=j(ve.ITEM_STYLES,"flex",...vo),r.setAttribute("data-item-index",String(t));const i=[...o,t];r.setAttribute("data-item-path",JSON.stringify(i)),this.applyItemStyles(r);const a=this.createListMarker(t,o.length,n);r.appendChild(a);const l=document.createElement("div");if(l.className="flex-1 min-w-0",e.items&&e.items.length>0){const c=document.createElement("div");c.contentEditable=this.readOnly?"false":"true",c.innerHTML=e.content,c.className=j("outline-none",...vo),this.setupItemPlaceholder(c),l.appendChild(c);const d=document.createElement("div");d.setAttribute("role","list"),d.className="pl-0.5 mt-1",e.items.forEach((u,h)=>{const p=this.createListItem(u,h,i,1);d.appendChild(p)}),l.appendChild(d)}else l.contentEditable=this.readOnly?"false":"true",l.innerHTML=e.content,l.className=j(l.className,"outline-none",...vo),this.setupItemPlaceholder(l);return r.appendChild(l),r}createListMarker(e,t,o){const n=document.createElement("span");if(n.className="flex-shrink-0 select-none",n.setAttribute("aria-hidden","true"),n.contentEditable="false",this._data.style==="ordered"){const r=this.getOrderedMarkerText(e,t,o);n.textContent=r,n.className=j(n.className,"text-right"),n.style.paddingRight="11px",n.style.minWidth="fit-content"}else{const r=this.getBulletCharacter(t);n.textContent=r,n.className=j(n.className,"w-6 text-center flex justify-center"),n.style.paddingLeft="1px",n.style.paddingRight="13px",n.style.fontSize="24px",n.style.fontFamily="Arial"}return n}getBulletCharacter(e){const t=["•","◦","▪"];return t[e%t.length]}getOrderedMarkerText(e,t,o){const n=o+e;switch(t%3){case 0:return`${n}.`;case 1:return`${this.numberToLowerAlpha(n)}.`;case 2:return`${this.numberToLowerRoman(n)}.`;default:return`${n}.`}}numberToLowerAlpha(e){const t=o=>{if(o<=0)return"";const n=o-1;return t(Math.floor(n/26))+String.fromCharCode(97+n%26)};return t(e)}numberToLowerRoman(e){const t=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],o=(n,r)=>{if(n<=0||r>=t.length)return"";const[i,a]=t[r];return n>=i?a+o(n-i,r):o(n,r+1)};return o(e,0)}createChecklistItem(e,t,o){const n=document.createElement("div");n.setAttribute("role","listitem"),n.className=ve.CHECKLIST_ITEM_STYLES,n.setAttribute("data-item-index",String(t)),n.setAttribute("data-item-path",JSON.stringify(o)),this.applyItemStyles(n);const r=document.createElement("input");r.type="checkbox",r.className=ve.CHECKBOX_STYLES,r.checked=!!e.checked,r.disabled=this.readOnly;const i=document.createElement("div");return i.className=j("flex-1 outline-none leading-[1.6em]",e.checked?"line-through opacity-60":"",...vo),i.contentEditable=this.readOnly?"false":"true",i.innerHTML=e.content,this.setupItemPlaceholder(i),this.readOnly||r.addEventListener("change",()=>{const a=this.getItemAtPath(o);a&&(a.checked=r.checked),i.classList.toggle("line-through",r.checked),i.classList.toggle("opacity-60",r.checked)}),n.appendChild(r),n.appendChild(i),n}handleKeyDown(e){if(e.key==="Enter"&&!e.shiftKey){e.preventDefault(),this.handleEnter();return}if(e.key==="Backspace"){this.handleBackspace(e);return}if(e.key==="Tab"&&e.shiftKey){e.preventDefault(),this.handleOutdent();return}e.key==="Tab"&&(e.preventDefault(),this.handleIndent())}handleEnter(){const e=window.getSelection();if(!e||!this._element)return;const t=e.focusNode;if(!t)return;const o=this.findItemElement(t);if(!o)return;const n=this.getItemPath(o);if(!n||n.length===0)return;const r=this.getContentElement(o);if(!r)return;const i=r.innerHTML.trim();if(i===""||i==="<br>"){this.exitListAndCreateParagraph(n);return}this.addNewItem(n)}exitListAndCreateParagraph(e){const t=e[e.length-1],o=e.slice(0,-1);if(o.length>0){this.unnestEmptyItem(e);return}const n=this.getItemsArrayAtPath(o);if(!n)return;n.splice(t,1);const r=this.api.blocks.getCurrentBlockIndex();if(this._data.items.length===0){this.api.blocks.delete(r);const a=this.api.blocks.insert("paragraph",{text:""},void 0,r,!0);this.api.caret.setToBlock(a,"start");return}this.rerender();const i=this.api.blocks.insert("paragraph",{text:""},void 0,r+1,!0);this.api.caret.setToBlock(i,"start")}unnestEmptyItem(e){const t=e[e.length-1],o=e.slice(0,-1),n=o[o.length-1],r=this.getItemAtPath(o);if(!r||!r.items)return;const i=this.deepCopyItem(r.items[t]),a=r.items.slice(t+1).map(u=>this.deepCopyItem(u));if(a.length>0){const u=i.items||[];i.items=[...u,...a]}r.items.splice(t),r.items.length===0&&delete r.items;const l=o.slice(0,-1),c=this.getItemsArrayAtPath(l);if(!c)return;c.splice(n+1,0,i),this.rerender();const d=[...l,n+1];this.focusItemAtPath(d)}addNewItem(e){const t=window.getSelection();if(!t||!this._element)return;const o=JSON.stringify(e),n=this._element.querySelector(`[data-item-path='${o}']`);if(!n)return;const r=this.getContentElement(n);if(!r)return;const i=t.getRangeAt(0),{beforeContent:a,afterContent:l}=this.splitContentAtCursor(r,i);this.syncDataFromDOM();const c=e[e.length-1],d=e.slice(0,-1),u=this.getItemsArrayAtPath(d);if(!u)return;const h=u[c];if(!h)return;h.content=a;const p={content:l,checked:!1};h.items&&h.items.length>0&&(p.items=h.items,delete h.items),u.splice(c+1,0,p),this.rerender();const f=[...d,c+1];this.focusItemAtPath(f)}splitContentAtCursor(e,t){const o=document.createRange();o.setStart(e,0),o.setEnd(t.startContainer,t.startOffset);const n=document.createRange();return n.setStart(t.endContainer,t.endOffset),n.setEndAfter(e.lastChild||e),{beforeContent:this.getFragmentHTML(o.cloneContents()),afterContent:this.getFragmentHTML(n.cloneContents())}}getContentElement(e){if(this._data.style==="checklist")return e.querySelector("[contenteditable]");const t=e.querySelector(":scope > div.flex-1");if(!t)return null;const o=t.querySelector(":scope > div[contenteditable]");return o||t}handleBackspace(e){const t=window.getSelection();if(!t||!this._element)return;const o=t.focusNode;if(!o)return;const n=this.findItemElement(o);if(!n)return;const r=parseInt(n.getAttribute("data-item-index")||"0",10),i=t.getRangeAt(0);this.shouldMergeWithPrevious(n,i,r)&&(e.preventDefault(),this.mergeWithPreviousItem(r))}shouldMergeWithPrevious(e,t,o){if(t.startOffset!==0||!t.collapsed||o===0)return!1;const n=this.getContentElement(e);return n?this.isAtStart(n,t):!1}mergeWithPreviousItem(e){const t=this._data.items[e-1].content,o=this._data.items[e].content;this._data.items[e-1].content=t+o,this._data.items.splice(e,1),this.rerender(),this.focusItem(e-1,t.length)}syncDataFromDOM(){if(!this._element)return;const e=this.extractItemsFromDOM();e.length>0&&(this._data.items=e)}handleIndent(){const e=window.getSelection();if(!e||!this._element)return;const t=e.focusNode;if(!t)return;const o=this.findItemElement(t);if(!o)return;const n=this.getItemPath(o);if(!n||n.length===0)return;const r=n[n.length-1];if(r===0)return;const i=this.saveCursorOffset(o);this.syncDataFromDOM();const a=this.getItemsArrayAtPath(n.slice(0,-1));if(!a)return;const l=a[r];if(!l)return;const c=a[r-1];if(!c)return;c.items||(c.items=[]),c.items.push(this.deepCopyItem(l)),a.splice(r,1),this.rerender();const d=[...n.slice(0,-1),r-1,c.items.length-1];this.focusItemAtPath(d,i)}getItemPath(e){const t=e.getAttribute("data-item-path");if(!t){const o=e.getAttribute("data-item-index");return o!==null?[parseInt(o,10)]:null}try{return JSON.parse(t)}catch(o){return null}}getItemsArrayAtPath(e){return e.length===0?this._data.items:e.reduce((t,o,n)=>{if(!t)return null;const r=t[o];return r?(n===e.length-1,r.items||null):null},this._data.items)}getItemAtPath(e){if(e.length===0)return null;const t=this.getItemsArrayAtPath(e.slice(0,-1));return t&&t[e[e.length-1]]||null}deepCopyItem(e){const t={content:e.content,checked:e.checked};return e.items&&e.items.length>0&&(t.items=e.items.map(o=>this.deepCopyItem(o))),t}focusItemAtPath(e,t){if(!this._element||e.length===0)return;const o=JSON.stringify(e),n=this._element.querySelector(`[data-item-path='${o}']`);if(!n)return;const r=this.getContentElement(n);r&&(r.focus(),t!==void 0&&this.setCursorAtOffset(r,t))}saveCursorOffset(e){const t=window.getSelection();if(!t||t.rangeCount===0)return 0;const o=this.getContentElement(e);if(!o)return 0;const n=t.getRangeAt(0),r=document.createRange();return r.selectNodeContents(o),r.setEnd(n.startContainer,n.startOffset),r.toString().length}handleOutdent(){const e=window.getSelection();if(!e||!this._element)return;const t=e.focusNode;if(!t)return;const o=this.findItemElement(t);if(!o)return;const n=this.getItemPath(o);if(!n||n.length<=1)return;const r=this.saveCursorOffset(o);this.syncDataFromDOM();const i=n[n.length-1],a=n.slice(0,-1),l=a[a.length-1],c=this.getItemAtPath(a);if(!c||!c.items||!c.items[i])return;const d=this.deepCopyItem(c.items[i]),u=c.items.slice(i+1).map(g=>this.deepCopyItem(g));if(u.length>0){const g=d.items||[];d.items=[...g,...u]}c.items.splice(i),c.items.length===0&&delete c.items;const h=a.slice(0,-1),p=this.getItemsArrayAtPath(h);if(!p)return;p.splice(l+1,0,d),this.rerender();const f=[...h,l+1];this.focusItemAtPath(f,r)}isAtStart(e,t){const o=document.createRange();return o.selectNodeContents(e),o.setEnd(t.startContainer,t.startOffset),o.toString().length===0}findItemElement(e){return this.traverseToItemElement(e)}traverseToItemElement(e){if(e===this._element)return null;if(e instanceof HTMLElement&&e.hasAttribute("data-item-index"))return e;const t=e.parentNode;return t?this.traverseToItemElement(t):null}getFragmentHTML(e){const t=document.createElement("div");return t.appendChild(e),t.innerHTML}rerender(){if(!this._element)return;const e=this._element.parentNode;if(!e)return;const t=this.createListElement();e.replaceChild(t,this._element),this._element=t}focusItem(e,t){if(!this._element)return;const o=JSON.stringify([e]),n=this._element.querySelector(`[data-item-path='${o}']`);if(!n)return;const r=this.getContentElement(n);r&&(r.focus(),t!==void 0&&this.setCursorAtOffset(r,t))}setCursorAtOffset(e,t){const o=document.createRange(),n=window.getSelection(),r=this.findTextNodeAtOffset(e,t);r&&(o.setStart(r.node,r.offset),o.collapse(!0),n==null||n.removeAllRanges(),n==null||n.addRange(o))}findTextNodeAtOffset(e,t){const o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=this.walkTextNodes(o,t,0);return n||this.getLastTextNodePosition(e)}walkTextNodes(e,t,o){var i;const n=e.nextNode();if(!n)return null;const r=((i=n.textContent)==null?void 0:i.length)||0;return o+r>=t?{node:n,offset:t-o}:this.walkTextNodes(e,t,o+r)}getLastTextNodePosition(e){var o;const t=e.lastChild;return!t||t.nodeType!==Node.TEXT_NODE?null:{node:t,offset:((o=t.textContent)==null?void 0:o.length)||0}}renderSettings(){return this.availableStyles.map(e=>({icon:e.icon,label:this.api.i18n.t(e.name),onActivate:()=>this.setStyle(e.style),closeOnActivate:!0,isActive:this._data.style===e.style}))}setStyle(e){this._data.style=e,this.rerender()}validate(e){return e.items&&e.items.length>0&&e.items.some(t=>t.content.trim()!=="")}save(){if(!this._element)return this._data;const e=this.extractItemsFromDOM(),t={style:this._data.style,items:e.length>0?e:this._data.items};return this._data.style==="ordered"&&this._data.start!==void 0&&this._data.start!==1&&(t.start=this._data.start),t}extractItemsFromDOM(){if(!this._element)return[];if(this._data.style==="checklist")return this.extractChecklistItemsFromDOM();const e=this._element.querySelectorAll("[data-item-path]"),t=[];return e.forEach(o=>{const n=o.getAttribute("data-item-path");if(n)try{if(JSON.parse(n).length===1){const i=this.extractItemDataRecursive(o);t.push(i)}}catch(r){}}),t}extractChecklistItemsFromDOM(){if(!this._element)return[];const e=this._element.querySelectorAll("[data-item-path]"),t=new Map,o=[];return e.forEach(n=>{const r=n.getAttribute("data-item-path");if(r)try{const i=JSON.parse(r),a=this.extractItemData(n);t.set(r,a),i.length===1?o[i[0]]=a:this.addNestedItemToParent(t,i,a)}catch(i){}}),o.filter(Boolean)}addNestedItemToParent(e,t,o){const n=t.slice(0,-1),r=JSON.stringify(n),i=e.get(r);i&&(i.items||(i.items=[]),i.items[t[t.length-1]]=o)}extractItemDataRecursive(e){const t=this.extractItemData(e),o=e.querySelector(":scope > div.flex-1"),n=o==null?void 0:o.querySelector(':scope > div[role="list"]'),r=n==null?void 0:n.querySelectorAll(":scope > div[data-item-path]");return!r||r.length===0||(t.items=[],r.forEach(i=>{t.items.push(this.extractItemDataRecursive(i))})),t}extractItemData(e){if(this._data.style==="checklist"){const n=e.querySelector('input[type="checkbox"]'),r=e.querySelector("[contenteditable]");return{content:this.stripFakeBackgroundElements((r==null?void 0:r.innerHTML)||""),checked:(n==null?void 0:n.checked)||!1}}const t=e.querySelector(":scope > div.flex-1");if(!t)return{content:"",checked:!1};const o=t.querySelector(":scope > div[contenteditable]");return o?{content:this.stripFakeBackgroundElements(o.innerHTML||""),checked:!1}:{content:this.stripFakeBackgroundElements(t.innerHTML||""),checked:!1}}stripFakeBackgroundElements(e){if(!e||!e.includes("data-blok-fake-background"))return e;const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll('[data-blok-fake-background="true"]').forEach(n=>{const r=n.parentNode;if(r){for(;n.firstChild;)r.insertBefore(n.firstChild,n);r.removeChild(n)}}),t.innerHTML}merge(e){this._data.items=[...this._data.items,...e.items],this.rerender()}onPaste(e){const t=e.detail;if(!("data"in t))return;const o=t.data,n=this.getStyleFromTag(o.tagName),r=this.extractItemsFromPastedContent(o);this._data={style:n,items:r.length>0?r:[{content:"",checked:!1}]},n==="ordered"&&o instanceof HTMLOListElement&&o.start!==1&&(this._data.start=o.start),this.rerender()}getStyleFromTag(e){return e==="OL"?"ordered":"unordered"}extractItemsFromPastedContent(e){const t=[];return e.querySelectorAll("li").forEach(n=>{t.push({content:n.innerHTML,checked:!1})}),t}static get conversionConfig(){return{export:e=>e.items.map(t=>t.content).join(`
197
- `),import:e=>({style:"unordered",items:e.split(`
198
- `).map(t=>({content:t,checked:!1}))})}}static get sanitize(){return{style:!1,items:!0}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["OL","UL"]}}static get toolbox(){return[{icon:Iu,title:"Bulleted list",data:{style:"unordered"},name:"bulleted-list"},{icon:Nu,title:"Numbered list",data:{style:"ordered"},name:"numbered-list"},{icon:Ru,title:"Checklist",data:{style:"checklist"},name:"check-list"}]}};ve.BASE_STYLES="outline-none py-1",ve.ITEM_STYLES="outline-none py-0.5 leading-[1.6em]",ve.CHECKLIST_ITEM_STYLES="flex items-start py-0.5",ve.CHECKBOX_STYLES="mt-1 w-4 mr-2 h-4 cursor-pointer accent-current",ve.STYLE_CONFIGS=[{style:"unordered",name:"Bulleted list",icon:Iu},{style:"ordered",name:"Numbered list",icon:Nu},{style:"checklist",name:"Checklist",icon:Ru}],ve.DEFAULT_PLACEHOLDER="List";let gn=ve;const m=class m{static get sanitize(){return{strong:{},b:{}}}static normalizeAllBoldTags(){if(typeof document=="undefined")return;const e=`${hu} b, ${Ae} b`;document.querySelectorAll(e).forEach(t=>{m.ensureStrongElement(t)})}static normalizeBoldInNode(e){var n;const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;!t||typeof t.closest!="function"||!t.closest(`${hu}, ${Ae}`)||(t.tagName==="B"&&m.ensureStrongElement(t),(n=t.querySelectorAll)==null||n.call(t,"b").forEach(r=>{m.ensureStrongElement(r)}))}constructor(){typeof document!="undefined"&&(m.instances.add(this),m.initializeGlobalListeners())}static initializeGlobalListeners(){return typeof document=="undefined"?!1:(m.shortcutListenerRegistered||(document.addEventListener("keydown",m.handleShortcut,!0),m.shortcutListenerRegistered=!0),m.selectionListenerRegistered||(document.addEventListener("selectionchange",m.handleGlobalSelectionChange,!0),m.selectionListenerRegistered=!0),m.inputListenerRegistered||(document.addEventListener("input",m.handleGlobalInput,!0),m.inputListenerRegistered=!0),m.beforeInputListenerRegistered||(document.addEventListener("beforeinput",m.handleBeforeInput,!0),m.beforeInputListenerRegistered=!0),m.ensureMutationObserver(),!0)}static maintainCollapsedExitState(){var e,t,o,n,r;if(typeof document!="undefined")for(const i of Array.from(m.collapsedExitRecords)){const a=m.resolveBoundary(i);if(!a){m.collapsedExitRecords.delete(i);continue}i.boundary=a.boundary,i.boldElement=a.boldElement;const l=a.boundary,c=a.boldElement,d=i.allowedLength,u=(e=c.textContent)!=null?e:"";if(u.length>d){const x=u.slice(0,d),E=u.slice(d);c.textContent=x,l.textContent=((t=l.textContent)!=null?t:"")+E}const h=(o=l.textContent)!=null?o:"";h.length>1&&h.startsWith("​")&&(l.textContent=h.slice(1));const p=window.getSelection();m.ensureCaretAtBoundary(p,l),m.scheduleBoundaryCaretAdjustment(l);const f=(n=l.textContent)!=null?n:"",g=f.replace(/\u200B/g,""),b=g.match(/^\s+/),k=/\S/.test(g),y=f.startsWith("​");b&&(i.hasLeadingSpace=!0,i.leadingWhitespace=b[0]),k&&(i.hasTypedContent=!0);const T=/^\s/.test(g),C=i.hasTypedContent&&!y&&((r=c.textContent)!=null?r:"").length<=d,N=i.hasLeadingSpace&&i.hasTypedContent&&!T;if(C&&N){const x=f.replace(/^[\u200B\s]+/,""),E=i.leadingWhitespace||" ";l.textContent=`${E}${x}`,m.ensureCaretAtBoundary(p,l)}C&&m.collapsedExitRecords.delete(i)}}static ensureCaretAtBoundary(e,t){!e||!e.isCollapsed||m.setCaretToBoundaryEnd(e,t)}static scheduleBoundaryCaretAdjustment(e){m.pendingBoundaryCaretAdjustments.has(e)||(m.pendingBoundaryCaretAdjustments.add(e),setTimeout(()=>{var r,i,a;m.pendingBoundaryCaretAdjustments.delete(e);const t=(r=e.ownerDocument)!=null?r:typeof document!="undefined"?document:null;if(!t)return;const o=t.getSelection();if(!o||!o.isCollapsed||o.anchorNode!==e)return;const n=(a=(i=e.textContent)==null?void 0:i.length)!=null?a:0;o.anchorOffset!==n&&m.setCaret(o,e,n)},0))}static ensureTextNodeAfter(e){var i;const t=e.nextSibling;if((t==null?void 0:t.nodeType)===Node.TEXT_NODE)return t;const o=e.parentNode;if(!o)return null;const n=(i=e.ownerDocument)!=null?i:typeof document!="undefined"?document:null;if(!n)return null;const r=n.createTextNode("");return o.insertBefore(r,t),r}static resolveBoundary(e){if(!e.boldElement.isConnected)return null;const t=m.ensureStrongElement(e.boldElement),o=e.boundary,r=o.isConnected&&o.previousSibling===t?o:m.ensureTextNodeAfter(t);return r?{boundary:r,boldElement:t}:null}static setCaretToBoundaryEnd(e,t){var r,i;const o=document.createRange(),n=(i=(r=t.textContent)==null?void 0:r.length)!=null?i:0;o.setStart(t,n),o.collapse(!0),e.removeAllRanges(),e.addRange(o)}static hasBoldParent(e){return e?e.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(e)?!0:m.hasBoldParent(e.parentNode):!1}static findBoldElement(e){return e?e.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(e)?m.ensureStrongElement(e):m.findBoldElement(e.parentNode):null}static isBoldTag(e){const t=e.tagName;return t==="B"||t==="STRONG"}static ensureStrongElement(e){if(e.tagName==="STRONG")return e;const t=document.createElement("strong");for(e.hasAttributes()&&Array.from(e.attributes).forEach(o=>{t.setAttribute(o.name,o.value)});e.firstChild;)t.appendChild(e.firstChild);return e.replaceWith(t),t}static mergeStrongNodes(e,t){const o=m.ensureStrongElement(e),n=m.ensureStrongElement(t);for(;n.firstChild;)o.appendChild(n.firstChild);return n.remove(),o}render(){return{icon:mb,name:"bold",onActivate:()=>{this.toggleBold()},isActive:()=>{const e=window.getSelection();return e?this.isSelectionVisuallyBold(e):!1}}}toggleBold(){const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);if(t.collapsed){this.toggleCollapsedSelection();return}this.isRangeBold(t,{ignoreWhitespace:!0})?this.unwrapBoldTags(t):this.wrapWithBold(t)}isSelectionVisuallyBold(e){if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0);return this.isRangeBold(t,{ignoreWhitespace:!0})}wrapWithBold(e){const t=this.getRangeHtmlWithoutBold(e),o=this.replaceRangeWithHtml(e,`<strong>${t}</strong>`),n=window.getSelection();n&&o&&(n.removeAllRanges(),n.addRange(o)),m.normalizeAllBoldTags();const r=n?m.findBoldElement(n.focusNode):null;if(!r)return;const i=this.mergeAdjacentBold(r);this.normalizeWhitespaceAround(i),this.selectElementContents(i),m.normalizeBoldTagsWithinBlok(window.getSelection()),m.replaceNbspInBlock(window.getSelection()),this.notifySelectionChange()}unwrapBoldTags(e){const t=this.collectBoldAncestors(e),o=window.getSelection();if(!o)return;const n=document.createElement("span"),r=e.extractContents();n.setAttribute("data-blok-bold-marker",`unwrap-${m.markerSequence++}`),n.appendChild(r),this.removeNestedBold(n),e.insertNode(n);const i=document.createRange();for(i.selectNodeContents(n),o.removeAllRanges(),o.addRange(i);;){const d=m.findBoldElement(n);if(!d)break;this.moveMarkerOutOfBold(n,d)}const a=n.firstChild,l=n.lastChild;this.unwrapElement(n);const c=a&&l?(()=>{const d=document.createRange();return d.setStartBefore(a),d.setEndAfter(l),o.removeAllRanges(),o.addRange(d),d})():void 0;c||o.removeAllRanges(),this.replaceNbspWithinRange(c),m.normalizeBoldTagsWithinBlok(o),m.replaceNbspInBlock(o),m.removeEmptyBoldElements(o),t.forEach(d=>{m.isElementEmpty(d)&&d.remove()}),this.notifySelectionChange()}replaceRangeWithHtml(e,t){var a,l;const o=m.createFragmentFromHtml(t),n=(a=o.firstChild)!=null?a:null,r=(l=o.lastChild)!=null?l:null;if(e.deleteContents(),!n||!r)return;e.insertNode(o);const i=document.createRange();return i.setStartBefore(n),i.setEndAfter(r),i}moveMarkerOutOfBold(e,t){const o=t.parentNode;if(!o)return;if(Array.from(t.childNodes).forEach(l=>{var c;l.nodeType===Node.TEXT_NODE&&((c=l.textContent)!=null?c:"").length===0&&l.remove()}),t.childNodes.length===1&&t.firstChild===e){t.replaceWith(e);return}if(t.firstChild===e){o.insertBefore(e,t);return}if(t.lastChild===e){o.insertBefore(e,t.nextSibling);return}const a=t.cloneNode(!1);for(;e.nextSibling;)a.appendChild(e.nextSibling);o.insertBefore(a,t.nextSibling),o.insertBefore(e,a)}selectElementContents(e){const t=window.getSelection();if(!t)return;const o=document.createRange();o.selectNodeContents(e),t.removeAllRanges(),t.addRange(o)}get shortcut(){return"CMD+B"}isRangeBold(e,t){var r;if(e.collapsed)return!!m.findBoldElement(e.startContainer);const o=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:i=>{try{return e.intersectsNode(i)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(a){const l=document.createRange();l.selectNodeContents(i);const c=e.compareBoundaryPoints(Range.END_TO_START,l)>0,d=e.compareBoundaryPoints(Range.START_TO_END,l)<0;return c&&d?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}}),n=[];for(;o.nextNode();){const i=o.currentNode,a=(r=i.textContent)!=null?r:"";t.ignoreWhitespace&&a.trim().length===0||a.length!==0&&n.push(i)}return n.length===0?!!m.findBoldElement(e.startContainer):n.every(i=>m.hasBoldParent(i))}removeNestedBold(e){var o;const t=(o=e.querySelectorAll)==null?void 0:o.call(e,"b,strong");t&&t.forEach(n=>{this.unwrapElement(n)})}unwrapElement(e){const t=e.parentNode;if(!t){e.remove();return}for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}mergeAdjacentBold(e){const t=m.ensureStrongElement(e),o=t.previousSibling,n=o&&o.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(o)?m.mergeStrongNodes(o,t):t,r=n.nextSibling;return r&&r.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(r)?m.mergeStrongNodes(n,r):n}toggleCollapsedSelection(){const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0),o=m.findBoldElement(t.startContainer),n=(()=>{if(o&&o.getAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE)!=="true")return m.exitCollapsedBold(e,o);const r=o!=null?o:m.getBoundaryBold(t);return r?m.exitCollapsedBold(e,r):this.startCollapsedBold(t)})();document.dispatchEvent(new Event("selectionchange")),n&&(e.removeAllRanges(),e.addRange(n)),m.normalizeBoldTagsWithinBlok(e),m.replaceNbspInBlock(e),m.removeEmptyBoldElements(e),this.notifySelectionChange()}startCollapsedBold(e){if(!e.collapsed)return;const t=document.createElement("strong"),o=document.createTextNode("");t.appendChild(o),t.setAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE,"true");const n=e.startContainer,r=e.startOffset;if(!(n.nodeType===Node.TEXT_NODE?this.insertCollapsedBoldIntoText(n,t,r):n.nodeType===Node.ELEMENT_NODE?(this.insertCollapsedBoldIntoElement(n,t,r),!0):!1))return;const a=window.getSelection(),l=document.createRange();l.setStart(o,0),l.collapse(!0);const c=this.mergeAdjacentBold(t);return m.normalizeBoldTagsWithinBlok(a),m.replaceNbspInBlock(a),m.removeEmptyBoldElements(a),a&&(a.removeAllRanges(),a.addRange(l)),this.notifySelectionChange(),c.firstChild instanceof Text?(()=>{var u,h;const d=document.createRange();return d.setStart(c.firstChild,(h=(u=c.firstChild.textContent)==null?void 0:u.length)!=null?h:0),d.collapse(!0),d})():l}insertCollapsedBoldIntoText(e,t,o){var d;const n=e,r=n.parentNode;if(!r)return!1;const i=(d=n.textContent)!=null?d:"",a=i.slice(0,o),l=i.slice(o);n.textContent=a;const c=l.length?document.createTextNode(l):null;return c&&r.insertBefore(c,n.nextSibling),r.insertBefore(t,c!=null?c:n.nextSibling),t.setAttribute(m.DATA_ATTR_PREV_LENGTH,a.length.toString()),!0}insertCollapsedBoldIntoElement(e,t,o){var r;const n=(r=e.childNodes[o])!=null?r:null;e.insertBefore(t,n),t.setAttribute(m.DATA_ATTR_PREV_LENGTH,"0")}static isElementEmpty(e){var t;return((t=e.textContent)!=null?t:"").length===0}notifySelectionChange(){m.enforceCollapsedBoldLengths(window.getSelection()),document.dispatchEvent(new Event("selectionchange")),this.updateToolbarButtonState()}updateToolbarButtonState(){const e=window.getSelection();if(!e)return;const t=e.anchorNode,o=(t==null?void 0:t.nodeType)===Node.ELEMENT_NODE?t:t==null?void 0:t.parentElement,n=o==null?void 0:o.closest(Ae);if(!n)return;const r=n.querySelector("[data-blok-testid=inline-toolbar]");if(!(r instanceof HTMLElement))return;const i=r.querySelector('[data-blok-item-name="bold"]');if(!(i instanceof HTMLElement))return;this.isSelectionVisuallyBold(e)?i.setAttribute("data-blok-popover-item-active","true"):i.removeAttribute("data-blok-popover-item-active")}normalizeWhitespaceAround(e){m.replaceNbspWithSpace(e.previousSibling),m.replaceNbspWithSpace(e.nextSibling)}static replaceNbspWithSpace(e){var n;if(!e||e.nodeType!==Node.TEXT_NODE)return;const t=e,o=(n=t.textContent)!=null?n:"";o.includes(" ")&&(t.textContent=o.replace(/\u00A0/g," "))}restoreSelectionFromMarkers(e){const t=document.querySelector(`[data-blok-bold-marker="${e}-start"]`),o=document.querySelector(`[data-blok-bold-marker="${e}-end"]`);if(!t||!o){t==null||t.remove(),o==null||o.remove();return}const n=window.getSelection();if(!n){t.remove(),o.remove();return}const r=document.createRange();return r.setStartAfter(t),r.setEndBefore(o),n.removeAllRanges(),n.addRange(r),t.remove(),o.remove(),r}replaceNbspWithinRange(e){if(!e)return;const t=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:o=>{try{return e.intersectsNode(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(n){const r=document.createRange();r.selectNodeContents(o);const i=e.compareBoundaryPoints(Range.END_TO_START,r)>0,a=e.compareBoundaryPoints(Range.START_TO_END,r)<0;return i&&a?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}});for(;t.nextNode();)m.replaceNbspWithSpace(t.currentNode)}static normalizeBoldTagsWithinBlok(e){var r;const t=(r=e==null?void 0:e.anchorNode)!=null?r:e==null?void 0:e.focusNode;if(!t)return;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,n=o==null?void 0:o.closest(Ae);n&&n.querySelectorAll("b").forEach(i=>{m.ensureStrongElement(i)})}static replaceNbspInBlock(e){var i;const t=(i=e==null?void 0:e.anchorNode)!=null?i:e==null?void 0:e.focusNode;if(!t)return;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,n=o==null?void 0:o.closest('[data-blok-component="paragraph"]');if(!n)return;const r=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(;r.nextNode();)m.replaceNbspWithSpace(r.currentNode);n.querySelectorAll("b").forEach(a=>{m.ensureStrongElement(a)})}static removeEmptyBoldElements(e){var i,a;const t=(i=e==null?void 0:e.anchorNode)!=null?i:e==null?void 0:e.focusNode;if(!t)return;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,n=o==null?void 0:o.closest('[data-blok-component="paragraph"]');if(!n)return;const r=(a=e==null?void 0:e.focusNode)!=null?a:null;n.querySelectorAll("strong").forEach(l=>{var u;const c=l.getAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE)==="true",d=l.hasAttribute(m.DATA_ATTR_COLLAPSED_LENGTH);c||d||((u=l.textContent)!=null?u:"").length===0&&!m.isNodeWithin(r,l)&&l.remove()})}static synchronizeCollapsedBold(e){var i,a;const t=(i=e==null?void 0:e.anchorNode)!=null?i:e==null?void 0:e.focusNode,o=t&&t.nodeType===Node.ELEMENT_NODE?t:t==null?void 0:t.parentElement,n=(a=o==null?void 0:o.closest(Ae))!=null?a:o==null?void 0:o.ownerDocument;if(!n)return;const r=`strong[${m.DATA_ATTR_COLLAPSED_ACTIVE}="true"]`;n.querySelectorAll(r).forEach(l=>{var _,F,O,Y,L;const c=l.getAttribute(m.DATA_ATTR_PREV_LENGTH),d=l.previousSibling;if(!c||!d||d.nodeType!==Node.TEXT_NODE)return;const u=Number(c);if(!Number.isFinite(u))return;const h=d,p=(_=h.textContent)!=null?_:"";if(p.length<=u)return;const f=p.slice(0,u),g=p.slice(u);h.textContent=f;const b=g.match(/^[\u00A0\s]+/);if(b&&!l.hasAttribute(m.DATA_ATTR_LEADING_WHITESPACE)&&l.setAttribute(m.DATA_ATTR_LEADING_WHITESPACE,b[0]),g.length===0)return;const k=(F=l.textContent)!=null?F:"",y=k+g,T=(O=l.getAttribute(m.DATA_ATTR_LEADING_WHITESPACE))!=null?O:"",N=T.length>0&&k.length===0&&!y.startsWith(T)?T+y:y,x=document.createTextNode(N);for(;l.firstChild;)l.removeChild(l.firstChild);if(l.appendChild(x),!(e!=null&&e.isCollapsed)||!m.isNodeWithin(e.focusNode,h))return;const E=document.createRange(),w=(L=(Y=x.textContent)==null?void 0:Y.length)!=null?L:0;E.setStart(x,w),E.collapse(!0),e.removeAllRanges(),e.addRange(E)})}static moveCaretAfterBoundaryBold(e){if(!e.rangeCount)return;const t=e.getRangeAt(0);if(!t.collapsed)return;const o=m.findBoldElement(t.startContainer);(o==null?void 0:o.getAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE))!=="true"&&(m.moveCaretFromElementContainer(e,t)||m.moveCaretFromTextContainer(e,t))}static getAdjacentBold(e){const t=e.startContainer;return t.nodeType===Node.TEXT_NODE?m.getBoldAdjacentToText(e,t):t.nodeType===Node.ELEMENT_NODE?m.getBoldAdjacentToElement(e,t):null}static getBoldAdjacentToText(e,t){var i,a;const o=(a=(i=t.textContent)==null?void 0:i.length)!=null?a:0,n=t.previousSibling;if(e.startOffset===0&&m.isBoldElement(n))return n;if(e.startOffset!==o)return null;const r=t.nextSibling;return m.isBoldElement(r)?r:null}static getBoldAdjacentToElement(e,t){var r,i;const o=e.startOffset>0&&(r=t.childNodes[e.startOffset-1])!=null?r:null;if(m.isBoldElement(o))return o;const n=(i=t.childNodes[e.startOffset])!=null?i:null;return m.isBoldElement(n)?n:null}static exitCollapsedIfNeeded(e,t){var i;if(!!m.findBoldElement(t.startContainer))return;const n=(i=m.getBoundaryBold(t))!=null?i:m.getAdjacentBold(t);if(!n)return;const r=m.exitCollapsedBold(e,n);r&&(e.removeAllRanges(),e.addRange(r))}static moveCaretFromElementContainer(e,t){if(t.startContainer.nodeType!==Node.ELEMENT_NODE)return!1;const o=t.startContainer;return m.moveCaretAfterPreviousBold(e,o,t.startOffset)?!0:m.moveCaretBeforeNextBold(e,o,t.startOffset)}static moveCaretAfterPreviousBold(e,t,o){var a,l,c;const n=o>0&&(a=t.childNodes[o-1])!=null?a:null;if(!m.isBoldElement(n))return!1;const r=m.ensureFollowingTextNode(n,n.nextSibling);if(!r)return!1;const i=(c=(l=r.textContent)==null?void 0:l.length)!=null?c:0;return m.setCaret(e,r,i),!0}static moveCaretBeforeNextBold(e,t,o){var i;const n=(i=t.childNodes[o])!=null?i:null;if(!m.isBoldElement(n))return!1;const r=m.ensureFollowingTextNode(n,n.nextSibling);return r?(m.setCaret(e,r,0),!0):(m.setCaretAfterNode(e,n),!0)}static moveCaretFromTextContainer(e,t){var c,d,u;if(t.startContainer.nodeType!==Node.TEXT_NODE)return;const o=t.startContainer,n=o.previousSibling,r=(c=o.textContent)!=null?c:"",i=/^\s/.test(r);if(t.startOffset===0&&m.isBoldElement(n)&&(r.length===0||i)){m.setCaret(e,o,r.length);return}const a=m.findBoldElement(o);if(!a||t.startOffset!==((u=(d=o.textContent)==null?void 0:d.length)!=null?u:0))return;const l=m.ensureFollowingTextNode(a,a.nextSibling);if(l){m.setCaret(e,l,0);return}m.setCaretAfterNode(e,a)}static guardCollapsedBoundaryKeydown(e){var l;if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.key.length!==1)return;const o=window.getSelection();if(!o||!o.isCollapsed||o.rangeCount===0)return;const n=o.getRangeAt(0);if(n.startContainer.nodeType!==Node.TEXT_NODE)return;const r=n.startContainer,i=(l=r.textContent)!=null?l:"";if(i.length===0||n.startOffset!==0)return;const a=r.previousSibling;m.isBoldElement(a)&&/^\s/.test(i)&&m.setCaret(o,r,i.length)}static isBoldElement(e){return!!(e&&e.nodeType===Node.ELEMENT_NODE&&m.isBoldTag(e))}static setCaret(e,t,o){const n=document.createRange();n.setStart(t,o),n.collapse(!0),e.removeAllRanges(),e.addRange(n)}static setCaretAfterNode(e,t){if(!t)return;const o=document.createRange();o.setStartAfter(t),o.collapse(!0),e.removeAllRanges(),e.addRange(o)}static ensureFollowingTextNode(e,t){const o=e.parentNode;if(!o)return null;if(t&&t.nodeType===Node.TEXT_NODE)return t;const n=document.createTextNode("");return o.insertBefore(n,t),n}static enforceCollapsedBoldLengths(e){var i;const t=(i=e==null?void 0:e.anchorNode)!=null?i:e==null?void 0:e.focusNode;if(!t)return;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,n=o==null?void 0:o.closest(Ae);if(!n)return;n.querySelectorAll(`strong[${m.DATA_ATTR_COLLAPSED_LENGTH}]`).forEach(a=>{var C,N,x,E,w;const l=a,c=l.getAttribute(m.DATA_ATTR_COLLAPSED_LENGTH);if(!c)return;const d=Number(c),u=(C=l.textContent)!=null?C:"";if(!Number.isFinite(d))return;const h=u.length>d,p=h?m.splitCollapsedBoldText(l,d,u):null,f=l.getAttribute(m.DATA_ATTR_PREV_LENGTH),g=f?Number(f):NaN,b=l.previousSibling,k=(b==null?void 0:b.nodeType)===Node.TEXT_NODE?b:null,y=(N=k==null?void 0:k.textContent)!=null?N:"",T=!!(f&&Number.isFinite(g)&&k&&y.length>g);if(T&&k){const _=y.slice(0,g),F=y.slice(g);k.textContent=_;const O=document.createTextNode(F);(x=l.parentNode)==null||x.insertBefore(O,l.nextSibling)}if(T&&l.removeAttribute(m.DATA_ATTR_PREV_LENGTH),e!=null&&e.isCollapsed&&p&&m.isNodeWithin(e.focusNode,l)){const _=document.createRange(),F=(w=(E=p.textContent)==null?void 0:E.length)!=null?w:0;_.setStart(p,F),_.collapse(!0),e.removeAllRanges(),e.addRange(_)}h&&l.removeAttribute(m.DATA_ATTR_COLLAPSED_LENGTH)})}static splitCollapsedBoldText(e,t,o){const n=e,r=n.parentNode;if(!r)return null;const i=o.slice(0,t),a=o.slice(t);n.textContent=i;const l=document.createTextNode(a);return r.insertBefore(l,n.nextSibling),l}static isNodeWithin(e,t){return e?e===t||t.contains(e):!1}static handleGlobalSelectionChange(){m.refreshSelectionState("selectionchange")}static handleGlobalInput(){m.refreshSelectionState("input")}static refreshSelectionState(e){const t=window.getSelection();m.enforceCollapsedBoldLengths(t),m.maintainCollapsedExitState(),m.synchronizeCollapsedBold(t),m.normalizeBoldTagsWithinBlok(t),m.removeEmptyBoldElements(t),e==="input"&&t&&m.moveCaretAfterBoundaryBold(t),m.normalizeAllBoldTags()}static ensureMutationObserver(){if(typeof MutationObserver=="undefined"||m.mutationObserver)return;const e=new MutationObserver(t=>{if(!m.isProcessingMutation){m.isProcessingMutation=!0;try{t.forEach(o=>{o.addedNodes.forEach(n=>{m.normalizeBoldInNode(n)}),o.type==="characterData"&&o.target&&m.normalizeBoldInNode(o.target)})}finally{m.isProcessingMutation=!1}}});e.observe(document.body,{subtree:!0,childList:!0,characterData:!0}),m.mutationObserver=e}static handleBeforeInput(e){if(e.inputType!=="formatBold")return;const t=window.getSelection(),o=!!(t&&m.isSelectionInsideBlok(t)),n=m.isEventTargetInsideBlok(e.target);!o&&!n||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),m.normalizeAllBoldTags())}static exitCollapsedBold(e,t){const o=m.ensureStrongElement(t),n=o.parentNode;if(n)return m.isElementEmpty(o)?m.removeEmptyBoldElement(e,o,n):m.exitCollapsedBoldWithContent(e,o,n)}static removeEmptyBoldElement(e,t,o){const n=document.createRange();return n.setStartBefore(t),n.collapse(!0),o.removeChild(t),e.removeAllRanges(),e.addRange(n),n}static exitCollapsedBoldWithContent(e,t,o){var h,p,f,g,b,k;t.setAttribute(m.DATA_ATTR_COLLAPSED_LENGTH,((p=(h=t.textContent)==null?void 0:h.length)!=null?p:0).toString()),t.removeAttribute(m.DATA_ATTR_PREV_LENGTH),t.removeAttribute(m.DATA_ATTR_COLLAPSED_ACTIVE),t.removeAttribute(m.DATA_ATTR_LEADING_WHITESPACE);const n=t.nextSibling,r=!n||n.nodeType!==Node.TEXT_NODE,i=r?document.createTextNode("​"):null;i&&o.insertBefore(i,n);const a=i!=null?i:n;!r&&((f=a.textContent)!=null?f:"").length===0&&(a.textContent="​");const l=document.createRange(),d=((g=a.textContent)!=null?g:"").startsWith("​")?1:0;l.setStart(a,d),l.collapse(!0),e.removeAllRanges(),e.addRange(l);const u=m.ensureStrongElement(t);return m.collapsedExitRecords.add({boundary:a,boldElement:u,allowedLength:(k=(b=u.textContent)==null?void 0:b.length)!=null?k:0,hasLeadingSpace:!1,hasTypedContent:!1,leadingWhitespace:""}),l}static getBoundaryBold(e){const t=e.startContainer;return t.nodeType===Node.TEXT_NODE?m.getBoundaryBoldForText(e,t):t.nodeType===Node.ELEMENT_NODE?m.getBoundaryBoldForElement(e,t):null}static getBoundaryBoldForText(e,t){var r,i;const o=(i=(r=t.textContent)==null?void 0:r.length)!=null?i:0;if(e.startOffset===o)return m.findBoldElement(t);if(e.startOffset!==0)return null;const n=t.previousSibling;return m.isBoldElement(n)?n:null}static getBoundaryBoldForElement(e,t){if(e.startOffset<=0)return null;const o=t.childNodes[e.startOffset-1];return m.isBoldElement(o)?o:null}static handleShortcut(e){var n;if(m.guardCollapsedBoundaryKeydown(e),!m.isBoldShortcut(e))return;const t=window.getSelection();if(!t||!t.rangeCount||!m.isSelectionInsideBlok(t))return;const o=(n=m.instances.values().next().value)!=null?n:new m;o&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),o.toggleBold())}static isBoldShortcut(e){return!((typeof navigator!="undefined"?navigator.userAgent.toLowerCase():"").includes("mac")?e.metaKey:e.ctrlKey)||e.altKey?!1:e.key.toLowerCase()==="b"}static isSelectionInsideBlok(e){const t=e.anchorNode;if(!t)return!1;const o=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;return!!(o!=null&&o.closest(Ae))}static isEventTargetInsideBlok(e){var o;if(!e||typeof Node=="undefined")return!1;if(e instanceof Element)return!!e.closest(Ae);if(e instanceof Text)return!!((o=e.parentElement)!=null&&o.closest(Ae));if(typeof ShadowRoot!="undefined"&&e instanceof ShadowRoot)return m.isEventTargetInsideBlok(e.host);if(!(e instanceof Node))return!1;const t=e.parentNode;return t?t instanceof Element?!!t.closest(Ae):m.isEventTargetInsideBlok(t):!1}getRangeHtmlWithoutBold(e){const t=e.cloneContents();this.removeNestedBold(t);const o=document.createElement("div");return o.appendChild(t),o.innerHTML}static createFragmentFromHtml(e){const t=document.createElement("template");return t.innerHTML=e,t.content}collectBoldAncestors(e){const t=new Set,o=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:n=>{try{return e.intersectsNode(n)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(r){const i=document.createRange();i.selectNodeContents(n);const a=e.compareBoundaryPoints(Range.END_TO_START,i)>0,l=e.compareBoundaryPoints(Range.START_TO_END,i)<0;return a&&l?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}});for(;o.nextNode();){const n=m.findBoldElement(o.currentNode);n&&t.add(n)}return Array.from(t)}};m.isInline=!0,m.title="Bold",m.shortcutListenerRegistered=!1,m.selectionListenerRegistered=!1,m.inputListenerRegistered=!1,m.beforeInputListenerRegistered=!1,m.globalListenersInitialized=m.initializeGlobalListeners(),m.collapsedExitRecords=new Set,m.markerSequence=0,m.isProcessingMutation=!1,m.DATA_ATTR_COLLAPSED_LENGTH="data-blok-bold-collapsed-length",m.DATA_ATTR_COLLAPSED_ACTIVE="data-blok-bold-collapsed-active",m.DATA_ATTR_PREV_LENGTH="data-blok-bold-prev-length",m.DATA_ATTR_LEADING_WHITESPACE="data-blok-bold-leading-ws",m.instances=new Set,m.pendingBoundaryCaretAdjustments=new WeakSet;let pa=m;const bn=class bn{static get sanitize(){return{i:{},em:{}}}render(){return{icon:bb,name:"italic",onActivate:()=>{this.toggleItalic()},isActive:()=>{const e=window.getSelection();return e?this.isSelectionVisuallyItalic(e):!1}}}get shortcut(){return"CMD+I"}toggleItalic(){const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);if(t.collapsed){this.toggleCollapsedItalic(t,e);return}this.isRangeItalic(t,{ignoreWhitespace:!0})?this.unwrapItalicTags(t):this.wrapWithItalic(t)}toggleCollapsedItalic(e,t){if(this.isRangeItalic(e,{ignoreWhitespace:!0})){const n=document.createTextNode("​");e.insertNode(n),e.selectNode(n),this.unwrapItalicTags(e);const r=document.createRange();r.setStart(n,1),r.setEnd(n,1),t.removeAllRanges(),t.addRange(r)}else{const n=document.createElement("i"),r=document.createTextNode("​");n.appendChild(r),e.insertNode(n);const i=document.createRange();i.setStart(r,1),i.setEnd(r,1),t.removeAllRanges(),t.addRange(i)}}isSelectionVisuallyItalic(e){if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0);return this.isRangeItalic(t,{ignoreWhitespace:!0})}isRangeItalic(e,t){var r;if(e.collapsed)return!!this.findItalicElement(e.startContainer);const o=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:i=>{try{return e.intersectsNode(i)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(a){const l=document.createRange();l.selectNodeContents(i);const c=e.compareBoundaryPoints(Range.END_TO_START,l)>0,d=e.compareBoundaryPoints(Range.START_TO_END,l)<0;return c&&d?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}}),n=[];for(;o.nextNode();){const i=o.currentNode,a=(r=i.textContent)!=null?r:"";t.ignoreWhitespace&&a.trim().length===0||a.length!==0&&n.push(i)}return n.length===0?!!this.findItalicElement(e.startContainer):n.every(i=>this.hasItalicParent(i))}wrapWithItalic(e){const t=this.getRangeHtmlWithoutItalic(e),o=this.replaceRangeWithHtml(e,`<i>${t}</i>`),n=window.getSelection();n&&o&&(n.removeAllRanges(),n.addRange(o))}unwrapItalicTags(e){const t=this.collectItalicAncestors(e),o=window.getSelection();if(!o)return;const n=document.createElement("span"),r=e.extractContents();n.appendChild(r),this.removeNestedItalic(n),e.insertNode(n);const i=document.createRange();for(i.selectNodeContents(n),o.removeAllRanges(),o.addRange(i);;){const d=this.findItalicElement(n);if(!d)break;this.moveMarkerOutOfItalic(n,d)}const a=n.firstChild,l=n.lastChild;this.unwrapElement(n),(a&&l?(()=>{const d=document.createRange();return d.setStartBefore(a),d.setEndAfter(l),o.removeAllRanges(),o.addRange(d),d})():void 0)||o.removeAllRanges(),t.forEach(d=>{var u;((u=d.textContent)!=null?u:"").length===0&&d.remove()})}hasItalicParent(e){return e?e.nodeType===Node.ELEMENT_NODE&&this.isItalicTag(e)?!0:this.hasItalicParent(e.parentNode):!1}findItalicElement(e){return e?e.nodeType===Node.ELEMENT_NODE&&this.isItalicTag(e)?e:this.findItalicElement(e.parentNode):null}isItalicTag(e){const t=e.tagName;return t==="I"||t==="EM"}collectItalicAncestors(e){const t=new Set,o=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:n=>{try{return e.intersectsNode(n)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}catch(r){const i=document.createRange();i.selectNodeContents(n);const a=e.compareBoundaryPoints(Range.END_TO_START,i)>0,l=e.compareBoundaryPoints(Range.START_TO_END,i)<0;return a&&l?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}});for(;o.nextNode();){const n=this.findItalicElement(o.currentNode);n&&t.add(n)}return Array.from(t)}getRangeHtmlWithoutItalic(e){const t=e.cloneContents();this.removeNestedItalic(t);const o=document.createElement("div");return o.appendChild(t),o.innerHTML}removeNestedItalic(e){var o;const t=(o=e.querySelectorAll)==null?void 0:o.call(e,"i,em");t&&t.forEach(n=>{this.unwrapElement(n)})}unwrapElement(e){const t=e.parentNode;if(!t){e.remove();return}for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}replaceRangeWithHtml(e,t){var a,l;const o=this.createFragmentFromHtml(t),n=(a=o.firstChild)!=null?a:null,r=(l=o.lastChild)!=null?l:null;if(e.deleteContents(),!n||!r)return;e.insertNode(o);const i=document.createRange();return i.setStartBefore(n),i.setEndAfter(r),i}createFragmentFromHtml(e){const t=document.createElement("template");return t.innerHTML=e,t.content}moveMarkerOutOfItalic(e,t){const o=t.parentNode;if(!o)return;if(Array.from(t.childNodes).forEach(l=>{var c;l.nodeType===Node.TEXT_NODE&&((c=l.textContent)!=null?c:"").length===0&&l.remove()}),t.childNodes.length===1&&t.firstChild===e){t.replaceWith(e);return}if(t.firstChild===e){o.insertBefore(e,t);return}if(t.lastChild===e){o.insertBefore(e,t.nextSibling);return}const a=t.cloneNode(!1);for(;e.nextSibling;)a.appendChild(e.nextSibling);o.insertBefore(a,t.nextSibling),o.insertBefore(e,a)}};bn.isInline=!0,bn.title="Italic";let ga=bn;const Hv=(Ct=class{constructor({api:e}){this.INPUT_BASE_CLASSES="hidden w-full m-0 px-2 py-1 text-sm leading-[22px] font-medium bg-item-hover-bg border border-[rgba(226,226,229,0.2)] rounded-md outline-none box-border appearance-none font-[inherit] placeholder:text-gray-text mobile:text-[15px] mobile:font-medium",this.DATA_ATTRIBUTES={buttonActive:"data-blok-link-tool-active",buttonUnlink:"data-blok-link-tool-unlink",inputOpened:"data-blok-link-tool-input-opened"},this.nodes={input:null,button:null},this.inputOpened=!1,this.unlinkAvailable=!1,this.handleButtonClick=t=>{!this.inputOpened||!this.unlinkAvailable||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.restoreSelection(),this.unlink(),this.inlineToolbar.close())},this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new R,this.nodes.input=this.createInput()}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return{icon:vb,isActive:()=>!!this.selection.findParentTag("A"),children:{hideChevron:!0,items:[{type:le.Html,element:this.nodes.input}],onOpen:()=>{this.openActions(!0)},onClose:()=>{this.closeActions()}}}}createInput(){const e=document.createElement("input");return e.placeholder=this.i18n.t("Add a link"),e.enterKeyHint="done",e.className=this.INPUT_BASE_CLASSES,e.setAttribute("data-blok-testid","inline-tool-input"),this.setBooleanStateAttribute(e,this.DATA_ATTRIBUTES.inputOpened,!1),e.addEventListener("keydown",t=>{t.key==="Enter"&&this.enterPressed(t)}),e}get shortcut(){return"CMD+K"}openActions(e=!1){if(!this.nodes.input)return;const t=this.selection.findParentTag("A"),o=!!t;if(this.updateButtonStateAttributes(o),this.unlinkAvailable=o,t){const n=t.getAttribute("href");this.nodes.input.value=n!==null?n:""}else this.nodes.input.value="";this.nodes.input.className=j(this.INPUT_BASE_CLASSES,"block"),this.setBooleanStateAttribute(this.nodes.input,this.DATA_ATTRIBUTES.inputOpened,!0),this.selection.setFakeBackground(),this.selection.save(),e&&this.focusInputWithRetry(),this.inputOpened=!0}focusInputWithRetry(){this.nodes.input&&(this.nodes.input.focus(),!(typeof window=="undefined"||typeof document=="undefined")&&window.setTimeout(()=>{var e;document.activeElement!==this.nodes.input&&((e=this.nodes.input)==null||e.focus())},0))}getButtonElement(){if(this.nodes.button&&document.contains(this.nodes.button))return this.nodes.button;const e=document.querySelector(`${fu} [data-blok-item-name="link"]`);return e&&e.addEventListener("click",this.handleButtonClick,!0),this.nodes.button=e!=null?e:null,this.nodes.button}updateButtonStateAttributes(e){const t=this.getButtonElement();if(!t)return;const o=typeof e=="boolean"?e:!!this.selection.findParentTag("A");this.setBooleanStateAttribute(t,this.DATA_ATTRIBUTES.buttonActive,o),this.setBooleanStateAttribute(t,this.DATA_ATTRIBUTES.buttonUnlink,o)}closeActions(e=!0){(this.selection.isFakeBackgroundEnabled||e&&this.selection.savedSelectionRange)&&this.restoreSelection(),this.nodes.input&&(this.nodes.input.className=this.INPUT_BASE_CLASSES,this.setBooleanStateAttribute(this.nodes.input,this.DATA_ATTRIBUTES.inputOpened,!1),this.nodes.input.value="",this.updateButtonStateAttributes(!1),this.unlinkAvailable=!1,e&&this.selection.clearSaved(),this.inputOpened=!1)}restoreSelection(){const e=new R,t=R.isAtBlok;if(t&&e.save(),this.selection.removeFakeBackground(),this.selection.restore(),!t&&this.selection.savedSelectionRange){const r=this.selection.savedSelectionRange.commonAncestorContainer,i=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;i==null||i.focus()}if(!t)return;e.restore();const o=e.savedSelectionRange;if(o){const n=o.commonAncestorContainer,r=n.nodeType===Node.ELEMENT_NODE?n:n.parentElement;r==null||r.focus()}}enterPressed(e){if(!this.nodes.input)return;const t=this.nodes.input.value||"";if(!t.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions(),this.inlineToolbar.close();return}if(!this.validateURL(t)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),U("Incorrect Link pasted","warn",t);return}const o=this.prepareLink(t);this.selection.removeFakeBackground(),this.selection.restore(),this.insertLink(o),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return this.addProtocol(e.trim())}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;const t=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",n=/^\/\/[^/\s]/.test(e);return!t&&!o&&!n?"http://"+e:e}insertLink(e){const t=this.selection.findParentTag("A");if(t){this.selection.expandToTag(t),t.href=e,t.target="_blank",t.rel="nofollow";return}const o=R.range;if(!o)return;const n=document.createElement("a");n.href=e,n.target="_blank",n.rel="nofollow",n.appendChild(o.extractContents()),o.insertNode(n),this.selection.expandToTag(n)}unlink(){const e=this.selection.findParentTag("A");e&&(this.unwrap(e),this.updateButtonStateAttributes(!1),this.unlinkAvailable=!1)}unwrap(e){var o;const t=document.createDocumentFragment();for(;e.firstChild;)t.appendChild(e.firstChild);(o=e.parentNode)==null||o.replaceChild(t,e)}setBooleanStateAttribute(e,t,o){e&&e.setAttribute(t,o?"true":"false")}},Ct.isInline=!0,Ct.title="Link",Ct),Ba=class Ba{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){var d;const e=R.get();if(e===null)return[];const t=this.blocksAPI.getBlockByElement(e.anchorNode);if(t===void 0)return[];const o=this.toolsAPI.getBlockTools(),n=await xi(t,o);if(n.length===0)return[];const r=this.getSelectedListItemInfo(e.anchorNode),i=n.reduce((u,h)=>{var p;return(p=h.toolbox)==null||p.forEach(f=>{f.title!==void 0&&u.push({icon:f.icon,title:oe.t(he.toolNames,f.title),name:h.name,closeOnActivate:!0,onActivate:async()=>{if(r!==null&&t.name==="list")await this.convertListItem(t,r,h.name,f.data);else{const g=await this.blocksAPI.convert(t.id,h.name,f.data);this.caretAPI.setToBlock(g,"end")}}})}),u},[]),a=await t.getActiveToolboxEntry(),l=(d=a==null?void 0:a.title)!=null?d:t.name,c=!st();return{name:"convert-to",title:oe.t(he.toolNames,l),hint:{title:oe.ui(he.ui.inlineToolbar.converter,"Convert to")},children:{items:i,onOpen:()=>{c&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{c&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}getSelectedListItemInfo(e){const t=this.findListItemElement(e);if(!t)return null;const o=t.getAttribute("data-item-path");if(!o)return null;try{const n=JSON.parse(o),r=this.getListItemContentElement(t),i=(r==null?void 0:r.innerHTML)||"";return{path:n,content:i}}catch(n){return null}}findListItemElement(e){var t;return e?(t=e.getAttribute)!=null&&t.call(e,"data-item-path")?e:this.findListItemElement(e.parentElement):null}getListItemContentElement(e){const t=e.querySelector(":scope > div[contenteditable]");if(t)return t;const o=e.querySelector(":scope > div.flex-1");if(!o)return null;const n=o.querySelector(":scope > div[contenteditable]");return n||o}async convertListItem(e,t,o,n){const r=this.blocksAPI.getBlockIndex(e.id);if(r===void 0)return;const i=await e.save();if(!(i!=null&&i.data))return;const a=i.data,{path:l,content:c}=t;if(l.length>1){await this.convertNestedItemToBlock(e,a,l,c,o,n,r);return}await this.convertRootItemToBlock(e,a,l[0],c,o,n,r)}async convertRootItemToBlock(e,t,o,n,r,i,a){const l=t.items.slice(0,o),c=t.items.slice(o+1),d=t.items[o],h=[...d!=null&&d.items?this.deepCloneItems(d.items):[],...this.deepCloneItems(c)],p=this.prepareBlockData(r,n,i),f=l.length>0,g=h.length>0;if(f&&g){await this.handleSplitWithBothParts(e,t,l,h,r,p,a);return}if(f){await this.handleSplitWithOnlyBefore(e,t,l,r,p,a);return}if(g){await this.handleSplitWithOnlyAfter(e,t,h,r,p,a);return}this.deleteListBlockIfExists(e.id);const b=this.blocksAPI.insert(r,p,void 0,a,!1);this.caretAPI.setToBlock(b,"end")}async handleSplitWithBothParts(e,t,o,n,r,i,a){await this.blocksAPI.update(e.id,q({style:t.style,items:this.deepCloneItems(o)},t.start!==void 0?{start:t.start}:{}));const l=this.blocksAPI.insert(r,i,void 0,a+1,!1);this.blocksAPI.insert("list",{style:t.style,items:n},void 0,a+2,!1),this.caretAPI.setToBlock(l,"end")}async handleSplitWithOnlyBefore(e,t,o,n,r,i){await this.blocksAPI.update(e.id,q({style:t.style,items:this.deepCloneItems(o)},t.start!==void 0?{start:t.start}:{}));const a=this.blocksAPI.insert(n,r,void 0,i+1,!1);this.caretAPI.setToBlock(a,"end")}async handleSplitWithOnlyAfter(e,t,o,n,r,i){const a=this.blocksAPI.insert(n,r,void 0,i,!1);await this.blocksAPI.update(e.id,{style:t.style,items:o}),this.caretAPI.setToBlock(a,"end")}async convertNestedItemToBlock(e,t,o,n,r,i,a){const l=o[0],c=t.items.slice(0,l),d=this.deepCloneItems([t.items[l]])[0],u=t.items.slice(l+1),{updatedParent:h,itemsAfterNested:p}=this.removeNestedItemAndGetAfter(d,o.slice(1)),f=h!==null?[...c,h]:[...c],g=[...p,...u],b=this.prepareBlockData(r,n,i),k=f.length>0,y=g.length>0;if(k&&y){await this.handleSplitWithBothParts(e,t,f,g,r,b,a);return}if(k){await this.handleSplitWithOnlyBefore(e,t,f,r,b,a);return}if(y){await this.handleSplitWithOnlyAfter(e,t,g,r,b,a);return}this.deleteListBlockIfExists(e.id);const T=this.blocksAPI.insert(r,b,void 0,a,!1);this.caretAPI.setToBlock(T,"end")}removeNestedItemAndGetAfter(e,t){if(t.length===0||!e.items)return{updatedParent:e,itemsAfterNested:[]};const o=t[0];return t.length===1?this.removeDirectChildAndGetAfter(e,o):this.removeDeepNestedItemAndGetAfter(e,t,o)}removeDirectChildAndGetAfter(e,t){const o=e.items,n=o.slice(t+1),r=o.slice(0,t),i=o[t],a=(i==null?void 0:i.items)||[],l=[...r,...a],c={content:e.content,checked:e.checked};return l.length>0&&(c.items=l),{updatedParent:c,itemsAfterNested:n}}removeDeepNestedItemAndGetAfter(e,t,o){const n=e.items,r=n[o];if(!r)return{updatedParent:e,itemsAfterNested:[]};const i=this.removeNestedItemAndGetAfter(r,t.slice(1)),a=[...n];i.updatedParent===null?a.splice(o,1):a[o]=i.updatedParent;const l={content:e.content,checked:e.checked};return a.length>0&&(l.items=a),{updatedParent:l,itemsAfterNested:i.itemsAfterNested}}deleteListBlockIfExists(e){const t=this.blocksAPI.getBlockIndex(e);t!==void 0&&this.blocksAPI.delete(t)}deepCloneItems(e){return e.map(t=>{const o={content:t.content,checked:t.checked};return t.items&&t.items.length>0&&(o.items=this.deepCloneItems(t.items)),o})}prepareBlockData(e,t,o){if(e==="list")return{style:(o==null?void 0:o.style)||"unordered",items:[{content:t,checked:!1}]};const i={[{paragraph:"text",header:"text"}[e]||"text"]:t};return o?q(q({},i),o):i}};Ba.isInline=!0;let ma=Ba;const xa=class xa{constructor({data:e,api:t}){this.api=t,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){const e=v.make("div","flex items-center py-3 px-[18px] my-2.5 rounded-[10px] bg-bg-light border border-line-gray text-gray-text text-sm [&_svg]:size-icon"),t=_b,o=v.make("div","ml-3.5"),n=v.make("div","font-medium capitalize",{textContent:this.title}),r=v.make("div","",{textContent:this.subtitle});return e.setAttribute(Ho,"stub"),e.setAttribute(pm,""),o.setAttribute(gm,""),n.setAttribute(mm,""),r.setAttribute(bm,""),e.innerHTML=t,o.appendChild(n),o.appendChild(r),e.appendChild(o),e}};xa.isReadOnlySupported=!0;let ba=xa;class qv extends ji{constructor(){super(...arguments),this.type=yt.Inline}getMissingMethods(e){const t=this.constructable,o=t==null?void 0:t.prototype;return o?e.filter(n=>typeof o[n]!="function"):[...e]}create(){const e=this.constructable;return new e({api:this.api,config:this.settings})}get isReadOnlySupported(){var t;const e=this.constructable;return(t=e==null?void 0:e.isReadOnlySupported)!=null?t:!1}get title(){return this.constructable.title||""}}class zv extends ji{constructor(){super(...arguments),this.type=yt.Tune}create(e,t){const o=this.constructable;return new o({api:this.api,config:this.settings,block:t,data:e})}}class ye extends Map{get blockTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isBlock());return new ye(e)}get inlineTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInline());return new ye(e)}get blockTunes(){const e=Array.from(this.entries()).filter(([,t])=>t.isTune());return new ye(e)}get internalTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInternal);return new ye(e)}get externalTools(){const e=Array.from(this.entries()).filter(([,t])=>!t.isInternal);return new ye(e)}}class jv extends ji{constructor(){super(...arguments),this.type=yt.Block,this.inlineTools=new ye,this.tunes=new ye}create(e,t,o){return new this.constructable({data:e,block:t,readOnly:o,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[Dt.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){var e;return(e=this.constructable[Dt.IsEnabledLineBreaks])!=null?e:!1}get toolbox(){const e=this.constructable[Dt.Toolbox],t=this.config[Vo.Toolbox];if(!e||ae(e)||t===!1)return;const o=this.mergeToolboxSettings(e,t);return this.filterToolboxEntriesByStyles(o)}mergeToolboxSettings(e,t){return t==null?Array.isArray(e)?e:[e]:!Array.isArray(t)&&Array.isArray(e)?[t]:Array.isArray(t)?Array.isArray(e)?t.map((o,n)=>{const r=e[n];return r?q(q({},r),o):o}):t:[q(q({},e),t)]}filterToolboxEntriesByStyles(e){const t=this.settings.toolboxStyles;return!t||!Array.isArray(t)||t.length===0?e:e.filter(o=>{const n=o.data;return!n||!n.style?!0:t.includes(n.style)})}get conversionConfig(){return this.constructable[Dt.ConversionConfig]}get enabledInlineTools(){return this.config[Vo.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[Vo.EnabledBlockTunes]}get pasteConfig(){var e;return(e=this.constructable[Dt.PasteConfig])!=null?e:{}}get hasOnPasteHandler(){var t;const e=(t=this.constructable)==null?void 0:t.prototype;return typeof(e==null?void 0:e.onPaste)=="function"}get sanitizeConfig(){if(this._sanitizeConfig)return this._sanitizeConfig;const e=super.sanitizeConfig,t=this.baseSanitizeConfig;if(ae(e))return this._sanitizeConfig=t,t;const o={};for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n];Z(r)?o[n]=Object.assign({},t,r):o[n]=r}return this._sanitizeConfig=o,o}get baseSanitizeConfig(){if(this._baseSanitizeConfig)return this._baseSanitizeConfig;const e={};return Array.from(this.inlineTools.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),Array.from(this.tunes.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),this._baseSanitizeConfig=e,e}}class Uv{constructor(e,t,o){this.api=o,this.config=e,this.blokConfig=t}get(e){const l=this.config[e],{class:t,isInternal:o=!1}=l,n=Ah(l,["class","isInternal"]),r=t;if(r===void 0)throw new Error(`Tool "${e}" does not provide a class.`);const i=this.getConstructor(r),a=!!Reflect.get(r,zi.IsTune);return new i({name:e,constructable:r,config:n,api:this.api.getMethodsForTool(e,a),isDefault:e===this.blokConfig.defaultBlock,defaultPlaceholder:this.blokConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case!!Reflect.get(e,qu.IsInline):return qv;case!!Reflect.get(e,zi.IsTune):return zv;default:return jv}}}const Ca=class Ca{constructor({api:e}){this.api=e}render(){return{icon:Au,title:this.api.i18n.t("Delete"),name:"delete",onActivate:()=>this.handleClick()}}handleClick(){this.api.blocks.delete()}};Ca.isTune=!0;let va=Ca;const ut=s=>{if(!V(s))throw new Error("Tool constructable must be a function");return s};class Kv extends K{constructor(){super(...arguments),this.stubTool="stub",this.factory=null,this.toolsAvailable=new ye,this.toolsUnavailable=new ye,this.inlineToolsSanitizeConfigCache=null}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){const e=this.config.defaultBlock;if(!e)throw new Error("Default block tool name is not configured");const t=this.blockTools.get(e);if(!t)throw new Error(`Default block tool "${e}" not found in available block tools`);return t}get internal(){return this.available.internalTools}async prepare(){var l;const e=(l=this.config.tools)!=null?l:{};this.config.tools=Yt({},this.internalTools,e),this.validateTools();const t=this.config.tools;if(!t||Object.keys(t).length===0)throw Error("Can't start without tools");const o=this.prepareConfig(t);this.factory=new Uv(o,this.config,this.Blok.API);const n=this.getListOfPrepareFunctions(o);if(n.length===0)return Promise.resolve();const r=c=>{this.isToolPrepareData(c)&&this.toolPrepareMethodSuccess({toolName:c.toolName})},i=c=>{this.isToolPrepareData(c)&&this.toolPrepareMethodFallback({toolName:c.toolName})},a=new vh;n.forEach(c=>{a.add(async()=>{const d=og(c.data)?{}:c.data;try{await c.function(c.data),r(d)}catch(u){i(d)}})}),await a.completed,this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){if(this.inlineToolsSanitizeConfigCache)return this.inlineToolsSanitizeConfigCache;const e={};return Array.from(this.inlineTools.values()).forEach(t=>{Object.assign(e,t.sanitizeConfig)}),this.inlineToolsSanitizeConfigCache=e,e}destroy(){for(const e of this.available.values()){const t=(()=>{try{return e.reset()}catch(o){U(`Tool "${e.name}" reset failed`,"warn",o);return}})();t instanceof Promise&&t.catch(o=>{U(`Tool "${e.name}" reset failed`,"warn",o)})}}get internalTools(){return{convertTo:{class:ut(ma),isInternal:!0},link:{class:ut(Hv),isInternal:!0},bold:{class:ut(pa),isInternal:!0},italic:{class:ut(ga),isInternal:!0},paragraph:{class:ut(pn),inlineToolbar:!0,config:{preserveBlank:!0},isInternal:!0},list:{class:ut(gn),inlineToolbar:!0,isInternal:!0},stub:{class:ut(ba),isInternal:!0},delete:{class:ut(va),isInternal:!0}}}toolPrepareMethodSuccess(e){const t=this.getFactory().get(e.toolName);if(!t.isInline()){this.toolsAvailable.set(t.name,t);return}const o=["render"],n=t.getMissingMethods(o);if(n.length){U(`Incorrect Inline Tool: ${t.name}. Some of required methods is not implemented %o`,"warn",n),this.toolsUnavailable.set(t.name,t);return}this.toolsAvailable.set(t.name,t)}toolPrepareMethodFallback(e){const t=this.getFactory();this.toolsUnavailable.set(e.toolName,t.get(e.toolName))}getListOfPrepareFunctions(e){return Object.entries(e).map(([t,o])=>{var i;const n={toolName:t,config:(i=o.config)!=null?i:{}};return{function:async a=>{const l=o.class;if(!l||!V(l.prepare))return;const c=a!=null?a:n;return l.prepare.call(l,c)},data:n}})}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){const t=e;if(this.config.inlineToolbar!==!1){if(t.enabledInlineTools===!0){const o=Array.isArray(this.config.inlineToolbar)?this.createInlineToolsCollection(this.config.inlineToolbar):new ye(Array.from(this.inlineTools.entries()));t.inlineTools=o;return}if(Array.isArray(t.enabledInlineTools)){const o=this.createInlineToolsCollection(["convertTo",...t.enabledInlineTools]);t.inlineTools=o}}}assignBlockTunesToBlockTool(e){const t=e;if(t.enabledBlockTunes!==!1){if(Array.isArray(t.enabledBlockTunes)){const o=this.createBlockTunesCollection(t.enabledBlockTunes),n=[...Array.from(o.entries()),...Array.from(this.blockTunes.internalTools.entries())];t.tunes=new ye(n);return}if(Array.isArray(this.config.tunes)){const o=this.createBlockTunesCollection(this.config.tunes),n=[...Array.from(o.entries()),...Array.from(this.blockTunes.internalTools.entries())];t.tunes=new ye(n);return}t.tunes=new ye(Array.from(this.blockTunes.internalTools.entries()))}}validateTools(){const e=this.config.tools;if(!e)return;const t=this.internalTools;for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o)||o in t)continue;const n=e[o],r=V(n),a=V(n.class);if(!r&&!a)throw new Xt(`Tool «${o}» must be a constructor function or an object with function in the «class» property`)}}prepareConfig(e){const t={};for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const n=e[o];if(Z(n)){t[o]=n;continue}t[o]={class:n}}return t}isToolPrepareData(e){const t=e;return typeof(t==null?void 0:t.toolName)=="string"}getFactory(){if(this.factory===null)throw new Error("Tools factory is not initialized");return this.factory}createInlineToolsCollection(e){const t=[];for(const o of e){const n=this.inlineTools.get(o);if(!n){U(`Inline tool "${o}" is not available and will be skipped`,"warn");continue}t.push([o,n])}return new ye(t)}createBlockTunesCollection(e){const t=[];for(const o of e){const n=this.blockTunes.get(o);if(!n){U(`Block tune "${o}" is not available and will be skipped`,"warn");continue}t.push([o,n])}return new ye(t)}}const Wv=`*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:PT Mono,Menlo,Monaco,Consolas,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:651px){.\\!container{max-width:651px!important}.container{max-width:651px}}@media(min-width:768px){.\\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\\!container{max-width:1536px!important}.container{max-width:1536px}}.blok-block{padding:3px 2px}.blok-block::-webkit-input-placeholder{line-height:1.5!important}.blok-inline-tool-button{display:flex;height:100%;width:1.75rem;cursor:pointer;align-items:center;justify-content:center;border-radius:.25rem;border-width:0px;background-color:transparent;padding:0;line-height:1.5;--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.blok-inline-tool-button--active{background-color:#388ae51a;--tw-text-opacity: 1;color:rgb(56 138 229 / var(--tw-text-opacity, 1))}.blok-input{width:100%;border-radius:3px;border-width:1px;--tw-border-opacity: 1;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1));padding:.625rem .75rem;--tw-shadow: inset 0 1px 2px 0 rgba(35, 44, 72, .06);--tw-shadow-colored: inset 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}.blok-input[data-blok-placeholder]:before{pointer-events:none;position:static!important;display:inline-block;width:0px;content:var(--tw-content);white-space:nowrap}.blok-loader{position:relative;border-width:1px;--tw-border-opacity: 1;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1))}.blok-loader:before{position:absolute;left:50%;top:50%;margin-left:-11px;margin-top:-11px;height:18px;content:var(--tw-content);width:18px}@keyframes rotation{0%{content:var(--tw-content);transform:rotate(0)}to{content:var(--tw-content);transform:rotate(360deg)}}.blok-loader:before{animation:rotation 1.2s infinite linear;border-radius:9999px;border-width:2px;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1));--tw-border-opacity: 1;border-left-color:rgb(56 138 229 / var(--tw-border-opacity, 1));--tw-content: "";content:var(--tw-content)}.blok-button{cursor:pointer;border-radius:3px;border-width:1px;--tw-border-opacity: 1;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:13px;text-align:center;font-size:14.9px;--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1));--tw-shadow: 0 2px 2px 0 rgba(18, 30, 57, .04);--tw-shadow-colored: 0 2px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blok-button:hover{--tw-bg-opacity: 1;background-color:rgb(251 252 254 / var(--tw-bg-opacity, 1));--tw-shadow: 0 1px 3px 0 rgba(18, 30, 57, .08);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blok-button svg{margin-right:.2em;margin-top:-.125rem;height:1.25rem}.blok-settings-button{margin:0;display:inline-flex;min-height:26px;min-width:26px;cursor:pointer;align-items:center;justify-content:center;border-radius:3px;border-width:0px;background-color:transparent;vertical-align:bottom;color:inherit;outline:2px solid transparent;outline-offset:2px}@media(max-width:650px){.blok-settings-button{height:36px;width:36px;border-radius:.5rem}}@media(hover:hover){.blok-settings-button:hover{--tw-bg-opacity: 1;background-color:rgb(239 242 245 / var(--tw-bg-opacity, 1))}}.blok-settings-button svg{height:auto;width:auto}@media(max-width:650px){.blok-settings-button svg{height:28px;width:28px}}.blok-settings-button--active{--tw-text-opacity: 1;color:rgb(56 138 229 / var(--tw-text-opacity, 1))}.blok-settings-button--focused{background-color:#22baff14;--tw-shadow: inset 0 0 0 1px rgba(7, 161, 227, .08);--tw-shadow-colored: inset 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}@keyframes buttonClicked{0%{transform:scale3d(.95,.95,.95)}60%{transform:scale3d(1.02,1.02,1.02)}80%,to{transform:scaleZ(1)}}.blok-settings-button--focused-animated{animation:buttonClicked .75s cubic-bezier(.215,.61,.355,1) forwards}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-\\[auto_var\\(--offset\\)_calc\\(var\\(--offset\\)\\+env\\(safe-area-inset-bottom\\)\\)_var\\(--offset\\)\\]{inset:auto var(--offset) calc(var(--offset) + env(safe-area-inset-bottom)) var(--offset)}.bottom-0{bottom:0}.bottom-5{bottom:1.25rem}.left-0{left:0}.left-5{left:1.25rem}.left-\\[var\\(--popover-left\\)\\]{left:var(--popover-left)}.right-0{right:0}.right-\\[15px\\]{right:15px}.right-full{right:100%}.top-0{top:0}.top-\\[7px\\]{top:7px}.top-\\[var\\(--popover-top\\)\\]{top:var(--popover-top)}.z-0{z-index:0}.z-\\[1\\]{z-index:1}.z-\\[2\\]{z-index:2}.z-\\[3\\]{z-index:3}.z-\\[4\\]{z-index:4}.z-overlay{z-index:999}.m-0{margin:0}.mx-auto{margin-left:auto;margin-right:auto}.my-2\\.5{margin-top:.625rem;margin-bottom:.625rem}.my-4{margin-top:1rem;margin-bottom:1rem}.\\!mr-0{margin-right:0!important}.\\!mr-2{margin-right:.5rem!important}.mb-1{margin-bottom:.25rem}.mb-1\\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-\\[30px\\]{margin-bottom:30px}.mb-px{margin-bottom:1px}.ml-3\\.5{margin-left:.875rem}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-1{margin-top:.25rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-\\[15px\\]{margin-top:15px}.mt-\\[2px\\]{margin-top:2px}.mt-\\[3px\\]{margin-top:3px}.mt-\\[5px\\]{margin-top:5px}.box-border{box-sizing:border-box}.\\!block{display:block!important}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.contents{display:contents}.\\!hidden{display:none!important}.hidden{display:none}.h-2\\.5{height:.625rem}.h-4{height:1rem}.h-9{height:2.25rem}.h-\\[26px\\]{height:26px}.h-\\[50px\\]{height:50px}.h-auto{height:auto}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-px{height:1px}.h-toolbox-btn{height:26px}.max-h-0{max-height:0px}.max-h-\\[var\\(--max-height\\)\\]{max-height:var(--max-height)}.w-2\\.5{width:.625rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-9{width:2.25rem}.w-\\[230px\\]{width:230px}.w-\\[26px\\]{width:26px}.w-\\[var\\(--width\\)\\]{width:var(--width)}.w-auto{width:auto}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.w-toolbox-btn{width:26px}.min-w-0{min-width:0px}.min-w-\\[calc\\(100\\%-theme\\(\\'spacing\\.6\\'\\)-10px\\)\\]{min-width:calc(100% - 1.5rem - 10px)}.min-w-\\[calc\\(100\\%-var\\(--offset\\)\\*2\\)\\]{min-width:calc(100% - var(--offset) * 2)}.min-w-\\[var\\(--width\\)\\]{min-width:var(--width)}.min-w-max{min-width:-moz-max-content;min-width:max-content}.max-w-\\[1100px\\]{max-width:1100px}.max-w-\\[130px\\]{max-width:130px}.max-w-content{max-width:650px}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-\\[5px\\]{--tw-translate-x: -5px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-\\[5px\\]{--tw-translate-y: -5px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\\[5px\\]{--tw-translate-x: 5px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\\[5px\\]{--tw-translate-y: 5px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-none{transform:none}@keyframes panelShowingMobile{0%{opacity:0;transform:translateY(14px) scale(.98)}70%{opacity:1;transform:translateY(-4px)}to{transform:translateY(0)}}.animate-\\[panelShowingMobile_250ms_ease\\]{animation:panelShowingMobile .25s ease}@keyframes panelShowing{0%{opacity:0;transform:translateY(-8px) scale(.9)}70%{opacity:1;transform:translateY(2px)}to{transform:translateY(0)}}.animate-\\[panelShowing_100ms_ease\\]{animation:panelShowing .1s ease}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fade-in .3s ease forwards}.animate-none{animation:none}@keyframes notifyBounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}to{transform:scale(1)}}.animate-notify-bounce-in{animation:notifyBounceIn .6s 1}@keyframes wobble{0%{transform:translateZ(0)}15%{transform:translate3d(-9%,0,0)}30%{transform:translate3d(9%,0,0)}45%{transform:translate3d(-4%,0,0)}60%{transform:translate3d(4%,0,0)}75%{transform:translate3d(-1%,0,0)}to{transform:translateZ(0)}}.animate-wobble{animation:wobble .4s}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-\\[auto_auto_1fr\\]{grid-template-columns:auto auto 1fr}.grid-rows-\\[auto\\]{grid-template-rows:auto}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.space-y-0\\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-\\[10px\\]{border-radius:10px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[5px\\]{border-radius:5px}.rounded-\\[7px\\]{border-radius:7px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-0{border-width:0px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-\\[\\#e8e8eb\\]{--tw-border-opacity: 1;border-color:rgb(232 232 235 / var(--tw-border-opacity, 1))}.border-\\[rgba\\(226\\,226\\,229\\,0\\.2\\)\\],.border-\\[rgba\\(226\\,226\\,229\\,0\\.20\\)\\]{border-color:#e2e2e533}.border-line-gray,.border-popover-border{--tw-border-opacity: 1;border-color:rgb(239 240 241 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.\\!bg-\\[\\#fafffe\\]{--tw-bg-opacity: 1 !important;background-color:rgb(250 255 254 / var(--tw-bg-opacity, 1))!important}.\\!bg-\\[\\#fffbfb\\]{--tw-bg-opacity: 1 !important;background-color:rgb(255 251 251 / var(--tw-bg-opacity, 1))!important}.\\!bg-item-confirm-bg{--tw-bg-opacity: 1 !important;background-color:rgb(226 74 74 / var(--tw-bg-opacity, 1))!important}.\\!bg-item-focus-bg{background-color:#22baff14!important}.bg-\\[\\#34c992\\]{--tw-bg-opacity: 1;background-color:rgb(52 201 146 / var(--tw-bg-opacity, 1))}.bg-\\[\\#F8F8F8\\]{--tw-bg-opacity: 1;background-color:rgb(248 248 248 / var(--tw-bg-opacity, 1))}.bg-\\[\\#eff1f4\\]{--tw-bg-opacity: 1;background-color:rgb(239 241 244 / var(--tw-bg-opacity, 1))}.bg-\\[\\#f2f5f7\\]{--tw-bg-opacity: 1;background-color:rgb(242 245 247 / var(--tw-bg-opacity, 1))}.bg-\\[\\#f7f7f7\\]{--tw-bg-opacity: 1;background-color:rgb(247 247 247 / var(--tw-bg-opacity, 1))}.bg-bg-light{--tw-bg-opacity: 1;background-color:rgb(239 242 245 / var(--tw-bg-opacity, 1))}.bg-dark{--tw-bg-opacity: 1;background-color:rgb(29 32 43 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-icon-active-bg{background-color:#388ae51a}.bg-item-hover-bg{--tw-bg-opacity: 1;background-color:rgb(248 248 248 / var(--tw-bg-opacity, 1))}.bg-popover-bg{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-popover-border{--tw-bg-opacity: 1;background-color:rgb(239 240 241 / var(--tw-bg-opacity, 1))}.bg-selection{--tw-bg-opacity: 1;background-color:rgb(225 242 255 / var(--tw-bg-opacity, 1))}.bg-selection-highlight{background-color:#2eaadc33}.bg-tooltip-bg{--tw-bg-opacity: 1;background-color:rgb(29 32 43 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.p-0{padding:0}.p-0\\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-\\[3px\\]{padding:3px}.p-\\[5px\\]{padding:5px}.p-\\[var\\(--item-padding\\)\\]{padding:var(--item-padding)}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-\\[18px\\]{padding-left:18px;padding-right:18px}.px-\\[2px\\]{padding-left:2px;padding-right:2px}.px-\\[30px\\]{padding-left:30px;padding-right:30px}.px-\\[3px\\]{padding-left:3px;padding-right:3px}.py-0{padding-top:0;padding-bottom:0}.py-0\\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-\\[13px\\]{padding-top:13px;padding-bottom:13px}.py-\\[3px\\]{padding-top:3px;padding-bottom:3px}.py-\\[5px\\]{padding-top:5px;padding-bottom:5px}.pl-0\\.5{padding-left:.125rem}.pl-6{padding-left:1.5rem}.pr-1\\.5{padding-right:.375rem}.pr-\\[5px\\]{padding-right:5px}.text-center{text-align:center}.text-right{text-align:right}.text-start{text-align:start}.font-\\[-apple-system\\,BlinkMacSystemFont\\,\\"Segoe_UI\\"\\,\\"Roboto\\"\\,\\"Oxygen\\"\\,\\"Ubuntu\\"\\,\\"Cantarell\\"\\,\\"Fira_Sans\\"\\,\\"Droid_Sans\\"\\,\\"Helvetica_Neue\\"\\,sans-serif\\]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.font-\\[inherit\\]{font-family:inherit}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\\[13px\\]{font-size:13px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.\\!leading-\\[1\\.3\\]{line-height:1.3!important}.leading-5{line-height:1.25rem}.leading-\\[1\\.4em\\]{line-height:1.4em}.leading-\\[1\\.6em\\]{line-height:1.6em}.leading-\\[1em\\]{line-height:1em}.leading-\\[22px\\]{line-height:22px}.leading-\\[50px\\]{line-height:50px}.leading-relaxed{line-height:1.625}.-tracking-widest{letter-spacing:-.1em}.tracking-\\[0\\.02em\\]{letter-spacing:.02em}.\\!text-white{--tw-text-opacity: 1 !important;color:rgb(255 255 255 / var(--tw-text-opacity, 1))!important}.text-\\[\\#656b7c\\]{--tw-text-opacity: 1;color:rgb(101 107 124 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-dark{--tw-text-opacity: 1;color:rgb(29 32 43 / var(--tw-text-opacity, 1))}.text-gray-text{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.text-icon-active-text{--tw-text-opacity: 1;color:rgb(56 138 229 / var(--tw-text-opacity, 1))}.text-inherit{color:inherit}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-text-primary{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-text-secondary{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.text-tooltip-font{--tw-text-opacity: 1;color:rgb(205 209 224 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-current{accent-color:currentColor}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_11px_17px_0_rgba\\(23\\,32\\,61\\,0\\.13\\)\\]{--tw-shadow: 0 11px 17px 0 rgba(23,32,61,.13);--tw-shadow-colored: 0 11px 17px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_1px_1px_0_rgba\\(18\\,49\\,35\\,0\\.05\\)\\]{--tw-shadow: 0 1px 1px 0 rgba(18,49,35,.05);--tw-shadow-colored: 0 1px 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_2px_1px_0_rgba\\(16\\,19\\,29\\,0\\)\\]{--tw-shadow: 0 2px 1px 0 rgba(16,19,29,0);--tw-shadow-colored: 0 2px 1px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_3px_15px_-3px_theme\\(colors\\.popover-shadow\\)\\]{--tw-shadow: 0 3px 15px -3px rgba(13, 20, 33, .1);--tw-shadow-colored: 0 3px 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-tooltip{--tw-shadow: 0 8px 12px 0 rgba(29, 32, 43, .17), 0 4px 5px -3px rgba(5, 6, 12, .49);--tw-shadow-colored: 0 8px 12px 0 var(--tw-shadow-color), 0 4px 5px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-100{transition-duration:.1s}.duration-150{transition-duration:.15s}.duration-\\[120ms\\]{transition-duration:.12s}.duration-\\[250ms\\]{transition-duration:.25s}.duration-\\[50ms\\,70ms\\]{transition-duration:50ms,70ms}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.will-change-\\[opacity\\,left\\,top\\]{will-change:opacity,left,top}.will-change-\\[opacity\\,top\\,left\\]{will-change:opacity,top,left}.will-change-\\[opacity\\,top\\]{will-change:opacity,top}.will-change-\\[opacity\\]{will-change:opacity}.\\[direction\\:rtl\\]{direction:rtl}[data-blok-navigation-focused=true]{margin-left:auto;margin-right:auto;width:650px;max-width:100%;border-radius:.375rem;background-color:#22baff14}@media(hover:hover){[data-blok-item-name=delete]:hover{--tw-text-opacity: 1;color:rgb(226 74 74 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}}.placeholder\\:font-medium::-moz-placeholder{font-weight:500}.placeholder\\:font-medium::placeholder{font-weight:500}.placeholder\\:text-\\[\\#656b7c\\]::-moz-placeholder{--tw-text-opacity: 1;color:rgb(101 107 124 / var(--tw-text-opacity, 1))}.placeholder\\:text-\\[\\#656b7c\\]::placeholder{--tw-text-opacity: 1;color:rgb(101 107 124 / var(--tw-text-opacity, 1))}.placeholder\\:text-gray-text::-moz-placeholder{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.placeholder\\:text-gray-text::placeholder{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.before\\:absolute:before{content:var(--tw-content);position:absolute}.before\\:inset-0:before{content:var(--tw-content);inset:0}.before\\:left-0:before{content:var(--tw-content);left:0}.before\\:left-\\[9px\\]:before{content:var(--tw-content);left:9px}.before\\:top-0:before{content:var(--tw-content);top:0}.before\\:top-\\[5px\\]:before{content:var(--tw-content);top:5px}.before\\:-z-10:before{content:var(--tw-content);z-index:-10}.before\\:m-\\[3px\\]:before{content:var(--tw-content);margin:3px}.before\\:block:before{content:var(--tw-content);display:block}.before\\:h-3:before{content:var(--tw-content);height:.75rem}.before\\:h-\\[calc\\(100\\%-6px\\)\\]:before{content:var(--tw-content);height:calc(100% - 6px)}.before\\:w-0\\.5:before{content:var(--tw-content);width:.125rem}.before\\:w-\\[3px\\]:before{content:var(--tw-content);width:3px}.before\\:rotate-\\[-45deg\\]:before{content:var(--tw-content);--tw-rotate: -45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.before\\:rounded-\\[5px\\]:before{content:var(--tw-content);border-radius:5px}.before\\:rounded-lg:before{content:var(--tw-content);border-radius:.5rem}.before\\:\\!bg-\\[\\#41ffb1\\]:before{content:var(--tw-content);--tw-bg-opacity: 1 !important;background-color:rgb(65 255 177 / var(--tw-bg-opacity, 1))!important}.before\\:\\!bg-\\[\\#fb5d5d\\]:before{content:var(--tw-content);--tw-bg-opacity: 1 !important;background-color:rgb(251 93 93 / var(--tw-bg-opacity, 1))!important}.before\\:bg-\\[\\#575d67\\]:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(87 93 103 / var(--tw-bg-opacity, 1))}.before\\:bg-tooltip-bg:before{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(29 32 43 / var(--tw-bg-opacity, 1))}.before\\:bg-transparent:before{content:var(--tw-content);background-color:transparent}.before\\:content-\\[\\"\\"\\]:before{--tw-content: "";content:var(--tw-content)}.before\\:content-\\[\\\\\\'\\\\\\'\\]:before{--tw-content: \\'\\';content:var(--tw-content)}.after\\:absolute:after{content:var(--tw-content);position:absolute}.after\\:left-\\[9px\\]:after{content:var(--tw-content);left:9px}.after\\:top-\\[5px\\]:after{content:var(--tw-content);top:5px}.after\\:mx-3:after{content:var(--tw-content);margin-left:.75rem;margin-right:.75rem}.after\\:h-3:after{content:var(--tw-content);height:.75rem}.after\\:w-0\\.5:after{content:var(--tw-content);width:.125rem}.after\\:rotate-45:after{content:var(--tw-content);--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.after\\:bg-\\[\\#575d67\\]:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(87 93 103 / var(--tw-bg-opacity, 1))}.after\\:text-\\[\\#ddd\\]:after{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(221 221 221 / var(--tw-text-opacity, 1))}.after\\:content-\\[\\"\\"\\]:after{--tw-content: "";content:var(--tw-content)}.after\\:content-\\[\\'\\|\\'\\]:after{--tw-content: "|";content:var(--tw-content)}.first\\:mt-0:first-child{margin-top:0}.last\\:ml-2\\.5:last-child{margin-left:.625rem}.empty\\:before\\:pointer-events-none:empty:before{content:var(--tw-content);pointer-events:none}.empty\\:before\\:cursor-text:empty:before{content:var(--tw-content);cursor:text}.empty\\:before\\:text-gray-text:empty:before{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.empty\\:before\\:content-\\[attr\\(data-blok-placeholder\\)\\]:empty:before{--tw-content: attr(data-blok-placeholder);content:var(--tw-content)}.empty\\:before\\:content-\\[attr\\(data-placeholder\\)\\]:empty:before{--tw-content: attr(data-placeholder);content:var(--tw-content)}.empty\\:before\\:content-\\[attr\\(data-placeholder-active\\)\\]:empty:before{--tw-content: attr(data-placeholder-active);content:var(--tw-content)}.hover\\:bg-\\[\\#2db583\\]:hover{--tw-bg-opacity: 1;background-color:rgb(45 181 131 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#e0e4eb\\]:hover{--tw-bg-opacity: 1;background-color:rgb(224 228 235 / var(--tw-bg-opacity, 1))}.hover\\:bg-\\[\\#e9ecee\\]:hover{--tw-bg-opacity: 1;background-color:rgb(233 236 238 / var(--tw-bg-opacity, 1))}.hover\\:opacity-100:hover{opacity:1}.focus\\:placeholder\\:text-\\[rgba\\(101\\,107\\,124\\,0\\.3\\)\\]:focus::-moz-placeholder{color:#656b7c4d}.focus\\:placeholder\\:text-\\[rgba\\(101\\,107\\,124\\,0\\.3\\)\\]:focus::placeholder{color:#656b7c4d}.active\\:cursor-grabbing:active{cursor:grabbing}.group[data-blok-dragging=true] .group-data-\\[blok-dragging\\=true\\]\\:pointer-events-none{pointer-events:none}.group[data-blok-rtl=true] .group-data-\\[blok-rtl\\=true\\]\\:left-\\[calc\\(-1\\*theme\\(width\\.toolbox-btn\\)\\)\\]{left:-26px}.group[data-blok-rtl=true] .group-data-\\[blok-rtl\\=true\\]\\:left-auto{left:auto}.group[data-blok-rtl=true] .group-data-\\[blok-rtl\\=true\\]\\:right-\\[calc\\(-1\\*theme\\(width\\.toolbox-btn\\)\\)\\]{right:-26px}.group[data-blok-rtl=true] .group-data-\\[blok-rtl\\=true\\]\\:right-auto{right:auto}.group[data-blok-dragging=true] .group-data-\\[blok-dragging\\=true\\]\\:cursor-grabbing{cursor:grabbing}@media(max-width:650px){.mobile\\:absolute{position:absolute}.mobile\\:right-auto{right:auto}.mobile\\:z-\\[2\\]{z-index:2}.mobile\\:hidden{display:none}.mobile\\:h-toolbox-btn-mobile{height:36px}.mobile\\:w-toolbox-btn-mobile{width:36px}.mobile\\:rounded-\\[6px\\]{border-radius:6px}.mobile\\:border{border-width:1px}.mobile\\:border-\\[\\#e8e8eb\\]{--tw-border-opacity: 1;border-color:rgb(232 232 235 / var(--tw-border-opacity, 1))}.mobile\\:bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.mobile\\:p-1{padding:.25rem}.mobile\\:text-\\[15px\\]{font-size:15px}.mobile\\:font-medium{font-weight:500}.mobile\\:shadow-overlay-pane{--tw-shadow: 0 3px 15px -3px rgba(13, 20, 33, .13);--tw-shadow-colored: 0 3px 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group[data-blok-rtl=true] .mobile\\:group-data-\\[blok-rtl\\=true\\]\\:ml-0{margin-left:0}.group[data-blok-rtl=true] .mobile\\:group-data-\\[blok-rtl\\=true\\]\\:mr-auto{margin-right:auto}.group[data-blok-rtl=true] .mobile\\:group-data-\\[blok-rtl\\=true\\]\\:pl-\\[10px\\]{padding-left:10px}.group[data-blok-rtl=true] .mobile\\:group-data-\\[blok-rtl\\=true\\]\\:pr-0{padding-right:0}}@media(min-width:651px){.not-mobile\\:w-6{width:1.5rem}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:left-0{left:0}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:left-\\[-5px\\]{left:-5px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:left-\\[calc\\(-1\\*theme\\(spacing\\.narrow-mode-right-padding\\)-5px\\)\\]{left:-55px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:right-\\[5px\\]{right:5px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:right-auto{right:auto}.group[data-blok-narrow=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:left-\\[5px\\]{left:5px}.group[data-blok-narrow=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:right-\\[calc\\(-1\\*theme\\(spacing\\.narrow-mode-right-padding\\)-5px\\)\\]{right:-55px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:ml-\\[theme\\(spacing\\.narrow-mode-right-padding\\)\\]{margin-left:50px}.group[data-blok-narrow=true][data-blok-rtl=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:group-data-\\[blok-rtl\\=true\\]\\:mr-0{margin-right:0}.group[data-blok-narrow=true] .not-mobile\\:group-data-\\[blok-narrow\\=true\\]\\:mr-\\[theme\\(spacing\\.narrow-mode-right-padding\\)\\]{margin-right:50px}}@media(hover:hover){.can-hover\\:hover\\:cursor-grab:hover{cursor:grab}.can-hover\\:hover\\:cursor-pointer:hover{cursor:pointer}.can-hover\\:hover\\:bg-bg-light:hover{--tw-bg-opacity: 1;background-color:rgb(239 242 245 / var(--tw-bg-opacity, 1))}.can-hover\\:hover\\:bg-item-hover-bg:hover{--tw-bg-opacity: 1;background-color:rgb(248 248 248 / var(--tw-bg-opacity, 1))}.group[data-blok-toolbox-opened=true] .group-data-\\[blok-toolbox-opened\\=true\\]\\:can-hover\\:hover\\:cursor-pointer:hover{cursor:pointer}}.\\[\\&\\>p\\:first-of-type\\]\\:mt-0>p:first-of-type{margin-top:0}.\\[\\&\\>p\\:last-of-type\\]\\:mb-0>p:last-of-type{margin-bottom:0}.\\[\\&\\[data-blok-dragging\\=true\\]\\]\\:cursor-grabbing[data-blok-dragging=true]{cursor:grabbing}.\\[\\&\\[data-blok-empty\\=true\\]\\]\\:before\\:pointer-events-none[data-blok-empty=true]:before{content:var(--tw-content);pointer-events:none}.\\[\\&\\[data-blok-empty\\=true\\]\\]\\:before\\:cursor-text[data-blok-empty=true]:before{content:var(--tw-content);cursor:text}.\\[\\&\\[data-blok-empty\\=true\\]\\]\\:before\\:text-gray-text[data-blok-empty=true]:before{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.\\[\\&\\[data-blok-empty\\=true\\]\\]\\:before\\:content-\\[attr\\(data-blok-placeholder\\)\\][data-blok-empty=true]:before{--tw-content: attr(data-blok-placeholder);content:var(--tw-content)}.\\[\\&\\[data-blok-empty\\=true\\]\\]\\:before\\:content-\\[attr\\(data-placeholder\\)\\][data-blok-empty=true]:before{--tw-content: attr(data-placeholder);content:var(--tw-content)}.\\[\\&\\[data-blok-focused\\=\\"true\\"\\]\\]\\:bg-item-focus-bg[data-blok-focused=true]{background-color:#22baff14}.\\[\\&\\[data-blok-force-hover\\]\\]\\:cursor-pointer[data-blok-force-hover]{cursor:pointer}.\\[\\&\\[data-blok-force-hover\\]\\]\\:bg-item-hover-bg[data-blok-force-hover]{--tw-bg-opacity: 1;background-color:rgb(248 248 248 / var(--tw-bg-opacity, 1))}.\\[\\&\\[data-blok-popover-item-no-hover\\]\\]\\:cursor-default[data-blok-popover-item-no-hover]{cursor:default}.\\[\\&\\[data-blok-popover-item-no-hover\\]\\]\\:hover\\:bg-transparent:hover[data-blok-popover-item-no-hover]{background-color:transparent}.\\[\\&\\[data-blok-toolbox-opened\\=true\\]_\\[contentEditable\\=true\\]\\[data-blok-placeholder\\]\\:focus\\]\\:before\\:\\!opacity-0[data-blok-toolbox-opened=true] [contentEditable=true][data-blok-placeholder]:focus:before{content:var(--tw-content);opacity:0!important}.\\[\\&\\[data-empty\\=true\\]\\]\\:before\\:pointer-events-none[data-empty=true]:before{content:var(--tw-content);pointer-events:none}.\\[\\&\\[data-empty\\=true\\]\\]\\:before\\:cursor-text[data-empty=true]:before{content:var(--tw-content);cursor:text}.\\[\\&\\[data-empty\\=true\\]\\]\\:before\\:text-gray-text[data-empty=true]:before{content:var(--tw-content);--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}.\\[\\&\\[data-empty\\=true\\]\\]\\:before\\:content-\\[attr\\(data-placeholder-active\\)\\][data-empty=true]:before{--tw-content: attr(data-placeholder-active);content:var(--tw-content)}.\\[\\&_\\:\\:selection\\]\\:bg-selection-inline ::-moz-selection{--tw-bg-opacity: 1;background-color:rgb(212 236 255 / var(--tw-bg-opacity, 1))}.\\[\\&_\\:\\:selection\\]\\:bg-selection-inline ::selection{--tw-bg-opacity: 1;background-color:rgb(212 236 255 / var(--tw-bg-opacity, 1))}.\\[\\&_\\[contenteditable\\]\\:empty\\]\\:after\\:content-\\[\\"\\\\\\\\feff_\\"\\] [contenteditable]:empty:after{--tw-content: "\\\\feff ";content:var(--tw-content)}.\\[\\&_\\[contenteditable\\]\\]\\:select-none [contenteditable]{-webkit-user-select:none;-moz-user-select:none;user-select:none}.\\[\\&_\\[data-blok-tool\\=stub\\]\\]\\:opacity-55 [data-blok-tool=stub]{opacity:.55}.\\[\\&_\\[hidden\\]\\]\\:\\!hidden [hidden]{display:none!important}.\\[\\&_a\\]\\:cursor-pointer a{cursor:pointer}.\\[\\&_a\\]\\:text-link a{--tw-text-opacity: 1;color:rgb(56 138 229 / var(--tw-text-opacity, 1))}.\\[\\&_a\\]\\:underline a{text-decoration-line:underline}.\\[\\&_b\\]\\:font-bold b{font-weight:700}.\\[\\&_div\\]\\:\\!m-0 div{margin:0!important}.\\[\\&_div\\]\\:\\!p-0 div{padding:0!important}.\\[\\&_i\\]\\:italic i{font-style:italic}.\\[\\&_img\\]\\:opacity-55 img{opacity:.55}.\\[\\&_p\\]\\:\\!m-0 p{margin:0!important}.\\[\\&_p\\]\\:\\!p-0 p{padding:0!important}.\\[\\&_path\\]\\:stroke-current path{stroke:currentColor}.\\[\\&_svg\\]\\:block svg{display:block}.\\[\\&_svg\\]\\:size-icon svg{width:20px;height:20px}.\\[\\&_svg\\]\\:h-6 svg{height:1.5rem}.\\[\\&_svg\\]\\:h-7 svg{height:1.75rem}.\\[\\&_svg\\]\\:h-icon svg{height:20px}.\\[\\&_svg\\]\\:max-h-full svg{max-height:100%}.\\[\\&_svg\\]\\:w-6 svg{width:1.5rem}.\\[\\&_svg\\]\\:w-7 svg{width:1.75rem}.\\[\\&_svg\\]\\:w-icon svg{width:20px}.\\[\\&_svg\\]\\:text-gray-text svg{--tw-text-opacity: 1;color:rgb(112 118 132 / var(--tw-text-opacity, 1))}@media(max-width:650px){.mobile\\:\\[\\&_svg\\]\\:h-icon-mobile svg{height:28px}.mobile\\:\\[\\&_svg\\]\\:w-icon-mobile svg{width:28px}}`;class Gv extends K{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=jd(()=>{this.windowResize()},200),this.selectionChangeDebounced=jd(()=>{this.selectionChanged()},Xg),this.documentTouchedListener=e=>{this.documentTouched(e)}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;const e=this.nodes.wrapper.querySelector('[data-blok-testid="block-content"]');return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){if(e){this.unbindReadOnlySensitiveListeners();return}const t=()=>{this.bindReadOnlySensitiveListeners()};t();const o=window.requestIdleCallback;typeof o=="function"&&o(t,{timeout:2e3})}checkEmptiness(){const{BlockManager:e}=this.Blok;this.nodes.wrapper.setAttribute(vm,e.isBlokEmpty?"true":"false")}get someToolbarOpened(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Blok;return!!(t.opened||o.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Blok.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Blok).filter(([e,t])=>t.flipper instanceof at).some(([e,t])=>t.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Blok;t.close(),o.close(),e.toolbox.close()}setIsMobile(){const e=window.innerWidth<Wd;e!==this.isMobile&&this.eventsDispatcher.emit(to,{isEnabled:this.isMobile}),this.isMobile=e}make(){const e=this.config.holder;if(!e)throw new Error("Blok holder is not specified in the configuration.");this.nodes.holder=v.getHolder(e),this.nodes.wrapper=v.make("div",["group","relative","box-border","z-[1]","[&[data-blok-dragging=true]]:cursor-grabbing","[&_svg]:max-h-full","[&_path]:stroke-current","[&_::selection]:bg-selection-inline","[&[data-blok-toolbox-opened=true]_[contentEditable=true][data-blok-placeholder]:focus]:before:!opacity-0",...this.isRtl?["[direction:rtl]"]:[]]),this.nodes.wrapper.setAttribute(_t,Jg),this.nodes.wrapper.setAttribute(om,""),this.nodes.wrapper.setAttribute("data-blok-testid","blok-editor"),this.isRtl&&this.nodes.wrapper.setAttribute(sm,"true"),this.nodes.redactor=v.make("div",["not-mobile:group-data-[blok-narrow=true]:mr-[theme(spacing.narrow-mode-right-padding)]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:ml-[theme(spacing.narrow-mode-right-padding)]","not-mobile:group-data-[blok-narrow=true]:group-data-[blok-rtl=true]:mr-0",'[&_[contenteditable]:empty]:after:content-["\\feff_"]']),this.nodes.redactor.setAttribute(nm,""),this.nodes.redactor.setAttribute("data-blok-testid","redactor"),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.setAttribute(rm,"true"),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){const e="blok-styles";if(v.get(e))return;const t=v.make("style",null,{id:e,textContent:Wv.toString()});this.config.style&&!ae(this.config.style)&&this.config.style.nonce&&t.setAttribute("nonce",this.config.style.nonce),v.prepend(document.head,t)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{e instanceof MouseEvent&&this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{e instanceof KeyboardEvent&&this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{e instanceof MouseEvent&&this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){const e={lastHovered:null},o=ci(n=>{var c;const r=typeof MouseEvent!="undefined"&&n instanceof MouseEvent,i=typeof TouchEvent!="undefined"&&n instanceof TouchEvent;if(!r&&!i)return;const a=(c=n.target)==null?void 0:c.closest('[data-blok-testid="block-wrapper"]');if(!a||e.lastHovered===a)return;e.lastHovered=a;const l=this.Blok.BlockManager.getBlockByChildNode(a);l&&this.eventsDispatcher.emit(Fu,{block:l})},20);this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",n=>{o(n)},{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){var o;switch((o=e.key)!=null?o:""){case"Enter":this.enterPressed(e);break;case"Backspace":case"Delete":this.backspacePressed(e);break;case"Escape":this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){const{currentBlock:t}=this.Blok.BlockManager,o=e.target,n=o instanceof HTMLElement,r=n?o.closest('[data-blok-testid="blok-editor"]'):null,i=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(!(n&&this.Blok.BlockSettings.contains(o))&&(this.Blok.BlockSelection.navigationModeEnabled&&!e.defaultPrevented&&this.Blok.BlockEvents.keydown(e),!this.Blok.BlockSelection.navigationModeEnabled)){if(t!==void 0&&r===null){this.Blok.BlockEvents.keydown(e);return}r||t&&i||(this.Blok.BlockManager.unsetCurrentBlock(),this.Blok.Toolbar.close())}}backspacePressed(e){if(this.Blok.BlockSettings.contains(e.target))return;const{BlockManager:t,BlockSelection:o,Caret:n}=this.Blok,r=R.isSelectionExists,i=R.isCollapsed;if(!(o.anyBlockSelected&&(!r||i===!0||this.Blok.CrossBlockSelection.isCrossBlockSelectionStarted)))return;const l=t.removeSelectedBlocks();if(l===void 0)return;const c=t.insertDefaultBlockAtIndex(l,!0);n.setToBlock(c,n.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}escapePressed(e){if(this.Blok.BlockSelection.navigationModeEnabled){this.Blok.BlockSelection.disableNavigationMode(!1);return}if(this.Blok.BlockSelection.anyBlockSelected){this.Blok.BlockSelection.clearSelection(e);return}if(this.Blok.Toolbar.toolbox.opened){this.Blok.Toolbar.toolbox.close(),this.Blok.BlockManager.currentBlock&&this.Blok.Caret.setToBlock(this.Blok.BlockManager.currentBlock,this.Blok.Caret.positions.END);return}if(this.Blok.BlockSettings.opened){this.Blok.BlockSettings.close();return}if(this.Blok.InlineToolbar.opened){this.Blok.InlineToolbar.close();return}const t=e.target,n=t instanceof HTMLElement&&this.nodes.redactor.contains(t),r=this.Blok.BlockManager.currentBlock!==void 0;if(n&&r){e.preventDefault(),this.Blok.Toolbar.close(),this.Blok.BlockSelection.enableNavigationMode();return}this.Blok.Toolbar.close()}enterPressed(e){const{BlockManager:t,BlockSelection:o,BlockEvents:n}=this.Blok;if(this.someToolbarOpened)return;if(o.navigationModeEnabled){n.keydown(e);return}const r=t.currentBlockIndex>=0,i=R.isSelectionExists,a=R.isCollapsed;if(o.anyBlockSelected&&(!i||a===!0)){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&r&&e.target.tagName==="BODY"){const l=this.Blok.BlockManager.insert();e.preventDefault(),this.Blok.Caret.setToBlock(l),this.Blok.Toolbar.moveAndOpen(l)}this.Blok.BlockSelection.clearSelection(e)}documentClicked(e){var f,g;if(!e.isTrusted)return;const t=e.target,o=this.nodes.holder.contains(t)||R.isAtBlok,n=this.nodes.redactor.contains(t),r=this.Blok.Toolbar.contains(t),i=this.Blok.InlineToolbar.containsNode(t),a=o||r,l=this.Blok.BlockSettings.contains(t),c=(f=this.Blok.Toolbar.nodes.settingsToggler)==null?void 0:f.contains(t),d=(g=this.Blok.Toolbar.nodes.plusButton)==null?void 0:g.contains(t),u=l||c||d;(!a||!n&&!r)&&!u&&(this.Blok.BlockManager.unsetCurrentBlock(),this.Blok.Toolbar.close());const p=this.Blok.BlockSettings.opened&&!u;if(p&&this.Blok.BlockSettings.close(),p&&n){const b=this.Blok.BlockManager.getBlockByChildNode(t);this.Blok.Toolbar.moveAndOpen(b)}u||this.Blok.BlockSelection.clearSelection(e),this.Blok.InlineToolbar.opened&&!i&&this.Blok.InlineToolbar.close()}documentTouched(e){const t=e.target,o=(()=>{if(t!==this.nodes.redactor)return t;if(e instanceof MouseEvent){const n=document.elementFromPoint(e.clientX,e.clientY);return n!=null?n:t}if(e instanceof TouchEvent&&e.touches.length>0){const{clientX:n,clientY:r}=e.touches[0],i=document.elementFromPoint(n,r);return i!=null?i:t}return t})();try{this.Blok.BlockManager.setCurrentBlockByChildNode(o)}catch(n){this.Blok.RectangleSelection.isRectActivated()||this.Blok.Caret.setToTheLastBlock()}!this.Blok.ReadOnly.isEnabled&&!this.Blok.Toolbar.contains(t)&&this.Blok.Toolbar.moveAndOpen()}redactorClicked(e){if(!R.isCollapsed)return;const t=e.target,o=e.metaKey||e.ctrlKey;if(!(v.isAnchor(t)&&o)){this.processBottomZoneClick(e);return}e.stopImmediatePropagation(),e.stopPropagation();const r=t.getAttribute("href");if(!r)return;const i=ig(r);lg(i)}processBottomZoneClick(e){var d,u;const t=this.Blok.BlockManager.getBlockByIndex(-1),o=v.offset(t.holder).bottom,n=e.pageY,{BlockSelection:r}=this.Blok;if(!(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!r.anyBlockSelected&&o<n))return;e.stopImmediatePropagation(),e.stopPropagation();const{BlockManager:a,Caret:l,Toolbar:c}=this.Blok;(!((d=a.lastBlock)!=null&&d.tool.isDefault)||!((u=a.lastBlock)!=null&&u.isEmpty))&&a.insertAtEnd(),l.setToTheLastBlock(),c.moveAndOpen(a.lastBlock)}selectionChanged(){var c,d,u;const{CrossBlockSelection:e,BlockSelection:t}=this.Blok,o=R.anchorElement;if(e.isCrossBlockSelectionStarted&&t.anyBlockSelected&&((c=R.get())==null||c.removeAllRanges()),document.querySelector('[data-blok-fake-background="true"]')!==null&&((u=(d=this.Blok)==null?void 0:d.InlineToolbar)!=null&&u.opened)||(!o&&!R.range&&this.Blok.InlineToolbar.close(),!o))return;const r=o.closest('[data-blok-testid="block-content"]'),i=r===null||r.closest('[data-blok-testid="blok-editor"]')!==this.nodes.wrapper,a=o.getAttribute("data-blok-inline-toolbar")==="true";i&&!this.Blok.InlineToolbar.containsNode(o)&&this.Blok.InlineToolbar.close(),!(i&&!a)&&(this.Blok.BlockManager.currentBlock||this.Blok.BlockManager.setCurrentBlockByChildNode(o),this.Blok.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){const e=t=>{const o=t.target;Gd(o)};this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}}const $v=30,Vv=200,Yv=100,Et=class Et extends K{constructor(){super(...arguments),this.undoStack=[],this.redoStack=[],this.registeredShortcuts=[],this.debounceTimeout=null,this.isPerformingUndoRedo=!1,this.initialStateCaptured=!1}get maxHistoryLength(){var e;return(e=this.config.maxHistoryLength)!=null?e:$v}get debounceTime(){var e;return(e=this.config.historyDebounceTime)!=null?e:Vv}get globalUndoRedo(){var e;return(e=this.config.globalUndoRedo)!=null?e:!0}async prepare(){this.setupEventListeners(),this.setupKeyboardShortcuts()}async captureInitialState(){if(this.initialStateCaptured)return;const e=await this.getCurrentState();if(e){const t=this.getCaretPosition();this.undoStack=[{state:e,timestamp:Date.now(),caretPosition:t}],this.initialStateCaptured=!0,this.emitStateChanged()}}async undo(){if(this.undoStack.length<2)return this.preserveCaretPosition(),!1;if(this.isPerformingUndoRedo)return!1;this.isPerformingUndoRedo=!0,this.clearDebounce();try{const e=this.undoStack.pop();e&&this.redoStack.push(e);const t=this.undoStack[this.undoStack.length-1];if(t){const o=e!=null&&e.caretPosition?Math.max(0,e.caretPosition.blockIndex-1):void 0,n=t.caretPosition||e==null?void 0:e.caretPosition;return await this.restoreState(t.state,t.caretPosition,o,n),this.emitStateChanged(),await this.cooldown(),!0}return!1}finally{this.isPerformingUndoRedo=!1}}async redo(){if(this.redoStack.length===0||this.isPerformingUndoRedo)return!1;this.isPerformingUndoRedo=!0,this.clearDebounce();try{const e=this.undoStack[this.undoStack.length-1],t=this.redoStack.pop();if(t){this.undoStack.push(t);const o=e!=null&&e.caretPosition?Math.max(0,e.caretPosition.blockIndex-1):void 0;return await this.restoreState(t.state,t.caretPosition,o),this.emitStateChanged(),await this.cooldown(),!0}return!1}finally{this.isPerformingUndoRedo=!1}}canUndo(){return this.undoStack.length>1}canRedo(){return this.redoStack.length>0}clear(){this.clearDebounce(),this.undoStack=[],this.redoStack=[],this.initialStateCaptured=!1,this.emitStateChanged()}setupEventListeners(){this.eventsDispatcher.on(eo,e=>{this.handleBlockMutation(e.event)})}setupKeyboardShortcuts(){setTimeout(()=>{var n,r;const e=(r=(n=this.Blok.UI)==null?void 0:n.nodes)==null?void 0:r.redactor;if(!e)return;const t=this.globalUndoRedo?document:e;["CMD+Z","CMD+SHIFT+Z","CMD+Y"].forEach(i=>je.remove(t,i)),je.add({name:"CMD+Z",on:t,handler:i=>{this.shouldHandleShortcut(i)&&(i.preventDefault(),this.undo())}}),this.registeredShortcuts.push({name:"CMD+Z",element:t}),je.add({name:"CMD+SHIFT+Z",on:t,handler:i=>{this.shouldHandleShortcut(i)&&(i.preventDefault(),this.redo())}}),this.registeredShortcuts.push({name:"CMD+SHIFT+Z",element:t}),je.add({name:"CMD+Y",on:t,handler:i=>{this.shouldHandleShortcut(i)&&(i.preventDefault(),this.redo())}}),this.registeredShortcuts.push({name:"CMD+Y",element:t})},0)}shouldHandleShortcut(e){return!(this.globalUndoRedo&&Et.activeInstance!==this||this.isNativeFormControl(e.target))}isNativeFormControl(e){var o,n;if(!(e instanceof HTMLElement))return!1;const t=(n=(o=this.Blok.UI)==null?void 0:o.nodes)==null?void 0:n.wrapper;return t!=null&&t.contains(e)?!1:!!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e.isContentEditable)}handleBlockMutation(e){if(Et.activeInstance=this,!this.isPerformingUndoRedo){if(!this.initialStateCaptured){this.captureInitialState();return}this.clearDebounce(),this.debounceTimeout=setTimeout(()=>{this.recordState()},this.debounceTime)}}async recordState(){if(this.isPerformingUndoRedo)return;const e=await this.getCurrentState();if(!e)return;const t=this.getCaretPosition();for(this.redoStack=[],this.undoStack.push({state:e,timestamp:Date.now(),caretPosition:t});this.undoStack.length>this.maxHistoryLength;)this.undoStack.shift();this.emitStateChanged()}async getCurrentState(){try{const{BlockManager:e}=this.Blok,t=e.blocks;if(t.length===1&&t[0].isEmpty)return{time:Date.now(),blocks:[],version:""};const o=t.map(async i=>{const a=await i.save();return!a||a.data===void 0||!await i.validate(a.data)?null:q({id:a.id,type:a.tool,data:a.data},a.tunes&&Object.keys(a.tunes).length>0&&{tunes:a.tunes})}),r=(await Promise.all(o)).filter(i=>i!==null);return{time:Date.now(),blocks:r,version:""}}catch(e){return null}}async restoreState(e,t,o,n){this.Blok.ModificationsObserver.disable();try{await this.applyStateDiff(e)}finally{this.Blok.ModificationsObserver.enable()}this.restoreCaretPosition(t,o,n)}async applyStateDiff(e){const{BlockManager:t,Renderer:o}=this.Blok,n=t.blocks,r=e.blocks,i=new Map;n.forEach((p,f)=>{i.set(p.id,{block:p,index:f})});const a=new Map;r.forEach((p,f)=>{p.id&&a.set(p.id,{data:p,index:f})});const l=[];for(const p of n)a.has(p.id)||l.push(p);const c=[];for(const[p,{data:f,index:g}]of a)i.has(p)||c.push({data:f,index:g});const d=[];for(const[p,{data:f,index:g}]of a){const b=i.get(p);b&&d.push({block:b.block,data:f,targetIndex:g})}const u=l.length+c.length;if(u>n.length/2||u>5||n.length===0){await t.clear(),await o.render(r);return}for(const p of l)await t.removeBlock(p);for(const{block:p,data:f}of d){const g=await p.data;if(!(JSON.stringify(g)!==JSON.stringify(f.data)))continue;await p.setData(f.data)||await t.update(p,f.data,f.tunes)}for(const{data:p,index:f}of c)t.insert({id:p.id,tool:p.type,data:p.data,index:f,needToFocus:!1});await this.reorderBlocks(r)}async reorderBlocks(e){const{BlockManager:t}=this.Blok,o=new Map;e.forEach((i,a)=>{i.id&&o.set(i.id,a)}),t.blocks.some((i,a)=>{const l=o.get(i.id);return l!==void 0&&l!==a})&&e.forEach((i,a)=>{const l=i.id;if(!l)return;const c=t.blocks.findIndex(d=>d.id===l);c!==-1&&c!==a&&t.move(a,c)})}cooldown(){return new Promise(e=>setTimeout(e,Yv))}getCaretPosition(){const{BlockManager:e}=this.Blok,t=e.currentBlock;if(!t)return;const o=t.currentInput;if(!o)return;const n=t.inputs.indexOf(o),r=this.getCaretOffset(o),i=e.currentBlockIndex;return{blockId:t.id,blockIndex:i>=0?i:0,inputIndex:n>=0?n:0,offset:r}}getCaretOffset(e){var n;const t=window.getSelection();if(!t||t.rangeCount===0)return 0;const o=t.getRangeAt(0);if(!e.contains(o.startContainer))return 0;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return(n=e.selectionStart)!=null?n:0;try{const r=document.createRange();return r.selectNodeContents(e),r.setEnd(o.startContainer,o.startOffset),r.toString().length}catch(r){return 0}}restoreCaretPosition(e,t,o){if(!e&&o){this.focusBlockAtIndexWithInput(o.blockIndex,o.inputIndex,o.offset);return}if(!e&&t!==void 0){this.focusBlockAtIndex(t);return}if(!e){this.focusFirstAvailableBlock();return}const{BlockManager:n}=this.Blok,r=n.getBlockById(e.blockId);if(!r){const i=t!==void 0?t:e.blockIndex;this.focusBlockAtIndex(i);return}r.ready.then(()=>{const i=n.getBlockById(e.blockId);if(!i){const a=t!==void 0?t:e.blockIndex;this.focusBlockAtIndex(a);return}if(i!==r){i.ready.then(()=>{this.setCaretToBlockInput(i,e)});return}this.setCaretToBlockInput(i,e)})}focusFirstAvailableBlock(){const{BlockManager:e,Caret:t}=this.Blok,o=e.firstBlock;o!=null&&o.focusable&&t.setToBlock(o,t.positions.END)}focusBlockAtIndex(e){const{BlockManager:t,Caret:o}=this.Blok,n=t.blocks.length;if(n===0)return;const r=Math.min(e,n-1),i=t.getBlockByIndex(r);if(i!=null&&i.focusable){o.setToBlock(i,o.positions.END);return}const a=t.lastBlock;a!=null&&a.focusable&&o.setToBlock(a,o.positions.END)}focusBlockAtIndexWithInput(e,t,o){const{BlockManager:n,Caret:r}=this.Blok,i=n.blocks.length;if(i===0)return;const a=e>=i,l=Math.min(e,i-1),c=n.getBlockByIndex(l);if(!(c!=null&&c.focusable)){this.focusFirstAvailableBlock();return}if(a){c.ready.then(()=>{r.setToBlock(c,r.positions.END)});return}const d={blockId:c.id,blockIndex:l,inputIndex:t,offset:o};c.ready.then(()=>{this.setCaretToBlockInput(c,d)})}setCaretToBlockInput(e,t){const{BlockManager:o,Caret:n}=this.Blok;requestAnimationFrame(()=>{const r=e.inputs,i=Math.min(t.inputIndex,r.length-1),a=r[i];if(!a){n.setToBlock(e,n.positions.END);return}o.currentBlock=e;try{n.setToInput(a,n.positions.DEFAULT,t.offset)}catch(l){n.setToInput(a,n.positions.END)}})}clearDebounce(){this.debounceTimeout&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=null)}preserveCaretPosition(){const{BlockManager:e,Caret:t}=this.Blok,o=e.currentBlock;if(!(o!=null&&o.focusable))return;const n=o.currentInput;n?n.focus():t.setToBlock(o,t.positions.END)}emitStateChanged(){this.eventsDispatcher.emit(ym,{canUndo:this.canUndo(),canRedo:this.canRedo()})}destroy(){this.clearDebounce();for(const{name:e,element:t}of this.registeredShortcuts)je.remove(t,e);this.registeredShortcuts=[],Et.activeInstance===this&&(Et.activeInstance=null),this.undoStack=[],this.redoStack=[],this.initialStateCaptured=!1}};Et.activeInstance=null;let ka=Et;const Xv={BlocksAPI:Bm,CaretAPI:Cm,EventsAPI:Em,I18nAPI:Ci,API:Sm,InlineToolbarAPI:Am,ListenersAPI:Im,NotifierAPI:Rm,ReadOnlyAPI:Om,SanitizerAPI:Ym,SaverAPI:Xm,SelectionAPI:Zm,ToolsAPI:Jm,StylesAPI:Qm,ToolbarAPI:eb,TooltipAPI:db,UiAPI:ub,HistoryAPI:hb,BlockSettings:qb,Toolbar:Gb,InlineToolbar:$b,BlockEvents:Gi,BlockManager:xv,BlockSelection:Cv,Caret:ua,CrossBlockSelection:Av,ModificationsObserver:Iv,Paste:ha,ReadOnly:Nv,RectangleSelection:Rv,Renderer:Ov,Saver:_v,Tools:Kv,UI:Gv,History:ka};class Zv{constructor(e){this.moduleInstances={},this.eventsDispatcher=new Zt,this.config={},this.isReady=new Promise((t,o)=>{Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();const{BlockManager:n,Caret:r,UI:i,ModificationsObserver:a,History:l}=this.moduleInstances;i.checkEmptiness(),a.enable(),await l.captureInitialState(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&r.setToBlock(n.blocks[0],r.positions.START),t()}).catch(n=>{U(`Blok is not ready because of ${n}`,"error"),o(n)})})}set configuration(e){var l,c,d,u,h,p;Z(e)?this.config=q({},e):this.config={holder:e},this.config.holder==null&&(this.config.holder="blok"),this.config.logLevel==null&&(this.config.logLevel=Pd.VERBOSE),tg(this.config.logLevel),this.config.defaultBlock=(l=this.config.defaultBlock)!=null?l:"paragraph";const t=this.config.tools,o=this.config.defaultBlock,n=t!=null&&Object.prototype.hasOwnProperty.call(t,o!=null?o:""),r=(c=this.config.data)==null?void 0:c.blocks,i=Array.isArray(r)&&r.length>0;if(o&&o!=="paragraph"&&!n&&!i){U(`Default block "${o}" is not configured. Falling back to "paragraph" tool.`,"warn"),this.config.defaultBlock="paragraph";const f=this.config.tools,g=q({},f!=null?f:{}),b=g.paragraph;g.paragraph=this.createParagraphToolConfig(b),this.config.tools=g}this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;const a={type:this.config.defaultBlock,data:{}};this.config.placeholder===void 0&&(this.config.placeholder=!1),this.config.sanitizer=(d=this.config.sanitizer)!=null?d:{},this.config.hideToolbar=(u=this.config.hideToolbar)!=null?u:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(ae(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[a]}),this.config.readOnly=this.config.readOnly||!1,(h=this.config.i18n)!=null&&h.messages&&oe.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((p=this.config.i18n)==null?void 0:p.direction)||"ltr"}get configuration(){return this.config}validate(){const{holder:e}=this.config;if(ze(e)&&!v.get(e))throw Error(`element with ID «${e}» is missing. Pass correct holder's ID.`);if(e&&Z(e)&&!v.isElement(e))throw Error("«holder» value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly","History"].reduce((t,o)=>t.then(async()=>{try{await this.moduleInstances[o].prepare()}catch(n){if(n instanceof Xt)throw new Error(n.message);U(`Module ${o} was skipped because of %o`,"warn",n)}}),Promise.resolve())}render(){const e=this.moduleInstances.Renderer;if(!e)throw new Xt("Renderer module is not initialized");if(!this.config.data)throw new Xt("Blok data is not initialized");return e.render(this.config.data.blocks)}constructModules(){Object.entries(Xv).forEach(([e,t])=>{try{this.moduleInstances[e]=new t({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){U(`[constructModules] Module ${e} skipped because`,"error",o)}})}configureModules(){for(const e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}createParagraphToolConfig(e){if(e===void 0)return{config:{preserveBlank:!0}};if(V(e))return{class:e,config:{preserveBlank:!0}};if(Z(e)){const t=e,o=t.config;return Se(q({},t),{config:Se(q({},Z(o)?o:{}),{preserveBlank:!0})})}return{config:{preserveBlank:!0}}}getModulesDiff(e){const t={};for(const o in this.moduleInstances)o!==e&&(t[o]=this.moduleInstances[o]);return t}}const Ut=class Ut{constructor({data:e,config:t,api:o,readOnly:n}){this.api=o,this.readOnly=n,this._settings=t||{},this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:""}}isHeaderData(e){return typeof e=="object"&&e!==null&&"text"in e}normalizeData(e){if(!this.isHeaderData(e))return{text:"",level:this.defaultLevel.number};const t=parseInt(String(e.level)),o=e.level!==void 0&&!isNaN(t);return{text:e.text||"",level:o?t:this.defaultLevel.number}}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.icon,label:this.api.i18n.t(e.name),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,dataset:{"blok-header-level":String(e.number)}}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){const t=this.getTag();t.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(t,this._element),this._element=t}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){const e=document.createElement(this.currentLevel.tag);e.innerHTML=this._data.text||"",e.className=j(Ut.BASE_STYLES,this.currentLevel.styles,vo);const{inlineStyles:t}=this.currentLevel;return t&&Object.assign(e.style,t),e.setAttribute(Ho,"header"),e.contentEditable=this.readOnly?"false":"true",this.readOnly?e.setAttribute("data-placeholder",this.api.i18n.t(this._settings.placeholder||"")):fa(e,this.api.i18n.t(this._settings.placeholder||"")),e}get currentLevel(){const e=this.levels.find(t=>t.number===this._data.level);return e!=null?e:this.defaultLevel}get defaultLevel(){if(!this._settings.defaultLevel)return this.levels[1];const e=this.levels.find(t=>t.number===this._settings.defaultLevel);return e||(console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels"),this.levels[1])}get levels(){const e=this._settings.levelOverrides||{},t=Ut.DEFAULT_LEVELS.map(o=>{var i;const n=e[o.number]||{},r={};return n.size&&(r.fontSize=n.size),n.marginTop&&(r.marginTop=n.marginTop),n.marginBottom&&(r.marginBottom=n.marginBottom),{number:o.number,tag:((i=n.tag)==null?void 0:i.toUpperCase())||o.tag,name:n.name||o.name,icon:o.icon,styles:o.styles,inlineStyles:r}});return this._settings.levels?t.filter(o=>this._settings.levels.includes(o.number)):t}onPaste(e){var a;const t=e.detail;if(!("data"in t))return;const o=t.data,r=(a={H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[o.tagName])!=null?a:this.defaultLevel.number,i=this._settings.levels?this._settings.levels.reduce((l,c)=>Math.abs(c-r)<Math.abs(l-r)?c:l):r;this.data={level:i,text:o.innerHTML}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:Rb,title:"Heading"}}};Ut.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",Ut.DEFAULT_LEVELS=[{number:1,tag:"H1",name:"Heading 1",icon:Cb,styles:"text-4xl font-bold mt-8 mb-1"},{number:2,tag:"H2",name:"Heading 2",icon:Eb,styles:"text-3xl font-semibold mt-6 mb-px"},{number:3,tag:"H3",name:"Heading 3",icon:Sb,styles:"text-2xl font-semibold mt-4 mb-px"},{number:4,tag:"H4",name:"Heading 4",icon:Ab,styles:"text-xl font-semibold mt-3 mb-px"},{number:5,tag:"H5",name:"Heading 5",icon:Ib,styles:"text-base font-semibold mt-3 mb-px"},{number:6,tag:"H6",name:"Heading 6",icon:Nb,styles:"text-sm font-semibold mt-3 mb-px"}];let ya=Ut;const St=class St{static get version(){return Oo()}constructor(e){this.initialConfiguration=Z(e)?q({},e):e;const t=Z(e)&&V(e.onReady)?e.onReady:()=>{},o=new Zv(e);this.destroy=()=>{},this.isReady=o.isReady.then(()=>{this.exportAPI(o),t()})}exportAPI(e){var f,g;const t=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(b=>{if(b==null)return;V(b.destroy)&&b.destroy();const k=b.listeners;k&&V(k.removeAll)&&k.removeAll()}),cb();for(const b in this)Object.prototype.hasOwnProperty.call(this,b)&&delete this[b];Object.setPrototypeOf(this,null)};t.forEach(b=>{if(b!=="configuration"){this[b]=e[b];return}const k=e.configuration,y=Z(this.initialConfiguration)?this.initialConfiguration:k!=null?k:this.initialConfiguration;y!==void 0&&(this[b]=y)}),this.destroy=o;const n=e.moduleInstances.API.methods,r=(g=(f=e.moduleInstances.EventsAPI)==null?void 0:f.methods)!=null?g:n.events;if(r!==void 0){const b=k=>{Object.prototype.hasOwnProperty.call(k,"eventsDispatcher")||Object.defineProperty(k,"eventsDispatcher",{value:r,configurable:!0,enumerable:!0,writable:!1})};b(n),b(this)}Object.getPrototypeOf(n)!==St.prototype&&Object.setPrototypeOf(n,St.prototype),Object.setPrototypeOf(this,n);const i=Object.create(null),a=e.moduleInstances,l=a,c=b=>/^[A-Z]+$/.test(b)?b.toLowerCase():b.charAt(0).toLowerCase()+b.slice(1);Object.keys(l).forEach(b=>{const k=c(b);Object.defineProperty(i,k,{configurable:!0,enumerable:!0,get:()=>l[b]})});const d=a.Toolbar,u=a.BlockSettings;d!==void 0&&u!==void 0&&d.blockSettings===void 0&&(d.blockSettings=u);const h=a.InlineToolbar;d!==void 0&&h!==void 0&&d.inlineToolbar===void 0&&(d.inlineToolbar=h),Object.defineProperty(this,"module",{value:i,configurable:!0,enumerable:!1,writable:!1}),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([b,k])=>{Object.entries(k).forEach(([y,T])=>{const C=b,N=e.moduleInstances.API.methods[C];this[T]=N[y]})})}};St.Header=ya,St.Paragraph=pn,St.List=gn;let wa=St;const Ee={wrapper:me("fixed z-[2] bottom-5 left-5",'font-[-apple-system,BlinkMacSystemFont,"Segoe_UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira_Sans","Droid_Sans","Helvetica_Neue",sans-serif]'),notification:me("relative w-[230px] mt-[15px] py-[13px] px-4","bg-white shadow-[0_11px_17px_0_rgba(23,32,61,0.13)] rounded-[5px]","text-sm leading-[1.4em] break-words",'before:content-[""] before:absolute before:block before:top-0 before:left-0',"before:w-[3px] before:h-[calc(100%-6px)] before:m-[3px] before:rounded-[5px] before:bg-transparent"),crossBtn:me("absolute top-[7px] right-[15px] w-2.5 h-2.5 p-[5px] opacity-55 cursor-pointer",'before:content-[""] before:absolute before:left-[9px] before:top-[5px] before:h-3 before:w-0.5 before:bg-[#575d67] before:rotate-[-45deg]','after:content-[""] after:absolute after:left-[9px] after:top-[5px] after:h-3 after:w-0.5 after:bg-[#575d67] after:rotate-45',"hover:opacity-100"),btnsWrapper:"flex flex-row flex-nowrap mt-[5px]",btn:"border-none rounded-[3px] text-[13px] py-[5px] px-2.5 cursor-pointer last:ml-2.5",okBtn:"bg-[#34c992] shadow-[0_1px_1px_0_rgba(18,49,35,0.05)] text-white hover:bg-[#2db583]",cancelBtn:"bg-[#f2f5f7] shadow-[0_2px_1px_0_rgba(16,19,29,0)] text-[#656b7c] hover:bg-[#e9ecee]",input:me("max-w-[130px] py-[5px] px-2.5 bg-[#f7f7f7] border-0 rounded-[3px]","text-[13px] text-[#656b7c] outline-none","placeholder:text-[#656b7c] focus:placeholder:text-[rgba(101,107,124,0.3)]"),successNotification:me("!bg-[#fafffe]","before:!bg-[#41ffb1]"),errorNotification:me("!bg-[#fffbfb]","before:!bg-[#fb5d5d]")},Ta=s=>{const e=document.createElement("DIV"),t=document.createElement("DIV"),o=s.message,n=s.style,r=()=>n==="success"?Ee.successNotification:n==="error"?Ee.errorNotification:"";return e.className=j(Ee.notification,r()),n?e.setAttribute("data-blok-testid",`notification-${n}`):e.setAttribute("data-blok-testid","notification"),e.innerHTML=o,t.className=Ee.crossBtn,t.setAttribute("data-blok-testid","notification-cross"),t.addEventListener("click",()=>e.remove()),e.appendChild(t),e},Jv=s=>{const e=Ta(s),t=document.createElement("div"),o=document.createElement("button"),n=document.createElement("button"),r=e.querySelector('[data-blok-testid="notification-cross"]'),i=s.cancelHandler,a=s.okHandler;return t.className=Ee.btnsWrapper,t.setAttribute("data-blok-testid","notification-buttons-wrapper"),o.innerHTML=s.okText||"Confirm",n.innerHTML=s.cancelText||"Cancel",o.className=me(Ee.btn,Ee.okBtn),n.className=me(Ee.btn,Ee.cancelBtn),o.setAttribute("data-blok-testid","notification-confirm-button"),n.setAttribute("data-blok-testid","notification-cancel-button"),i&&typeof i=="function"&&n.addEventListener("click",i),i&&typeof i=="function"&&r&&r.addEventListener("click",i),a&&typeof a=="function"&&o.addEventListener("click",a),o.addEventListener("click",()=>e.remove()),n.addEventListener("click",()=>e.remove()),t.appendChild(o),t.appendChild(n),e.appendChild(t),e},Qv=s=>{const e=Ta(s),t=document.createElement("div"),o=document.createElement("button"),n=document.createElement("input"),r=e.querySelector('[data-blok-testid="notification-cross"]'),i=s.cancelHandler,a=s.okHandler;return t.className=Ee.btnsWrapper,o.innerHTML=s.okText||"Ok",o.className=me(Ee.btn,Ee.okBtn),n.className=Ee.input,n.setAttribute("data-blok-testid","notification-input"),s.placeholder&&n.setAttribute("placeholder",s.placeholder),s.default&&(n.value=s.default),s.inputType&&(n.type=s.inputType),i&&typeof i=="function"&&r&&r.addEventListener("click",i),a&&typeof a=="function"&&o.addEventListener("click",()=>{a(n.value)}),o.addEventListener("click",()=>e.remove()),t.appendChild(n),t.appendChild(o),e.appendChild(t),e},ek=()=>{const s=document.createElement("DIV");return s.className=Ee.wrapper,s.setAttribute("data-blok-testid","notifier-container"),s},tk=8e3,ok=()=>{const s=document.querySelector('[data-blok-testid="notifier-container"]');if(s)return s;const e=ek();return document.body.appendChild(e),e},Th=s=>{if(!s.message)return;const e=ok(),t=s.time||tk,o=(()=>{switch(s.type){case"confirm":return Jv(s);case"prompt":return Qv(s);default:{const n=Ta(s);return window.setTimeout(()=>{n.remove()},t),n}}})();e&&o&&(e.appendChild(o),o.className=`${o.className} animate-notify-bounce-in`,o.setAttribute("data-blok-bounce-in","true"))},nk=Object.freeze(Object.defineProperty({__proto__:null,default:{show:Th},show:Th},Symbol.toStringTag,{value:"Module"}));return wa}));