@hkyhy/marsun-components-core 0.1.89 → 0.1.98

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 (278) hide show
  1. package/dist/components/Audit/AuditLogList.d.ts +27 -0
  2. package/dist/components/Audit/AuditLogList.js +272 -0
  3. package/dist/components/Audit/AuditLogList.js.map +1 -0
  4. package/dist/components/Audit/formatAuditCurl.d.ts +27 -0
  5. package/dist/components/Audit/formatAuditCurl.js +115 -0
  6. package/dist/components/Audit/formatAuditCurl.js.map +1 -0
  7. package/dist/components/Audit/formatAuditJson.d.ts +15 -0
  8. package/dist/components/Audit/formatAuditJson.js +135 -0
  9. package/dist/components/Audit/formatAuditJson.js.map +1 -0
  10. package/dist/components/Audit/index.d.ts +3 -0
  11. package/dist/components/Audit/style.module.scss.js +30 -0
  12. package/dist/components/Audit/style.module.scss.js.map +1 -0
  13. package/dist/components/Audit/types.d.ts +39 -0
  14. package/dist/components/Editor/RichTextEditor/RichTextEditor.d.ts +24 -0
  15. package/dist/components/Editor/RichTextEditor/RichTextEditor.js +93 -0
  16. package/dist/components/Editor/RichTextEditor/RichTextEditor.js.map +1 -0
  17. package/dist/components/Editor/RichTextEditor/index.d.ts +2 -0
  18. package/dist/components/Editor/RichTextEditor/style.module.scss.js +11 -0
  19. package/dist/components/Editor/RichTextEditor/style.module.scss.js.map +1 -0
  20. package/dist/components/Editor/VariablePicker.d.ts +19 -0
  21. package/dist/components/Editor/VariablePicker.js +55 -0
  22. package/dist/components/Editor/VariablePicker.js.map +1 -0
  23. package/dist/components/Editor/index.d.ts +7 -0
  24. package/dist/components/Editor/index.js +21 -0
  25. package/dist/components/Editor/index.js.map +1 -0
  26. package/dist/components/Editor/msgVarTokenPlugin.d.ts +13 -0
  27. package/dist/components/Editor/msgVarTokenPlugin.js +94 -0
  28. package/dist/components/Editor/msgVarTokenPlugin.js.map +1 -0
  29. package/dist/components/Editor/variableMention.d.ts +37 -0
  30. package/dist/components/Editor/variableMention.js +64 -0
  31. package/dist/components/Editor/variableMention.js.map +1 -0
  32. package/dist/components/FormInfo/RichTextField/index.d.ts +21 -0
  33. package/dist/components/FormInfo/RichTextField/index.js +82 -0
  34. package/dist/components/FormInfo/RichTextField/index.js.map +1 -0
  35. package/dist/components/FormInfo/RichTextField/style.module.scss.js +9 -0
  36. package/dist/components/FormInfo/RichTextField/style.module.scss.js.map +1 -0
  37. package/dist/components/FormInfo/VariableMentionInput/index.d.ts +17 -0
  38. package/dist/components/FormInfo/VariableMentionInput/index.js +73 -0
  39. package/dist/components/FormInfo/VariableMentionInput/index.js.map +1 -0
  40. package/dist/components/FormInfo/VariableMentionInput/style.module.scss.js +11 -0
  41. package/dist/components/FormInfo/VariableMentionInput/style.module.scss.js.map +1 -0
  42. package/dist/components/FormInfo/fields.d.ts +5 -0
  43. package/dist/components/FormInfo/fields.js +32 -23
  44. package/dist/components/FormInfo/fields.js.map +1 -1
  45. package/dist/components/FormInfo/index.d.ts +4 -0
  46. package/dist/components/StateBar/StateBar.d.ts +19 -6
  47. package/dist/components/StateBar/StateBar.js +87 -50
  48. package/dist/components/StateBar/StateBar.js.map +1 -1
  49. package/dist/components/StateBar/style.module.scss.js +13 -10
  50. package/dist/components/StateBar/style.module.scss.js.map +1 -1
  51. package/dist/components/Tools/Inbox/InboxBell/InboxBell.d.ts +45 -0
  52. package/dist/components/Tools/Inbox/InboxBell/InboxBell.js +156 -0
  53. package/dist/components/Tools/Inbox/InboxBell/InboxBell.js.map +1 -0
  54. package/dist/components/Tools/Inbox/InboxBell/index.d.ts +2 -0
  55. package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js +30 -0
  56. package/dist/components/Tools/Inbox/InboxBell/style.module.scss.js.map +1 -0
  57. package/dist/components/Tools/Inbox/index.d.ts +2 -0
  58. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.d.ts +8 -0
  59. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.js +56 -0
  60. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/List/columns.js.map +1 -0
  61. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.d.ts +8 -0
  62. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.js +216 -0
  63. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/MessageTemplateAdmin.js.map +1 -0
  64. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.d.ts +26 -0
  65. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js +190 -0
  66. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/Modal/TemplateFormModal.js.map +1 -0
  67. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/index.d.ts +3 -0
  68. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/style.module.scss.js +12 -0
  69. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/style.module.scss.js.map +1 -0
  70. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.d.ts +76 -0
  71. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.js +26 -0
  72. package/dist/components/Tools/MessageCenter/MessageTemplateAdmin/types.js.map +1 -0
  73. package/dist/components/Tools/MessageCenter/index.d.ts +3 -0
  74. package/dist/components/Tools/MessageCenter/utils/templateCode.d.ts +8 -0
  75. package/dist/components/Tools/MessageCenter/utils/templateCode.js +25 -0
  76. package/dist/components/Tools/MessageCenter/utils/templateCode.js.map +1 -0
  77. package/dist/components/Tools/index.d.ts +5 -0
  78. package/dist/components/index.d.ts +3 -0
  79. package/dist/editor.d.ts +5 -0
  80. package/dist/editor.js +21 -0
  81. package/dist/editor.js.map +1 -0
  82. package/dist/form-info.js +33 -29
  83. package/dist/form-info.js.map +1 -1
  84. package/dist/index.d.ts +5 -0
  85. package/dist/index.js +805 -773
  86. package/dist/index.js.map +1 -1
  87. package/dist/marsun-components-core.css +4 -1
  88. package/dist/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js +301 -0
  89. package/dist/node_modules/@ckeditor/ckeditor5-basic-styles/dist/index.js.map +1 -0
  90. package/dist/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js +1256 -0
  91. package/dist/node_modules/@ckeditor/ckeditor5-clipboard/dist/index.js.map +1 -0
  92. package/dist/node_modules/@ckeditor/ckeditor5-core/dist/index.js +2107 -0
  93. package/dist/node_modules/@ckeditor/ckeditor5-core/dist/index.js.map +1 -0
  94. package/dist/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js +259 -0
  95. package/dist/node_modules/@ckeditor/ckeditor5-editor-classic/dist/index.js.map +1 -0
  96. package/dist/node_modules/@ckeditor/ckeditor5-engine/dist/index.js +23990 -0
  97. package/dist/node_modules/@ckeditor/ckeditor5-engine/dist/index.js.map +1 -0
  98. package/dist/node_modules/@ckeditor/ckeditor5-enter/dist/index.js +249 -0
  99. package/dist/node_modules/@ckeditor/ckeditor5-enter/dist/index.js.map +1 -0
  100. package/dist/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js +47 -0
  101. package/dist/node_modules/@ckeditor/ckeditor5-essentials/dist/index.js.map +1 -0
  102. package/dist/node_modules/@ckeditor/ckeditor5-font/dist/index.js +100 -0
  103. package/dist/node_modules/@ckeditor/ckeditor5-font/dist/index.js.map +1 -0
  104. package/dist/node_modules/@ckeditor/ckeditor5-icons/dist/index.js +31 -0
  105. package/dist/node_modules/@ckeditor/ckeditor5-icons/dist/index.js.map +1 -0
  106. package/dist/node_modules/@ckeditor/ckeditor5-integrations-common/dist/index.js +194 -0
  107. package/dist/node_modules/@ckeditor/ckeditor5-integrations-common/dist/index.js.map +1 -0
  108. package/dist/node_modules/@ckeditor/ckeditor5-list/dist/index.js +2042 -0
  109. package/dist/node_modules/@ckeditor/ckeditor5-list/dist/index.js.map +1 -0
  110. package/dist/node_modules/@ckeditor/ckeditor5-mention/dist/index.js +9 -0
  111. package/dist/node_modules/@ckeditor/ckeditor5-mention/dist/index.js.map +1 -0
  112. package/dist/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js +167 -0
  113. package/dist/node_modules/@ckeditor/ckeditor5-paragraph/dist/index.js.map +1 -0
  114. package/dist/node_modules/@ckeditor/ckeditor5-react/dist/index.js +471 -0
  115. package/dist/node_modules/@ckeditor/ckeditor5-react/dist/index.js.map +1 -0
  116. package/dist/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js +139 -0
  117. package/dist/node_modules/@ckeditor/ckeditor5-select-all/dist/index.js.map +1 -0
  118. package/dist/node_modules/@ckeditor/ckeditor5-typing/dist/index.js +755 -0
  119. package/dist/node_modules/@ckeditor/ckeditor5-typing/dist/index.js.map +1 -0
  120. package/dist/node_modules/@ckeditor/ckeditor5-ui/dist/index.js +7838 -0
  121. package/dist/node_modules/@ckeditor/ckeditor5-ui/dist/index.js.map +1 -0
  122. package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/conversions.js +422 -0
  123. package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/conversions.js.map +1 -0
  124. package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/index.js +33 -0
  125. package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/index.js.map +1 -0
  126. package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/route.js +47 -0
  127. package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-convert/route.js.map +1 -0
  128. package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-name/index.js +156 -0
  129. package/dist/node_modules/@ckeditor/ckeditor5-ui/node_modules/color-name/index.js.map +1 -0
  130. package/dist/node_modules/@ckeditor/ckeditor5-undo/dist/index.js +313 -0
  131. package/dist/node_modules/@ckeditor/ckeditor5-undo/dist/index.js.map +1 -0
  132. package/dist/node_modules/@ckeditor/ckeditor5-utils/dist/index.js +2942 -0
  133. package/dist/node_modules/@ckeditor/ckeditor5-utils/dist/index.js.map +1 -0
  134. package/dist/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js +892 -0
  135. package/dist/node_modules/@ckeditor/ckeditor5-watchdog/dist/index.js.map +1 -0
  136. package/dist/node_modules/@ckeditor/ckeditor5-widget/dist/index.js +1047 -0
  137. package/dist/node_modules/@ckeditor/ckeditor5-widget/dist/index.js.map +1 -0
  138. package/dist/node_modules/color-parse/node_modules/color-name/index.js +153 -0
  139. package/dist/node_modules/color-parse/node_modules/color-name/index.js.map +1 -0
  140. package/dist/node_modules/es-toolkit/dist/_internal/globalThis.js +7 -0
  141. package/dist/node_modules/es-toolkit/dist/_internal/globalThis.js.map +1 -0
  142. package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js +7 -0
  143. package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js.map +1 -0
  144. package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeToWriteProperty.js +7 -0
  145. package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeToWriteProperty.js.map +1 -0
  146. package/dist/node_modules/es-toolkit/dist/compat/_internal/assignValue.js +9 -0
  147. package/dist/node_modules/es-toolkit/dist/compat/_internal/assignValue.js.map +1 -0
  148. package/dist/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js +7 -0
  149. package/dist/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js.map +1 -0
  150. package/dist/node_modules/es-toolkit/dist/compat/_internal/getTag.js +7 -0
  151. package/dist/node_modules/es-toolkit/dist/compat/_internal/getTag.js.map +1 -0
  152. package/dist/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js +16 -0
  153. package/dist/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js.map +1 -0
  154. package/dist/node_modules/es-toolkit/dist/compat/_internal/isIndex.js +15 -0
  155. package/dist/node_modules/es-toolkit/dist/compat/_internal/isIndex.js.map +1 -0
  156. package/dist/node_modules/es-toolkit/dist/compat/_internal/isKey.js +9 -0
  157. package/dist/node_modules/es-toolkit/dist/compat/_internal/isKey.js.map +1 -0
  158. package/dist/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js +8 -0
  159. package/dist/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js.map +1 -0
  160. package/dist/node_modules/es-toolkit/dist/compat/_internal/tags.js +30 -0
  161. package/dist/node_modules/es-toolkit/dist/compat/_internal/tags.js.map +1 -0
  162. package/dist/node_modules/es-toolkit/dist/compat/_internal/toKey.js +8 -0
  163. package/dist/node_modules/es-toolkit/dist/compat/_internal/toKey.js.map +1 -0
  164. package/dist/node_modules/es-toolkit/dist/compat/function/debounce.js +17 -0
  165. package/dist/node_modules/es-toolkit/dist/compat/function/debounce.js.map +1 -0
  166. package/dist/node_modules/es-toolkit/dist/compat/function/throttle.js +13 -0
  167. package/dist/node_modules/es-toolkit/dist/compat/function/throttle.js.map +1 -0
  168. package/dist/node_modules/es-toolkit/dist/compat/object/assignIn.js +17 -0
  169. package/dist/node_modules/es-toolkit/dist/compat/object/assignIn.js.map +1 -0
  170. package/dist/node_modules/es-toolkit/dist/compat/object/clone.js +102 -0
  171. package/dist/node_modules/es-toolkit/dist/compat/object/clone.js.map +1 -0
  172. package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +8 -0
  173. package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js.map +1 -0
  174. package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js +33 -0
  175. package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js.map +1 -0
  176. package/dist/node_modules/es-toolkit/dist/compat/object/get.js +39 -0
  177. package/dist/node_modules/es-toolkit/dist/compat/object/get.js.map +1 -0
  178. package/dist/node_modules/es-toolkit/dist/compat/object/has.js +21 -0
  179. package/dist/node_modules/es-toolkit/dist/compat/object/has.js.map +1 -0
  180. package/dist/node_modules/es-toolkit/dist/compat/object/keysIn.js +33 -0
  181. package/dist/node_modules/es-toolkit/dist/compat/object/keysIn.js.map +1 -0
  182. package/dist/node_modules/es-toolkit/dist/compat/object/mapValues.js +10 -0
  183. package/dist/node_modules/es-toolkit/dist/compat/object/mapValues.js.map +1 -0
  184. package/dist/node_modules/es-toolkit/dist/compat/object/merge.js +9 -0
  185. package/dist/node_modules/es-toolkit/dist/compat/object/merge.js.map +1 -0
  186. package/dist/node_modules/es-toolkit/dist/compat/object/mergeWith.js +53 -0
  187. package/dist/node_modules/es-toolkit/dist/compat/object/mergeWith.js.map +1 -0
  188. package/dist/node_modules/es-toolkit/dist/compat/object/property.js +10 -0
  189. package/dist/node_modules/es-toolkit/dist/compat/object/property.js.map +1 -0
  190. package/dist/node_modules/es-toolkit/dist/compat/object/set.js +9 -0
  191. package/dist/node_modules/es-toolkit/dist/compat/object/set.js.map +1 -0
  192. package/dist/node_modules/es-toolkit/dist/compat/object/updateWith.js +31 -0
  193. package/dist/node_modules/es-toolkit/dist/compat/object/updateWith.js.map +1 -0
  194. package/dist/node_modules/es-toolkit/dist/compat/predicate/isArguments.js +8 -0
  195. package/dist/node_modules/es-toolkit/dist/compat/predicate/isArguments.js.map +1 -0
  196. package/dist/node_modules/es-toolkit/dist/compat/predicate/isArray.js +7 -0
  197. package/dist/node_modules/es-toolkit/dist/compat/predicate/isArray.js.map +1 -0
  198. package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js +8 -0
  199. package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js.map +1 -0
  200. package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js +9 -0
  201. package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js.map +1 -0
  202. package/dist/node_modules/es-toolkit/dist/compat/predicate/isElement.js +9 -0
  203. package/dist/node_modules/es-toolkit/dist/compat/predicate/isElement.js.map +1 -0
  204. package/dist/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js +15 -0
  205. package/dist/node_modules/es-toolkit/dist/compat/predicate/isEqualWith.js.map +1 -0
  206. package/dist/node_modules/es-toolkit/dist/compat/predicate/isFunction.js +7 -0
  207. package/dist/node_modules/es-toolkit/dist/compat/predicate/isFunction.js.map +1 -0
  208. package/dist/node_modules/es-toolkit/dist/compat/predicate/isMatch.js +9 -0
  209. package/dist/node_modules/es-toolkit/dist/compat/predicate/isMatch.js.map +1 -0
  210. package/dist/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.js +81 -0
  211. package/dist/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.js.map +1 -0
  212. package/dist/node_modules/es-toolkit/dist/compat/predicate/isObject.js +7 -0
  213. package/dist/node_modules/es-toolkit/dist/compat/predicate/isObject.js.map +1 -0
  214. package/dist/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js +7 -0
  215. package/dist/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js.map +1 -0
  216. package/dist/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js +16 -0
  217. package/dist/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js.map +1 -0
  218. package/dist/node_modules/es-toolkit/dist/compat/predicate/isString.js +7 -0
  219. package/dist/node_modules/es-toolkit/dist/compat/predicate/isString.js.map +1 -0
  220. package/dist/node_modules/es-toolkit/dist/compat/predicate/isSymbol.js +7 -0
  221. package/dist/node_modules/es-toolkit/dist/compat/predicate/isSymbol.js.map +1 -0
  222. package/dist/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js +8 -0
  223. package/dist/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js.map +1 -0
  224. package/dist/node_modules/es-toolkit/dist/compat/predicate/matches.js +9 -0
  225. package/dist/node_modules/es-toolkit/dist/compat/predicate/matches.js.map +1 -0
  226. package/dist/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js +23 -0
  227. package/dist/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js.map +1 -0
  228. package/dist/node_modules/es-toolkit/dist/compat/util/eq.js +7 -0
  229. package/dist/node_modules/es-toolkit/dist/compat/util/eq.js.map +1 -0
  230. package/dist/node_modules/es-toolkit/dist/compat/util/iteratee.js +19 -0
  231. package/dist/node_modules/es-toolkit/dist/compat/util/iteratee.js.map +1 -0
  232. package/dist/node_modules/es-toolkit/dist/compat/util/times.js +11 -0
  233. package/dist/node_modules/es-toolkit/dist/compat/util/times.js.map +1 -0
  234. package/dist/node_modules/es-toolkit/dist/compat/util/toFinite.js +8 -0
  235. package/dist/node_modules/es-toolkit/dist/compat/util/toFinite.js.map +1 -0
  236. package/dist/node_modules/es-toolkit/dist/compat/util/toInteger.js +9 -0
  237. package/dist/node_modules/es-toolkit/dist/compat/util/toInteger.js.map +1 -0
  238. package/dist/node_modules/es-toolkit/dist/compat/util/toNumber.js +8 -0
  239. package/dist/node_modules/es-toolkit/dist/compat/util/toNumber.js.map +1 -0
  240. package/dist/node_modules/es-toolkit/dist/compat/util/toPath.js +37 -0
  241. package/dist/node_modules/es-toolkit/dist/compat/util/toPath.js.map +1 -0
  242. package/dist/node_modules/es-toolkit/dist/compat/util/toString.js +15 -0
  243. package/dist/node_modules/es-toolkit/dist/compat/util/toString.js.map +1 -0
  244. package/dist/node_modules/es-toolkit/dist/function/after.js +11 -0
  245. package/dist/node_modules/es-toolkit/dist/function/after.js.map +1 -0
  246. package/dist/node_modules/es-toolkit/dist/function/debounce.js +30 -0
  247. package/dist/node_modules/es-toolkit/dist/function/debounce.js.map +1 -0
  248. package/dist/node_modules/es-toolkit/dist/function/identity.js +7 -0
  249. package/dist/node_modules/es-toolkit/dist/function/identity.js.map +1 -0
  250. package/dist/node_modules/es-toolkit/dist/function/noop.js +6 -0
  251. package/dist/node_modules/es-toolkit/dist/function/noop.js.map +1 -0
  252. package/dist/node_modules/es-toolkit/dist/object/clone.js +27 -0
  253. package/dist/node_modules/es-toolkit/dist/object/clone.js.map +1 -0
  254. package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js +8 -0
  255. package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js.map +1 -0
  256. package/dist/node_modules/es-toolkit/dist/object/cloneDeepWith.js +121 -0
  257. package/dist/node_modules/es-toolkit/dist/object/cloneDeepWith.js.map +1 -0
  258. package/dist/node_modules/es-toolkit/dist/object/mapValues.js +12 -0
  259. package/dist/node_modules/es-toolkit/dist/object/mapValues.js.map +1 -0
  260. package/dist/node_modules/es-toolkit/dist/predicate/isBuffer.js +8 -0
  261. package/dist/node_modules/es-toolkit/dist/predicate/isBuffer.js.map +1 -0
  262. package/dist/node_modules/es-toolkit/dist/predicate/isEqual.js +9 -0
  263. package/dist/node_modules/es-toolkit/dist/predicate/isEqual.js.map +1 -0
  264. package/dist/node_modules/es-toolkit/dist/predicate/isEqualWith.js +110 -0
  265. package/dist/node_modules/es-toolkit/dist/predicate/isEqualWith.js.map +1 -0
  266. package/dist/node_modules/es-toolkit/dist/predicate/isLength.js +7 -0
  267. package/dist/node_modules/es-toolkit/dist/predicate/isLength.js.map +1 -0
  268. package/dist/node_modules/es-toolkit/dist/predicate/isPlainObject.js +9 -0
  269. package/dist/node_modules/es-toolkit/dist/predicate/isPlainObject.js.map +1 -0
  270. package/dist/node_modules/es-toolkit/dist/predicate/isPrimitive.js +7 -0
  271. package/dist/node_modules/es-toolkit/dist/predicate/isPrimitive.js.map +1 -0
  272. package/dist/node_modules/es-toolkit/dist/predicate/isTypedArray.js +7 -0
  273. package/dist/node_modules/es-toolkit/dist/predicate/isTypedArray.js.map +1 -0
  274. package/dist/styles/global.css +4 -1
  275. package/dist/utils/copyText.d.ts +4 -0
  276. package/dist/utils/copyText.js +21 -0
  277. package/dist/utils/copyText.js.map +1 -0
  278. package/package.json +9 -2
@@ -0,0 +1,892 @@
1
+ var v = Object.defineProperty;
2
+ var P = (e, t, s) => t in e ? v(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var a = (e, t, s) => P(e, typeof t != "symbol" ? t + "" : t, s);
4
+ import { cloneDeepWith as w } from "../../../es-toolkit/dist/compat/object/cloneDeepWith.js";
5
+ import { throttle as S } from "../../../es-toolkit/dist/compat/function/throttle.js";
6
+ import { isElement as y } from "../../../es-toolkit/dist/compat/predicate/isElement.js";
7
+ /**
8
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
9
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
10
+ */
11
+ /**
12
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
13
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
14
+ */
15
+ var E = class {
16
+ /**
17
+ * @param {module:watchdog/watchdog~WatchdogConfig} config The watchdog plugin configuration.
18
+ */
19
+ constructor(e) {
20
+ /**
21
+ * An array of crashes saved as an object with the following properties:
22
+ *
23
+ * * `message`: `String`,
24
+ * * `stack`: `String`,
25
+ * * `date`: `Number`,
26
+ * * `filename`: `String | undefined`,
27
+ * * `lineno`: `Number | undefined`,
28
+ * * `colno`: `Number | undefined`,
29
+ */
30
+ a(this, "crashes", []);
31
+ /**
32
+ * Specifies the state of the item watched by the watchdog. The state can be one of the following values:
33
+ *
34
+ * * `initializing` – Before the first initialization, and after crashes, before the item is ready.
35
+ * * `ready` – A state when the user can interact with the item.
36
+ * * `crashed` – A state when an error occurs. It quickly changes to `initializing` or `crashedPermanently`
37
+ * depending on how many and how frequent errors have been caught recently.
38
+ * * `crashedPermanently` – A state when the watchdog stops reacting to errors and keeps the item it is watching crashed,
39
+ * * `destroyed` – A state when the item is manually destroyed by the user after calling `watchdog.destroy()`.
40
+ */
41
+ a(this, "state", "initializing");
42
+ /**
43
+ * @see module:watchdog/watchdog~WatchdogConfig
44
+ */
45
+ a(this, "_crashNumberLimit");
46
+ /**
47
+ * Returns the result of the `Date.now()` call. It can be overridden in tests to mock time as some popular
48
+ * approaches like `sinon.useFakeTimers()` do not work well with error handling.
49
+ */
50
+ a(this, "_now", Date.now);
51
+ /**
52
+ * @see module:watchdog/watchdog~WatchdogConfig
53
+ */
54
+ a(this, "_minimumNonErrorTimePeriod");
55
+ /**
56
+ * Checks if the event error comes from the underlying item and restarts the item.
57
+ */
58
+ a(this, "_boundErrorHandler");
59
+ /**
60
+ * A dictionary of event emitter listeners.
61
+ */
62
+ a(this, "_listeners");
63
+ if (this.crashes = [], this._crashNumberLimit = typeof e.crashNumberLimit == "number" ? e.crashNumberLimit : 3, this._minimumNonErrorTimePeriod = typeof e.minimumNonErrorTimePeriod == "number" ? e.minimumNonErrorTimePeriod : 5e3, this._boundErrorHandler = (t) => {
64
+ const s = "error" in t ? t.error : t.reason;
65
+ s instanceof Error && this._handleError(s, t);
66
+ }, this._listeners = {}, !this._restart) throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.");
67
+ }
68
+ /**
69
+ * Destroys the watchdog and releases the resources.
70
+ */
71
+ destroy() {
72
+ this._stopErrorHandling(), this._listeners = {};
73
+ }
74
+ /**
75
+ * Starts listening to a specific event name by registering a callback that will be executed
76
+ * whenever an event with a given name fires.
77
+ *
78
+ * Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.
79
+ *
80
+ * @param eventName The event name.
81
+ * @param callback A callback which will be added to event listeners.
82
+ */
83
+ on(e, t) {
84
+ this._listeners[e] || (this._listeners[e] = []), this._listeners[e].push(t);
85
+ }
86
+ /**
87
+ * Stops listening to the specified event name by removing the callback from event listeners.
88
+ *
89
+ * Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.
90
+ *
91
+ * @param eventName The event name.
92
+ * @param callback A callback which will be removed from event listeners.
93
+ */
94
+ off(e, t) {
95
+ this._listeners[e] = this._listeners[e].filter((s) => s !== t);
96
+ }
97
+ /**
98
+ * Fires an event with a given event name and arguments.
99
+ *
100
+ * Note that this method differs from the CKEditor 5's default `EventEmitterMixin` implementation.
101
+ */
102
+ _fire(e, ...t) {
103
+ const s = this._listeners[e] || [];
104
+ for (const r of s) r.apply(this, [null, ...t]);
105
+ }
106
+ /**
107
+ * Starts error handling by attaching global error handlers.
108
+ */
109
+ _startErrorHandling() {
110
+ window.addEventListener("error", this._boundErrorHandler), window.addEventListener("unhandledrejection", this._boundErrorHandler);
111
+ }
112
+ /**
113
+ * Stops error handling by detaching global error handlers.
114
+ */
115
+ _stopErrorHandling() {
116
+ window.removeEventListener("error", this._boundErrorHandler), window.removeEventListener("unhandledrejection", this._boundErrorHandler);
117
+ }
118
+ /**
119
+ * Checks if an error comes from the watched item and restarts it.
120
+ * It reacts to {@link module:utils/ckeditorerror~CKEditorError `CKEditorError` errors} only.
121
+ *
122
+ * @fires error
123
+ * @param error Error.
124
+ * @param evt An error event.
125
+ */
126
+ _handleError(e, t) {
127
+ if (this._shouldReactToError(e)) {
128
+ this.crashes.push({
129
+ message: e.message,
130
+ stack: e.stack,
131
+ filename: t instanceof ErrorEvent ? t.filename : void 0,
132
+ lineno: t instanceof ErrorEvent ? t.lineno : void 0,
133
+ colno: t instanceof ErrorEvent ? t.colno : void 0,
134
+ date: this._now()
135
+ });
136
+ const s = this._shouldRestart();
137
+ this.state = "crashed", this._fire("stateChange"), this._fire("error", {
138
+ error: e,
139
+ causesRestart: s
140
+ }), s ? this._restart() : (this.state = "crashedPermanently", this._fire("stateChange"));
141
+ }
142
+ }
143
+ /**
144
+ * Checks whether an error should be handled by the watchdog.
145
+ *
146
+ * @param error An error that was caught by the error handling process.
147
+ */
148
+ _shouldReactToError(e) {
149
+ return e.is && e.is("CKEditorError") && e.context !== void 0 && e.context !== null && this.state === "ready" && this._isErrorComingFromThisItem(e);
150
+ }
151
+ /**
152
+ * Checks if the watchdog should restart the underlying item.
153
+ */
154
+ _shouldRestart() {
155
+ return this.crashes.length <= this._crashNumberLimit ? !0 : (this.crashes[this.crashes.length - 1].date - this.crashes[this.crashes.length - 1 - this._crashNumberLimit].date) / this._crashNumberLimit > this._minimumNonErrorTimePeriod;
156
+ }
157
+ };
158
+ /**
159
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
160
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
161
+ */
162
+ function g(e, t = /* @__PURE__ */ new Set()) {
163
+ const s = [e], r = /* @__PURE__ */ new Set();
164
+ let i = 0;
165
+ for (; s.length > i; ) {
166
+ const o = s[i++];
167
+ if (!(r.has(o) || !x(o) || t.has(o)))
168
+ if (r.add(o), Symbol.iterator in o) try {
169
+ for (const c of o) s.push(c);
170
+ } catch {
171
+ }
172
+ else for (const c in o)
173
+ c !== "defaultValue" && s.push(o[c]);
174
+ }
175
+ return r;
176
+ }
177
+ function x(e) {
178
+ const t = Object.prototype.toString.call(e), s = typeof e;
179
+ return !(s === "number" || s === "boolean" || s === "string" || s === "symbol" || s === "function" || t === "[object Date]" || t === "[object RegExp]" || t === "[object Module]" || e === void 0 || e === null || e._watchdogExcluded || e instanceof EventTarget || e instanceof Event);
180
+ }
181
+ /**
182
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
183
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
184
+ */
185
+ function b(e, t, s = /* @__PURE__ */ new Set()) {
186
+ if (e === t && T(e)) return !0;
187
+ const r = g(e, s), i = g(t, s);
188
+ for (const o of r) if (i.has(o)) return !0;
189
+ return !1;
190
+ }
191
+ /* v8 ignore stop -- @preserve */
192
+ function T(e) {
193
+ return typeof e == "object" && e !== null;
194
+ }
195
+ /**
196
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
197
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
198
+ */
199
+ function f(e, t, s) {
200
+ const r = t.root, i = t.roots || /* @__PURE__ */ Object.create(null);
201
+ s && !i[s] && (i[s] = r || /* @__PURE__ */ Object.create(null));
202
+ const o = N(e), c = A(t, o, s), n = Array.from(/* @__PURE__ */ new Set([
203
+ ...o ? Object.keys(e) : [],
204
+ ...Object.keys(i),
205
+ ...Object.keys(c)
206
+ ]));
207
+ for (const d of n) {
208
+ const h = i[d] || /* @__PURE__ */ Object.create(null);
209
+ h.initialData = "", h.placeholder ?? (h.placeholder = m(t, "placeholder", d)), h.label ?? (h.label = m(t, "label", d)), i[d] = h;
210
+ }
211
+ t.roots = i;
212
+ }
213
+ function N(e) {
214
+ return !!e && typeof e == "object" && !Array.isArray(e) && !k(e);
215
+ }
216
+ function A(e, t, s) {
217
+ return t || !s ? e.initialData || /* @__PURE__ */ Object.create(null) : { [s]: e.initialData };
218
+ }
219
+ function m(e, t, s) {
220
+ const r = e[t];
221
+ if (r) return typeof r == "string" ? r : r[s];
222
+ }
223
+ function k(e) {
224
+ return y(e);
225
+ }
226
+ /**
227
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
228
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
229
+ */
230
+ var R = class extends E {
231
+ /**
232
+ * @param Editor The editor class.
233
+ * @param watchdogConfig The watchdog plugin configuration.
234
+ */
235
+ constructor(t, s = {}) {
236
+ super(s);
237
+ /**
238
+ * The current editor instance.
239
+ */
240
+ a(this, "_editor", null);
241
+ /**
242
+ * A promise associated with the life cycle of the editor (creation or destruction processes).
243
+ *
244
+ * It is used to prevent the initialization of the editor if the previous instance has not been destroyed yet,
245
+ * and conversely, to prevent the destruction of the editor if it has not been initialized.
246
+ */
247
+ a(this, "_lifecyclePromise", null);
248
+ /**
249
+ * Throttled save method. The `save()` method is called the specified `saveInterval` after `throttledSave()` is called,
250
+ * unless a new action happens in the meantime.
251
+ */
252
+ a(this, "_throttledSave");
253
+ /**
254
+ * The latest saved editor data represented as a root name -> root data object.
255
+ */
256
+ a(this, "_data");
257
+ /**
258
+ * The last document version.
259
+ */
260
+ a(this, "_lastDocumentVersion");
261
+ /**
262
+ * The editor source element or data.
263
+ */
264
+ a(this, "_elementOrData");
265
+ /**
266
+ * Stores the original DOM element for single-root editors.
267
+ */
268
+ a(this, "_editorAttachTo", null);
269
+ /**
270
+ * Specifies whether the editor is a single-root editor (e.g. ClassicEditor) or a multi-root editor (e.g. MultiRootEditor).
271
+ */
272
+ a(this, "_isSingleRootEditor", !0);
273
+ /**
274
+ * Specifies whether the editor was created using config-based creator mode (without a source element or data as the first argument).
275
+ *
276
+ * @internal
277
+ */
278
+ a(this, "_isUsingConfigBasedCreator", !1);
279
+ /**
280
+ * The latest record of the editor editable elements. Used to restart the editor.
281
+ */
282
+ a(this, "_editables", {});
283
+ /**
284
+ * The editor configuration.
285
+ */
286
+ a(this, "_config");
287
+ a(this, "_excludedProps");
288
+ this._throttledSave = S(this._save.bind(this), typeof s.saveInterval == "number" ? s.saveInterval : 5e3), t && (this._creator = ((r, i) => i === void 0 ? t.create(r) : t.create(r, i))), this._destructor = (r) => r.destroy();
289
+ }
290
+ /**
291
+ * The current editor instance.
292
+ */
293
+ get editor() {
294
+ return this._editor;
295
+ }
296
+ /**
297
+ * @internal
298
+ */
299
+ get _item() {
300
+ return this._editor;
301
+ }
302
+ /**
303
+ * Sets the function that is responsible for the editor creation.
304
+ * It expects a function that should return a promise.
305
+ *
306
+ * For config-based editor creation:
307
+ *
308
+ * ```ts
309
+ * watchdog.setCreator( config => ClassicEditor.create( config ) );
310
+ * ```
311
+ *
312
+ * For legacy editor creation (with element or data as the first argument):
313
+ *
314
+ * ```ts
315
+ * watchdog.setCreator( ( element, config ) => ClassicEditor.create( element, config ) );
316
+ * ```
317
+ */
318
+ setCreator(t) {
319
+ this._creator = t;
320
+ }
321
+ /**
322
+ * Sets the function that is responsible for the editor destruction.
323
+ * Overrides the default destruction function, which destroys only the editor instance.
324
+ * It expects a function that should return a promise or `undefined`.
325
+ *
326
+ * ```ts
327
+ * watchdog.setDestructor( editor => {
328
+ * // Do something before the editor is destroyed.
329
+ *
330
+ * return editor
331
+ * .destroy()
332
+ * .then( () => {
333
+ * // Do something after the editor is destroyed.
334
+ * } );
335
+ * } );
336
+ * ```
337
+ */
338
+ setDestructor(t) {
339
+ this._destructor = t;
340
+ }
341
+ /**
342
+ * Restarts the editor instance. This method is called whenever an editor error occurs. It fires the `restart` event and changes
343
+ * the state to `initializing`.
344
+ *
345
+ * @fires restart
346
+ */
347
+ _restart() {
348
+ return Promise.resolve().then(() => (this.state = "initializing", this._fire("stateChange"), this._destroy())).catch((t) => {
349
+ console.error("An error happened during the editor destroying.", t);
350
+ }).then(() => {
351
+ var i;
352
+ this._isUsingConfigBasedCreator ? f(this._isSingleRootEditor ? "" : {}, this._config, this._isSingleRootEditor ? "main" : !1) : f(this._isSingleRootEditor ? this._editorAttachTo || "" : this._editables, this._config, this._isSingleRootEditor ? "main" : !1);
353
+ const t = {
354
+ ...this._config,
355
+ extraPlugins: this._config.extraPlugins || [],
356
+ _watchdogInitialData: this._data
357
+ };
358
+ t.extraPlugins.push(D);
359
+ const s = {};
360
+ for (const [o, c] of Object.entries(this._data.roots)) {
361
+ const n = t.roots[o] || /* @__PURE__ */ Object.create(null);
362
+ n.initialData = "", n.modelElement = c.modelElement, this._isUsingConfigBasedCreator && ((i = this._editables[o]) != null && i.isConnected ? n.element = this._editables[o] : c.isLoaded && !n.element && Object.assign(n, j(c.attributes))), c.isLoaded ? n.lazyLoad = !1 : delete n.modelAttributes, s[o] = n;
363
+ }
364
+ if (t.roots = s, delete t.initialData, delete t.root, this._isUsingConfigBasedCreator) return this.create(t, t.context);
365
+ const r = this._isSingleRootEditor ? this._editorAttachTo || "" : this._editables;
366
+ return this.create(r, t, t.context);
367
+ }).then(() => {
368
+ this._fire("restart");
369
+ });
370
+ }
371
+ create(t = this._isUsingConfigBasedCreator ? this._config : this._elementOrData, s = this._isUsingConfigBasedCreator ? void 0 : this._config, r) {
372
+ const i = this._detectConfigBasedCreator(t, s), o = i ? void 0 : t, c = i ? t : s, n = i ? s : r;
373
+ return this._lifecyclePromise = Promise.resolve(this._lifecyclePromise).then(() => {
374
+ if (super._startErrorHandling(), this._isUsingConfigBasedCreator = i, this._elementOrData = o, this._config = this._cloneEditorConfiguration(c || {}), this._config.context = n, i) {
375
+ this._editorAttachTo = null;
376
+ const d = this._config.roots ? Object.keys(this._config.roots).length : 0, h = this._config.initialData, _ = h && typeof h == "object";
377
+ this._isSingleRootEditor = !_ && d <= 1;
378
+ } else
379
+ this._editorAttachTo = l(o) ? o : null, this._isSingleRootEditor = l(o) || typeof o == "string";
380
+ return i ? this._creator(this._config) : this._creator(o, this._config);
381
+ }).then((d) => {
382
+ this._editor = d, d.model.document.on("change:data", this._throttledSave), this._lastDocumentVersion = d.model.document.version, this._data = this._getData(), this._editorAttachTo || (this._editables = this._getEditables()), this.state = "ready", this._fire("stateChange");
383
+ }).finally(() => {
384
+ this._lifecyclePromise = null;
385
+ }), this._lifecyclePromise;
386
+ }
387
+ /**
388
+ * Destroys the watchdog and the current editor instance. It fires the callback
389
+ * registered in {@link #setDestructor `setDestructor()`} and uses it to destroy the editor instance.
390
+ * It also sets the state to `destroyed`.
391
+ */
392
+ destroy() {
393
+ return this._lifecyclePromise = Promise.resolve(this._lifecyclePromise).then(() => (this.state = "destroyed", this._fire("stateChange"), super.destroy(), this._destroy())).finally(() => {
394
+ this._lifecyclePromise = null;
395
+ }), this._lifecyclePromise;
396
+ }
397
+ _destroy() {
398
+ return Promise.resolve().then(() => {
399
+ this._stopErrorHandling(), this._throttledSave.cancel();
400
+ const t = this._editor;
401
+ return this._editor = null, t.model.document.off("change:data", this._throttledSave), this._destructor(t);
402
+ });
403
+ }
404
+ /**
405
+ * Saves the editor data, so it can be restored after the crash even if the data cannot be fetched at
406
+ * the moment of the crash.
407
+ */
408
+ _save() {
409
+ const t = this._editor.model.document.version;
410
+ try {
411
+ this._data = this._getData(), this._editorAttachTo || (this._editables = this._getEditables()), this._lastDocumentVersion = t;
412
+ } catch (s) {
413
+ console.error(s, "An error happened during restoring editor data. Editor will be restored from the previously saved data.");
414
+ }
415
+ }
416
+ /**
417
+ * @internal
418
+ */
419
+ _setExcludedProperties(t) {
420
+ this._excludedProps = t;
421
+ }
422
+ /**
423
+ * Gets all data that is required to reinitialize editor instance.
424
+ */
425
+ _getData() {
426
+ const t = this._editor, s = t.model.document.roots.filter((n) => n.isAttached() && n.rootName != "$graveyard"), { plugins: r } = t, i = r.has("CommentsRepository") && r.get("CommentsRepository"), o = r.has("TrackChanges") && r.get("TrackChanges"), c = {
427
+ roots: {},
428
+ markers: {},
429
+ commentThreads: JSON.stringify([]),
430
+ suggestions: JSON.stringify([])
431
+ };
432
+ s.forEach((n) => {
433
+ c.roots[n.rootName] = {
434
+ content: JSON.stringify(Array.from(n.getChildren())),
435
+ attributes: JSON.stringify(Array.from(n.getAttributes())),
436
+ modelElement: n.name,
437
+ isLoaded: n._isLoaded
438
+ };
439
+ });
440
+ for (const n of t.model.markers)
441
+ n._affectsData && (c.markers[n.name] = {
442
+ rangeJSON: n.getRange().toJSON(),
443
+ usingOperation: n._managedUsingOperations,
444
+ affectsData: n._affectsData
445
+ });
446
+ return i && (c.commentThreads = JSON.stringify(i.getCommentThreads({
447
+ toJSON: !0,
448
+ skipNotAttached: !0
449
+ }))), o && (c.suggestions = JSON.stringify(o.getSuggestions({
450
+ toJSON: !0,
451
+ skipNotAttached: !0
452
+ }))), c;
453
+ }
454
+ /**
455
+ * For each attached model root, returns its HTML editable element (if available).
456
+ */
457
+ _getEditables() {
458
+ const t = {};
459
+ for (const s of this.editor.model.document.getRootNames()) {
460
+ const r = this.editor.ui.getEditableElement(s);
461
+ r && (t[s] = r);
462
+ }
463
+ return t;
464
+ }
465
+ /**
466
+ * Traverses the error context and the current editor to find out whether these structures are connected
467
+ * to each other via properties.
468
+ *
469
+ * @internal
470
+ */
471
+ _isErrorComingFromThisItem(t) {
472
+ return b(this._editor, t.context, this._excludedProps);
473
+ }
474
+ /**
475
+ * Detects whether the `create()` call was made in config-based creator mode
476
+ * (i.e., the first argument is a config object rather than a source element or data).
477
+ */
478
+ _detectConfigBasedCreator(t, s) {
479
+ if (typeof t == "string" || l(t) || s && typeof s == "object" && !("destroy" in s) && Object.keys(s).length > 0) return !1;
480
+ if (t && typeof t == "object") {
481
+ const r = Object.values(t);
482
+ if (r.length > 0 && r.every((i) => typeof i == "string" || l(i))) return !1;
483
+ }
484
+ return !0;
485
+ }
486
+ /**
487
+ * Clones the editor configuration.
488
+ */
489
+ _cloneEditorConfiguration(t) {
490
+ return w(t, (s, r) => {
491
+ if (l(s) || r === "context") return s;
492
+ });
493
+ }
494
+ }, D = class {
495
+ constructor(e) {
496
+ a(this, "editor");
497
+ a(this, "_data");
498
+ this.editor = e, this._data = e.config.get("_watchdogInitialData");
499
+ }
500
+ /**
501
+ * @inheritDoc
502
+ */
503
+ init() {
504
+ this.editor.data.on("init", (e) => {
505
+ e.stop(), this.editor.model.enqueueChange({ isUndoable: !1 }, (t) => {
506
+ this._restoreCollaborationData(), this._restoreEditorData(t);
507
+ }), this.editor.data.fire("ready");
508
+ }, { priority: 999 });
509
+ }
510
+ /**
511
+ * Creates a model node (element or text) based on provided JSON.
512
+ */
513
+ _createNode(e, t) {
514
+ if ("name" in t) {
515
+ const s = e.createElement(t.name, t.attributes);
516
+ if (t.children) for (const r of t.children) s._appendChild(this._createNode(e, r));
517
+ return s;
518
+ } else return e.createText(t.data, t.attributes);
519
+ }
520
+ /**
521
+ * Restores the editor by setting the document data, roots attributes and markers.
522
+ */
523
+ _restoreEditorData(e) {
524
+ const t = this.editor;
525
+ Object.entries(this._data.roots).forEach(([s, { content: r, attributes: i }]) => {
526
+ const o = JSON.parse(r), c = JSON.parse(i), n = t.model.document.getRoot(s);
527
+ for (const [d, h] of c) e.setAttribute(d, h, n);
528
+ for (const d of o) {
529
+ const h = this._createNode(e, d);
530
+ e.insert(h, n, "end");
531
+ }
532
+ }), Object.entries(this._data.markers).forEach(([s, r]) => {
533
+ const { document: i } = t.model, { rangeJSON: { start: o, end: c }, ...n } = r, d = i.getRoot(o.root), h = e.createPositionFromPath(d, o.path, o.stickiness), _ = e.createPositionFromPath(d, c.path, c.stickiness), C = e.createRange(h, _);
534
+ e.addMarker(s, {
535
+ range: C,
536
+ ...n
537
+ });
538
+ });
539
+ }
540
+ /**
541
+ * Restores the editor collaboration data - comment threads and suggestions.
542
+ */
543
+ _restoreCollaborationData() {
544
+ const e = JSON.parse(this._data.commentThreads), t = JSON.parse(this._data.suggestions);
545
+ if (this.editor.plugins.has("CommentsRepository")) {
546
+ const s = this.editor.plugins.get("CommentsRepository");
547
+ for (const r of s.getCommentThreads()) s._removeCommentThread({ threadId: r.id });
548
+ e.forEach((r) => {
549
+ const i = this.editor.config.get("collaboration.channelId");
550
+ this.editor.plugins.get("CommentsRepository").addCommentThread({
551
+ channelId: i,
552
+ ...r
553
+ });
554
+ });
555
+ }
556
+ if (this.editor.plugins.has("TrackChangesEditing")) {
557
+ const s = this.editor.plugins.get("TrackChangesEditing");
558
+ for (const r of s.getSuggestions()) s._removeSuggestion(r);
559
+ t.forEach((r) => {
560
+ s.addSuggestionData(r);
561
+ });
562
+ }
563
+ }
564
+ };
565
+ function l(e) {
566
+ return y(e);
567
+ }
568
+ function j(e) {
569
+ const { $rootEditableOptions: t } = Object.fromEntries(JSON.parse(e));
570
+ return !t || typeof t != "object" ? {} : {
571
+ ...t.placeholder && { placeholder: t.placeholder },
572
+ ...t.label && { label: t.label },
573
+ ...t.element && { element: t.element }
574
+ };
575
+ }
576
+ /**
577
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
578
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
579
+ */
580
+ const u = Symbol("MainQueueId");
581
+ var H = class extends E {
582
+ /**
583
+ * The context watchdog class constructor.
584
+ *
585
+ * ```ts
586
+ * const watchdog = new ContextWatchdog( Context );
587
+ *
588
+ * await watchdog.create( contextConfiguration );
589
+ *
590
+ * await watchdog.add( item );
591
+ * ```
592
+ *
593
+ * See the {@glink features/watchdog Watchdog feature guide} to learn more how to use this feature.
594
+ *
595
+ * @param Context The {@link module:core/context~Context} class.
596
+ * @param watchdogConfig The watchdog configuration.
597
+ */
598
+ constructor(t, s = {}) {
599
+ super(s);
600
+ /**
601
+ * A map of internal watchdogs for added items.
602
+ */
603
+ a(this, "_watchdogs", /* @__PURE__ */ new Map());
604
+ /**
605
+ * The watchdog configuration.
606
+ */
607
+ a(this, "_watchdogConfig");
608
+ /**
609
+ * The current context instance.
610
+ */
611
+ a(this, "_context", null);
612
+ /**
613
+ * Context properties (nodes/references) that are gathered during the initial context creation
614
+ * and are used to distinguish the origin of an error.
615
+ */
616
+ a(this, "_contextProps", /* @__PURE__ */ new Set());
617
+ /**
618
+ * An action queue, which is used to handle async functions queuing.
619
+ */
620
+ a(this, "_actionQueues", new O());
621
+ /**
622
+ * The configuration for the {@link module:core/context~Context}.
623
+ */
624
+ a(this, "_contextConfig");
625
+ /**
626
+ * The watched item.
627
+ */
628
+ a(this, "_item");
629
+ this._watchdogConfig = s, this._creator = (r) => t.create(r), this._destructor = (r) => r.destroy(), this._actionQueues.onEmpty(() => {
630
+ this.state === "initializing" && (this.state = "ready", this._fire("stateChange"));
631
+ });
632
+ }
633
+ /**
634
+ * Sets the function that is responsible for the context creation.
635
+ * It expects a function that should return a promise (or `undefined`).
636
+ *
637
+ * ```ts
638
+ * watchdog.setCreator( config => Context.create( config ) );
639
+ * ```
640
+ */
641
+ setCreator(t) {
642
+ this._creator = t;
643
+ }
644
+ /**
645
+ * Sets the function that is responsible for the context destruction.
646
+ * Overrides the default destruction function, which destroys only the context instance.
647
+ * It expects a function that should return a promise (or `undefined`).
648
+ *
649
+ * ```ts
650
+ * watchdog.setDestructor( context => {
651
+ * // Do something before the context is destroyed.
652
+ *
653
+ * return context
654
+ * .destroy()
655
+ * .then( () => {
656
+ * // Do something after the context is destroyed.
657
+ * } );
658
+ * } );
659
+ * ```
660
+ */
661
+ setDestructor(t) {
662
+ this._destructor = t;
663
+ }
664
+ /**
665
+ * The context instance. Keep in mind that this property might be changed when the context watchdog restarts,
666
+ * so do not keep this instance internally. Always operate on the `ContextWatchdog#context` property.
667
+ */
668
+ get context() {
669
+ return this._context;
670
+ }
671
+ /**
672
+ * Initializes the context watchdog. Once it is created, the watchdog takes care about
673
+ * recreating the context and the provided items, and starts the error handling mechanism.
674
+ *
675
+ * ```ts
676
+ * await watchdog.create( {
677
+ * plugins: []
678
+ * } );
679
+ * ```
680
+ *
681
+ * @param contextConfig The context configuration. See {@link module:core/context~Context}.
682
+ */
683
+ create(t = {}) {
684
+ return this._actionQueues.enqueue(u, () => (this._contextConfig = t, this._create()));
685
+ }
686
+ /**
687
+ * Returns an item instance with the given `itemId`.
688
+ *
689
+ * ```ts
690
+ * const editor1 = watchdog.getItem( 'editor1' );
691
+ * ```
692
+ *
693
+ * @param itemId The item ID.
694
+ * @returns The item instance or `undefined` if an item with a given ID has not been found.
695
+ */
696
+ getItem(t) {
697
+ return this._getWatchdog(t)._item;
698
+ }
699
+ /**
700
+ * Gets the state of the given item. See {@link #state} for a list of available states.
701
+ *
702
+ * ```ts
703
+ * const editor1State = watchdog.getItemState( 'editor1' );
704
+ * ```
705
+ *
706
+ * @param itemId Item ID.
707
+ * @returns The state of the item.
708
+ */
709
+ getItemState(t) {
710
+ return this._getWatchdog(t).state;
711
+ }
712
+ /**
713
+ * Adds items to the watchdog. Once created, instances of these items will be available using the {@link #getItem} method.
714
+ *
715
+ * Items can be passed together as an array of objects:
716
+ *
717
+ * ```ts
718
+ * await watchdog.add( [ {
719
+ * id: 'editor1',
720
+ * type: 'editor',
721
+ * config: {
722
+ * attachTo: document.querySelector( '#editor' ),
723
+ * plugins: [ Essentials, Paragraph, Bold, Italic ],
724
+ * toolbar: [ 'bold', 'italic', 'alignment' ]
725
+ * },
726
+ * creator: config => ClassicEditor.create( config )
727
+ * } ] );
728
+ * ```
729
+ *
730
+ * Or one by one as objects:
731
+ *
732
+ * ```ts
733
+ * await watchdog.add( {
734
+ * id: 'editor1',
735
+ * type: 'editor',
736
+ * config: {
737
+ * attachTo: document.querySelector( '#editor' ),
738
+ * plugins: [ Essentials, Paragraph, Bold, Italic ],
739
+ * toolbar: [ 'bold', 'italic', 'alignment' ]
740
+ * },
741
+ * creator: config => ClassicEditor.create( config )
742
+ * } );
743
+ * ```
744
+ *
745
+ * Then an instance can be retrieved using the {@link #getItem} method:
746
+ *
747
+ * ```ts
748
+ * const editor1 = watchdog.getItem( 'editor1' );
749
+ * ```
750
+ *
751
+ * Note that this method can be called multiple times, but for performance reasons it is better
752
+ * to pass all items together.
753
+ *
754
+ * @param itemConfigurationOrItemConfigurations An item configuration object or an array of item configurations.
755
+ */
756
+ add(t) {
757
+ const s = p(t);
758
+ return Promise.all(s.map((r) => this._actionQueues.enqueue(r.id, () => {
759
+ if (this.state === "destroyed") throw new Error("Cannot add items to destroyed watchdog.");
760
+ if (!this._context) throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");
761
+ let i;
762
+ if (this._watchdogs.has(r.id)) throw new Error(`Item with the given id is already added: '${r.id}'.`);
763
+ if (r.type === "editor")
764
+ return i = new R(null, this._watchdogConfig), i.setCreator(r.creator), i._setExcludedProperties(this._contextProps), r.destructor && i.setDestructor(r.destructor), this._watchdogs.set(r.id, i), i.on("error", (o, { error: c, causesRestart: n }) => {
765
+ this._fire("itemError", {
766
+ itemId: r.id,
767
+ error: c
768
+ }), n && this._actionQueues.enqueue(r.id, () => new Promise((d) => {
769
+ const h = () => {
770
+ i.off("restart", h), this._fire("itemRestart", { itemId: r.id }), d();
771
+ };
772
+ i.on("restart", h);
773
+ }));
774
+ }), r.sourceElementOrData !== void 0 ? i.create(r.sourceElementOrData, r.config, this._context) : i.create(r.config, this._context);
775
+ throw new Error(`Not supported item type: '${r.type}'.`);
776
+ })));
777
+ }
778
+ /**
779
+ * Removes and destroys item(s) with given ID(s).
780
+ *
781
+ * ```ts
782
+ * await watchdog.remove( 'editor1' );
783
+ * ```
784
+ *
785
+ * Or
786
+ *
787
+ * ```ts
788
+ * await watchdog.remove( [ 'editor1', 'editor2' ] );
789
+ * ```
790
+ *
791
+ * @param itemIdOrItemIds Item ID or an array of item IDs.
792
+ */
793
+ remove(t) {
794
+ const s = p(t);
795
+ return Promise.all(s.map((r) => this._actionQueues.enqueue(r, () => {
796
+ const i = this._getWatchdog(r);
797
+ return this._watchdogs.delete(r), i.destroy();
798
+ })));
799
+ }
800
+ /**
801
+ * Destroys the context watchdog and all added items.
802
+ * Once the context watchdog is destroyed, new items cannot be added.
803
+ *
804
+ * ```ts
805
+ * await watchdog.destroy();
806
+ * ```
807
+ */
808
+ destroy() {
809
+ return this._actionQueues.enqueue(u, () => (this.state = "destroyed", this._fire("stateChange"), super.destroy(), this._destroy()));
810
+ }
811
+ /**
812
+ * Restarts the context watchdog.
813
+ */
814
+ _restart() {
815
+ return this._actionQueues.enqueue(u, () => (this.state = "initializing", this._fire("stateChange"), this._destroy().catch((t) => {
816
+ console.error("An error happened during destroying the context or items.", t);
817
+ }).then(() => this._create()).then(() => this._fire("restart"))));
818
+ }
819
+ /**
820
+ * Initializes the context watchdog.
821
+ */
822
+ _create() {
823
+ return Promise.resolve().then(() => (this._startErrorHandling(), this._creator(this._contextConfig))).then((t) => (this._context = t, this._contextProps = g(this._context), Promise.all(Array.from(this._watchdogs.values()).map((s) => (s._setExcludedProperties(this._contextProps), s._isUsingConfigBasedCreator ? s.create(void 0, this._context) : s.create(void 0, void 0, this._context))))));
824
+ }
825
+ /**
826
+ * Destroys the context instance and all added items.
827
+ */
828
+ _destroy() {
829
+ return Promise.resolve().then(() => {
830
+ this._stopErrorHandling();
831
+ const t = this._context;
832
+ return this._context = null, this._contextProps = /* @__PURE__ */ new Set(), Promise.all(Array.from(this._watchdogs.values()).map((s) => s.destroy())).then(() => this._destructor(t));
833
+ });
834
+ }
835
+ /**
836
+ * Returns the watchdog for a given item ID.
837
+ *
838
+ * @param itemId Item ID.
839
+ */
840
+ _getWatchdog(t) {
841
+ const s = this._watchdogs.get(t);
842
+ if (!s) throw new Error(`Item with the given id was not registered: ${t}.`);
843
+ return s;
844
+ }
845
+ /**
846
+ * Checks whether an error comes from the context instance and not from the item instances.
847
+ *
848
+ * @internal
849
+ */
850
+ _isErrorComingFromThisItem(t) {
851
+ for (const s of this._watchdogs.values()) if (s._isErrorComingFromThisItem(t)) return !1;
852
+ return b(this._context, t.context);
853
+ }
854
+ }, O = class {
855
+ constructor() {
856
+ a(this, "_onEmptyCallbacks", []);
857
+ a(this, "_queues", /* @__PURE__ */ new Map());
858
+ a(this, "_activeActions", 0);
859
+ }
860
+ /**
861
+ * Used to register callbacks that will be run when the queue becomes empty.
862
+ *
863
+ * @param onEmptyCallback A callback that will be run whenever the queue becomes empty.
864
+ */
865
+ onEmpty(e) {
866
+ this._onEmptyCallbacks.push(e);
867
+ }
868
+ /**
869
+ * It adds asynchronous actions (functions) to the proper queue and runs them one by one.
870
+ *
871
+ * @param queueId The action queue ID.
872
+ * @param action A function that should be enqueued.
873
+ */
874
+ enqueue(e, t) {
875
+ const s = e === u;
876
+ this._activeActions++, this._queues.get(e) || this._queues.set(e, Promise.resolve());
877
+ const r = (s ? Promise.all(this._queues.values()) : Promise.all([this._queues.get(u), this._queues.get(e)])).then(t), i = r.catch(() => {
878
+ });
879
+ return this._queues.set(e, i), r.finally(() => {
880
+ this._activeActions--, this._queues.get(e) === i && this._activeActions === 0 && this._onEmptyCallbacks.forEach((o) => o());
881
+ });
882
+ }
883
+ };
884
+ function p(e) {
885
+ return Array.isArray(e) ? e : [e];
886
+ }
887
+ export {
888
+ H as ContextWatchdog,
889
+ R as EditorWatchdog,
890
+ E as Watchdog
891
+ };
892
+ //# sourceMappingURL=index.js.map