lakelib 0.0.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 (126) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -0
  3. package/dist/codemirror.min.js +1 -0
  4. package/dist/lake-all.css +1328 -0
  5. package/dist/lake-all.min.js +84 -0
  6. package/dist/lake.css +907 -0
  7. package/dist/lake.min.js +75 -0
  8. package/lib/lake.css +907 -0
  9. package/lib/lake.js +8315 -0
  10. package/lib/types/boxes/code-block.d.ts +2 -0
  11. package/lib/types/boxes/hr.d.ts +2 -0
  12. package/lib/types/boxes/image.d.ts +3 -0
  13. package/lib/types/codemirror.d.ts +8 -0
  14. package/lib/types/config/element-rules.d.ts +1 -0
  15. package/lib/types/config/menu-items.d.ts +9 -0
  16. package/lib/types/config/tag-names.d.ts +6 -0
  17. package/lib/types/config/toolbar-items.d.ts +2 -0
  18. package/lib/types/css/index.d.ts +15 -0
  19. package/lib/types/editor.d.ts +73 -0
  20. package/lib/types/elements/bookmark.d.ts +2 -0
  21. package/lib/types/elements/box.d.ts +2 -0
  22. package/lib/types/icons/index.d.ts +1 -0
  23. package/lib/types/index.d.ts +29 -0
  24. package/lib/types/managers/box-manager.d.ts +13 -0
  25. package/lib/types/managers/command.d.ts +11 -0
  26. package/lib/types/managers/history.d.ts +26 -0
  27. package/lib/types/managers/keystroke.d.ts +12 -0
  28. package/lib/types/managers/plugin.d.ts +9 -0
  29. package/lib/types/managers/selection.d.ts +41 -0
  30. package/lib/types/models/box.d.ts +28 -0
  31. package/lib/types/models/fragment.d.ts +7 -0
  32. package/lib/types/models/nodes.d.ts +96 -0
  33. package/lib/types/models/range.d.ts +53 -0
  34. package/lib/types/operations/add-mark.d.ts +3 -0
  35. package/lib/types/operations/delete-contents.d.ts +2 -0
  36. package/lib/types/operations/fix-list.d.ts +2 -0
  37. package/lib/types/operations/insert-bookmark.d.ts +6 -0
  38. package/lib/types/operations/insert-box.d.ts +4 -0
  39. package/lib/types/operations/insert-contents.d.ts +2 -0
  40. package/lib/types/operations/insert-fragment.d.ts +2 -0
  41. package/lib/types/operations/insert-link.d.ts +3 -0
  42. package/lib/types/operations/insert-node.d.ts +4 -0
  43. package/lib/types/operations/remove-box.d.ts +3 -0
  44. package/lib/types/operations/remove-mark.d.ts +2 -0
  45. package/lib/types/operations/set-blocks.d.ts +3 -0
  46. package/lib/types/operations/split-block.d.ts +3 -0
  47. package/lib/types/operations/split-marks.d.ts +3 -0
  48. package/lib/types/operations/to-bookmark.d.ts +6 -0
  49. package/lib/types/parsers/html-parser.d.ts +14 -0
  50. package/lib/types/parsers/text-parser.d.ts +6 -0
  51. package/lib/types/plugins/align.d.ts +3 -0
  52. package/lib/types/plugins/arrow-keys.d.ts +3 -0
  53. package/lib/types/plugins/backspace-key.d.ts +3 -0
  54. package/lib/types/plugins/block-quote.d.ts +3 -0
  55. package/lib/types/plugins/bold.d.ts +3 -0
  56. package/lib/types/plugins/code-block.d.ts +3 -0
  57. package/lib/types/plugins/code.d.ts +3 -0
  58. package/lib/types/plugins/copy.d.ts +3 -0
  59. package/lib/types/plugins/cut.d.ts +3 -0
  60. package/lib/types/plugins/delete-key.d.ts +3 -0
  61. package/lib/types/plugins/enter-key.d.ts +3 -0
  62. package/lib/types/plugins/font-color.d.ts +3 -0
  63. package/lib/types/plugins/font-family.d.ts +3 -0
  64. package/lib/types/plugins/font-size.d.ts +3 -0
  65. package/lib/types/plugins/format-painter.d.ts +3 -0
  66. package/lib/types/plugins/heading.d.ts +3 -0
  67. package/lib/types/plugins/highlight.d.ts +3 -0
  68. package/lib/types/plugins/hr.d.ts +3 -0
  69. package/lib/types/plugins/image.d.ts +3 -0
  70. package/lib/types/plugins/indent.d.ts +3 -0
  71. package/lib/types/plugins/italic.d.ts +3 -0
  72. package/lib/types/plugins/link.d.ts +3 -0
  73. package/lib/types/plugins/list.d.ts +3 -0
  74. package/lib/types/plugins/markdown.d.ts +3 -0
  75. package/lib/types/plugins/paste.d.ts +3 -0
  76. package/lib/types/plugins/redo.d.ts +3 -0
  77. package/lib/types/plugins/remove-format.d.ts +3 -0
  78. package/lib/types/plugins/select-all.d.ts +3 -0
  79. package/lib/types/plugins/shift-enter-key.d.ts +3 -0
  80. package/lib/types/plugins/strikethrough.d.ts +3 -0
  81. package/lib/types/plugins/subscript.d.ts +3 -0
  82. package/lib/types/plugins/superscript.d.ts +3 -0
  83. package/lib/types/plugins/tab-key.d.ts +3 -0
  84. package/lib/types/plugins/underline.d.ts +3 -0
  85. package/lib/types/plugins/undo.d.ts +3 -0
  86. package/lib/types/plugins/unlink.d.ts +3 -0
  87. package/lib/types/storage/box-instances.d.ts +2 -0
  88. package/lib/types/storage/boxes.d.ts +2 -0
  89. package/lib/types/storage/editors.d.ts +2 -0
  90. package/lib/types/types/box.d.ts +15 -0
  91. package/lib/types/types/native.d.ts +33 -0
  92. package/lib/types/types/node.d.ts +1 -0
  93. package/lib/types/types/object.d.ts +21 -0
  94. package/lib/types/types/request.d.ts +20 -0
  95. package/lib/types/types/toolbar.d.ts +40 -0
  96. package/lib/types/ui/link-popup.d.ts +16 -0
  97. package/lib/types/ui/toolbar.d.ts +30 -0
  98. package/lib/types/ui/upload.d.ts +10 -0
  99. package/lib/types/utils/append-deepest.d.ts +2 -0
  100. package/lib/types/utils/camel-case.d.ts +1 -0
  101. package/lib/types/utils/change-tag-name.d.ts +2 -0
  102. package/lib/types/utils/debug.d.ts +1 -0
  103. package/lib/types/utils/denormalize-value.d.ts +1 -0
  104. package/lib/types/utils/encode.d.ts +1 -0
  105. package/lib/types/utils/fix-numbered-list.d.ts +2 -0
  106. package/lib/types/utils/for-each.d.ts +5 -0
  107. package/lib/types/utils/get-css.d.ts +1 -0
  108. package/lib/types/utils/get-deepest.d.ts +2 -0
  109. package/lib/types/utils/in-string.d.ts +1 -0
  110. package/lib/types/utils/index.d.ts +26 -0
  111. package/lib/types/utils/merge-nodes.d.ts +5 -0
  112. package/lib/types/utils/morph.d.ts +56 -0
  113. package/lib/types/utils/normalize-value.d.ts +1 -0
  114. package/lib/types/utils/parse-style.d.ts +2 -0
  115. package/lib/types/utils/query.d.ts +3 -0
  116. package/lib/types/utils/remove-br.d.ts +2 -0
  117. package/lib/types/utils/remove-zws.d.ts +2 -0
  118. package/lib/types/utils/request.d.ts +27 -0
  119. package/lib/types/utils/safe-template.d.ts +1 -0
  120. package/lib/types/utils/set-block-indent.d.ts +2 -0
  121. package/lib/types/utils/split-nodes.d.ts +5 -0
  122. package/lib/types/utils/template.d.ts +1 -0
  123. package/lib/types/utils/to-hex.d.ts +1 -0
  124. package/lib/types/utils/to-node-list.d.ts +2 -0
  125. package/lib/types/utils/wrap-node-list.d.ts +2 -0
  126. package/package.json +81 -0
@@ -0,0 +1,75 @@
1
+ var Lake=function(e,t,n,o,i){"use strict";class s extends HTMLElement{}customElements.define("lake-box",s);class r extends HTMLElement{}customElements.define("lake-bookmark",r);const a=new Map([["plus",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm48-88a8,8,0,0,1-8,8H136v32a8,8,0,0,1-16,0V136H88a8,8,0,0,1,0-16h32V88a8,8,0,0,1,16,0v32h32A8,8,0,0,1,176,128Z"></path></svg>'],["more",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["left",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"></path></svg>'],["right",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path></svg>'],["down",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"></path></svg>'],["check",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"></path></svg>'],["checkCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"></path></svg>'],["warningCircle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z"></path></svg>'],["open",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6.25 4.5A1.75 1.75 0 0 0 4.5 6.25v11.5c0 .966.783 1.75 1.75 1.75h11.5a1.75 1.75 0 0 0 1.75-1.75v-4a.75.75 0 0 1 1.5 0v4A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25A3.25 3.25 0 0 1 6.25 3h4a.75.75 0 0 1 0 1.5h-4ZM13 3.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 .75.75v6.5a.75.75 0 0 1-1.5 0V5.56l-5.22 5.22a.75.75 0 0 1-1.06-1.06l5.22-5.22h-4.69a.75.75 0 0 1-.75-.75Z" fill="#000000"/></svg>'],["copy",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"></path></svg>'],["remove",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"></path></svg>'],["maximize",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,80v32a8,8,0,0,1-16,0V88H160a8,8,0,0,1,0-16h32A8,8,0,0,1,200,80ZM96,168H72V144a8,8,0,0,0-16,0v32a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16ZM232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z"></path></svg>'],["close",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path></svg>'],["zoomIn",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["zoomOut",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"></path></svg>'],["circleNotch",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"></path></svg>'],["selectAll",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M104,40a8,8,0,0,1,8-8h32a8,8,0,0,1,0,16H112A8,8,0,0,1,104,40Zm40,168H112a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM208,32H184a8,8,0,0,0,0,16h24V72a8,8,0,0,0,16,0V48A16,16,0,0,0,208,32Zm8,72a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V112A8,8,0,0,0,216,104Zm0,72a8,8,0,0,0-8,8v24H184a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V184A8,8,0,0,0,216,176ZM40,152a8,8,0,0,0,8-8V112a8,8,0,0,0-16,0v32A8,8,0,0,0,40,152Zm32,56H48V184a8,8,0,0,0-16,0v24a16,16,0,0,0,16,16H72a8,8,0,0,0,0-16ZM40,80a8,8,0,0,0,8-8V48H72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,48V72A8,8,0,0,0,40,80ZM176,184H80a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8h96a8,8,0,0,1,8,8v96A8,8,0,0,1,176,184Zm-8-96H88v80h80Z"></path></svg>'],["undo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,144a64.07,64.07,0,0,1-64,64H80a8,8,0,0,1,0-16h88a48,48,0,0,0,0-96H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48A8,8,0,0,1,85.66,45.66L51.31,80H168A64.07,64.07,0,0,1,232,144Z"></path></svg>'],["redo",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.34,130.34,204.69,96H88a48,48,0,0,0,0,96h88a8,8,0,0,1,0,16H88A64,64,0,0,1,88,80H204.69L170.34,45.66a8,8,0,0,1,11.32-11.32l48,48a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32-11.32Z"></path></svg>'],["heading",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,56V200a8,8,0,0,1-16,0V136H64v64a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v64H192V56a8,8,0,0,1,16,0Z"></path></svg>'],["heading1",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm75.77,49a8,8,0,0,0-8.21.39l-24,16a8,8,0,1,0,8.88,13.32L216,127V208a8,8,0,0,0,16,0V112A8,8,0,0,0,227.77,105Z"></path></svg>'],["heading2",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm88,144H208l33.55-44.74a32,32,0,1,0-55.73-29.93,8,8,0,1,0,15.08,5.34,16.28,16.28,0,0,1,2.32-4.3,16,16,0,1,1,25.54,19.27L185.6,203.2A8,8,0,0,0,192,216h48a8,8,0,0,0,0-16Z"></path></svg>'],["heading3",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm73.52,90.63,21-30A8,8,0,0,0,240,104H192a8,8,0,0,0,0,16h32.63l-19.18,27.41A8,8,0,0,0,212,160a20,20,0,1,1-14.29,34,8,8,0,1,0-11.42,11.19A36,36,0,0,0,248,180,36.07,36.07,0,0,0,225.52,146.63Z"></path></svg>'],["heading4",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,112h-8V144a8,8,0,0,0-16,0v24H195.1l20.49-61.47a8,8,0,0,0-15.18-5.06l-24,72A8,8,0,0,0,184,184h40v24a8,8,0,0,0,16,0V184h8a8,8,0,0,0,0-16Z"></path></svg>'],["heading5",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm60,88a38.8,38.8,0,0,0-9.41,1.14L206.78,120H240a8,8,0,0,0,0-16H200a8,8,0,0,0-7.89,6.68l-8,48a8,8,0,0,0,13.6,6.92A19.73,19.73,0,0,1,212,160a20,20,0,0,1,0,40,19.73,19.73,0,0,1-14.29-5.6,8,8,0,1,0-11.42,11.2A35.54,35.54,0,0,0,212,216a36,36,0,0,0,0-72Z"></path></svg>'],["heading6",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M152,56V176a8,8,0,0,1-16,0V124H48v52a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0v52h88V56a8,8,0,0,1,16,0Zm96,124a36,36,0,1,1-67.34-17.68c.07-.14.14-.28.22-.42l32.25-54a8,8,0,0,1,13.74,8.2l-16.69,28c.6,0,1.21-.05,1.82-.05A36,36,0,0,1,248,180Zm-16,0a20,20,0,1,0-20,20A20,20,0,0,0,232,180Z"></path></svg>'],["paragraph",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208,40H96a64,64,0,0,0,0,128h40v40a8,8,0,0,0,16,0V56h24V208a8,8,0,0,0,16,0V56h16a8,8,0,0,0,0-16ZM136,152H96a48,48,0,0,1,0-96h40Z"></path></svg>'],["blockQuote",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M100,56H40A16,16,0,0,0,24,72v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,100,56Zm0,80H40V72h60ZM216,56H156a16,16,0,0,0-16,16v64a16,16,0,0,0,16,16h60v8a32,32,0,0,1-32,32,8,8,0,0,0,0,16,48.05,48.05,0,0,0,48-48V72A16,16,0,0,0,216,56Zm0,80H156V72h60Z"></path></svg>'],["list",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M88,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Zm128,56H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H96a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM56,56H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Zm0,64H40a8,8,0,0,0,0,16H56a8,8,0,0,0,0-16Z"></path></svg>'],["numberedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM104,72H216a8,8,0,0,0,0-16H104a8,8,0,0,0,0,16ZM216,184H104a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM43.58,55.16,48,52.94V104a8,8,0,0,0,16,0V40a8,8,0,0,0-11.58-7.16l-16,8a8,8,0,0,0,7.16,14.32ZM79.77,156.72a23.73,23.73,0,0,0-9.6-15.95,24.86,24.86,0,0,0-34.11,4.7,23.63,23.63,0,0,0-3.57,6.46,8,8,0,1,0,15,5.47,7.84,7.84,0,0,1,1.18-2.13,8.76,8.76,0,0,1,12-1.59A7.91,7.91,0,0,1,63.93,159a7.64,7.64,0,0,1-1.57,5.78,1,1,0,0,0-.08.11L33.59,203.21A8,8,0,0,0,40,216H72a8,8,0,0,0,0-16H56l19.08-25.53A23.47,23.47,0,0,0,79.77,156.72Z"></path></svg>'],["bulletedList",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z"></path></svg>'],["checklist",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H128a8,8,0,0,1,0-16h88A8,8,0,0,1,224,128ZM128,72h88a8,8,0,0,0,0-16H128a8,8,0,0,0,0,16Zm88,112H128a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16ZM82.34,42.34,56,68.69,45.66,58.34A8,8,0,0,0,34.34,69.66l16,16a8,8,0,0,0,11.32,0l32-32A8,8,0,0,0,82.34,42.34Zm0,64L56,132.69,45.66,122.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Zm0,64L56,196.69,45.66,186.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0-11.32-11.32Z"></path></svg>'],["alignLeft",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,48H168a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm176,24H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-48,40H40a8,8,0,0,0,0,16H168a8,8,0,0,0,0-16Z"></path></svg>'],["alignCenter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM64,96a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Zm152,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm-24,40H64a8,8,0,0,0,0,16H192a8,8,0,0,0,0-16Z"></path></svg>'],["alignRight",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["alignJustify",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64ZM216,96H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,40H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Z"></path></svg>'],["increaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM34.34,141.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0,0-11.32l-40-40A8,8,0,0,0,34.34,61.66L68.69,96,34.34,130.34A8,8,0,0,0,34.34,141.66Z"></path></svg>'],["decreaseIndent",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM112,72H216a8,8,0,0,0,0-16H112a8,8,0,0,0,0,16ZM216,184H40a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM72,144a8,8,0,0,0,5.66-13.66L43.31,96,77.66,61.66A8,8,0,0,0,66.34,50.34l-40,40a8,8,0,0,0,0,11.32l40,40A8,8,0,0,0,72,144Z"></path></svg>'],["formatPainter",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,88H216V64a16,16,0,0,0-16-16H48A16,16,0,0,0,32,64V88H16a8,8,0,0,0,0,16H32v24a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V104h16v50L131.6,182.65A16.07,16.07,0,0,0,120,198v34a8,8,0,0,0,16,0V198l100.4-28.68A16.07,16.07,0,0,0,248,154V104A16,16,0,0,0,232,88Zm-32,40H48V64H200v64Z"></path></svg>'],["bold",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M170.48,115.7A44,44,0,0,0,140,40H72a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8h80a48,48,0,0,0,18.48-92.3ZM80,56h60a28,28,0,0,1,0,56H80Zm72,136H80V128h72a32,32,0,0,1,0,64Z"></path></svg>'],["italic",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,56a8,8,0,0,1-8,8H157.77L115.1,192H144a8,8,0,0,1,0,16H64a8,8,0,0,1,0-16H98.23L140.9,64H112a8,8,0,0,1,0-16h80A8,8,0,0,1,200,56Z"></path></svg>'],["underline",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M200,224a8,8,0,0,1-8,8H64a8,8,0,0,1,0-16H192A8,8,0,0,1,200,224Zm-72-24a64.07,64.07,0,0,0,64-64V56a8,8,0,0,0-16,0v80a48,48,0,0,1-96,0V56a8,8,0,0,0-16,0v80A64.07,64.07,0,0,0,128,200Z"></path></svg>'],["strikethrough",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"></path></svg>'],["superscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.736 3.5c-.543 0-.986.495-.986 1.023a.75.75 0 0 1-1.5 0C16.25 3.278 17.258 2 18.736 2c.855 0 1.684.4 2.15 1.117.49.751.5 1.724-.057 2.672-.285.484-.673.847-1.045 1.141-.187.148-.379.284-.557.41l-.078.056a17.45 17.45 0 0 0-.432.311c-.356.268-.619.511-.78.793h2.514a.75.75 0 0 1 0 1.5H17a.75.75 0 0 1-.75-.75c0-1.396.821-2.182 1.565-2.741.157-.119.32-.234.472-.341l.074-.052c.177-.126.34-.243.493-.363.306-.242.532-.47.682-.724.31-.53.229-.886.093-1.094-.158-.244-.486-.435-.893-.435Z" fill="#000000"/><path d="M15.26 4.71c.06.562.385 1.043.847 1.318L10.987 12l5.583 6.512a.75.75 0 1 1-1.14.976L10 13.152l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 1 1 1.139-.976L10 10.848l5.26-6.137Z" fill="#000000"/></svg>'],["subscript",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M16.488 4.43a.75.75 0 0 1 .082 1.058L10.988 12l5.032 5.871c-.302.41-.555.906-.682 1.51L10 13.151l-5.43 6.336a.75.75 0 0 1-1.14-.976L9.013 12 3.431 5.488a.75.75 0 0 1 1.139-.976L10 10.848l5.43-6.336a.75.75 0 0 1 1.058-.081ZM17.75 15.523c0-.528.444-1.023.986-1.023.407 0 .735.19.893.434.136.21.218.566-.093 1.095-.15.255-.376.482-.682.724-.152.12-.316.237-.493.363l-.074.052c-.152.107-.315.222-.472.34-.744.56-1.565 1.346-1.565 2.742 0 .414.336.75.75.75h3.451a.75.75 0 0 0 0-1.5h-2.513c.16-.282.423-.525.779-.793.137-.103.279-.203.432-.312l.078-.054c.178-.127.37-.264.557-.41.372-.295.76-.658 1.045-1.142.557-.948.546-1.921.058-2.672C20.42 13.4 19.59 13 18.736 13c-1.478 0-2.486 1.278-2.486 2.523a.75.75 0 0 0 1.5 0Z" fill="#000000"/></svg>'],["code",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M93.31,70,28,128l65.27,58a8,8,0,1,1-10.62,12l-72-64a8,8,0,0,1,0-12l72-64A8,8,0,1,1,93.31,70Zm152,52-72-64a8,8,0,0,0-10.62,12L228,128l-65.27,58a8,8,0,1,0,10.62,12l72-64a8,8,0,0,0,0-12Z"></path></svg>'],["removeFormat",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M225,80.4,183.6,39a24,24,0,0,0-33.94,0L31,157.66a24,24,0,0,0,0,33.94l30.06,30.06A8,8,0,0,0,66.74,224H216a8,8,0,0,0,0-16h-84.7L225,114.34A24,24,0,0,0,225,80.4ZM108.68,208H70.05L42.33,180.28a8,8,0,0,1,0-11.31L96,115.31,148.69,168Zm105-105L160,156.69,107.31,104,161,50.34a8,8,0,0,1,11.32,0l41.38,41.38a8,8,0,0,1,0,11.31Z"></path></svg>'],["moreStyle",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M112,60a16,16,0,1,1,16,16A16,16,0,0,1,112,60Zm16,52a16,16,0,1,0,16,16A16,16,0,0,0,128,112Zm0,68a16,16,0,1,0,16,16A16,16,0,0,0,128,180Z"></path></svg>'],["fontColor",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><polyline points="192 168 128 32 64 168" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><line x1="173.18" y1="128" x2="82.82" y2="128" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["fontColorAccent",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><line x1="40" y1="216" x2="216" y2="216" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>'],["highlight",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.38 14.003A2.5 2.5 0 0 0 2 16.5v3A2.5 2.5 0 0 0 4.5 22h15a2.5 2.5 0 0 0 2.5-2.5v-3a2.5 2.5 0 0 0-2.5-2.5h-5.954l-1.316 1.314a3.237 3.237 0 0 1-.203.186H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869 2 2 0 0 1 .092-.744l.285-.884Z" fill="#000000"/><path d="M18.648 2.944a3.218 3.218 0 0 1-.002 4.551l-7.123 7.111a2.25 2.25 0 0 1-.942.563l-4.294 1.289a1 1 0 0 1-1.239-1.265l1.362-4.228c.11-.34.298-.65.552-.902l7.132-7.122a3.22 3.22 0 0 1 4.554.003Zm-3.494 1.059-7.133 7.121a.75.75 0 0 0-.184.301l-1.07 3.322 3.382-1.015a.75.75 0 0 0 .315-.187l7.121-7.11a1.718 1.718 0 1 0-2.43-2.432Z" fill="#000000"/></svg>'],["highlightAccent",'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.004 15.631a2 2 0 0 0 2.571 1.784l4.293-1.288a3.25 3.25 0 0 0 1.159-.627H19.5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1v-3a1 1 0 0 1 .504-.869Z" fill="#000000"/></svg>'],["link",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"></path></svg>'],["unlink",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M190.63,65.37a32,32,0,0,0-45.19-.06L133.79,77.52a8,8,0,0,1-11.58-11l11.72-12.29a1.59,1.59,0,0,1,.13-.13,48,48,0,0,1,67.88,67.88,1.59,1.59,0,0,1-.13.13l-12.29,11.72a8,8,0,0,1-11-11.58l12.21-11.65A32,32,0,0,0,190.63,65.37ZM122.21,178.48l-11.65,12.21a32,32,0,0,1-45.25-45.25l12.21-11.65a8,8,0,0,0-11-11.58L54.19,133.93a1.59,1.59,0,0,0-.13.13,48,48,0,0,0,67.88,67.88,1.59,1.59,0,0,0,.13-.13l11.72-12.29a8,8,0,1,0-11.58-11ZM208,152H184a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16ZM48,104H72a8,8,0,0,0,0-16H48a8,8,0,0,0,0,16Zm112,72a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V184A8,8,0,0,0,160,176ZM96,80a8,8,0,0,0,8-8V48a8,8,0,0,0-16,0V72A8,8,0,0,0,96,80Z"></path></svg>'],["hr",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"></path></svg>'],["image",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"></path></svg>'],["codeBlock",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"></path></svg>'],["table",'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M224,48H32a8,8,0,0,0-8,8V192a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A8,8,0,0,0,224,48ZM40,112H80v32H40Zm56,0H216v32H96ZM216,64V96H40V64ZM40,160H80v32H40Zm176,32H96V160H216v32Z"></path></svg>']]);function l(e,...t){let n=e[0];for(let o=0;o<t.length;o++){n+=String(t[o]),n+=e[o+1]}return n=n.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),n}const c=new Map([["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],[" ","&nbsp;"]]);function d(e){return e.replace(/[&<>"\xA0]/g,(e=>{var t;return null!==(t=c.get(e))&&void 0!==t?t:""}))}function h(e,...t){let n=e[0];for(let o=0;o<t.length;o++){n+=d(String(t[o])),n+=e[o+1]}return n=n.replace(/^\s+/gm,"").replace(/\s+$/gm,"").replace(/[\r\n]/g,""),n}function u(e){const t=e.split("-");let n="";return t.forEach(((e,t)=>{n+=t>0?e.charAt(0).toUpperCase()+e.substring(1):e})),n}function f(e,t,n){return void 0===n&&(n=","),(n+e+n).indexOf(n+t+n)>=0}function p(e){const t=Number.parseInt(e,10).toString(16).toLowerCase();return t.length>1?t:`0${t}`}function g(e){return e.replace(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)/gi,((e,t,n,o,i)=>void 0===i?`#${p(t)}${p(n)}${p(o)}`:`#${p(t)}${p(n)}${p(o)}${function(e){const t=Math.round(255*Number.parseFloat(e)).toString(16);return t.length>1?t:`0${t}`}(i)}`))}function m(e){e=e.replace(/&quot;/gi,'"');const t={},n=/\s*([\w-]+)\s*:([^;]*)(;|$)/g;let o;for(;null!==(o=n.exec(e));){const e=o[1].toLowerCase().trim(),n=g(o[2]).trim();t[e]=n}return t}function v(e){return e.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<anchor\s*\/>/gi,'<lake-bookmark type="anchor"></lake-bookmark>').replace(/<focus\s*\/>/gi,'<lake-bookmark type="focus"></lake-bookmark>')}function x(e){return e.replace(/(<lake-box[^>]+>)[\s\S]*?(<\/lake-box>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"<anchor />").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"<focus />")}function k(e,t){for(const n in e)if(!1===t(n,e[n]))break}function w(e,t){const n=u(t),o=window.getComputedStyle(e,null);return g(e.style[n]||o.getPropertyValue(t)||"")}function b(e,t){const n=[];if("string"!=typeof e)return n.push(e),n;if(""===e)return n;if("text"===t){const t=document.createTextNode(e);return n.push(t),n}if("html"===t||/<.+>/.test(e)){const t=document.createElement("div");t.innerHTML=e;for(const e of t.childNodes)n.push(e);return n}const o=document.querySelectorAll(e);for(const e of o)n.push(e);return n}const y=Node,B=new Set(["h1","h2","h3","h4","h5","h6","div","p","blockquote","ul","ol","li","table","tr","th","td"]),A=new Set(["span","strong","em","i","u","s","sup","sub","code"]),C=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),S=new Set(["h1","h2","h3","h4","h5","h6"]),M=new Set(["ol","ul","li"]),T=new Set(["table","tr","td"]);function H(...e){window.DEBUG&&console.log.apply(console.log,e)}const E={};let N=0;class L{constructor(e){e=null!=e?e:[],this.nodeList=Array.isArray(e)?e:[e];for(let e=0;e<this.nodeList.length;e++)this.nodeList[e].lakeId||(this.nodeList[e].lakeId=++N);this.length=this.nodeList.length}get id(){return this.get(0).lakeId}get name(){if(0===this.length)return"";return this.get(0).nodeName.toLowerCase()}get isElement(){if(0===this.length)return!1;return this.get(0).nodeType===y.ELEMENT_NODE}get isText(){if(0===this.length)return!1;return this.get(0).nodeType===y.TEXT_NODE}get isBlock(){return 0!==this.length&&B.has(this.name)}get isMark(){return 0!==this.length&&A.has(this.name)}get isVoid(){return 0!==this.length&&C.has(this.name)}get isHeading(){return 0!==this.length&&S.has(this.name)}get isList(){return 0!==this.length&&M.has(this.name)}get isTable(){return 0!==this.length&&T.has(this.name)}get isBookmark(){return"lake-bookmark"===this.name}get isBox(){return"lake-box"===this.name}get isInlineBox(){return this.isBox&&"inline"===this.attr("type")}get isBlockBox(){return this.isBox&&"block"===this.attr("type")}get isContainer(){if(0===this.length)return!1;const e=this.get(0);return this.isElement&&"true"===e.getAttribute("contenteditable")}get isOutside(){return 0===this.closest('[contenteditable="true"]').length}get isInside(){return!this.isOutside&&!this.isContainer}get isTopInside(){if(0===this.length)return!1;const e=this.parent();return 0!==e.length&&(this.isInside&&e.isContainer)}get isContentEditable(){if(0===this.length)return!1;if(this.isText){const e=this.get(0).parentNode;return!!e&&e.isContentEditable}if(!this.isElement)return!1;return this.get(0).isContentEditable}get isIndivisible(){return this.isContainer||this.isTable}get isEmpty(){if(this.isBox)return!1;const e=this.text(),t=""===e||/^[\r\n\u200B\u2060]+$/.test(e);return this.isElement&&t?0===this.find("lake-box").length:t}isSibling(e){if(0===this.length)return!1;const t=this.get(0).parentNode;return t&&t===e.parent().get(0)}get(e){return this.nodeList[e]}getAll(){return this.nodeList}eq(e){const t=this.get(e);return new L(t)}each(e){const t=this.getAll();for(let n=0;n<t.length;n++)if(!1===e(t[n],n))return this;return this}eachElement(e){const t=this.getAll();for(let n=0;n<t.length;n++)if(t[n].nodeType===y.ELEMENT_NODE&&!1===e(t[n],n))return this;return this}reverse(){const e=this.getAll().reverse();return new L(e)}matches(e){if(!this.isElement)return!1;return this.get(0).matches(e)}find(e){if("string"==typeof e){const t=this.get(0).querySelectorAll(e);return new L(Array.from(t))}let t=this.eq(0);for(const n of e)if(t=t.children()[n],!t)return new L;return t}closest(e){if(this.isText){const t=this.get(0).parentNode;return t?new L(t.closest(e)):new L}if(!this.isElement)return new L;const t=this.get(0);return new L(t.closest(e))}closestBlock(){let e=this.eq(0);for(;e.length>0&&!e.isTopInside&&!e.isBlock;)e=e.parent();return e.isBlock?e:new L}closestOperableBlock(){const e=this.closest("lake-box"),t=e.length>0?e.closestBlock():this.closestBlock();if(0===t.length)return t;if(t.isTable)return new L;const n=t.parent();return"li"===t.name&&n.isList?n:t}closestContainer(){return this.closest('div[contenteditable="true"]')}parent(){const e=this.get(0);return new L(e.parentNode)}prev(){const e=this.get(0);return new L(e.previousSibling)}next(){const e=this.get(0);return new L(e.nextSibling)}first(){const e=this.get(0);return new L(e.firstChild)}last(){const e=this.get(0);return new L(e.lastChild)}index(){let e=-1,t=this.get(0);for(;t;)e++,t=t.previousSibling;return e}path(){const e=[];let t=this.eq(0);if(t.isContainer)return e;for(;t.length>0;){const n=t.parent();if(0===n.length)break;if(e.push(t.index()),n.isContainer)break;t=n}return e.reverse()}children(){const e=[];let t=this.first();for(;t.length>0;)e.push(t),t=t.next();return e}*getWalker(){for(const e of function*e(t){if(t.isBox)return;let n=t.first();for(;n.length>0;){const t=n.next();yield n,yield*e(n),n=t}}(this.eq(0)))yield e}on(e,t){return this.eachElement((n=>{n.addEventListener(e,t,!1);const o=n.lakeId;E[o]||(E[o]=[]),E[o].push({type:e,listener:t})}))}off(e,t){return this.eachElement((n=>{var o;const i=n.lakeId,s=null!==(o=E[i])&&void 0!==o?o:[];s.forEach(((o,i)=>{e&&(e!==o.type||t&&t!==o.listener)||(n.removeEventListener(o.type,o.listener,!1),s[i]={type:"",listener:()=>{}})})),E[i]=s.filter((e=>""!==e.type))}))}emit(e,t){return this.eachElement((n=>{const o=n.lakeId;E[o].forEach((n=>{n.type===e&&n.listener(null!=t?t:new Event(e))}))}))}getEventListeners(e){const t=this.get(e).lakeId;return E[t]}focus(){return this.get(0).focus(),this}blur(){return this.get(0).blur(),this}clone(e=!1){const t=this.get(0);return new L(t.cloneNode(e))}hasAttr(e){return this.get(0).hasAttribute(e)}attr(e,t){var n;if("object"==typeof e)return k(e,((e,t)=>{this.attr(e,t)})),this;if(void 0===t){return null!==(n=this.get(0).getAttribute(e))&&void 0!==n?n:""}return this.eachElement((n=>{n.setAttribute(e,t)}))}removeAttr(e){return this.eachElement((t=>{t.removeAttribute(e)}))}hasClass(e){return f(this.get(0).className,e," ")}addClass(e){return Array.isArray(e)?(e.forEach((e=>{this.addClass(e)})),this):this.eachElement((t=>{f(t.className,e," ")||t.classList.add(e)}))}removeClass(e){return Array.isArray(e)?(e.forEach((e=>{this.removeClass(e)})),this):this.eachElement((t=>{f(t.className,e," ")&&(t.classList.remove(e),""===t.className&&t.removeAttribute("class"))}))}computedCSS(e){return w(this.get(0),e)}css(e,t){if("object"==typeof e)return k(e,((e,t)=>{this.css(e,t)})),this;if(void 0===t){return g(this.get(0).style[u(e)])}return this.eachElement((n=>{n.style[u(e)]=t,""===n.getAttribute("style")&&n.removeAttribute("style")}))}width(){return this.get(0).offsetWidth}height(){return this.get(0).offsetHeight}show(e="block"){return this.css("display",e),this}hide(){return this.css("display","none"),this}html(e){if(void 0===e){return this.get(0).innerHTML}return this.eachElement((t=>{t.innerHTML=e}))}text(e){var t;if(void 0===e){const e=this.get(0);if(this.isText)return null!==(t=e.nodeValue)&&void 0!==t?t:"";return e.innerText.replace(/^\n+|\n+$/,"")}return this.eachElement((t=>{t.innerText=e}))}outerHTML(){return this.get(0).outerHTML}empty(){return this.html(""),this}prepend(e){if("string"==typeof e)return this.eachElement((t=>{b(e).reverse().forEach((e=>{t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}))}));const t=this.get(0);return e instanceof L&&(e=e.get(0)),t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e),this}append(e){if("string"==typeof e)return this.eachElement((t=>{b(e).forEach((e=>{t.appendChild(e)}))}));const t=this.get(0);return e instanceof L&&(e=e.get(0)),t.appendChild(e),this}before(e){if("string"==typeof e)return this.each((t=>{b(e).forEach((e=>{t.parentNode&&t.parentNode.insertBefore(e,t)}))}));const t=this.get(0);return e instanceof L&&(e=e.get(0)),t.parentNode?(t.parentNode.insertBefore(e,t),this):this}after(e){if("string"==typeof e)return this.each((t=>{b(e).reverse().forEach((e=>{t.parentNode&&(t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e))}))}));const t=this.get(0);return e instanceof L&&(e=e.get(0)),t.parentNode?(t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e),this):this}replaceWith(e){return this.each((t=>{let n;n=e instanceof L?e.get(0):b(e)[0],t.parentNode&&t.parentNode.replaceChild(n,t)}))}remove(e=!1){return this.each((t=>{if(t.parentNode){if(e){let e=t.firstChild;for(;e;){const n=e.nextSibling;t.parentNode.insertBefore(e,t),e=n}}t.parentNode.removeChild(t)}})),this}splitText(e){if(!this.isText)return new L;const t=this.get(0).splitText(e);return new L(t)}toString(){if(0===this.length)return"";const e=this.get(0);let t=this.isText?e.nodeValue:this.outerHTML();return t&&t.length>50&&(t=`${t.substring(0,50)} ...`),`node (${e.lakeId}): ${t}`}debug(){H(this.toString())}}function V(e){if(e instanceof L)return e;const t=b(e);return new L(t)}class ${constructor(e){this.range=null!=e?e:document.createRange()}get startNode(){return new L(this.range.startContainer)}get startOffset(){return this.range.startOffset}get endNode(){return new L(this.range.endContainer)}get endOffset(){return this.range.endOffset}get commonAncestor(){return new L(this.range.commonAncestorContainer)}get isCollapsed(){return this.range.collapsed}get isBox(){return this.commonAncestor.closest("lake-box").length>0}get isBoxLeft(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.compareBeforeNode(t)>=0}get isBoxCenter(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.isCollapsed&&this.startNode.get(0)===t.get(0)&&0===this.startOffset}get isBoxRight(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return this.compareAfterNode(t)<=0}get isInsideBox(){const e=this.commonAncestor.closest("lake-box");if(0===e.length)return!1;const t=e.find(".lake-box-container");return(!this.isCollapsed||this.startNode.get(0)!==t.get(0)||0!==this.startOffset)&&(this.compareBeforeNode(t)<0&&this.compareAfterNode(t)>0)}get isInoperative(){if(this.commonAncestor.isOutside)return!0;const e=this.startNode.closest("td"),t=this.endNode.closest("td");return e.length>0&&t.length>0&&e.get(0)!==t.get(0)}get(){return this.range}comparePoint(e,t){return this.range.comparePoint(e.get(0),t)}compareBeforeNode(e){const t=new $;return e.isText?t.setStart(e,0):t.setStartBefore(e),t.collapseToStart(),this.comparePoint(t.startNode,t.startOffset)}compareAfterNode(e){var t;const n=new $;if(e.isText){const o=null!==(t=e.get(0).nodeValue)&&void 0!==t?t:"";n.setStart(e,o.length)}else n.setStartAfter(e);return n.collapseToStart(),this.comparePoint(n.startNode,n.startOffset)}intersectsNode(e){return this.range.intersectsNode(e.get(0))}setStart(e,t){this.range.setStart(e.get(0),t)}setStartBefore(e){this.range.setStartBefore(e.get(0))}setStartAfter(e){this.range.setStartAfter(e.get(0))}setEnd(e,t){this.range.setEnd(e.get(0),t)}setEndBefore(e){this.range.setEndBefore(e.get(0))}setEndAfter(e){this.range.setEndAfter(e.get(0))}collapseToStart(){this.range.collapse(!0)}collapseToEnd(){this.range.collapse(!1)}selectNode(e){this.range.selectNode(e.get(0))}selectNodeContents(e){this.range.selectNodeContents(e.get(0))}selectBox(e){const t=e.find(".lake-box-container");if(0===t.length)throw new Error(`The box cannot be selected because the box '${e.attr("name")}' (id=${e.id}) has not been rendered yet.`);this.setStart(t,0),this.collapseToStart()}selectBoxLeft(e){const t=e.find(".lake-box-strip");if(0===t.length)throw new Error(`The box cannot be selected because the box '${e.attr("name")}' (id=${e.id}) has not been rendered yet.`);this.selectNodeContents(t.eq(0)),this.collapseToEnd()}selectBoxRight(e){const t=e.find(".lake-box-strip");if(0===t.length)throw new Error(`The box cannot be selected because the box '${e.attr("name")}' (id=${e.id}) has not been rendered yet.`);this.selectNodeContents(t.eq(1)),this.collapseToEnd()}shrinkBefore(e){if(e.isBox)return void this.selectBoxLeft(e);if(e.isText)return this.setStartBefore(e),void this.collapseToStart();let t;for(this.setStart(e,0);this.startNode.isElement&&(t=this.startNode.children()[0])&&t.isElement&&!t.isVoid;){if(t.isBox)return void this.selectBoxLeft(t);this.setStart(t,0)}this.collapseToStart()}shrinkAfter(e){if(e.isBox)return void this.selectBoxRight(e);if(e.isText)return this.setEndAfter(e),void this.collapseToEnd();let t;for(this.setEnd(e,e.children().length);this.endNode.isElement&&this.endOffset>0&&(t=this.endNode.children()[this.endOffset-1])&&t.isElement&&!t.isVoid;){if(t.isBox)return void this.selectBoxRight(t);this.setEnd(t,t.children().length)}this.collapseToEnd()}shrink(){const e=this.isCollapsed;let t;for(;this.startNode.isElement&&(t=this.startNode.children()[this.startOffset])&&t.isElement&&!t.isVoid&&!t.isBox;)this.setStart(t,0);if(e)this.collapseToStart();else for(;this.endNode.isElement&&this.endOffset>0&&(t=this.endNode.children()[this.endOffset-1])&&t.isElement&&!t.isVoid&&!t.isBox;)this.setEnd(t,t.children().length)}adaptBox(){const e=this.startNode.closest("lake-box");if(e.length>0){const t=this.clone();t.collapseToStart(),t.isBoxRight?this.setStartAfter(e):this.setStartBefore(e)}const t=this.endNode.closest("lake-box");if(t.length>0){const e=this.clone();e.collapseToEnd(),e.isBoxLeft?this.setEndBefore(t):this.setEndAfter(t)}}adaptTable(){const e=this.startNode.closest("table"),t=this.endNode.closest("table");if(0===e.length&&t.length>0&&t.isInside)return this.setEndBefore(t),void this.shrink();0===t.length&&e.length>0&&e.isInside&&(this.setStartAfter(e),this.shrink())}adaptBlock(){if(!this.isCollapsed){if(this.endNode.isElement&&0===this.endOffset){let e=this.endNode;for(;0===e.prev().length;)e=e.parent();this.setEndBefore(e)}return void this.shrink()}if(this.startNode.isText)return;const e=this.startNode.children()[this.startOffset];e&&(e.isBlockBox||e.isBlock)&&this.shrinkBefore(e)}adapt(){this.adaptBox(),this.adaptTable(),this.adaptBlock()}getPrevNode(){let e;return e=this.startNode.isText?0===this.startOffset?this.startNode.prev():this.startNode:this.startNode.children()[this.startOffset-1],null!=e?e:new L}getNextNode(){let e;return e=this.endNode.isText?this.endOffset===this.endNode.text().length?this.endNode.next():this.endNode:this.endNode.children()[this.endOffset],null!=e?e:new L}getBoxes(){if(this.isCollapsed){const e=this.startNode.closest("lake-box");return e.length>0?[e]:[]}const e=[],t=this.clone();t.adaptBox();for(const n of t.commonAncestor.getWalker())n.isBox&&t.intersectsNode(n)&&e.push(n);return e}getBlocks(){if(this.isCollapsed){const e=this.startNode.closestOperableBlock();return e.isTable?[]:e.isInside?[e]:[]}const e=this.startNode.closestOperableBlock(),t=this.endNode.closestOperableBlock();if(e.isInside&&e.get(0)&&e.get(0)===t.get(0))return e.isTable?[]:[e];const n=[],o=this.clone();o.collapseToEnd();for(const e of this.commonAncestor.getWalker())e.isBlock&&!e.isTable&&e.isTopInside&&0!==o.comparePoint(e,0)&&this.intersectsNode(e)&&n.push(e);if(n.length>0)return n;for(const o of this.commonAncestor.getWalker())o.isBlock&&!o.isTable&&(e.isSibling(o)||t.isSibling(o))&&this.intersectsNode(o)&&n.push(o);return n}getMarks(e=!1){const t=[];if(this.commonAncestor.isText&&e&&0===this.startOffset&&this.endOffset===this.commonAncestor.text().length)return t.push(this.commonAncestor),t;const n=this.clone();n.collapseToStart();const o=this.clone();o.collapseToEnd();for(const i of this.commonAncestor.getWalker()){const s=document.createRange();if(s.setStartAfter(i.get(0)),s.collapse(!0),o.compareBeforeNode(i)>=0)break;n.compareAfterNode(i)>0&&(i.isMark||i.isText&&e)&&t.push(i)}return t}getLeftText(){const e=this.startNode,t=this.startOffset;let n=e.closestBlock();if(n.isOutside&&(n=e.closestContainer()),0===n.length)return"";const o=new $;o.setStartBefore(n),o.setEnd(e,t);const i=V("<div />");i.append(o.cloneContents());const s=i.text();return""===s&&i.find("lake-box").length>0?"​":s}getRightText(){const e=this.endNode,t=this.endOffset;let n=e.closestBlock();if(n.isOutside&&(n=e.closestContainer()),0===n.length)return"";const o=new $;o.setStart(e,t),o.setEndAfter(n);const i=V("<div />");i.append(o.cloneContents());const s=i.text();return""===s&&i.find("lake-box").length>0?"​":s}clone(){return new $(this.range.cloneRange())}cloneContents(){return this.range.cloneContents()}debug(){H("--- range information ---"),H("start node:",this.startNode.toString(),", offset:",this.startOffset),H("end node:",this.endNode.toString(),", offset:",this.endOffset)}}function Z(e,t,n){const o=new $;let i;if(e.isText){i=e.parent();const n=e.splitText(t);o.setStartAfter(e),""===e.text()&&e.remove(),""===n.text()&&n.remove()}else o.setStart(e,t),i=e;if("body"===i.name||"html"===i.name)return null;if(i.get(0)===n.get(0))return null;o.collapseToStart();const s=i.clone();let r=i.first();for(;r.length>0&&!(o.compareBeforeNode(r)>=0);){const e=r.next();s.append(r),r=e}return i.before(s),i.parent().length>0&&i.parent().get(0)!==n.get(0)?Z(i.parent(),i.index(),n):{left:s,right:i}}function I(e,t){let n=e;for(;n.length>0;){let e=n.first();for(;e.isText&&e.isEmpty;)e=e.next();if(n.isText||n.isBox)break;if(n.isElement&&1===n.children().length&&e.isBookmark){n.prepend(t);break}if(n.isElement&&!n.isVoid&&0===e.length){n.append(t);break}n=e}}function O(e){if(0===e.length)return;const t=[];let n=e.first();for(;n.length>0;){const e=n.next();n.isText&&""===n.text()||t.push(n),n=e}(1===t.length&&"br"===t[0].name||2===t.length&&"br"===t[0].name&&t[1].isBookmark)&&t[0].remove(),2===t.length&&t[0].isBookmark&&"br"===t[1].name&&t[1].remove()}function D(e){if(e.isText)return{node:e,offset:e.text().length};const t=new $;return t.setEndAfter(e),{node:t.endNode,offset:t.endOffset}}function R(e,t){const n=t;if(["ul","ol"].indexOf(e.name)>=0){const t=e.find("li");e=t.eq(t.length-1)}if(["ul","ol"].indexOf(t.name)>=0){const e=t.find("li");t=e.eq(0)}if(e.isText||t.isText||e.isVoid||t.isVoid)return D(e);O(e),O(t),e.isBlock&&e.isEmpty&&t.isEmpty&&I(e,V("<br />"));const o=e.last(),i=t.first();let s=i;for(;s.length>0;){const t=s.next();e.append(s),s=t}return n.remove(),o.length>0&&i.length>0&&o.isElement&&!o.isBox&&o.clone(!1).get(0).isEqualNode(i.clone(!1).get(0))?R(o,i):0===o.length?{node:e,offset:0}:D(o)}function z(e){let t=e;for(;t.length>0;){let e=t.first();if(e.isText&&e.isEmpty&&(e=e.next()),t.isElement&&!t.isVoid&&0===e.length)break;t=e}return t}function j(e,t){if(t=null!=t?t:V("<p />"),0===e.length)return t;const n=z(t=t.clone(!0));return e[0].before(t),e.forEach((e=>{n.append(e)})),t}function P(e){for(const t of e.getWalker())if(t.isText&&t.text().length>1){const e=t.text();/\u200B/.test(t.text())&&(t.get(0).nodeValue=e.replace(/\u200B/g,""))}}function F(e,t){const n=e.get(0),o=V(h`<${t} />`);for(const e of n.attributes)o.attr(e.name,e.value);let i=e.first();for(;i.length>0;){const e=i.next();o.append(i),i=e}return e.replaceWith(o),o}function q(e){if(0===e.length)return;const t=e[0],n=e[e.length-1],o=[];let i=t.prev();for(;i.length>0&&"ol"===i.name;)o.push(i),i=i.prev();o.reverse(),o.push(...e);let s=n.next();for(;s.length>0&&"ol"===s.name;)o.push(s),s=s.next();let r=1;for(const e of o){const t=e.prev();if(0!==t.length&&"ol"===t.name||(r=1),"ol"===e.name){"ol"===t.name&&t.attr("indent")!==e.attr("indent")&&(r=1);const n=e.attr("start"),o=r.toString(10);n!==o&&e.attr("start",o),r++}}}function U(e,t){if(e.isList){let n=Number.parseInt(e.attr("indent"),10)||0;if("increase"===t?n++:n--,n<=0)n=0;else if(n>10)return;return 0===n?e.removeAttr("indent"):e.attr("indent",n.toString(10)),void q([e])}let n=Number.parseInt(e.css("margin-left"),10)||0;"decrease"!==t||0!==n||""===e.css("text-indent")?("increase"===t?n+=40:n-=40,n<=0&&(n=0),0===n?e.css("margin-left",""):e.css("margin-left",`${n}px`)):e.css("text-indent","")}const _=new Set;function W(){}const K={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:W,afterNodeAdded:W,beforeNodeMorphed:W,afterNodeMorphed:W,beforeNodeRemoved:W,afterNodeRemoved:W,beforeAttributeUpdated:W,afterAttributeUpdated:W,beforeChildrenUpdated:W},head:{style:"merge",shouldPreserve:e=>"true"===e.getAttribute("im-preserve"),shouldReAppend:e=>"true"===e.getAttribute("im-re-append"),shouldRemove:W,afterHeadMorphed:W}};function J(e,t){return!e.deadIds.has(t)}function X(e,t,n){return(e.idMap.get(n)||_).has(t)}function G(e,t){const n=e.idMap.get(t)||_;for(const t of n)e.deadIds.add(t)}function Q(e,t,n){const o=e.idMap.get(t)||_;let i=0;for(const t of o)J(e,t)&&X(e,t,n)&&++i;return i}function Y(e,t){const n=e.parentElement,o=e.querySelectorAll("[id]");for(const e of o){let o=e;for(;o!==n&&null!=o;){let n=t.get(o);null==n&&(n=new Set,t.set(o,n)),n.add(e.id),o=o.parentElement}}}function ee(e,t){const n=new Map;return Y(e,n),Y(t,n),n}function te(e,t,n){return{target:e,newContent:t,config:n=function(e){const t={};return Object.assign(t,K),Object.assign(t,e),t.callbacks={},Object.assign(t.callbacks,K.callbacks),Object.assign(t.callbacks,e.callbacks),t.head={},Object.assign(t.head,K.head),Object.assign(t.head,e.head),t}(n),morphStyle:n.morphStyle,ignoreActive:n.ignoreActive,ignoreActiveValue:n.ignoreActiveValue,idMap:ee(e,t),deadIds:new Set,callbacks:n.callbacks,head:n.head}}function ne(e,t,n){return null!=e&&null!=t&&(e.nodeType===t.nodeType&&e.tagName===t.tagName&&(""!==e.id&&e.id===t.id||Q(n,e,t)>0))}function oe(e,t){return null!=e&&null!=t&&(e.nodeType===t.nodeType&&e.tagName===t.tagName)}function ie(e,t){G(t,e),!1!==t.callbacks.beforeNodeRemoved(e)&&(e.remove(),t.callbacks.afterNodeRemoved(e))}function se(e,t,n){let o=e;for(;o&&o!==t;){const e=o;o=o.nextSibling,ie(e,n)}return G(n,t),t.nextSibling}function re(e,t,n,o,i){const s=Q(i,n,t);let r=null;if(s>0){r=o;let t=0;for(;null!=r;){if(ne(n,r,i))return r;if(t+=Q(i,r,e),t>s)return null;r=r.nextSibling}}return r}function ae(e,t,n,o,i){let s=o,r=n.nextSibling,a=0;for(;null!=s;){if(Q(i,s,e)>0)return null;if(oe(n,s))return s;if(oe(r,s)&&(a++,r=r?r.nextSibling:null,a>=2))return null;s=s?s.nextSibling:null}return s}function le(e,t,n){return oe(e,t)?.5+Q(n,e,t):0}function ce(e,t,n,o){return!("value"!==e||!o.ignoreActiveValue||t!==document.activeElement)||!1===o.callbacks.beforeAttributeUpdated(e,t,n)}function de(e,t,n){var o;if(!n.ignoreActive||e!==document.activeElement)return null==t?!1===n.callbacks.beforeNodeRemoved(e)?e:(e.remove(),n.callbacks.afterNodeRemoved(e),null):oe(e,t)?(!1===n.callbacks.beforeNodeMorphed(e,t)||(function(e,t,n){const o=e.nodeType;if(1===o){const o=e.attributes,i=t.attributes;for(const e of o)ce(e.name,t,"update",n)||t.getAttribute(e.name)!==e.value&&(t.setAttribute(e.name,e.value),n.callbacks.afterAttributeUpdated(e.name,t,"update"));for(let o=i.length-1;o>=0;o--){const s=i[o];ce(s.name,t,"remove",n)||e.hasAttribute(s.name)||(t.removeAttribute(s.name),n.callbacks.afterAttributeUpdated(s.name,t,"remove"))}}8!==o&&3!==o||t.nodeValue!==e.nodeValue&&(t.nodeValue=e.nodeValue)}(t,e,n),!1===n.callbacks.beforeChildrenUpdated(e,t)||function(e,t){return t.ignoreActiveValue&&e===document.activeElement}(e,n)||he(t,e,n),n.callbacks.afterNodeMorphed(e,t)),e):!1===n.callbacks.beforeNodeRemoved(e)||!1===n.callbacks.beforeNodeAdded(t)?e:(null===(o=e.parentElement)||void 0===o||o.replaceChild(t,e),n.callbacks.afterNodeAdded(t),n.callbacks.afterNodeRemoved(e),t)}function he(e,t,n){let o,i=e.firstChild,s=t.firstChild;for(;i;){if(o=i,i=o.nextSibling,null==s){if(!1===n.callbacks.beforeNodeAdded(o))return;t.appendChild(o),n.callbacks.afterNodeAdded(o),G(n,o);continue}if(ne(o,s,n)){de(s,o,n),s=s.nextSibling,G(n,o);continue}const r=re(e,t,o,s,n);if(r){s=se(s,r,n),de(r,o,n),G(n,o);continue}const a=ae(e,0,o,s,n);if(a)s=se(s,a,n),de(a,o,n),G(n,o);else{if(!1===n.callbacks.beforeNodeAdded(o))return;t.insertBefore(o,s),n.callbacks.afterNodeAdded(o),G(n,o)}}for(;null!==s;){const e=s;s=s.nextSibling,ie(e,n)}}function ue(e,t,n){if("innerHTML"===n.morphStyle)return he(t,e,n),e.children;if("outerHTML"===n.morphStyle||null==n.morphStyle){const o=function(e,t,n){let o;o=e.firstChild;let i=o,s=0;for(;o;){const e=le(o,t,n);e>s&&(i=o,s=e),o=o.nextSibling}return i}(t,e,n),i=null==o?void 0:o.previousSibling,s=null==o?void 0:o.nextSibling,r=de(e,o,n);return o?function(e,t,n){var o,i;const s=[],r=[];let a=e;for(;null!=a;)s.push(a),a=a.previousSibling;for(;s.length>0;){const e=s.pop();r.push(e),e&&(null===(o=t.parentElement)||void 0===o||o.insertBefore(e,t))}r.push(t);let l=n;for(;null!=l;)s.push(l),r.push(l),l=l.nextSibling;for(;s.length>0;){const e=s.pop();e&&(null===(i=t.parentElement)||void 0===i||i.insertBefore(e,t.nextSibling))}return r}(i,r,s):[]}throw`Do not understand how to morph style ${n.morphStyle}`}function fe(e,t,n={}){const o=function(e){if(null==e)return document.createElement("div");if(e instanceof Node){if(e.generatedByIdiomorph)return e;const t=document.createElement("div");return t.append(e),t}const t=document.createElement("div");for(const n of[...e])t.append(n);return t}(t.get(0)),i=te(e.get(0),o,n);ue(e.get(0),o,i)}function pe(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch(e){return t}}function ge(e){const t=new XMLHttpRequest;e.onProgress&&t.upload&&(t.upload.onprogress=t=>{t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress&&e.onProgress(t)});const n=new FormData,o=e.data||{};Object.keys(o).forEach((e=>{const t=o[e];Array.isArray(t)?t.forEach((t=>{n.append(`${e}[]`,t)})):n.append(e,t)}));const i=e.filename||"file";e.file instanceof Blob?n.append(i,e.file,e.file.name):n.append(i,e.file),t.onerror=t=>{e.onError&&e.onError(t)},t.onload=()=>{if(t.status<200||t.status>=300){if(!e.onError)return;return e.onError(function(e,t){const n=`Cannot ${e.method} ${e.action} ${t.status}'`,o=new Error(n);return o.status=t.status,o.method=e.method,o.url=e.action,o}(e,t),pe(t))}if(e.onSuccess)return e.onSuccess(pe(t),t)},t.open(e.method,e.action,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const s=e.headers||{};return null!==s["X-Requested-With"]&&t.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(s).forEach((e=>{null!==s[e]&&t.setRequestHeader(e,s[e])})),t.send(n),t}var me=Object.freeze({__proto__:null,appendDeepest:I,camelCase:u,changeTagName:F,debug:H,denormalizeValue:x,encode:d,fixNumberedList:q,forEach:k,getCSS:w,getDeepest:z,inString:f,mergeNodes:R,morph:fe,normalizeValue:v,parseStyle:m,query:V,removeBr:O,removeZWS:P,request:ge,safeTemplate:h,setBlockIndent:U,splitNodes:Z,template:l,toHex:g,toNodeList:b,wrapNodeList:j});class ve{constructor(e){this.fragment=null!=e?e:document.createDocumentFragment()}find(e){const t=[];let n=new L(this.fragment.firstChild);for(;n.length>0;)n.matches(e)?t.push(n.get(0)):n.isElement&&n.find(e).each((e=>{t.push(e)})),n=n.next();return new L(t)}append(e){e.each((e=>{this.fragment.appendChild(e)}))}}const xe="function"==typeof Buffer,ke="function"==typeof TextDecoder?new TextDecoder:void 0,we="function"==typeof TextEncoder?new TextEncoder:void 0,be=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),ye=(e=>{let t={};return e.forEach(((e,n)=>t[e]=n)),t})(be),Be=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Ae=String.fromCharCode.bind(String),Ce="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),Se=e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_")),Me=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),Te=e=>{let t,n,o,i,s="";const r=e.length%3;for(let r=0;r<e.length;){if((n=e.charCodeAt(r++))>255||(o=e.charCodeAt(r++))>255||(i=e.charCodeAt(r++))>255)throw new TypeError("invalid character found");t=n<<16|o<<8|i,s+=be[t>>18&63]+be[t>>12&63]+be[t>>6&63]+be[63&t]}return r?s.slice(0,r-3)+"===".substring(r):s},He="function"==typeof btoa?e=>btoa(e):xe?e=>Buffer.from(e,"binary").toString("base64"):Te,Ee=xe?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let n=0,o=e.length;n<o;n+=4096)t.push(Ae.apply(null,e.subarray(n,n+4096)));return He(t.join(""))},Ne=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?Ae(192|t>>>6)+Ae(128|63&t):Ae(224|t>>>12&15)+Ae(128|t>>>6&63)+Ae(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return Ae(240|t>>>18&7)+Ae(128|t>>>12&63)+Ae(128|t>>>6&63)+Ae(128|63&t)},Le=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Ve=e=>e.replace(Le,Ne),$e=xe?e=>Buffer.from(e,"utf8").toString("base64"):we?e=>Ee(we.encode(e)):e=>He(Ve(e)),Ze=(e,t=!1)=>t?Se($e(e)):$e(e),Ie=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Oe=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return Ae(55296+(t>>>10))+Ae(56320+(1023&t));case 3:return Ae((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return Ae((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},De=e=>e.replace(Ie,Oe),Re=e=>{if(e=e.replace(/\s+/g,""),!Be.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,n,o,i="";for(let s=0;s<e.length;)t=ye[e.charAt(s++)]<<18|ye[e.charAt(s++)]<<12|(n=ye[e.charAt(s++)])<<6|(o=ye[e.charAt(s++)]),i+=64===n?Ae(t>>16&255):64===o?Ae(t>>16&255,t>>8&255):Ae(t>>16&255,t>>8&255,255&t);return i},ze="function"==typeof atob?e=>atob(Me(e)):xe?e=>Buffer.from(e,"base64").toString("binary"):Re,je=xe?e=>Ce(Buffer.from(e,"base64")):e=>Ce(ze(e).split("").map((e=>e.charCodeAt(0)))),Pe=xe?e=>Buffer.from(e,"base64").toString("utf8"):ke?e=>ke.decode(je(e)):e=>De(ze(e)),Fe=e=>Me(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),qe=e=>Pe(Fe(e)),Ue=Ze,_e=qe;var We="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ke(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Je={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,o,s,r){if("function"!=typeof o)throw new TypeError("The listener must be a function");var a=new i(o,s||e,r),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function a(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,o,i=[];if(0===this._eventsCount)return i;for(o in e=this._events)t.call(e,o)&&i.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var i=0,s=o.length,r=new Array(s);i<s;i++)r[i]=o[i].fn;return r},a.prototype.listenerCount=function(e){var t=n?n+e:e,o=this._events[t];return o?o.fn?1:o.length:0},a.prototype.emit=function(e,t,o,i,s,r){var a=n?n+e:e;if(!this._events[a])return!1;var l,c,d=this._events[a],h=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),h){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,o),!0;case 4:return d.fn.call(d.context,t,o,i),!0;case 5:return d.fn.call(d.context,t,o,i,s),!0;case 6:return d.fn.call(d.context,t,o,i,s,r),!0}for(c=1,l=new Array(h-1);c<h;c++)l[c-1]=arguments[c];d.fn.apply(d.context,l)}else{var u,f=d.length;for(c=0;c<f;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),h){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,o);break;case 4:d[c].fn.call(d[c].context,t,o,i);break;default:if(!l)for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];d[c].fn.apply(d[c].context,l)}}return!0},a.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,o,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return r(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||i&&!a.once||o&&a.context!==o||r(this,s);else{for(var l=0,c=[],d=a.length;l<d;l++)(a[l].fn!==t||i&&!a[l].once||o&&a[l].context!==o)&&c.push(a[l]);c.length?this._events[s]=1===c.length?c[0]:c:r(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&r(this,t)):(this._events=new o,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}(Je);var Xe=Ke(Je.exports);const Ge=new Map,Qe=new Map,Ye={},et={},tt=h`
2
+ <span class="lake-box-strip"><br /></span>
3
+ <div class="lake-box-container" contenteditable="false"></div>
4
+ <span class="lake-box-strip"><br /></span>
5
+ `;class nt{constructor(e){if(this.event=new Xe,"string"==typeof e){const t=Ge.get(e);if(void 0===t)throw new Error(`Box '${e}' has not been defined yet.`);const n=d(t.type),o=d(t.name);this.node=V(h`<lake-box type="${n}" name="${o}"></lake-box>`),t.value&&(this.value=t.value)}else{this.node=V(e);const t=Ge.get(this.name);if(void 0===t)throw new Error(`Box '${this.name}' has not been defined yet.`);t.value&&!this.node.hasAttr("value")&&(this.value=t.value)}Ye[this.node.id]||(Ye[this.node.id]={}),et[this.node.id]||(et[this.node.id]={setup:[],cleanup:[]})}addFramework(){let e=this.getContainer();0===e.length?(this.node.html(tt),e=this.getContainer()):(e.off("mouseenter"),e.off("mouseleave"),e.off("click")),e.on("mouseenter",(()=>{e.hasClass("lake-box-selected")||e.hasClass("lake-box-focused")||e.hasClass("lake-box-activated")||e.addClass("lake-box-hovered")})),e.on("mouseleave",(()=>{e.removeClass("lake-box-hovered")})),e.on("click",(()=>{H(`Box '${this.name}' (id = ${this.node.id}) value:`),H(this.value)}))}get type(){return this.node.attr("type")}get name(){return this.node.attr("name")}get value(){const e=this.node.attr("value");return""===e?{}:JSON.parse(_e(e))}set value(e){this.node.attr("value",Ue(JSON.stringify(e)))}updateValue(e,t){const n=this.value;"string"==typeof e?n[e]=t:k(e,((e,t)=>{n[e]=t})),this.value=n}getData(e){return Ye[this.node.id][e]}setData(e,t){Ye[this.node.id][e]=t}getEditor(){const e=this.node.closestContainer();return e.length>0?Qe.get(e.id):void 0}getContainer(){return this.node.find(".lake-box-container")}useEffect(e){et[this.node.id].setup.push(e)}render(){et[this.node.id].setup=[],et[this.node.id].cleanup=[];const e=Ge.get(this.name);if(void 0===e)return;this.addFramework();const t=e.render(this);if(void 0!==t){const e=this.getContainer(),n=e.clone(!1);n.append(t),fe(e,n)}for(const e of et[this.node.id].setup){const t=e();void 0!==t&&et[this.node.id].cleanup.push(t)}H(`Box '${this.name}' (id = ${this.node.id}) rendered`)}unmount(){for(const e of et[this.node.id].cleanup)e();Ye[this.node.id]={},et[this.node.id].setup=[],et[this.node.id].cleanup=[],this.node.empty(),H(`Box '${this.name}' (id = ${this.node.id}) unmounted`)}getHTML(){const e=Ge.get(this.name);return void 0===e?"":void 0===e.html?this.node.outerHTML():e.html(this)}}const ot={id:/^[\w-]+$/,class:/^[\w-]+$/,style:{"text-align":["left","center","right","justify"],"margin-left":/^-?\d+px$/i,"text-indent":/^-?\d+em$/i}};function it(){return{h1:Object.assign({},ot),h2:Object.assign({},ot),h3:Object.assign({},ot),h4:Object.assign({},ot),h5:Object.assign({},ot),h6:Object.assign({},ot),p:Object.assign({},ot),blockquote:Object.assign(Object.assign({},ot),{type:["success","info","warning","error"]}),ul:Object.assign(Object.assign({},ot),{type:"checklist",indent:/^\d+$/}),ol:Object.assign(Object.assign({},ot),{start:/^\d+$/,indent:/^\d+$/}),li:{value:["true","false"]},table:{style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/}},tr:{style:{height:/^-?\d+(px|%)$/i}},th:"td",td:{colspan:/^\d+$/,rowspan:/^\d+$/,style:{width:/^-?\d+(px|%)$/i,height:/^-?\d+(px|%)$/i,border:/^[^"]+$/,"border-width":/^-?\d+px$/i,"border-style":/^[\w-]+$/,"border-color":/^[^"]+$/,"background-color":/^[^"]+$/,"text-align":["left","center","right","justify"]}},"lake-box":{type:["inline","block"],name:/^[\w-]+$/,value:/^[^"]+$/,focus:["left","center","right"]},br:{},hr:{},img:{src:/^[^"]+$/,width:/^-?\d+px$/i,height:/^-?\d+px$/i,"data-lake-value":/^[^"]+$/,alt:/^[^"]+$/,style:{width:/^-?\d+px$/i,height:/^-?\d+px$/i}},span:{class:/^[\w-]+$/,style:{color:/^[^"]+$/,"background-color":/^[^"]+$/,"font-family":/^[^;]+$/,"font-size":/^[^"]+$/}},b:"strong",strong:{},em:"i",i:{},u:{},s:{},sub:{},sup:{},code:{},a:{class:/^[\w-]+$/,name:/^[\w-]+$/,href:/^[^"]+$/,target:/^[\w-]+$/,rel:/^[^"]+$/,download:/^[^"]+$/},"lake-bookmark":{type:["anchor","focus"]}}}class st{constructor(e,t=it()){this.rules=t,this.source="string"==typeof e?this.parseHTML(e):e}parseHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");return new L(t.querySelector("body"))}static matchRule(e,t){return"string"==typeof e?e===t:Array.isArray(e)?e.indexOf(t)>=0:e instanceof RegExp&&e.test(t)}static getOpenTagString(e,t){let n=e.name,o=t[n];if(!o)return"";"string"==typeof o&&(n=o,o=t[n]);const i=e.get(0);if(!i.hasAttributes())return n;const s=new Map;for(const e of i.attributes)if(o[e.name]&&("style"!==e.name&&st.matchRule(o[e.name],e.value)&&s.set(e.name,e.value),"style"===e.name)){const t=o.style,n=new Map;k(m(e.value),((e,o)=>{t[e]&&st.matchRule(t[e],o)&&n.set(e,o)})),s.set("style",n)}let r=n;for(const[e,t]of s)if("style"===e){let e="";for(const[n,o]of t)e+=`${n}: ${o.replace(/"/g,"&quot;")}; `;""!==e&&(r+=` style="${e.trim()}"`)}else r+=` ${e}="${t}"`;return r}static getClosedTagString(e,t){let n=e.name;const o=t[n];return o?("string"==typeof o&&(n=o),n):""}static getTrimmedText(e){const t=e.parent(),n=e.prev(),o=e.next();let i=e.text();return(n.isBlock||n.isBlockBox)&&(o.isBlock||o.isBlockBox)||0===n.length&&0===o.length&&t.isBlock?i=i.replace(/^[\u0020\t\r\n]+|[\u0020\t\r\n]+$/g,""):n.isBlock||n.isBlockBox||0===n.length&&t.isBlock?i=i.replace(/^[\u0020\t\r\n]+/,""):(o.isBlock||o.isBlockBox||0===o.length&&t.isBlock)&&(i=i.replace(/[\u0020\t\r\n]+$/,"")),i}getHTML(){const e=this.rules;let t="";for(const n of function*t(n){let o=n.first();for(;o.length>0;){const n=o.next();if(o.isText)yield d(st.getTrimmedText(o));else if(o.isVoid){const t=st.getOpenTagString(o,e);""!==t&&(yield`<${t} />`)}else if(o.isElement){const n=st.getOpenTagString(o,e),i=st.getClosedTagString(o,e);""!==n&&(yield`<${n}>`),o.isBox||(yield*t(o)),""!==i&&(yield`</${i}>`)}o=n}}(this.source))t+=n;return t.trim()}getNodeList(){const e=this.getHTML();return this.parseHTML(e).children()}getFragment(){const e=this.getHTML(),t=this.parseHTML(e),n=document.createDocumentFragment();let o=t.first();for(;o.length>0;){const e=o.next();n.appendChild(o.get(0)),o=e}return n}}class rt{constructor(e){this.content=e}getHTML(){let e=this.content;return e=e.replace(/ {2}/g,"  "),e=d(e.trim()),e=`<p>${e}</p>`,e=e.replace(/(\r\n){2,}/g,"</p><p><br /></p><p>"),e=e.replace(/\r\n/g,"</p><p>"),e=e.replace(/[\r\n]{2,}/g,"</p><p><br /></p><p>"),e=e.replace(/[\r\n]/g,"</p><p>"),e}getFragment(){return new st(this.getHTML()).getFragment()}}function at(e,t){if(e.commonAncestor.isOutside)return;const n=(t=V(t)).get(0),o=e.get();o.insertNode(n),o.setEndAfter(n),o.collapse(!1)}function lt(e){if(e.commonAncestor.isOutside)return{anchor:new L,focus:new L};const t=e.startNode.closest("lake-box");if(t.length>0)return e.isBoxLeft?t.attr("focus","left"):e.isBoxRight?t.attr("focus","right"):t.attr("focus","center"),{anchor:new L,focus:t};if(e.isCollapsed){const t=e.clone();t.collapseToEnd();const n=V('<lake-bookmark type="focus" />');return at(t,n),{anchor:new L,focus:n}}const n=e.clone();n.collapseToStart();const o=V('<lake-bookmark type="anchor" />');at(n,o);const i=e.clone();i.collapseToEnd();const s=V('<lake-bookmark type="focus" />');return at(i,s),{anchor:o,focus:s}}function ct(e,t){const n=e.prev(),o=e.next();if(n.isText&&o.isText){const t=e.parent();P(t),e.remove(),t.get(0).normalize()}else if(0===n.length&&0===o.length){if(e.parent().isMark&&t){const n=new L(document.createTextNode("​"));e.before(n),t.setStartAfter(n),t.collapseToStart()}e.remove()}else e.remove()}function dt(e,t){const n=t.anchor,o=t.focus;if(n.length>0&&0===o.length)ct(n);else{if(o.length>0&&0===n.length){if(o.isBox){const t=new nt(o);0===t.getContainer().length&&t.render();const n=o.attr("focus");return"left"===n?e.selectBoxLeft(o):"center"===n?e.selectBox(o):e.selectBoxRight(o),void o.removeAttr("focus")}return e.setStartBefore(o),e.collapseToStart(),void ct(o,e)}if(n.length>0&&o.length>0){const t=new $;t.selectNode(n),t.collapseToEnd(),-1===t.compareAfterNode(o)?(e.setStartBefore(o),ct(o),e.setEndBefore(n),ct(n)):(e.setStartBefore(n),ct(n),e.setEndBefore(o),ct(o))}}}function ht(e){if(e.commonAncestor.isOutside)return;q(e.getBlocks())}function ut(e){if(e.isCollapsed)return;if(e.adapt(),e.isInoperative)return;const t=e.startNode.closestBlock(),n=e.endNode.closestBlock(),o=t.get(0)===n.get(0);if(e.get().deleteContents(),e.adaptBlock(),o){const t=e.getBlocks()[0];return void(t&&t.isEmpty&&(I(t,V("<br />")),e.shrinkAfter(t)))}const i=e.getBlocks()[0];if(!i)return;const s=i.prev();if(0===s.length)return;const r=lt(e);R(s,i),dt(e,r),ht(e)}function ft(e,t){if(e.commonAncestor.isOutside)return;e.isCollapsed?e.adaptBox():ut(e);O(e.startNode.closestBlock());const n=lt(e);n.focus.before(t),dt(e,n),e.adaptBlock()}function pt(e,t){const n=V(t),o=document.createDocumentFragment();n.each((e=>{o.appendChild(e)})),ft(e,o)}function gt(e,t){if(e.commonAncestor.isOutside)return;if(e.isCollapsed&&e.isBox)return;if("string"!=typeof t){const n=e.getBlocks();for(const e of n)e.css(t);return}const n=V(t),o=n.name,i=n.get(0).attributes,s=e.getBlocks();if(s.length>0){const t=lt(e);for(const e of s)if(e.name===o&&0===n.first().length)for(const t of i)e.attr(t.name,t.value);else{const t=n.clone(!0);e.isList&&""!==e.attr("indent")&&t.attr("indent",e.attr("indent"));const o=z(t);let i=e.first();for(;i.length>0;){const e=i.next();o.append(i),o.name!==i.name&&"li"!==i.name||i.remove(!0),i=e}e.replaceWith(t)}return dt(e,t),void ht(e)}const r=lt(e),a=function(e){const t=e.commonAncestor.closest('div[contenteditable="true"],td');let n=[];if(0===t.length)return n;let o=t.first(),i=!0;for(;o.length>0;){if(o.isMark||o.isText||o.isBookmark||o.isInlineBox)n.push(o);else{if(!i)break;n=[]}e.intersectsNode(o)&&(i=!1),o=o.next()}return n}(e),l=j(a,n);dt(e,r),ht(e),l.isEmpty&&(I(l,V("<br />")),e.shrinkAfter(l))}function mt(e){if(e.commonAncestor.isOutside)return{left:null,right:null};e.isCollapsed?e.adaptBox():ut(e);const t=e.startNode,n=t.closestOperableBlock();if(0===n.length)return{left:null,right:null};let o=n.parent();o.isOutside&&(o=t.closestContainer());const i=Z(t,e.startOffset,o);let s=null,r=null;return i&&(s=i.left,r=i.right),!i&&t.isBlock&&(e.startOffset>0&&(s=t.children()[e.startOffset-1]),r=t.children()[e.startOffset],r&&!r.isBlock&&(r=null)),s&&s.isEmpty&&I(s,V("<br />")),r&&(r.isEmpty?(I(r,V("<br />")),e.shrinkAfter(r)):e.shrinkBefore(r)),ht(e),{left:s,right:r}}function vt(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function xt(e,t,n){let o=null,i=null,s=e.closestBlock();0===s.length&&(s=e.closestContainer());const r=Z(e,t,s);return r&&(n?(vt(r.left),vt(r.right),r.left.isEmpty||(o=r.left),r.right.isEmpty||(i=r.right)):(o=r.left,i=r.right)),{left:o,right:i}}function kt(e,t=!0){if(e.commonAncestor.isOutside)return{left:null,center:null,right:null};if(e.adaptBox(),e.isCollapsed){const n=xt(e.startNode,e.startOffset,t);return n.left?(e.setStartAfter(n.left),e.collapseToStart()):n.right&&(e.setStartBefore(n.right),e.collapseToStart()),{left:n.left,center:null,right:n.right}}const n=xt(e.startNode,e.startOffset,t);n.left?e.setStartAfter(n.left):n.right&&e.setStartBefore(n.right);const o=xt(e.endNode,e.endOffset,t);return o.left?e.setEndAfter(o.left):o.right&&e.setEndBefore(o.right),{left:n.left,center:o.left,right:o.right}}function wt(e,t){const n=e.text();let o=e;for(;o.length>0;){const e=o.parent();if(!e.isMark||n!==e.text()||!o.isText&&o.name===t&&""!==o.attr("style"))break;o=e}return o}function bt(e,t){if(e.commonAncestor.isOutside)return;let n=V(t);const o=n.name,i=m(n.attr("style"));if(e.isCollapsed){if(e.isBox){const t=e.startNode.closest("lake-box");if("block"===new nt(t).type){const n=V("<p><br /></p>");e.isBoxLeft?t.before(n):t.after(n),e.shrinkAfter(n)}else e.adaptBox()}O(e.startNode.closestBlock());const t=new L(document.createTextNode("​")),s=kt(e);if(s.left){const e=function(e){if(!e.isMark)return null;let t=e.clone(),n=e.last();for(;n.length>0;){if(n.isMark){const e=n.clone();t.append(e),t=e}n=n.last()}return t}(s.left);e&&(e.name===o?(e.css(i),n=e):(I(e,t),n.append(e)))}return""===n.text()&&n.append(t),at(e,n),function(e){const t=e.prev();t.length>0&&t.isText&&t.isEmpty&&t.remove();const n=e.next();n.length>0&&n.isText&&n.isEmpty&&n.remove()}(n),void e.shrinkAfter(n)}kt(e);const s=e.getMarks(!0),r=lt(e);for(const e of s)if(!e.isEmpty&&e.isText){const t=wt(e,o);if(t.isMark&&t.name===o)t.css(i);else{const e=n.clone();t.before(e),e.append(t)}}dt(e,r)}function yt(e){if(e.isMark&&e.isEmpty)e.remove();else for(const t of e.getWalker())t.isMark&&t.isEmpty&&t.remove()}function Bt(e,t){if(e.commonAncestor.isOutside)return;let n;if(t){n=V(t).name}if(e.isCollapsed){if(e.isBox)return;if(n&&0===e.commonAncestor.closest(n).length)return;const t=kt(e,!1);if(!t.left)return;t.right&&yt(t.right);const o=new L(document.createTextNode("​")),i=function(e,t){if(!e.isMark||!t)return null;let n=e.clone(),o=e.last();for(;o.length>0;){if(o.isMark&&o.name!==t){const e=o.clone();n.append(e),n=e}o=o.last()}if(n.name===t){if(!(n.first().length>0))return null;n=n.first()}return n}(t.left,n);return i?(I(i,o),t.left.after(i),yt(t.left),void e.shrinkAfter(i)):(t.left.after(o),yt(t.left),o.prev().isText?(e.setStartAfter(o.prev()),e.collapseToStart(),void o.remove()):(e.setStartAfter(o),void e.collapseToStart()))}kt(e);const o=e.getMarks(),i=lt(e);for(const e of o)if(!n||e.name===n){const t=e.parent();e.remove(!e.isEmpty),t.length>0&&t.get(0).normalize()}P(e.commonAncestor),dt(e,i)}function At(e,t){if(e.commonAncestor.isOutside)return null;const n=V(t);if(e.isCollapsed){let t=e.commonAncestor.closest("a");if(0===t.length){t=n.clone(!0);return O(e.startNode.closestBlock()),at(e,t),t}return""!==n.attr("href")&&t.attr({href:n.attr("href")}),t}kt(e);const o=lt(e);for(const t of e.commonAncestor.getWalker())"a"===t.name&&e.intersectsNode(t)&&t.remove(!0);const i=n.clone(!1);o.anchor.after(i);let s=i.next();for(;s.length>0;){const e=s.next();if(!s.isMark&&!s.isText)break;i.append(s),s=e}return 0===i.first().length&&i.remove(),dt(e,o),i}var Ct=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},St="object"==typeof We&&We&&We.Object===Object&&We,Mt="object"==typeof self&&self&&self.Object===Object&&self,Tt=St||Mt||Function("return this")(),Ht=Tt,Et=function(){return Ht.Date.now()},Nt=/\s/;var Lt=function(e){for(var t=e.length;t--&&Nt.test(e.charAt(t)););return t},Vt=Lt,$t=/^\s+/;var Zt=function(e){return e?e.slice(0,Vt(e)+1).replace($t,""):e},It=Tt.Symbol,Ot=It,Dt=Object.prototype,Rt=Dt.hasOwnProperty,zt=Dt.toString,jt=Ot?Ot.toStringTag:void 0;var Pt=function(e){var t=Rt.call(e,jt),n=e[jt];try{e[jt]=void 0;var o=!0}catch(e){}var i=zt.call(e);return o&&(t?e[jt]=n:delete e[jt]),i},Ft=Object.prototype.toString;var qt=Pt,Ut=function(e){return Ft.call(e)},_t=It?It.toStringTag:void 0;var Wt=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_t&&_t in Object(e)?qt(e):Ut(e)},Kt=function(e){return null!=e&&"object"==typeof e};var Jt=Zt,Xt=Ct,Gt=function(e){return"symbol"==typeof e||Kt(e)&&"[object Symbol]"==Wt(e)},Qt=/^[-+]0x[0-9a-f]+$/i,Yt=/^0b[01]+$/i,en=/^0o[0-7]+$/i,tn=parseInt;var nn=Ct,on=Et,sn=function(e){if("number"==typeof e)return e;if(Gt(e))return NaN;if(Xt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Jt(e);var n=Yt.test(e);return n||en.test(e)?tn(e.slice(2),n?2:8):Qt.test(e)?NaN:+e},rn=Math.max,an=Math.min;var ln=function(e,t,n){var o,i,s,r,a,l,c=0,d=!1,h=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=o,s=i;return o=i=void 0,c=t,r=e.apply(s,n)}function p(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-c>=s}function g(){var e=on();if(p(e))return m(e);a=setTimeout(g,function(e){var n=t-(e-l);return h?an(n,s-(e-c)):n}(e))}function m(e){return a=void 0,u&&o?f(e):(o=i=void 0,r)}function v(){var e=on(),n=p(e);if(o=arguments,i=this,l=e,n){if(void 0===a)return function(e){return c=e,a=setTimeout(g,t),d?f(e):r}(l);if(h)return clearTimeout(a),a=setTimeout(g,t),f(l)}return void 0===a&&(a=setTimeout(g,t)),r}return t=sn(t)||0,nn(n)&&(d=!!n.leading,s=(h="maxWait"in n)?rn(sn(n.maxWait)||0,t):s,u="trailing"in n?!!n.trailing:u),v.cancel=function(){void 0!==a&&clearTimeout(a),c=0,o=l=i=a=void 0},v.flush=function(){return void 0===a?r:m(on())},v},cn=Ke(ln),dn="0.0.2";function hn(e){const t=e.get(0),n={};if(t.hasAttributes())for(const e of t.attributes)n[e.name]=e.value;return n}class un{constructor(e){const t=window.getSelection();if(!t)throw new Error("Selection object is null.");this.selection=t,this.container=e,this.range=this.getRangeFromNativeSelection(),this.appliedItems=[]}getRangeFromNativeSelection(){if(this.selection.rangeCount>0){const e=this.selection.getRangeAt(0);return new $(e)}return new $}addRangeToNativeSelection(){this.selection.removeAllRanges(),this.selection.addRange(this.range.get())}syncByRange(){const e=this.getRangeFromNativeSelection();this.range.get()!==e.get()&&(this.range=e)}synByBookmark(){const e=this.range,t=this.container,n=t.find("lake-box[focus]");if(n.length>0)return dt(e,{anchor:new L,focus:n}),void this.addRangeToNativeSelection();dt(e,{anchor:t.find('lake-bookmark[type="anchor"]'),focus:t.find('lake-bookmark[type="focus"]')}),this.addRangeToNativeSelection()}getAppliedItems(){const e=[];return function(e,t){let n=t.startNode;for(n.isText&&(n=n.parent());n.length>0&&n.isInside;)e.push({node:n,name:n.name,attributes:hn(n),styles:m(n.attr("style"))}),n=n.parent()}(e,this.range),function(e,t){const n=t.startNode;let o;if(n.isText&&n.text().length===t.startOffset){const e=n.next();e.length>0&&e.isElement&&(o=e)}if(n.isElement){const e=n.children();if(e.length>0){const n=e[t.startOffset];n&&n.isElement&&(o=n)}}if(o){let t=o;for(;t.length>0;)t.isElement&&e.push({node:t,name:t.name,attributes:hn(t),styles:m(t.attr("style"))}),t=t.first()}}(e,this.range),e}insertBookmark(){return lt(this.range)}toBookmark(e){return dt(this.range,e)}insertNode(e){return at(this.range,e)}insertFragment(e){return ft(this.range,e)}insertContents(e){return pt(this.range,e)}deleteContents(){return ut(this.range)}setBlocks(e){return gt(this.range,e)}splitBlock(){return mt(this.range)}splitMarks(e){return kt(this.range,e)}addMark(e){return bt(this.range,e)}removeMark(e){return Bt(this.range,e)}fixList(){return ht(this.range)}insertLink(e){return At(this.range,e)}}class fn{constructor(){this.commandMap=new Map,this.event=new Xe}add(e,t){this.commandMap.set(e,t)}getNames(){return Array.from(this.commandMap.keys())}execute(e,...t){const n=this.commandMap.get(e);if(void 0===n)throw new Error(`Command '${e}' does not exist.`);this.event.emit("beforeexecute",e),n.apply(this,t),this.event.emit("execute",e),H(`Command '${e}' executed`)}}var pn,gn={exports:{}};pn=gn,function(e){function t(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function n(e,n,o,i,s,r){return t((a=t(t(n,e),t(i,r)))<<(l=s)|a>>>32-l,o);var a,l}function o(e,t,o,i,s,r,a){return n(t&o|~t&i,e,t,s,r,a)}function i(e,t,o,i,s,r,a){return n(t&i|o&~i,e,t,s,r,a)}function s(e,t,o,i,s,r,a){return n(t^o^i,e,t,s,r,a)}function r(e,t,o,i,s,r,a){return n(o^(t|~i),e,t,s,r,a)}function a(e,n){var a,l,c,d,h;e[n>>5]|=128<<n%32,e[14+(n+64>>>9<<4)]=n;var u=1732584193,f=-271733879,p=-1732584194,g=271733878;for(a=0;a<e.length;a+=16)l=u,c=f,d=p,h=g,u=o(u,f,p,g,e[a],7,-680876936),g=o(g,u,f,p,e[a+1],12,-389564586),p=o(p,g,u,f,e[a+2],17,606105819),f=o(f,p,g,u,e[a+3],22,-1044525330),u=o(u,f,p,g,e[a+4],7,-176418897),g=o(g,u,f,p,e[a+5],12,1200080426),p=o(p,g,u,f,e[a+6],17,-1473231341),f=o(f,p,g,u,e[a+7],22,-45705983),u=o(u,f,p,g,e[a+8],7,1770035416),g=o(g,u,f,p,e[a+9],12,-1958414417),p=o(p,g,u,f,e[a+10],17,-42063),f=o(f,p,g,u,e[a+11],22,-1990404162),u=o(u,f,p,g,e[a+12],7,1804603682),g=o(g,u,f,p,e[a+13],12,-40341101),p=o(p,g,u,f,e[a+14],17,-1502002290),u=i(u,f=o(f,p,g,u,e[a+15],22,1236535329),p,g,e[a+1],5,-165796510),g=i(g,u,f,p,e[a+6],9,-1069501632),p=i(p,g,u,f,e[a+11],14,643717713),f=i(f,p,g,u,e[a],20,-373897302),u=i(u,f,p,g,e[a+5],5,-701558691),g=i(g,u,f,p,e[a+10],9,38016083),p=i(p,g,u,f,e[a+15],14,-660478335),f=i(f,p,g,u,e[a+4],20,-405537848),u=i(u,f,p,g,e[a+9],5,568446438),g=i(g,u,f,p,e[a+14],9,-1019803690),p=i(p,g,u,f,e[a+3],14,-187363961),f=i(f,p,g,u,e[a+8],20,1163531501),u=i(u,f,p,g,e[a+13],5,-1444681467),g=i(g,u,f,p,e[a+2],9,-51403784),p=i(p,g,u,f,e[a+7],14,1735328473),u=s(u,f=i(f,p,g,u,e[a+12],20,-1926607734),p,g,e[a+5],4,-378558),g=s(g,u,f,p,e[a+8],11,-2022574463),p=s(p,g,u,f,e[a+11],16,1839030562),f=s(f,p,g,u,e[a+14],23,-35309556),u=s(u,f,p,g,e[a+1],4,-1530992060),g=s(g,u,f,p,e[a+4],11,1272893353),p=s(p,g,u,f,e[a+7],16,-155497632),f=s(f,p,g,u,e[a+10],23,-1094730640),u=s(u,f,p,g,e[a+13],4,681279174),g=s(g,u,f,p,e[a],11,-358537222),p=s(p,g,u,f,e[a+3],16,-722521979),f=s(f,p,g,u,e[a+6],23,76029189),u=s(u,f,p,g,e[a+9],4,-640364487),g=s(g,u,f,p,e[a+12],11,-421815835),p=s(p,g,u,f,e[a+15],16,530742520),u=r(u,f=s(f,p,g,u,e[a+2],23,-995338651),p,g,e[a],6,-198630844),g=r(g,u,f,p,e[a+7],10,1126891415),p=r(p,g,u,f,e[a+14],15,-1416354905),f=r(f,p,g,u,e[a+5],21,-57434055),u=r(u,f,p,g,e[a+12],6,1700485571),g=r(g,u,f,p,e[a+3],10,-1894986606),p=r(p,g,u,f,e[a+10],15,-1051523),f=r(f,p,g,u,e[a+1],21,-2054922799),u=r(u,f,p,g,e[a+8],6,1873313359),g=r(g,u,f,p,e[a+15],10,-30611744),p=r(p,g,u,f,e[a+6],15,-1560198380),f=r(f,p,g,u,e[a+13],21,1309151649),u=r(u,f,p,g,e[a+4],6,-145523070),g=r(g,u,f,p,e[a+11],10,-1120210379),p=r(p,g,u,f,e[a+2],15,718787259),f=r(f,p,g,u,e[a+9],21,-343485551),u=t(u,l),f=t(f,c),p=t(p,d),g=t(g,h);return[u,f,p,g]}function l(e){var t,n="",o=32*e.length;for(t=0;t<o;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function c(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var o=8*e.length;for(t=0;t<o;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function d(e){var t,n,o="0123456789abcdef",i="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),i+=o.charAt(t>>>4&15)+o.charAt(15&t);return i}function h(e){return unescape(encodeURIComponent(e))}function u(e){return function(e){return l(a(c(e),8*e.length))}(h(e))}function f(e,t){return function(e,t){var n,o,i=c(e),s=[],r=[];for(s[15]=r[15]=void 0,i.length>16&&(i=a(i,8*e.length)),n=0;n<16;n+=1)s[n]=909522486^i[n],r[n]=1549556828^i[n];return o=a(s.concat(c(t)),512+8*t.length),l(a(r.concat(o),640))}(h(e),h(t))}function p(e,t,n){return t?n?f(t,e):d(f(t,e)):n?u(e):d(u(e))}pn.exports?pn.exports=p:e.md5=p}(We);var mn=Ke(gn.exports);const vn=new Map;class xn{constructor(e){this.selection=e,this.container=e.container,this.list=[],this.index=0,this.canSave=!0,this.limit=100,this.event=new Xe}removeBookmark(e){return e.replace(/(<lake-box[^>]+)\s+focus="\w+"([^>]*>)/gi,"$1$2").replace(/<lake-bookmark\s+type="anchor">\s*<\/lake-bookmark>/gi,"").replace(/<lake-bookmark\s+type="focus">\s*<\/lake-bookmark>/gi,"")}getValue(e){return new st(e).getHTML()}addIdToBoxes(e){e.find("lake-box").each((e=>{const t=new L(e),n=mn(`${t.attr("type")}-${t.attr("name")}-${t.attr("value")}`);t.attr("id",n)}))}removeIdfromBoxes(e){e.find("lake-box").each((e=>{new L(e).removeAttr("id")}))}morphContainer(e){const t=this.container,n={beforeChildrenUpdated:e=>{if("lake-box"===new L(e).name)return!1},afterAttributeUpdated:(e,n)=>{const o=new L(n);if("value"===e&&"lake-box"===o.name){const e=vn.get(t.id);if(!e)return;e.delete(o.id)}}},o=e.clone(!0);this.addIdToBoxes(t),this.addIdToBoxes(o),fe(t,o,{callbacks:n}),this.removeIdfromBoxes(t),this.removeIdfromBoxes(o)}cloneContainer(){const e=this.selection.range,t=this.container.clone(!0);if(t.find("lake-box").each((e=>{new nt(e).getContainer().empty()})),e.commonAncestor.isOutside)return t;if(e.isInsideBox)return t;const n=e.startNode.path(),o=e.endNode.path(),i=t.find(n),s=t.find(o),r=e.clone();return r.setStart(i,e.startOffset),r.setEnd(s,e.endOffset),lt(r),t}get count(){return this.list.length}get canUndo(){return this.index>1&&!!this.list[this.index-1]}get canRedo(){return!!this.list[this.index]}undo(){if(!this.list[this.index-1])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index>0;){const t=this.list[this.index-1];if(!t)break;const n=this.getValue(t);if(this.removeBookmark(n)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("undo",n);break}if(1===this.index)break;this.index--}this.selection.synByBookmark(),H(`History undone, the last index is ${this.index}`)}redo(){if(!this.list[this.index])return;this.selection.insertBookmark();const e=this.getValue(this.container);for(;this.index<this.list.length;){const t=this.list[this.index];if(!t)break;this.index++;const n=this.getValue(t);if(this.removeBookmark(n)!==this.removeBookmark(e)){this.morphContainer(t),this.event.emit("redo",n);break}}this.selection.synByBookmark(),H(`History redone, the last index is ${this.index}`)}continue(){this.canSave=!0}pause(){this.canSave=!1}save(){if(!this.canSave)return;const e=this.cloneContainer(),t=this.getValue(e);this.list[this.index-1]&&this.removeBookmark(this.getValue(this.list[this.index-1]))===this.removeBookmark(t)||(this.list.splice(this.index,1/0,e),this.index++,this.list.length>this.limit&&(this.list.shift(),this.index=this.list.length),this.event.emit("save",t),H(`History saved, the last index is ${this.index}`))}}var kn=["Shift","Meta","Alt","Control"],wn="object"==typeof navigator?navigator.platform:"",bn=/Mac|iPod|iPhone|iPad/.test(wn),yn=bn?"Meta":"Control",Bn="Win32"===wn?["Control","Alt"]:bn?["Alt"]:[];function An(e,t){return"function"==typeof e.getModifierState&&(e.getModifierState(t)||Bn.includes(t)&&e.getModifierState("AltGraph"))}function Cn(e){return e.trim().split(" ").map((function(e){var t=e.split(/\b\+/),n=t.pop();return[t=t.map((function(e){return"$mod"===e?yn:e})),n]}))}function Sn(e,t){var n;void 0===t&&(t={});var o=null!=(n=t.timeout)?n:1e3,i=Object.keys(e).map((function(t){return[Cn(t),e[t]]})),s=new Map,r=null;return function(e){e instanceof KeyboardEvent&&(i.forEach((function(t){var n=t[0],o=t[1],i=s.get(n)||n;!function(e,t){return!(t[1].toUpperCase()!==e.key.toUpperCase()&&t[1]!==e.code||t[0].find((function(t){return!An(e,t)}))||kn.find((function(n){return!t[0].includes(n)&&t[1]!==n&&An(e,n)})))}(e,i[0])?An(e,e.key)||s.delete(n):i.length>1?s.set(n,i.slice(1)):(s.delete(n),o(e))})),r&&clearTimeout(r),r=setTimeout(s.clear.bind(s),o))}}const Mn=new Map([["#","shift+#"]]);class Tn{constructor(e){this.container=e,this.keydownEventList=[],this.keyupEventList=[]}normalizeType(e){var t;return e=(e=null!==(t=Mn.get(e))&&void 0!==t?t:e).replace(/(^|\+|\s)mod(\+|\s|$)/g,"$1$mod$2").replace(/shift|control|alt|meta|enter|tab|backspace|delete|space|escape|arrow-left|arrow-right|arrow-up|arrow-down/,(e=>e.charAt(0).toUpperCase()+u(e.substring(1)))).replace(/(^|\+|\s)([a-z])(\+|\s|$)/g,((e,t,n,o)=>`${t}Key${n.toUpperCase()}${o}`))}setKeydown(e,t){const n=Sn({[e=this.normalizeType(e)]:e=>t(e)});this.keydownEventList.push({type:e,listener:t}),this.container.on("keydown",n)}setKeyup(e,t){const n=Sn({[e=this.normalizeType(e)]:e=>t(e)});this.keyupEventList.push({type:e,listener:t}),this.container.on("keyup",n)}keydown(e){e=this.normalizeType(e);for(const t of this.keydownEventList)t.type===e&&t.listener(new Event(e))}keyup(e){e=this.normalizeType(e);for(const t of this.keyupEventList)t.type===e&&t.listener(new Event(e))}}const Hn={value:"<p><br /><focus /></p>",readonly:!1,spellcheck:!1,minChangeSize:5,imageRequestMethod:"POST",imageRequestAction:"/upload",imageRequestTypes:["image/gif","image/jpeg","image/png","image/svg+xml"]};class En{constructor(e){if(!e.root)throw new Error("The root of the config must be specified.");this.root=V(e.root),this.config=Object.assign(Object.assign({},Hn),e),this.containerWrapper=V('<div class="lake-container-wrapper" />'),this.container=V('<div class="lake-container" />'),this.overlayContainer=V('<div class="lake-overlay" />'),this.popupContainer=V('<div class="lake-popup lake-custom-properties" />'),this.isComposing=!1,this.readonly=this.config.readonly,this.root.addClass("lake-custom-properties"),this.container.attr({contenteditable:this.readonly?"false":"true",spellcheck:this.config.spellcheck?"true":"false"}),this.event=new Xe,this.selection=new un(this.container),this.command=new fn,this.history=new xn(this.selection),this.keystroke=new Tn(this.container),this.box=En.box,this.unsavedInputData="",Qe.set(this.container.id,this),this.beforeunloadListener=()=>{this.commitUnsavedInputData()};const t=cn((()=>{if(0===this.root.first().length)return;const e=this.selection.range,t=e.clone();t.adaptBox(),this.box.findAll(this).each((n=>{const o=new nt(n),i=o.getContainer();if(0!==i.length){if(e.compareBeforeNode(i)<0&&e.compareAfterNode(i)>0&&(!e.isCollapsed||e.startNode.get(0)!==i.get(0)||0!==e.startOffset))return i.removeClass("lake-box-selected"),i.removeClass("lake-box-focused"),void i.addClass("lake-box-activated");if(t.intersectsNode(o.node))return i.removeClass("lake-box-activated"),void(e.isCollapsed?(i.removeClass("lake-box-selected"),i.addClass("lake-box-focused")):(i.removeClass("lake-box-focused"),i.addClass("lake-box-selected")));i.removeClass("lake-box-activated"),i.removeClass("lake-box-focused"),i.removeClass("lake-box-selected")}}))}),50,{leading:!1,trailing:!0,maxWait:50});this.selectionchangeListener=()=>{this.selection.syncByRange(),this.selection.appliedItems=this.selection.getAppliedItems(),t(),this.event.emit("selectionchange")},this.clickListener=e=>{const t=new L(e.target);this.event.emit("click",t)},this.mouseoverListener=e=>{const t=new L(e.target);this.event.emit("mouseover",t)},this.resizeListener=()=>{this.event.emit("resize")}}inputInBoxStrip(){const e=this.selection,t=e.range,n=t.startNode.closest(".lake-box-strip"),o=n.closest("lake-box");if("inline"===new nt(o).type)t.isBoxLeft?(t.setStartBefore(o),t.collapseToStart()):(t.setStartAfter(o),t.collapseToStart());else{const e=V("<p />");t.isBoxLeft?o.before(e):o.after(e),t.shrinkAfter(e)}const i=n.text();n.html("<br />"),e.insertNode(document.createTextNode(i))}bindInputEvents(){this.container.on("compositionstart",(()=>{this.isComposing=!0})),this.container.on("compositionend",(()=>{this.isComposing=!1})),this.container.on("beforeinput",(()=>{const e=this.selection.range;(e.isBoxLeft||e.isBoxRight)&&this.commitUnsavedInputData()})),this.container.on("input",(e=>{const t=e;window.setTimeout((()=>{var e;const n=this.selection.range;if(!n.isInsideBox)if(this.isComposing)this.event.emit("input",t);else{if("insertText"===t.inputType||"insertCompositionText"===t.inputType)if(n.isBoxLeft||n.isBoxRight)this.inputInBoxStrip();else if(this.unsavedInputData+=null!==(e=t.data)&&void 0!==e?e:"",this.unsavedInputData.length<this.config.minChangeSize)return void this.event.emit("input",t);this.history.save(),this.unsavedInputData="",this.event.emit("input",t)}}),0)})),this.command.event.on("beforeexecute",(()=>this.commitUnsavedInputData()))}bindHistoryEvents(){this.history.event.on("undo",(e=>{this.box.renderAll(this),this.event.emit("change",e)})),this.history.event.on("redo",(e=>{this.box.renderAll(this),this.event.emit("change",e)})),this.history.event.on("save",(e=>{this.box.rectifyInstances(this),this.event.emit("change",e)}))}commitUnsavedInputData(){this.unsavedInputData.length>0&&(this.history.save(),this.unsavedInputData="")}prepareOperation(){this.commitUnsavedInputData(),this.history.pause()}commitOperation(){this.history.continue(),this.history.save()}focus(){this.container.focus()}blur(){this.container.blur()}setValue(e){e=v(e);const t=new st(e).getFragment();this.container.empty(),this.container.append(t),En.box.renderAll(this),this.selection.synByBookmark()}getValue(){const e=this.selection.insertBookmark();let t=new st(this.container).getHTML();return t=x(t),this.selection.toBookmark(e),t}insertBox(e,t){const n=function(e,t,n){if(e.commonAncestor.isOutside)return null;const o=new nt(t);n&&(o.value=n);const i=document.createDocumentFragment();if(i.appendChild(o.node.get(0)),"inline"===o.type)return ft(e,i),o.render(),e.selectBoxRight(o.node),o;const s=mt(e);return s.left&&(e.setEndAfter(s.left),e.collapseToEnd()),s.right&&s.right.isEmpty&&s.right.remove(),ft(e,i),o.render(),e.selectBoxRight(o.node),s.left&&s.left.isEmpty&&s.left.remove(),o}(this.selection.range,e,t);if(!n)return n;return this.box.getInstances(this).set(n.node.id,n),n}removeBox(){const e=function(e){if(e.commonAncestor.isOutside)return null;const t=e.commonAncestor.closest("lake-box");if(0===t.length)return null;const n=new nt(t);if("block"===n.type){const o=V("<p><br /></p>");return t.before(o),e.shrinkAfter(o),n.unmount(),t.remove(),n}e.setStartBefore(t),e.collapseToStart();const o=t.parent();return n.unmount(),t.remove(),o.isEmpty&&(I(o,V("<br />")),e.shrinkAfter(o)),n}(this.selection.range);if(e){this.box.getInstances(this).delete(e.node.id)}return e}innerWidth(){const e=parseInt(this.container.computedCSS("padding-left"),10)||0,t=parseInt(this.container.computedCSS("padding-right"),10)||0;return this.container.width()-e-t}render(){const e=v(this.config.value),t=new st(e).getFragment();this.root.empty(),this.root.append(this.containerWrapper),this.containerWrapper.append(this.container),this.containerWrapper.append(this.overlayContainer),V(document.body).append(this.popupContainer),this.container.append(t),this.readonly||(this.focus(),this.selection.synByBookmark(),this.history.save()),En.plugin.loadAll(this),En.box.renderAll(this),this.readonly||(window.addEventListener("beforeunload",this.beforeunloadListener),document.addEventListener("selectionchange",this.selectionchangeListener),this.bindInputEvents(),this.bindHistoryEvents()),document.addEventListener("click",this.clickListener),document.addEventListener("mouseover",this.mouseoverListener),window.addEventListener("resize",this.resizeListener)}unmount(){this.root.empty(),this.popupContainer.remove(),this.readonly||(window.removeEventListener("beforeunload",this.beforeunloadListener),document.removeEventListener("selectionchange",this.selectionchangeListener)),document.removeEventListener("click",this.clickListener),document.removeEventListener("mouseover",this.mouseoverListener),window.removeEventListener("resize",this.resizeListener)}}En.version=dn,En.box=new class{add(e){Ge.set(e.name,e)}remove(e){Ge.delete(e)}getNames(){return Array.from(Ge.keys())}getInstances(e){let t=vn.get(e.container.id);return t||(t=new Map,vn.set(e.container.id,t),t)}rectifyInstances(e){const t=this.getInstances(e);for(const e of t.values())e.node.get(0).isConnected||(e.unmount(),t.delete(e.node.id))}findAll(e){return e.container.find("lake-box")}renderAll(e){this.rectifyInstances(e);const t=this.getInstances(e);this.findAll(e).each((e=>{const n=new L(e);if(t.get(n.id))return;const o=new nt(n);o.render(),t.set(o.node.id,o)}))}},En.plugin=new class{constructor(){this.pluginList=[]}add(e){this.pluginList.push(e)}loadAll(e){this.pluginList.forEach((t=>{t(e)}))}};const Nn=[{icon:a.get("numberedList"),value:"numbered",text:"Numbered list"},{icon:a.get("bulletedList"),value:"bulleted",text:"Bulleted list"},{icon:a.get("checklist"),value:"checklist",text:"Checklist"}],Ln=[{icon:a.get("alignLeft"),value:"left",text:"Align left"},{icon:a.get("alignCenter"),value:"center",text:"Align center"},{icon:a.get("alignRight"),value:"right",text:"Align right"},{icon:a.get("alignJustify"),value:"justify",text:"Align justify"}],Vn=[{icon:a.get("increaseIndent"),value:"increase",text:"Increase indent"},{icon:a.get("decreaseIndent"),value:"decrease",text:"Decrease indent"}],$n=[{icon:a.get("italic"),value:"italic",text:"Italic"},{icon:a.get("underline"),value:"underline",text:"Underline"},{icon:a.get("strikethrough"),value:"strikethrough",text:"Strikethrough"},{icon:a.get("superscript"),value:"superscript",text:"Superscript"},{icon:a.get("subscript"),value:"subscript",text:"Subscript"},{icon:a.get("code"),value:"code",text:"Code"}],Zn=["#f5222d","#fa541c","#fa8c16","#faad14","#fadb14","#a0d911","#52c41a","#13c2c2","#1677ff","#2f54eb","#722ed1","#eb2f96","#fff1f0","#fff2e8","#fff7e6","#fffbe6","#feffe6","#fcffe6","#f6ffed","#e6fffb","#e6f4ff","#f0f5ff","#f9f0ff","#fff0f6","#ffccc7","#ffd8bf","#ffe7ba","#fff1b8","#ffffb8","#f4ffb8","#d9f7be","#b5f5ec","#bae0ff","#d6e4ff","#efdbff","#ffd6e7","#ffa39e","#ffbb96","#ffd591","#ffe58f","#fffb8f","#eaff8f","#b7eb8f","#87e8de","#91caff","#adc6ff","#d3adf7","#ffadd2","#ff7875","#ff9c6e","#ffc069","#ffd666","#fff566","#d3f261","#95de64","#5cdbd3","#69b1ff","#85a5ff","#b37feb","#ff85c0","#ff4d4f","#ff7a45","#ffa940","#ffc53d","#ffec3d","#bae637","#73d13d","#36cfc9","#4096ff","#597ef7","#9254de","#f759ab","#cf1322","#d4380d","#d46b08","#d48806","#d4b106","#7cb305","#389e0d","#08979c","#0958d9","#1d39c4","#531dab","#c41d7f","#a8071a","#ad2102","#ad4e00","#ad6800","#ad8b00","#5b8c00","#237804","#006d75","#003eb3","#10239e","#391085","#9e1068","#820014","#871400","#873800","#874d00","#876800","#3f6600","#135200","#00474f","#002c8c","#061178","#22075e","#780650","#5c0011","#610b00","#612500","#613400","#614700","#254000","#092b00","#002329","#001d66","#030852","#120338","#520339","#000000","#1f1f1f","#262626","#434343","#595959","#8c8c8c","#bfbfbf","#d9d9d9","#f0f0f0","#f5f5f5","#fafafa","#ffffff"],In=[{icon:a.get("removeFormat"),value:"",text:"Remove color"}];for(const e of Zn)In.push({value:e.toLowerCase(),text:e.toUpperCase()});const On=new Map([["strong","bold"],["em","italic"],["i","italic"],["u","underline"],["s","strikethrough"],["sup","superscript"],["sub","subscript"],["code","code"]]),Dn=[{name:"undo",type:"button",icon:a.get("undo"),tooltip:"Undo",onClick:(e,t)=>{e.command.execute(t)}},{name:"redo",type:"button",icon:a.get("redo"),tooltip:"Redo",onClick:(e,t)=>{e.command.execute(t)}},{name:"selectAll",type:"button",icon:a.get("selectAll"),tooltip:"Select all",onClick:(e,t)=>{e.command.execute(t)}},{name:"paragraph",type:"button",icon:a.get("paragraph"),tooltip:"Paragraph",isSelected:e=>!!e.find((e=>"p"===e.name)),onClick:e=>{e.command.execute("heading","p")}},{name:"blockQuote",type:"button",icon:a.get("blockQuote"),tooltip:"Block quotation",isSelected:e=>!!e.find((e=>"blockquote"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"numberedList",type:"button",icon:a.get("numberedList"),tooltip:"Numbered list",isSelected:e=>!!e.find((e=>"ol"===e.name)),onClick:e=>{e.command.execute("list","numbered")}},{name:"bulletedList",type:"button",icon:a.get("bulletedList"),tooltip:"Bulleted list",isSelected:e=>!!e.find((e=>"ul"===e.name&&!e.node.hasAttr("type"))),onClick:e=>{e.command.execute("list","bulleted")}},{name:"checklist",type:"button",icon:a.get("checklist"),tooltip:"Checklist",isSelected:e=>!!e.find((e=>"ul"===e.name&&"checklist"===e.node.attr("type"))),onClick:e=>{e.command.execute("list","checklist")}},{name:"alignLeft",type:"button",icon:a.get("alignLeft"),tooltip:"Align left",isSelected:e=>!!e.find((e=>e.node.isBlock&&"left"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","left")}},{name:"alignCenter",type:"button",icon:a.get("alignCenter"),tooltip:"Align center",isSelected:e=>!!e.find((e=>e.node.isBlock&&"center"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","center")}},{name:"alignRight",type:"button",icon:a.get("alignRight"),tooltip:"Align right",isSelected:e=>!!e.find((e=>e.node.isBlock&&"right"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","right")}},{name:"alignJustify",type:"button",icon:a.get("alignJustify"),tooltip:"Align justify",isSelected:e=>!!e.find((e=>e.node.isBlock&&"justify"===e.node.css("text-align"))),onClick:e=>{e.command.execute("align","justify")}},{name:"increaseIndent",type:"button",icon:a.get("increaseIndent"),tooltip:"Increase indent",onClick:e=>{e.command.execute("indent","increase")}},{name:"decreaseIndent",type:"button",icon:a.get("decreaseIndent"),tooltip:"Decrease indent",onClick:e=>{e.command.execute("indent","decrease")}},{name:"bold",type:"button",icon:a.get("bold"),tooltip:"Bold",isDisabled:e=>!!e.find((e=>e.node.isHeading)),isSelected:e=>!!e.find((e=>"strong"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"italic",type:"button",icon:a.get("italic"),tooltip:"Italic",isSelected:e=>!!e.find((e=>"i"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"underline",type:"button",icon:a.get("underline"),tooltip:"Underline",isSelected:e=>!!e.find((e=>"u"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"strikethrough",type:"button",icon:a.get("strikethrough"),tooltip:"Strikethrough",isSelected:e=>!!e.find((e=>"s"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"superscript",type:"button",icon:a.get("superscript"),tooltip:"Superscript",isSelected:e=>!!e.find((e=>"sup"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"subscript",type:"button",icon:a.get("subscript"),tooltip:"Subscript",isSelected:e=>!!e.find((e=>"sub"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"code",type:"button",icon:a.get("code"),tooltip:"Inline code",isSelected:e=>!!e.find((e=>"code"===e.name)),onClick:(e,t)=>{e.command.execute(t)}},{name:"removeFormat",type:"button",icon:a.get("removeFormat"),tooltip:"Remove format",onClick:(e,t)=>{e.command.execute(t)}},{name:"formatPainter",type:"button",icon:a.get("formatPainter"),tooltip:"Format painter",onClick:(e,t)=>{e.command.execute(t)}},{name:"link",type:"button",icon:a.get("link"),tooltip:"Link",onClick:(e,t)=>{e.command.execute(t)}},{name:"hr",type:"button",icon:a.get("hr"),tooltip:"Horizontal line",onClick:(e,t)=>{e.command.execute(t)}},{name:"codeBlock",type:"button",icon:a.get("codeBlock"),tooltip:"Code block",onClick:(e,t)=>{e.command.execute(t)}},{name:"heading",type:"dropdown",downIcon:a.get("down"),defaultValue:"p",tooltip:"Heading",width:"100px",menuType:"list",menuItems:[{value:"h1",text:'<span style="font-weight: bold; font-size: 26px;">Heading 1</span>'},{value:"h2",text:'<span style="font-weight: bold; font-size: 24px;">Heading 2</span>'},{value:"h3",text:'<span style="font-weight: bold; font-size: 22px;">Heading 3</span>'},{value:"h4",text:'<span style="font-weight: bold; font-size: 20px;">Heading 4</span>'},{value:"h5",text:'<span style="font-weight: bold; font-size: 18px;">Heading 5</span>'},{value:"h6",text:'<span style="font-weight: bold; font-size: 16px;">Heading 6</span>'},{value:"p",text:"Paragraph"}],selectedValues:e=>{const t=e.find((e=>e.node.isHeading||"p"===e.name));return t?[t.name]:[]},onSelect:(e,t)=>{e.command.execute("heading",t)}},{name:"list",type:"dropdown",downIcon:a.get("down"),icon:a.get("list"),defaultValue:"",tooltip:"List",width:"auto",menuType:"list",menuItems:Nn,selectedValues:e=>{let t="";for(const n of e){if("ol"===n.name){t="numbered";break}if("ul"===n.name&&!n.node.hasAttr("type")){t="bulleted";break}if("ul"===n.name&&"checklist"===n.node.attr("type")){t="checklist";break}}return[t]},onSelect:(e,t)=>{e.command.execute("list",t)}},{name:"align",type:"dropdown",downIcon:a.get("down"),icon:a.get("alignLeft"),defaultValue:"",tooltip:"Alignment",width:"auto",menuType:"list",menuItems:Ln,selectedValues:e=>{let t="";for(const n of e)if(n.node.isBlock){t=n.node.computedCSS("text-align");break}return[t]},onSelect:(e,t)=>{e.command.execute("align",t)}},{name:"indent",type:"dropdown",downIcon:a.get("down"),icon:a.get("increaseIndent"),defaultValue:"",tooltip:"Indent",width:"auto",menuType:"list",menuItems:Vn,onSelect:(e,t)=>{e.command.execute("indent",t)}},{name:"fontFamily",type:"dropdown",downIcon:a.get("down"),defaultValue:"Segoe UI",tooltip:"Font family",width:"100px",menuType:"list",menuItems:[{value:"Arial",text:'<span style="font-family: Arial;">Arial</span>'},{value:"Arial Black",text:"<span style=\"font-family: 'Arial Black';\">Arial Black</span>"},{value:"Comic Sans MS",text:"<span style=\"font-family: 'Comic Sans MS';\">Comic Sans MS</span>"},{value:"Courier New",text:"<span style=\"font-family: 'Courier New';\">Courier New</span>"},{value:"Georgia",text:'<span style="font-family: Georgia;">Georgia</span>'},{value:"Helvetica",text:'<span style="font-family: Helvetica;">Helvetica</span>'},{value:"Impact",text:'<span style="font-family: Impact;">Impact</span>'},{value:"Segoe UI",text:"<span style=\"font-family: 'Segoe UI';\">Segoe UI</span>"},{value:"Tahoma",text:'<span style="font-family: Tahoma;">Tahoma</span>'},{value:"Times New Roman",text:"<span style=\"font-family: 'Times New Roman';\">Times New Roman</span>"},{value:"Trebuchet MS",text:"<span style=\"font-family: 'Trebuchet MS';\">Trebuchet MS</span>"},{value:"Verdana",text:'<span style="font-family: Verdana;">Verdana</span>'}],selectedValues:e=>{for(const t of e)if("span"===t.name){return[t.node.css("font-family").replace(/['"]/g,"")]}return[]},onSelect:(e,t)=>{e.command.execute("fontFamily",t)}},{name:"fontSize",type:"dropdown",downIcon:a.get("down"),defaultValue:"16px",tooltip:"Font size",width:"65px",menuType:"list",menuItems:[{value:"12px",text:"12px"},{value:"14px",text:"14px"},{value:"16px",text:"16px"},{value:"18px",text:"18px"},{value:"22px",text:"22px"},{value:"24px",text:"24px"},{value:"32px",text:"32px"}],isDisabled:e=>!!e.find((e=>e.node.isHeading)),selectedValues:e=>{for(const t of e)if("span"===t.name){return[t.node.css("font-size").replace(/\.\d+/,"")]}return[]},onSelect:(e,t)=>{e.command.execute("fontSize",t)}},{name:"moreStyle",type:"dropdown",icon:a.get("more"),defaultValue:"",tooltip:"More style",width:"auto",menuType:"list",menuItems:$n,selectedValues:e=>{var t;const n=[];for(const o of e)if(o.node.isMark){const e=null!==(t=On.get(o.name))&&void 0!==t?t:o.name;n.push(e)}return n},onSelect:(e,t)=>{e.command.execute(t)}},{name:"fontColor",type:"dropdown",downIcon:a.get("down"),icon:a.get("fontColor"),accentIcon:a.get("fontColorAccent"),defaultValue:"#f5222d",tooltip:"Font color",width:"auto",menuType:"color",menuItems:In,selectedValues:e=>{for(const t of e)if("span"===t.name){return[g(t.node.computedCSS("color"))]}return[]},onSelect:(e,t)=>{e.command.execute("fontColor",t)}},{name:"highlight",type:"dropdown",downIcon:a.get("down"),icon:a.get("highlight"),accentIcon:a.get("highlightAccent"),defaultValue:"#fadb14",tooltip:"Highlight",width:"auto",menuType:"color",menuItems:In,selectedValues:e=>{for(const t of e)if("span"===t.name){return[g(t.node.computedCSS("background-color"))]}return[]},onSelect:(e,t)=>{e.command.execute("highlight",t)}},{name:"image",type:"upload",icon:a.get("image"),tooltip:"Image",accept:"image/*",multiple:!0}];function Rn(e){const{editor:t,file:n,onError:o,onSuccess:i}=e,{imageRequestMethod:s,imageRequestAction:r,imageRequestTypes:a}=t.config;if(a.indexOf(n.type)<0)throw new Error(`Cannot upload file because its type '${n.type}' is not found in ['${a.join("', '")}'].`);const l=t.insertBox("image",{url:URL.createObjectURL(n),status:"uploading",name:n.name,size:n.size,type:n.type,lastModified:n.lastModified});if(!l)throw new Error("The image box cannot be inserted outside the editor.");const c=ge({onProgress:e=>{const t=l.node.find(".lake-percent"),n=Math.round(e.percent);t.text(`${n<100?n:99} %`)},onError:(e,t)=>{H(e.toString(),t),l.updateValue("status","error"),l.render(),o&&o()},onSuccess:e=>{if(!e.url)return l.updateValue("status","error"),l.render(),void(o&&o());l.updateValue({status:"done",url:e.url}),l.render(),t.history.save(),i&&i()},file:n,action:r,method:s});return l.setData("xhr",c),l}const zn=["undo","redo","|","heading","fontSize","|","formatPainter","removeFormat","bold","moreStyle","|","fontColor","highlight","|","align","list","indent","link","blockQuote","hr"],jn=new Map;Dn.forEach((e=>{jn.set(e.name,e)}));function Pn(e,t,n,o){return new(n||(n=Promise))((function(i,s){function r(e){try{l(o.next(e))}catch(e){s(e)}}function a(e){try{l(o.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}l((o=o.apply(e,t||[])).next())}))}function Fn(e,t){const n=t.getEditor();if(!n)return;const o=t.getContainer(),i=e.closest(".lake-resizer").find(".lake-resizer-info"),s=e.attr("class").indexOf("-right")>=0,r=o.width(),a=o.height()/r;let l=0,c=0;const d=e=>{const t=e.clientX-l,n=Math.round(s?c+t:c-t),r=Math.round(a*n);o.css({width:`${n}px`,height:`${r}px`}),i.text(`${n} x ${r}`)};e.on("pointerdown",(t=>{const n=t;e.get(0).setPointerCapture(n.pointerId),l=n.clientX,c=o.width(),i.show(),e.on("pointermove",d)})),e.on("pointerup",(()=>{e.off("pointermove"),i.hide(),c=t.getContainer().width();const o=Math.round(a*c);t.updateValue({width:c,height:o}),n.history.save()})),e.on("pointercancel",(()=>{e.off("pointermove"),i.hide()}))}function qn(e){return Pn(this,void 0,void 0,(function*(){const t=V("<img />");return t.css({position:"absolute",top:"0",left:"-8888px","z-index":"-1",visibility:"hidden"}),new Promise((n=>{t.on("load",(()=>{const e=t.get(0),o=e.width,i=e.height;t.remove(),t.removeAttr("style"),n({node:t,width:o,height:i})})),t.on("error",(()=>{t.remove(),n({node:t})})),t.attr("src",e),V(document.body).append(t)}))}))}function Un(e,t){return Pn(this,void 0,void 0,(function*(){const n=t.value;t.getContainer().css({width:"",height:""});const o=V(h`
6
+ <div class="lake-button-group">
7
+ <button type="button" class="lake-button-remove" title="Delete"></button>
8
+ </div>
9
+ `),i=o.find(".lake-button-remove"),s=a.get("remove");s&&i.append(s);const r=V(h`
10
+ <div class="lake-error">
11
+ <div class="lake-error-icon"></div>
12
+ <div class="lake-error-name">${n.name||""}</div>
13
+ </div>
14
+ `),l=a.get("image");l&&r.find(".lake-error-icon").append(l),e.append(o),e.append(r)}))}"function"==typeof SuppressedError&&SuppressedError;const _n={type:"inline",name:"image",render:e=>{const t=e.getEditor();if(!t)return;const i=e.value,s=e.getContainer();if(i.width&&i.height&&0===s.find(".lake-progress").length){s.css({width:`${i.width}px`,height:`${i.height}px`}),s.empty();const e=V('<div class="lake-image-placeholder" />');s.append(e);const t=a.get("image");t&&e.append(t)}if(0===s.first().length&&s.append("<div />"),"loading"===i.status)return;const r=V('<div class="lake-image" />');let l;r.addClass(`lake-image-${i.status}`),l="uploading"===i.status?function(e,t){return Pn(this,void 0,void 0,(function*(){const n=t.getEditor();if(!n)return;const o=t.value,i=yield qn(o.url);if(!i.width||!i.height)return void(yield Un(e,t));const s=n.innerWidth()-2,r=i.width<s?i.width:s,l=Math.round(r*i.height/i.width);t.updateValue({width:r,height:l,originalWidth:i.width,originalHeight:i.height}),t.getContainer().css({width:`${r}px`,height:`${l}px`});const c=V(h`
15
+ <div class="lake-button-group">
16
+ <button type="button" class="lake-button-remove" title="Delete"></button>
17
+ </div>
18
+ `),d=c.find(".lake-button-remove"),u=a.get("remove");u&&d.append(u);const f=V(h`
19
+ <div class="lake-progress">
20
+ <div class="lake-percent">${Math.round(o.percent||0)} %</div>
21
+ </div>
22
+ `);r<80&&f.find(".lake-percent").hide();const p=a.get("circleNotch");p&&f.prepend(p);const g=i.node;i.node.addClass("lake-image-img"),g.attr({draggable:"false",alt:o.name}),e.append(c),e.append(f),e.append(g)}))}(r,e):"error"===i.status?Un(r,e):function(e,t){return Pn(this,void 0,void 0,(function*(){const n=t.getEditor();if(!n)return;const o=t.value,i=yield qn(o.url);if(!i.width||!i.height)return void(yield Un(e,t));let s=o.width,r=o.height;if(!s||!r){const e=n.innerWidth()-2;s=Math.round(i.width<e?i.width:e),r=Math.round(s*i.height/i.width),t.updateValue({width:s,height:r})}t.getContainer().css({width:`${s}px`,height:`${r}px`});const l=V(h`
23
+ <div class="lake-button-group">
24
+ <button type="button" class="lake-button-view" title="Full screen"></button>
25
+ <button type="button" class="lake-button-remove" title="Delete"></button>
26
+ </div>
27
+ `),c=l.find(".lake-button-view"),d=a.get("maximize");d&&c.append(d),s<80&&c.hide();const u=l.find(".lake-button-remove"),f=a.get("remove");f&&u.append(f);const p=V(h`
28
+ <div class="lake-resizer">
29
+ <div class="lake-resizer-top-left"></div>
30
+ <div class="lake-resizer-top-right"></div>
31
+ <div class="lake-resizer-bottom-left"></div>
32
+ <div class="lake-resizer-bottom-right"></div>
33
+ <div class="lake-resizer-info">${s} x ${r}</div>
34
+ </div>
35
+ `),g=i.node;g.addClass("lake-image-img"),g.attr({draggable:"false",alt:o.name}),Fn(p.find(".lake-resizer-top-left"),t),Fn(p.find(".lake-resizer-top-right"),t),Fn(p.find(".lake-resizer-bottom-left"),t),Fn(p.find(".lake-resizer-bottom-right"),t),e.append(l),e.append(p),e.append(g)}))}(r,e),l.then((()=>{s.empty(),s.append(r),r.find(".lake-button-view").on("click",(()=>function(e){const t=e.getEditor();if(!t)return;const i=[];let s=0;const r=t.container.find('lake-box[name="image"]');r.each(((t,n)=>{const o=new nt(t),r=o.value;"done"===r.status&&(i.push({id:n,src:r.originalUrl||r.url,width:r.originalWidth||r.width,height:r.originalHeight||r.height,alt:r.name}),e.node.id===o.node.id&&(s=n))}));const l=new n({pswpModule:o,dataSource:i,mainClass:"lake-pswp",zoom:!1,arrowPrevSVG:a.get("left"),arrowNextSVG:a.get("right"),closeSVG:a.get("close"),arrowPrevTitle:"Previous",arrowNextTitle:"Next",closeTitle:"Close (Esc)",errorMsg:"The image cannot be loaded"});l.on("uiRegister",(()=>{const e=l.pswp;e.ui.registerElement({name:"zoom-out-button",order:8,isButton:!0,title:"Zoom out",html:a.get("zoomOut"),onClick:()=>{const t=e.currSlide,n=(t.zoomLevels.max-t.zoomLevels.min)/5,o=t.currZoomLevel-n;t.zoomTo(o,void 0,333)}}),e.ui.registerElement({name:"zoom-in-button",order:9,isButton:!0,title:"Zoom in",html:a.get("zoomIn"),onClick:()=>{const t=e.currSlide,n=(t.zoomLevels.max-t.zoomLevels.min)/5,o=t.currZoomLevel+n;t.zoomTo(o,void 0,333)}})})),l.addFilter("thumbEl",((e,t)=>{const n=r.eq(t.id).find(".lake-image-img");return n.length>0?n.get(0):e})),l.addFilter("placeholderSrc",((e,t)=>{const n=r.eq(t.data.id).find(".lake-image-img");return n.length>0?n.attr("src"):e})),l.on("openingAnimationEnd",(()=>{e.event.emit("openfullscreen")})),l.init(),l.loadAndOpen(s)}(e))),r.find(".lake-button-remove").on("click",(t=>{t.stopPropagation(),function(e){const t=e.getEditor();if(!t)return;const n=e.getData("xhr");n&&n.abort(),t.selection.range.selectBox(e.node),t.removeBox(),t.history.save()}(e)})),e.event.emit("render")})),r.on("click",(()=>{t.selection.range.selectBox(e.node)}))},html:e=>{const t=e.node.attr("value");return h`<img src="${e.value.url}" data-lake-value="${t}" />`}},Wn={type:"block",name:"codeBlock",render:e=>{var t;const n=e.getEditor();if(!n)return;const o=n.innerWidth()-2,s=V('<div class="lake-code-block" />');s.css("width",`${o}px`);const r=e.getContainer();r.empty(),r.append(s);if(!s.get(0))return;const a=i({parent:s.get(0),value:null!==(t=e.value.code)&&void 0!==t?t:"",onChange:t=>{window.setTimeout((()=>{n.isComposing||(e.updateValue("code",t),n.history.save())}),0)}});e.setData("codeEditor",a)}};const Kn=Array.from(B).join(",");function Jn(e){const t=[e];for(const n of e.getWalker())t.push(n);for(const e of t)"div"===e.name?e.find(Kn).length>0?e.remove(!0):F(e,"p"):(e.isHeading||["blockquote","li"].indexOf(e.name)>=0)&&e.find(Kn).remove(!0)}function Xn(e,t){const n=e.selection,o=n.range;if(0===t.childNodes.length)return;const i=new L(t.firstChild);let s=new L(t.lastChild);0===o.getBlocks().length&&n.setBlocks("<p />"),function(e,t){const n=e.selection.range,o=n.startNode.closest("lake-box");if(o.length>0)if("inline"===new nt(o).type)n.isBoxLeft?(n.setStartBefore(o),n.collapseToStart()):n.isBoxRight?(n.setStartAfter(o),n.collapseToStart()):e.removeBox();else{const t=V("<p />");n.isBoxLeft?(o.before(t),n.shrinkAfter(t)):n.isBoxRight?(o.after(t),n.shrinkAfter(t)):e.removeBox()}const i=n.startNode.closestBlock();if(t.isBlockBox){const n=new nt(t),o=""!==t.attr("value")?n.value:void 0;return e.insertBox(n.name,o),void t.remove()}if(t.first().length>0&&O(i),i.isEmpty&&"p"===i.name)return i.replaceWith(t),t.find("lake-box").each((e=>{new nt(e).render()})),void n.shrinkAfter(t);let s=t.first();for(;s.length>0;){"li"===s.name&&(s=s.first());const t=s.next();e.selection.insertNode(s),s=t}t.remove()}(e,i);let r=new L(t.firstChild);for(;r.length>0;){const e=r.next();"br"===r.name&&r.remove(),r=e}if(s=new L(t.lastChild),t.childNodes.length>0){const e=n.splitBlock();e.left&&(o.setEndAfter(e.left),o.collapseToEnd()),e.right&&e.right.isEmpty&&e.right.remove(),n.insertFragment(t),o.shrinkAfter(s)}q(e.container.children().filter((e=>e.isBlock))),e.history.save()}function Gn(e){e.selection.setBlocks("<p />")}function Qn(e){e.selection.setBlocks("<ol><li></li></ol>")}function Yn(e){e.selection.setBlocks("<ul><li></li></ul>")}function eo(e,t){e.selection.setBlocks(`<ul type="checklist"><li value="${t}"></li></ul>`)}const to="strong";const no="sub";const oo="sup";const io="code";let so=[];const ro="lake-format-painter";class ao{constructor(e){this.linkNode=null,this.event=new Xe,this.root=V(h`
36
+ <div class="lake-link-popup">
37
+ <div class="lake-row">URL</div>
38
+ <div class="lake-row lake-url-row">
39
+ <input type="text" name="url" />
40
+ <button type="button" class="lake-button-copy" title="Copy link to clipboard"></button>
41
+ <button type="button" class="lake-button-open" title="Open link in new tab"></button>
42
+ </div>
43
+ <div class="lake-row">Link title</div>
44
+ <div class="lake-row">
45
+ <input type="text" name="title" />
46
+ </div>
47
+ <div class="lake-row">
48
+ <button type="button" class="lake-button-save"><span>Save</span></button>
49
+ <button type="button" class="lake-button-unlink"><span>Remove link</span></button>
50
+ </div>
51
+ </div>
52
+ `);const t=a.get("open");t&&this.root.find(".lake-button-open").append(t);const n=this.root.find(".lake-button-copy"),o=a.get("copy");o&&n.append(o);const i=a.get("checkCircle");i&&n.append(i);const s=a.get("warningCircle");s&&n.append(s);const r=a.get("check");r&&this.root.find(".lake-button-save").prepend(r);const l=a.get("unlink");l&&this.root.find(".lake-button-unlink").prepend(l),e.append(this.root),this.bindEvents()}writeClipboardText(e,t){return Pn(this,void 0,void 0,(function*(){try{yield navigator.clipboard.writeText(e)}catch(e){t()}}))}bindEvents(){let e=null;this.root.find(".lake-button-copy").on("click",(()=>{if(!this.linkNode)return;const t=this.getInputValue("url");this.writeClipboardText(t,(()=>{const e=this.root.find(".lake-button-copy svg");e.hide(),e.eq(2).show("inline")}));const n=this.root.find(".lake-button-copy svg");n.hide(),n.eq(1).show("inline"),e&&window.clearTimeout(e),e=window.setTimeout((()=>{n.hide(),n.eq(0).show("inline")}),2e3)})),this.root.find(".lake-button-open").on("click",(()=>{if(!this.linkNode)return;const e=this.getInputValue("url");window.open(e)})),this.root.find(".lake-button-save").on("click",(()=>{this.linkNode&&(this.save(),this.hide(),this.event.emit("save"))})),this.root.find(".lake-button-unlink").on("click",(()=>{this.linkNode&&(this.linkNode.remove(!0),this.hide(),this.event.emit("remove"))}))}getInputValue(e){return this.root.find(`input[name="${e}"]`).get(0).value}setInputValue(e,t){this.root.find(`input[name="${e}"]`).get(0).value=t}save(){if(!this.linkNode)return;const e=this.getInputValue("url");let t=this.getInputValue("title");""===t&&(t="Link"),this.linkNode.attr("href",e),this.linkNode.text(t)}updatePosition(){if(!this.linkNode)return;const e=this.linkNode.get(0).getBoundingClientRect(),t=e.x+window.scrollX,n=e.y+window.scrollY;t<0||n<0?this.hide():(e.x+this.root.width()>window.innerWidth?this.root.css("left",`${t-this.root.width()+e.width}px`):this.root.css("left",`${t}px`),e.y+e.height+this.root.height()>window.innerHeight?this.root.css("top",n-this.root.height()+"px"):this.root.css("top",`${n+e.height}px`))}show(e){this.linkNode=e;const t=e.attr("href"),n=e.text();this.setInputValue("url",t),this.setInputValue("title",n),this.root.css("visibility","hidden"),this.root.show(),this.updatePosition(),this.root.css("visibility","")}hide(){this.linkNode=null,this.root.hide()}}function lo(e,t){const n=e.selection.range,o=n.getRightText();if(e.selection.splitBlock(),t=n.getBlocks()[0])return""!==o||!t.isHeading&&"blockquote"!==t.name?void(t.isList&&"checklist"===t.attr("type")&&t.find("li").attr("value","false")):(e.selection.setBlocks("<p />"),void e.history.save());e.history.save()}function co(e){const t=e.selection.range,n=t.startNode.closest("lake-box"),o=n.closestBlock();if(o.length>0&&!o.isContainer)return void(t.isBoxLeft?(t.setStartBefore(n),t.collapseToStart(),lo(e,o)):t.isBoxRight?(t.setStartAfter(n),t.collapseToStart(),lo(e,o)):e.removeBox());const i=V("<p><br /></p>");t.isBoxLeft?n.before(i):t.isBoxRight?(n.after(i),t.shrinkAfter(i)):e.removeBox()}function ho(e){const t=e.selection.range,n=t.startNode.closestBlock();if(n.length>0&&!n.isContainer){const n=t.getPrevNode(),o=t.getRightText();if("br"!==n.name&&""===o)return e.selection.insertContents("<br /><br />"),void e.history.save()}e.selection.insertContents("<br />")}function uo(e){const t=e.selection.range,n=t.startNode.closest("lake-box"),o=n.closestBlock();if(o.length>0&&!o.isContainer)return void(t.isBoxLeft?(t.setStartBefore(n),t.collapseToStart(),ho(e)):t.isBoxRight?(t.setStartAfter(n),t.collapseToStart(),ho(e)):e.removeBox());const i=V("<p><br /></p>");t.isBoxLeft?n.before(i):t.isBoxRight?(n.after(i),t.shrinkAfter(i)):e.removeBox()}function fo(e,t){const n=e.selection.range;let o=t.prev();if(0===o.length)return void("p"!==t.name&&e.selection.setBlocks("<p />"));if(o.isBox)return t.isEmpty&&t.remove(),void n.selectBoxRight(o);if("br"===o.name)return void o.remove();if(!o.isBlock){const e=new $;e.selectNodeContents(o),gt(e,"<p />"),o=e.startNode.closestBlock()}if(o.isEmpty)return void o.remove();const i=e.selection.insertBookmark();R(o,t),e.selection.toBookmark(i),e.selection.fixList()}function po(e,t){const n=e.selection.range;let o=t.next();if(0===o.length)return void e.history.save();if(o.isBox)return t.isEmpty&&t.remove(),n.selectBoxLeft(o),void e.history.save();if(!o.isBlock){const e=new $;e.selectNodeContents(o),gt(e,"<p />"),o=o.closestBlock()}const i=e.selection.insertBookmark();R(t,o),e.selection.toBookmark(i),e.selection.fixList()}const go=new Map([["#","h1"],["##","h2"],["###","h3"],["####","h4"],["#####","h5"],["######","h6"]]),mo=[{re:/\*\*(.+?)\*\*$/,getParameters:()=>["bold"]},{re:/__(.+?)__$/,getParameters:()=>["bold"]},{re:/_(.+?)_$/,getParameters:()=>["italic"]},{re:/\*(.+?)\*$/,getParameters:()=>["italic"]},{re:/==(.+?)==$/,getParameters:()=>["highlight","#fff566"]},{re:/~~(.+?)~~$/,getParameters:()=>["strikethrough"]},{re:/`(.+?)`$/,getParameters:()=>["code"]}],vo=[{re:/^#+$/,getParameters:e=>{var t;return["heading",null!==(t=go.get(e))&&void 0!==t?t:"h6"]}},{re:/^\d+\.$/,getParameters:()=>["list","numbered"]},{re:/^[*\-+]$/,getParameters:()=>["list","bulleted"]},{re:/^\[\s?\]$/,getParameters:()=>["list","checklist",!1]},{re:/^\[x\]$/i,getParameters:()=>["list","checklist",!0]},{re:/^>$/,getParameters:()=>["blockQuote"]}];function xo(e){const t=e.clone(!0);t.find("lake-bookmark").remove(),""===t.html()&&e.prepend("<br />")}return En.box.add({type:"block",name:"hr",render:e=>{const t=e.getEditor();if(t)return e.useEffect((()=>{e.getContainer().find(".lake-hr").on("click",(()=>{t.selection.range.selectBox(e.node)}))})),'<div class="lake-hr"><hr /></div>'},html:()=>"<hr />"}),En.box.add(_n),En.box.add(Wn),En.plugin.add((e=>{e.container.on("copy",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.startNode.closest("lake-box");if(0===o.length)return;if(n.isBoxLeft||n.isBoxRight)return;t.preventDefault();const i=t.clipboardData;if(!i)return;const s=new nt(o).getHTML();i.setData("text/html",s)}))})),En.plugin.add((e=>{e.container.on("cut",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.startNode.closest("lake-box");if(0===o.length)return;if(n.isBoxLeft||n.isBoxRight)return;t.preventDefault();const i=t.clipboardData;if(!i)return;const s=new nt(o).getHTML();i.setData("text/html",s),e.removeBox(),e.history.save()}))})),En.plugin.add((e=>{const{imageRequestTypes:t}=e.config;e.container.on("paste",(n=>{if(e.selection.range.isInsideBox)return;n.preventDefault();const o=n.clipboardData;if(!o)return;if(e.selection.deleteContents(),o.files.length>0){for(const n of o.files)t.indexOf(n.type)>=0&&Rn({editor:e,file:n});return}const i=o.types;if(1===i.length&&"text/plain"===i[0]){const t=o.getData("text/plain"),n=new rt(t).getFragment();return e.event.emit("beforepaste",n),void Xn(e,n)}const s=v(o.getData("text/html")),r=function(){const e=it();return e.div=e.p,k(e,((e,t)=>{delete t.id,delete t.class})),e}(),a=new st(s,r).getFragment();e.event.emit("beforepaste",a),function(e){let t=new L(e.firstChild);for(;t.length>0;){const e=t.next();t.isBlock&&Jn(t),t=e}let n=[];for(t=new L(e.firstChild);t.length>0;){const e=t.next();t.isMark||t.isText||t.isBookmark||t.isInlineBox?n.push(t):(j(n),n=[]),t=e}j(n)}(a),Xn(e,a),e.box.renderAll(e)}))})),En.plugin.add((e=>{e.command.add("undo",(()=>{e.history.undo()})),e.keystroke.setKeydown("mod+z",(t=>{e.selection.range.isInsideBox||(t.preventDefault(),e.command.execute("undo"))}))})),En.plugin.add((e=>{e.command.add("redo",(()=>{e.history.redo()})),e.keystroke.setKeydown("mod+y",(t=>{e.selection.range.isInsideBox||(t.preventDefault(),e.command.execute("redo"))}))})),En.plugin.add((e=>{e.command.add("selectAll",(()=>{const t=e.selection.range;t.selectNodeContents(e.container),t.shrink()}))})),En.plugin.add((e=>{e.command.add("heading",(t=>{e.selection.setBlocks(`<${t} />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("blockQuote",(()=>{e.selection.setBlocks("<blockquote />"),e.history.save()}))})),En.plugin.add((e=>{e.command.add("list",((t,n=!1)=>{const o=e.selection.range.getBlocks();let i=!1,s=!1,r=!1;for(const e of o)i||"ol"!==e.name||(i=!0),s||"ul"!==e.name||e.hasAttr("type")||(s=!0),r||"ul"!==e.name||"checklist"!==e.attr("type")||(r=!0);i?("numbered"===t&&Gn(e),"bulleted"===t&&Yn(e),"checklist"===t&&eo(e,n)):s?("numbered"===t&&Qn(e),"bulleted"===t&&Gn(e),"checklist"===t&&eo(e,n)):r?("numbered"===t&&Qn(e),"bulleted"===t&&Yn(e),"checklist"===t&&Gn(e)):("numbered"===t&&Qn(e),"bulleted"===t&&Yn(e),"checklist"===t&&eo(e,n)),e.history.save()})),e.container.on("click",(t=>{const n=t;if(e.readonly)return;if(!n.target)return;const o=V(n.target);"li"===o.name&&""!==o.attr("value")&&n.offsetX<=18&&(o.attr("value",("true"!==o.attr("value")).toString()),e.history.save())}))})),En.plugin.add((e=>{e.command.add("align",(t=>{e.selection.setBlocks({"text-align":t}),e.history.save()}))})),En.plugin.add((e=>{e.command.add("indent",(t=>{const n=e.selection.range.getBlocks();for(const e of n)U(e,t);e.history.save()}))})),En.plugin.add((e=>{e.command.add("bold",(()=>{e.selection.getAppliedItems().find((e=>e.name===to))?e.selection.removeMark(`<${to} />`):e.selection.addMark(`<${to} />`),e.history.save()})),e.keystroke.setKeydown("mod+b",(t=>{t.preventDefault(),e.command.execute("bold")}))})),En.plugin.add((e=>{e.command.add("italic",(()=>{e.selection.getAppliedItems().find((e=>"i"===e.name))?e.selection.removeMark("<i />"):e.selection.addMark("<i />"),e.history.save()})),e.keystroke.setKeydown("mod+i",(t=>{t.preventDefault(),e.command.execute("italic")}))})),En.plugin.add((e=>{e.command.add("underline",(()=>{e.selection.getAppliedItems().find((e=>"u"===e.name))?e.selection.removeMark("<u />"):e.selection.addMark("<u />"),e.history.save()})),e.keystroke.setKeydown("mod+u",(t=>{t.preventDefault(),e.command.execute("underline")}))})),En.plugin.add((e=>{e.command.add("strikethrough",(()=>{e.selection.getAppliedItems().find((e=>"s"===e.name))?e.selection.removeMark("<s />"):e.selection.addMark("<s />"),e.history.save()})),e.keystroke.setKeydown("mod+shift+x",(t=>{t.preventDefault(),e.command.execute("strikethrough")}))})),En.plugin.add((e=>{e.command.add("subscript",(()=>{e.selection.getAppliedItems().find((e=>e.name===no))?e.selection.removeMark(`<${no} />`):e.selection.addMark(`<${no} />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("superscript",(()=>{e.selection.getAppliedItems().find((e=>e.name===oo))?e.selection.removeMark(`<${oo} />`):e.selection.addMark(`<${oo} />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("code",(()=>{e.selection.getAppliedItems().find((e=>e.name===io))?e.selection.removeMark(`<${io} />`):e.selection.addMark(`<${io} />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("fontFamily",(t=>{e.selection.addMark(`<span style="font-family: ${t};" />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("fontSize",(t=>{e.selection.addMark(`<span style="font-size: ${t};" />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("fontColor",(t=>{e.selection.addMark(`<span style="color: ${t};" />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("highlight",(t=>{e.selection.addMark(`<span style="background-color: ${t};" />`),e.history.save()}))})),En.plugin.add((e=>{e.command.add("removeFormat",(()=>{e.selection.removeMark(),e.history.save()}))})),En.plugin.add((e=>{e.command.add("formatPainter",(()=>{e.container.addClass(ro);const t=e.selection.getAppliedItems();for(const e of t){const t=e.node.clone();t.isMark&&"a"!==t.name&&so.push(t)}})),e.container.on("click",(()=>{if(e.container.removeClass(ro),0!==so.length){for(const t of so)e.selection.addMark(t);so=[],e.history.save()}})),e.event.on("click",(t=>{if(t.isInside)return;const n=t.closest(".lake-toolbar-button");n.length>0&&"formatPainter"===n.attr("name")||(e.container.removeClass(ro),so=[])}))})),En.plugin.add((e=>{let t;const n=n=>{t||(t=new ao(e.popupContainer),t.event.on("save",(()=>{e.history.save()})),t.event.on("remove",(()=>{e.history.save()}))),t.show(n)};e.root.on("scroll",(()=>{t&&t.updatePosition()})),e.event.on("resize",(()=>{t&&t.updatePosition()})),e.event.on("click",(e=>{if(e.isOutside)return;if(e.closest("lake-box").length>0)return;const o=e.closest("a");0!==o.length?n(o):t&&t.hide()})),e.command.add("link",(()=>{const t=e.selection.insertLink('<a href="">New link</a>');t&&(e.history.save(),n(t))}))})),En.plugin.add((e=>{e.event.on("beforepaste",(e=>{new ve(e).find("hr").each((e=>{const t=V(e),n=new nt("hr");t.replaceWith(n.node)}))})),e.command.add("hr",(()=>{e.insertBox("hr"),e.history.save()}))})),En.plugin.add((e=>{e.event.on("beforepaste",(e=>{new ve(e).find("img").each((e=>{const t=V(e),n=new nt("image"),o=t.attr("data-lake-value");""===o?n.value={url:t.attr("src"),status:"done"}:n.node.attr("value",o),t.replaceWith(n.node)}))})),e.command.add("image",(t=>{e.insertBox("image",t),e.history.save()}))})),En.plugin.add((e=>{e.command.add("codeBlock",(()=>{const t=e.insertBox("codeBlock");if(!t)return;e.history.save();t.getData("codeEditor").focus()}))})),En.plugin.add((e=>{e.keystroke.setKeydown("enter",(t=>{const n=e.selection.range;if(n.isInsideBox)return;if(t.preventDefault(),n.isBox)return co(e),void e.history.save();if(n.adapt(),n.isInoperative)return;if(n.isBox)return co(e),void e.history.save();let o=n.getBlocks()[0];if(o||(e.selection.setBlocks("<p />"),o=n.getBlocks()[0]),o.isEmpty&&"p"!==o.name)return e.selection.setBlocks("<p />"),void e.history.save();lo(e,o),e.history.save()}))})),En.plugin.add((e=>{e.keystroke.setKeydown("shift+enter",(t=>{const n=e.selection.range;if(!n.isInsideBox){if(t.preventDefault(),n.isBox)return uo(e),void e.history.save();if(n.adapt(),!n.isInoperative){if(n.isBox)return uo(e),void e.history.save();ho(e),e.history.save()}}}))})),En.plugin.add((e=>{e.keystroke.setKeydown("backspace",(t=>{const n=e.selection.range;if(n.isInsideBox)return;if(n.isBoxLeft){const o=n.startNode.closest("lake-box"),i=o.prev();if(0===i.length){const n=o.closestBlock();return void(n.length>0&&!n.isContainer&&(t.preventDefault(),fo(e,n),e.history.save()))}if(i.isBlock)return i.isEmpty?(t.preventDefault(),i.remove(),e.selection.fixList(),void e.history.save()):(t.preventDefault(),void n.shrinkAfter(i));n.adaptBox()}if(n.isBox)return t.preventDefault(),e.removeBox(),void e.history.save();if(!n.isCollapsed)return t.preventDefault(),e.selection.deleteContents(),""===e.container.html().trim()&&e.setValue("<p><br /><focus /></p>"),void e.history.save();n.adapt();const o=n.getPrevNode();if(o.isBox)return t.preventDefault(),n.selectBox(o),e.removeBox(),void e.history.save();if(""===n.getLeftText()){t.preventDefault();let o=n.getBlocks()[0];return o||(e.selection.setBlocks("<p />"),o=n.getBlocks()[0]),""!==o.css("margin-left")||""!==o.css("text-indent")||""!==o.attr("indent")?(U(o,"decrease"),void e.history.save()):o.isList||"blockquote"===o.name?(e.selection.setBlocks("<p />"),void e.history.save()):(fo(e,o),void e.history.save())}"br"===o.name&&(t.preventDefault(),n.setStartBefore(o),n.collapseToStart(),o.remove(),e.history.save())}))})),En.plugin.add((e=>{e.keystroke.setKeydown("delete",(t=>{const n=e.selection.range;if(n.isInsideBox)return;if(n.isBoxRight){const o=n.startNode.closest("lake-box"),i=o.next();if(0===i.length){const n=o.closestBlock();return void(n.length>0&&!n.isContainer&&(t.preventDefault(),po(e,n),e.history.save()))}if(i.isBlock)return i.isEmpty?(t.preventDefault(),i.remove(),e.selection.fixList(),void e.history.save()):(t.preventDefault(),void n.shrinkBefore(i));n.adaptBox()}if(n.isBox)return t.preventDefault(),e.removeBox(),void e.history.save();if(!n.isCollapsed)return t.preventDefault(),e.selection.deleteContents(),""===e.container.html().trim()&&e.setValue("<p><br /><focus /></p>"),void e.history.save();n.adapt();const o=n.getNextNode();if(o.isBox)return t.preventDefault(),n.selectBox(o),e.removeBox(),void e.history.save();if(""===n.getRightText()){t.preventDefault();let o=n.getBlocks()[0];return o||(e.selection.setBlocks("<p />"),o=n.getBlocks()[0]),po(e,o),void e.history.save()}"br"===o.name&&(t.preventDefault(),n.setStartBefore(o),n.collapseToStart(),o.remove(),e.history.save())}))})),En.plugin.add((e=>{e.keystroke.setKeydown("tab",(t=>{t.preventDefault();e.selection.range.getBlocks().forEach((e=>{"p"===e.name&&"2em"!==e.css("text-indent")?e.css("text-indent","2em"):U(e,"increase")})),e.history.save()}))})),En.plugin.add((e=>{e.keystroke.setKeydown("arrow-left",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.commonAncestor.closest("lake-box");if(o.length>0){if(n.isBoxLeft){const e=o.prev();return e.isBlock||e.isBox?(t.preventDefault(),e.isInlineBox?void n.selectBox(e):void n.shrinkAfter(e)):(n.setStartBefore(o),void n.collapseToStart())}return n.isBoxRight?(t.preventDefault(),void n.selectBox(o)):(t.preventDefault(),void n.selectBoxLeft(o))}if(!n.isCollapsed)return;const i=n.getPrevNode();i.isBox&&(t.preventDefault(),n.selectBox(i))})),e.keystroke.setKeydown("arrow-right",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.commonAncestor.closest("lake-box");if(o.length>0){if(n.isBoxLeft)return t.preventDefault(),void n.selectBox(o);if(n.isBoxRight){const e=o.next();return e.isBlock||e.isBox?(t.preventDefault(),e.isInlineBox?void n.selectBox(e):void n.shrinkBefore(e)):(n.setStartAfter(o),void n.collapseToStart())}return t.preventDefault(),void n.selectBoxRight(o)}if(!n.isCollapsed)return;const i=n.getNextNode();i.isBox&&(t.preventDefault(),n.selectBox(i))})),e.keystroke.setKeydown("arrow-up",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.commonAncestor.closest("lake-box");if(o.length>0){if(o.isBlockBox){const e=o.prev();if(e.isBlock||e.isBox)return t.preventDefault(),void n.shrinkAfter(e)}n.setStartBefore(o),n.collapseToStart()}})),e.keystroke.setKeydown("arrow-down",(t=>{const n=e.selection.range;if(n.isInsideBox)return;const o=n.commonAncestor.closest("lake-box");if(o.length>0){if(o.isBlockBox){const e=o.next();if(e.isBlock||e.isBox)return t.preventDefault(),void n.shrinkBefore(e)}n.setStartAfter(o),n.collapseToStart()}}))})),En.plugin.add((e=>{e.keystroke.setKeydown("space",(t=>{const n=e.selection,o=function(e){const t=e.selection.range;let n=t.startNode,o=t.startOffset;if(0!==o){if(n.isElement){const e=n.children()[o-1];if(!e||!e.isText)return;n=e,o=n.text().length}if(!(o<1))return{node:n,offset:o}}}(e);if(!o)return;if(function(e,t){const n=e.selection,o=n.range,i=t.offset,s=t.node.text().slice(0,i);for(const t of mo){const r=t.re.exec(s);if(null!==r){e.prepareOperation();const s=n.insertBookmark(),a=s.focus.prev(),l=a.text(),c=`${l.replace(t.re,"$1")}​`;a.get(0).nodeValue=c,o.setStart(a,i-r[0].length),o.setEnd(a,i-(l.length-c.length)-1);const d=t.getParameters();return e.command.execute(d.shift(),...d),n.toBookmark(s),e.commitOperation(),!0}}return!1}(e,o))return void t.preventDefault();const i=n.range.getBlocks()[0];i&&!i.isHeading&&"p"!==i.name||function(e,t){const n=e.selection,o=t.offset;let i=t.node.text().slice(0,o);i=i.replace(/[\u200B\u2060]/g,"");for(const t of vo)if(t.re.test(i)){e.prepareOperation();const o=n.insertBookmark();o.focus.prev().remove();const s=o.focus.closestBlock();xo(s),n.range.shrinkAfter(s);const r=t.getParameters(i);return e.command.execute(r.shift(),...r),n.toBookmark(o),e.commitOperation(),!0}return!1}(e,o)&&t.preventDefault()}))})),e.Box=nt,e.Editor=En,e.Fragment=ve,e.HTMLParser=st,e.Nodes=L,e.Range=$,e.TextParser=rt,e.Toolbar=class{constructor(e){this.items=e.items||zn,this.editor=e.editor,this.root=V(e.root),this.event=new Xe}getValue(e){const t=e.attr("value");return""===t?[]:JSON.parse(_e(t))}setValue(e,t){e.attr("value",Ue(JSON.stringify(t)))}appendDivider(){this.root.append('<div class="lake-toolbar-divider" />')}appendButton(e){const t=this.editor,n=V('<button type="button" class="lake-toolbar-button" />');n.attr("name",e.name),n.attr("title",e.tooltip),e.icon&&n.append(e.icon),this.root.append(n),n.on("mouseenter",(()=>{n.attr("disabled")||n.addClass("lake-toolbar-button-hovered")})),n.on("mouseleave",(()=>{n.attr("disabled")||n.removeClass("lake-toolbar-button-hovered")})),n.on("click",(n=>{n.preventDefault(),t.focus(),e.onClick(t,e.name)}))}getMenuMap(e){const t=new Map;if(!e.menuItems)return t;for(const n of e.menuItems){const e=n.text.replace(/<[^>]*>/g,"");t.set(n.value,e)}return t}updateColorAccent(e,t){const n=e.find(".lake-dropdown-icon svg").eq(1),o=n.find("line");o.length>0?o.attr("stroke",t):n.find("path").attr("fill",t)}addDropdownMenu(e,t){for(const n of t.menuItems){const o=V(l`
53
+ <li value="${n.value}">
54
+ <div class="lake-dropdown-menu-text">${n.text}</div>
55
+ </li>
56
+ `);if(e.append(o),"color"===t.menuType&&(o.attr("title",n.text),o.find(".lake-dropdown-menu-text").css("background-color",n.value)),n.icon){const e=V('<div class="lake-dropdown-menu-icon"></div>');e.append(n.icon),o.prepend(e)}const i=a.get("check");if(i){const e=V('<div class="lake-dropdown-menu-check"></div>');e.append(i),o.prepend(e)}}}bindDropdownEvents(e,t){const n=this.editor,o=e.find(".lake-dropdown-title"),i=o.find(".lake-dropdown-text"),s=o.find(".lake-dropdown-icon"),r=o.find(".lake-dropdown-down-icon"),a=e.find(".lake-dropdown-menu");"color"===t.menuType?(s.on("mouseenter",(()=>{e.attr("disabled")||s.addClass("lake-dropdown-icon-hovered")})),s.on("mouseleave",(()=>{s.removeClass("lake-dropdown-icon-hovered")})),r.on("mouseenter",(()=>{e.attr("disabled")||r.addClass("lake-dropdown-down-icon-hovered")})),r.on("mouseleave",(()=>{r.removeClass("lake-dropdown-down-icon-hovered")}))):(o.on("mouseenter",(()=>{e.attr("disabled")||o.addClass("lake-dropdown-title-hovered")})),o.on("mouseleave",(()=>{o.removeClass("lake-dropdown-title-hovered")}))),"color"===t.menuType&&s.on("click",(o=>{if(o.preventDefault(),e.attr("disabled"))return;n.focus();const i=e.attr("color")||t.defaultValue;t.onSelect(n,i)}));("color"===t.menuType&&r?r:o).on("click",(n=>{if(n.preventDefault(),e.attr("disabled"))return;const o=this.getValue(e);a.find(".lake-dropdown-menu-check").css("visibility","hidden"),a.find("li").each((e=>{const t=V(e);o.indexOf(t.attr("value"))>=0&&t.find(".lake-dropdown-menu-check").css("visibility","visible")})),a.css("visibility","hidden"),a.show("color"===t.menuType?"flex":"block");e.get(0).getBoundingClientRect().x+a.width()>window.innerWidth?(a.css("left","auto"),a.css("right","0")):(a.css("left",""),a.css("right","")),a.css("visibility","")})),a.on("click",(s=>{s.preventDefault(),n.focus();const r=V(s.target).closest("li"),a=r.attr("value");i.length>0&&i.text(r.text()),"color"===t.menuType&&""!==a&&(e.attr("color",a),this.updateColorAccent(o,a)),t.onSelect(n,a)})),n.event.on("click",(e=>{e.closest(".lake-dropdown-title").get(0)!==o.get(0)&&a.hide()}))}appendDropdown(e){var t;const n=this.getMenuMap(e),o=e.icon?V(h`
57
+ <div class="lake-dropdown">
58
+ <button type="button" class="lake-dropdown-title">
59
+ <div class="lake-dropdown-icon"></div>
60
+ <div class="lake-dropdown-down-icon"></div>
61
+ </button>
62
+ </div>
63
+ `):V(h`
64
+ <div class="lake-dropdown">
65
+ <button type="button" class="lake-dropdown-title">
66
+ <div class="lake-dropdown-text"></div>
67
+ <div class="lake-dropdown-down-icon"></div>
68
+ </button>
69
+ </div>
70
+ `);o.attr("name",e.name),o.addClass(`lake-dropdown-${e.menuType}`);const i=o.find(".lake-dropdown-title");e.downIcon||i.addClass("lake-dropdown-title-no-down"),i.css("width",e.width),i.attr("title",e.tooltip);const s=i.find(".lake-dropdown-text"),r=i.find(".lake-dropdown-icon");e.icon&&r.append(e.icon),e.accentIcon&&r.append(e.accentIcon);const a=i.find(".lake-dropdown-down-icon");e.downIcon&&a.append(e.downIcon);const l=V('<ul class="lake-dropdown-menu" />');l.addClass(`lake-dropdown-${e.menuType}-menu`),s.length>0&&s.text(null!==(t=n.get(e.defaultValue))&&void 0!==t?t:e.defaultValue),"color"===e.menuType&&this.updateColorAccent(i,e.defaultValue),this.addDropdownMenu(l,e),o.append(i),o.append(l),this.root.append(o),this.bindDropdownEvents(o,e)}appendUpload(e){const t=this.editor,n=V(h`
71
+ <div class="lake-upload">
72
+ <input type="file" />
73
+ <button type="button" class="lake-toolbar-button" />
74
+ </div>
75
+ `),o=n.find('input[type="file"]'),i=o.get(0);e.accept&&o.attr("accept",e.accept),!0===e.multiple&&o.attr("multiple","true");const s=n.find("button");s.attr("name",e.name),s.attr("title",e.tooltip),e.icon&&s.append(e.icon),this.root.append(n),s.on("mouseenter",(()=>{s.addClass("lake-toolbar-button-hovered")})),s.on("mouseleave",(()=>{s.removeClass("lake-toolbar-button-hovered")})),s.on("click",(e=>{e.preventDefault(),i.click()})),o.on("click",(e=>e.stopPropagation())),o.on("change",(e=>{const n=e.target.files||[];for(const e of n)Rn({editor:t,file:e})}))}getUpdateStateHandler(e){const{editor:t,allMenuMap:n,buttonItemList:o,dropdownItemList:i}=e;return cn((()=>{var e;let s=t.selection.appliedItems;s.length>0&&s[0].node.closestContainer().get(0)!==t.container.get(0)&&(s=[]);for(const e of o){const n="lake-toolbar-button-selected",o=this.root.find(`button[name="${e.name}"]`),i=!!(e.isDisabled&&s.length>0)&&e.isDisabled(s,t);if(i?(o.attr("disabled","true"),o.removeClass(n)):o.removeAttr("disabled"),!i){!!(e.isSelected&&s.length>0)&&e.isSelected(s,t)?o.addClass(n):o.removeClass(n)}}for(const o of i){const i=o.selectedValues&&s.length>0?o.selectedValues(s,t):[],r=this.root.find(`div.lake-dropdown[name="${o.name}"]`),a=!!(o.isDisabled&&s.length>0)&&o.isDisabled(s,t);if(a?r.attr("disabled","true"):r.removeAttr("disabled"),!a){this.setValue(r,i);const t=r.find(".lake-dropdown-text");if(t.length>0){const s=i[0]||o.defaultValue,r=n.get(o.name),a=null!==(e=r&&r.get(s))&&void 0!==e?e:s;t.text(a)}}}this.event.emit("updatestate")}),100,{leading:!1,trailing:!0,maxWait:100})}render(){const e=this.editor;this.root.addClass("lake-custom-properties");const t=new Map,n=[],o=[];this.items.forEach((e=>{if("|"===e)return void this.appendDivider();let i;if("string"==typeof e){if(i=jn.get(e),!i)return}else i=e;return"button"===i.type?(n.push(i),void this.appendButton(i)):"dropdown"===i.type?(t.set(i.name,this.getMenuMap(i)),o.push(i),void this.appendDropdown(i)):void("upload"===i.type&&this.appendUpload(i))}));const i=this.getUpdateStateHandler({editor:e,allMenuMap:t,buttonItemList:n,dropdownItemList:o});e.event.on("selectionchange",i),e.event.on("change",i)}},e.Utils=me,e.addMark=bt,e.deleteContents=ut,e.fixList=ht,e.icons=a,e.insertBookmark=lt,e.insertContents=pt,e.insertFragment=ft,e.insertLink=At,e.insertNode=at,e.removeMark=Bt,e.setBlocks=gt,e.splitBlock=mt,e.splitMarks=kt,e.toBookmark=dt,e}({},0,PhotoSwipeLightbox,PhotoSwipe,CodeMirror);