suneditor 3.0.0-beta.9 → 3.0.0-rc.2
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.
- package/README.md +65 -57
- package/dist/suneditor-contents.min.css +1 -0
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +110 -61
- package/src/assets/design/color.css +36 -17
- package/src/assets/design/size.css +2 -0
- package/src/assets/icons/defaultIcons.js +17 -2
- package/src/assets/suneditor-contents.css +51 -16
- package/src/assets/suneditor.css +116 -43
- package/src/core/config/contextProvider.js +288 -0
- package/src/core/config/eventManager.js +188 -0
- package/src/core/config/instanceCheck.js +59 -0
- package/src/core/config/optionProvider.js +452 -0
- package/src/core/editor.js +166 -1637
- package/src/core/event/actions/index.js +229 -0
- package/src/core/event/effects/common.registry.js +74 -0
- package/src/core/event/effects/keydown.registry.js +573 -0
- package/src/core/event/effects/ruleHelpers.js +148 -0
- package/src/core/event/eventOrchestrator.js +944 -0
- package/src/core/event/executor.js +27 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +27 -28
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +10 -8
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +22 -23
- package/src/core/event/handlers/handler_ww_input.js +75 -0
- package/src/core/event/handlers/handler_ww_key.js +228 -0
- package/src/core/event/handlers/handler_ww_mouse.js +166 -0
- package/src/core/event/ports.js +211 -0
- package/src/core/event/reducers/keydown.reducer.js +97 -0
- package/src/core/event/rules/keydown.rule.arrow.js +63 -0
- package/src/core/event/rules/keydown.rule.backspace.js +208 -0
- package/src/core/event/rules/keydown.rule.delete.js +132 -0
- package/src/core/event/rules/keydown.rule.enter.js +150 -0
- package/src/core/event/rules/keydown.rule.tab.js +35 -0
- package/src/core/event/support/defaultLineManager.js +136 -0
- package/src/core/event/support/selectionState.js +204 -0
- package/src/core/kernel/coreKernel.js +320 -0
- package/src/core/kernel/kernelInjector.js +19 -0
- package/src/core/kernel/store.js +173 -0
- package/src/core/{class → logic/dom}/char.js +42 -45
- package/src/core/logic/dom/format.js +1075 -0
- package/src/core/{class → logic/dom}/html.js +743 -624
- package/src/core/logic/dom/inline.js +1847 -0
- package/src/core/logic/dom/listFormat.js +601 -0
- package/src/core/{class → logic/dom}/nodeTransform.js +92 -72
- package/src/core/{class → logic/dom}/offset.js +254 -317
- package/src/core/logic/dom/selection.js +754 -0
- package/src/core/logic/panel/menu.js +389 -0
- package/src/core/logic/panel/toolbar.js +449 -0
- package/src/core/logic/panel/viewer.js +761 -0
- package/src/core/logic/shell/_commandExecutor.js +380 -0
- package/src/core/logic/shell/commandDispatcher.js +241 -0
- package/src/core/logic/shell/component.js +970 -0
- package/src/core/logic/shell/focusManager.js +110 -0
- package/src/core/{base → logic/shell}/history.js +110 -60
- package/src/core/logic/shell/pluginManager.js +363 -0
- package/src/core/logic/shell/shortcuts.js +130 -0
- package/src/core/logic/shell/ui.js +904 -0
- package/src/core/schema/context.js +66 -0
- package/src/core/schema/frameContext.js +160 -0
- package/src/core/schema/options.js +628 -0
- package/src/core/section/constructor.js +194 -500
- package/src/core/section/documentType.js +297 -222
- package/src/events.js +808 -543
- package/src/helper/clipboard.js +27 -16
- package/src/helper/converter.js +100 -78
- package/src/helper/dom/domCheck.js +56 -30
- package/src/helper/dom/domQuery.js +159 -89
- package/src/helper/dom/domUtils.js +114 -49
- package/src/helper/dom/index.js +5 -1
- package/src/helper/env.js +26 -26
- package/src/helper/index.js +1 -1
- package/src/helper/keyCodeMap.js +25 -28
- package/src/helper/numbers.js +4 -8
- package/src/helper/unicode.js +4 -8
- package/src/hooks/base.js +307 -0
- package/src/hooks/params.js +130 -0
- package/src/interfaces/contracts.js +227 -0
- package/src/interfaces/index.js +7 -0
- package/src/interfaces/plugins.js +239 -0
- package/src/langs/ckb.js +4 -4
- package/src/langs/cs.js +4 -4
- package/src/langs/da.js +4 -4
- package/src/langs/de.js +4 -4
- package/src/langs/en.js +4 -4
- package/src/langs/es.js +4 -4
- package/src/langs/fa.js +4 -4
- package/src/langs/fr.js +4 -4
- package/src/langs/he.js +4 -4
- package/src/langs/hu.js +4 -4
- package/src/langs/it.js +4 -4
- package/src/langs/ja.js +4 -4
- package/src/langs/km.js +4 -4
- package/src/langs/ko.js +4 -4
- package/src/langs/lv.js +4 -4
- package/src/langs/nl.js +4 -4
- package/src/langs/pl.js +4 -4
- package/src/langs/pt_br.js +13 -13
- package/src/langs/ro.js +4 -4
- package/src/langs/ru.js +4 -4
- package/src/langs/se.js +4 -4
- package/src/langs/tr.js +4 -4
- package/src/langs/uk.js +4 -4
- package/src/langs/ur.js +4 -4
- package/src/langs/zh_cn.js +4 -4
- package/src/modules/{Browser.js → contract/Browser.js} +119 -128
- package/src/modules/{ColorPicker.js → contract/ColorPicker.js} +132 -142
- package/src/modules/contract/Controller.js +589 -0
- package/src/modules/{Figure.js → contract/Figure.js} +591 -411
- package/src/modules/{HueSlider.js → contract/HueSlider.js} +125 -86
- package/src/modules/contract/Modal.js +357 -0
- package/src/modules/contract/index.js +9 -0
- package/src/modules/manager/ApiManager.js +197 -0
- package/src/modules/{FileManager.js → manager/FileManager.js} +128 -160
- package/src/modules/manager/index.js +5 -0
- package/src/modules/{ModalAnchorEditor.js → ui/ModalAnchorEditor.js} +108 -138
- package/src/modules/{SelectMenu.js → ui/SelectMenu.js} +119 -120
- package/src/modules/{_DragHandle.js → ui/_DragHandle.js} +1 -1
- package/src/modules/ui/index.js +6 -0
- package/src/plugins/browser/audioGallery.js +23 -26
- package/src/plugins/browser/fileBrowser.js +25 -28
- package/src/plugins/browser/fileGallery.js +20 -23
- package/src/plugins/browser/imageGallery.js +24 -23
- package/src/plugins/browser/videoGallery.js +27 -29
- package/src/plugins/command/blockquote.js +11 -17
- package/src/plugins/command/exportPDF.js +26 -26
- package/src/plugins/command/fileUpload.js +138 -133
- package/src/plugins/command/list_bulleted.js +48 -44
- package/src/plugins/command/list_numbered.js +48 -44
- package/src/plugins/dropdown/align.js +64 -50
- package/src/plugins/dropdown/backgroundColor.js +34 -35
- package/src/plugins/dropdown/{formatBlock.js → blockStyle.js} +43 -37
- package/src/plugins/dropdown/font.js +50 -36
- package/src/plugins/dropdown/fontColor.js +34 -35
- package/src/plugins/dropdown/hr.js +55 -50
- package/src/plugins/dropdown/layout.js +20 -15
- package/src/plugins/dropdown/lineHeight.js +46 -30
- package/src/plugins/dropdown/list.js +32 -33
- package/src/plugins/dropdown/paragraphStyle.js +40 -34
- package/src/plugins/dropdown/table/index.js +915 -0
- package/src/plugins/dropdown/table/render/table.html.js +308 -0
- package/src/plugins/dropdown/table/render/table.menu.js +121 -0
- package/src/plugins/dropdown/table/services/table.cell.js +465 -0
- package/src/plugins/dropdown/table/services/table.clipboard.js +414 -0
- package/src/plugins/dropdown/table/services/table.grid.js +504 -0
- package/src/plugins/dropdown/table/services/table.resize.js +463 -0
- package/src/plugins/dropdown/table/services/table.selection.js +466 -0
- package/src/plugins/dropdown/table/services/table.style.js +844 -0
- package/src/plugins/dropdown/table/shared/table.constants.js +109 -0
- package/src/plugins/dropdown/table/shared/table.utils.js +219 -0
- package/src/plugins/dropdown/template.js +20 -15
- package/src/plugins/dropdown/textStyle.js +28 -22
- package/src/plugins/field/mention.js +54 -49
- package/src/plugins/index.js +5 -5
- package/src/plugins/input/fontSize.js +100 -97
- package/src/plugins/input/pageNavigator.js +13 -10
- package/src/plugins/modal/audio.js +208 -219
- package/src/plugins/modal/drawing.js +99 -104
- package/src/plugins/modal/embed.js +323 -312
- package/src/plugins/modal/image/index.js +942 -0
- package/src/plugins/modal/image/render/image.html.js +150 -0
- package/src/plugins/modal/image/services/image.size.js +198 -0
- package/src/plugins/modal/image/services/image.upload.js +216 -0
- package/src/plugins/modal/image/shared/image.constants.js +20 -0
- package/src/plugins/modal/link.js +74 -54
- package/src/plugins/modal/math.js +126 -119
- package/src/plugins/modal/video/index.js +858 -0
- package/src/plugins/modal/video/render/video.html.js +131 -0
- package/src/plugins/modal/video/services/video.size.js +281 -0
- package/src/plugins/modal/video/services/video.upload.js +92 -0
- package/src/plugins/popup/anchor.js +57 -49
- package/src/suneditor.js +73 -61
- package/src/themes/cobalt.css +155 -0
- package/src/themes/dark.css +143 -120
- package/src/typedef.js +214 -63
- package/types/assets/icons/defaultIcons.d.ts +8 -0
- package/types/assets/suneditor-contents.css.d.ts +1 -0
- package/types/assets/suneditor.css.d.ts +1 -0
- package/types/core/config/contextProvider.d.ts +148 -0
- package/types/core/config/eventManager.d.ts +68 -0
- package/types/core/config/instanceCheck.d.ts +33 -0
- package/types/core/config/optionProvider.d.ts +147 -0
- package/types/core/editor.d.ts +27 -586
- package/types/core/event/actions/index.d.ts +50 -0
- package/types/core/event/effects/common.registry.d.ts +56 -0
- package/types/core/event/effects/keydown.registry.d.ts +80 -0
- package/types/core/event/effects/ruleHelpers.d.ts +36 -0
- package/types/core/event/eventOrchestrator.d.ts +191 -0
- package/types/core/event/executor.d.ts +13 -0
- package/types/core/event/handlers/handler_toolbar.d.ts +38 -0
- package/types/core/event/handlers/handler_ww_clipboard.d.ts +36 -0
- package/types/core/event/handlers/handler_ww_dragDrop.d.ts +26 -0
- package/types/core/event/handlers/handler_ww_input.d.ts +38 -0
- package/types/core/event/handlers/handler_ww_key.d.ts +40 -0
- package/types/core/event/handlers/handler_ww_mouse.d.ts +47 -0
- package/types/core/event/ports.d.ts +256 -0
- package/types/core/event/reducers/keydown.reducer.d.ts +84 -0
- package/types/core/event/rules/keydown.rule.arrow.d.ts +19 -0
- package/types/core/event/rules/keydown.rule.backspace.d.ts +18 -0
- package/types/core/event/rules/keydown.rule.delete.d.ts +18 -0
- package/types/core/event/rules/keydown.rule.enter.d.ts +18 -0
- package/types/core/event/rules/keydown.rule.tab.d.ts +18 -0
- package/types/core/event/support/defaultLineManager.d.ts +22 -0
- package/types/core/event/support/selectionState.d.ts +29 -0
- package/types/core/kernel/coreKernel.d.ts +219 -0
- package/types/core/kernel/kernelInjector.d.ts +16 -0
- package/types/core/kernel/store.d.ts +170 -0
- package/types/core/logic/dom/char.d.ts +46 -0
- package/types/core/logic/dom/format.d.ts +234 -0
- package/types/core/logic/dom/html.d.ts +290 -0
- package/types/core/logic/dom/inline.d.ts +93 -0
- package/types/core/logic/dom/listFormat.d.ts +101 -0
- package/types/core/logic/dom/nodeTransform.d.ts +110 -0
- package/types/core/logic/dom/offset.d.ts +335 -0
- package/types/core/logic/dom/selection.d.ts +165 -0
- package/types/core/logic/panel/menu.d.ts +93 -0
- package/types/core/logic/panel/toolbar.d.ts +128 -0
- package/types/core/logic/panel/viewer.d.ts +89 -0
- package/types/core/logic/shell/_commandExecutor.d.ts +18 -0
- package/types/core/logic/shell/commandDispatcher.d.ts +65 -0
- package/types/core/logic/shell/component.d.ts +182 -0
- package/types/core/logic/shell/focusManager.d.ts +31 -0
- package/types/core/{base → logic/shell}/history.d.ts +13 -12
- package/types/core/logic/shell/pluginManager.d.ts +115 -0
- package/types/core/logic/shell/shortcuts.d.ts +131 -0
- package/types/core/logic/shell/ui.d.ts +261 -0
- package/types/core/schema/context.d.ts +104 -0
- package/types/core/schema/frameContext.d.ts +320 -0
- package/types/core/schema/options.d.ts +1241 -0
- package/types/core/section/constructor.d.ts +117 -652
- package/types/core/section/documentType.d.ts +43 -61
- package/types/events.d.ts +796 -65
- package/types/helper/clipboard.d.ts +5 -4
- package/types/helper/converter.d.ts +55 -43
- package/types/helper/dom/domCheck.d.ts +27 -19
- package/types/helper/dom/domQuery.d.ts +76 -57
- package/types/helper/dom/domUtils.d.ts +62 -39
- package/types/helper/dom/index.d.ts +87 -1
- package/types/helper/env.d.ts +16 -13
- package/types/helper/index.d.ts +8 -2
- package/types/helper/keyCodeMap.d.ts +24 -23
- package/types/helper/numbers.d.ts +4 -6
- package/types/helper/unicode.d.ts +4 -3
- package/types/hooks/base.d.ts +239 -0
- package/types/hooks/params.d.ts +65 -0
- package/types/index.d.ts +20 -117
- package/types/interfaces/contracts.d.ts +183 -0
- package/types/interfaces/index.d.ts +3 -0
- package/types/interfaces/plugins.d.ts +168 -0
- package/types/langs/_Lang.d.ts +2 -2
- package/types/langs/index.d.ts +2 -2
- package/types/modules/contract/Browser.d.ts +262 -0
- package/types/modules/contract/ColorPicker.d.ts +99 -0
- package/types/modules/contract/Controller.d.ts +204 -0
- package/types/modules/contract/Figure.d.ts +529 -0
- package/types/modules/{HueSlider.d.ts → contract/HueSlider.d.ts} +39 -28
- package/types/modules/contract/Modal.d.ts +62 -0
- package/types/modules/contract/index.d.ts +7 -0
- package/types/modules/manager/ApiManager.d.ts +106 -0
- package/types/modules/manager/FileManager.d.ts +124 -0
- package/types/modules/manager/index.d.ts +3 -0
- package/types/modules/ui/ModalAnchorEditor.d.ts +152 -0
- package/types/modules/ui/SelectMenu.d.ts +107 -0
- package/types/modules/{_DragHandle.d.ts → ui/_DragHandle.d.ts} +1 -0
- package/types/modules/ui/index.d.ts +4 -0
- package/types/plugins/browser/audioGallery.d.ts +33 -41
- package/types/plugins/browser/fileBrowser.d.ts +42 -50
- package/types/plugins/browser/fileGallery.d.ts +33 -41
- package/types/plugins/browser/imageGallery.d.ts +30 -37
- package/types/plugins/browser/videoGallery.d.ts +33 -41
- package/types/plugins/command/blockquote.d.ts +4 -21
- package/types/plugins/command/exportPDF.d.ts +23 -33
- package/types/plugins/command/fileUpload.d.ts +80 -100
- package/types/plugins/command/list_bulleted.d.ts +9 -35
- package/types/plugins/command/list_numbered.d.ts +9 -35
- package/types/plugins/dropdown/align.d.ts +23 -46
- package/types/plugins/dropdown/backgroundColor.d.ts +35 -53
- package/types/plugins/dropdown/blockStyle.d.ts +45 -0
- package/types/plugins/dropdown/font.d.ts +18 -41
- package/types/plugins/dropdown/fontColor.d.ts +35 -53
- package/types/plugins/dropdown/hr.d.ts +26 -52
- package/types/plugins/dropdown/layout.d.ts +19 -25
- package/types/plugins/dropdown/lineHeight.d.ts +21 -39
- package/types/plugins/dropdown/list.d.ts +6 -34
- package/types/plugins/dropdown/paragraphStyle.d.ts +34 -45
- package/types/plugins/dropdown/table/index.d.ts +158 -0
- package/types/plugins/dropdown/table/render/table.html.d.ts +71 -0
- package/types/plugins/dropdown/table/render/table.menu.d.ts +59 -0
- package/types/plugins/dropdown/table/services/table.cell.d.ts +76 -0
- package/types/plugins/dropdown/table/services/table.clipboard.d.ts +26 -0
- package/types/plugins/dropdown/table/services/table.grid.d.ts +77 -0
- package/types/plugins/dropdown/table/services/table.resize.d.ts +72 -0
- package/types/plugins/dropdown/table/services/table.selection.d.ts +59 -0
- package/types/plugins/dropdown/table/services/table.style.d.ts +162 -0
- package/types/plugins/dropdown/table/shared/table.constants.d.ts +134 -0
- package/types/plugins/dropdown/table/shared/table.utils.d.ts +91 -0
- package/types/plugins/dropdown/template.d.ts +19 -25
- package/types/plugins/dropdown/textStyle.d.ts +23 -30
- package/types/plugins/field/mention.d.ts +66 -72
- package/types/plugins/index.d.ts +41 -40
- package/types/plugins/input/fontSize.d.ts +57 -96
- package/types/plugins/input/pageNavigator.d.ts +5 -8
- package/types/plugins/modal/audio.d.ts +60 -153
- package/types/plugins/modal/drawing.d.ts +16 -118
- package/types/plugins/modal/embed.d.ts +46 -166
- package/types/plugins/modal/image/index.d.ts +281 -0
- package/types/plugins/modal/image/render/image.html.d.ts +45 -0
- package/types/plugins/modal/image/services/image.size.d.ts +55 -0
- package/types/plugins/modal/image/services/image.upload.d.ts +24 -0
- package/types/plugins/modal/image/shared/image.constants.d.ts +17 -0
- package/types/plugins/modal/link.d.ts +46 -66
- package/types/plugins/modal/math.d.ts +17 -86
- package/types/plugins/modal/{video.d.ts → video/index.d.ts} +89 -221
- package/types/plugins/modal/video/render/video.html.d.ts +37 -0
- package/types/plugins/modal/video/services/video.size.d.ts +74 -0
- package/types/plugins/modal/video/services/video.upload.d.ts +19 -0
- package/types/plugins/popup/anchor.d.ts +8 -38
- package/types/suneditor.d.ts +55 -24
- package/types/typedef.d.ts +344 -228
- package/CONTRIBUTING.md +0 -186
- package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
- package/src/core/base/eventHandlers/handler_ww_mouse.js +0 -194
- package/src/core/base/eventManager.js +0 -1523
- package/src/core/class/component.js +0 -856
- package/src/core/class/format.js +0 -3433
- package/src/core/class/menu.js +0 -346
- package/src/core/class/selection.js +0 -610
- package/src/core/class/shortcuts.js +0 -98
- package/src/core/class/toolbar.js +0 -431
- package/src/core/class/ui.js +0 -424
- package/src/core/class/viewer.js +0 -750
- package/src/core/section/actives.js +0 -266
- package/src/core/section/context.js +0 -102
- package/src/editorInjector/_classes.js +0 -36
- package/src/editorInjector/_core.js +0 -87
- package/src/editorInjector/index.js +0 -73
- package/src/modules/ApiManager.js +0 -191
- package/src/modules/Controller.js +0 -474
- package/src/modules/Modal.js +0 -346
- package/src/modules/index.js +0 -14
- package/src/plugins/dropdown/table.js +0 -4034
- package/src/plugins/modal/image.js +0 -1376
- package/src/plugins/modal/video.js +0 -1226
- package/types/core/base/eventHandlers/handler_toolbar.d.ts +0 -41
- package/types/core/base/eventHandlers/handler_ww_clipboard.d.ts +0 -40
- package/types/core/base/eventHandlers/handler_ww_dragDrop.d.ts +0 -35
- package/types/core/base/eventHandlers/handler_ww_key_input.d.ts +0 -45
- package/types/core/base/eventHandlers/handler_ww_mouse.d.ts +0 -39
- package/types/core/base/eventManager.d.ts +0 -401
- package/types/core/class/char.d.ts +0 -61
- package/types/core/class/component.d.ts +0 -213
- package/types/core/class/format.d.ts +0 -623
- package/types/core/class/html.d.ts +0 -430
- package/types/core/class/menu.d.ts +0 -126
- package/types/core/class/nodeTransform.d.ts +0 -93
- package/types/core/class/offset.d.ts +0 -522
- package/types/core/class/selection.d.ts +0 -188
- package/types/core/class/shortcuts.d.ts +0 -142
- package/types/core/class/toolbar.d.ts +0 -189
- package/types/core/class/ui.d.ts +0 -164
- package/types/core/class/viewer.d.ts +0 -140
- package/types/core/section/actives.d.ts +0 -46
- package/types/core/section/context.d.ts +0 -45
- package/types/editorInjector/_classes.d.ts +0 -41
- package/types/editorInjector/_core.d.ts +0 -87
- package/types/editorInjector/index.d.ts +0 -69
- package/types/modules/ApiManager.d.ts +0 -125
- package/types/modules/Browser.d.ts +0 -326
- package/types/modules/ColorPicker.d.ts +0 -135
- package/types/modules/Controller.d.ts +0 -251
- package/types/modules/Figure.d.ts +0 -517
- package/types/modules/FileManager.d.ts +0 -202
- package/types/modules/Modal.d.ts +0 -111
- package/types/modules/ModalAnchorEditor.d.ts +0 -236
- package/types/modules/SelectMenu.d.ts +0 -194
- package/types/modules/index.d.ts +0 -26
- package/types/plugins/dropdown/formatBlock.d.ts +0 -55
- package/types/plugins/dropdown/table.d.ts +0 -627
- package/types/plugins/modal/image.d.ts +0 -451
- /package/{LICENSE → LICENSE.txt} +0 -0
package/dist/suneditor.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var t={cfbI:function(t){var e,i;e="undefined"!=typeof window?window:this,i=function(t,e){const i={code:"en",align:"Align",alignBottom:"Align bottom",alignCenter:"Align center",alignJustify:"Align justify",alignLeft:"Align left",alignMiddle:"Align middle",alignRight:"Align right",alignTop:"Align top",anchor:"Anchor",asBlock:"As a block",asInline:"As a inline",asLink:"As a link",audio:"Audio",audioGallery:"Audio gallery",audio_modal_file:"Select from files",audio_modal_title:"Insert Audio",audio_modal_url:"Audio URL",autoSize:"Auto size",backgroundColor:"Background color",basic:"Basic",blockStyle:"Block style",bold:"Bold",border:"Border",border_all:"Border all",border_inside:"Border inside",border_horizontal:"Border horizontal",border_vertical:"Border vertical",border_outside:"Border outside",border_left:"Border left",border_top:"Border top",border_right:"Border right",border_bottom:"Border bottom",border_none:"Border none",bulletedList:"Bulleted list",cancel:"Cancel",caption:"Insert description",cellProperties:"Cell properties",center:"Center",close:"Close",codeView:"Code view",color:"Color",colorPicker:"Color picker",column:"Column",comment:"Comments",commentAdd:"Add comment",commentShow:"Show comments",copy:"Copy",copyFormat:"Paint Formatting",cut:"Cut",default:"Default",deleteColumn:"Delete column",deleteRow:"Delete row",dir_ltr:"Left to right",dir_rtl:"Right to left",download:"Download",drag:"Drag",drawing:"Drawing",drawing_modal_title:"Drawing",edit:"Edit",embed:"Embed",embed_modal_title:"Embed",embed_modal_source:"Embed Source / URL",exportPDF:"Export to PDF",exportWord:"Export to Word",find:"Find",decrease:"Decrease",increase:"Increase",fileBrowser:"File browser",fileGallery:"File gallery",fileUpload:"File upload",fixedColumnWidth:"Fixed column width",font:"Font",fontColor:"Font color",fontSize:"Size",formats:"Formats",fullScreen:"Full screen",height:"Height",horizontalLine:"Horizontal line",horizontalSplit:"Horizontal split",hr_dashed:"Dashed",hr_dotted:"Dotted",hr_solid:"Solid",id:"ID",image:"Image",imageGallery:"Image gallery",image_modal_altText:"Alternative text",image_modal_file:"Select from files",image_modal_title:"Insert image",image_modal_url:"Image URL",importWord:"Import from Word",indent:"Indent",inlineStyle:"Inline style",insertColumnAfter:"Insert column after",insertColumnBefore:"Insert column before",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertLine:"Insert line",italic:"Italic",layout:"Layout",left:"Left",lineHeight:"Line height",link:"Link",link_modal_bookmark:"Bookmark",link_modal_downloadLinkCheck:"Download link",link_modal_newWindowCheck:"Open in new window",link_modal_text:"Text to display",link_modal_title:"Insert Link",link_modal_url:"URL to link",link_modal_relAttribute:"Rel attribute",list:"List",math:"Math",math_modal_fontSizeLabel:"Font Size",math_modal_inputLabel:"Mathematical Notation",math_modal_previewLabel:"Preview",math_modal_title:"Math",maxSize:"Max size",mediaGallery:"Media gallery",mention:"Mention",menu_bordered:"Bordered",menu_code:"Code",menu_neon:"Neon",menu_shadow:"Shadow",menu_spaced:"Spaced",menu_translucent:"Translucent",mergeCells:"Merge cells",minSize:"Min size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",newDocument:"New document",numberedList:"Numbered list",outdent:"Outdent",pageBreak:"Page break",pageDown:"Page down",pageNumber:"Page number",pageUp:"Page up",paragraphStyle:"Paragraph style",preview:"Preview",print:"print",proportion:"Constrain proportions",ratio:"Ratio",redo:"Redo",remove:"Remove",removeFormat:"Remove Format",replace:"Replace",replaceAll:"Replace all",resize100:"Zoom 100%",resize25:"Zoom 25%",resize50:"Zoom 50%",resize75:"Zoom 75%",resize:"Resize",revert:"Revert",revisionHistory:"Revision History",right:"Right",rotateLeft:"Rotate left",rotateRight:"Rotate right",row:"Row",save:"Save",search:"Search",selectAll:"Select All",showBlocks:"Show blocks",size:"Size",splitCells:"Split cells",strike:"Strike",submitButton:"Submit",subscript:"Subscript",superscript:"Superscript",table:"Table",tableHeader:"Table header",tableProperties:"Table properties",tags:"Tags",tag_blockquote:"Quote",tag_div:"Normal (DIV)",tag_h:"Header",tag_p:"Paragraph",tag_pre:"Code",template:"Template",textStyle:"Text style",title:"Title",underline:"Underline",undo:"Undo",unmergeCells:"Unmerge cells",unlink:"Unlink",verticalSplit:"Vertical split",video:"Video",videoGallery:"Video gallery",video_modal_file:"Select from files",video_modal_title:"Insert Video",video_modal_url:"Media embed URL, YouTube/Vimeo",width:"Width",message_copy_success:"Copied to clipboard",message_copy_fail:"Copy failed. Please copy manually."};return void 0===e&&(t.SUNEDITOR_LANG||Object.defineProperty(t,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(t.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:i})),i},"object"==typeof t.exports?t.exports=e.document?i(e,!0):function(t){if(!t.document)throw new Error("SUNEDITOR_LANG a window with a document");return i(t)}:i(e)},JybH:(t,e,i)=>{"use strict";i.r(e)},"+qkj":(t,e,i)=>{"use strict";i.r(e)}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var o=e[s]={exports:{}};return t[s].call(o.exports,o,o.exports,i),o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";const t=window,e=document,s=Symbol("noEventHandler"),n=Symbol("onOverComponent"),o=navigator.userAgent.toLowerCase();const l="function"==typeof ResizeObserver,r="function"==typeof navigator.clipboard?.write,a=/Edg/.test(navigator.userAgent),h=/(Mac|iPhone|iPod|iPad)/.test(navigator.userAgent),c=o.includes("chrome/")&&!o.includes("edge/"),d=!!o.match(/gecko\/\d+/),u=!!t.chrome,p=o.includes("applewebkit/")&&!o.includes("chrome"),g=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(o)||navigator.maxTouchPoints>0&&"ontouchstart"in t,m=o.includes("android"),f=h?"⌘":"CTRL",_=h?"⇧":"+SHIFT",b=t.devicePixelRatio,y={_w:t,_d:e,NO_EVENT:s,ON_OVER_COMPONENT:n,getXMLHttpRequest:function(){return new XMLHttpRequest},getPageStyle:function(t){let i="";const s=(t||e).styleSheets;for(let t,e=0,n=s.length;e<n;e++){try{t=s[e].cssRules}catch(t){continue}if(t)for(let e=0,s=t.length;e<s;e++)i+=t[e].cssText}return i},getIncludePath:function(t,i){let s="";const n=[],o="js"===i?"script":"link",l="js"===i?"src":"href";let r="(?:";for(let e=0,i=t.length;e<i;e++)r+=t[e]+(e<i-1?"|":")");const a=new RegExp(`(^|.*[\\/])${r}(\\.[^\\/]+)?.${i}(?:\\?.*|;.*)?$`,"i"),h=new RegExp(`.+\\.${i}(?:\\?.*|;.*)?$`,"i");for(let t=e.getElementsByTagName(o),i=0;i<t.length;i++)h.test(t[i][l])&&n.push(t[i]);for(let t=0;t<n.length;t++){const e=n[t][l].match(a);if(e){s=e[0];break}}if(""===s&&(s=n.length>0?n[0][l]:""),s.includes(":/")||"//"===s.slice(0,2)||(s=!1===s.includes("/")?location.href.match(/^.*?:\/\/[^/]*/)[0]+s:location.href.match(/^[^?]*\/(?:)/)[0]+s),!s)throw"[SUNEDITOR.helper.env.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (path: +"+s+", extension: "+i+")";return s},isResizeObserverSupported:l,isClipboardSupported:r,isEdge:a,isBlink:c,isGecko:d,isChromium:u,isSafari:p,isOSX_IOS:h,isAndroid:m,isMobile:g,cmdIcon:f,shiftIcon:_,DPI:b,KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},v=8203,C=String.fromCharCode(v),w=new RegExp(String.fromCharCode(v),"g"),x=new RegExp("^"+String.fromCharCode(v)+"+$");const k={zeroWidthSpace:C,zeroWidthRegExp:w,onlyZeroWidthRegExp:x,escapeStringRegexp:function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},S=/https?:\/\/[^\s]+/g,E={"xx-small":.5625,"x-small":.625,small:.8333,medium:1,large:1.125,"x-large":1.5,"xx-large":2,"xxx-large":2.5};function T(t){if(3===t.nodeType){const e=t.nodeValue.trim();return e?{type:"text",content:e}:null}if(1===t.nodeType){const e={type:"element",tag:t.tagName.toLowerCase(),attributes:{},children:[]};for(const i of t.attributes)e.attributes[i.name]=i.value;for(const i of t.childNodes){const t=T(i);t&&e.children.push(t)}return e}return null}function H(t){const e={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"};return t.replace(/&|\u00A0|'|"|<|>/g,(t=>"string"==typeof e[t]?e[t]:t))}function M(t){return"string"==typeof t?t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase())):t.map((function(t){return M(t)}))}function L(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const N={htmlToJson:function(t){return T((new DOMParser).parseFromString(t,"text/html").body)},jsonToHtml:function t(e){if(!e)return"";if("text"===e.type)return H(e.content||"");if("element"===e.type){const{tag:i,attributes:s={},children:n=[]}=e,o=Object.entries(s).map((([t,e])=>`${t}="${H(e)}"`)).join(" "),l=`</${i}>`;return`${o?`<${i} ${o}>`:`<${i}>`}${n.map(t).join("")}${l}`}return""},htmlToEntity:H,entityToHTML:function(t){const e={"&":"&"," ":" ","'":"'",""":'"',"<":"<",">":">"};return t.replace(/&| |'|"|\$lt;|\$gt;/g,(t=>"string"==typeof e[t]?e[t]:t))},debounce:function(e,i){let s;return function(...n){t.clearTimeout(s),s=t.setTimeout((()=>{t.clearTimeout(s),e(...n)}),i)}},syncMaps:function(t,e){e.forEach(((e,i)=>{t.set(i,e)})),t.forEach(((i,s)=>{e.has(s)||t.delete(s)}))},mergeMaps:function(...t){const e=t.filter((t=>t instanceof Map)).flatMap((t=>[...t]));return new Map(e)},getValues:function(t){return t?Object.keys(t).map((function(e){return t[e]})):[]},camelToKebabCase:M,kebabToCamelCase:function(t){return"string"==typeof t?t.replace(/-[a-zA-Z]/g,(t=>t.replace("-","").toUpperCase())):t.map((function(t){return M(t)}))},toFontUnit:function(t,e){const i=e.match(/(\d+(?:\.\d+)?)(.+)/),s=i?Number(i[1]):E[e],n=i?i[2]:"rem";let o=s;switch(/em/.test(n)?o=Math.round(s/.0625):"pt"===n?o=Math.round(1.333*s):"%"===n&&(o=s/100),t){case"em":case"rem":return(.0625*o).toFixed(2)+t;case"%":return 100*Number((.0625*o).toFixed(2))+t;case"pt":return Math.round(o/1.333)+t;default:return o+t}},nodeListToArray:function(t){return t?Array.prototype.slice.call(t):[]},swapKeyValue:function(t){const e={},i=Object.prototype.hasOwnProperty;for(const s in t)i.call(t,s)&&(e[t[s]]=s);return e},createElementWhitelist:function(t){return new RegExp(`<\\/?\\b(?!\\b${(t||"").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},createElementBlacklist:function(t){return new RegExp(`<\\/?\\b(?:\\b${(t||"^").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},isHexColor:L,rgb2hex:function(t){if(L(t)||!t)return t;const e=t.match(/^rgba?[\s+]?\(([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?/i);if(e&&e.length>=4){const i=("0"+parseInt(e[1],10).toString(16)).slice(-2),s=("0"+parseInt(e[2],10).toString(16)).slice(-2),n=("0"+parseInt(e[3],10).toString(16)).slice(-2);let o="";if(t.includes("rgba")){const e=t.match(/[\s+]?([\d]+\.?[\d]*)[\s+]?/i);e&&(o=("0"+Math.round(255*parseFloat(e[1])).toString(16)).slice(-2))}return`#${i}${s}${n}${o}`}return t},getWidthInPercentage:function(e,i){const s=i||e.parentElement,n=t.getComputedStyle(s),o=parseFloat(n.paddingLeft),l=parseFloat(n.paddingRight),r=s.offsetWidth-s.clientWidth,a=s.offsetWidth-o-l-r;return e.offsetWidth/a*100},textToAnchor:function(t){if(3===t.nodeType&&S.test(t.textContent)&&!/^A$/i.test(t.parentNode?.nodeName)){const i=t.textContent,s=e.createDocumentFragment();let n=0;return i.replace(S,((t,o)=>{o>0&&s.appendChild(e.createTextNode(i.slice(0,o)));const l=e.createElement("a");return l.href=t,l.target="_blank",l.textContent=t,s.appendChild(l),n=o+t.length,n<i.length&&s.appendChild(e.createTextNode(i.slice(n))),t})),t.parentNode.replaceChild(s,t),!0}return!1},spanToStyleNode:function(t,i){if(1===i.nodeType&&/^SPAN$/i.test(i.nodeName)&&i.hasAttribute("style")){const s=i.getAttribute("style"),n=[];if(Object.keys(t).forEach((i=>{if(t[i].regex.test(s)){const s=e.createElement(t[i].tag);n.push(s)}})),n.length>0){const t=e.createElement("span");let s=i.firstChild;n.forEach(((e,i)=>{0===i?t.appendChild(e):n[i-1].appendChild(e)}));const o=n[n.length-1];for(;s;){const t=s.nextSibling;o.appendChild(s),s=t}for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(t)}}},addUrlQuery:function(t,e){if(e.length>0)if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t},_setDefaultOptionStyle:function(t,e){let i="";t.get("height")&&(i+="height:"+t.get("height")+";"),t.get("minHeight")&&(i+="min-height:"+t.get("minHeight")+";"),t.get("maxHeight")&&(i+="max-height:"+t.get("maxHeight")+";"),t.get("width")&&(i+="width:"+t.get("width")+";"),t.get("minWidth")&&(i+="min-width:"+t.get("minWidth")+";"),t.get("maxWidth")&&(i+="max-width:"+t.get("maxWidth")+";");let s="",n="",o="";const l=(e=i+e).split(";");for(let e,i=0,r=l.length;i<r;i++)e=l[i].trim(),e&&(/^(min-|max-)?width\s*:/.test(e)||/^(z-index|position|display)\s*:/.test(e)?s+=e+";":/^(min-|max-)?height\s*:/.test(e)?(/^height/.test(e)&&"auto"===e.split(":")[1].trim()&&t.set("height","auto"),n+=e+";"):o+=e+";");return{top:s,frame:n,editor:o}},_setIframeStyleLinks:function(t){let i="";if(t)for(let s,n=0,o=t.length;n<o;n++){if(s=[],/(^https?:\/\/)|(^data:text\/css,)/.test(t[n]))s.push(t[n]);else{const i=new RegExp(`(^|.*[\\/])${t[n]}(\\..+)?.css((\\??.+?)|\\b)$`,"i");for(let t,n=e.getElementsByTagName("link"),o=0,l=n.length;o<l;o++)t=n[o].href.match(i),t&&s.push(t[0])}if(!s||0===s.length)throw'[SUNEDITOR.constructor.iframe.fail] The suneditor CSS files installation path could not be automatically detected. Please set the option property "iframe_cssFileName" before creating editor instances.';for(let t=0,e=s.length;t<e;t++)i+='<link href="'+s[t]+'" rel="stylesheet">'}return i},_setAutoHeightStyle:function(t){return"auto"===t?"<style>\n/** Iframe height auto */\nbody{height: min-content; overflow: hidden;}\n</style>":""}},A=N;function B(t){return null!=t&&("string"!=typeof t&&(t=t.textContent),""===t||x.test(t))}function I(t){return 1===t?.nodeType}function V(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function O(t){return 1===t?.nodeType&&(G.hasClass(t,"se-wrapper-wysiwyg|sun-editor-carrier-wrapper|se-wrapper")||/^BODY$/i.test(t.nodeName))}const R={isZeroWidth:B,isEdgePoint:function(t,e,i){return"end"!==i&&0===e||(!i||"front"!==i)&&!t.nodeValue&&1===e||(!i||"end"===i)&&t.nodeValue&&e>=t.nodeValue.length},isText:function(t){return 3===t?.nodeType},isElement:I,isInputElement:function(t){return I(t)&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isButtonElement:function(t){return I(t)&&/^(BUTTON)$/i.test(t.nodeName)},isList:function(t){return/^(OL|UL)$/i.test("string"==typeof t?t:t?.nodeName)},isListCell:function(t){return/^LI$/i.test("string"==typeof t?t:t?.nodeName)},isTable:function(t){return/^TABLE$/i.test("string"==typeof t?t:t?.nodeName)},isTableElements:function(t){return/^(TABLE|THEAD|TBODY|TR|TH|TD|COL)$/i.test("string"==typeof t?t:t?.nodeName)},isTableCell:function(t){return/^(TD|TH)$/i.test("string"==typeof t?t:t?.nodeName)},isTableRow:function(t){return/^TR$/i.test("string"==typeof t?t:t?.nodeName)},isBreak:V,isAnchor:function(t){return/^A$/i.test("string"==typeof t?t:t?.nodeName)},isMedia:function(t){return/^(IMG|IFRAME|AUDIO|VIDEO|CANVAS)$/i.test("string"==typeof t?t:t?.nodeName)},isIFrame:function(t){return/^IFRAME$/i.test("string"==typeof t?t:t?.nodeName)},isFigure:function(t){return/^FIGURE$/i.test("string"==typeof t?t:t?.nodeName)},isContentLess:function(t){return/^(BR|COLGROUP|COL|THEAD|TBODY|TFOOT|TR|AREA|BASE|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/i.test("string"==typeof t?t:t?.nodeName)},isEmptyLine:function(t){if(!t?.parentNode)return!0;const e=t;return!e.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&(e.children.length<=1||V(e.firstElementChild))&&B(e.textContent)},isWysiwygFrame:O,isNonEditable:function(t){return 1===t?.nodeType&&"false"===t.getAttribute("contenteditable")},isSpanWithoutAttr:function(t){if(1!==t?.nodeType)return!1;const e=t;return/^SPAN$/i.test(e.nodeName)&&!e.className&&!e.style.cssText},isSameAttributes:function(t,e){if(3===t.nodeType&&3===e.nodeType)return!0;if(3===t.nodeType||3===e.nodeType)return!1;const i=t,s=e,n=i.style,o=s.style;let l=0;for(let t=0,e=n.length;t<e;t++)n[n[t]]===o[n[t]]&&l++;const r=i.classList,a=s.classList,h=RegExp;let c=0;for(let t=0,e=r.length;t<e;t++)h("(s|^)"+r[t]+"(s|$)").test(a.value)&&c++;return l===o.length&&l===n.length&&c===a.length&&c===r.length},isExcludeFormat:function(t){return/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/.test(t?.className)},isUneditable:function(t){return G.hasClass(t,"__se__uneditable")},isImportantDisabled:function(t){return t.hasAttribute("data-important-disabled")}},z=R;function $(t,i,s){const n=e.createElement(t);if(i)for(const t in i)void 0!==i[t]&&null!==i[t]&&n.setAttribute(t,i[t]);return s&&("string"==typeof s?n.innerHTML=s:"object"==typeof s&&n.appendChild(s)),n}function F(t,e){let i=-1;for(let s=0,n=t.length;s<n;s++)if(t[s]===e){i=s;break}return i}function P(t,e,i){const s=t,n=e;if(n.style.cssText){const t=n.style;for(let e=0,i=t.length;e<i;e++)s.style[t[e]]=t[t[e]]}const o=n.attributes;for(let t,e=0,n=o.length;e<n;e++)t=o[e].name.toLowerCase(),i?.includes(t)||!o[e].value?s.removeAttribute(t):"style"!==t&&s.setAttribute(o[e].name,o[e].value)}function D(t,e){if(!t||1!==t.nodeType)return;return new RegExp(`(\\s|^)${e}(\\s|$)`).test(t.className)}function q(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.add(t)}}function W(t,e){if(!t)return;const i=t instanceof HTMLCollection||t instanceof NodeList||t instanceof Array?t:[t],s=e.split("|");for(let t=0,e=i.length;t<e;t++){const e=i[t];if(e&&1===e.nodeType)for(const t of s)t&&e.classList.remove(t)}}function U(t=e){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const G={clone:function(t,e=!1){return t.cloneNode(e)},createElement:$,createTextNode:function(t){return e.createTextNode(t||"")},getAttributesToString:function(t,e){const i=t.attributes;if(!i)return"";let s="";for(let t=0,n=i.length;t<n;t++)e?.includes(i[t].name)||(s+=i[t].name+'="'+i[t].value+'" ');return s},arrayFilter:function(t,e){if(!t||0===t.length)return null;e=e||function(){return!0};const i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],e(s)&&i.push(s);return i},arrayFind:function(t,e){if(!t||0===t.length)return null;e=e||function(){return!0};for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],e(i))return i;return null},arrayIncludes:function(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1},getArrayIndex:F,nextIndex:function(t,e){const i=F(t,e);return-1===i?-1:i+1},prevIndex:function(t,e){const i=F(t,e);return-1===i?-1:i-1},copyTagAttributes:P,copyFormatAttributes:function(t,e){const i=e.cloneNode(!1);i.className=i.className.replace(/(\s|^)__se__format__[^\s]+/g,""),P(t,i)},removeItem:function(t){t&&("remove"in t&&"function"==typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t))},changeElement:function(t,e){if(t)if("string"==typeof e)if("outerHTML"in t)t.outerHTML=e;else{const i=$("DIV");i.innerHTML=e,t.parentNode.replaceChild(i.firstChild,t)}else 1===e?.nodeType&&t.parentNode.replaceChild(e,t)},changeTxt:function(t,e){t&&e&&(t.textContent=e)},setStyle:function(t,e,i){for(let s,n=0,o=(t=Array.isArray(t)?t:[t]).length;n<o;n++)s=t[n],s.style[e]=i,s.style.cssText||s.removeAttribute("style")},getStyle:function(t,e){if(1===t?.nodeType)return t.style[e]},setDisabled:function(t,e,i){for(let s=0,n=t.length;s<n;s++){const n=t[s];!i&&z.isImportantDisabled(n)||(n.disabled=e),i&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:D,addClass:q,removeClass:W,toggleClass:function(t,e){if(!t||1!==t.nodeType)return;const i=t;let s=!1;const n=new RegExp(`(\\s|^)${e}(\\s|$)`);return n.test(i.className)?i.className=i.className.replace(n," ").trim():(i.className+=" "+e,s=!0),i.className.trim()||i.removeAttribute("class"),s},flashClass:function(e,i,s=120){q(e,i),t.setTimeout((()=>{W(e,i)}),s)},getClientSize:U,getViewportSize:function(){return"visualViewport"in t?{top:t.visualViewport.pageTop,left:t.visualViewport.pageLeft,scale:t.visualViewport.scale}:{top:0,left:0,scale:1}},applyInlineStylesAll:function(i,s,n){if(!i)return console.warn('"parentTarget" is not exist'),null;let o=i;const l=e.createElement("DIV");if(l.style.display="none",/body/i.test(o.nodeName)){const t=e.createElement("DIV"),i=o.attributes;for(let e=0,s=i.length;e<s;e++)t.setAttribute(i[e].name,i[e].value);t.innerHTML=o.innerHTML,o=t}else o=o.cloneNode(!0);l.appendChild(o),e.body.appendChild(l);const r=Array.from(o.querySelectorAll("*")),a=s?[o].concat(r):r;for(let e,i=0;e=a[i];i++){if(1!==e.nodeType)continue;const i=t.getComputedStyle(e),s=e.style;for(const t of n)s.setProperty(t,i.getPropertyValue(t)||"")}return e.body.removeChild(l),o},waitForMediaLoad:function(i,s=5e3){const n=i||e;return new Promise((e=>{const i=["img","video","audio","iframe"].flatMap((t=>Array.from(n.querySelectorAll(t))));if(0===i.length)return void e();const o=i.map((t=>{if(t instanceof HTMLImageElement){if(t.complete)return Promise.resolve()}else if(t instanceof HTMLMediaElement){if(t.readyState>=2)return Promise.resolve()}else if(t instanceof HTMLIFrameElement)try{if("complete"===t.contentDocument?.readyState)return Promise.resolve()}catch(t){console.warn(["[SUNEDITOR] Iframe load error",t])}return new Promise((e=>{t.addEventListener("load",e,{once:!0}),t.addEventListener("error",e,{once:!0})}))}));Promise.race([Promise.all(o),new Promise((e=>t.setTimeout(e,s)))]).then((()=>{e()}))}))},createTooltipInner:function(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}};function Z(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function Y(t,e,i){const s=[];let n=!0;return J(t,(t=>{if(t===e&&(n=!1),n&&!z.isWysiwygFrame(t)){if(i&&3===t.nodeType){let e=null,s=null;i.s=i.e=0;let n=t.previousSibling;for(;3===n?.nodeType;)s=n.textContent.replace(w,""),i.s+=s.length,t.textContent=s+t.textContent,e=n,n=n.previousSibling,G.removeItem(e);let o=t.nextSibling;for(;3===o?.nodeType;)s=o.textContent.replace(w,""),i.e+=s.length,t.textContent+=s,e=o,o=o.nextSibling,G.removeItem(e)}s.push(t)}return!1})),s.map(Z).reverse()}function X(t,e){let i,s=e;for(let e=0,n=t.length;e<n&&(i=s.childNodes,0!==i.length);e++)s=i.length<=t[e]?i[i.length-1]:i[t[e]];return s}function j(t,e){const i=[];return t&&0!==t.childNodes.length?(e=e||function(){return!0},function s(n){t!==n&&e(n)&&i.push(n);for(let t=0,e=n.childNodes.length;t<e;t++)s(n.childNodes[t])}(t),i):i}function K(t){if(!t||z.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!z.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function J(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const i=new RegExp(e,"i");s=e=>i.test(e[t])}i||(i=1/0);let n=0;for(;t&&!s(t);){if(n>=i||z.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const Q={getPositionIndex:Z,getNodePath:Y,getNodeFromPath:X,getListChildren:function(t,e){const i=[];if(!t)return i;const s=t;return s.children&&0!==s.children.length?(e=e||function(){return!0},function t(n){if(s!==n&&e(n)&&i.push(n),n.children)for(let e=0,i=n.children.length;e<i;e++)t(n.children[e])}(s),i):i},getListChildNodes:j,getNodeDepth:K,sortNodeByDepth:function(t,e){const i=e?1:-1,s=-1*i;t.sort((function(t,e){if(!z.isListCell(t)||!z.isListCell(e))return 0;const n=K(t),o=K(e);return n>o?i:n<o?s:0}))},compareElements:function(t,e){let i=t,s=e;for(;i&&s&&i.parentElement!==s.parentElement;)i=i.parentElement,s=s.parentElement;if(!i||!s)return{ancestor:null,a:t,b:e,result:0};const n=i.parentNode.childNodes,o=G.getArrayIndex(n,i),l=G.getArrayIndex(n,s);return{ancestor:i.parentElement,a:i,b:s,result:o>l?1:o<l?-1:0}},getParentElement:J,getParentElements:function(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const i=new RegExp(e,"i");s=e=>i.test(e[t])}const n=[];i||(i=1/0);let o=0;for(;o<=i&&t&&!z.isWysiwygFrame(t);)s(t)&&n.push(t),t=t.parentElement,o++;return n},getCommandTarget:function(t){let e=t;for(;e&&!/^(UL)$/i.test(e.nodeName)&&!G.hasClass(e,"sun-editor");){if(e.hasAttribute("data-command"))return e;e=e.parentElement}return null},getEventTarget:function(t){return t.target},getEdgeChild:function(t,e,i){let s;if("function"==typeof e)s=e;else if("object"==typeof e)s=function(t){return t===e};else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+("text"===e?"#"+e:e)+"$");const i=new RegExp(e,"i");s=function(e){return i.test(e[t])}}const n=j(t,(t=>s(t)));return n[i?n.length-1:0]},getEdgeChildNodes:function(t,e){if(t){for(e||(e=t);t&&1===t.nodeType&&t.childNodes.length>0&&!z.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!z.isBreak(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getPreviousDeepestNode:function(t,e){let i=t.previousSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.previousSibling){i=s.previousSibling;break}}if(!i)return null}if(z.isNonEditable(i))return i;for(;i.lastChild;)i=i.lastChild;return i},getNextDeepestNode:function(t,e){let i=t.nextSibling;if(!i){for(let s=t.parentNode;s;s=s.parentNode){if(s===e)return null;if(s.nextSibling){i=s.nextSibling;break}}if(!i)return null}if(z.isNonEditable(i))return i;for(;i.firstChild;)i=i.firstChild;return i},findTextIndexOnLine:function(t,e,i,s){if(!t)return 0;s||(s=()=>!0);let n=0,o=!1;return function t(l){if(!o&&8!==l.nodeType&&!s(l))if(3===l.nodeType){if(l===e)return n+=i,void(o=!0);n+=l.textContent.length}else if(1===l.nodeType){const e=l.childNodes;for(let i=0,s=e.length;i<s;i++)if(t(e[i]),o)return}}(t),n},findTabEndIndex:function(t,e,i){if(!t)return 0;const s=t.textContent,n=new RegExp(`((\\u00A0|\\s){${i},})`,"g");let o;for(n.lastIndex=e;null!==(o=n.exec(s));)if(o.index>=e){const t=o.index+o[0].length-1;return t+(s.slice(0,t+1).match(/[^\u00A0\s]/g)||[]).length+i}return 0},findVisualLastCell:function(t){if(!t||0===t.length)return null;const e={};let i=null,s=-1,n=-1;for(const o of t){const t=o.parentElement.rowIndex,l=o.rowSpan||1,r=o.colSpan||1;e[t]||(e[t]=[]);let a=0;const h=e[t];for(;h[a];)a++;for(let t=0;t<r;t++)h[a+t]=!0;for(let i=1;i<l;i++){const s=t+i;e[s]||(e[s]=[]);for(let t=0;t<r;t++)e[s][a+t]=!0}const c=t+l-1,d=a+r-1;(c>s||c===s&&d>n)&&(s=c,n=d,i=o)}return i},getScrollParent:function t(e){if(!e||/^(body|html)$/i.test(e.nodeName))return null;const i=e;return i.scrollHeight>i.clientHeight?i:t(i.parentNode)},getIframeDocument:function(t){return t.contentWindow?.document||t.contentDocument}},tt={query:Q,check:z,utils:G};function et(t,e=0){if(!t)return 0;const i=(t+"").match(/-?\d+(\.\d+)?/);if(!i||!i[0])return 0;const s=Number(i[0]);return e<0?s:0===e?Math.round(s):Number(s.toFixed(e))}const it={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:et,getOverlapRangeAtIndex:function(t,e,i,s){if(t<=s?e<i:e>i)return 0;const n=(t>i?t:i)-(e<s?e:s);return(n<0?-1*n:n)+1},isEven:function(t){return!(1&t)},isOdd:function(t){return!(1&~t)}},st="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",nt="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",ot=st.split("|"),lt="Backspace|Delete".split("|"),rt=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${st}|Insert|Delete|${nt}|NumLock|ScrollLock`.split("|"),at="Backspace|Enter|Delete".split("|"),ht="Backspace|Enter|Delete".split("|"),ct=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${nt}|NumLock|ScrollLock`.split("|");const dt=y,ut=k,pt=A,gt=tt,mt=it,ft={isShift:function(t){return t.shiftKey||16===t.keyCode},isCtrl:function(t){const e=t.code;return t.ctrlKey||t.metaKey||"MetaLeft"===e||"MetaRight"===e},isAlt:function(t){return t.altKey},isComposing:function(t){return t.isComposing||229===t.keyCode},isBackspace:function(t){return"Backspace"===t},isTab:function(t){return"Tab"===t},isEnter:function(t){return"Enter"===t},isEsc:function(t){return"Escape"===t},isSpace:function(t){return"Space"===t},isDirectionKey:function(t){return ot.includes(t)},isRemoveKey:function(t){return lt.includes(t)},isNonTextKey:function(t){return rt.includes(t)},isHistoryRelevantKey:function(t){return at.includes(t)},isDocumentTypeObserverKey:function(t){return ht.includes(t)},isNonResponseKey:function(t){return ct.includes(t)}},_t={write:async function(t){if(!r)return void console.error("Clipboard is not supported in this browser.");let e="",i="";"string"==typeof t?(e=t,i=t):I(t)?(t.querySelectorAll("iframe").forEach((t=>{const e=document.createElement("div"),i={};for(const e of Array.from(t.attributes))i[e.name]=e.value;e.setAttribute("data-se-iframe-holder","1"),e.setAttribute("data-se-iframe-holder-attrs",JSON.stringify(i)),e.innerText=`[iframe: ${t.src}]`,t.replaceWith(e)})),e=t.outerHTML,i=t.textContent):(e=t.textContent,i=t.textContent),await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([i],{type:"text/plain"})})])}},bt={env:dt,unicode:ut,converter:pt,dom:gt,numbers:mt,keyCodeMap:ft,clipboard:_t},yt={redo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z" /></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z" /></svg>',bold:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"/></svg>',underline:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9.78 15.74"><g><path d="M14.64,3.76h2.52v7.72a4.51,4.51,0,0,1-.59,2.31,3.76,3.76,0,0,1-1.71,1.53,6.12,6.12,0,0,1-2.64.53,5,5,0,0,1-3.57-1.18,4.17,4.17,0,0,1-1.27-3.24V3.76H9.9v7.3a3,3,0,0,0,.55,2,2.3,2.3,0,0,0,1.83.65,2.26,2.26,0,0,0,1.8-.65,3.09,3.09,0,0,0,.55-2V3.76Zm2.52,13.31V19.5H7.39V17.08h9.77Z" transform="translate(-7.38 -3.76)"/></g></svg>',italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',strike:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.2 9.8C6 7.5 7.7 4.8 10.1 4.3C13.2 3.3 17.7 4.7 17.6 8.5H14.6C14.6 8.2 14.5 7.9 14.5 7.7C14.3 7.1 13.9 6.8 13.3 6.6C12.5 6.3 11.2 6.4 10.5 6.9C9 8.2 10.4 9.5 12 10H7.4C7.3 9.9 7.3 9.8 7.2 9.8M21 13V11H3V13H12.6C12.8 13.1 13 13.1 13.2 13.2C13.8 13.5 14.3 13.7 14.5 14.3C14.6 14.7 14.7 15.2 14.5 15.6C14.3 16.1 13.9 16.3 13.4 16.5C11.6 17 9.4 16.3 9.5 14.1H6.5C6.4 16.7 8.6 18.5 11 18.8C14.8 19.6 19.3 17.2 17.3 12.9L21 13Z" /></svg>',subscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,21.03H16.97V20.03L17.86,19.23C18.62,18.58 19.18,18.04 19.56,17.6C19.93,17.16 20.12,16.75 20.13,16.36C20.14,16.08 20.05,15.85 19.86,15.66C19.68,15.5 19.39,15.38 19,15.38C18.69,15.38 18.42,15.44 18.16,15.56L17.5,15.94L17.05,14.77C17.32,14.56 17.64,14.38 18.03,14.24C18.42,14.1 18.85,14 19.32,14C20.1,14.04 20.7,14.25 21.1,14.66C21.5,15.07 21.72,15.59 21.72,16.23C21.71,16.79 21.53,17.31 21.18,17.78C20.84,18.25 20.42,18.7 19.91,19.14L19.27,19.66V19.68H21.85V21.03Z" /></svg>',superscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,9H16.97V8L17.86,7.18C18.62,6.54 19.18,6 19.56,5.55C19.93,5.11 20.12,4.7 20.13,4.32C20.14,4.04 20.05,3.8 19.86,3.62C19.68,3.43 19.39,3.34 19,3.33C18.69,3.34 18.42,3.4 18.16,3.5L17.5,3.89L17.05,2.72C17.32,2.5 17.64,2.33 18.03,2.19C18.42,2.05 18.85,2 19.32,2C20.1,2 20.7,2.2 21.1,2.61C21.5,3 21.72,3.54 21.72,4.18C21.71,4.74 21.53,5.26 21.18,5.73C20.84,6.21 20.42,6.66 19.91,7.09L19.27,7.61V7.63H21.85V9Z" /></svg>',remove_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22.11 21.46L2.39 1.73L1.11 3L7.65 9.54C6.74 11.03 6 12.65 6 14.23C6 17.54 8.69 20.23 12 20.23C13.74 20.23 15.3 19.5 16.4 18.29L20.84 22.73L22.11 21.46M12 18.23C9.78 18.23 8 16.45 8 14.23C8 13.5 8.5 12.27 9.14 11.03L15 16.88C14.26 17.71 13.2 18.23 12 18.23M11.14 7.94L9.71 6.5C10.57 5.38 11.25 4.61 11.25 4.61L12 3.77L12.75 4.61C12.75 4.61 14.03 6.06 15.32 7.94S18 12.07 18 14.23C18 14.41 18 14.59 17.97 14.77L15.46 12.26C15 11.23 14.37 10.07 13.68 9.07C12.84 7.85 12.44 7.42 12 6.9C11.73 7.21 11.5 7.5 11.14 7.94Z" /></svg>',remove_format:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6,5V5.18L8.82,8H11.22L10.5,9.68L12.6,11.78L14.21,8H20V5H6M3.27,5L2,6.27L8.97,13.24L6.5,19H9.5L11.07,15.34L16.73,21L18,19.73L3.55,5.27L3.27,5Z" /></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M11,17H21V15H11M3,8V16L7,12M3,21H21V19H3V21Z" /></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M3,21H21V19H3M3,12L7,16V8M11,17H21V15H11V17Z" /></svg>',expansion:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,21V19H6.41L10.91,14.5L9.5,13.09L5,17.59V14H3V21H10M14.5,10.91L19,6.41V10H21V3H14V5H17.59L13.09,9.5L14.5,10.91Z" /></svg>',reduction:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.5,3.09L15,7.59V4H13V11H20V9H16.41L20.91,4.5L19.5,3.09M4,13V15H7.59L3.09,19.5L4.5,20.91L9,16.41V20H11V13H4Z" /></svg>',code_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z" /></svg>',preview:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z" /></svg>',print:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,3H6V7H18M19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12M16,19H8V14H16M19,8H5A3,3 0 0,0 2,11V17H6V21H18V17H22V11A3,3 0 0,0 19,8Z" /></svg>',template:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,7.5H18V9.5H13V7.5M13,14.5H18V16.5H13V14.5M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M19,19V5H5V19H19M11,6V11H6V6H11M10,10V7H7V10H10M11,13V18H6V13H11M10,17V14H7V17H10Z" /></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21H11V13H3M5 15H9V19H5M3 11H11V3H3M5 5H9V9H5M13 3V11H21V3M19 9H15V5H19M18 16H21V18H18V21H16V18H13V16H16V13H18Z" /></svg>',new_document:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',select_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,9H15V15H9M7,17H17V7H7M15,5H17V3H15M15,21H17V19H15M19,17H21V15H19M19,9H21V7H19M19,21A2,2 0 0,0 21,19H19M19,13H21V11H19M11,21H13V19H11M9,3H7V5H9M3,17H5V15H3M5,21V19H3A2,2 0 0,0 5,21M19,3V5H21A2,2 0 0,0 19,3M13,3H11V5H13M3,9H5V7H3M7,21H9V19H7M3,13H5V11H3M3,5H5V3A2,2 0 0,0 3,5Z" /></svg>',line_height:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 22H3V20H21V22M21 4H3V2H21V4M10 13.7H14L12 8.3L10 13.7M11.2 6H12.9L17.6 18H15.6L14.7 15.4H9.4L8.5 18H6.5L11.2 6Z" /></svg>',paragraph_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,11A4,4 0 0,1 6,7A4,4 0 0,1 10,3H18V5H16V21H14V5H12V21H10V11Z" /></svg>',text_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,3H16V6H11V18H8V6H3V3M12,7H14V9H12V7M15,7H17V9H15V7M18,7H20V9H18V7M12,10H14V12H12V10M12,13H14V15H12V13M12,16H14V18H12V16M12,19H14V21H12V19Z" /></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" /></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11 18V10H9.12L11.12 6H5.38L3 10.76V18M9 16H5V11.24L6.62 8H7.88L5.88 12H9M21 18V10H19.12L21.12 6H15.38L13 10.76V18M19 16H15V11.24L16.62 8H17.88L15.88 12H19Z" /></svg>',arrow_down:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 8.67"><g><path d="M18.79,7.52a.8.8,0,0,1,.56-.23.82.82,0,0,1,.79.79.8.8,0,0,1-.23.56l-7.07,7.07a.79.79,0,0,1-.57.25.77.77,0,0,1-.57-.25h0L4.64,8.65a.8.8,0,0,1-.23-.57.82.82,0,0,1,.79-.79.8.8,0,0,1,.56.23L12.28,14l3.26-3.26,3.25-3.26Z" transform="translate(-4.41 -7.29)"/></g></svg>',align_justify:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm0,5.9H20.15v-2H4.41v2Zm0,3.94H20.15v-2H4.41v2Zm0,3.93h7.87v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_left:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm11.8,3.94H4.41v2H16.22v-2Zm-11.8,5.9H18.18v-2H4.41v2Zm0,3.93h9.84v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_right:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm3.93,5.9H20.15v-2H8.34v2Zm-2,3.94H20.14v-2H6.37v2Zm3.94,3.93h9.84v-2H10.31v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_center:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm2,3.94v2H18.18v-2H6.37Zm-1,5.9H19.16v-2H5.39v2Zm2,3.93H17.2v-2H7.36v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,11H11V21H13V11H16L12,7L8,11M4,3V5H20V3H4Z" /></svg>',align_middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,19H11V23H13V19H16L12,15L8,19M16,5H13V1H11V5H8L12,9L16,5M4,11V13H20V11H4Z" /></svg>',align_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,13H13V3H11V13H8L12,17L16,13M4,19V21H20V19H4Z" /></svg>',format_float_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,7V9H11V7H21M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,7H21V13H15V7M3,3H21V5H3V3M13,7V9H3V7H13M9,11V13H3V11H9M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,7H15V13H9V7M3,3H21V5H3V3M3,15H21V17H3V15M3,19H17V21H3V19Z" /></svg>',font_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M9.62,12L12,5.67L14.37,12M11,3L5.5,17H7.75L8.87,14H15.12L16.25,17H18.5L13,3H11Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',background_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M4,17L6.75,14.25L6.72,14.23C6.14,13.64 6.14,12.69 6.72,12.11L11.46,7.37L15.7,11.61L10.96,16.35C10.39,16.93 9.46,16.93 8.87,16.37L8.24,17H4M15.91,2.91C16.5,2.33 17.45,2.33 18.03,2.91L20.16,5.03C20.74,5.62 20.74,6.57 20.16,7.16L16.86,10.45L12.62,6.21L15.91,2.91Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',list_bulleted:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.37"><g><path d="M7.77,16.12a1.59,1.59,0,0,0-.49-1.18,1.62,1.62,0,0,0-1.19-.49,1.68,1.68,0,1,0,0,3.36,1.67,1.67,0,0,0,1.68-1.69Zm0-4.48A1.67,1.67,0,0,0,6.09,10,1.68,1.68,0,0,0,4.9,12.82a1.62,1.62,0,0,0,1.19.49,1.67,1.67,0,0,0,1.68-1.67Zm12.38,3.64a.27.27,0,0,0-.08-.19.28.28,0,0,0-.2-.09H9.19a.28.28,0,0,0-.2.08.29.29,0,0,0-.08.19V17a.27.27,0,0,0,.28.28H19.87a.27.27,0,0,0,.19-.08.24.24,0,0,0,.08-.2V15.28ZM7.77,7.13a1.63,1.63,0,0,0-.49-1.2,1.61,1.61,0,0,0-1.19-.49,1.61,1.61,0,0,0-1.19.49,1.71,1.71,0,0,0,0,2.4,1.62,1.62,0,0,0,1.19.49,1.61,1.61,0,0,0,1.19-.49,1.63,1.63,0,0,0,.49-1.2Zm12.38,3.66a.28.28,0,0,0-.08-.2.29.29,0,0,0-.19-.08H9.19a.27.27,0,0,0-.28.28v1.69a.27.27,0,0,0,.08.19.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08.25.25,0,0,0,.08-.19V10.79Zm0-4.5a.27.27,0,0,0-.08-.19A.25.25,0,0,0,19.88,6H9.19A.28.28,0,0,0,9,6.1a.26.26,0,0,0-.08.19V8A.27.27,0,0,0,9,8.17a.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08A.25.25,0,0,0,20.14,8V6.29Z" transform="translate(-4.41 -5.44)"/></g></svg>',list_numbered:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.69 15.74"><g><path d="M7.66,18a1.24,1.24,0,0,0-.26-.78,1.17,1.17,0,0,0-.72-.42l.85-1V15H4.58v1.34h.94v-.46l.85,0h0c-.11.11-.22.23-.32.35s-.23.27-.37.47L5.39,17l.23.51c.61-.05.92.11.92.49a.42.42,0,0,1-.18.37.79.79,0,0,1-.45.12A1.41,1.41,0,0,1,5,18.15l-.51.77A2.06,2.06,0,0,0,6,19.5a1.8,1.8,0,0,0,1.2-.41A1.38,1.38,0,0,0,7.66,18Zm0-5.54H6.75V13H5.63A.72.72,0,0,1,6,12.51a5.45,5.45,0,0,1,.66-.45,2.71,2.71,0,0,0,.67-.57,1.19,1.19,0,0,0,.31-.81,1.29,1.29,0,0,0-.45-1,1.86,1.86,0,0,0-2-.11,1.51,1.51,0,0,0-.62.7l.74.52A.87.87,0,0,1,6,10.28a.51.51,0,0,1,.35.12.42.42,0,0,1,.13.33.55.55,0,0,1-.21.4,3,3,0,0,1-.5.38c-.19.13-.39.27-.58.42a2,2,0,0,0-.5.6,1.63,1.63,0,0,0-.21.81,3.89,3.89,0,0,0,.05.48h3.2V12.44Zm12.45,2.82a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2V17a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V15.26ZM7.69,7.32h-1V3.76H5.8L4.6,4.88l.63.68a1.85,1.85,0,0,0,.43-.48h0l0,2.24H4.74V8.2h3V7.32Zm12.43,3.42a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2v1.71a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V10.74Zm0-4.52A.27.27,0,0,0,20,6,.28.28,0,0,0,19.83,6H9.1A.32.32,0,0,0,8.89,6a.24.24,0,0,0-.08.19V7.93a.27.27,0,0,0,.08.19.32.32,0,0,0,.21.08H19.83A.32.32,0,0,0,20,8.12a.26.26,0,0,0,.08-.2V6.22Z" transform="translate(-4.43 -3.76)"/></g></svg>',table:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M4.41,8.05V3.76H8.7V8.05H4.41Zm5.71,0V3.76h4.3V8.05h-4.3Zm5.74-4.29h4.29V8.05H15.86V3.76Zm-11.45,10V9.48H8.7v4.3H4.41Zm5.71,0V9.48h4.3v4.3h-4.3Zm5.74,0V9.48h4.29v4.3H15.86ZM4.41,19.5V15.21H8.7V19.5H4.41Zm5.71,0V15.21h4.3V19.5h-4.3Zm5.74,0V15.21h4.29V19.5H15.86Z" transform="translate(-4.41 -3.76)"/></g></svg>',table_header:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M17,19.5v-.78H15.5v.78H17Zm-3,0v-.78H12.5v.78H14Zm-3,0v-.78H9.53v.78H11Zm-3,0v-.78H6.53v.78H8Zm10.55,0a1.73,1.73,0,0,0,.85-.35,1.67,1.67,0,0,0,.56-.76l-.71-.31a1.21,1.21,0,0,1-.35.4,1.34,1.34,0,0,1-.53.23l.08.38c.06.24.09.38.1.41Zm-13.7-.63.55-.55A.77.77,0,0,1,5.25,18a1.31,1.31,0,0,1-.06-.38v-.38H4.41v.38a2,2,0,0,0,.12.68,1.6,1.6,0,0,0,.35.57Zm15.27-2.12V15.26h-.78v1.49h.78Zm-15-1V14.23H4.41v1.49h.78Zm15-2V12.26h-.78v1.49h.78Zm-15-1V11.22H4.41v1.51h.78Zm15-2V9.26h-.78v1.51h.78Zm-15-1V8.17H4.41V9.74h.78Zm15-2V6.28h-.78V7.77h.78Zm-15-1.11V5.33L4.48,5.1a.77.77,0,0,0-.07.27,2.72,2.72,0,0,0,0,.28v1h.79ZM19.21,5l.63-.4A1.62,1.62,0,0,0,19.16,4a1.94,1.94,0,0,0-.91-.22v.78a1.31,1.31,0,0,1,.56.12.88.88,0,0,1,.4.36ZM6,4.54H7.78V3.76H6a.82.82,0,0,0-.28.06l.12.35c.07.21.1.33.11.36Zm10.8,0V3.76H15.28v.78h1.49Zm-3,0V3.76H12.28v.78h1.49Zm-3,0V3.76H9.28v.78h1.51ZM6,10.84h12.6V6.91H6Z" transform="translate(-4.4 -3.76)"/></g></svg>',table_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.88 12L2.2 16.06L6.26 17.74L7.94 21.8L11 20.53V18.36L9 19.19L7.79 16.21L4.81 15L6.05 12L4.81 9L7.79 7.79L9 4.81L12 6.05L15 4.81L16.21 7.79L19.19 9L17.95 12L18 12.13L19.38 10.75C19.82 10.3 20.38 10.06 20.94 10L21.8 7.94L17.74 6.26L16.06 2.2L12 3.88L7.94 2.2L6.26 6.26L2.2 7.94L3.88 12M22.85 13.47L21.53 12.15C21.33 11.95 21 11.95 20.81 12.15L19.83 13.13L21.87 15.17L22.85 14.19C23.05 14 23.05 13.67 22.85 13.47M13 19.96V22H15.04L21.17 15.88L19.13 13.83L13 19.96Z" /></svg>',cell_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.58,17L12,14.84L8.42,17L9.37,12.93L6.21,10.2L10.38,9.84L12,6L13.62,9.83L17.79,10.19L14.63,12.92L15.58,17M19,3A2,2 0 0,1 21,5V19C21,20.11 20.1,21 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',table_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,2H16A2,2 0 0,1 18,4V20A2,2 0 0,1 16,22H8A2,2 0 0,1 6,20V4A2,2 0 0,1 8,2M8,10V14H16V10H8M8,16V20H16V16H8M8,4V8H16V4H8Z" /></svg>',table_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,1 20,16H4A2,2 0 0,1 2,14V10A2,2 0 0,1 4,8H20A2,2 0 0,1 22,10V14M4,14H8V10H4V14M10,14H14V10H10V14M16,14H20V10H16V14Z" /></svg>',color_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" /></svg>',color_palette:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" /></svg>',border_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,11H13V5H19M19,19H13V13H19M11,11H5V5H11M11,19H5V13H11M3,21H21V3H3V21Z" /></svg>',border_inside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,17H21V15H19M19,21H21V19H19M13,3H11V11H3V13H11V21H13V13H21V11H13M15,21H17V19H15M19,5H21V3H19M19,9H21V7H19M17,3H15V5H17M5,3H3V5H5M9,3H7V5H9M3,17H5V15H3M5,7H3V9H5M7,21H9V19H7M3,21H5V19H3V21Z" /></svg>',border_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H21V19H19M15,21H17V19H15M11,17H13V15H11M19,9H21V7H19M19,5H21V3H19M3,13H21V11H3M11,21H13V19H11M19,17H21V15H19M13,3H11V5H13M13,7H11V9H13M17,3H15V5H17M9,3H7V5H9M5,3H3V5H5M7,21H9V19H7M3,17H5V15H3M5,7H3V9H5M3,21H5V19H3V21Z" /></svg>',border_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M15,21H17V19H15M15,5H17V3H15M19,9H21V7H19M19,5H21V3H19M19,13H21V11H19M19,21H21V19H19M11,21H13V3H11M19,17H21V15H19M7,5H9V3H7M3,17H5V15H3M3,21H5V19H3M3,13H5V11H3M7,13H9V11H7M7,21H9V19H7M3,5H5V3H3M3,9H5V7H3V9Z" /></svg>',border_outside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,11H7V13H9M13,15H11V17H13M19,19H5V5H19M3,21H21V3H3M17,11H15V13H17M13,11H11V13H13M13,7H11V9H13V7Z" /></svg>',border_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M19,21H21V19H19M19,13H21V11H19M19,5H21V3H19M19,17H21V15H19M15,21H17V19H15M19,9H21V7H19M3,21H5V3H3M7,13H9V11H7M7,5H9V3H7M7,21H9V19H7M11,13H13V11H11M11,9H13V7H11M11,5H13V3H11M11,17H13V15H11M11,21H13V19H11V21Z" /></svg>',border_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M19,21H21V19H19M11,9H13V7H11M15,21H17V19H15M19,17H21V15H19M3,5H21V3H3M19,13H21V11H19M19,9H21V7H19M11,17H13V15H11M3,9H5V7H3M3,13H5V11H3M3,21H5V19H3M3,17H5V15H3M11,21H13V19H11M11,13H13V11H11M7,13H9V11H7M7,21H9V19H7V21Z" /></svg>',border_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,5H13V3H11M15,5H17V3H15M15,21H17V19H15M19,21H21V3H19M3,9H5V7H3M3,17H5V15H3M3,13H5V11H3M11,21H13V19H11M3,21H5V19H3M7,5H9V3H7M3,5H5V3H3M7,21H9V19H7V21Z" /></svg>',border_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,15H3V17H5M3,21H21V19H3M5,11H3V13H5M19,9H21V7H19M19,5H21V3H19M5,7H3V9H5M19,17H21V15H19M19,13H21V11H19M17,3H15V5H17M13,3H11V5H13M5,3H3V5H5M9,3H7V5H9" /></svg>',border_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M15,21H17V19H15M11,5H13V3H11M19,5H21V3H19M11,9H13V7H11M19,9H21V7H19M19,21H21V19H19M19,13H21V11H19M19,17H21V15H19M11,13H13V11H11M3,5H5V3H3M3,9H5V7H3M3,13H5V11H3M3,17H5V15H3M3,21H5V19H3M11,21H13V19H11M11,17H13V15H11M7,21H9V19H7M7,13H9V11H7M7,5H9V3H7V5Z" /></svg>',horizontal_line:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 2.24"><g><path d="M20.15,12.75V10.51H4.41v2.24H20.15Z" transform="translate(-4.41 -10.51)"/></g></svg>',show_blocks:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 3C3.9 3 3 3.9 3 5S2.1 7 1 7V9C2.1 9 3 9.9 3 11S3.9 13 5 13H7V11H5V10C5 8.9 4.1 8 3 8C4.1 8 5 7.1 5 6V5H7V3M11 3C12.1 3 13 3.9 13 5S13.9 7 15 7V9C13.9 9 13 9.9 13 11S12.1 13 11 13H9V11H11V10C11 8.9 11.9 8 13 8C11.9 8 11 7.1 11 6V5H9V3H11M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V15H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" /></svg>',cancel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',selection_remove:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 20V17H22V20C22 21.11 21.1 22 20 22H17V20H20M2 20V17H4V20H7V22H4C2.9 22 2 21.1 2 20M10 20H14V22H10V20M14.59 8L12 10.59L9.41 8L8 9.41L10.59 12L8 14.59L9.41 16L12 13.41L14.59 16L16 14.59L13.41 12L16 9.41L14.59 8M20 10H22V14H20V10M2 10H4V14H2V10M2 4C2 2.89 2.9 2 4 2H7V4H4V7H2V4M22 4V7H20V4H17V2H20C21.1 2 22 2.9 22 4M10 2H14V4H10V2Z" /></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" /></svg>',image_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M17,13V19H7L12,14L14,16M10,10.5A1.5,1.5 0 0,1 8.5,12A1.5,1.5 0 0,1 7,10.5A1.5,1.5 0 0,1 8.5,9A1.5,1.5 0 0,1 10,10.5Z" /></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10,8V16L15,12L10,8Z" /></svg>',video_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M16,18L13.5,16.3V18H8V13H13.5V14.7L16,13V18Z" /></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',link_rel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 1C1.89 1 1 1.89 1 3V14C1 15.11 1.89 16 3 16H14C15.11 16 16 15.11 16 14V11H14V14H3V3H14V5H16V3C16 1.89 15.11 1 14 1M9 7C7.89 7 7 7.89 7 9V12H9V9H20V20H9V18H7V20C7 21.11 7.89 22 9 22H20C21.11 22 22 21.11 22 20V9C22 7.89 21.11 7 20 7H9" /></svg>',math:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.73"><g><path d="M17.19,5.73a1,1,0,0,0,.71-.29,1,1,0,0,0,.28-.7,1,1,0,0,0-1-1H7.35a1,1,0,0,0-1,1,.77.77,0,0,0,.13.47h0l4.58,6.43L6.68,17.81a1.25,1.25,0,0,0-.29.71.94.94,0,0,0,.28.7.92.92,0,0,0,.69.28H17.2a1,1,0,0,0,.71-.28,1,1,0,0,0,0-1.39.92.92,0,0,0-.71-.29H9.26l3.87-5.43a.86.86,0,0,0,0-.95L9.26,5.73h7.93Z" transform="translate(-6.38 -3.77)"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.43 19.12,14.63 17.79,15L19.25,16.44C20.88,15.61 22,13.95 22,12A5,5 0 0,0 17,7M16,11H13.81L15.81,13H16V11M2,4.27L5.11,7.38C3.29,8.12 2,9.91 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12C3.9,10.41 5.11,9.1 6.66,8.93L8.73,11H8V13H10.73L13,15.27V17H14.73L18.74,21L20,19.74L3.27,3L2,4.27Z" /></svg>',merge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4M8,13V15L11,12L8,9V11H3V13H8M16,11V9L13,12L16,15V13H21V11H16Z" /></svg>',split_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 14H21V20H3V14H5V18H19V14M3 4V10H5V6H19V10H21V4H3M11 11V13H8V15L5 12L8 9V11H11M16 11V9L19 12L16 15V13H13V11H16Z" /></svg>',unmerge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4"/><line x1="7.5" y1="12" x2="16.5" y2="12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',caption:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.79"><g><path d="M4.41,18.52H20.15v-2H4.41ZM20,4.73H18.07V6h.65v.65H20V4.73ZM17,6V4.73H14.55V6H17ZM13.49,6V4.73H11V6h2.47ZM10,6V4.73H7.5V6H10ZM5.79,6h.65V4.73H4.5V6.67H5.8V6ZM4.5,11.34H5.79V8.48H4.5ZM6.44,13.8H5.79v-.65H4.5v1.94H6.44ZM17,15.09V13.8H14.55v1.29H17Zm-3.52,0V13.8H11v1.29h2.47Zm-3.53,0V13.8H7.5v1.29H10ZM20,13.16H18.72v.65h-.65V15.1H20Zm-1.29-1.82H20V8.48h-1.3v2.86Z" transform="translate(-4.41 -4.73)"/></g></svg>',edit:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.73"><g><path d="M7.51,5.68h6l1.52-1.57H6.94a2.4,2.4,0,0,0-1.79.82A2.8,2.8,0,0,0,4.41,6.8V17a2.55,2.55,0,0,0,.75,1.8A2.48,2.48,0,0,0,7,19.5H17.22a2.57,2.57,0,0,0,1.83-.74,2.52,2.52,0,0,0,.77-1.8V8.83l-1.58,1.54v6a1.54,1.54,0,0,1-1.53,1.53H7.51A1.54,1.54,0,0,1,6,16.41V7.21A1.52,1.52,0,0,1,7.51,5.68Zm5.63,7.47h0L10.7,10.74l-1,3.38,1.71-.48,1.7-.49Zm.34-.34h0l5.36-5.32L16.4,5.08,11,10.4l1.23,1.21,1.21,1.2ZM19.93,6.4a.82.82,0,0,0,.22-.48A.54.54,0,0,0,20,5.47L18.45,4A.67.67,0,0,0,18,3.77a.7.7,0,0,0-.48.21l-.74.72,2.44,2.43.37-.37.35-.36Z" transform="translate(-4.41 -3.77)"/></g></svg>',delete:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.74"><g><path d="M19.16,6.71a.94.94,0,0,0,.69-.28.91.91,0,0,0,.29-.68A1,1,0,0,0,19.85,5a.93.93,0,0,0-.69-.3H14.24A.94.94,0,0,0,14,4.06a.92.92,0,0,0-.7-.3h-2a1,1,0,0,0-.7.3.93.93,0,0,0-.28.68H5.39A.92.92,0,0,0,4.7,5a1,1,0,0,0-.29.71.91.91,0,0,0,.29.68,1,1,0,0,0,.69.28H19.16Zm-12.79,1a1,1,0,0,0-.7.3.94.94,0,0,0-.28.69v8.85A1.88,1.88,0,0,0,6,18.93a1.9,1.9,0,0,0,1.39.57H17.2a1.87,1.87,0,0,0,1.39-.58,1.91,1.91,0,0,0,.58-1.39V8.68A1,1,0,0,0,18.88,8a.89.89,0,0,0-.7-.29,1,1,0,0,0-.69.29.92.92,0,0,0-.29.68v7.87a1,1,0,0,1-1,1H8.34a.94.94,0,0,1-.69-.28,1,1,0,0,1-.29-.71V8.68a1,1,0,0,0-1-1Z" transform="translate(-4.41 -3.76)"/></g></svg>',revert:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 14.69"><g><path d="M18.26,15V12.3l1.89-2V15a2.58,2.58,0,0,1-.24,1c-.2.58-.75.92-1.65,1H7.56v2L4.41,15.63,7.56,13v2h10.7ZM6.3,8.28V11L4.41,13V8.28a2.58,2.58,0,0,1,.24-1c.2-.58.75-.92,1.65-1H17v-2l3.15,3.34L17,10.3v-2H6.3Z" transform="translate(-4.4 -4.28)"/></g></svg>',auto_size:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M6.71,17.19,6.89,16l1.21-.15A6,6,0,0,1,6.81,13.9a5.78,5.78,0,0,1-.45-2.27A6,6,0,0,1,8.1,7.45a5.83,5.83,0,0,1,4.17-1.73l1-1-1-1A7.89,7.89,0,0,0,5,14.64a7.73,7.73,0,0,0,1.71,2.55Zm5.57,2.31h0A7.86,7.86,0,0,0,17.85,6.07L17.67,7.3l-1.21.15a5.9,5.9,0,0,1,1.29,1.92,5.81,5.81,0,0,1,.45,2.26,5.91,5.91,0,0,1-5.9,5.9l-1,1,.49.49.47.5Z" transform="translate(-4.41 -3.76)"/></g></svg>',resize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M23,15H21V17H23V15M23,11H21V13H23V11M23,19H21V21C22,21 23,20 23,19M15,3H13V5H15V3M23,7H21V9H23V7M21,3V5H23C23,4 22,3 21,3M3,21H11V15H1V19A2,2 0 0,0 3,21M3,7H1V9H3V7M15,19H13V21H15V19M19,3H17V5H19V3M19,19H17V21H19V19M3,3C2,3 1,4 1,5H3V3M3,11H1V13H3V11M11,3H9V5H11V3M7,3H5V5H7V3Z" /></svg>',insert_row_below:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z" /></svg>',insert_row_above:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,0 20,12H4A2,2 0 0,0 2,14V21H4V19H8V21H10V19H14V21H16V19H20V21H22V14M4,14H8V17H4V14M10,14H14V17H10V14M20,14V17H16V14H20M11,10H13V7H16V5H13V2H11V5H8V7H11V10Z" /></svg>',insert_column_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,2A2,2 0 0,0 11,4V20A2,2 0 0,0 13,22H22V2H13M20,10V14H13V10H20M20,16V20H13V16H20M20,4V8H13V4H20M9,11H6V8H4V11H1V13H4V16H6V13H9V11Z" /></svg>',insert_column_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z" /></svg>',delete_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z" /></svg>',delete_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z" /></svg>',fixed_column_width:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,8H19A2,2 0 0,1 21,10V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V10A2,2 0 0,1 5,8M5,12V15H11V12H5M13,12V15H19V12H13M5,17V20H11V17H5M13,17V20H19V17H13M11,2H21V6H19V4H13V6H11V2Z" /></svg>',rotate_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,4.07V1L8.45,5.55L13,10V6.09C15.84,6.57 18,9.03 18,12C18,14.97 15.84,17.43 13,17.91V19.93C16.95,19.44 20,16.08 20,12C20,7.92 16.95,4.56 13,4.07M7.1,18.32C8.26,19.22 9.61,19.76 11,19.93V17.9C10.13,17.75 9.29,17.41 8.54,16.87L7.1,18.32M6.09,13H4.07C4.24,14.39 4.79,15.73 5.69,16.89L7.1,15.47C6.58,14.72 6.23,13.88 6.09,13M7.11,8.53L5.7,7.11C4.8,8.27 4.24,9.61 4.07,11H6.09C6.23,10.13 6.58,9.28 7.11,8.53Z" /></svg>',rotate_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z" /></svg>',mirror_horizontal:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.75 15.74"><g><path d="M13.75,3.76l5.9,15.74h-5.9V3.76ZM4.9,19.5,10.8,3.76V19.5H4.9Z" transform="translate(-4.9 -3.76)"/></g></svg>',mirror_vertical:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.75"><g><path d="M20.15,13.1,4.41,19V13.1H20.15ZM4.41,4.25l15.74,5.9H4.41V4.25Z" transform="translate(-4.41 -4.25)"/></g></svg>',checked:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 12.1"><g><path d="M4.59,12.23l.12.18L9.43,17.5a.58.58,0,0,0,.84,0L20,7.45h0a.58.58,0,0,0,0-.84l-.85-.85a.58.58,0,0,0-.84,0H18.2l-8.12,8.41a.29.29,0,0,1-.42,0l-3.4-3.63a.58.58,0,0,0-.84,0l-.85.85a.6.6,0,0,0-.14.21.51.51,0,0,0,0,.44c.05.06.1.13.16.19Z" transform="translate(-4.38 -5.58)"/></g></svg>',line_break:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6a1,1,0,0,0-1,1v4a1,1,0,0,1-1,1H7.41l1.3-1.29A1,1,0,0,0,7.29,9.29l-3,3a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76,1,1,0,0,0,.21.33l3,3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42L7.41,14H17a3,3,0,0,0,3-3V7A1,1,0,0,0,19,6Z"/></svg>',audio:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,9H13V14.5A2.5,2.5 0 0,1 10.5,17A2.5,2.5 0 0,1 8,14.5A2.5,2.5 0 0,1 10.5,12C11.07,12 11.58,12.19 12,12.5V7H16V9M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',audio_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6A2,2 0 0,0 20,4M7.76,16.24L6.35,17.65C4.78,16.1 4,14.05 4,12C4,9.95 4.78,7.9 6.34,6.34L7.75,7.75C6.59,8.93 6,10.46 6,12C6,13.54 6.59,15.07 7.76,16.24M12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16M17.66,17.66L16.25,16.25C17.41,15.07 18,13.54 18,12C18,10.46 17.41,8.93 16.24,7.76L17.65,6.35C19.22,7.9 20,9.95 20,12C20,14.05 19.22,16.1 17.66,17.66M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10Z" /></svg>',image_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,17H7V3H21M21,1H7A2,2 0 0,0 5,3V17A2,2 0 0,0 7,19H21A2,2 0 0,0 23,17V3A2,2 0 0,0 21,1M3,5H1V21A2,2 0 0,0 3,23H19V21H3M15.96,10.29L13.21,13.83L11.25,11.47L8.5,15H19.5L15.96,10.29Z" /></svg>',audio_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M20,16H8V4H20M12.5,15A2.5,2.5 0 0,0 15,12.5V7H18V5H14V10.5C13.58,10.19 13.07,10 12.5,10A2.5,2.5 0 0,0 10,12.5A2.5,2.5 0 0,0 12.5,15M4,6H2V20A2,2 0 0,0 4,22H18V20H4" /></svg>',video_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6H2V20C2 21.1 2.9 22 4 22H18V20H4V6M20 4V16H8V4H20M20 2H8C6.9 2 6 2.9 6 4V16C6 17.1 6.9 18 8 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M12 14.5V5.5L18 10L12 14.5Z" /></svg>',file_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,15H9V13H16V15M19,11H9V9H19V11M19,7H9V5H19V7M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3M21,1A2,2 0 0,1 23,3V17C23,18.11 22.11,19 21,19H7A2,2 0 0,1 5,17V3C5,1.89 5.89,1 7,1H21M7,3V17H21V3H7Z" /></svg>',file_browser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 6V20H20V22H2C.895 22 0 21.11 0 20V6H2M12.78 10.05L15.81 9.79L17 7L18.19 9.79L21.22 10.05L18.92 12.04L19.61 15L17 13.47L14.39 15L15.08 12.04L12.78 10.05M24 6V16C24 17.11 23.11 18 22 18H6C4.9 18 4 17.11 4 16V4C4 2.89 4.9 2 6 2H12L14 4H22C23.11 4 24 4.9 24 6M22 6H6V16H22V6Z" /></svg>',bookmark:'<svg viewBox="0 0 24 24"><path d="M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',bookmark_anchor:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,18L12,15.82L7,18V5H17M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',download:'<svg viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z" /></svg>',dir_ltr:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2H9C6.79 2 5 3.79 5 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zm0 12v3H5v2h12v3l4-4-4-4z"/></svg>',dir_rtl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zM8 14l-4 4 4 4v-3h12v-2H8v-3z"/></svg>',file_upload:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M12,12L16,16H13.5V19H10.5V16H8L12,12Z" /></svg>',file_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',file_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.81 22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H14L20 8V13.09C19.67 13.04 19.34 13 19 13S18.33 13.04 18 13.09V9H13V4H6V20H13.09C13.21 20.72 13.46 21.39 13.81 22M23 18H20V15H18V18H15V20H18V23H20V20H23V18Z" /></svg>',upload_tray:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 2L6.46 7.46L7.88 8.88L11 5.75V15H13V5.75L16.13 8.88L17.55 7.45L12 2Z" /></svg>',folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z" /></svg>',plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" /></svg>',minus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H5V11H19V13Z" /></svg>',selection:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,4C2,2.89 2.9,2 4,2H7V4H4V7H2V4M22,4V7H20V4H17V2H20A2,2 0 0,1 22,4M20,20V17H22V20C22,21.11 21.1,22 20,22H17V20H20M2,20V17H4V20H7V22H4A2,2 0 0,1 2,20M10,2H14V4H10V2M10,20H14V22H10V20M20,10H22V14H20V10M2,10H4V14H2V10Z" /></svg>',copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" /></svg>',cut:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z" /></svg>',PDF:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M9.5 11.5C9.5 12.3 8.8 13 8 13H7V15H5.5V9H8C8.8 9 9.5 9.7 9.5 10.5V11.5M14.5 13.5C14.5 14.3 13.8 15 13 15H10.5V9H13C13.8 9 14.5 9.7 14.5 10.5V13.5M18.5 10.5H17V11.5H18.5V13H17V15H15.5V9H18.5V10.5M12 10.5H13V13.5H12V10.5M7 10.5H8V11.5H7V10.5Z" /></svg>',format_paint:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,4V3A1,1 0 0,0 17,2H5A1,1 0 0,0 4,3V7A1,1 0 0,0 5,8H17A1,1 0 0,0 18,7V6H19V10H9V21A1,1 0 0,0 10,22H12A1,1 0 0,0 13,21V12H21V4H18Z" /></svg>',find_replace:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6C12.38,6 13.63,6.56 14.54,7.46L12,10H18V4L15.95,6.05C14.68,4.78 12.93,4 11,4C7.47,4 4.57,6.61 4.08,10H6.1C6.56,7.72 8.58,6 11,6M16.64,15.14C17.3,14.24 17.76,13.17 17.92,12H15.9C15.44,14.28 13.42,16 11,16C9.62,16 8.37,15.44 7.46,14.54L10,12H4V18L6.05,15.95C7.32,17.22 9.07,18 11,18C12.55,18 14,17.5 15.14,16.64L20,21.5L21.5,20L16.64,15.14Z" /></svg>',drawing:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.75 20.85C11.53 20.15 11.14 18.22 10.24 17C9.35 15.75 8.12 14.89 6.88 14.06C6 13.5 5.19 12.8 4.54 12C4.26 11.67 3.69 11.06 4.27 10.94C4.86 10.82 5.88 11.4 6.4 11.62C7.31 12 8.21 12.44 9.05 12.96L10.06 11.26C8.5 10.23 6.5 9.32 4.64 9.05C3.58 8.89 2.46 9.11 2.1 10.26C1.78 11.25 2.29 12.25 2.87 13.03C4.24 14.86 6.37 15.74 7.96 17.32C8.3 17.65 8.71 18.04 8.91 18.5C9.12 18.94 9.07 18.97 8.6 18.97C7.36 18.97 5.81 18 4.8 17.36L3.79 19.06C5.32 20 7.88 21.47 9.75 20.85M20.84 5.25C21.06 5.03 21.06 4.67 20.84 4.46L19.54 3.16C19.33 2.95 18.97 2.95 18.76 3.16L17.74 4.18L19.82 6.26M11 10.92V13H13.08L19.23 6.85L17.15 4.77L11 10.92Z" /></svg>',eraser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.14,3C14.63,3 14.12,3.2 13.73,3.59L2.59,14.73C1.81,15.5 1.81,16.77 2.59,17.56L5.03,20H12.69L21.41,11.27C22.2,10.5 22.2,9.23 21.41,8.44L16.56,3.59C16.17,3.2 15.65,3 15.14,3M17,18L15,20H22V18" /></svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>',selection_search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.27 18.9C19.7 18.21 19.95 17.38 19.95 16.5C19.95 14 17.95 12 15.46 12S10.96 14 10.96 16.5 12.96 21 15.46 21C16.33 21 17.15 20.75 17.84 20.32L20.96 23.39L22.35 22L19.27 18.9M15.46 19C14.07 19 12.96 17.88 12.96 16.5S14.07 14 15.46 14 17.95 15.12 17.95 16.5 16.84 19 15.46 19M22 14H21.45C21.12 13.19 20.62 12.47 20 11.86V10H22V14M20 4H17V2H20C21.11 2 22 2.9 22 4V7H20V4M14 4H10V2H14V4M4 2H7V4H4V7H2V4C2 2.89 2.9 2 4 2M12 22H10V20C10.5 20.82 11.2 21.5 12 22M4 20H7V22H4C2.9 22 2 21.11 2 20V17H4V20M4 14H2V10H4V14Z" /></svg>',embed:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 19H15V21H19C20.1 21 21 20.1 21 19V15H19M19 3H15V5H19V9H21V5C21 3.9 20.1 3 19 3M5 5H9V3H5C3.9 3 3 3.9 3 5V9H5M5 15H3V19C3 20.1 3.9 21 5 21H9V19H5V15M7 11H9V13H7V11M11 11H13V13H11V11M15 11H17V13H15V11Z" /></svg>',menu_arrow_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,10L12,15L17,10H7Z" /></svg>',menu_arrow_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,15L12,10L17,15H7Z" /></svg>',menu_arrow_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,17L15,12L10,7V17Z" /></svg>',menu_arrow_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,7L9,12L14,17V7Z" /></svg>',side_menu_hamburger:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /></svg>',side_menu_folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4A2,2 0 0,1 24,6V16A2,2 0 0,1 22,18H6A2,2 0 0,1 4,16V4A2,2 0 0,1 6,2H12L14,4H22M2,6V20H20V22H2A2,2 0 0,1 0,20V11H0V6H2M6,6V16H22V6H6Z" /></svg>',side_menu_folder_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4H14L12,2H6A2,2 0 0,0 4,4V16A2,2 0 0,0 6,18H22A2,2 0 0,0 24,16V6A2,2 0 0,0 22,4M2,6H0V11H0V20A2,2 0 0,0 2,22H20V20H2V6Z" /></svg>',side_menu_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z" /></svg>',side_menu_folder_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 19C13 19.34 13.04 19.67 13.09 20H4C2.9 20 2 19.11 2 18V6C2 4.89 2.89 4 4 4H10L12 6H20C21.1 6 22 6.89 22 8V13.81C21.12 13.3 20.1 13 19 13C15.69 13 13 15.69 13 19M20 18V15H18V18H15V20H18V23H20V20H23V18H20Z" /></svg>',alert_outline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" /></svg>',more_text:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M49.711,142.188h49.027c2.328,0.002,4.394,1.492,5.129,3.699l9.742,29.252c0.363,1.092,1.385,1.828,2.537,1.83l15.883,0.01c0.859,0,1.667-0.412,2.17-1.109s0.641-1.594,0.37-2.41l-16.625-50.045L86.503,28.953c-0.36-1.097-1.383-1.839-2.537-1.842H64.532c-1.153-0.001-2.178,0.736-2.542,1.831L13.847,173.457c-0.271,0.816-0.135,1.713,0.369,2.412c0.503,0.697,1.311,1.109,2.171,1.109h15.872c1.151,0,2.173-0.736,2.537-1.828l9.793-29.287C45.325,143.66,47.39,142.18,49.711,142.188L49.711,142.188z M53.493,119.098l15.607-46.9c0.744-2.196,2.806-3.674,5.125-3.674s4.381,1.478,5.125,3.674l15.607,46.904c0.537,1.621,0.263,3.402-0.736,4.789c-1.018,1.408-2.649,2.24-4.386,2.24H58.615c-1.736,0-3.368-0.832-4.386-2.24C53.23,122.504,52.956,120.721,53.493,119.098L53.493,119.098z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_paragraph:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M128.39,28.499H63.493c-25.558,0-46.354,20.796-46.354,46.354c0,25.559,20.796,46.353,46.354,46.353h9.271v55.625h18.542V47.04h9.271V176.83h18.543V47.04h9.271V28.499z M72.764,102.664h-9.271c-15.337,0-27.813-12.475-27.813-27.812c0-15.336,12.476-27.813,27.813-27.813h9.271V102.664z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="35 30 140 140"><g><path d="M137.215,102.045c0,3.498-2.835,6.332-6.333,6.332H24.549c-3.498,0-6.334-2.834-6.334-6.332l0,0c0-3.498,2.836-6.333,6.334-6.333h106.333C134.38,95.711,137.215,98.547,137.215,102.045L137.215,102.045z M77.715,161.545c-3.498,0-6.333-2.836-6.333-6.334V48.878c0-3.498,2.836-6.333,6.333-6.333l0,0c3.498,0,6.334,2.835,6.334,6.333v106.333C84.049,158.709,81.213,161.545,77.715,161.545L77.715,161.545z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.632,190.465,66.177,190.465,63.32L190.465,63.32z M190.465,101.993c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.888,1.026,5.353,3.056,7.396c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.993L190.465,101.993z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z" /></svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" /></svg>',as_inline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,7L13,17H3L8,7M3,3H21V5H3V3M21,15V17H14V15H21M3,19H21V21H3V19Z" /></svg>',as_block:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,7L17,17H7L12,7M3,3H21V5H3V3M3,19H21V21H3V19Z" /></svg>',page_break:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,20H6V18H4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V18H18V20M14,2H6A2,2 0 0,0 4,4V12H6V4H14V8H18V12H20V8L14,2M11,16H8V14H11V16M16,16H13V14H16V16M3,14H6V16H3V14M21,16H18V14H21V16Z" /></svg>',page_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6H13V14L16.5,10.5L17.92,11.92L12,17.84L6.08,11.92L7.5,10.5L11,14V6M12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20Z" /></svg>',page_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,18H11V10L7.5,13.5L6.08,12.08L12,6.16L17.92,12.08L16.5,13.5L13,10V18M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" /></svg>',collapse_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.92,19.92L4,12L11.92,4.08L13.33,5.5L7.83,11H22V13H7.83L13.34,18.5L11.92,19.92M4,12V2H2V22H4V12Z" /></svg>',collapse_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.08,4.08L20,12L12.08,19.92L10.67,18.5L16.17,13H2V11H16.17L10.67,5.5L12.08,4.08M20,12V22H22V2H20V12Z" /></svg>',map:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.7 15.62"><g><path d="M12.05,12.42a2.93,2.93,0,1,1,2.07-5A2.88,2.88,0,0,1,15,9.49a3,3,0,0,1-.86,2.07,2.89,2.89,0,0,1-2.07.86Zm0-5.36a2.43,2.43,0,0,0-1.72,4.16,2.48,2.48,0,0,0,1.72.72,2.44,2.44,0,0,0,0-4.88Zm0-3.3A5.84,5.84,0,0,1,17.9,9.62a9.94,9.94,0,0,1-1.73,5A33.59,33.59,0,0,1,12.84,19a1.52,1.52,0,0,1-.23.2,1,1,0,0,1-.55.2h0a1,1,0,0,1-.55-.2,1.52,1.52,0,0,1-.23-.2,33.59,33.59,0,0,1-3.33-4.32,9.93,9.93,0,0,1-1.72-5,5.84,5.84,0,0,1,5.85-5.86ZM12,18.34l.08.05.06-.06a35.58,35.58,0,0,0,3.06-3.93,9.35,9.35,0,0,0,1.74-4.77,4.88,4.88,0,0,0-4.88-4.88A4.79,4.79,0,0,0,8.6,6.17,4.84,4.84,0,0,0,7.17,9.62,9.29,9.29,0,0,0,8.91,14.4,36,36,0,0,0,12,18.34Z" transform="translate(-6.2 -3.76)"/></g></svg>',magic_stick:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.75"><g><path d="M19.86,19.21a1,1,0,0,0,.28-.68,1,1,0,0,0-.28-.7L13,10.93a1,1,0,0,0-.7-.28,1,1,0,0,0-.68,1.65l6.9,6.9a1,1,0,0,0,.69.29.93.93,0,0,0,.69-.28ZM9.19,8.55a3,3,0,0,0,1.68,0,14.12,14.12,0,0,0,1.41-.32A11.26,11.26,0,0,0,10.8,7.06c-.56-.36-.86-.56-.91-.58S10,5.91,10,5.11s0-1.26-.15-1.37a4.35,4.35,0,0,0-1.19.71c-.53.4-.81.62-.87.68a9,9,0,0,0-2-.6,6.84,6.84,0,0,0-.76-.09s0,.27.08.77a8.6,8.6,0,0,0,.61,2q-.09.09-.69.87a3.59,3.59,0,0,0-.68,1.17c.12.17.57.23,1.36.15S7,9.26,7.15,9.23s.21.36.57.91a10.49,10.49,0,0,0,1.14,1.48c0-.1.14-.57.31-1.4a3,3,0,0,0,0-1.67Z" transform="translate(-4.41 -3.74)"/></g></svg>',open_in_new:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" /></svg>'};var vt=i("cfbI"),Ct=i.n(vt);function wt(t,e,i,s,n,o,l,r){const a=new Map([["key",r],["options",t.options],["originElement",t.target],["topArea",e],["container",e.querySelector(".se-container")],["wrapper",e.querySelector(".se-wrapper")],["documentTypeInner",l.inner],["documentTypePage",l.page],["documentTypePageMirror",l.pageMirror],["wysiwygFrame",i],["wysiwyg",i],["codeWrapper",s],["code",n],["codeNumbers",s?.querySelector(".se-code-view-line")],["lineBreaker_t",e.querySelector(".se-line-breaker-component-t")],["lineBreaker_b",e.querySelector(".se-line-breaker-component-b")],["_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy")],["_toolbarShadow",e.querySelector(".se-toolbar-shadow")],["_minHeight",et(i.style.minHeight||"65",0)],["isCodeView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",-1],["historyIndex",-1],["savedIndex",-1],["eventwysiwyg",null]]);o&&xt(o,a);const h=e.querySelector(".se-placeholder");return h&&a.set("placeholder",h),a}function xt(t,e){t?e.set("statusbar",t):e.delete("statusbar");const i=t?t.querySelector(".se-navigation"):null,s=t?t.querySelector(".se-char-counter-wrapper"):null,n=t?t.querySelector(".se-char-counter-wrapper .se-char-counter"):null;i?e.set("navigation",i):e.delete("navigation"),s?e.set("charWrapper",s):e.delete("charWrapper"),n?e.set("charCounter",n):e.delete("charCounter")}function kt(t,e,i,s,n){const o=new Map([["menuTray",i],["toolbar.main",t],["toolbar.buttonTray",t.querySelector(".se-btn-tray")],["toolbar._arrow",t.querySelector(".se-arrow")]]);return s&&(o.set("toolbar.sub.main",s),o.set("toolbar.sub.buttonTray",s.querySelector(".se-btn-tray")),o.set("toolbar.sub._arrow",s.querySelector(".se-arrow")),o.set("toolbar.sub._wrapper",s.parentElement.parentElement)),e&&(o.set("toolbar._wrapper",e.querySelector(".sun-editor")),o.set("_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy"))),n&&o.set("statusbar._wrapper",n.querySelector(".sun-editor")),o}const St=dt._d,Et=[["undo","redo"],"|",["bold","underline","italic","strike","|","subscript","superscript"],"|",["removeFormat"],"|",["outdent","indent"],"|",["fullScreen","showBlocks","codeView"],"|",["preview","print"]],Tt=["px","pt","em","rem"],Ht={script:!1,style:!1,meta:!1,link:!1,"[a-z]+:[a-z]+":!1},Mt="background|background-clip|background-color|border|border-bottom|border-collapse|border-color|border-image|border-left-width|border-radius|border-right-width|border-spacing|border-style|border-top|border-width|box-shadow|box-sizing|caption-side|color|content|direction|display|float|font|font-family|font-size|font-style|font-weight|height|left|letter-spacing|line-height|list-style-position|list-style-type|margin|margin-block-end|margin-block-start|margin-bottom|margin-inline-end|margin-inline-start|margin-left|margin-right|margin-top|max-width|min-width|outline|overflow|position|padding|padding-bottom|padding-inline-start|padding-left|padding-right|padding-top|page-break-before|page-break-after|page-break-inside|rotate|rotateX|rotateY|table-layout|text-align|text-decoration|text-shadow|text-transform|top|text-indent|text-rendering|vertical-align|visibility|white-space|width|word-break|word-wrap",Lt={"table|th|td":"border|border-[a-z]+|color|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align|text-align","table|td":"width",tr:"height",col:"width","ol|ul":"list-style-type"},Nt="font-family|font-size|color|background-color",At=["repeat","always","none"],Bt={value:"fixed",placeholder:!0,editableFrameAttributes:!0,width:!0,minWidth:!0,maxWidth:!0,height:!0,minHeight:!0,maxHeight:!0,editorStyle:!0,iframe:"fixed",iframe_fullPage:"fixed",iframe_attributes:!0,iframe_cssFileName:!0,statusbar:!0,statusbar_showPathLabel:!0,statusbar_resizeEnable:"fixed",charCounter:!0,charCounter_max:!0,charCounter_label:!0,charCounter_type:!0},It={plugins:"fixed",excludedPlugins:"fixed",buttonList:"fixed",v2Migration:"fixed",strictMode:"fixed",mode:"fixed",type:"fixed",theme:!0,lang:"fixed",fontSizeUnits:"fixed",allowedClassName:"fixed",closeModalOutsideClick:"fixed",copyFormatKeepOn:!0,syncTabIndent:!0,tabDisable:!0,autoLinkify:!0,autoStyleify:!0,scrollToOptions:!0,componentScrollToOptions:!0,retainStyleMode:!0,allowedExtraTags:"fixed",events:!0,__textStyleTags:"fixed",textStyleTags:"fixed",convertTextTags:"fixed",__tagStyles:"fixed",tagStyles:"fixed",spanStyles:"fixed",lineStyles:"fixed",textDirection:!0,reverseButtons:"fixed",historyStackDelayTime:!0,lineAttrReset:!0,printClass:!0,defaultLine:"fixed",defaultLineBreakFormat:!0,scopeSelectionTags:!0,__defaultElementWhitelist:"fixed",elementWhitelist:"fixed",elementBlacklist:"fixed",__defaultAttributeWhitelist:"fixed",attributeWhitelist:"fixed",attributeBlacklist:"fixed",__defaultFormatLine:"fixed",formatLine:"fixed",__defaultFormatBrLine:"fixed",formatBrLine:"fixed",__defaultFormatClosureBrLine:"fixed",formatClosureBrLine:"fixed",__defaultFormatBlock:"fixed",formatBlock:"fixed",__defaultFormatClosureBlock:"fixed",formatClosureBlock:"fixed",allowedEmptyTags:!0,toolbar_width:!0,toolbar_container:"fixed",toolbar_sticky:!0,toolbar_hide:!0,subToolbar:"fixed",statusbar_container:"fixed",shortcutsHint:!0,shortcutsDisable:"fixed",shortcuts:"fixed",fullScreenOffset:!0,previewTemplate:!0,printTemplate:!0,componentAutoSelect:!0,defaultUrlProtocol:!0,allUsedStyles:"fixed",toastMessageTime:!0,icons:"fixed",freeCodeViewMode:!0,__lineFormatFilter:!0,__pluginRetainFilter:!0,__listCommonStyle:"fixed",externalLibs:"fixed"};function Vt(t,e,i,s,n,o){if(!i||i.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let h,c,d,u,p,g,m,f,_,b,y,v,C,w,x=0;x<i.length;x+=2+w){if(w=0,h=i[x].split("+"),_=null,b=h[h.length-1].trim?.(),b.startsWith("~"))_=t,b=h.pop().trim().substring(1);else if(b.startsWith("$~")){const t=h.pop().trim().substring(2).split(".");_=t[0],b=t[1]}else b.startsWith("$")?(w=1,b=i[x+2]):b="";d=u=p=g=m=f=c=null;for(const t of h)switch(t.trim()){case"c":d=!0;break;case"!":p=!0;break;case"s":u=!0;break;case"_":g=!0;break;case"=":f=!0;break;case"/":m=!0;break;default:c=t}c=c.split("|");for(let i=0,l=c.length;i<l;i++)v=d?c[i]+(u?"1000":""):c[i],s.has(v)||(C=n.indexOf(t),C=-1===C?"":mt.isOdd(C)?n[C+1]:n[C-1],C&&o.push(v),s.set(v,{c:d,s:u,edge:p,space:g,enter:m,textTrigger:f,plugin:_,command:t,method:b,r:C,type:e?.getAttribute("data-type"),button:e,key:v}));(y=i[x+1])&&(l&&(r=u,a=y,l.appendChild(gt.utils.createElement("SPAN",{class:"se-shortcut"},dt.cmdIcon+(r?dt.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>"))))}var r,a}function Ot(t,e){return[t,e].reduce(((t,e)=>{for(const i in e)t[i]=(e[i]||"").toLowerCase();return t}),{})}function Rt(t,e,i){const s=t.buttonList||Et,n=new Map;if(e.length>1&&!t.toolbar_container&&!/inline|balloon/i.test(t.mode))throw Error('[SUNEDITOR.create.fail] In multi root, The "mode" option cannot be "classic" without using the "toolbar_container" option.');n.set("v2Migration",!!t.v2Migration),n.set("buttons",new Set(s.toString().split(",")));const o=!1!==t.strictMode;n.set("strictMode",{tagFilter:o,formatFilter:o,classFilter:o,styleNodeFilter:o,attrFilter:o,styleFilter:o,..."boolean"==typeof t.strictMode?{}:t.strictMode}),n.set("freeCodeViewMode",!!t.freeCodeViewMode),n.set("__lineFormatFilter",t.__lineFormatFilter??!0),n.set("__pluginRetainFilter",t.__pluginRetainFilter??!0),n.set("mode",t.mode||"classic"),n.set("type",t.type?.split(":")[0]||""),n.set("theme",t.theme||""),n.set("_themeClass",t.theme?` se-theme-${t.theme}`:""),n.set("_type_options",t.type?.split(":")[1]||""),n.set("externalLibs",t.externalLibs||{}),n.set("fontSizeUnits",Array.isArray(t.fontSizeUnits)&&t.fontSizeUnits.length>0?t.fontSizeUnits.map((t=>t.toLowerCase())):Tt),n.set("allowedClassName",new RegExp((t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":"")+"^__se__|^se-|^katex|^MathJax")),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTabIndent",t.syncTabIndent??!0),n.set("autoLinkify",t.autoLinkify??!!i.link),n.set("autoStyleify",Array.isArray(t.autoStyleify)?t.autoStyleify:["bold","underline","italic","strike"]),n.set("scrollToOptions",{behavior:"auto",block:"nearest",...t.scrollToOptions}),n.set("componentScrollToOptions",{behavior:"smooth",block:"center",...t.componentScrollToOptions});let l=t.retainStyleMode;"string"!=typeof l||At.includes(l)||(console.error(`Invalid retainStyleMode: ${l}. Valid options are ${At.join(", ")}. Using default 'once'.`),l="repeat"),n.set("retainStyleMode",l);const r={...Ht,...t.allowedExtraTags,"-":!0},a=Object.keys(r),h=a.filter((t=>r[t])).join("|"),c=a.filter((t=>!r[t])).join("|");n.set("_allowedExtraTag",h),n.set("_disallowedExtraTag",c),n.set("events",t.events||{}),n.set("textStyleTags",("string"==typeof t.__textStyleTags?t.__textStyleTags:"strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary")+(t.textStyleTags?"|"+t.textStyleTags:""));const d=Ot({bold:"strong",underline:"u",italic:"em",strike:"del",subscript:"sub",superscript:"sup"},t.convertTextTags||{});n.set("convertTextTags",d),n.set("_textStyleTags",Object.values(d).concat(["span","li"])),n.set("tagStyles",[{...Lt,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{})),n.set("_textStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Nt}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](text-align|margin-left|margin-right|line-height${t.lineStyles?"|"+t.lineStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_defaultStyleTagMap",{strong:d.bold,b:d.bold,u:d.underline,ins:d.underline,em:d.italic,i:d.italic,del:d.strike,strike:d.strike,s:d.strike,sub:d.subscript,sup:d.superscript}),n.set("_styleCommandMap",Ot(pt.swapKeyValue(d),{strong:"bold",b:"bold",u:"underline",ins:"underline",em:"italic",i:"italic",del:"strike",strike:"strike",s:"strike",sub:"subscript",sup:"superscript"})),n.set("_defaultTagCommand",{bold:d.bold,underline:d.underline,italic:d.italic,strike:d.strike,subscript:d.sub,superscript:d.sup}),n.set("textDirection","string"!=typeof t.textDirection?"ltr":t.textDirection),n.set("_rtl","rtl"===n.get("textDirection")),n.set("reverseCommands",["indent-outdent"].concat(t.reverseButtons||[])),n.set("_reverseCommandArray",("-"+n.get("reverseCommands").join("-")).split("-")),mt.isEven(n.get("_reverseCommandArray").length)&&console.warn('[SUNEDITOR.create.warning] The "reverseCommands" option is invalid, Shortcuts key may not work properly.'),n.set("historyStackDelayTime","number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400),n.set("_editableClass","sun-editor-editable"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")+("document"===n.get("type")?" se-type-document-editable":"")),n.set("lineAttrReset",["id"].concat(t.lineAttrReset&&"string"==typeof t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):[])),n.set("printClass","string"==typeof t.printClass?t.printClass+" "+n.get("_editableClass"):null),n.set("defaultLine","string"==typeof t.defaultLine&&t.defaultLine.length>0?t.defaultLine:"p"),n.set("defaultLineBreakFormat",t.defaultLineBreakFormat||"line"),n.set("scopeSelectionTags",t.scopeSelectionTags||"td|table|li|ol|ul|pre|figcaption|blockquote|dl|dt|dd".split("|"));const u=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),p=n.get("externalLibs").mathjax?"mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover|":"";n.set("elementWhitelist",u+(u?"|":"")+p+n.get("_allowedExtraTag"));const g=(m=("string"==typeof t.elementBlacklist?t.elementBlacklist:"").toLowerCase(),f=(f=n.get("defaultLine")).toLowerCase(),m.split("|").filter((function(t){return t!==f||(console.warn(`[SUNEDITOR.constructor.createBlacklist.warn] defaultLine("<${f}>") cannot be included in the blacklist and will be removed.`),!1)})).join("|"));var m,f;if(n.set("elementBlacklist",g+(g?"|":"")+n.get("_disallowedExtraTag")),n.set("attributeWhitelist",t.attributeWhitelist&&"object"==typeof t.attributeWhitelist?t.attributeWhitelist:null),n.set("attributeBlacklist",t.attributeBlacklist&&"object"==typeof t.attributeBlacklist?t.attributeBlacklist:null),n.set("formatClosureBrLine",Dt(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:"").toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",Dt((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:"PRE").toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",Dt("div|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:"P|H[1-6]|LI|TH|TD|DETAILS").toLowerCase(),n.get("elementBlacklist"))),!n.get("formatLine").reg.test(n.get("defaultLine")))throw Error(`[SUNEDITOR.create.fail] The "defaultLine(${n.get("defaultLine")})" option must be included in the "formatLine(${n.get("formatLine").str})" option.`);n.set("formatClosureBlock",Dt(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:"TH|TD").toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",Dt((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:"BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS").toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details"+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist","br|div|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:"p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|colgroup|col|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary").toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:"contenteditable|target|href|title|download|rel|src|alt|class|type|colspan|rowspan|width|height|controls|autoplay|loop|muted|poster|preload|playsinline|volume|crossorigin|disableRemotePlayback|controlsList|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling").toLowerCase()),n.set("_editorElementWhitelist","*"===n.get("elementWhitelist")?"*":function(t){const e=t.get("elementBlacklist").split("|"),i=(t.get("__defaultElementWhitelist")+"|"+t.get("elementWhitelist")+"|"+t.get("formatLine").str+"|"+t.get("formatBrLine").str+"|"+t.get("formatClosureBlock").str+"|"+t.get("formatClosureBrLine").str).replace(/(^\||\|$)/g,"").split("|").filter(((t,i,s)=>t&&s.indexOf(t)===i&&!e.includes(t)));return i.join("|")}(n)),n.set("toolbar_width",t.toolbar_width?mt.is(t.toolbar_width)?t.toolbar_width+"px":t.toolbar_width:"auto"),n.set("toolbar_container",t.toolbar_container&&!/inline/i.test(n.get("mode"))?"string"==typeof t.toolbar_container?St.querySelector(t.toolbar_container):t.toolbar_container:null),n.set("toolbar_sticky",/balloon/i.test(n.get("mode"))?-1:void 0===t.toolbar_sticky?0:mt.is(t.toolbar_sticky)?mt.get(t.toolbar_sticky,0):-1),n.set("toolbar_hide",!!t.toolbar_hide);let _=null;const b=t.subToolbar;b?.buttonList?.length>0&&(/balloon/.test(n.get("mode"))?console.warn('[SUNEDITOR.create.subToolbar.fail] When the "mode" option is "balloon-*", the "subToolbar" option is omitted.'):(n.set("_subMode",b.mode||"balloon"),n.set("toolbar.sub_width",b.width?mt.is(b.width)?b.width+"px":b.width:"auto"),_=n.get("_rtl")?b.buttonList.reverse():b.buttonList,n.set("buttons_sub",new Set(_.toString().split(",")))));const y=new Map;for(let i=0,s=e.length;i<s;i++)y.set(e[i].key,$t(e[i].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const v=void 0===t.shortcutsDisable||t.shortcutsDisable?[{selectAll:["c+KeyA","A"],bold:["c+KeyB","B"],strike:["c+s+KeyS","S"],underline:["c+KeyU","U"],italic:["c+KeyI","I"],redo:["c+KeyY","Y","c+s+KeyZ","Z"],undo:["c+KeyZ","Z"],indent:["c+BracketRight","]"],outdent:["c+BracketLeft","["],save:["c+KeyS","S"],link:["c+KeyK","K"],hr:["!+---+=+~shortcut",""],list_numbered:["!+1.+_+~shortcut",""],list_bulleted:["!+*.+_+~shortcut",""],_h1:["c+s+Digit1|Numpad1+$~formatBlock.applyHeaderByShortcut",""],_h2:["c+s+Digit2|Numpad2+$~formatBlock.applyHeaderByShortcut",""],_h3:["c+s+Digit3|Numpad3+$~formatBlock.applyHeaderByShortcut",""]},t.shortcuts||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):{};n.set("shortcuts",v),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:mt.is(t.fullScreenOffset)?mt.get(t.fullScreenOffset,0):0),n.set("previewTemplate","string"==typeof t.previewTemplate?t.previewTemplate:null),n.set("printTemplate","string"==typeof t.printTemplate?t.printTemplate:null),n.set("componentAutoSelect",void 0!==t.componentAutoSelect&&!!t.componentAutoSelect),n.set("defaultUrlProtocol","string"==typeof t.defaultUrlProtocol?t.defaultUrlProtocol:null);const C=n.get("externalLibs").codeMirror;C&&(n.set("codeMirror",C),C.EditorView?n.set("codeMirror6Editor",!0):C.src?n.set("codeMirror5Editor",!0):(console.warn("[SUNEDITOR.options.externalLibs.codeMirror.fail] The codeMirror option is set incorrectly."),n.set("codeMirror",null))),n.set("__listCommonStyle",t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"]);const w=t.icons&&"object"==typeof t.icons?[yt,t.icons].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{}):yt;n.set("icons",w);const x=new Set(Mt.split("|")),k=t.spanStyles?.split("|")||[],S=n.get("__listCommonStyle"),E=Nt.split("|");for(let t=0,e=E.length;t<e;t++)x.add(E[t]);for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,i=e.length;t<i;t++)x.add(e[t])}for(let t=0,e=k.length;t<e;t++)x.add(k[t]);for(let t=0,e=S.length;t<e;t++)x.add(S[t]);const T=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=T.length;t<e;t++)x.add(T[t]);return n.set("allUsedStyles",x),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:w,l:t.lang||Ct(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?s.reverse():s,subButtons:_,statusbarContainer:"string"==typeof t.statusbar_container?St.querySelector(t.statusbar_container):t.statusbar_container,frameMap:y}}function zt(t,e){let i=null,s=null,n=null;if(t.get("statusbar")&&(i=(e=e||gt.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"})).querySelector(".se-navigation")||gt.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(i),t.get("charCounter"))){if(s=e.querySelector(".se-char-counter-wrapper")||gt.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=s.querySelector(".se-char-label")||gt.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),s.appendChild(e)}if(n=s.querySelector(".se-char-counter")||gt.utils.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",s.appendChild(n),t.get("charCounter_max")>0){const e=s.querySelector(".se-char-max")||gt.utils.createElement("SPAN",{class:"se-char-max"});e.textContent=" / "+t.get("charCounter_max"),s.appendChild(e)}e.appendChild(s)}return{statusbar:e,navigation:i,charWrapper:s,charCounter:n}}function $t(t,e){const i=new Map;i.set("_origin",t);const s=e.statusbar_container,n=void 0===t.value?e.value:t.value,o=void 0===t.placeholder?e.placeholder:t.placeholder,l=void 0===t.editableFrameAttributes?e.editableFrameAttributes:t.editableFrameAttributes,r=void 0===t.width?e.width:t.width,a=void 0===t.minWidth?e.minWidth:t.minWidth,h=void 0===t.maxWidth?e.maxWidth:t.maxWidth,c=void 0===t.height?e.height:t.height,d=void 0===t.minHeight?e.minHeight:t.minHeight,u=void 0===t.maxHeight?e.maxHeight:t.maxHeight,p=void 0===t.editorStyle?e.editorStyle:t.editorStyle,g=void 0===t.iframe?e.iframe:t.iframe,m=void 0===t.iframe_fullPage?e.iframe_fullPage:t.iframe_fullPage,f=void 0===t.iframe_attributes?e.iframe_attributes:t.iframe_attributes,_=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,b=s||void 0===t.statusbar?e.statusbar:t.statusbar,y=s||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,v=!s&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),C=s||void 0===t.charCounter?e.charCounter:t.charCounter,w=s||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,x=s||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,k=s||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type;i.set("value",n),i.set("placeholder",o),i.set("editableFrameAttributes",l||{}),i.set("width",r?mt.is(r)?r+"px":r:"100%"),i.set("minWidth",(mt.is(a)?a+"px":a)||""),i.set("maxWidth",(mt.is(h)?h+"px":h)||""),i.set("height",c?mt.is(c)?c+"px":c:"auto"),i.set("minHeight",(mt.is(d)?d+"px":d)||""),i.set("maxHeight",(mt.is(u)?u+"px":u)||""),i.set("editorStyle",p),i.set("_defaultStyles",pt._setDefaultOptionStyle(i,"string"==typeof p?p:"")),i.set("iframe",!(!m&&!g)),i.set("iframe_fullPage",!!m),i.set("iframe_attributes",f||{}),i.set("iframe_cssFileName",g?"string"==typeof _?[_]:_||["suneditor"]:null);const S=void 0===b||!!b;return i.set("statusbar",S),i.set("statusbar_showPathLabel",!!S&&("boolean"!=typeof y||y)),i.set("statusbar_resizeEnable",!!S&&(void 0===v||!!v)),i.set("charCounter",w>0||"boolean"==typeof C&&C),i.set("charCounter_max",mt.is(w)&&w>-1?1*w:null),i.set("charCounter_label","string"==typeof x?x.trim():null),i.set("charCounter_type","string"==typeof k?k:"char"),i}function Ft(t,e,i,s){const n=s.get("_defaultStyles");i.style.cssText=n.top;const o=gt.utils.createElement(s.get("iframe")?"IFRAME":"DIV",{class:"se-wrapper-inner se-wrapper-wysiwyg","data-root-key":t});if(s.get("iframe")){const t=s.get("iframe_attributes");for(const e in t)o.setAttribute(e,t[e]);const e=o;e.allowFullscreen=!0,e.frameBorder="0",e.style.cssText=n.frame}else o.setAttribute("contenteditable","true"),o.setAttribute("scrolling","auto"),o.className+=" "+e.get("_editableClass"),o.style.cssText=n.frame+n.editor;const l=gt.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame}),r=gt.utils.createElement("SPAN",{class:"se-placeholder"});return s.get("placeholder")&&(r.textContent=s.get("placeholder")),{bottomBar:zt(s,null),wysiwygFrame:o,codeView:l,placeholder:r}}function Pt(t,e,i){let s=null,n=!1;if(t.get("codeMirror6Editor")){const o=t.get("codeMirror"),l=i.style.cssText,r=new o.EditorView({parent:i.parentElement,extensions:o.extensions,state:o.state});e.set("codeMirror6Editor",r),s=r.dom,s.style.cssText=l,n=!0}else if(t.get("codeMirror5Editor")){const o=t.get("codeMirror"),l=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},o.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});"auto"===e.get("height")&&(l.viewportMargin=1/0,l.height="auto");const r=i.style.cssText,a=o.src.fromTextArea(i,l);e.set("codeMirror5Editor",a),s=a.display.wrapper,s.style.cssText=r,n=!0}return t.set("hasCodeMirror",n),s?(gt.utils.removeItem(i),s.className+=" se-code-viewer-mirror",s):i}function Dt(t,e,i){const s=i.split("|"),n=(e+"|"+("string"==typeof t?t.toLowerCase():"")).replace(/^\||\|$/g,"").split("|").filter((t=>t&&!s.includes(t))).join("|");return{reg:new RegExp(`^(${n})$`,"i"),str:n}}function qt(){const t=gt.utils.createElement("UL",{class:"se-menu-list"});return{div:gt.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function Wt(t,e,i,s,n,o,l){n||(n="");const r=gt.utils.createElement("LI"),a=e||"",h=/^INPUT|FIELD$/i.test(s),c="se-toolbar-separator-vertical"===t?gt.utils.createElement("DIV",{class:t,tabindex:"-1"},null):gt.utils.createElement(h?"DIV":"BUTTON",{class:"se-toolbar-btn se-btn se-tooltip"+(t?" "+t:""),"data-command":i,"data-type":s,"aria-label":a.replace(/<span .+<\/span>/,""),tabindex:"-1"});return h||c.setAttribute("type","button"),/^default\./i.test(n)&&(n=l[n.replace(/^default\./i,"")]),/^text\./i.test(n)&&(n=n.replace(/^text\./i,""),c.className+=" se-btn-more-text"),o&&(c.disabled=!0),/^FIELD$/i.test(s)&>.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=gt.utils.createTooltipInner(a)),n&&(c.innerHTML=n),r.appendChild(c),{li:r,button:c}}function Ut(t,e,i,s){if(!t)return;const n=!1===e.inner;if(1===e.inner?.nodeType?t.appendChild(e.inner):t.innerHTML=n?"":(e.inner||i[e.icon]||e.icon||'<span class="se-icon-text">!</span>')+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+(s[e.title]||e.title)+"</span></span>",t.setAttribute("aria-label",e.title),e.type&&t.setAttribute("data-type",e.type),e.className&&(t.className+=" "+e.className),e.afterItem&&(gt.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),gt.utils.addClass(t,"se-side-btn-a"),gt.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(gt.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(gt.utils.addClass(t,"se-side-btn"),gt.utils.removeClass(t,"se-side-btn-a")):gt.utils.addClass(t,"se-side-btn-b"),gt.utils.addClass(e.beforeItem,"se-side-btn-before")),e.replaceButton&&(t.parentElement.appendChild(e.replaceButton),t.style.display="none"),!e.replaceButton&&/^INPUT$/i.test(t.getAttribute("data-type"))){const e=t.querySelector("input");e&&(gt.utils.addClass(e,"se-toolbar-btn"),e.setAttribute("data-command",t.getAttribute("data-command")),e.setAttribute("data-type",t.getAttribute("data-type")),t.hasAttribute("disabled")&&(e.disabled=!0))}}function Gt(t,e,i,s,n,o){t=JSON.parse(JSON.stringify(t));const l=function(t,e,i){const s=t.get("_rtl");return{bold:["",i.bold,"bold","",e.bold],underline:["",i.underline,"underline","",e.underline],italic:["",i.italic,"italic","",e.italic],strike:["",i.strike,"strike","",e.strike],subscript:["",i.subscript,"subscript","",e.subscript],superscript:["",i.superscript,"superscript","",e.superscript],removeFormat:["",i.removeFormat,"removeFormat","",e.remove_format],copyFormat:["",i.copyFormat,"copyFormat","",e.format_paint],indent:["se-icon-flip-rtl",i.indent,"indent","",s?e.outdent:e.indent],outdent:["se-icon-flip-rtl",i.outdent,"outdent","",s?e.indent:e.outdent],fullScreen:["se-code-view-enabled se-component-enabled",i.fullScreen,"fullScreen","",e.expansion],showBlocks:["",i.showBlocks,"showBlocks","",e.show_blocks],codeView:["se-code-view-enabled se-component-enabled",i.codeView,"codeView","",e.code_view],undo:["se-component-enabled",i.undo,"undo","",e.undo],redo:["se-component-enabled",i.redo,"redo","",e.redo],preview:["se-component-enabled",i.preview,"preview","",e.preview],print:["se-component-enabled",i.print,"print","",e.print],copy:["",i.copy,"copy","",e.copy],dir:["",i[s?"dir_ltr":"dir_rtl"],"dir","",e[s?"dir_ltr":"dir_rtl"]],dir_ltr:["",i.dir_ltr,"dir_ltr","",e.dir_ltr],dir_rtl:["",i.dir_rtl,"dir_rtl","",e.dir_rtl],save:["se-component-enabled",i.save,"save","",e.save],newDocument:["se-component-enabled",i.newDocument,"newDocument","",e.new_document],selectAll:["se-component-enabled",i.selectAll,"selectAll","",e.select_all],pageBreak:["se-component-enabled",i.pageBreak,"pageBreak","",e.page_break],pageUp:["se-component-enabled",i.pageUp,"pageUp","",e.page_up],pageDown:["se-component-enabled",i.pageDown,"pageDown","",e.page_down],pageNavigator:["se-component-enabled","","pageNavigator","input",""]}}(i,s,n),r={},a=[],h=[];let c=null,d=null,u=null,p=null,g=null;const m=gt.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=gt.utils.createElement("DIV",{class:"se-btn-tray"}),_=gt.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let i,b,y,v,C,w=0;w<t.length;w++)if(i=!1,C="",v=t[w],p=qt(),"object"==typeof v){for(let f,_=0;_<v.length;_++){if(d=v[_],f=!1,u=e[d],/^%\d+/.test(d)&&0===_){v[0]=d.replace(/[^\d]/g,""),a.push(v),t.splice(w--,1);continue t}if("function"==typeof u)c=[u.className,u.title,d,u.type,u.innerHTML,u._disabled];else if("object"==typeof u){const t=u.constructor;c=[u.className||t.className,u.title||t.title,d,u.type||t.type,u.innerHTML||t.innerHTML,u._disabled||t._disabled]}else{if(/^-/.test(d)){C=d.substring(1),p.div.className+=" module-float-"+C;continue}if(/^#/.test(d)){"fix"===d.substring(1)&&(p.ul.className+=" se-menu-dir-fix");continue}if(/^:/.test(d)){f=!0;const t=d.match(/^:([^-]+)-([^-]+)/);y="__se__more_"+w;const e=t[1].trim(),i=t[2].trim();c=["se-btn-more",/^lang\./i.test(e)?n[e.replace(/^lang\./i,"")]:e,y,"MORE",i]}else if("|"===d)c=["se-toolbar-separator-vertical","","","separator",""];else{if("copy"===d&&!dt.isClipboardSupported){console.warn("[SUNEDITOR.constructor.warn] Clipboard is not supported in this browser. : [copy] button is not rendered.");continue}c=l[d]}if(!c){if(!u)throw Error(`[SUNEDITOR.create.toolbar.fail] The button name of a plugin that does not exist. [${d}]`);u="object"==typeof u?u.constructor:u,c=[u.className,u.title,u.key,u.type,u.innerHTML,u._disabled]}}g=Wt(c[0],c[1],c[2],c[3],c[4],c[5],s),(i?b:p.ul).appendChild(g.li),u&&(r[d]?r[d].push(g.button):r[d]=[g.button],o&&h.push({button:g.button,plugin:u,key:d})),f&&(i=!0,b=gt.utils.createElement("DIV"),b.className="se-more-layer "+y,b.setAttribute("data-ref",y),b.innerHTML='<div class="se-more-form"><ul class="se-menu-list"'+(C?' style="float: '+C+';"':"")+"></ul></div>",m.appendChild(b),b=b.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===v){const t=_.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(v)){const t=gt.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:gt.utils.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const b=gt.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(i.get("shortcutsHint")?"":" se-shortcut-hide")},f);return i.get("toolbar_hide")&&(b.style.display="none"),{element:b,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:h}}const Zt=function(t,e){"object"!=typeof e&&(e={});const i={};if(e.plugins){const t=e.excludedPlugins||[],s=e.plugins,n=(Array.isArray(s)?s:Object.keys(s)).filter((e=>!t.includes(e))).map((t=>s[t]));for(let t,e=0,s=n.length;e<s;e++)t=n[e].default||n[e],i[t.key]=t}const s=Rt(e,t,i),n=s.o,o=s.i,l=s.l,r=gt.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=gt.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),h=gt.utils.createElement("DIV",{class:"se-menu-tray"});a.appendChild(h);const c=gt.utils.createElement("INPUT",{class:"__se__focus__temp__",style:"position: fixed !important; top: -10000px !important; left: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;"});c.tabIndex=0,a.appendChild(c);const d=gt.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common"}),u=gt.utils.createElement("DIV",{class:"se-modal-back"}),p=gt.utils.createElement("DIV",{class:"se-modal-inner"});d.appendChild(u),d.appendChild(p),a.appendChild(d);const g=gt.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;"}),m=gt.utils.createElement("DIV",{class:"se-modal-back"}),f=gt.utils.createElement("DIV",{class:"se-modal-inner"});g.appendChild(m),g.appendChild(f),a.appendChild(g),a.appendChild(gt.utils.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const _=gt.utils.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(_),St.body.appendChild(a);let b=null,y=null;const v=Gt(s.buttons,i,n,o,l,!1),C=v.element;C.style.visibility="hidden",/inline/i.test(n.get("mode"))?(C.className+=" se-toolbar-inline",C.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(C.className+=" se-toolbar-balloon",C.style.width=n.get("toolbar_width"),C.appendChild(gt.utils.createElement("DIV",{class:"se-arrow"}))),s.subButtons&&(y=Gt(s.subButtons,i,n,o,l,!1),b=y.element,b.style.visibility="hidden",b.className+=" se-toolbar-balloon se-toolbar-sub",b.style.width=n.get("toolbar.sub_width"),b.appendChild(gt.utils.createElement("DIV",{class:"se-arrow"})));const w=t[0].key||null,x=[],k=new Map,S=s.statusbarContainer;let E=null;for(let e=0,i=t.length;e<i;e++){const i=t[e],a=s.frameMap.get(i.key),h=gt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=gt.utils.createElement("DIV",{class:"se-container"}),d=gt.utils.createElement("DIV",{class:"se-wrapper"+("document"===n.get("type")?" se-type-document":"")+(n.get("_type_options").includes("header")?" se-type-document-header":"")});c.appendChild(gt.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const u=Ft(i.key,n,h,a),p=u.bottomBar.statusbar,g=u.wysiwygFrame,m=u.placeholder;let f=u.codeView;const _=gt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),b=gt.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);d.appendChild(_),d.appendChild(b),m&&d.appendChild(m),c.appendChild(gt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),c.appendChild(d),p&&(S?E||(S.appendChild(gt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},p)),E=p):c.appendChild(p)),c.appendChild(r.cloneNode(!0));const y=i.key||null,v=gt.utils.createElement("DIV",{class:"se-code-wrapper"},f);v.style.setProperty("display","none","important"),d.appendChild(v);const C=Pt(n,a,f);if(f===C){const t=gt.utils.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);v.insertBefore(t,f)}else f=C;const w={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(w.inner=gt.utils.createElement("DIV",{class:"se-document-lines",style:`height: ${a.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("_type_options").includes("page")&&(w.page=gt.utils.createElement("DIV",{class:"se-document-page"},null),w.pageMirror=gt.utils.createElement("DIV",{class:"sun-editor-editable se-document-page-mirror-a4",style:"position: absolute; width: 21cm; columns: 21cm; border: 0; overflow: hidden; height: auto; top: -10000px; left: -10000px;"},null)),h.appendChild(c),x.push(y),k.set(y,wt({target:i.target,key:i.key,options:a},h,g,v,f,E||p,w,y))}const T=n.get("toolbar_container");if(T){const t=gt.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=gt.utils.createElement("DIV",{class:"se-container"});e.appendChild(C),b&&e.appendChild(b),t.appendChild(e),T.appendChild(t),T.appendChild(gt.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=k.get(w).get("container");t.insertBefore(C,t.firstElementChild),b&&t.insertBefore(b,t.firstElementChild)}return{context:kt(C,T,h,b,S),carrierWrapper:a,options:n,plugins:i,icons:o,lang:l,value:s.v,rootId:w,rootKeys:x,frameRoots:k,pluginCallButtons:v.pluginCallButtons,responsiveButtons:v.responsiveButtons,pluginCallButtons_sub:y?y.pluginCallButtons:[],responsiveButtons_sub:y?y.responsiveButtons:[]}},{NO_EVENT:Yt}=dt,Xt={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};let jt=null,Kt=null;const Jt=function(t,e){return jt=this.eventManager.removeGlobalEvent("keydown",jt),Kt=this.eventManager.removeGlobalEvent("mousedown",Kt),this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,gt.utils.removeClass(t,"se-copy-format-cursor"),gt.utils.removeClass(e,"on"),!0},Qt=function(t){const e=gt.check.isContentLess,i=gt.check.isTable;return{first:gt.query.getEdgeChild(gt.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||i(t)),!1)||t.firstChild,last:gt.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||i(t)),!0)||t.lastChild}},te=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],ee=te.concat(["undo","redo","save","fullScreen","showBlocks","codeView","dir","dir_ltr","dir_rtl"]);function ie(t,e){if("function"==typeof t._onCopyFormatInitMethod)return void t._onCopyFormatInitMethod();const i=t.frameContext.get("wysiwyg");t._onCopyFormatInfo=[...t.eventManager.__cacheStyleNodes],t._onCopyFormatInitMethod=Jt.bind(t,i,e),gt.utils.addClass(i,"se-copy-format-cursor"),gt.utils.addClass(e,"on"),jt=t.eventManager.addGlobalEvent("keydown",(e=>{ft.isEsc(e.code)&&t._onCopyFormatInitMethod?.()})),Kt=t.eventManager.addGlobalEvent("mousedown",(s=>{i.contains(s.target)||s.target===e||t._onCopyFormatInitMethod?.()}))}function se(e){const i=e.frameRoots;let s,n,o,l,r=e.options.get("historyStackDelayTime"),a=null,h=!1,c=null;function d(t,i,s){s&&e.status.hasFocus&&e.eventManager.applyTagEffect(),e.history.resetButtons(t.get("key"),i),e.triggerEvent("onChange",{frameContext:t,data:t.get("wysiwyg").innerHTML}),"block"===e.context.get("toolbar.main").style.display?e.toolbar._showBalloon():e.isSubBalloon&&"block"===e.context.get("toolbar.sub.main").style.display&&e.subToolbar._showBalloon()}function u(t){const l=n[s],r=o[l],a=e.frameContext;s+=t;const h=t<0&&l!==n[s]&&r.index>0?l:n[s],c=o[h];c.index+=t;const u=c.value[c.index];i.get(h).get("wysiwyg").innerHTML=u.content,l!==h&&t<0&&1===s?s=0:l!==h&&t>0&&1===c.index?s++:(t<0&&c.index<1||t>0&&c.index>c.value.length)&&(s+=t);let p=h,g=u;if(t<0&&s>0&&0===c.index){const e=n[s+t];if(e!==h){const t=o[e];p=e,g=t.value[t.index]}}e.changeFrameContext(p),e.selection.setRange(X(g.s.path,g.frame),g.s.offset,X(g.e.path,g.frame),g.e.offset),e.focus(),s<0?s=0:s>=n.length&&(s=n.length-1),e.ui._offCurrentController(),e._checkComponents(!1),e.char.display(),e._resourcesStateChange(a),a.has("documentType-use-header")&&a.get("documentType").reHeader(),d(a,c.index,!0)}function p(t,e,l,r){let a,h;e?(a={path:Y(e.startContainer,null,null),offset:e.startOffset},h={path:Y(e.endContainer,null,null),offset:e.endOffset}):(a={path:[0,0],offset:[0,0]},h={path:0,offset:0}),s+=r,n[s]=l;const c=o[l];c.index+=r,c.value[c.index]={content:t,s:a,e:h,frame:i.get(l).get("wysiwyg")}}function g(t){o[t]={value:[],index:-1},l[t]=i.get(t).get("wysiwyg").innerHTML}function m(t,r){e._checkComponents(!1);const a=i.get(t),h=a.get("wysiwyg").innerHTML,c=o[t];!h||c.value[c.index]&&h===c.value[c.index].content||(n.length>s+1&&function(t){const i=[];for(let t=s+1,e=n.length;t<e;t++)i.includes(n[t])||i.push(n[t]);n=n.slice(0,s+1),t.value.splice(s+1),e.applyCommandTargets("redo",(t=>{t.disabled=!0}));for(let t=0,e=i.length;t<e;t++)n.includes(i[t])||g(i[t])}(c),0===c.value.length&&function(t){s++,n[s]=t;const e=o[t];e.index=0,e.value[0]={content:l[t],s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0},frame:i.get(t).get("wysiwyg")}}(t),p(h,r,t,1),1===s&&e.applyCommandTargets("undo",(t=>{t.disabled=!1})),e.char.display(),d(a,c.index,!1))}return{push(s,n){if(h)return;n=n||e.status.rootKey;const o=e.status._range;t.setTimeout(e._resourcesStateChange.bind(e,i.get(n)),0);const l="number"==typeof s?s>0?s:0:s?r:0;l&&!a||(t.clearTimeout(a),l)?a=t.setTimeout((()=>{t.clearTimeout(a),a=null,m(n,o)}),l):m(n,o)},check(e,i){a&&(t.clearTimeout(a),a=null,m(e,i))},undo(){s>0&&u(-1)},redo(){n.length-1>s&&u(1)},overwrite(t){p(i.get(t||e.status.rootKey).get("wysiwyg").innerHTML,null,e.status.rootKey,0)},pause(){h=!0,c&&(t.clearTimeout(c),c=null),c=t.setTimeout((()=>{h=!1}),5e3)},resume(){c&&(t.clearTimeout(c),c=null),h=!1},reset(){e.applyCommandTargets("undo",(t=>t.disabled=!0)),e.applyCommandTargets("redo",(t=>t.disabled=!0)),e.applyCommandTargets("save",(t=>t.disabled=!0)),e.applyFrameRoots((t=>t.set("historyIndex",-1))),e.applyFrameRoots((t=>t.set("isChanged",!1))),s=-1,n=[],o={},l={},h=!1;const t=e.rootKeys;for(let e=0,i=t.length;e<i;e++)g(t[e])},resetButtons(t,i){const l=!mt.is(i),r=o[void 0===t?n[s]:t];i=l?r.index:i;const a=e.frameRoots.get(t),h=r.value.length-1;e.applyCommandTargets("undo",(t=>{t.disabled=!(i>0&&i<=h)})),e.applyCommandTargets("redo",(t=>{t.disabled=!(i>-1&&i<h)}));const c=a.get("savedIndex"),d=a.get("historyIndex"),u=c>-1?c!==i:l?r.index>0:i>0&&d!==i;a.set("historyIndex",i),a.set("isChanged",u),e.applyCommandTargets("save",(t=>{t.disabled=!u})),e.triggerEvent("onResetButtons",{rootKey:t})},getRootStack:()=>o,resetDelayTime(t){r=t},destroy(){a&&t.clearTimeout(a),s=n=o=l=null}}}function ne(t){this.editor=t,this.eventManager=t.eventManager,this.history=t.history,this.events=t.events,this.triggerEvent=t.triggerEvent,this.carrierWrapper=t.carrierWrapper,this.plugins=t.plugins,this.status=t.status,this.context=t.context,this.options=t.options,this.icons=t.icons,this.lang=t.lang,this.frameRoots=t.frameRoots,this._w=t._w,this._d=t._d}const oe=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),{isMobile:le}=dt;function re(t){const e=gt.query.getEventTarget(t);let i=e;this.editor.isSubBalloon&&!this.context.get("toolbar.sub.main")?.contains(i)&&this._hideToolbar_sub();const s=gt.check.isInputElement(i);if(s?this.editor._preventBlur=!1:this.editor.frameContext.get("wysiwyg").contains(this.selection.getNode())||this.editor.focus(),gt.query.getParentElement(i,".se-dropdown"))t.stopPropagation(),this.editor._notHideToolbar=!0;else{let n=i.getAttribute("data-command"),o=i.className;for(;i&&!n&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(o);)i=i.parentElement,n=i.getAttribute("data-command"),o=i.className;if(s&&/^INPUT$/i.test(i?.getAttribute("data-type"))){if(this.editor._preventBlur=this._inputFocus=!0,this.status.hasFocus||this.applyTagEffect(),!gt.check.isInputElement(e)||e.disabled)return;const t=this.plugins[n];if(!t)return;if(this.__inputBlurEvent&&this.__removeInput(),"function"==typeof t.onInputChange&&(this.__inputPlugin={obj:t,target:e,value:e.value}),this.__inputBlurEvent=this.addEvent(e,"blur",(i=>{if(!t.isInputActive)try{const s=e.value.trim();"function"==typeof t.onInputChange&&s!==this.__inputPlugin.value&&t.onInputChange({target:e,value:s,event:i})}finally{this._w.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!t)return;"function"==typeof t.onInputKeyDown&&(this.__inputKeyEvent=this.addEvent(e,"keydown",(i=>{t.onInputKeyDown({target:e,event:i})})))}else{if(this.__inputBlurEvent&&this.__inputPlugin){const e=this.__inputPlugin.target.value.trim();return e!==this.__inputPlugin.value&&this.__inputPlugin.obj.onInputChange({target:this.__inputPlugin.target,value:e,event:t}),void this.__removeInput()}this.editor.frameContext.get("isCodeView")||(le?this.editor._preventBlur=!0:(t.preventDefault(),dt.isGecko&&n&&this._injectActiveEvent(i)))}n!==this.menu.currentDropdownName&&n!==this.menu.currentContainerName||t.stopPropagation()}}function ae(t){const e=gt.query.getEventTarget(t),i=gt.query.getCommandTarget(e);if(!i)return;let s=i,n="";for(;s&&!/se-menu-tray/.test(s.className)&&!n;)s=s.parentElement,n=s.getAttribute("data-key");if(!n)return;const o=this.plugins[n];o&&"function"==typeof o.action&&(t.stopPropagation(),o.action(i))}function he(t){const e=gt.query.getEventTarget(t);this.editor.runFromTarget(e)}const{_w:ce}=dt;let de=null;function ue(){this.editor.status._onMousedown=!1,de=this.removeGlobalEvent(de)}async function pe(t,e){const i=gt.query.getEventTarget(e);this.editor.status._onMousedown=!0,de&&ue.call(this),de=this.addGlobalEvent("mouseup",ue.bind(this)),t.get("isReadOnly")||gt.check.isNonEditable(t.get("wysiwyg"))||(this.format._isExcludeSelectionElement(i)?e.preventDefault():(this._setSelectionSync(),this._w.setTimeout(this.selection._init.bind(this.selection),0),!1!==await this.triggerEvent("onMouseDown",{frameContext:t,event:e})&&!1!==this._callPluginEvent("onMouseDown",{frameContext:t,event:e})&&(this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(i.nodeName)&&e.preventDefault())))}async function ge(t,e){!1!==await this.triggerEvent("onMouseUp",{frameContext:t,event:e})&&this._callPluginEvent("onMouseUp",{frameContext:t,event:e})}async function me(t,e){const i=gt.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),gt.check.isAnchor(i)&&ce.open(i.href,i.target),!1;if(gt.check.isNonEditable(t.get("wysiwyg")))return;if(!1===await this.triggerEvent("onClick",{frameContext:t,event:e}))return;if(!1===this._callPluginEvent("onClick",{frameContext:t,event:e}))return;const s=this.component.get(i);if(s)return e.preventDefault(),void this.component.select(s.target,s.pluginName);if(this.selection._init(),3===e.detail){let t=this.selection.getRange();this.format.isLine(t.endContainer)&&0===t.endOffset&&(t=this.selection.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.textContent.length),this.selection._rangeInfo(t,this.selection.get()))}const n=this.selection.getNode(),o=this.format.getLine(n,null),l=this.format.getBlock(n,null);if(!o&&!gt.check.isNonEditable(i)&&!gt.check.isList(l)){const t=this.selection.getRange();if(this.format.getLine(t.startContainer)===this.format.getLine(t.endContainer))if(gt.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,i=gt.utils.createElement("LI",null,n);l.insertBefore(i,t),this.editor.focus()}else gt.check.isWysiwygFrame(n)||this.component.is(n)||gt.check.isTableElements(n)&&!gt.check.isTableCell(n)||null===this._setDefaultLine(this.format.isBlock(l)?"DIV":this.options.get("defaultLine"))||(e.preventDefault(),this.editor.focus())}if(this.editor._onCopyFormatInfo)try{const t=[...this.editor._onCopyFormatInfo],e=t.pop();if(this.format.removeInlineElement(),e){const i=this.format.applyInlineElement(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:s,inner:n}=this.nodeTransform.createNestedNode(t);i.parentNode.insertBefore(s,i),n.appendChild(i),this.selection.setRange(i,gt.check.isZeroWidth(i)?1:0,i,1)}if(this.options.get("copyFormatKeepOn"))return;this.editor._onCopyFormatInitMethod()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.editor._onCopyFormatInitMethod?.()||(this.editor._onCopyFormatInfo=null,this.editor._onCopyFormatInitMethod=null)}(this.editor.isBalloon||this.editor.isSubBalloon)&&this._w.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function fe(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;const i=gt.query.getEventTarget(e);!1!==oe.get("__overInfo")&&this._overComponentSelect(i),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}async function _e(t,e){!1!==await this.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&this._callPluginEvent("onMouseLeave",{frameContext:t,event:e})}const{_w:be,isOSX_IOS:ye}=dt,ve=new RegExp(ut.zeroWidthSpace+"+",""),Ce={ctrl:!1,alt:!1};let we=null;function xe(t){const e=t.lastChild,i=t.nextElementSibling;if(!i)return e;if(gt.check.isZeroWidth(i))return gt.utils.removeItem(i),e;const s=i.childNodes;for(;s[0];)t.appendChild(s[0]);return gt.utils.removeItem(i),e}function ke(t){const e=t.childNodes,i=t.previousElementSibling;let s=e[0],n=0;if(!i)return{focusNode:s,focusOffset:n};if(gt.check.isZeroWidth(i))return gt.utils.removeItem(i),{focusNode:s,focusOffset:n};if(e.length>1||e[0]?.textContent.length>0)for(;e[0];)i.appendChild(e[0]);else s=i.lastChild,n=s.textContent.length;return gt.utils.removeItem(t),{focusNode:s,focusOffset:n}}async function Se(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const i=this.selection.getRange(),s=this.selection.getNode();if(!this.format.getLine(s,null)&&i.collapsed&&!this.component.is(s)&&!gt.check.isList(s)){const t=this.format.getBlock(s,null);this._setDefaultLine(this.format.isBlock(t)?"DIV":this.options.get("defaultLine"))}this.selection._init();const n=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(!this.char.test(n,!0))return e.preventDefault(),e.stopPropagation(),!1;!1!==await this.triggerEvent("onInput",{frameContext:t,event:e,data:n})&&!1!==this._callPluginEvent("onInput",{frameContext:t,event:e,data:n})&&this.history.push(!0)}async function Ee(t,e){if(this.editor.selectMenuOn||!e.isTrusted)return;let i=this.selection.getNode();if(gt.check.isInputElement(i))return;if(this.menu.currentDropdownName)return;const s=e.code,n=ft.isShift(e),o=Ce.ctrl=ft.isCtrl(e),l=Ce.alt=ft.isAlt(e);if(this.isComposing=ft.isComposing(e),!o&&t.get("isReadOnly")&&!ft.isDirectionKey(s))return e.preventDefault(),!1;if(this.menu.dropdownOff(),this.editor.isBalloon?this._hideToolbar():this.editor.isSubBalloon&&this._hideToolbar_sub(),!1===await this.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;ft.isEnter(s)&&this.format.isLine(this.selection.getRange()?.startContainer)&&(this.selection._resetRangeToTextNode(),i=this.selection.getNode());const r=this.selection.getRange(),a=!r.collapsed||r.startContainer!==r.endContainer;let h=this.format.getLine(i,null)||i,c=this.format.getBlock(h,null);if(o&&!ft.isNonTextKey(s)&&this.shortcuts.command(e,o,n,s,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!ft.isNonTextKey(s)&&this.format.isLine(h)&&r.collapsed&>.check.isEdgePoint(r.startContainer,0,"front")){const t=r.startContainer.substringData?.(0,r.startOffset);if(t&&this.shortcuts.command(e,!1,n,s,t,!0,h,r))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);if(!1===this._callPluginEvent("onKeyDown",{frameContext:t,event:e,range:r,line:h}))return;switch(s){case"Backspace":{if(this.component.deselect(),we=this.__cacheStyleNodes,a&&this._hardDelete()){e.preventDefault(),e.stopPropagation();break}if(!this.format.isLine(h)&&!t.get("wysiwyg").firstElementChild&&!this.component.is(i)&&null!==this._setDefaultLine(this.options.get("defaultLine")))return e.preventDefault(),e.stopPropagation(),!1;if(this.format.isLine(h)&&(!r.collapsed||gt.check.isEdgePoint(r.endContainer,r.endOffset,"front"))&&!r.endContainer.previousSibling&&this.format.isLine(h.previousElementSibling)){let t;if(e.preventDefault(),e.stopPropagation(),!r.collapsed){const e=this.html.remove();if(e.commonCon!==e.container&&h.parentElement)if(h.contains(r.startContainer))t=xe(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length);else{const t=ke(h);this.selection.setRange(t.focusNode,t.focusOffset,t.focusNode,t.focusOffset)}return void this.history.push(!0)}const i=ke(h);return this.selection.setRange(i.focusNode,i.focusOffset,i.focusNode,i.focusOffset),void this.history.push(!0)}if(!a&&!h.previousElementSibling&&0===r.startOffset&&!i.previousSibling&&!gt.check.isListCell(h)&&this.format.isLine(h)&&(!this.format.isBrLine(h)||this.format.isClosureBrLine(h))){if(this.format.isClosureBlock(h.parentNode))return e.preventDefault(),e.stopPropagation(),!1;if(gt.check.isWysiwygFrame(h.parentNode)&&h.childNodes.length<=1&&(!h.firstChild||gt.check.isZeroWidth(h.textContent))){if(e.preventDefault(),e.stopPropagation(),h.nodeName.toUpperCase()===this.options.get("defaultLine").toUpperCase()){h.innerHTML="<br>";const t=h.attributes;for(;t[0];)h.removeAttribute(t[0].name)}else h.parentNode.replaceChild(gt.utils.createElement(this.options.get("defaultLine"),null,"<br>"),h);return this.editor._nativeFocus(),!1}}const s=r.startContainer;if(h&&!h.previousElementSibling&&0===r.startOffset&&3===s.nodeType&>.check.isZeroWidth(s)){let t=s.parentNode.previousSibling;const e=s.parentNode.nextSibling;t||(e?t=e:(t=gt.utils.createElement("BR"),h.appendChild(t)));let i=s;for(;h.contains(i)&&!i.previousSibling;)i=i.parentNode;if(!h.contains(i)){s.textContent="",this.nodeTransform.removeAllParents(s,null,h);break}}if(!a&&h&&(0===r.startOffset||i===h)){const t=i===h?this._isUneditableNode(r,!0):gt.check.isEdgePoint(r.startContainer,r.startOffset)?gt.query.getPreviousDeepestNode(r.startContainer):null;if(this.component.is(t)){const i=this.component.get(t);if(i){e.preventDefault(),e.stopPropagation(),!1===this.component.select(i.target,i.pluginName)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!0)){e.preventDefault(),e.stopPropagation();break}!a&&this.format.isEdgeLine(r.startContainer,r.startOffset,"front")&&this.format.isLine(h.previousElementSibling)&&(this._formatAttrsTemp=h.previousElementSibling.attributes);const n=r.commonAncestorContainer;if(h=this.format.getLine(r.startContainer,null),c=this.format.getBlock(h,null),c&&h&&!gt.check.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){if(gt.check.isListCell(h)&>.check.isList(c)&&(gt.check.isListCell(c.parentElement)||h.previousElementSibling)&&(i===h||3===i.nodeType&&(!i.previousSibling||gt.check.isList(i.previousSibling)))&&(this.format.getLine(r.startContainer,null)!==this.format.getLine(r.endContainer,null)?c.contains(r.startContainer):0===r.startOffset&&r.collapsed)){if(r.startContainer!==r.endContainer)e.preventDefault(),this.html.remove(),3===r.startContainer.nodeType&&this.selection.setRange(r.startContainer,r.startContainer.textContent.length,r.startContainer,r.startContainer.textContent.length),this.history.push(!0);else{let t=h.previousElementSibling||c.parentElement;if(gt.check.isListCell(t)){e.preventDefault();let i=t;if(!t.contains(h)&>.check.isListCell(i)&>.check.isList(i.lastElementChild)){for(i=i.lastElementChild.lastElementChild;gt.check.isListCell(i)&>.check.isList(i.lastElementChild);)i=i.lastElementChild&&i.lastElementChild.lastElementChild;t=i}let s=t===c.parentNode?c.previousSibling:t.lastChild;s||(s=gt.utils.createTextNode(ut.zeroWidthSpace),c.parentNode.insertBefore(s,c.parentNode.firstChild));const n=3===s.nodeType?s.textContent.length:1,o=h.childNodes;let l=s,r=o[0];for(;r=o[0];)t.insertBefore(r,l.nextSibling),l=r;gt.utils.removeItem(h),0===c.children.length&>.utils.removeItem(c),this.selection.setRange(s,n,s,n),this.history.push(!0)}}break}if(!a&&0===r.startOffset){let t=!0,i=n;for(;i&&i!==c&&!gt.check.isWysiwygFrame(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!gt.check.isZeroWidth(i.previousSibling.textContent.trim()))){t=!1;break}i=i.parentNode}if(t&&c.parentNode){e.preventDefault(),this.format.removeBlock(c,{selectedFormats:gt.check.isListCell(h)?[h]:null,newBlockElement:null,shouldDelete:!1,skipHistory:!1}),this.history.push(!0);break}}}if(!a&&h&&(0===r.startOffset||i===h&&h.childNodes[r.startOffset])){const t=i===h?h.childNodes[r.startOffset]:i,s=h.previousSibling,o=(3===n.nodeType||gt.check.isBreak(n))&&!n.previousSibling&&0===r.startOffset;if(t&&!t.previousSibling&&(n&&this.component.is(n.previousSibling)||o&&this.component.is(s))){const t=this.component.get(s);t?(e.preventDefault(),e.stopPropagation(),0===h.textContent.length&>.utils.removeItem(h),!1===this.component.select(t.target,t.pluginName)&&this.editor.blur()):this.component.is(s)&&(e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(s));break}if(t&>.check.isNonEditable(t.previousSibling)){e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(t.previousSibling);break}}break}case"Delete":if(this.component.deselect(),we=this.__cacheStyleNodes,a&&this._hardDelete()){e.preventDefault(),e.stopPropagation();break}if(!a&&this.format.isEdgeLine(r.endContainer,r.endOffset,"end")&&!h.nextSibling)return e.preventDefault(),void e.stopPropagation();if(this.format.isLine(h)&&(!r.collapsed||gt.check.isEdgePoint(r.startContainer,r.endOffset,"end"))&&!r.startContainer.nextSibling&&this.format.isLine(h.nextElementSibling)){let t;if(e.preventDefault(),e.stopPropagation(),!r.collapsed){const e=this.html.remove();if(e.commonCon!==e.container&&h.parentElement)if(h.contains(r.startContainer))t=xe(h),this.selection.setRange(t,t.textContent.length,t,t.textContent.length);else{const t=ke(h);this.selection.setRange(t.focusNode,t.focusOffset,t.focusNode,t.focusOffset)}return void this.history.push(!0)}return xe(h),void this.history.push(!0)}if(!a&&h&&(r.endOffset===r.endContainer.textContent.length||i===h)){const t=i===h?this._isUneditableNode(r,!1):gt.check.isEdgePoint(r.endContainer,r.endOffset)?gt.query.getNextDeepestNode(r.endContainer,null):null;if(this.component.is(t)){const i=this.component.get(t);if(i){e.preventDefault(),e.stopPropagation(),gt.check.isZeroWidth(h.textContent)&>.utils.removeItem(h),!1===this.component.select(i.target,i.pluginName)&&this.editor.blur();break}}}if(this._isUneditableNode(r,!1)){e.preventDefault(),e.stopPropagation();break}if((this.format.isLine(i)||null===i.nextSibling||gt.check.isZeroWidth(i.nextSibling)&&null===i.nextSibling.nextSibling)&&r.startOffset===i.textContent.length){const t=h.nextElementSibling;if(!t)break;if(this.component.is(t)){if(e.preventDefault(),gt.check.isZeroWidth(h)&&(gt.utils.removeItem(h),gt.check.isTable(t))){let e=gt.query.getEdgeChild(t,gt.check.isTableCell,!1);e=e.firstElementChild||e,this.selection.setRange(e,0,e,0);break}const i=this.component.get(t);i?(e.stopPropagation(),!1===this.component.select(i.target,i.pluginName)&&this.editor.blur()):this.component.is(t)&&(e.stopPropagation(),gt.utils.removeItem(t));break}}if(!a&&(gt.check.isEdgePoint(r.endContainer,r.endOffset)||i===h&&h.childNodes[r.startOffset])){const t=i===h&&h.childNodes[r.startOffset]||i;if(t&>.check.isNonEditable(t.nextSibling)){e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(t.nextSibling);break}if(this.component.is(t)){e.preventDefault(),e.stopPropagation(),gt.utils.removeItem(t);break}}if(!a&&this.format.isEdgeLine(r.endContainer,r.endOffset,"end")&&this.format.isLine(h.nextElementSibling)&&(this._formatAttrsTemp=h.attributes),h=this.format.getLine(r.startContainer,null),c=this.format.getBlock(h,null),gt.check.isListCell(h)&>.check.isList(c)&&(i===h||3===i.nodeType&&(!i.nextSibling||gt.check.isList(i.nextSibling))&&(this.format.getLine(r.startContainer,null)!==this.format.getLine(r.endContainer,null)?c.contains(r.endContainer):r.endOffset===i.textContent.length&&r.collapsed))){r.startContainer!==r.endContainer&&this.html.remove();const t=gt.utils.arrayFind(h.children,gt.check.isList)||h.nextElementSibling||c.parentElement.nextElementSibling;if(t&&(gt.check.isList(t)||gt.utils.arrayFind(t.children,gt.check.isList))){let i,s;if(e.preventDefault(),gt.check.isList(t)){const e=t.firstElementChild;for(s=e.childNodes,i=s[0];s[0];)h.insertBefore(s[0],t);gt.utils.removeItem(e)}else{for(i=t.firstChild,s=t.childNodes;s[0];)h.appendChild(s[0]);gt.utils.removeItem(t)}this.selection.setRange(i,0,i,0),this.history.push(!0)}break}break;case"Tab":{if(this.options.get("tabDisable"))break;if(e.preventDefault(),o||l||gt.check.isWysiwygFrame(i))break;const t=!r.collapsed||gt.check.isEdgePoint(r.startContainer,r.startOffset),s=this.format.getLines(null);i=this.selection.getNode();const a=[],c=[],d=gt.check.isListCell(s[0]),u=gt.check.isListCell(s[s.length-1]);let p={sc:r.startContainer,so:r.startOffset,ec:r.endContainer,eo:r.endOffset};for(let t,e=0,i=s.length;e<i;e++)if(t=s[e],gt.check.isListCell(t)){if(!t.previousElementSibling&&!n)continue;a.push(t)}else c.push(t);if(a.length>0&&t&&(p=this.format._applyNestedList(a,n)),c.length>0)if(n){const t=c.length-1;for(let e,i=0;i<=t;i++){e=c[i].childNodes;for(let t,i=0,s=e.length;i<s&&(t=e[i],t);i++)if(!gt.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?gt.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=gt.query.getEdgeChild(c[0],"text",!1),i=gt.query.getEdgeChild(c[t],"text",!0);!d&&e&&(p.sc=e,p.so=0),!u&&i&&(p.ec=i,p.eo=i.textContent.length)}else if(1===c.length){let t=this.status.tabSize+1;if(this.options.get("syncTabIndent")){const e=gt.query.findTextIndexOnLine(h,r.startContainer,r.startOffset,this.component.is.bind(this.component)),i=this.format.isLine(h.previousElementSibling)?gt.query.findTabEndIndex(h.previousElementSibling,e,2):0;i>e&&(t=i-e)}const e=gt.utils.createTextNode(new Array(t).join(" "));if(!this.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;d||(p.sc=e,p.so=e.length),u||(p.ec=e,p.eo=e.length)}else{const t=gt.utils.createTextNode(new Array(this.status.tabSize+1).join(" ")),e=c.length-1;for(let i,s=0;s<=e;s++)i=c[s].firstChild,i&&(gt.check.isBreak(i)?c[s].insertBefore(t.cloneNode(!1),i):i.textContent=t.textContent+i.textContent);const i=gt.query.getEdgeChild(c[0],"text",!1),s=gt.query.getEdgeChild(c[e],"text",!0);!d&&i&&(p.sc=i,p.so=0),!u&&s&&(p.ec=s,p.eo=s.textContent.length)}this.selection.setRange(p.sc,p.so,p.ec,p.eo),this.history.push(!1);break}case"Enter":{this.component.deselect();const s=this.format.getBrLine(i,null);if("byte-html"===this.editor.frameOptions.get("charCounter_type")){let t="";if(t=!n&&s||n?"<br>":"<"+h.nodeName+"><br></"+h.nodeName+">",!this.char.check(t))return e.preventDefault(),!1}if(!n){const n=!r.endContainer.nextSibling&&this.format.isEdgeLine(r.endContainer,r.endOffset,"end"),o=!r.startContainer.previousSibling&&this.format.isEdgeLine(r.startContainer,r.startOffset,"front");if(n&&(/^H[1-6]$/i.test(h.nodeName)||/^HR$/i.test(h.nodeName))){this.__enterPrevent(e);const t=this.format.addLine(h,this.options.get("defaultLine")).firstChild;if(gt.check.isBreak(t)){const e=gt.utils.createTextNode(ut.zeroWidthSpace);t.parentNode.insertBefore(e,t),this.selection.setRange(e,1,e,1)}else this.selection.setRange(t,0,t,0);this.__enterScrollTo(r);break}if(c&&h&&!gt.check.isTableCell(c)&&!/^FIGCAPTION$/i.test(c.nodeName)){const t=this.selection.getRange();if(gt.check.isEdgePoint(t.endContainer,t.endOffset)&>.check.isList(i.nextSibling)){this.__enterPrevent(e);const t=gt.utils.createElement("BR"),s=gt.utils.createElement("LI",null,t);h.parentNode.insertBefore(s,h.nextElementSibling),s.appendChild(i.nextSibling),this.selection.setRange(t,1,t,1),this.__enterScrollTo(r);break}if((3!==t.commonAncestorContainer.nodeType||!t.commonAncestorContainer.nextElementSibling)&>.check.isZeroWidth(h.innerText.trim())&&!gt.check.isListCell(h.nextElementSibling)){this.__enterPrevent(e);let t=null;if(gt.check.isListCell(c.parentElement)){const e=h.parentNode.parentElement;c=e.parentElement;const i=gt.utils.createElement("LI");i.innerHTML="<br>",gt.utils.copyTagAttributes(i,h,this.options.get("lineAttrReset")),t=i,c.insertBefore(t,e.nextElementSibling)}else{let e;e=gt.check.isTableCell(c.parentElement)?"DIV":gt.check.isList(c.parentElement)?"LI":this.format.isLine(c.nextElementSibling)?c.nextElementSibling.nodeName:this.format.isLine(c.previousElementSibling)?c.previousElementSibling.nodeName:this.options.get("defaultLine"),t=gt.utils.createElement(e);const i=this.format.removeBlock(c,{selectedFormats:[h],newBlockElement:null,shouldDelete:!0,skipHistory:!0});i.cc.insertBefore(t,i.ec)}t.innerHTML="<br>",this.nodeTransform.removeAllParents(h,null,null),this.selection.setRange(t,1,t,1);break}}if(s){this.__enterPrevent(e);const t=i===s,n=this.selection.get(),o=i.childNodes,l=n.focusOffset,a=i.previousElementSibling,h=i.nextSibling;if(!this.format.isClosureBrLine(s)&&o&&(t&&r.collapsed&&o.length-1<=l+1&>.check.isBreak(o[l])&&(!o[l+1]||(!o[l+2]||gt.check.isZeroWidth(o[l+2].textContent))&&3===o[l+1].nodeType&>.check.isZeroWidth(o[l+1].textContent))&&l>0&>.check.isBreak(o[l-1])||!t&>.check.isZeroWidth(i.textContent)&>.check.isBreak(a)&&(gt.check.isBreak(a.previousSibling)||!gt.check.isZeroWidth(a.previousSibling?.textContent))&&(!h||!gt.check.isBreak(h)&>.check.isZeroWidth(h.textContent)))){t?gt.utils.removeItem(o[l-1]):gt.utils.removeItem(i);const e=s.nextElementSibling,n=this.format.addLine(s,this.format.isLine(e)?e:null);gt.utils.copyFormatAttributes(n,s),this.selection.setRange(n,1,n,1),this.__enterScrollTo(r);break}if(t){this.html.insert(r.collapsed&>.check.isBreak(r.startContainer.childNodes[r.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let t=n.focusNode;const e=n.focusOffset;s===t&&(t=t.childNodes[e-l>1?e-1:e]),this.selection.setRange(t,1,t,1)}else{const t=n.focusNode.nextSibling,e=gt.utils.createElement("BR");this.html.insertNode(e,{afterNode:null,skipCharCount:!0});const i=e.previousSibling,s=e.nextSibling;gt.check.isBreak(t)||gt.check.isBreak(i)||s&&!gt.check.isZeroWidth(s)?this.selection.setRange(s,0,s,0):(e.parentNode.insertBefore(e.cloneNode(!1),e),this.selection.setRange(e,1,e,1))}this._onShortcutKey=!0,this.__enterScrollTo(r);break}if(r.collapsed&&(o||n)){this.__enterPrevent(e);const t=gt.utils.createElement("BR"),s=gt.utils.createElement(h.nodeName,null,t);gt.utils.copyTagAttributes(s,h,this.options.get("lineAttrReset"));let l=t;do{if(!gt.check.isBreak(i)&&1===i.nodeType){const t=i.cloneNode(!1);t.appendChild(l),l=t}i=i.parentElement}while(h!==i&&h.contains(i));if(s.appendChild(l),h.parentNode.insertBefore(s,o&&!n?h:h.nextElementSibling),n)this.selection.setRange(t,1,t,1);else{const t=h.firstChild||h;this.selection.setRange(t,0,t,0)}this.__enterScrollTo(r);break}if(h){let i;e.stopPropagation();let s=0;if(r.collapsed)i=gt.check.isZeroWidth(h)?this.format.addLine(h,h.cloneNode(!1)):this.nodeTransform.split(r.endContainer,r.endOffset,gt.query.getNodeDepth(h));else{const l=this.format.getLine(r.startContainer,null)!==this.format.getLine(r.endContainer,null),a=h.cloneNode(!1);a.innerHTML="<br>";const c=r.commonAncestorContainer,d=c===r.startContainer&&c===r.endContainer&>.check.isZeroWidth(c)?{container:c,offset:r.endOffset,prevContainer:c.previousElementSibling,commonCon:c}:this.html.remove();if(i=this.format.getLine(d.container,null),!i){gt.check.isWysiwygFrame(d.container)&&(this.__enterPrevent(e),t.get("wysiwyg").appendChild(a),i=a,gt.utils.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s)),this.__enterScrollTo(r);break}const u=this.format.getBlock(d.container);if(i=i.contains(u)?gt.query.getEdgeChild(u,this.format.getLine.bind(this.format),!1):i,l){if(n&&!o)i.parentNode.insertBefore(a,d.prevContainer&&d.container!==d.prevContainer?i:i.nextElementSibling),i=a,s=0;else if(s=d.offset,o){const t=i.parentNode.insertBefore(a,i);n&&(i=t,s=0)}}else n&&o?(i.parentNode.insertBefore(a,d.prevContainer&&d.container===d.prevContainer?i.nextElementSibling:i),i=a,s=0):n?(i=i.parentNode.insertBefore(a,i.nextElementSibling),i=a,s=0):i=this.nodeTransform.split(d.container,d.offset,gt.query.getNodeDepth(h))}this.__enterPrevent(e),gt.utils.copyTagAttributes(i,h,this.options.get("lineAttrReset")),this.selection.setRange(i,s,i,s),this.__enterScrollTo(r);break}}if(a){this.__enterScrollTo(r);break}c&>.query.getParentElement(c,"FIGCAPTION")&>.query.getParentElement(c,gt.check.isList)&&(this.__enterPrevent(e),h=this.format.addLine(h,null),this.selection.setRange(h,0,h,0),this.__enterScrollTo(r));break}}if(n&&(ye?l:o)&&ft.isSpace(s)){e.preventDefault(),e.stopPropagation();const t=this.html.insertNode(gt.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});if(t)return void this.selection.setRange(t,t.length,t,t.length)}if(!o&&!l&&!a&&!ft.isNonTextKey(s)&>.check.isBreak(r.commonAncestorContainer)){const t=gt.utils.createTextNode(ut.zeroWidthSpace);this.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.selection.setRange(t,1,t,1)}if(t.has("documentType-use-header")&&!r.collapsed&&!o&&!l&&!n&&!ft.isDirectionKey(s))return void be.setTimeout((()=>{t.get("documentType").reHeader()}),0);let d=null;switch(s){case"ArrowUp":this.component.is(h.previousElementSibling)&&(d=this.component.get(h.previousElementSibling));break;case"ArrowLeft":if(gt.check.isEdgePoint(i,r.startOffset,"front")){const t=i.previousElementSibling||gt.query.getPreviousDeepestNode(i);t?this.component.is(t)&&(d=this.component.get(t)):this.component.is(h.previousElementSibling)&&(d=this.component.get(h.previousElementSibling))}break;case"ArrowDown":this.component.is(h.nextElementSibling)&&(d=this.component.get(h.nextElementSibling));break;case"ArrowRight":if(gt.check.isEdgePoint(i,r.endOffset,"end")){const t=i.nextElementSibling||gt.query.getNextDeepestNode(i);t?this.component.is(t)&&(d=this.component.get(t)):this.component.is(h.nextElementSibling)&&(d=this.component.get(h.nextElementSibling))}}d&&!d.options?.isInputComponent&&(e.preventDefault(),!1===this.component.select(d.target,d.pluginName)&&this.editor.blur())}async function Te(t,e){if(this._onShortcutKey||this.menu.currentDropdownName)return;const i=e.code,s=ft.isCtrl(e),n=ft.isAlt(e);if(s&&(Ce.ctrl=!1),n&&(Ce.alt=!1),t.get("isReadOnly"))return;const o=this.selection.getRange();let l=this.selection.getNode();if((this.editor.isBalloon||this.editor.isSubBalloon)&&((this.editor.isBalloonAlways||this.editor.isSubBalloonAlways)&&!ft.isEsc(i)||!o.collapsed)){if(!this.editor.isBalloonAlways&&!this.editor.isSubBalloonAlways)return void(this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon());ft.isEsc(i)||this._showToolbarBalloonDelay()}if(ft.isBackspace(i)&>.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const s=gt.utils.createElement(this.format.isLine(this.status.currentNodes[0])&&!gt.check.isListCell(this.status.currentNodes[0])?this.status.currentNodes[0]:this.options.get("defaultLine"),null,"<br>");return l.appendChild(s),this.selection.setRange(s,0,s,0),this.applyTagEffect(),this.history.push(!1),void(t.has("documentType-use-header")&&ft.isDocumentTypeObserverKey(i)&&t.get("documentType").reHeader())}const r=this.format.getLine(l,null),a=this.format.getBlock(l,null),h=this._formatAttrsTemp;if(r&&h){for(let t=0,e=h.length;t<e;t++)ft.isEnter(i)&&/^id$/i.test(h[t].name)?r.removeAttribute("id"):r.setAttribute(h[t].name,h[t].value);this._formatAttrsTemp=null}r||!o.collapsed||this.component.is(l)||gt.check.isList(l)||null===this._setDefaultLine(this.format.isBlock(a)?"DIV":this.options.get("defaultLine"))||(l=this.selection.getNode());if(!Ce.ctrl&&!Ce.alt&&!ft.isNonTextKey(i)&&3===l.nodeType&&ut.zeroWidthRegExp.test(l.textContent)&&!(void 0!==e.isComposing?e.isComposing:this.isComposing)){let t=o.startOffset,e=o.endOffset;const i=(l.textContent.substring(0,e).match(ve)||"").length;t=o.startOffset-i,e=o.endOffset-i,l.textContent=l.textContent.replace(ut.zeroWidthRegExp,""),this.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(ft.isRemoveKey(i)&>.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling){const t=this.options.get("retainStyleMode");"none"!==t&&we?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=be.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=be.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,we)):(this.__retainTimer=null,this._retainStyleNodes(r,we)):this._clearRetainStyleNodes(r)}if(this.char.test("",!1),t.has("documentType-use-header"))if(ft.isDocumentTypeObserverKey(i)){t.get("documentType").reHeader();const e=gt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}else{const e=gt.query.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==await this.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==this._callPluginEvent("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&ft.isHistoryRelevantKey(i)&&this.history.push(!0)}function He(t,e){const i=e.clipboardData;return!i||this._dataTransferAction("paste",e,i,t)}async function Me(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCopy",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString()}async function Le(t,e){const i=e.clipboardData;if(!1===await this.triggerEvent("onCut",{frameContext:t,event:e,clipboardData:i}))return e.preventDefault(),e.stopPropagation(),!1;const s=t.get("_ww").getSelection();this.__secopy=s.toString(),this._w.setTimeout((()=>{this.history.push(!1)}),0)}function Ne(t,e,i,s,n){const{sc:o,so:l,ec:r,eo:a}=this.selection.getDragEventLocationRange(n);if(!o)return;n.preventDefault();const h=t.get("_wd").createRange();h.setStart(o,l),h.setEnd(r,a);const c={y:0,x:0};if(i){const t=this.offset.getGlobal(i),e=s?this.context.get("toolbar.main").offsetHeight:0;c.y=t.top+e-this._w.scrollY,c.x=t.left-this._w.scrollX}const d=h.getBoundingClientRect();if(d.height>0){const i=t.get("wysiwygFrame");let s=0,n=0;/^iframe$/i.test(i.nodeName)&&(s=i.offsetLeft,n=i.offsetTop),e.style.left=`${d.right+this._w.scrollX+c.x+s}px`,e.style.top=`${d.top+this._w.scrollY+c.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block"}else e.style.display="none"}function Ae(t){t.style.display="none"}function Be(t,e,i){try{if(t.get("isReadOnly"))return i.preventDefault(),i.stopPropagation(),!1;const e=i.dataTransfer;if(!e)return!0;const{sc:s,so:n,ec:o,eo:l}=this.selection.getDragEventLocationRange(i);if(!s)return;if(gt.query.getParentElement(s,".se-disable-pointer"))return void i.preventDefault();if(oe.get("__dragContainer")){if(i.preventDefault(),oe.get("__dragContainer").contains(i.target))return void this.component.deselect();const e=oe.get("__dragContainer");return this.component.deselect(),this.selection.setRange(s,n,o,l),this.html.insertNode(e,{afterNode:null,skipCharCount:!0}),void(t.has("documentType-use-page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0)))}return this.html.remove(),this.selection.setRange(s,n,o,l),this._dataTransferAction("drop",i,e,t)}finally{e.style.display="none"}}const{_w:Ie,ON_OVER_COMPONENT:Ve,isMobile:Oe}=dt;function Re(t){ne.call(this,t),this.isComposing=!1,this._events=[],this._onButtonsCheck=new RegExp(`^(${Object.keys(t.options.get("_defaultStyleTagMap")).join("|")})$`,"i"),this._onShortcutKey=!1,this._balloonDelay=null,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__resize_editor=null,this.__close_move=null,this.__geckoActiveEvent=null,this.__scrollparents=[],this.__cacheStyleNodes=[],this.__selectionSyncEvent=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=this.carrierWrapper.querySelector(".__se__focus__temp__"),this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null}function ze(t,e,i){this._moveContainer(e),this._scrollContainer(),this._callPluginEvent("onScroll",{frameContext:t,event:i}),t.has("documentType-use-page")&&t.get("documentType").scrollPage(),this.triggerEvent("onScroll",{frameContext:t,event:i})}function $e(t,e){if(this.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),!1;this.status.hasFocus=!0,this.component.__prevent=!1,this.triggerEvent("onNativeFocus",{frameContext:t,event:e});const i=t.get("key");if(this._inputFocus)return void(this.editor.isInline&&this._w.setTimeout((()=>{this.toolbar._showInline()}),0));if(this.status.rootKey===i&&this.editor._preventBlur||this.editor._preventFocus)return;this.editor._preventFocus=!0;const s=this.editor.status.onSelected||this.editor.opendModal;this.ui._offCurrentController(),gt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),gt.utils.setDisabled(this.editor._codeViewDisabledButtons,!1),this.editor.changeFrameContext(i),this.history.resetButtons(i,null),s||this.applyTagEffect(),this._w.setTimeout((()=>{this.__postFocusEvent(t,e)}),0)}function Fe(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.status.hasFocus=!1,this.editor.effectNode=null,this.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this._inputFocus||this.editor._preventBlur||(this.editor._preventFocus=!1,this._setKeyEffect([]),this.status.currentNodes=[],this.status.currentNodesMap=[],this.editor.applyFrameRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.history.check(t.get("key"),this.status._range),this.__postBlurEvent(t,e)))}function Pe(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.ui.enableBackWrapper("ns-resize"),this.__resize_editor=this.addGlobalEvent("mousemove",De.bind(this)),this.__close_move=this.addGlobalEvent("mouseup",qe.bind(this))}function De(t){const e=this.editor.frameContext,i=e.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),s=i<e.get("_minHeight")?e.get("_minHeight"):i;e.get("wysiwygFrame").style.height=e.get("code").style.height=s+"px",this._resizeClientY=t.clientY,dt.isResizeObserverSupported||this.editor.__callResizeFunction(e,s,null)}function qe(){this.ui.disableBackWrapper(),this.__resize_editor&&(this.__resize_editor=this.removeGlobalEvent(this.__resize_editor)),this.__close_move&&(this.__close_move=this.removeGlobalEvent(this.__close_move))}function We(t,e){e.preventDefault();const i=this._lineBreakComp;if(!i)return;const s=gt.check.isListCell(i.parentElement),n=gt.utils.createElement(s?"BR":gt.check.isTableCell(i.parentElement)?"DIV":this.options.get("defaultLine"));if(s||(n.innerHTML="<br>"),"byte-html"!==this.editor.frameOptions.get("charCounter_type")||this.char.check(n.outerHTML)){i.parentNode.insertBefore(n,"t"===t?i:i.nextSibling),this.component.deselect();try{const t=s?n:n.firstChild;this.selection.setRange(t,1,t,1),this.history.push(!1)}catch(t){console.warn("[SUNEDITOR.lineBreaker.error]",t)}}}function Ue(){Oe?this._scrollContainer():this.ui._offCurrentController(),this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this._resetFrameStatus()}function Ge(){this.options.get("toolbar_sticky")>-1&&this.toolbar._resetSticky(),this.editor.isBalloon&&"block"===this.context.get("toolbar.main").style.display?this.toolbar._setBalloonOffset("top"===this.toolbar._balloonOffset.position):this.editor.isSubBalloon&&"block"===this.context.get("toolbar.sub.main").style.display&&this.subToolbar._setBalloonOffset("top"===this.subToolbar._balloonOffset.position),this._scrollContainer(),this.editor.frameContext.has("documentType-use-page")&&this.editor.frameContext.get("documentType").scrollWindow()}function Ze(){this.options.get("toolbar_sticky")>-1&&(this.toolbar._resetSticky(),this.editor.menu._restoreMenuPosition())}function Ye(t){if(this.editor._preventSelection)return;let e=t.getSelection().anchorNode;this.editor.applyFrameRoots((t=>{if(e&&t.get("wysiwyg").contains(e)){if(t.get("isReadOnly")||t.get("isDisabled"))return;if(e=null,this.selection._init(),this.applyTagEffect(),t.has("documentType-use-header")){const e=gt.query.getParentElement(this.selection.selectionNode,this.format.isLine.bind(this.format));t.get("documentType").on(e)}}}))}function Xe(){this._scrollContainer()}function je(t){this.editor.changeFrameContext(t.get("key")),gt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),gt.utils.setDisabled(this.editor._codeViewDisabledButtons,!0)}Re.prototype={addEvent(t,e,i,s){if(!t)return null;if((!mt.is(t.length)||t.nodeName||!Array.isArray(t)&&t.length<1)&&(t=[t]),0===t.length)return null;const n=t.length;for(let o=0;o<n;o++)t[o].addEventListener(e,i,s),this._events.push({target:t[o],type:e,listener:i,useCapture:s});return{target:n>1?t:t[0],type:e,listener:i,useCapture:s}},removeEvent(t){if(!t)return;let e=t.target;const i=t.type,s=t.listener,n=t.useCapture;if(e&&((!mt.is(e.length)||e.nodeName||!Array.isArray(e)&&e.length<1)&&(e=[e]),0!==e.length)){for(let t=0,o=e.length;t<o;t++)e[t].removeEventListener(i,s,n);return null}},addGlobalEvent(t,e,i){return this.editor.frameOptions.get("iframe")&&this.editor.frameContext.get("_ww").addEventListener(t,e,i),this._w.addEventListener(t,e,i),{type:t,listener:e,useCapture:i}},removeGlobalEvent(t,e,i){if(t)return"object"==typeof t&&(e=t.listener,i=t.useCapture,t=t.type),this.editor.frameOptions.get("iframe")&&this.editor.frameContext.get("_ww").removeEventListener(t,e,i),this._w.removeEventListener(t,e,i),null},applyTagEffect(t){if((t=t||this.selection.getNode())===this.editor.effectNode)return;this.editor.effectNode=t;const e=this.options.get("_rtl")?"marginRight":"marginLeft",i=this.plugins,s=this.editor.commandTargets,n=this._onButtonsCheck,o=this.options.get("_styleCommandMap"),l=[],r=[],a=this.options.get("_textStyleTags"),h=[],c=[],d=this.editor.activeCommands,u=d.length;let p="";if(this.component.is(t)&&!this.component.__selectionSelected){const e=this.component.get(t);if(!e)return;return void this.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.editor.frameContext,m=!g.get("isReadOnly");for(let g=t;!gt.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!gt.check.isBreak(g)){if(this._isNonFocusNode(g))return void this.editor.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.format.isLine(p)&&h.push(g),m)for(let t,e=0;e<u;e++)t=d[e],!l.includes(t)&&!c.includes(t)&&s.get(t)&&s.get(t).filter((e=>{const s=i[t]?.active(g,e);return void 0===s&&c.push(t),s})).length>0&&l.push(t);if(this.format.isLine(g)){if(!l.includes("outdent")&&s.has("outdent")&&(gt.check.isListCell(g)||g.style[e]&&mt.get(g.style[e],0)>0)&&s.get("outdent").filter((t=>!gt.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&s.has("indent")){const t=gt.check.isListCell(g)&&!g.previousElementSibling;s.get("indent").filter((e=>!gt.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),gt.utils.addClass(s.get(p),"active"))}return this._setKeyEffect(l),this.__cacheStyleNodes=h.reverse(),this.status.currentNodes=r.reverse(),this.status.currentNodesMap=l,this.editor.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.options.get("_rtl")?this.status.currentNodes.reverse().join(" < "):this.status.currentNodes.join(" > ")),t},_injectActiveEvent(t){gt.utils.addClass(t,"__se__active"),this.__geckoActiveEvent=this.addGlobalEvent("mouseup",(()=>{gt.utils.removeClass(t,"__se__active"),this.__geckoActiveEvent=this.removeGlobalEvent(this.__geckoActiveEvent)}))},_setKeyEffect(t){const e=this.editor.activeCommands,i=this.editor.commandTargets,s=this.plugins;for(let n,o,l,r=0,a=e.length;r<a;r++)if(n=e[r],!t.includes(n)&&(o=i.get(n))){l=s[n];for(let t,e=0,i=o.length;e<i;e++)t=o[e],t&&(l?l.active(null,t):/^outdent$/i.test(n)?gt.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?gt.check.isImportantDisabled(t)||(t.disabled=!1):gt.utils.removeClass(t,"active"))}},_showToolbarBalloonDelay(){this._balloonDelay&&Ie.clearTimeout(this._balloonDelay),this._balloonDelay=Ie.setTimeout((()=>{Ie.clearTimeout(this._balloonDelay),this._balloonDelay=null,this.editor.isSubBalloon?this.subToolbar._showBalloon():this.toolbar._showBalloon()}),250)},_toggleToolbarBalloon(){this.selection._init();const t=this.selection.getRange(),e=this.options.has("_subMode");!(e?this.editor.isSubBalloonAlways:this.editor.isBalloonAlways)&&t.collapsed?e?this._hideToolbar_sub():this._hideToolbar():e?this.subToolbar._showBalloon(t):this.toolbar._showBalloon(t)},_hideToolbar(){this.editor._notHideToolbar||this.editor.frameContext.get("isFullScreen")||this.toolbar.hide()},_hideToolbar_sub(){this.subToolbar&&!this.editor._notHideToolbar&&this.subToolbar.hide()},_isNonFocusNode:t=>gt.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus"),_isUneditableNode(t,e){const i=e?t.startContainer:t.endContainer,s=e?t.startOffset:t.endOffset,n=e?"previousSibling":"nextSibling";let o;return 1===i.nodeType?(o=this._isUneditableNode_getSibling(i.childNodes[s],n,i),o&&1===o.nodeType&&"false"===o.getAttribute("contenteditable")?o:null):(o=this._isUneditableNode_getSibling(i,n,i),gt.check.isEdgePoint(i,s,e?"front":"end")&&o&&1===o.nodeType&&"false"===o.getAttribute("contenteditable")?o:null)},_isUneditableNode_getSibling(t,e,i){if(!t)return null;let s=t[e];if(!s){if(s=this.format.getLine(i),s=s?s[e]:null,!s||this.component.is(s))return null;s="previousSibling"===e?s.firstChild:s.lastChild}return s},_hardDelete(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=this.format.getBlock(e),n=this.format.getBlock(i),o=gt.check.isTableCell(s),l=gt.check.isTableCell(n);if((o&&!s.previousElementSibling&&!s.parentElement.previousElementSibling||l&&!n.nextElementSibling&&!n.parentElement.nextElementSibling)&&s!==n){const e=gt.query.getParentElement(t.commonAncestorContainer,gt.check.isFigure)?.parentElement||t.commonAncestorContainer;if(o){if(l)return gt.utils.removeItem(gt.query.getParentElement(s,(t=>e===t.parentNode))),this.editor._nativeFocus(),!0;gt.utils.removeItem(gt.query.getParentElement(s,(t=>e===t.parentNode)))}else gt.utils.removeItem(gt.query.getParentElement(n,(t=>e===t.parentNode)))}const r=1===e.nodeType?gt.query.getParentElement(e,".se-component"):null,a=1===i.nodeType?gt.query.getParentElement(i,".se-component"):null;return r&>.utils.removeItem(r),a&>.utils.removeItem(a),!1},_setDefaultLine(t){if(!this.options.get("__lineFormatFilter"))return null;if(this.editor._fileManager.pluginRegExp.test(this.editor.currentControllerName))return;const e=this.selection.getRange(),i=e.commonAncestorContainer,s=e.startContainer,n=this.format.getBlock(i,null);let o,l,r;if(n)return r=gt.utils.createElement(t||this.options.get("defaultLine")),r.innerHTML=n.innerHTML,0===r.childNodes.length&&(r.innerHTML=ut.zeroWidthSpace),n.innerHTML=r.outerHTML,r=n.firstChild,o=gt.query.getEdgeChildNodes(r,null).sc,o||(o=gt.utils.createTextNode(ut.zeroWidthSpace),r.insertBefore(o,r.firstChild)),l=o.textContent.length,void this.selection.setRange(o,l,o,l);if(3===i.nodeType&&this.component.is(i.parentElement)){const t=this.component.get(i.parentElement);if(!t)return;const e=t.container;if(i.parentElement===e){const t=i.nextElementSibling?e:e.nextElementSibling,s=gt.utils.createElement(this.options.get("defaultLine"),null,i);return e.parentElement.insertBefore(s,t),void this.editor.focusEdge(s)}return this.component.select(t.target,t.pluginName),null}if(1===i.nodeType&&"true"===i.getAttribute("data-se-embed")){let t=i.nextElementSibling;return this.format.isLine(t)||(t=this.format.addLine(i,this.options.get("defaultLine"))),void this.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.format.isBlock(s)&&!gt.check.isWysiwygFrame(s)||!this.component.is(s.children[e.startOffset])&&!this.component.is(s.children[e.startOffset-1])){if(gt.query.getParentElement(i,gt.check.isExcludeFormat))return null;if(this.format.isBlock(i)&&i.childNodes.length<=1){let t=null;return 1===i.childNodes.length&>.check.isBreak(i.firstChild)?t=i.firstChild:(t=gt.utils.createTextNode(ut.zeroWidthSpace),i.appendChild(t)),void this.selection.setRange(t,1,t,1)}try{if(3===i.nodeType&&(r=gt.utils.createElement(t||this.options.get("defaultLine")),i.parentNode.insertBefore(r,i),r.appendChild(i)),gt.check.isBreak(r.nextSibling)&>.utils.removeItem(r.nextSibling),gt.check.isBreak(r.previousSibling)&>.utils.removeItem(r.previousSibling),gt.check.isBreak(o)){const t=gt.utils.createTextNode(ut.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}}catch(e){return this.editor.execCommand("formatBlock",!1,t||this.options.get("defaultLine")),this.selection.removeRange(),this.selection._init(),void(this.editor.effectNode=null)}if(r&&(gt.check.isBreak(r.nextSibling)&>.utils.removeItem(r.nextSibling),gt.check.isBreak(r.previousSibling)&>.utils.removeItem(r.previousSibling),gt.check.isBreak(o))){const t=gt.utils.createTextNode(ut.zeroWidthSpace);o.parentNode.insertBefore(t,o),o=t}this.editor.effectNode=null,s?this.selection.setRange(s,1,s,1):this.editor._nativeFocus()}},async _dataTransferAction(t,e,i,s){try{return this.ui.showLoading(),await this._setClipboardData(t,e,i,s),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.ui.hideLoading()}},async _setClipboardData(t,e,i,s){e.preventDefault(),e.stopPropagation();let n=i.getData("text/plain"),o=i.getData("text/html");const l=!o,r=this.__secopy===n,a=/class=["']*Mso(Normal|List)/i.test(o)||/content=["']*Word.Document/i.test(o)||/content=["']*OneNote.File/i.test(o)||/content=["']*Excel.Sheet/i.test(o),h=r?"SE":a?"MS":"";if(l?o=pt.htmlToEntity(n).replace(/\n/g,"<br>"):(o=o.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),a&&(o=o.replace(/\n/g," "),n=n.replace(/\n/g," "))),!r){if(this.options.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");gt.query.getListChildNodes(t.body,pt.textToAnchor),o=t.body.innerHTML}}l||(o=this.html.clean(o,{forceFormat:!1,whitelist:null,blacklist:null}));const c=this.char.test("byte-html"===this.editor.frameOptions.get("charCounter_type")?o:n,!1);if("paste"===t){const t=await this.triggerEvent("onPaste",{frameContext:s,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}if("drop"===t){const t=await this.triggerEvent("onDrop",{frameContext:s,event:e,data:o,maxCharCount:c,from:h});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}const d=i.files;if(d.length>0&&!a){for(let t=0,i=d.length;t<i;t++)this._callPluginEvent("onFilePasteAndDrop",{frameContext:s,event:e,file:d[t]});return!1}if(!c)return!1;if(o){const t=(new DOMParser).parseFromString(o,"text/html");return!0!==this._callPluginEvent("onPaste",{frameContext:s,event:e,data:o,doc:t})&&this.html.insert(o,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),s.has("documentType-use-header")&&s.get("documentType").reHeader(),!1}},_addCommonEvents(){const t=re.bind(this),e=he.bind(this);this.addEvent(this.context.get("menuTray"),"mousedown",t,!1),this.addEvent(this.context.get("menuTray"),"click",ae.bind(this),!0),this.addEvent(this.context.get("toolbar.main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar.main"),"click",e,!1),this.options.has("_subMode")&&(this.addEvent(this.context.get("toolbar.sub.main"),"mousedown",t,!1),this.addEvent(this.context.get("toolbar.sub.main"),"click",e,!1)),this.toolbar._setResponsive(),dt.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{Ie.setTimeout((()=>{this.toolbar.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{Ie.setTimeout((()=>{t.forEach((t=>{this.editor.__callResizeFunction(this.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)}))}),0)}))),this.options.get("closeModalOutsideClick")&&this.addEvent(this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.ui._offCurrentModal()}),!1),this.addEvent(Ie,"resize",Ue.bind(this),!1),this.addEvent(Ie,"scroll",Ge.bind(this),!1),dt.isMobile&&(this.addEvent(Ie.visualViewport,"resize",Ze.bind(this),!1),this.addEvent(Ie.visualViewport,"scroll",Ze.bind(this),!1))},_addFrameEvents(t){const e=t.get("options").get("iframe"),i=e?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",i);const s=t.get("code"),n=this.editor.carrierWrapper.querySelector(".se-drag-cursor"),o=fe.bind(this,t);this.addEvent(i,"mousemove",o,!1),this.addEvent(i,"mouseleave",_e.bind(this,t),!1),this.addEvent(i,"mousedown",pe.bind(this,t),!1),this.addEvent(i,"mouseup",ge.bind(this,t),!1),this.addEvent(i,"click",me.bind(this,t),!1),this.addEvent(i,"input",Se.bind(this,t),!1),this.addEvent(i,"keydown",Ee.bind(this,t),!1),this.addEvent(i,"keyup",Te.bind(this,t),!1),this.addEvent(i,"paste",He.bind(this,t),!1),this.addEvent(i,"copy",Me.bind(this,t),!1),this.addEvent(i,"cut",Le.bind(this,t),!1),this.addEvent(i,"dragover",Ne.bind(this,t,n,e?this.editor.frameContext.get("topArea"):null,!this.options.get("toolbar_container")&&!this.editor.isBalloon&&!this.editor.isInline),!1),this.addEvent(i,"dragend",Ae.bind(this,n),!1),this.addEvent(i,"drop",Be.bind(this,t,n),!1),this.addEvent(i,"scroll",ze.bind(this,t,i),{passive:!0,capture:!1}),this.addEvent(i,"focus",$e.bind(this,t),!1),this.addEvent(i,"blur",Fe.bind(this,t),!1),this.addEvent(s,"mousedown",je.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");this.addEvent(l,"wheel",(t=>{t.preventDefault(),this.component.deselect()}),!1);const r=Oe?"touchstart":"mousedown";if(this.addEvent(t.get("lineBreaker_t"),r,We.bind(this,"t"),!1),this.addEvent(t.get("lineBreaker_b"),r,We.bind(this,"b"),!1),Oe&&this.addEvent(i,"touchstart",o,{passive:!0,capture:!1}),!this.options.get("hasCodeMirror")){const e=t.get("codeNumbers"),i=this.viewer._codeViewAutoHeight.bind(this.viewer,t.get("code"),e,"auto"===this.editor.frameOptions.get("height"));this.addEvent(s,"keydown",i,!1),this.addEvent(s,"keyup",i,!1),this.addEvent(s,"paste",i,!1),e&&this.addEvent(s,"scroll",this.viewer._scrollLineNumbers.bind(s,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const a=Xe.bind(this);let h=t.get("originElement");for(;h=gt.query.getScrollParent(h.parentElement);)this.__scrollparents.push(h),this.addEvent(h,"scroll",a,!1);this.addEvent(this.__focusTemp,"focus",(t=>t.preventDefault()),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.addEvent(this.__eventDoc,"selectionchange",Ye.bind(this,this.__eventDoc),!1))},__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.addEvent(t.get("statusbar"),"mousedown",Pe.bind(this),!1)):gt.utils.addClass(t.get("statusbar"),"se-resizing-none")},_removeAllEvents(){for(let t,e=0,i=this._events.length;e<i;e++)t=this._events[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this._events=[],this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null)},_moveContainer(t){const e=t.scrollTop||0,i=t.scrollLeft||0;if(this.editor.isBalloon?(this.context.get("toolbar.main").style.top=this.toolbar._balloonOffset.top-e+"px",this.context.get("toolbar.main").style.left=this.toolbar._balloonOffset.left-i+"px"):this.editor.isSubBalloon&&(this.context.get("toolbar.sub.main").style.top=this.subToolbar._balloonOffset.top-e+"px",this.context.get("toolbar.sub.main").style.left=this.subToolbar._balloonOffset.left-i+"px"),this.editor._controllerTargetContext!==this.editor.frameContext.get("topArea")&&this.ui._offCurrentController(),this.editor._lineBreaker_t){const t=this.editor._lineBreaker_t.style;if("none"!==t.display){const s=(this.editor._lineBreaker_t.getAttribute("data-offset")||",").split(",");t.top=mt.get(t.top,0)-(e-mt.get(s[0],0))+"px",t.left=mt.get(t.left,0)-(i-mt.get(s[1],0))+"px",this.editor._lineBreaker_t.setAttribute("data-offset",e+","+i)}}if(this.editor._lineBreaker_b){const t=this.editor._lineBreaker_b.style;if("none"!==t.display){const s=(this.editor._lineBreaker_b.getAttribute("data-offset")||",").split(",");t.top=mt.get(t.top,0)-(e-mt.get(s[0],0))+"px",t[s[1]]=mt.get(t[s[1]],0)-(i-mt.get(s[2],0))+"px",this.editor._lineBreaker_b.setAttribute("data-offset",e+","+s[1]+","+i)}}const s=this.editor.opendControllers;for(let t=0;t<s.length;t++)s[t].notInCarrier&&(s[t].form.style.top=s[t].inst.__offset.top-e+"px",s[t].form.style.left=s[t].inst.__offset.left-i+"px")},_scrollContainer(){const t=this.editor.opendControllers;t.length&&this.__rePositionController(t)},__rePositionController(t){oe.get("__dragMove")&&oe.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?.show()},_resetFrameStatus(){dt.isResizeObserverSupported||(this.toolbar.resetResponsiveToolbar(),this.options.get("_subMode")&&this.subToolbar.resetResponsiveToolbar());const t=this.context.get("toolbar.main"),e="none"===t.style.display||this.editor.isInline&&!this.toolbar._inlineToolbarAttr.isShow;if(0===t.offsetWidth&&!e)return;const i=this.editor.opendBrowser;if(i&&"block"===i.area.style.display&&(i.body.style.maxHeight=gt.utils.getClientSize().h-i.header.offsetHeight-50+"px"),this.menu.currentDropdownActiveButton&&this.menu.currentDropdown&&this.menu._setMenuPosition(this.menu.currentDropdownActiveButton,this.menu.currentDropdown),this.viewer._resetFullScreenHeight())return;const s=this.editor.frameContext;s.get("isCodeView")&&this.editor.isInline?this.toolbar._showInline():(this.editor._iframeAutoHeight(s),this.toolbar._sticky&&(this.context.get("toolbar.main").style.width=s.get("topArea").offsetWidth-2+"px",this.toolbar._resetSticky()))},_setSelectionSync(){this.removeGlobalEvent(this.__selectionSyncEvent),this.__selectionSyncEvent=this.addGlobalEvent("mouseup",(()=>{this.selection._init(),this.removeGlobalEvent(this.__selectionSyncEvent)}))},_retainStyleNodes(t,e){let i=e[0].cloneNode(!1);for(let t,s=1,n=e.length;s<n;s++)t=e[s].cloneNode(!1),i.appendChild(t),i=t;const{parent:s,inner:n}=this.nodeTransform.createNestedNode(e,null),o=gt.utils.createTextNode(ut.zeroWidthSpace);n.appendChild(o),t.innerHTML="",t.appendChild(s),this.selection.setRange(o,1,o,1)},_clearRetainStyleNodes(t){t.innerHTML="<br>",this.selection.setRange(t,0,t,0)},_callPluginEvent(t,e){const i=this.editor._onPluginEvents.get(t);for(let t,s=0;s<i.length;s++)if(t=i[s](e),"boolean"==typeof t)return t},_overComponentSelect(t){const e=gt.query.getParentElement(t,gt.check.isFigure);let i=this.component.get(t);i||e?(i||(i=this.component.get(e)),i&&!gt.utils.hasClass(i.container,"se-component-selected")&&(this.ui._offCurrentController(),oe.set("__overInfo",Ve),this.component.select(i.target,i.pluginName))):null===oe.get("__overInfo")||gt.utils.hasClass(t,"se-drag-handle")||(this.component.__deselect(),oe.set("__overInfo",null))},__removeInput(){this._inputFocus=this.editor._preventBlur=!1,this.__inputBlurEvent=this.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null},__enterPrevent(t){t.preventDefault(),Oe&&(this.__focusTemp.focus({preventScroll:!0}),this.editor.frameContext.get("wysiwyg").focus({preventScroll:!0}))},__enterScrollTo(t){dt.isMobile||this.editor.selection.scrollTo(t)},__postFocusEvent(t,e){(this.editor.isInline||this.editor.isBalloonAlways)&&this.toolbar.show(),this.editor.isSubBalloonAlways&&this.subToolbar.show(),this.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})},__postBlurEvent(t,e){(this.editor.isInline||this.editor.isBalloon)&&this._hideToolbar(),this.editor.isSubBalloon&&this._hideToolbar_sub(),this.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})},constructor:Re};const Ke=Re,Je={onload:null,onScroll:null,onMouseDown:null,onClick:null,onInput:null,onMouseLeave:null,onKeyDown:null,onKeyUp:null,onFocus:null,onNativeFocus:null,onBlur:null,onNativeBlur:null,onCopy:null,onCut:null,onChange:null,onShowToolbar:null,onShowController:null,onBeforeShowController:null,onToggleCodeView:null,onToggleFullScreen:null,onResizeEditor:null,onSetToolbarButtons:null,onSave:null,onDrop:null,onPaste:null,imageUploadHandler:null,onImageUploadBefore:null,onImageLoad:null,onImageAction:null,onImageUploadError:null,onImageDeleteBefore:null,videoUploadHandler:null,onVideoUploadBefore:null,onVideoLoad:null,onVideoAction:null,onVideoUploadError:null,onVideoDeleteBefore:null,audioUploadHandler:null,onAudioUploadBefore:null,onAudioUploadError:null,onAudioLoad:null,onAudioAction:null,onAudioDeleteBefore:null,onFileUploadBefore:null,onFileLoad:null,onFileAction:null,onFileUploadError:null,onFileDeleteBefore:null,onExportPDFBefore:null,onFileManagerAction:null,onEmbedInputBefore:null,onEmbedDeleteBefore:null},{_w:Qe}=dt,ti=Math.floor(96/72*841.89105);function ei(t,e){this.editor=t,this.context=t.context,this.selection=t.selection,this.offset=t.offset,this.fc=e,this.ww=e.get("wysiwyg"),this.wwFrame=e.get("wysiwygFrame"),this.wwWidth=-1,this.wwHeight=-1,this.isAutoHeight="auto"===e.get("options").get("height"),this.displayPage=this.isAutoHeight?Qe:e.get("wysiwyg"),this.innerHeaders=[],this._wwHeaders=[],this.documentTypeInner=e.get("documentTypeInner"),this.inner=null,this.page=null,this.totalPages=0,this.pageNum=0,this.pageHeight=-1,this.pageBreaksCnt=0,this.pages=[],this.pages_line=[],this.prevScrollTop=0,this.useHeader=t.options.get("_type_options").includes("header"),this.usePage=t.options.get("_type_options").includes("page"),this.navigatorButtons=[],this.pageNavigator=null,this._mirror=e.get("documentTypePageMirror"),this._mirrorCache=0,this._positionCache=new Map,this._rePageTimeout=null;const i=Qe.getComputedStyle(this._mirror);if(this._paddingTop=mt.get(i.paddingTop),this._paddingBottom=mt.get(i.paddingBottom),this.useHeader){const t=this._getHeaders(),e=this.inner=this.documentTypeInner.querySelector(".se-document-lines-inner");let i="";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i+=`<div class="se-doc-item se-doc-h${mt.get(e.nodeName)}" title="${e.textContent}">${e.textContent}</div>`;e.innerHTML=i,this.innerHeaders=e.querySelectorAll("div"),this.editor.eventManager.addEvent(e,"click",ii.bind(this,this.ww))}this.usePage&&(this.page=e.get("documentTypePage"),this.pageNavigator=t.plugins.pageNavigator)}function ii(t,e){e.preventDefault();try{this.editor._preventBlur=!0;const t=gt.query.getEventTarget(e);if(gt.utils.hasClass(t,"se-doc-item")){const e=Array.prototype.indexOf.call(this.innerHeaders,t);if(-1===e)return;const i=this._wwHeaders[e];i&&this.selection.scrollTo(i)}}finally{this.editor._preventBlur=!1}}ei.prototype={reHeader(){if(!this.useHeader)return;const t=this._getHeaders(),e=this.inner,i=this.innerHeaders;for(let s,n,o,l=0,r=t.length;l<r;l++)if(s=t[l],n=`se-doc-h${mt.get(s.nodeName)}`,o=i[l],l<i.length)o.classList.contains(n)&&o.textContent===s.textContent||(o.textContent=o.title=s.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=t.title=s.textContent,e.appendChild(t)}if(i.length>t.length)for(let s=t.length;s<i.length;s++)e.removeChild(i[s]);this.innerHeaders=e.querySelectorAll("div")},async rePage(t){this.page&&(this._rePageTimeout&&Qe.clearTimeout(this._rePageTimeout),this._rePageTimeout=Qe.setTimeout((async()=>{await gt.utils.waitForMediaLoad(this._mirror,1500);const e=this._mirror.scrollHeight,i=this._mirror.querySelectorAll(".se-page-break");if(!t&&this.pageHeight===e&&this.pageBreaksCnt===i.length)return;this.pageHeight=e,this.pageBreaksCnt=i.length;let s=0,n=0,o=0;if(i.length>0){s=i[0].offsetHeight;for(let t=0;t<i.length;t++){const e=i[t].offsetTop;(e-n)%ti!=0&&o++,n=e}const t=e-n;t>0&&t%ti!=0&&o++}const l=this.isAutoHeight?0:this._getWWScrollTop(),r=Math.ceil(e/ti)+o,a=this.wwFrame.offsetWidth+1,h=[];for(let t=0;t<i.length;t++)h.push({number:t,top:i[t].offsetTop+s-l});this._mirrorCache=0;const c=this.ww.children,d=this._mirror.children;this._initializeCache(d),h.push({number:0,top:0});for(let t=1,e=0;t<r;t++)if(e+=ti+(1===t?this._paddingTop+this._paddingBottom:this._paddingTop),!h.some((t=>Math.abs(t.top-e)<1))){const{ci:i,cm:s,ch:n}=this._getElementAtPosition(e,d),o=c[i];if(!o)break;c[this._mirrorCache]&&(e+=mt.get(Qe.getComputedStyle(c[this._mirrorCache]).marginBottom));const l=o.offsetTop+o.offsetHeight+s+(o.offsetHeight-n);h.push({number:t,top:l})}if(0===h.length)return this.pages_line=[],this.totalPages=1,void this._displayCurrentPage();h.sort(((t,e)=>t.top-e.top)),this.page.innerHTML="",this.pages=[];for(let t,i=0;i<r;i++){if(!h[i])continue;if(t=h[i].top,e<t)break;const s=gt.utils.createElement("DIV",{style:`top:${t-l}px`,innerHTML:String(i+1)},`<div class="se-document-page-line" style="width: ${a}px;"></div>${i+1}`);this.page.appendChild(s),this.pages.push(s)}this.pages_line=this.page.querySelectorAll(".se-document-page-line"),this.totalPages=this.pages.length,this._displayCurrentPage()}),400))},_initializeCache(t){this._positionCache.clear();for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.offsetTop,n=i.offsetHeight,o=s+n;this._positionCache.set(e,{top:s,height:n,bottom:o})}},_getElementAtPosition(t,e){let i=this._mirrorCache,s=e.length-1;for(;i<=s;){const e=Math.floor((i+s)/2),{top:n,height:o,bottom:l}=this._positionCache.get(e);if(t>=n&&t<=l)return this._mirrorCache=e,{ci:e,cm:t-l,ch:o};t<n?s=e-1:i=e+1}const n=e[i]?i:s;this._mirrorCache=n;const o=this._positionCache.get(n);return{ci:n,cm:t-o.bottom,ch:o.height}},resizePage(){const t=this.wwFrame.offsetWidth+1,e=this.wwFrame.offsetHeight+1;let i=!1;if(t===this.wwWidth&&(i=e===this.wwHeight))return;t>800?gt.utils.removeClass(this.documentTypeInner,"se-document-responsible"):gt.utils.addClass(this.documentTypeInner,"se-document-responsible"),this.wwWidth=t,this.wwHeight=e;const s=this.pages_line;for(let e=0,i=s.length;e<i;e++)s[e].style.width=`${t}px`;i||this.rePage(!0),this._displayCurrentPage()},scrollPage(){const t=this.prevScrollTop,e=this._getWWScrollTop();if(t===e)return;const i=this.pages;for(let s=0,n=i.length;s<n;s++)i[s].style.top=mt.get(i[s].style.top)-(e-t)+"px";this.prevScrollTop=e,this._displayCurrentPage()},scrollWindow(){this.isAutoHeight&&this._displayCurrentPage()},getCurrentPageNumber(){if(this.totalPages<=1)return 1;let t=0;if(this.isAutoHeight){const e=this._getGlobalTop();if(t=Qe.scrollY-e+ti/2,t<=0)return 1}else t=this.wwHeight/2;const e=this.pages;for(let i=0,s=e.length;i<s;i++)if(e[i].offsetTop>=t)return this.pageNum=i;return this.pageNum=this.totalPages},pageUp(){const t=this.pageNum-1<=1?1:this.pageNum-1;this._movePage(t,!1)},pageDown(){const t=this.pageNum+1>this.pages.length?this.pages.length:this.pageNum+1;this._movePage(t,!1)},pageGo(t){t<1?t=1:t>this.pages.length&&(t=this.pages.length),this._movePage(t,!0)},on(t){if(!this.useHeader)return;if(this._is(t)||(t=this._findLinesHeader(t)),!t)return;const e=this._findItem(t);e&&(gt.utils.removeClass(this.innerHeaders,"active"),gt.utils.addClass(e,"active"))},onChangeText(t){if(!this.useHeader)return;if(!this._is(t))return;const e=this._findItem(t);e&&(e.textContent=t.textContent)},_displayCurrentPage(){const t=this.getCurrentPageNumber();this.pageNavigator?.display(t,this.totalPages)},_getWWScrollTop(){return this.displayPage.scrollTop||this.displayPage.scrollY||0},_movePage(t,e){const i=this._getGlobalTop(),s=pt.nodeListToArray(this.ww.children),n=this.page.offsetTop+mt.get(this.pages[t-1].style.top)+(this.isAutoHeight?0:this._getWWScrollTop());for(let o,l=0,r=s.length;l<r;l++)if(o=s[l],o.offsetTop>=n){e||this.selection.setRange(o,0,o,0);const s=0!==l||this.isAutoHeight?o.offsetTop-this.page.offsetTop-o.offsetHeight+i:0;this._applyPageScroll(s,(()=>{this.editor.toolbar._sticky&&this.displayPage.scrollTo({top:s-this.context.get("toolbar.main").offsetHeight,behavior:"smooth"})})),this.pageNum=t;break}},_applyPageScroll(t,e){this.displayPage.scrollTo({top:t,behavior:"smooth"});const i=()=>{Math.abs((this.displayPage.scrollY??this.displayPage.scrollTop)-t)<1?e():Qe.requestAnimationFrame(i)};Qe.requestAnimationFrame(i)},_getGlobalTop(){return this.isAutoHeight?this.offset.getGlobal(this.wwFrame).top:0},_findItem(t){const e=this._wwHeaders,i=Array.prototype.indexOf.call(e,t);return-1!==i&&this.innerHeaders[i]?this.innerHeaders[i]:null},_findLinesHeader(t){for(;t&&t!==this.ww;){if(this._is(t))return t;t=t.previousElementSibling||t.parentElement}return null},_is:t=>/^h[1-6]$/i.test(t?.nodeName),_getHeaders(){return this._wwHeaders=this.ww.querySelectorAll("h1, h2, h3, h4, h5, h6")},constructor:ei};const si=ei;const ni=function(t){this.toolbar=t.toolbar,this.subToolbar=null,t.subToolbar&&(this.subToolbar=t.subToolbar),this.char=t.char,this.component=t.component,this.format=t.format,this.html=t.html,this.menu=t.menu,this.nodeTransform=t.nodeTransform,this.offset=t.offset,this.selection=t.selection,this.shortcuts=t.shortcuts,this.ui=t.ui,this.viewer=t.viewer};function oi(t){ne.call(this,t)}function li(e){e&&!D(e,"se-blink")&&(q(e,"se-blink"),t.setTimeout((()=>{W(e,"se-blink")}),600))}oi.prototype={check(t){const e=this.editor.frameOptions.get("charCounter_max");if(e){const i=this.getLength("string"==typeof t?t:"byte-html"===this.editor.frameOptions.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(i>0&&i+this.getLength()>e)return li(this.editor.frameContext.get("charWrapper")),!1}return!0},getLength(t){return"string"!=typeof t&&(t="byte-html"===this.editor.frameOptions.get("charCounter_type")?this.editor.frameContext.get("wysiwyg").innerHTML:this.editor.frameContext.get("wysiwyg").textContent),/byte/.test(this.editor.frameOptions.get("charCounter_type"))?this.getByteLength(t):t.length},getByteLength(t){if(!t||!t.toString)return 0;let e,i;return t=t.toString(),a?(i=decodeURIComponent(encodeURIComponent(t)).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e):(i=(new TextEncoder).encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),i+e)},display(e){const i=(e||this.editor.frameContext).get("charCounter");i&&t.setTimeout((()=>{i.textContent=this.getLength()}),0)},test(t,e){let i=0;t&&(i=this.getLength(t)),this.display();const s=this.editor.frameOptions.get("charCounter_max");if(s>0){let t=!1;const n=this.getLength();if(n>s){if(t=!0,i>0&&e){this.selection._init();const t=this.selection.getRange(),e=t.endOffset-1,i=this.selection.getNode().textContent,s=t.endOffset-1;this.selection.getNode().textContent=i.slice(0,s<0?0:s)+i.slice(t.endOffset,i.length),this.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+i>s&&(t=!0);if(t&&(li(this.editor.frameContext.get("charWrapper")),i>0))return!1}return!0},constructor:oi};const ri=oi;const ai=function(t){this.editor,this.eventManager,this.history,this.events,this.triggerEvent,this.carrierWrapper,this.plugins,this.status,this.context,this.options,this.icons,this.lang,this.frameRoots,this._w,this._d,this.toolbar,this.subToolbar,this.char,this.component,this.format,this.html,this.menu,this.nodeTransform,this.offset,this.selection,this.shortcuts,this.ui,this.viewer,ne.call(this,t),ni.call(this,t)},{_w:hi,ON_OVER_COMPONENT:ci}=dt,di="2147483646",ui="2147483645",pi="2147483641",gi="2147483640";const mi=class extends ai{constructor(t,e,i,s){super(t.editor),this.kind=s||t.constructor.key||t.constructor.name,this.inst=t,this.form=e,this.isOpen=!1,this.currentTarget=null,this.currentPositionTarget=null,this.isWWTarget=i.isWWTarget??!0,this.position=i.position||"bottom",this.disabled=!!i.disabled,this.parents=i.parents||[],this.parentsHide=!!i.parentsHide,this.sibling=i.sibling||null,this.siblingPosition=["top","side"].includes(i.siblingPosition)?i.siblingPosition:"top",this.isInsideForm=!!i.isInsideForm,this.isOutsideForm=!!i.isOutsideForm,this.toTop=!1,this._reserveIndex=!1,this._initMethod="function"==typeof i.initMethod?i.initMethod:null,this.__globalEventHandlers={keydown:this.#t.bind(this),mousedown:this.#e.bind(this)},this._bindClose_key=null,this._bindClose_mouse=null,this.__offset={},this.__addOffset={left:0,top:0},this.__shadowRootEventForm=null,this.__shadowRootEventListener=null,this.carrierWrapper.appendChild(e),this.eventManager.addEvent(e,"click",this.#i.bind(this)),this.eventManager.addEvent(e,"mouseenter",this.#s.bind(this)),this.eventManager.addEvent(e,"mouseleave",this.#n.bind(this))}open(t,e,{isWWTarget:i,initMethod:s,disabled:n,addOffset:o}={}){if(oe.get("__overInfo")===ci)return;if(!t)return void console.warn("[SUNEDITOR.Controller.open.fail] The target element is required.");this.editor.isBalloon?this.toolbar.hide():this.editor.isSubBalloon&&this.subToolbar.hide(),this.status.hasFocus||(n??this.disabled?this.ui.setControllerOnDisabledButtons(!0):this.ui.setControllerOnDisabledButtons(!1)),this.currentPositionTarget=e||t,this.isWWTarget=i??this.isWWTarget,"function"==typeof s&&(this._initMethod=s),this.editor.currentControllerName=this.kind,this.__addOffset={left:0,top:0},o&&(this.__addOffset={...this.__addOffset,...o});const l=this.isOutsideForm?this.parents:[];this.editor.opendControllers?.forEach((t=>{l.includes(t.form)||(t.form.style.zIndex=gi)})),this.parentsHide&&this.parents.forEach((t=>{t.style.display="none"})),this.__addGlobalEvent(),this.sibling&&("top"===this.siblingPosition?this.__addOffset.top+=1-this.sibling.offsetHeight:this.__addOffset.left+=this.form.offsetWidth+this.sibling.offsetWidth-1),this._setControllerPosition(this.form,this.currentPositionTarget,!1);const r=t instanceof Range;this.currentTarget=r?null:t,this._controllerOn(this.form,t,r),this._w.setTimeout((()=>oe.set("__overInfo",!1)),0)}close(t){this.isOpen&&(this.toTop=!1,this.isOpen=!1,this.__offset={},this.__addOffset={left:0,top:0},this.__removeGlobalEvent(),"function"==typeof this._initMethod&&this._initMethod(),this._controllerOff(),this.parentsHide&&!t&&this.parents.forEach((t=>{t.style.display="block"})),this.parents.length>0||("function"==typeof this.inst.close&&this.inst.close(),this.component.deselect()))}hide(){this.form.style.display="none"}show(){this._setControllerPosition(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?di:ui}resetPosition(t){this._setControllerPosition(this.form,t||this.currentPositionTarget,!0)}async _controllerOn(t,e,i){const s={position:this.position,inst:this,form:t,target:e,isRangeTarget:i,notInCarrier:!this.carrierWrapper.contains(t)};!1!==await this.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.editor.frameContext,info:s})&&(t.style.display="block",this.editor._shadowRoot&&(this.__shadowRootEventForm=t,this.__shadowRootEventListener=t=>t.stopPropagation(),t.addEventListener("mousedown",this.__shadowRootEventListener)),this.editor._controllerTargetContext=this.editor.frameContext.get("topArea"),this.isOpen||this.editor.opendControllers.push(s),this.isOpen=!0,this.editor._preventBlur=!0,this.editor.status.onSelected=!0,this.triggerEvent("onShowController",{caller:this.kind,frameContext:this.editor.frameContext,info:s}))}_controllerOff(){this.form.style.display="none",this.editor.opendControllers=this.editor.opendControllers.filter((t=>t.form!==this.form)),this.editor.currentControllerName!==this.kind&&this.editor.opendControllers.length>0||(this.ui.setControllerOnDisabledButtons(!1),this.editor.frameContext.get("lineBreaker_t").style.display=this.editor.frameContext.get("lineBreaker_b").style.display="none",this.editor.effectNode=null,this.editor.currentControllerName="",this.editor._preventBlur=!1,this.editor._controllerTargetContext=null,hi.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.__shadowRootEventForm&&(this.__shadowRootEventForm.removeEventListener("mousedown",this.__shadowRootEventListener),this.__shadowRootEventForm=this.__shadowRootEventListener=null),"function"==typeof this.inst.reset&&this.inst.reset())}_setControllerPosition(t,e,i){if(t.style.visibility="hidden",t.style.display="block",this.selection.isRange(e)){if(!this.offset.setRangePosition(this.form,e,{position:"bottom"}))return void this.hide()}else if(e){const s=this.offset.setAbsPosition(t,e,{addOffset:this.__addOffset,position:this.position,isWWTarget:this.isWWTarget,inst:this});if(!s)return void this.hide();if(!i&&this.sibling&&"top"===this.siblingPosition&&s.position!==this.position){const e=t.offsetTop-this.__addOffset.top;"bottom"===s.position?(this._reserveIndex=!0,t.style.top=e+this.sibling.offsetHeight-2+"px"):t.style.top=e-this.sibling.offsetHeight+2+"px"}else this._reserveIndex=!1}t.style.zIndex=this.toTop?ui:this._reserveIndex?pi:gi,t.style.visibility=""}__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandlers.keydown,!0),this._bindClose_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandlers.mousedown,!0)}__removeGlobalEvent(){this.component.__removeGlobalEvent(),this._bindClose_key&&(this._bindClose_key=this.eventManager.removeGlobalEvent(this._bindClose_key)),this._bindClose_mouse&&(this._bindClose_mouse=this.eventManager.removeGlobalEvent(this._bindClose_mouse))}_checkFixed(){if(this.editor.selectMenuOn)return!0;const t=this.editor.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}_checkForm(t){if(gt.check.isWysiwygFrame(t))return!1;if(gt.utils.hasClass(t,"se-drag-handle"))return!0;let e=!1;return this.isInsideForm&&this.parents?.length>0&&this.parents.some((i=>{if(i.contains(t))return e=!0,!0})),!e&&(!!gt.query.getParentElement(t,".se-controller")||t?.contains(this.inst._element))}#i(t){const e=gt.query.getEventTarget(t),i=gt.query.getCommandTarget(e);i&&(t.stopPropagation(),t.preventDefault(),this.inst.controllerAction(i))}#s(t){if(this.editor.currentControllerName=this.kind,this.parents.length>0&&this.isInsideForm)return;gt.query.getEventTarget(t).style.zIndex=this.toTop?di:ui}#n(t){if(this.parents.length>0&&this.isInsideForm)return;gt.query.getEventTarget(t).style.zIndex=this.toTop?ui:this._reserveIndex?pi:gi}#t(t){if(this._checkFixed())return;const e=t.code;if(ft.isCtrl(t)||!ft.isNonResponseKey(e))return;const i=gt.query.getEventTarget(t);this.form.contains(i)||this._checkForm(i)||this.editor._fileManager.pluginRegExp.test(this.kind)&&!ft.isEsc(e)||(this.#o(i),this.close())}#e(t){const e=gt.query.getEventTarget(t);this.inst?._element?.contains(e)?this.isOpen=!1:(this.isOpen=!0,e===this.inst._element||e===this.currentTarget||this._checkFixed()||this.form.contains(e)||this._checkForm(e)||gt.query.getParentElement(e,".se-line-breaker-component")||(this.#o(e),this.close(!0)))}#o(t){this.editor.frameContext.get("wysiwyg").contains(t)||(this.component.__prevent=!1)}};const fi=class extends ne{constructor(t,e){super(t.editor),this.kink=t.constructor.key||t.constructor.name,this.inst=t;const i=e.position.split("-");this.form=null,this.items=[],this.menus=null,this.menuLen=0,this.index=-1,this.item=null,this.isOpen=!1,this.checkList=!!e.checkList,this.position=i[0],this.subPosition=i[1],this._dirPosition=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this._dirSubPosition=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this._textDirDiff="ltr"!==e.dir&&("rtl"===e.dir||null),this.splitNum=e.splitNum||0,this.horizontal=!!this.splitNum,this.openMethod=e.openMethod,this.closeMethod=e.closeMethod,this._refer=null,this._keydownTarget=null,this._selectMethod=null,this._bindClose_key=null,this._bindClose_mousedown=null,this._bindClose_click=null,this._closeSignal=!1,this.__events=null,this.__eventHandlers={mousedown:this.#l.bind(this),mousemove:this.#r.bind(this),click:this.#a.bind(this),keydown:this.#h.bind(this)},this.__globalEventHandlers={keydown:this.#c.bind(this),mousedown:this.#e.bind(this),click:this.#d.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="";let i="";for(let s=0,n=(e=e||t).length;s<n;s++)s>0&&s%this.splitNum==0&&(this._createFormat(i),i=""),i+=`<li class="se-select-item" data-index="${s}">${"string"==typeof e[s]?e[s]:e[s].outerHTML}</li>`;this._createFormat(i),this.items=t,this.menus=Array.from(this.form.querySelectorAll("li")),this.menuLen=this.menus.length}on(t,e,i){i||(i={}),this._refer=t,this._keydownTarget=gt.check.isInputElement(t)?t:this._w,this._selectMethod=e,this.form=gt.utils.createElement("DIV",{class:"se-select-menu"+(i.class?" "+i.class:""),style:i.style||""},'<div class="se-list-inner"></div>'),t.parentNode.insertBefore(this.form,t)}open(t,e){this.editor.selectMenuOn=!0,"function"==typeof this.openMethod&&this.openMethod(),this.__addEvents(),this.__addGlobalEvent();const i=t?t.split("-"):[],s=i[0]||(null!==this._textDirDiff&&this._textDirDiff!==this.options.get("_rtl")?this._dirPosition:this.position),n=i[1]||(null!==this._textDirDiff&&this._textDirDiff!==this.options.get("_rtl")?this._dirSubPosition:this.subPosition);this._setPosition(s,n,e),this.isOpen=!0}close(){this.editor.selectMenuOn=!1,gt.utils.removeClass(this._refer,"on"),this._init(),this.form&&(this.form.style.cssText=""),this.isOpen=!1,"function"==typeof this.closeMethod&&this.closeMethod()}getItem(t){return this.items[t]}setItem(t){this._selectItem(t)}_createFormat(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}_init(){this.__removeEvents(),this.__removeGlobalEvent(),this.index=-1,this.item=null,this._onItem&&(gt.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}_moveItem(t){t=this.index+t;const e=this.menuLen,i=this.index=t>=e?0:t<0?e-1:t;this._selectItem(i)}_selectItem(t){gt.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let i=0;i<e;i++)i===t?gt.utils.addClass(this.menus[i],"active"):gt.utils.removeClass(this.menus[i],"active");this.index=t,this.item=this.items[t]}_setPosition(t,e,i,s){const n=t,o=this.form,l=this._refer;o.style.visibility="hidden",o.style.display="block",gt.utils.removeClass(o,"se-select-menu-scroll"),gt.utils.addClass(l,"on");const r=o.offsetWidth,a=l.offsetWidth,h=l.offsetLeft;let c=!1,d=0,u=0;"left"===t?(d=h-r-1,t=e,c=!0):"right"===t&&(d=h+a+1,t=e,c=!0);const p=this.editor.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,_=gt.utils.getClientSize().h-(m-this._w.scrollY+f),b=c?f:0;let y=1e4;switch(t){case"middle":{let t=o.offsetHeight;const e=f/2;u=g-t/2+e,m<t/2&&(u+=t/2-m-e+4,o.style.top=u+"px");let i=this.editor.offset.getGlobal(o).top;const s=t-(m-i)-_-f;s>0&&(u-=s+4,o.style.top=u+"px"),i=this.editor.offset.getGlobal(o).top,i<0&&(t+=i-4,u-=i-4),o.style.height=t+"px";break}case"top":if(m<o.offsetHeight-b){if(!s){y=0;break}y=m-4+b,y>=38&&(o.style.height=y+"px")}u=g-o.offsetHeight+b;break;case"bottom":if(_<o.offsetHeight+b){if(!s){y=0;break}y=_-4+b,y>=38&&(o.style.height=y+"px")}u=g+(c?0:f)}if(y<38&&!s&&"middle"!==t)return void this._setPosition("top"===t?"bottpm":"top",e,i,!0);if(!c)switch(e){case"center":d=h+a/2-r/2;break;case"left":d=h;break;case"right":d=h-(r-a)}o.style.left=d+"px";const v=this.editor.offset.getGlobal(o).left;let C=0;switch(c+"-"+(c?n:e)){case"true-left":C=p.left-this._w.scrollX+v,C<0&&(d=d=h+a+1);break;case"true-right":C=this._w.innerWidth-(v+r),C<0&&(d=h-r-1);break;case"false-center":{C=this._w.innerWidth-(v+r),C<0&&(d+=C-4),o.style.left=d+"px";const t=this.editor.offset.getGlobal(o).left;t<0&&(d-=t-4);break}case"false-left":C=this._w.innerWidth-(p.left-this._w.scrollX+r),C<0&&(d+=C-4);break;case"false-right":v<0&&(d-=v-4)}if(i){const t=o.firstElementChild.querySelector(i);t&&(this._onItem=t,gt.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}_select(t){this.checkList&>.utils.toggleClass(this.menus[t],"se-checked"),this._selectMethod(this.getItem(t))}__addEvents(){this.__removeEvents(),this.__events=this.__eventHandlers,this.form.addEventListener("mousedown",this.__events.mousedown),this.form.addEventListener("mousemove",this.__events.mousemove),this.form.addEventListener("click",this.__events.click),this._keydownTarget.addEventListener("keydown",this.__events.keydown)}__removeEvents(){this.__events&&(this.form.removeEventListener("mousedown",this.__events.mousedown),this.form.removeEventListener("mousemove",this.__events.mousemove),this.form.removeEventListener("click",this.__events.click),this._keydownTarget.removeEventListener("keydown",this.__events.keydown),this.__events=null)}__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandlers.keydown,!0),this._bindClose_mousedown=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandlers.mousedown,!0)}__removeGlobalEvent(){this._bindClose_key&&(this._bindClose_key=this.eventManager.removeGlobalEvent(this._bindClose_key)),this._bindClose_mousedown&&(this._bindClose_mousedown=this.eventManager.removeGlobalEvent(this._bindClose_mousedown)),this._bindClose_click&&(this._bindClose_click=this.eventManager.removeGlobalEvent(this._bindClose_click))}#h(t){let e;switch(t.code){case"ArrowUp":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index-t<0?t:-t}else e=-1;break;case"ArrowDown":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index+t>this.menuLen?-t:t}else e=1;break;case"ArrowLeft":t.preventDefault(),t.stopPropagation(),e=-1;break;case"ArrowRight":t.preventDefault(),t.stopPropagation(),e=1;break;case"Enter":case"Space":this.index>-1?(t.preventDefault(),t.stopPropagation(),this._select(this.index)):this.close()}e&&this._moveItem(e)}#l(t){if(dt.isGecko){const e=gt.query.getEventTarget(t),i=gt.query.getParentElement(e,".se-select-item");i&&this.eventManager._injectActiveEvent(i)}}#r(t){const e=gt.query.getEventTarget(t);gt.utils.addClass(this.form,"se-select-menu-mouse-move");const i=e.getAttribute("data-index");i&&(this.index=Number(i))}#a(t){let e=gt.query.getEventTarget(t),i=null;for(;!i&&!/UL/i.test(e.tagName)&&!gt.utils.hasClass(e,"se-select-menu");)i=e.getAttribute("data-index"),e=e.parentElement;i&&this._select(Number(i))}#c(t){ft.isEsc(t.code)&&this.close()}#e(t){const e=gt.query.getEventTarget(t);this.form.contains(e)||(t.target!==this._refer?this.close():gt.check.isInputElement(e)||(this._bindClose_click=this.eventManager.addGlobalEvent("click",this.__globalEventHandlers.click,!0)))}#d(t){this._bindClose_click=this.eventManager.removeGlobalEvent(this._bindClose_click),t.target===this._refer&&(t.stopPropagation(),this.close())}},{ON_OVER_COMPONENT:_i}=dt,bi={tl:"nwse-resize",tr:"nesw-resize",bl:"nesw-resize",br:"nwse-resize",lw:"ew-resize",th:"ns-resize",rw:"ew-resize",bh:"ns-resize"};let yi=!1,vi=!1,Ci=0,wi=0;class xi extends ai{constructor(t,e,i){super(t.editor),this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.icons.format_float_none,left:this.icons.format_float_left,right:this.icons.format_float_right,center:this.icons.format_float_center},this._action={};const s=function(t,e){let i=null;if(e?.length>0){const{lang:s,icons:n}=t;i='<div class="se-arrow se-arrow-up"></div>';for(let o,l=0;l<e.length;l++){o=e[l],i+='<div class="se-btn-group">';for(let e,l=0,r=o.length;l<r;l++){if(e=o[l],"function"==typeof e?.action){const i=e;e={c:`__c__${i.command}`,v:i.value||"",l:i.title,i:i.icon},t._action[e.c]=i.action}else if(e=ki(e),!e)continue;i+=`\n\t\t\t\t\t<button type="button" data-command="${e.c}" data-value="${e.v}" class="se-btn se-tooltip">\n\t\t\t\t\t\t${n[e.i]||e.i}\n\t\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${s[e.l]||e.l}</span></span>\n\t\t\t\t\t</button>`}i+="</div>"}}return gt.utils.createElement("DIV",{class:"se-controller se-controller-resizing"+(i?"":" se-empty-controller")},i)}(this,e||[]);this.controller=new mi(this,s,{position:"bottom",disabled:!0},this.kind),this.alignButton=s.querySelector('[data-command="onalign"]');const n=function(t,e){if(!e)return null;const i=[t._alignIcons.none,t._alignIcons.left,t._alignIcons.center,t._alignIcons.right],s=[t.lang.basic,t.lang.left,t.lang.center,t.lang.right],n=["none","left","center","right"],o=[],l=[];for(let t=0;t<n.length;t++)o.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${n[t]}" data-type="selectMenu" >\n\t\t\t${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.alignButton);n&&(this.selectMenu_align=new fi(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#u.bind(this),{class:"se-figure-select-list"}),this.selectMenu_align.create(n.items,n.html)),this.asButton=s.querySelector('[data-command="onas"]');const o=function(t,e){if(!e)return null;const i=[t.icons.as_block,t.icons.as_inline],s=[t.lang.asBlock,t.lang.asInline],n=["block","inline"],o=[],l=[];for(let t=0;t<n.length;t++)o.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${n[t]}" data-type="selectMenu" >\n\t\t\t${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(this,this.asButton);o&&(this.selectMenu_as=new fi(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#p.bind(this),{class:"se-figure-select-list"}),this.selectMenu_as.create(o.items,o.html)),this.resizeButton=s.querySelector('[data-command="onresize"]');const l=function(t,e){if(!e)return null;const i=e.getAttribute("data-value").split(","),s=[];for(let e,n,o,l,r=0;r<i.length;r++)o=i[r],e=mt.is(o),n=e?"resize_percent"+o:"auto",l=e?o+"%":t.lang.autoSize,s.push('<button type="button" class="se-btn-list" data-command="'+n+'" data-value="'+o+'"><span>'+l+"</span></button>");return{html:s,items:i}}(this,this.resizeButton);l&&(this.selectMenu_resize=new fi(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#g.bind(this)),this.selectMenu_resize.create(l.items,l.html)),this.inst=t,this.sizeUnit=i.sizeUnit||"px",this.autoRatio=i.autoRatio,this.isVertical=!1,this.percentageButtons=s.querySelectorAll('[data-command="resize_percent"]'),this.captionButton=s.querySelector('[data-command="caption"]'),this.align="none",this.as="block",this._element=null,this._cover=null,this._inlineCover=null,this._container=null,this._caption=null,this._width="",this._height="",this._resize_w=0,this._resize_h=0,this._element_w=0,this._element_h=0,this._element_l=0,this._element_t=0,this._resizeClientX=0,this._resizeClientY=0,this._resize_direction="",this._floatClassStr="__se__float-none|__se__float-left|__se__float-center|__se__float-right",this.__preventSizechange=!1,this.__revertSize={w:"",h:""},this.__offset={},this.__offContainer=this.#m.bind(this),this.__containerResizing=this.#f.bind(this),this.__containerResizingOff=this.#_.bind(this),this.__containerResizingESC=this.#b.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.__onResizeESCEvent=null,this.__fileManagerInfo=!1,this.eventManager.addEvent(this.alignButton,"click",this.#y.bind(this)),this.eventManager.addEvent(this.asButton,"click",this.#v.bind(this)),this.eventManager.addEvent(this.resizeButton,"click",this.#C.bind(this)),this.editor.applyFrameRoots((t=>{if(!t.get("wrapper").querySelector(".se-controller.se-resizing-container")){const e=function(){const t='\n\t\t<div class="se-resize-dot">\n\t\t\t<span class="tl"></span>\n\t\t\t<span class="tr"></span>\n\t\t\t<span class="bl"></span>\n\t\t\t<span class="br"></span>\n\t\t\t<span class="lw"></span>\n\t\t\t<span class="th"></span>\n\t\t\t<span class="rw"></span>\n\t\t\t<span class="bh"></span>\n\t\t\t<div class="se-resize-display"></div>\n\t\t</div>';return gt.utils.createElement("DIV",{class:"se-controller se-resizing-container",style:"display: none;"},t)}(),i=e.querySelectorAll(".se-resize-dot > span");t.set("_figure",{main:e,border:e.querySelector(".se-resize-dot"),display:e.querySelector(".se-resize-display"),handles:i}),t.get("wrapper").appendChild(e),this.eventManager.addEvent(i,"mousedown",this.#w.bind(this))}}))}static CreateContainer(t,e){return gt.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},gt.utils.createElement("FIGURE",null,t)),xi.GetContainer(t)}static CreateInlineContainer(t,e){return gt.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),xi.GetContainer(t)}static CreateCaption(t,e){const i=gt.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(i),i}static GetContainer(t){const e=gt.query.getParentElement(t,"FIGURE",2),i=gt.query.getParentElement(t,"SPAN",2);return{target:t,container:gt.query.getParentElement(t,xi.is,2)||e,cover:e,inlineCover:gt.utils.hasClass(i,"se-inline-component")?i:null,caption:gt.query.getEdgeChild(t.parentElement,"FIGCAPTION",!1)}}static GetRatio(t,e,i){let s=1,n=1;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!mt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px")===(!mt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px")){const i=mt.get(t,4),o=mt.get(e,4);s=i/o,n=o/i}}return{w:mt.get(s,4),h:mt.get(n,4)}}static CalcRatio(t,e,i,s){if(/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!mt.is(t)&&String(t).replace(/\d+|\./g,"")||i||"px",o=!mt.is(e)&&String(e).replace(/\d+|\./g,"")||i||"px";if(n===o){const i="%"===n?2:0,l=t,r=e;e=mt.get(s.h*mt.get(l,i),i)+o,t=mt.get(s.w*mt.get(r,i),i)+n}}return{w:t,h:e}}static is(t){return gt.utils.hasClass(t,"se-component")||/^(HR)$/.test(t?.nodeName)}close(){this.editor._preventBlur=!1,gt.utils.removeClass(this._cover,"se-figure-selected"),this.controller.close(),this.component._removeDragEvent()}open(t,{nonResizing:e,nonSizeInfo:i,nonBorder:s,figureTarget:n,__fileManagerInfo:o}){if(!t)return void console.warn('[SUNEDITOR.modules.Figure.open] The "targetNode" is null.');oe.get("__overInfo")!==_i?this.ui._offCurrentController():s=!0;const l=xi.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.options.get("strictMode").formatFilter)return{container:null,cover:null,width:r.style.width||r.width||"",height:r.style.height||r.height||""};l.container=r,l.cover=r,a=!0}oe.set("__figureInst",this),this._setFigureInfo(l);const h=n&&(this._cover||this._container)||r,c=h.offsetWidth||null,d=h.offsetHeight||null,{top:u,left:p,scrollX:g,scrollY:m}=this.offset.getLocal(h),f=(r.getAttribute("data-se-size")||"").split(","),_=xi.GetRatio(f[0]||mt.get(r.style.width,2)||c,f[1]||mt.get(r.style.height,2)||d,this.sizeUnit),b={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:_,w:c||"",h:d||"",t:u,l:p,width:f[0]||"auto",height:f[1]||"auto",originWidth:r.naturalWidth||r.offsetWidth,originHeight:r.naturalHeight||r.offsetHeight};if(this._width=b.width,this._height=b.height,o||this.__fileManagerInfo)return b;const y=this.editor.frameContext.get("_figure");this.editor._figureContainer=y.main,y.main.style.top=u+"px",y.main.style.left=p+"px",y.main.style.width=(this.isVertical?d:c)+"px",y.main.style.height=(this.isVertical?c:d)+"px",y.border.style.top="0px",y.border.style.left="0px",y.border.style.width=(this.isVertical?d:c)+"px",y.border.style.height=(this.isVertical?c:d)+"px",this.__offset={left:p+g,top:u+m},this.editor.opendControllers.push({position:"none",form:y.main,target:h,inst:this,notInCarrier:!0});const v=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?mt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===v?gt.utils.addClass(this.percentageButtons[t],"active"):gt.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?gt.utils.addClass(this.captionButton,"active"):gt.utils.removeClass(this.captionButton,"active")),y.display.style.display=i||this._inlineCover?"none":"",y.border.style.display=s?"none":"",y.main.style.display="block",oe.get("__overInfo")!==_i){this._setAlignIcon(),this._setAsIcon(),this.ui._visibleControllers(!0,!0);const t=this.getSize(r);gt.utils.changeTxt(y.display,this.lang["none"===this.align?"basic":this.align]+" ("+t.w+", "+t.h+")"),this._displayResizeHandles(!e);const i=this.controller.form.querySelectorAll('[data-command="rotate"][data-value="90"], [data-command="rotate"][data-value="-90"], [data-command="caption"], [data-command="onalign"], [data-command="onresize"]'),s=this._inlineCover||a?"none":"";i.forEach((t=>{t.style.display=s}));const n=this.controller.form.querySelector('[data-command="onas"]');n&&(n.style.display=a?"none":""),gt.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller.open(y.main,null,{initMethod:this.__offContainer,isWWTarget:!1,addOffset:null}),this._w.setTimeout((()=>oe.set("__overInfo",!1)),0)}else gt.utils.addClass(this._cover,"se-figure-over-selected");return gt.utils.addClass(this._cover,"se-figure-selected"),this._element_w=this._resize_w=c,this._element_h=this._resize_h=d,this._element_l=p,this._element_t=u,this._inlineCover||oe.get("__overInfo")===_i&&!gt.utils.hasClass(l.container,"se-input-component")||this._setDragEvent(y.main),b}controllerHide(){this.controller.hide()}controllerShow(){this.controller.show()}controllerOpen(t,e){this._element=t,this.controller.open(t,null,e)}setSize(t,e){/%$/.test(t+"")?this._setPercentSize(t,e):t&&"auto"!==t||e&&"auto"!==e?this._applySize(t,e,""):this.autoRatio?this._setPercentSize(100,this.autoRatio.default||this.autoRatio.current):this._setAutoSize()}getSize(t){if(t||(t=this._element),!t)return{w:"",h:""};const e=xi.GetContainer(t),i=e.target;if(!e.container)return this.options.get("strictMode").formatFilter?{w:"",h:i.style.height}:{w:i.style.width||"auto",h:i.style.height||"auto"};return{w:(/%$/.test(i.style.width)?(e.container&&mt.get(e.container.style.width,2)||100)+"%":i.style.width)||"auto",h:(e.inlineCover?e.inlineCover.style.height:mt.get(e.cover.style.paddingBottom,0)>0&&!this.isVertical?e.cover.style.height:/%$/.test(i.style.height)&&/%$/.test(i.style.width)?(e.container&&mt.get(e.container.style.height,2)||100)+"%":i.style.height)||"auto"}}setAlign(t,e){t||(t=this._element),this.align=e=e||"none";const i=xi.GetContainer(t);if(!i.cover)return;const s=i.target,n=i.container,o=i.cover;if(/%$/.test(s.style.width)&&"center"===e&&!this.component.isInline(n)?(n.style.minWidth="100%",o.style.width=n.style.width):(n.style.minWidth="",o.style.width=this.isVertical?s.style.height||s.offsetHeight+"px":s.style.width&&"auto"!==s.style.width?s.style.width||"100%":""),gt.utils.hasClass(n,"__se__float-"+e)||(gt.utils.removeClass(n,this._floatClassStr),gt.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this._setAlignIcon()}convertAsFormat(t,e){t||(t=this._element),this.as=e||"block";const{container:i,inlineCover:s,target:n}=xi.GetContainer(t),{w:o,h:l}=this.getSize(n),r=n.cloneNode(!1);switch(e){case"inline":{if(s)break;this.component.deselect();const t=i.nextElementSibling,e=i.parentElement;r.style.width="",r.style.height="";const n=xi.CreateInlineContainer(r);gt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(n,o,l);const a=gt.utils.createElement(this.options.get("defaultLine"),null,n.container);e.insertBefore(a,t),gt.utils.removeItem(i);break}case"block":{if(!s)break;this.component.deselect(),this.selection.setRange(i,0,i,1);const t=this.html.remove(),e=this.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&>.check.isZeroWidth(e.previousElementSibling)&>.utils.removeItem(e.previousElementSibling),r.style.width="",r.style.height="";const n=xi.CreateContainer(r);gt.utils.addClass(n.container,i.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this._asFormatChange(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}}_asFormatChange(t,e,i){const s=this.kind;t.target.onload=()=>this.component.select(t.target,s),this._setFigureInfo(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setSize(e,i)}controllerAction(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value"),s=t.getAttribute("data-type"),n=this._element;if(!/^on.+/.test(e)&&"selectMenu"!==s){switch(e){case"mirror":{const t=this.#x(n);let e=t.x,s=t.y;"h"===i&&!this.isVertical||"v"===i&&this.isVertical?s=s?"":"180":e=e?"":"180",this._setRotate(n,t.r,e,s);break}case"rotate":this.setTransform(n,null,null,i);break;case"caption":if(this._caption)gt.utils.removeItem(this._caption),this._w.setTimeout(this.component.select.bind(this.component,n,this.kind),0);else{const t=xi.CreateCaption(this._cover,this.lang.caption),e=gt.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.selection.setRange(e,0,e,e.textContent.length):t.focus(),this.controller.close()}this._caption=!this._caption,(/\d+/.test(n.style.height)||this.isVertical&&this._caption)&&(/%$/.test(n.style.width)||/auto/.test(n.style.height)?this.deleteTransform():this.setTransform(n,n.style.width,n.style.height,0));break;case"revert":this._setRevert();break;case"edit":this.inst.edit(n);break;case"copy":this.component.copy(this._container);break;case"remove":this.inst.destroy(n),this.controller.close()}/^__c__/.test(e)?this._action[e](n,i,t):/^edit$/.test(e)||(this.history.push(!1),/^remove|caption$/.test(e)||this.component.select(n,this.kind))}}retainFigureFormat(t,e,i,s){const n=this.component.isInline(t);let o=this.format.isBlock(e.parentNode)||gt.check.isWysiwygFrame(e.parentNode)?e:gt.check.isAnchor(e.parentNode)?e.parentNode:this.format.getLine(e)||e;if(gt.query.getParentElement(e,gt.check.isExcludeFormat))o=i&&i!==e?i:e,o.parentNode.replaceChild(t,o);else if(n&&this.format.isLine(o)){const i=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;i.parentElement.replaceChild(t,i)}else if(gt.check.isListCell(o)){const i=gt.query.getParentElement(e,(t=>t.parentNode===o));o.insertBefore(t,i),gt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(i,null,!0)}else if(this.format.isLine(o)){const i=gt.query.getParentElement(e,(t=>t.parentNode===o));o=this.nodeTransform.split(o,i),o.parentNode.insertBefore(t,o),gt.utils.removeItem(e),this.nodeTransform.removeEmptyNode(o,null,!0)}else if(this.format.isLine(o.parentNode)){const e=o.parentNode;e.parentNode.insertBefore(t,o.previousSibling?e.nextElementSibling:e),(0===s?.__updateTags.map((t=>o.contains(t))).length||gt.check.isZeroWidth(o))&>.utils.removeItem(o)}else o=gt.check.isFigure(o.parentNode)?gt.query.getParentElement(o.parentNode,xi.is):o,o.parentNode.replaceChild(t,o)}deleteTransform(t){t||(t=this._element);const e=t,i=(e.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",this._deleteCaptionPosition(e),this._applySize(i[0]||"auto",i[1]||"","")}setTransform(t,e,i,s){try{this.__preventSizechange=!0;const n=this.#x(t),o=n.r+1*(s||0);s=Math.abs(o)>=360?0:o;const l=this.isVertical=/^(90|270)$/.test(Math.abs(s).toString());e=mt.get(e,0),i=mt.get(i,0);const r=t,a=(r.getAttribute("data-se-size")||"auto,auto").split(",");let h="";if(/auto|%$/.test(a[0])&&!l)"auto"===a[0]&&"auto"===a[1]?this._setAutoSize():this._setPercentSize(a[0],a[1]);else{const t=xi.GetContainer(r),n=t.cover||t.inlineCover,o=e||r.offsetWidth,a=i||r.offsetHeight,c=(l?a:o)+"px",d=(l?o:a)+"px";if(this._deletePercentSize(),this._applySize(o+"px",a+"px",""),n.style.width=c,n.style.height=t.caption||t.inlineCover?"":d,l){h=90===s||-270===s?a/2+"px "+a/2+"px 0":o/2+"px "+o/2+"px 0"}}r.style.transformOrigin=h,this._setRotate(r,s,n.x,n.y),r.style.maxWidth=l?"none":"",this._setCaptionPosition(r)}finally{this.__preventSizechange=!1}}_setFigureInfo(t){this._inlineCover=t.inlineCover,this._cover=t.cover||this._inlineCover,this._container=t.container,this._caption=t.caption,this._element=t.target,this.align=(this._container.className.match(/(?:^|\s)__se__float-(none|left|center|right)(?:$|\s)/)||[])[1]||t.target.style.float||"none",this.as=this._inlineCover?"inline":"block",this.isVertical=/^(90|270)$/.test(Math.abs(this.#x(t.target).r).toString())}_setRotate(t,e,i,s){let n=(t.offsetWidth-t.offsetHeight)*(/^-/.test(e+"")?1:-1),o="";if(/[1-9]/.test(e+"")&&(i||s))switch(o=i?"Y":"X",e+""){case"90":o=i&&s?"X":s?o:"";break;case"270":n*=-1,o=i&&s?"Y":i?o:"";break;case"-90":o=i&&s?"Y":i?o:"";break;case"-270":n*=-1,o=i&&s?"X":s?o:"";break;default:o=""}e%180==0&&(t.style.maxWidth=""),t.style.transform="rotate("+e+"deg)"+(i?" rotateX("+i+"deg)":"")+(s?" rotateY("+s+"deg)":"")+(o?" translate"+o+"("+n+"px)":"")}_applySize(t,e,i){const s=/^(rw|lw)$/.test(i)&&/\d+/.test(this._element.style.height),n=/^(th|bh)$/.test(i)&&/\d+/.test(this._element.style.width);e=e||(this.autoRatio?this.autoRatio.current||this.autoRatio.default:e),t=mt.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||s||n||this._deletePercentSize();const o=this._cover||this._element;this.autoRatio&&(this._cover.style.width=t),n||(o.style.width=this._element.style.width=t),s||(e=mt.is(e)?e+this.sizeUnit:e,o.style.height=this._element.style.height=this.autoRatio&&!this.isVertical?"100%":e,this.autoRatio&&(this._cover.style.height=e,this.__setCoverPaddingBottom(t,e))),"center"===this.align&&this.setAlign(this._element,this.align),this._saveCurrentSize()}__setCoverPaddingBottom(t,e){this._inlineCover!==this._cover&&(this._cover.style.height=e,/%$/.test(t)&&"center"===this.align?this._cover.style.paddingBottom=/%$/.test(e)?mt.get(mt.get(e,2)/100*mt.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this._deletePercentSize(),this.autoRatio?this._setPercentSize("100%",this.autoRatio.current||this.autoRatio.default):(this._element.style.maxWidth="",this._element.style.width="",this._element.style.height="",this._cover.style.width="",this._cover.style.height=""),this.setAlign(this._element,this.align),this._saveCurrentSize()}_setPercentSize(t,e){e||(e=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e),e=!e||/%$/.test(e+"")||mt.get(e,0)?mt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):mt.is(e)?e+"%":e;const i=/%$/.test(e+"");this._container.style.width=String(mt.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.options.get("strictMode").formatFilter?(this._inlineCover!==this._cover&&(this._cover.style.width="100%",this._cover.style.height=String(e)),this._element.style.width="100%",this._element.style.maxWidth="",this._element.style.height=String(this.autoRatio?"100%":i?"":e),"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(String(t),String(e)),this._setCaptionPosition(this._element),this._saveCurrentSize()):this._saveCurrentSize()}_deletePercentSize(){this._cover.style.width="",this._cover.style.height="",this._container.style.width="",this._container.style.height="",gt.utils.removeClass(this._container,this._floatClassStr),gt.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setSize(this.__revertSize.w,this.__revertSize.h)}_setAlignIcon(){this.alignButton&>.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}_setAsIcon(){this.asButton&>.utils.changeElement(this.asButton.firstElementChild,this.icons[`as_${this.as}`])}_saveCurrentSize(){if(this.__preventSizechange)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.__revertSize.w=t[0],this.__revertSize.h=t[1];const e=this.getSize(this._element);this._element.setAttribute("width",e.w.replace("px","")),this._element.setAttribute("height",e.h.replace("px","")),this._element.setAttribute("data-se-size",e.w+","+e.h),this.autoRatio&&(this.autoRatio.current=/%$/.test(e.h)?e.h:"")}_setCaptionPosition(t){const e=gt.query.getEdgeChild(gt.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop=(this.isVertical?t.offsetWidth-t.offsetHeight:0)+"px")}_deleteCaptionPosition(t){const e=gt.query.getEdgeChild(gt.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}_displayResizeHandles(t){const e=t?"flex":"none";this.controller.form.style.display=e;const i=this.editor.frameContext.get("_figure"),s=i.handles;for(let t=0,i=s.length;t<i;t++)s[t].style.display=e;"none"===e?(gt.utils.addClass(i.main,"se-resize-ing"),this.__onResizeESCEvent=this.eventManager.addGlobalEvent("keydown",this.__containerResizingESC)):gt.utils.removeClass(i.main,"se-resize-ing")}_offResizeEvent(){this.component._removeDragEvent(),this.eventManager.removeGlobalEvent(this.__onContainerEvent),this.eventManager.removeGlobalEvent(this.__offContainerEvent),this.eventManager.removeGlobalEvent(this.__onResizeESCEvent),this._displayResizeHandles(!0),this.ui._offCurrentController(),this.ui.disableBackWrapper()}_setDragEvent(t){const e=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");gt.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",oe.set("__dragHandler",e),oe.set("__dragContainer",this._container),oe.set("__dragCover",this._cover),oe.set("__dragMove",this.#k.bind(this,e,t)),oe.get("__dragMove")(),e.style.display="block"}#k(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+"px"}#w(t){t.stopPropagation(),t.preventDefault();const e=gt.query.getEventTarget(t),i=oe.get("__figureInst"),s=i._resize_direction=e.classList[0];i._resizeClientX=t.clientX,i._resizeClientY=t.clientY,i.editor.frameContext.get("_figure").main.style.float=/l/.test(s)?"right":/r/.test(s)?"left":"none",this.ui.enableBackWrapper(bi[s]);const{w:n,h:o}=this.getSize(i._element);if(yi=vi=!1,Ci=wi=0,!this.isVertical){const t=!n||/auto|%$/.test(n),e=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(s)&&t&&e?yi=!0:"lw|rw".includes(s)&&t&&(vi=!0),yi||vi){const t=i._cover||i._element;wi=t.offsetWidth,Ci=pt.getWidthInPercentage(t,this.editor.frameContext.get("wysiwygFrame"))/100}}i.__onContainerEvent=i.eventManager.addGlobalEvent("mousemove",i.__containerResizing),i.__offContainerEvent=i.eventManager.addGlobalEvent("mouseup",i.__containerResizingOff),i._displayResizeHandles(!1);const l=this.editor.frameContext.get("_figure").display;l.style.display="block",gt.utils.changeTxt(l,n+" x "+o)}#f(t){const e=this._resize_direction,i=t.clientX,s=t.clientY;let n=this._element_w,o=this._element_h;const l=n+(/r/.test(e)?i-this._resizeClientX:this._resizeClientX-i),r=o+(/b/.test(e)?s-this._resizeClientY:this._resizeClientY-s),a=o/n*l,h=this.editor.frameContext.get("_figure").border;/t/.test(e)&&(h.style.top=o-(/h/.test(e)?r:a)+"px"),/l/.test(e)&&(h.style.left=n-l+"px"),/r|l/.test(e)&&(h.style.width=l+"px",n=l),/^(t|b)[^h]$/.test(e)?(h.style.height=a+"px",o=a):/^(t|b)h$/.test(e)&&(h.style.height=r+"px",o=r),this._resize_w=/h$/.test(e)?this._width:Math.round(n),this._resize_h=/w$/.test(e)?this._height:Math.round(o);const c=Ci?this._resize_w/wi*Ci*100:this._resize_w;gt.utils.changeTxt(this.editor.frameContext.get("_figure").display,Ci?mt.get(c>100?100:c,2).toFixed(2)+"%":c+" x "+this._resize_h)}#_(){this._offResizeEvent();let t=this.isVertical?this._resize_h:this._resize_w,e=this.isVertical?this._resize_w:this._resize_h;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const i=this.editor.frameContext.get("wysiwygFrame").clientWidth-mt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+mt.get(this.editor.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;mt.get(t,0)>i&&(e=Math.round(e/t*i),t=i)}if(yi||vi){t=t/(this._cover||this._element).offsetWidth*Ci*100;const e=mt.get(t>100?100:t,2)+"%";this._setPercentSize(e,vi?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.history.push(!1),this.component.select(this._element,this.kind)}#b(t){ft.isEsc(t.code)&&(this._offResizeEvent(),this.component.select(this._element,this.kind))}#u(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.component.select(this._element,this.kind)}#p(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}#g(t){if("auto"===t)this.deleteTransform(),this._setAutoSize();else{let e=this.getSize(this._element).h;if(this.isVertical){const t=(this._element.getAttribute("data-se-size")||",").split(",");t[1]&&(e=t[1])}this.deleteTransform(),this._setPercentSize(1*t,null!==mt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.component.select(this._element,this.kind)}#m(){this.editor.frameContext.get("_figure").main.style.display="none",this.editor._figureContainer=null}#y(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#v(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#C(){const t=this.getSize(this._element),e=t.w,i=t.h;let s="";if(this.autoRatio){if(i===this.autoRatio.default&&/%$/.test(e)){const t=mt.get(e);s=100===t?"auto":"resize_percent"+t}}else"auto"===i&&("auto"===e?s="auto":/%$/.test(e)&&(s="resize_percent"+mt.get(e)));this.selectMenu_resize.open("",'[data-command="'+s+'"]')}#x(t){const e=t.style.transform;return e?{r:Number((e.match(/rotate\(([-0-9]+)deg\)/)||[])[1]||0),x:(e.match(/rotateX\(([-0-9]+)deg\)/)||[])[1]||"",y:(e.match(/rotateY\(([-0-9]+)deg\)/)||[])[1]||""}:{r:0,x:"",y:""}}}function ki(t){const e=t.split("_"),i=e[0],s=e[1];let n,o,l,r;switch(i){case"resize":n="onresize",o=s,l="resize",r="resize";break;case"auto":n="auto",l="autoSize",r="auto_size";break;case"rotate":n="rotate",o="l"===s?-90:"r"===s?90:mt.get(s),l=o<0?"rotateLeft":"rotateRight",r=o<0?"rotate_left":"rotate_right";break;case"mirror":n="mirror",o=s,l="h"===s?"mirrorHorizontal":"mirrorVertical",r="h"===s?"mirror_horizontal":"mirror_vertical";break;case"align":n="onalign",l="align",r="align_justify";break;case"caption":n="caption",l="caption",r="caption";break;case"revert":n="revert",l="revert",r="revert";break;case"edit":n="edit",l="edit",r="edit";break;case"as":n="onas",l="blockStyle",r="as_block";break;case"copy":n="copy",l="copy",r="copy";break;case"remove":n="remove",l="remove",r="delete"}return n?{c:n,v:o,l,t:undefined,i:r}:null}const Si=xi,{_w:Ei,ON_OVER_COMPONENT:Ti,isMobile:Hi}=dt,Mi=/^Arrow(Left|Up|Right|Down)$/,Li=/^Arrow(Left|Up)$/;function Ni(t){ne.call(this,t),this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.__globalEvents={copy:zi.bind(this),cut:$i.bind(this),keydown:Fi.bind(this),mousedown:Ri.bind(this)},this._bindClose_copy=null,this._bindClose_cut=null,this._bindClose_keydown=null,this._bindClose_mousedown=null,this._bindClose_touchstart=null,this.__selectionSelected=!1,this.__prevent=!1,this.editor.applyFrameRoots((t=>{const e=gt.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.icons.selection);t.get("wrapper").appendChild(e),this.eventManager.addEvent(e,"mouseenter",Ai.bind(this)),this.eventManager.addEvent(e,"mouseleave",Bi.bind(this)),this.eventManager.addEvent(e,"dragstart",Ii.bind(this)),this.eventManager.addEvent(e,"dragend",Vi.bind(this)),this.eventManager.addEvent(e,"click",Oi.bind(this))}))}function Ai(){this.editor._preventBlur=!0,this.ui._visibleControllers(!1,gt.utils.hasClass(oe.get("__dragHandler"),"se-drag-handle-full")),gt.utils.addClass(oe.get("__dragCover")||oe.get("__dragContainer"),"se-drag-over")}function Bi(){this.editor._preventBlur=!1,gt.utils.hasClass(oe.get("__dragHandler"),"se-drag-handle-full")||this.ui._visibleControllers(!0,!0),gt.utils.removeClass([oe.get("__dragCover"),oe.get("__dragContainer")],"se-drag-over")}function Ii(t){const e=oe.get("__dragCover")||oe.get("__dragContainer");e?(this.editor._preventBlur=!1,gt.utils.addClass(oe.get("__dragHandler"),"se-dragging"),gt.utils.addClass(oe.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.options.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}function Vi(){this.editor._preventBlur=!1,gt.utils.removeClass([oe.get("__dragHandler"),oe.get("__dragContainer")],"se-dragging"),this._removeDragEvent()}function Oi(t){const e=gt.query.getEventTarget(t);if(!gt.utils.hasClass(e,"se-drag-handle-full"))return;const i=oe.get("__dragInst");this._removeDragEvent(),this.select(i.currentTarget,i.currentPluginName)}function Ri(t){const e=gt.query.getEventTarget(t);this.currentTarget?.contains(e)||gt.query.getParentElement(e,".se-controller")||gt.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.editor.currentControllerName&&this.editor.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}function zi(t){const e=gt.query.getEventTarget(t);if(gt.check.isInputElement(e)&>.query.getParentElement(e,".se-modal"))return;const i=this.info;if(!i)return;const s=i.container.cloneNode(!0);gt.utils.removeClass(s,"se-component-selected"),"function"==typeof this.plugins[i.pluginName]?.onCopyComponent&&!1!==this.plugins[i.pluginName].onCopyComponent({event:t,cloneContainer:s,info:i})||Pi(t,s,t.clipboardData),gt.utils.flashClass(i.container,"se-copy")}function $i(t){const e=this.info;if(!e)return;const i=e.container.cloneNode(!0);gt.utils.removeClass(i,"se-component-selected"),Pi(t,i,t.clipboardData),this.deselect(),gt.utils.removeItem(e.container)}async function Fi(t){if(this.editor.selectMenuOn)return;const e=t.code;if(ft.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const i=this.editor.shortcutsKeyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(i?.c)&&(t.preventDefault(),t.stopPropagation(),this.editor.run(i.c,i.t,i.e))}}else{if(ft.isRemoveKey(e)&&(t.preventDefault(),t.stopPropagation(),"function"==typeof this.currentPlugin?.destroy))return await this.currentPlugin.destroy(this.currentTarget),this.deselect(),void this.editor.focus();if(ft.isEnter(e)){t.preventDefault();const e=this.currentInfo||this.get(this.currentTarget),i=e.container||e.target,s=i.previousElementSibling||i.nextElementSibling;let n=null;n=gt.check.isListCell(i.parentNode)?gt.utils.createElement("BR"):gt.utils.createElement(this.format.isLine(s)?s.nodeName:this.options.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),i.parentNode.insertBefore(n,i),!1===this.select(e.target,o)&&this.editor.blur(),void this.history.push(!1)}if(Mi.test(e)){const{container:i}=this.get(this.currentTarget);let s=null,n=1;if(this.isInline(i||this.currentTarget))switch(e){case"ArrowLeft":s=i.previousSibling,n=3===s?.nodeType?s.textContent.length:1;break;case"ArrowRight":s=i.nextSibling,n=0;break;case"ArrowUp":{const t=this.format.getLine(i,null);s=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.format.getLine(i,null);s=t?.nextElementSibling;break}}else Li.test(e)?s=i.previousElementSibling:(s=i.nextElementSibling,n=0);if(!s)return;this.deselect();const o=this.get(s);if(o?.container)t.stopPropagation(),t.preventDefault(),this.select(o.target,o.pluginName);else try{this.editor._preventBlur=!0,t.stopPropagation(),t.preventDefault(),this.selection.setRange(s,n,s,n)}finally{this.editor._preventBlur=!1}}else ft.isEsc(e)&&this.deselect()}}function Pi(t,e,i){t.preventDefault(),t.stopPropagation(),e.querySelectorAll(".se-figure-selected").forEach((t=>gt.utils.removeClass(t,"se-figure-selected"))),i.setData("text/html",e.outerHTML)}Ni.prototype={insert(t,{skipCharCount:e,skipSelection:i,skipHistory:s}={}){if(this.editor.frameContext.get("isReadOnly")||!e&&!this.char.check(t))return null;const n=this.html.remove(),o=this.isInline(t);this.selection.getRangeAndAddLine(this.selection.getRange(),n.container);const l=this.selection.getNode();let r=null,a=this.format.getLine(l,null);if(gt.check.isListCell(a))this.html.insertNode(t,{afterNode:o||l===a?null:n.container.nextSibling,skipCharCount:!0}),o||t.nextSibling||t.parentNode.appendChild(gt.utils.createElement("BR"));else{if(!o&&this.selection.getRange().collapsed&&(3===n.container.nodeType||gt.check.isBreak(n.container))){const t=gt.query.getParentElement(n.container,this.format.isBlock.bind(this.format));r=this.nodeTransform.split(n.container,n.offset,t?gt.query.getNodeDepth(t)+1:0),r&&(a=r.previousSibling)}this.html.insertNode(t,{afterNode:o||this.format.isBlock(a)?null:a,skipCharCount:!0}),!o&&a&>.check.isZeroWidth(a)&>.utils.removeItem(a)}if(o){const e=gt.utils.createTextNode(ut.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}if(s||this.history.push(!1),!i){this.selection.setRange(t,0,t,0);const e=this.get(t);e?this.select(e.target,e.pluginName):r&&(r=gt.query.getEdgeChildNodes(r,null).sc||r,this.selection.setRange(r,0,r,0))}return this.editor.frameContext.has("documentType-use-header")&&this.editor.frameContext.get("documentType").reHeader(),r||t},get(t){if(!t)return null;let e,i="",s={},n=!1,o=null;if(this.is(t)){if(gt.utils.hasClass(t,"se-component")&&!gt.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!n)return null;e=n.target,i=n.pluginName,s=n.options,o=n.launcher}if(!e&&t.nodeName){this.__isFiles(t)&&(n=!0);const l=this.editor._componentManager.map((e=>e(t))).find((t=>t));if(!l)return null;e=l.target,i=l.pluginName,s=l.options,o=l.launcher}if(!e)return null;const l=Si.GetContainer(e),r=l.container||l.cover||e;return this.info={target:e,pluginName:i,options:s,container:r,cover:l.cover,inlineCover:l.inlineCover,caption:l.caption,isFile:n,launcher:o,isInputType:gt.utils.hasClass(r,"se-input-component")}},select(t,e,{isInput:i=!1}={}){const s=this.get(t);if(!s||gt.check.isUneditable(gt.query.getParentElement(t,this.is.bind(this)))||gt.check.isUneditable(t))return!1;const n=s.launcher||this.plugins[e];if(!n)return;const o=oe.get("__overInfo")!==Ti;if(!i&&o){if(this.editor.status._onMousedown)return;this.editor._preventBlur=!0,this.__selectionSelected=!0,this.isInline(s.container)&&this.selection.setRange(s.container,0,s.container,0),this.editor.blur(),Ei.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.select&&(l=n.select(t));const r=gt.utils.hasClass(s.target,"se-component-line-break");(r||!l&&!gt.utils.hasClass(s.container,"se-inline-component"))&&this._setComponentLineBreaker(s.container||s.cover||t),this.currentTarget=t,this.currentPlugin=n,this.currentPluginName=e,this.currentInfo=s,oe.set("__dragInst",this);const a=oe.get("__overInfo");if(Ei.setTimeout((()=>{oe.set("__overInfo",a===Ti&&void 0),a!==Ti&&this.__addGlobalEvent(),s.isFile||this.__addNotFileGlobalEvent()}),0),pt.debounce((()=>{gt.utils.addClass(s.container,"se-component-selected")}),0)(),!o||this.status.hasFocus||this.editor._preventFocus||(this.eventManager.__postFocusEvent(this.editor.frameContext,null),this.editor._preventFocus=!0),r||a===Ti){if(r||!gt.utils.hasClass(s.container,"se-input-component")){const t=this.editor.frameContext.get("wrapper").querySelector(".se-drag-handle");gt.utils.addClass(t,"se-drag-handle-full"),this.ui._visibleControllers(!1,!1);const e=s.caption?s.target:s.cover||s.container||s.target,i=e.offsetWidth,n=e.offsetHeight,{top:o,left:l}=this.offset.getLocal(e);t.style.opacity=0,t.style.width=i+"px",t.style.height=n+"px",t.style.top=o+"px",t.style.left=l+"px",oe.set("__dragHandler",t),oe.set("__dragContainer",s.container),oe.set("__dragCover",s.cover),t.style.display="block"}}else{if(!this.isInline(s.container))return;const t=s.container;let e=null;t.previousSibling&&!gt.check.isBreak(t.previousSibling)||(e=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!gt.check.isBreak(t.nextSibling)||(e=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.editor.status.onSelected=!0}},deselect(){Ei.setTimeout((()=>{this.editor.status.onSelected=!1}),0),this.__deselect(),this.ui.setControllerOnDisabledButtons(!1),!this.editor._preventFocus||this.status.hasFocus||this.__prevent||(this.eventManager.__postBlurEvent(this.editor.frameContext,null),this.editor._preventFocus=!1)},is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!gt.utils.hasClass(t,"se-component"))||!!this.editor._componentManager.find((e=>e(t))))},isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),gt.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.editor._componentManager.find((e=>e(t)))||!gt.utils.hasClass(t,"se-inline-component"))},isBasic(t){return this.is(t)&&!this.isInline(t)},copy(t){const e=gt.utils.clone(t,!0);gt.utils.removeClass(e,"se-component-selected"),gt.utils.removeClass(e.querySelectorAll(".se-figure-selected"),"se-figure-selected"),gt.utils.removeClass(e.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),gt.utils.removeClass(e.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus"),this.html.copy(e),gt.utils.flashClass(t,"se-copy")},__isFiles(t){const e=t.nodeName.toLowerCase();return this.editor._fileManager.regExp.test(e)&&(!this.editor._fileManager.tagAttrs[e]||this.editor._fileManager.tagAttrs[e]?.every((e=>t.hasAttribute(e))))},__deselect(){if(this.editor._preventBlur=!1,oe.set("__overInfo",null),this._removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;pt.debounce((()=>{gt.utils.removeClass(t,"se-component-selected"),gt.utils.removeClass(e,"se-figure-over-selected")}),0)()}const{frameContext:t}=this.editor;t.get("lineBreaker_t").style.display=t.get("lineBreaker_b").style.display="none",this.currentPlugin&&"function"==typeof this.currentPlugin.deselect&&this.currentPlugin.deselect(this.currentTarget),this.isSelected=!1,this.currentPlugin=null,this.currentTarget=null,this.currentPluginName="",this.currentInfo=null,this.__removeGlobalEvent(),this.ui.__offControllers()},_setComponentLineBreaker(t){const e=oe.get("__overInfo")===Ti;this.eventManager._lineBreakComp=null;const i=this.get(t);if(!i)return;const s=this.editor.frameContext,n=i.container,o=gt.utils.hasClass(n,"se-flex-component"),l=s.get("lineBreaker_t"),r=s.get("lineBreaker_b"),a=l.style,h=r.style,c=n.offsetWidth<t.offsetWidth?n:t,d="block"===this.editor._figureContainer?.style.display?this.editor._figureContainer:c,u=gt.check.isListCell(n.parentNode);let p,g;const m=this.options.get("_rtl"),f=m?["right","left"]:["left","right"],{top:_,left:b,right:y,scrollX:v,scrollY:C}=this.offset.getLocal(c),w=m?y:b;if(u?n.previousSibling:this.format.isLine(n.previousElementSibling))a.display="none";else{const t=Ei.getComputedStyle(l),i=mt.get(t.height,1),s=mt.get(t.width,1);this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2,a.top=p-C-i/2+"px",a[f[0]]=(o?w-s/2:w+g)+"px",a[f[1]]="",l.setAttribute("data-offset",C+","+v),e?gt.utils.removeClass(l,"se-on-selected"):gt.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}if(u?n.nextSibling:this.format.isLine(n.nextElementSibling))h.display="none";else{const t=Ei.getComputedStyle(r),i=mt.get(t.height,1),s=mt.get(t.width,1);p||(this.eventManager._lineBreakComp=n,p=_,g=d.offsetWidth/2/2),h.top=p+d.offsetHeight-C-i/2+"px",h[f[0]]=w+d.offsetWidth-(o?0:g)-(o?s/2:s)+"px",h[f[1]]="",r.setAttribute("data-offset",C+","+f[0]+","+v),e?gt.utils.removeClass(r,"se-on-selected"):gt.utils.addClass(r,"se-on-selected"),h.display="block",h.visibility=""}},__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose_copy=this.eventManager.addGlobalEvent("copy",this.__globalEvents.copy),this._bindClose_cut=this.eventManager.addGlobalEvent("cut",this.__globalEvents.cut),this._bindClose_keydown=this.eventManager.addGlobalEvent("keydown",this.__globalEvents.keydown)},__removeGlobalEvent(){this.__removeNotFileGlobalEvent(),this._bindClose_copy&&(this._bindClose_copy=this.eventManager.removeGlobalEvent(this._bindClose_copy)),this._bindClose_cut&&(this._bindClose_cut=this.eventManager.removeGlobalEvent(this._bindClose_cut)),this._bindClose_keydown&&(this._bindClose_keydown=this.eventManager.removeGlobalEvent(this._bindClose_keydown))},__addNotFileGlobalEvent(){this.__removeNotFileGlobalEvent(),Hi?this._bindClose_touchstart=this.eventManager.addGlobalEvent("touchstart",this.__globalEvents.mousedown,!0):this._bindClose_mousedown=this.eventManager.addGlobalEvent("mousedown",this.__globalEvents.mousedown,!0)},__removeNotFileGlobalEvent(){this._bindClose_mousedown&&(this._bindClose_mousedown=this.eventManager.removeGlobalEvent(this._bindClose_mousedown)),this._bindClose_touchstart&&(this._bindClose_touchstart=this.eventManager.removeGlobalEvent(this._bindClose_touchstart))},_removeDragEvent(){this.carrierWrapper.querySelector(".se-drag-cursor").style.left="-10000px",oe.get("__dragHandler")&&(oe.get("__dragHandler").style.display="none"),gt.utils.removeClass([oe.get("__dragHandler"),oe.get("__dragContainer")],"se-dragging"),gt.utils.removeClass([oe.get("__dragCover"),oe.get("__dragContainer")],"se-drag-over"),oe.set("__figureInst",null),oe.set("__dragInst",null),oe.set("__dragHandler",null),oe.set("__dragContainer",null),oe.set("__dragCover",null),oe.set("__dragMove",null),oe.set("__overInfo",null)},constructor:Ni};const Di=Ni;function qi(t){ne.call(this,t),this._listCamel=this.options.get("__listCommonStyle"),this._listKebab=pt.camelToKebabCase(this.options.get("__listCommonStyle")),this._formatLineCheck=this.options.get("formatLine").reg,this._formatBrLineCheck=this.options.get("formatBrLine").reg,this._formatBlockCheck=this.options.get("formatBlock").reg,this._formatClosureBlockCheck=this.options.get("formatClosureBlock").reg,this._formatClosureBrLineCheck=this.options.get("formatClosureBrLine").reg,this._textStyleTagsCheck=new RegExp("^("+this.options.get("textStyleTags")+")$","i"),this._brLineBreak=null,this.__resetBrLineBreak(this.options.get("defaultLineBreakFormat"))}function Wi(t){const e=t.parentNode;let i,s,n,o,l,r=e.parentNode,a=e;for(;gt.check.isListCell(r);){for(o=gt.query.getPositionIndex(t),i=r.nextElementSibling,s=r.parentNode,n=a;n;){if(a=a.nextSibling,gt.check.isList(n)){for(l=n.childNodes;l[o];)s.insertBefore(l[o],i);0===l.length&>.utils.removeItem(n)}else s.appendChild(n);n=a}r=s.parentNode}return 0===e.children.length&>.utils.removeItem(e),s}function Ui(t,e,i){const s=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],gt.check.isListCell(n)?(e<0||n.previousElementSibling)&&s.push(n):(o=/\d+/.test(n.style[i])?mt.get(n.style[i],0):0,o+=e,gt.utils.setStyle(n,i,o<=0?"":o+"px"));return s}function Gi(t){const e=t.parentNode;if(!t||3===t.nodeType||!e)return;const i=t.childNodes;for(;i[0];)e.insertBefore(i[0],t);e.removeChild(t)}qi.prototype={setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this._lineWork(),i=e.lines,s=t.className,n=t.nodeName;let o=e.firstNode,l=e.lastNode;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],e.nodeName===n&&(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()===s||this.component.is(e)||(r=t.cloneNode(!1),gt.utils.copyFormatAttributes(r,e),r.innerHTML=e.innerHTML,e.parentNode.replaceChild(r,e)),0===a&&(o=r||e),a===h-1&&(l=r||e),r=null;this.selection.setRange(gt.query.getNodeFromPath(e.firstPath,o),e.startOffset,gt.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.history.push(!1),this.editor.frameContext.has("documentType-use-header")&&this.editor.frameContext.get("documentType").reHeader()},getLine(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(gt.check.isWysiwygFrame(t))return null;if(this.isBlock(t))return t.firstElementChild;if(this.isLine(t)&&e(t))return t;t=t.parentNode}return null},setBrLine(t){if(!this.isBrLine(t))throw new Error('[SUNEDITOR.format.setBrLine.fail] The "element" must satisfy "format.isBrLine()".');const e=this._lineWork().lines,i=e.length-1;let s=e[i].parentNode,n=t.cloneNode(!1);const o=n;for(let o,l,r,a,h,c,d=i,u=!0;d>=0;d--)if(o=e[d],o!==(e[d+1]?e[d+1].parentNode:null)){if(c=this.component.is(o),l=c?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=gt.query.getParentElement(o,(t=>t.parentNode===s)),(s!==o.parentNode||c)&&(this.isLine(s)?(s.parentNode.insertBefore(n,s.nextSibling),s=s.parentNode):(s.insertBefore(n,r?r.nextSibling:null),s=o.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&>.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,gt.utils.removeItem(a)),n=t.cloneNode(!1),u=!0),h=n.innerHTML,n.innerHTML=(u||!l||!h||/<br>$/i.test(l)?l:l+"<BR>")+h,0===d){s.insertBefore(n,o),a=o.nextSibling,a&&n.nodeName===a.nodeName&>.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,gt.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&>.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,gt.utils.removeItem(n))}c||gt.utils.removeItem(o),l&&(u=!1)}this.selection.setRange(o,0,o,0),this.history.push(!1)},getBrLine(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(gt.check.isWysiwygFrame(t))return null;if(this.isBrLine(t)&&e(t))return t;t=t.parentNode}return null},addLine(t,e){if(!t||!t.parentNode)return null;const i=this.getLine(this.selection.getNode(),null);let s=null;if(this.isBrLine(t)||!this.isBrLine(i||t.parentNode)||this.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isLineOnly(i)?i.nodeName:this.options.get("defaultLine");s=gt.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(i))&>.utils.copyTagAttributes(s,e||i,["id"])}else s=gt.utils.createElement("BR");return gt.check.isTableCell(t)?t.insertBefore(s,t.nextElementSibling):t.parentNode.insertBefore(s,t.nextElementSibling),s},getBlock(t,e){if(!t)return null;for(e||(e=function(){return!0});t;){if(gt.check.isWysiwygFrame(t))return null;if(this.isBlock(t)&&!/^(THEAD|TBODY|TR)$/i.test(t.nodeName)&&e(t))return t;t=t.parentNode}return null},applyBlock(t){this.selection.getRangeAndAddLine(this.selection.getRange(),null);const e=this.getLinesAndComponents(!1);if(!e||0===e.length)return;t:for(let t,i,s,n,o,l,r=0,a=e.length;r<a;r++)if(t=e[r],gt.check.isListCell(t))if(i=t.lastElementChild,i&>.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=i.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(gt.check.isList(t)){if(!e.includes(t.lastElementChild))continue t;n=t.lastElementChild}s=i.firstElementChild,o=e.indexOf(s),l=e.indexOf(n),e.splice(o,l-o+1),a=e.length}else;const i=e[e.length-1];let s,n,o;s=this.isBlock(i)||this.isLine(i)?i:this.getBlock(i,null)||this.getLine(i,null),gt.check.isTableCell(s)?(n=null,o=s):(n=s.nextSibling,o=s.parentNode);const l=t.cloneNode(!1);let r=gt.query.getNodeDepth(s),a=null;const h=[],c=(t,e,i)=>{let s=null;if(t!==e&&!gt.check.isTableElements(e)){if(e&>.query.getNodeDepth(t)===gt.query.getNodeDepth(e))return i;s=this.nodeTransform.removeAllParents(e,null,t)}return s?s.ec:i};for(let t,i,s,d,u,p,g,m=0,f=e.length;m<f;m++)if(t=e[m],i=t.parentNode,i&&!l.contains(i))if(s=gt.query.getNodeDepth(t),gt.check.isList(i)){if(null===a&&(p?(a=p,g=!0,p=null):a=i.cloneNode(!1)),h.push(t),u=e[m+1],m===f-1||u?.parentNode!==i){t.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=i.parentNode;for(;gt.check.isList(m);)e=gt.utils.createElement(m.nodeName),e.appendChild(a),a=e,m=m.parentNode;const f=this.removeBlock(i,{selectedFormats:h,newBlockElement:null,shouldDelete:!0,skipHistory:!0});r>=s?(r=s,o=f.cc,n=c(o,i,f.ec),n&&(o=n.parentNode)):o===f.cc&&(n=f.ec),o!==f.cc&&(d=c(o,f.cc,d),n=void 0!==d?d:f.cc);for(let t=0,e=f.removeArray.length;t<e;t++)a.appendChild(f.removeArray[t]);g||l.appendChild(a),p&&f.removeArray[f.removeArray.length-1].appendChild(p),a=null,g=!1}}else r>=s&&(r=s,o=i,n=t.nextSibling),l.appendChild(t),o!==i&&(d=c(o,i),void 0!==d&&(n=d));if(this.editor.effectNode=null,this.nodeTransform.mergeSameTags(l,null,!1),this.nodeTransform.mergeNestedTags(l,(t=>gt.check.isList(t))),n&>.query.getNodeDepth(n)>0&&(gt.check.isList(n.parentNode)||gt.check.isList(n.parentNode.parentNode))){const t=gt.query.getParentElement(n,(t=>this.isBlock(t)&&!gt.check.isList(t))),e=this.nodeTransform.split(n,null,t?gt.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),c(l,n);const d=gt.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.history.push(!1)},removeBlock(t,{selectedFormats:e,newBlockElement:i,shouldDelete:s,skipHistory:n}={}){const o=this.selection.getRange();let l=o.startOffset,r=o.endOffset,a=gt.query.getListChildNodes(t,(e=>e.parentNode===t)),h=t.parentNode,c=null,d=null,u=t.cloneNode(!1);const p=[],g=gt.check.isList(i);let m=!1,f=!1,_=!1;const b=(e,i,s,n)=>{if(gt.check.isZeroWidth(i)&&(i.innerHTML=ut.zeroWidthSpace,l=r=1),3===i.nodeType)return e.insertBefore(i,s),i;const o=(_?i:n).childNodes;let a=i.cloneNode(!1),h=null,c=null;for(;o[0];)c=o[0],!this._notTextNode(c)||gt.check.isBreak(c)||gt.check.isListCell(a)?a.appendChild(c):(a.childNodes.length>0&&(h||(h=a),e.insertBefore(a,s),a=i.cloneNode(!1)),e.insertBefore(c,s),h||(h=c));if(a.childNodes.length>0){if(gt.check.isListCell(e)&>.check.isListCell(a)&>.check.isList(s))if(g){for(h=s;s;)a.appendChild(s),s=s.nextSibling;e.parentNode.insertBefore(a,e.nextElementSibling)}else{const e=n.nextElementSibling,i=this._removeNestedList(n,!1);if(t!==i||e!==n.nextElementSibling){const e=a.childNodes;for(;e[0];)n.appendChild(e[0]);t=i,f=!0}}else e.insertBefore(a,s);h||(h=a)}return h};for(let n,o,l,r=0,y=a.length;r<y;r++)if(n=a[r],3!==n.nodeType||!gt.check.isList(u))if(_=!1,s&&0===r&&(c=e&&e.length!==y&&e[0]!==n?u:t.previousSibling),e&&(o=e.indexOf(n)),e&&-1===o)u||(u=t.cloneNode(!1)),u.appendChild(n);else{if(e&&(l=e[o+1]),u&&u.children.length>0&&(h.insertBefore(u,t),u=null),!g&>.check.isListCell(n))if(l&>.query.getNodeDepth(n)!==gt.query.getNodeDepth(l)&&(gt.check.isListCell(h)||gt.utils.arrayFind(n.children,gt.check.isList))){const e=n.nextElementSibling,i=this._removeNestedList(n,!1);t===i&&e===n.nextElementSibling||(t=i,f=!0)}else{const e=n;n=gt.utils.createElement(s?e.nodeName:gt.check.isList(t.parentNode)||gt.check.isListCell(t.parentNode)?"LI":gt.check.isTableCell(t.parentNode)?"DIV":this.options.get("defaultLine"));const i=gt.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!gt.check.isList(o[0])||i);)n.appendChild(o[0]);gt.utils.copyFormatAttributes(n,e),_=!0}else n=n.cloneNode(!1);if(!f&&(s?(p.push(n),gt.utils.removeItem(a[r])):(i?(m||(h.insertBefore(i,t),m=!0),n=b(i,n,null,a[r])):n=b(h,n,t,a[r]),f||(e?(d=n,c||(c=n)):c||(c=d=n))),f)){f=_=!1,a=gt.query.getListChildNodes(t,(e=>e.parentNode===t)),u=t.cloneNode(!1),h=t.parentNode,r=-1,y=a.length;continue}}const y=t.parentNode;let v=t.nextSibling;u?.children.length>0&&y.insertBefore(u,v),i?c=i.previousSibling:c||(c=t.previousSibling),v=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?gt.utils.removeItem(t):this.nodeTransform.removeEmptyNode(t,null,!1);let C=null;if(s)C={cc:y,sc:c,so:l,ec:v,eo:r,removeArray:p};else{c||(c=d),d||(d=c);const t=gt.query.getEdgeChildNodes(c,d.parentNode?c:d);C={cc:(t.sc||t.ec).parentNode,sc:t.sc,so:l,ec:t.ec,eo:r,removeArray:null}}if(this.editor.effectNode=null,n)return C;!s&&C&&(e?this.selection.setRange(C.sc,l,C.ec,r):this.selection.setRange(C.sc,0,C.sc,0)),this.history.push(!1)},applyList(t,e,i){const s=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.selection.getRange(),l=e||this.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.selection.getRangeAndAddLine(o,null),l=this.getLinesAndComponents(!1),0===l.length)return}gt.query.sortNodeByDepth(l,!0);const r=l[0],a=l[l.length-1];let h=!gt.check.isListCell(r)&&!this.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,c=!gt.check.isListCell(a)&&!this.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&>.check.isZeroWidth(o.startContainer)&&0===o.startOffset&&1===o.endOffset?o.endOffset:o.startOffset,ec:o.endContainer,eo:o.endOffset};let p=null,g=!0;for(let t=0,e=l.length;t<e;t++)if(!gt.check.isList(this.getBlock(l[t],(e=>this.getBlock(e)&&e!==l[t])))){g=!1;break}if(!g||h&&r.tagName===h.tagName&&s===h.tagName.toUpperCase()||c&&a.tagName===c.tagName&&s===c.tagName.toUpperCase()){const t=h?h.parentNode:h,e=c?c.parentNode:c;h=t&&!gt.check.isWysiwygFrame(t)&&t.nodeName===s?t:h,c=e&&!gt.check.isWysiwygFrame(e)&&e.nodeName===s?e:c;const i=h?.tagName===s,o=c?.tagName===s;let r=i?h:gt.utils.createElement(s,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!this.component.is(t)&&!gt.check.isList(t);for(let t,e,o,h,c,p,g,m,f,_=0,b=l.length;_<b;_++)if(e=l[_],0!==e.childNodes.length||this._isIgnoreNodeChange(e)){if(h=l[_+1],c=e.parentNode,p=h?h.parentNode:null,o=gt.check.isListCell(e),f=this.isBlock(c)?c:null,g=o&&!gt.check.isWysiwygFrame(c)?c.parentNode:c,m=o&&!gt.check.isWysiwygFrame(c)?!h||gt.check.isListCell(g)?c:c.nextSibling:e.nextSibling,t=gt.utils.createElement("LI"),gt.utils.copyFormatAttributes(t,e),this.component.is(e)){const i=/^HR$/i.test(e.nodeName);i||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,i&&(t.innerHTML+="<br>")}else{const i=e.childNodes;for(;i[0];)t.appendChild(i[0])}r.appendChild(t),h&&g===p&&!this.isBlock(m)||(a||(a=r),i&&h&&g===p||h&>.check.isList(p)&&p===c||r.parentNode!==g&&g.insertBefore(r,m)),gt.utils.removeItem(e),i&&null===d&&(d=r.children.length-1),h&&(this.getBlock(p,u)!==this.getBlock(c,u)||gt.check.isList(p)&>.check.isList(c)&>.query.getNodeDepth(p)!==gt.query.getNodeDepth(c))&&(r=gt.utils.createElement(s,{style:"list-style-type: "+n})),0===f?.children.length&>.utils.removeItem(f)}else gt.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=c.innerHTML,gt.utils.removeItem(c))}else{if(i)for(let t=0,e=l.length;t<e;t++)for(let i=t-1;i>=0;i--)if(l[i].contains(l[t])){l.splice(t,1),t--,e--;break}const t=this.getBlock(r),e=t?.tagName===s;let o,a;const h=t=>!this.component.is(t);e||(a=gt.utils.createElement(s,{style:"list-style-type: "+n}));for(let t,r,c=0,d=l.length;c<d;c++)r=this.getBlock(l[c],h),r&>.check.isList(r)&&(t?t!==r?(i&>.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[c].parentNode,e||(a=gt.utils.createElement(s,{style:"list-style-type: "+n})),t=r,o={r:t,f:[gt.query.getParentElement(l[c],"LI")]}):o.f.push(gt.query.getParentElement(l[c],"LI")):(t=r,o={r:t,f:[gt.query.getParentElement(l[c],"LI")]}),c===d-1&&(i&>.check.isListCell(r.parentNode)?this._detachNested(o.f):p=this.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0})))}return this.editor.effectNode=null,g&&d&&p||u},removeList(t,e){let i={},s=!1,n=!1,o=null,l=null;const r=t=>!this.component.is(t);for(let a,h,c,d,u=0,p=t.length;u<p;u++){if(c=u===p-1,h=this.getBlock(t[u],r),d=gt.check.isList(h),!a&&d)a=h,i={r:a,f:[gt.query.getParentElement(t[u],"LI")]},0===u&&(s=!0);else if(a&&d)if(a!==h){const r=this.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});h=t[u].parentNode,s&&(o=r.sc,s=!1),c&&(l=r.ec),d?(a=h,i={r:a,f:[gt.query.getParentElement(t[u],"LI")]},c&&(n=!0)):a=null}else i.f.push(gt.query.getParentElement(t[u],"LI")),c&&(n=!0);if(c&>.check.isList(a)){const t=this.removeBlock(i.f[0].parentNode,{selectedFormats:i.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});(n||1===p)&&(l=t.ec),s&&(o=t.sc||l)}}return{sc:o,ec:l}},indent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=Ui(this.getLines(null),this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this._applyNestedList(o,!1),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},outdent(){const t=this.selection.getRange(),e=t.startContainer,i=t.endContainer,s=t.startOffset,n=t.endOffset,o=Ui(this.getLines(null),-1*this.status.indentSize,this.options.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this._applyNestedList(o,!0),this.editor.effectNode=null,this.selection.setRange(e,s,i,n),this.history.push(!1)},applyInlineElement(t,{stylesToModify:e,nodesToRemove:i,strictRemove:s}={}){if(gt.query.getParentElement(this.selection.getNode(),gt.check.isNonEditable))return;this.selection._resetRangeToTextNode();let n=this.selection.getRangeAndAddLine(this.selection.getRange(),null);e=e?.length>0?e:null,i=i?.length>0?i:null;const o=!t,l=o&&!i&&!e;let r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset;if(l&&n.collapsed&&this.isLine(r.parentNode)&&this.isLine(h.parentNode)||r===h&&1===r.nodeType&>.check.isNonEditable(r)){const t=r.parentNode;return void(!gt.check.isListCell(t)||pt.getValues(t.style).some((t=>this._listKebab.includes(t))))}if(n.collapsed&&!l&&1===r.nodeType&&!gt.check.isBreak(r)&&!this.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?gt.check.isBreak(e)?e:e.nextSibling:null);const i=gt.utils.createTextNode(ut.zeroWidthSpace);r.insertBefore(i,t),this.selection.setRange(i,1,i,1),n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset}this.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.isLine(h)&&(h=h.childNodes[c]||h.lastChild,c=h.textContent.length),o&&(t=gt.utils.createElement("DIV"));const d=RegExp,u=t.nodeName;if(!l&&r===h&&!i&&t){let e=r,i=0;const s=[],n=t.style;for(let t=0,e=n.length;t<e;t++)s.push(n[t]);const l=t.className,a=t.classList;for(let t=0,e=a.length;t<e;t++)s.push("."+a[t]);if(s.length>0){for(;!this.isLine(e)&&!gt.check.isWysiwygFrame(e);){for(let t=0;t<s.length;t++)if(1===e.nodeType){const r=s[t],a=!!/^\./.test(r)&&new d("\\s*"+r.replace(/^\./,"")+"(\\s+|$)","ig"),h=e.style,c=e.className,u=o?!!h[r]:!!h[r]&&!!n[r]&&h[r]===n[r],p=!1!==a&&(o?!!c.match(a):!!c.match(a)&&!!l.match(a));(u||p)&&i++}e=e.parentNode}if(i>=s.length)return}}let p,g,m={},f={},_="",b="";if(e){for(let t,i=0,s=e.length;i<s;i++)t=e[i],/^\./.test(t)?b+=(b?"|":"\\s*(?:")+t.replace(/^\./,""):_+=(_?"|":"(?:;|^|\\s)(?:")+t;_&&(_+=")\\s*:[^;]*\\s*(?:;|$)",_=new d(_,"ig")),b&&(b+=")(?=\\s+|$)",b=new d(b,"ig"))}if(i){g="^(?:"+i[0];for(let t=1;t<i.length;t++)g+="|"+i[t];g+=")$",g=new d(g,"i")}const y={v:!1},v=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||gt.check.isBreak(e))return e;if(l)return null;const i=!g&&o||g?.test(e.nodeName);if(i&&!s)return y.v=!0,null;const n=e.style.cssText;let r="";_&&n.length>0&&(r=n.replace(_,"").trim(),r!==n&&(y.v=!0));const a=e.className;let h="";return b&&a.length>0&&(h=a.replace(b,"").trim(),h!==a&&(y.v=!0)),(!o||!b&&a||!_&&n||r||h||!i)&&(r||h||e.nodeName!==u||Boolean(_)!==Boolean(n)||Boolean(b)!==Boolean(a))?(_&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),b&&a.length>0&&(e.className=h.trim()),e.className.trim()||e.removeAttribute("class"),e.style.cssText||e.className||e.nodeName!==u&&!i?e:(y.v=!0,null)):(y.v=!0,null)},C=this.getLines(null);n=this.selection.getRange(),r=n.startContainer,a=n.startOffset,h=n.endContainer,c=n.endOffset,this.getLine(r,null)||(r=gt.query.getEdgeChild(C[0],(function(t){return 3===t.nodeType}),!1),a=0),this.getLine(h,null)||(h=gt.query.getEdgeChild(C[C.length-1],(function(t){return 3===t.nodeType}),!1),c=h.textContent.length);const w=this.getLine(r,null)===this.getLine(h,null),x=C.length-(w?0:1);p=t.cloneNode(!1);const k=l||o&&function(t,e){for(let i=0,s=e.length;i<s;i++)if(t._isNonSplitNode(e[i]))return!0;return!1}(this,i),S=o||this._sn_isSizeNode(p),E=this._sn_getMaintainedNode.bind(this,k,S),T=this._sn_isMaintainedNode.bind(this,k,S);if(w){this._sn_resetCommonListCell(C[0],e)&&(n=this.selection.setRange(r,a,h,c));const t=this._setNode_oneLine(C[0],p,v,r,a,h,c,l,o,n.collapsed,y,E,T);m.container=t.startContainer,m.offset=t.startOffset,f.container=t.endContainer,f.offset=t.endOffset,m.container===f.container&>.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this._sn_setCommonListStyle(t.ancestor,null)}else{let i=!1;x>0&&this._sn_resetCommonListCell(C[x],e)&&(i=!0),this._sn_resetCommonListCell(C[0],e)&&(i=!0),i&&this.selection.setRange(r,a,h,c),x>0&&(p=t.cloneNode(!1),f=this._setNode_endLine(C[x],p,v,h,c,l,o,y,E,T));for(let i,s=x-1;s>0;s--)this._sn_resetCommonListCell(C[s],e),p=t.cloneNode(!1),i=this._setNode_middleLine(C[s],p,v,l,o,y,f.container),i.endContainer&&i.ancestor.contains(i.endContainer)&&(f.ancestor=null,f.container=i.endContainer),this._sn_setCommonListStyle(i.ancestor,null);p=t.cloneNode(!1),m=this._setNode_startLine(C[0],p,v,r,a,l,o,y,E,T,f.container),m.endContainer&&(f.ancestor=null,f.container=m.endContainer),x<=0?f=m:f.container||(f.ancestor=null,f.container=m.container,f.offset=m.container.textContent.length),this._sn_setCommonListStyle(m.ancestor,null),this._sn_setCommonListStyle(f.ancestor||this.getLine(f.container),null)}return this.ui._offCurrentController(),this.selection.setRange(m.container,m.offset,f.container,f.offset),this.history.push(!1),p},removeInlineElement(){this.applyInlineElement(null,{stylesToModify:null,nodesToRemove:null,strictRemove:null})},isEdgeLine(t,e,i){if(!gt.check.isEdgePoint(t,e,i))return!1;let s=!1;const n="front"===i?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!gt.check.isWysiwygFrame(t);){if(t[n]&&(!gt.check.isBreak(t[n])||t[n][n]))return!1;s=!0,t=t.parentNode}return s},isTextStyleNode(t){return"string"==typeof t?this._textStyleTagsCheck.test(t):t&&1===t.nodeType&&this._textStyleTagsCheck.test(t.nodeName)},isLine(t){return!this.isBlock(t)&&("string"==typeof t?this._formatLineCheck.test(t):t&&1===t.nodeType&&(this._formatLineCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this._nonFormat(t))},isLineOnly(t){return this.isLine(t)&&(this._brLineBreak||!this.isBrLine(t))},isBrLine(t){return this._brLineBreak&&this.isLine(t)||("string"==typeof t?this._formatBrLineCheck.test(t):t&&1===t.nodeType&&(this._formatBrLineCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__br_line_.+"))&&!this._nonFormat(t))},isBlock(t){return"string"==typeof t?this._formatBlockCheck.test(t):t&&1===t.nodeType&&(this._formatBlockCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__block_.+"))&&!this._nonFormat(t)},isClosureBlock(t){return"string"==typeof t?this._formatClosureBlockCheck.test(t):t&&1===t.nodeType&&(this._formatClosureBlockCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this._nonFormat(t)},isClosureBrLine(t){return"string"==typeof t?this._formatClosureBrLineCheck.test(t):t&&1===t.nodeType&&(this._formatClosureBrLineCheck.test(t.nodeName)||gt.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this._nonFormat(t)},getLines(t){if(!this.selection._resetRangeToTextNode())return[];let e=this.selection.getRange();if(gt.check.isWysiwygFrame(e.startContainer)){const t=this.editor.frameContext.get("wysiwyg").children;if(0===t.length)return[];this.selection.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),e=this.selection.getRange()}const i=e.startContainer,s=e.endContainer,n=e.commonAncestorContainer,o=gt.query.getListChildren(n,(e=>t?t(e):this.isLine(e)));if(gt.check.isWysiwygFrame(n)||this.isBlock(n)||o.unshift(this.getLine(n,null)),i===s||1===o.length)return o;const l=this.getLine(i,null),r=this.getLine(s,null);let a=null,h=null;const c=function(t){return!gt.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,c),u=this.getBlock(r,c);gt.check.isTableElements(d)&>.check.isListCell(d.parentNode)&&(d=d.parentNode),gt.check.isTableElements(u)&>.check.isListCell(u.parentNode)&&(u=u.parentNode);const p=d===u;for(let t,e=0,i=o.length;e<i;e++)if(t=o[e],l===t||!p&&t===d)a=e;else if(r===t||!p&&t===u){h=e;break}return null===a&&(a=0),null===h&&(h=o.length-1),o.slice(a,h+1)},getLinesAndComponents(t){const e=this.selection.getRange().commonAncestorContainer,i=gt.query.getParentElement(e,this.component.is.bind(this.component)),s=gt.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=gt.query.getParentElement(t,this.component.is.bind(this.component));return this.isLine(t)&&(!e||e===i)||this.component.is(t)&&!this.getLine(t)}));if(t)for(let t=0,e=s.length;t<e;t++)for(let i=t-1;i>=0;i--)if(s[i].contains(s[t])){s.splice(t,1),t--,e--;break}return s},_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.component.is(t)||/FIGURE/i.test(t.nodeName))},_nonFormat(t){return gt.check.isExcludeFormat(t)||this.component.is(t)||gt.check.isWysiwygFrame(t)},_isNonSplitNode(t){if(!t)return!1;const e=/^(a|label|code|summary)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&e.test(t.nodeName)},_notTextNode(t){if(!t)return!1;const e=/^(br|input|select|canvas|img|iframe|audio|video)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&(this.component.is(t)||e.test(t.nodeName))},_isIgnoreNodeChange(t){return t&&1===t.nodeType&&(gt.check.isNonEditable(t)||!this.isTextStyleNode(t)||this.component.is(t))},_lineWork(){let t=this.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.selection.getRangeAndAddLine(t,null),e=this.getLinesAndComponents(!1),0===e.length))return;const i=t.startOffset,s=t.endOffset;let n=e[0],o=e[e.length-1];const l=gt.query.getNodePath(t.startContainer,n,null),r=gt.query.getNodePath(t.endContainer,o,null),a=this.removeList(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.selection.setRange(gt.query.getNodeFromPath(l,n),i,gt.query.getNodeFromPath(r,o),s),{lines:this.getLinesAndComponents(!1),firstNode:n,lastNode:o,firstPath:l,lastPath:r,startOffset:i,endOffset:s}},_attachNested(t,e,i,s,n){let o=!1;if(e.tagName===i?.tagName){const t=e.children;for(;t[0];)i.appendChild(t[0]);e=i,o=!0}if(e.tagName===s?.tagName){const t=s.children;for(;t[0];)e.appendChild(t[0]);const i=s.nextElementSibling;s.parentNode.removeChild(s),s=i}if(!o){gt.check.isListCell(i)&&(t=i,s=null),t.insertBefore(e,s),n.s||(n.s=gt.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?gt.query.getNodePath(n.sl,t):null;n.e=gt.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.nodeTransform.mergeNestedTags(t),o&&(n.sl=gt.query.getNodeFromPath(o,t))}return e},_detachNested(t){const e=t[0],i=t[t.length-1],s=i.nextElementSibling,n=e.parentElement,o=n.parentElement.nextElementSibling,l=n.parentElement.parentElement;for(let e=0,i=t.length;e<i;e++)l.insertBefore(t[e],o);if(s&&n.children.length>0){const t=n.cloneNode(!1),e=n.childNodes,o=gt.query.getPositionIndex(s);for(;e[o];)t.appendChild(e[o]);i.appendChild(t)}0===n.children.length&>.utils.removeItem(n),this.nodeTransform.mergeSameTags(l);const r=gt.query.getEdgeChildNodes(e,i);return{cc:e.parentNode,sc:r.sc,ec:r.ec}},_applyNestedList(t,e){const i=(t=t||this.getLines().filter((function(t){return gt.check.isListCell(t)}))).length;if(0===i||!e&&!gt.check.isListCell(t[0].previousElementSibling)&&!gt.check.isListCell(t[i-1].nextElementSibling))return{sc:t[0],so:0,ec:t[i-1],eo:1};let s=t[0].parentNode,n=t[i-1],o=null;if(e){if(s!==n.parentNode&>.check.isList(n.parentNode.parentNode)&&n.nextElementSibling)for(n=n.nextElementSibling;n;)t.push(n),n=n.nextElementSibling;o=this.applyList(s.nodeName+":"+s.style.listStyleType,t,!0)}else{let e=gt.utils.createElement(s.nodeName),l=t[0].previousElementSibling,r=n.nextElementSibling;const a={s:null,e:null,sl:s,el:s};for(let n,o=0,h=i;o<h;o++)n=t[o],n.parentNode!==s&&(this._attachNested(s,e,l,r,a),s=n.parentNode,e=gt.utils.createElement(s.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);this._attachNested(s,e,l,r,a);const h=gt.query.getNodeFromPath(a.s,a.sl),c=gt.query.getNodeFromPath(a.e,a.el);o={sc:h,so:0,ec:c,eo:c.textContent.length}}return o},_removeNestedList(t,e){const i=Wi(t);let s,n,o;if(i){s=i.cloneNode(!1),n=i.childNodes;const e=gt.query.getPositionIndex(t);for(;n[e];)s.appendChild(n[e])}else s=t;if(e)o=gt.query.getListChildren(s,(t=>gt.check.isListCell(t)&&!t.previousElementSibling));else{const e=gt.query.getNodeDepth(t)+2;o=gt.query.getListChildren(t,(t=>gt.check.isListCell(t)&&!t.previousElementSibling&>.query.getNodeDepth(t)===e))}for(let t=0,e=o.length;t<e;t++)Wi(o[t]);return i&&(i.parentNode.insertBefore(s,i.nextSibling),0===n?.length&>.utils.removeItem(i)),s===t?s.parentNode:s},_setNode_oneLine(t,e,i,s,n,o,l,r,a,h,c,d,u){let p=s.parentNode;for(;!(p.nextSibling||p.previousSibling||this.isLine(p.parentNode)||gt.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&p===o.parentNode&&p.nodeName===e.nodeName&>.check.isZeroWidth(s.textContent.slice(0,n))&>.check.isZeroWidth(o.textContent.slice(l))){const i=p.childNodes;let r=!1;for(let t,e,n,l,a=0,h=i.length;a<h;a++)if(t=i[a],l=!gt.check.isZeroWidth(t),t!==s)if(t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else n=!0;else e=!0;if(r)return gt.utils.copyTagAttributes(p,e),{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l}}c.v=!1;const g=this,m=t,f=[e],_=t.cloneNode(!1),b=s===o;let y,v,C,w,x,k=s,S=n,E=o,T=l,H=!1,M=!1;const L=RegExp;function N(t){const e=new L("(?:;|^|\\s)(?:"+w+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let i=!1;return e&&t.style.cssText.length>0&&(i=e.test(t.style.cssText)),!i}if(function t(s,n){const o=s.childNodes;for(let s,l=0,a=o.length;l<a;l++){const a=o[l];if(!a)continue;let c,p=n;if(!H&&a===k){let t=_;x=d(a);let o="",l="";if(3===k.nodeType){const t=k;o=t.substringData(0,S),l=t.substringData(S,b&&T>=S?T-S:t.data.length-S)}const r=gt.utils.createTextNode(o),h=gt.utils.createTextNode(l);if(x){const e=d(n);if(e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}x=x.cloneNode(!1)}gt.check.isZeroWidth(r)||n.appendChild(r);const c=d(n);for(c&&(x=c),x&&(t=x),v=a,y=[],w="";v!==t&&v!==m&&null!==v;)s=u(v)?null:i(v),s&&1===v.nodeType&&N(v)&&(y.push(s),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;const p=y.pop()||h;for(C=v=p;y.length>0;)v=y.pop(),C.appendChild(v),C=v;if(e.appendChild(p),t.appendChild(e),x&&!d(E)&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),k=h,S=0,H=!0,v!==h&&v.appendChild(k),!b)continue}if(M||a!==E){if(H){if(1===a.nodeType&&!gt.check.isBreak(a)){g._isIgnoreNodeChange(a)?(_.appendChild(a.cloneNode(!0)),h||(e=e.cloneNode(!1),_.appendChild(e),f.push(e))):t(a,a);continue}v=a,y=[],w="";const o=[];for(;null!==v.parentNode&&v!==m&&v!==e;)s=M?v.cloneNode(!1):i(v),1===v.nodeType&&!gt.check.isBreak(a)&&s&&N(v)&&(u(v)?x||o.push(s):y.push(s),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;y=y.concat(o);const l=y.pop()||a;for(C=v=l;y.length>0;)v=y.pop(),C.appendChild(v),C=v;if(!u(e.parentNode)||u(l)||gt.check.isZeroWidth(e)||(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),M||x||!u(l))l===a?n=M?_:e:M?(_.appendChild(l),n=v):(e.appendChild(l),n=v);else{e=e.cloneNode(!1);const t=l.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);l.appendChild(e),_.appendChild(l),f.push(e),n=e.children.length>0?v:e}if(x&&3===a.nodeType)if(d(a)){const t=gt.query.getParentElement(n,(t=>g._isNonSplitNode(t.parentNode)||t.parentNode===_));x.appendChild(t),e=t.cloneNode(!1),f.push(e),_.appendChild(e)}else x=null}c=a.cloneNode(!1),n.appendChild(c),1!==a.nodeType||gt.check.isBreak(a)||(p=c),t(a,p)}else{x=d(a);let t="",n="";if(3===E.nodeType){const e=E;t=e.substringData(T,e.length-T),n=b?"":e.substringData(0,T)}const o=gt.utils.createTextNode(t),l=gt.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),_.appendChild(e),f.push(e)),!gt.check.isZeroWidth(o)){v=a,w="",y=[];const t=[];for(;v!==_&&v!==m&&null!==v;)1===v.nodeType&&N(v)&&(u(v)?t.push(v.cloneNode(!1)):y.push(v.cloneNode(!1)),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;for(y=y.concat(t),c=C=v=y.pop()||o;y.length>0;)v=y.pop(),C.appendChild(v),C=v;_.appendChild(c),v.textContent=o.data}if(x&&c){const t=d(c);t&&(x=t)}for(v=a,y=[],w="";v!==_&&v!==m&&null!==v;)s=u(v)?null:i(v),s&&1===v.nodeType&&N(v)&&(y.push(s),w+=v.style.cssText.substring(0,v.style.cssText.indexOf(":"))+"|"),v=v.parentElement;const p=y.pop()||l;for(C=v=p;y.length>0;)v=y.pop(),C.appendChild(v),C=v;x?((e=e.cloneNode(!1)).appendChild(p),x.insertBefore(e,x.firstChild),_.appendChild(x),f.push(e),x=null):e.appendChild(p),E=l,T=l.data.length,M=!0,!r&&h&&(e=l,l.textContent=ut.zeroWidthSpace),v!==l&&v.appendChild(E)}}}(t,_),a&&!r&&!c.v)return{ancestor:t,startContainer:s,startOffset:n,endContainer:o,endOffset:l};if(r=r&&a)for(let t=0;t<f.length;t++){const e=f[t];let i,s,n;if(h)i=gt.utils.createTextNode(ut.zeroWidthSpace),_.replaceChild(i,e);else{const t=e.childNodes;for(s=t[0];t[0];)n=t[0],_.insertBefore(n,e);gt.utils.removeItem(e)}0===t&&(h?k=E=i:(k=s,E=n))}else{if(a)for(let t=0;t<f.length;t++)Gi(f[t]);h&&(k=E=e)}this.nodeTransform.removeEmptyNode(_,e,!1),h&&(S=k.textContent.length,T=E.textContent.length);const A=r||0===E.textContent.length;gt.check.isBreak(E)||0!==E.textContent.length||(gt.utils.removeItem(E),E=k),T=A?E.textContent.length:T;const B={s:0,e:0},I=gt.query.getNodePath(k,_,B),V=!E.parentNode;V&&(E=k);const O={s:0,e:0},R=gt.query.getNodePath(E,_,V||A?null:O);S+=B.s,T=h?S:V?k.textContent.length:A?T+B.s:T+O.s;const z=this.nodeTransform.mergeSameTags(_,[I,R],!0);return t.parentNode.replaceChild(_,t),k=gt.query.getNodeFromPath(I,_),E=gt.query.getNodeFromPath(R,_),{ancestor:_,startContainer:k,startOffset:S+z[0],endContainer:E,endOffset:T+z[1]}},_setNode_startLine(t,e,i,s,n,o,l,r,a,h,c){let d=s.parentNode;for(;!(d.nextSibling||d.previousSibling||this.isLine(d.parentNode)||gt.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&d.nodeName===e.nodeName&&!this.isLine(d)&&!d.nextSibling&>.check.isZeroWidth(s.textContent.slice(0,n))){let i=!1,o=s.previousSibling;for(;o;){if(!gt.check.isZeroWidth(o)){i=!1;break}o=o.previousSibling}if(i)return gt.utils.copyTagAttributes(d,e),{ancestor:t,container:s,offset:n}}r.v=!1;const u=this,p=t,g=[e],m=t.cloneNode(!1);let f,_,b,y,v=s,C=n,w=!1;if(function t(s,n){const o=s.childNodes;for(let s,l,r=0,d=o.length;r<d;r++){const d=o[r];if(!d)continue;let x=n;if(w&&!gt.check.isBreak(d)){if(1===d.nodeType){if(u._isIgnoreNodeChange(d)){if(e=e.cloneNode(!1),l=d.cloneNode(!0),m.appendChild(l),m.appendChild(e),g.push(e),c&&d.contains(c)){const t=gt.query.getNodePath(c,d);c=gt.query.getNodeFromPath(t,l)}}else t(d,d);continue}_=d,f=[];const o=[];for(;null!==_.parentNode&&_!==p&&_!==e;)s=i(_),1===_.nodeType&&s&&(h(_)?y||o.push(s):f.push(s)),_=_.parentNode;f=f.concat(o);const r=f.length>0,v=f.pop()||d;for(b=_=v;f.length>0;)_=f.pop(),b.appendChild(_),b=_;if(h(e.parentNode)&&!h(v)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!y&&h(v)){e=e.cloneNode(!1);const t=v.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);v.appendChild(e),m.appendChild(v),n=h(_)?e:_,g.push(e)}else r?(e.appendChild(v),n=_):n=e;if(y&&3===d.nodeType)if(a(d)){const t=gt.query.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));y.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else y=null}if(w||d!==v)s=w?i(d):d.cloneNode(!1),s&&(n.appendChild(s),1!==d.nodeType||gt.check.isBreak(d)||(x=s)),t(d,x);else{let t=m;y=a(d);let o="",l="";if(3===v.nodeType){const t=v;o=t.substringData(0,C),l=t.substringData(C,t.length-C)}const r=gt.utils.createTextNode(o),h=gt.utils.createTextNode(l);if(y){const e=a(n);if(e&&e.parentNode!==t){let i=e,s=null;for(;i.parentNode!==t;){for(n=s=i.parentNode.cloneNode(!1);i.childNodes[0];)s.appendChild(i.childNodes[0]);i.appendChild(s),i=i.parentNode}i.parentNode.appendChild(e)}y=y.cloneNode(!1)}gt.check.isZeroWidth(r)||n.appendChild(r);const c=a(n);for(c&&(y=c),y&&(t=y),_=n,f=[];_!==t&&null!==_;)s=i(_),1===_.nodeType&&s&&f.push(s),_=_.parentNode;const u=f.pop()||n;for(b=_=u;f.length>0;)_=f.pop(),b.appendChild(_),b=_;u!==n?(e.appendChild(u),n=_):n=e,gt.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),v=h,C=0,w=!0,n.appendChild(v)}}}(t,m),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n,endContainer:c};if(o=o&&l)for(let t=0;t<g.length;t++){const e=g[t],i=e.childNodes,s=i[0];for(;i[0];)m.insertBefore(i[0],e);gt.utils.removeItem(e),0===t&&(v=s)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)Gi(g[t])}if(o||0!==m.childNodes.length){this.nodeTransform.removeEmptyNode(m,e,!1),gt.check.isZeroWidth(m.textContent)&&(v=m.firstChild,C=0);const i={s:0,e:0},s=gt.query.getNodePath(v,m,i);C+=i.s;const n=this.nodeTransform.mergeSameTags(m,[s],!0);t.parentNode.replaceChild(m,t),v=gt.query.getNodeFromPath(s,m),C+=n[0]}else t.childNodes?v=t.childNodes[0]:(v=gt.utils.createTextNode(ut.zeroWidthSpace),t.appendChild(v));return{ancestor:m,container:v,offset:C,endContainer:c}},_setNode_middleLine(t,e,i,s,n,o,l){if(!n){let i=null;l&&t.contains(l)&&(i=gt.query.getNodePath(l,t));const s=t.cloneNode(!0),n=e.nodeName,o=e.style.cssText,r=e.className;let a=s.childNodes,h=0,c=a.length;for(let t;h<c&&(t=a[h],3!==t.nodeType);h++){if(t.nodeName!==n){if(!gt.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===c){a=t.childNodes,c=a.length,h=-1;continue}break}t.style.cssText+=o,gt.utils.addClass(t,r)}if(c>0&&h===c)return t.innerHTML=s.innerHTML,{ancestor:t,endContainer:i?gt.query.getNodeFromPath(i,t):null}}o.v=!1;const r=this,a=t.cloneNode(!1),h=[e];let c=!0;if(function t(s,n){const o=s.childNodes;for(let s,d,u=0,p=o.length;u<p;u++){const p=o[u];if(!p)continue;let g=n;if(gt.check.isBreak(p)||!r._isIgnoreNodeChange(p))s=i(p),s&&(c=!1,n.appendChild(s),1===p.nodeType&&(g=s)),gt.check.isBreak(p)||t(p,g);else if(e.childNodes.length>0&&(a.appendChild(e),e=e.cloneNode(!1)),d=p.cloneNode(!0),a.appendChild(d),a.appendChild(e),h.push(e),n=e,l&&p.contains(l)){const t=gt.query.getNodePath(l,p);l=gt.query.getNodeFromPath(t,d)}}}(t,e),c||n&&!s&&!o.v)return{ancestor:t,endContainer:l};if(a.appendChild(e),s&&n)for(let t=0;t<h.length;t++){const e=h[t],i=e.childNodes;for(;i[0];)a.insertBefore(i[0],e);gt.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<h.length;t++)Gi(h[t])}return this.nodeTransform.removeEmptyNode(a,e,!1),this.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}},_setNode_endLine(t,e,i,s,n,o,l,r,a,h){let c=s.parentNode;for(;!(c.nextSibling||c.previousSibling||this.isLine(c.parentNode)||gt.check.isWysiwygFrame(c.parentNode))&&c.nodeName!==e.nodeName;)c=c.parentNode;if(!l&&c.nodeName===e.nodeName&&!this.isLine(c)&&!c.previousSibling&>.check.isZeroWidth(s.textContent.slice(n))){let i=!1,o=s.nextSibling;for(;o;){if(!gt.check.isZeroWidth(o)){i=!1;break}o=o.nextSibling}if(i)return gt.utils.copyTagAttributes(c,e),{ancestor:t,container:s,offset:n}}r.v=!1;const d=this,u=t,p=[e],g=t.cloneNode(!1);let m,f,_,b,y=s,v=n,C=!1;if(function t(s,n){const o=s.childNodes;for(let s,l=o.length-1;0<=l;l--){const r=o[l];if(!r)continue;let c=n;if(C&&!gt.check.isBreak(r)){if(1===r.nodeType){if(d._isIgnoreNodeChange(r)){e=e.cloneNode(!1);const t=r.cloneNode(!0);g.insertBefore(t,n),g.insertBefore(e,t),p.push(e)}else t(r,r);continue}f=r,m=[];const o=[];for(;null!==f.parentNode&&f!==u&&f!==e;)s=i(f),s&&1===f.nodeType&&(h(f)?b||o.push(s):m.push(s)),f=f.parentNode;m=m.concat(o);const l=m.length>0,c=m.pop()||r;for(_=f=c;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(h(e.parentNode)&&!h(c)&&(e=e.cloneNode(!1),g.insertBefore(e,g.firstChild),p.push(e)),!b&&h(c)){e=e.cloneNode(!1);const t=c.childNodes;for(let i=0,s=t.length;i<s;i++)e.appendChild(t[i]);c.appendChild(e),g.insertBefore(c,g.firstChild),p.push(e),n=e.children.length>0?f:e}else l?(e.insertBefore(c,e.firstChild),n=f):n=e;if(b&&3===r.nodeType)if(a(r)){const t=gt.query.getParentElement(n,(t=>d._isNonSplitNode(t.parentNode)||t.parentNode===g));b.appendChild(t),e=t.cloneNode(!1),p.push(e),g.insertBefore(e,g.firstChild)}else b=null}if(C||r!==y)s=C?i(r):r.cloneNode(!1),s&&(n.insertBefore(s,n.firstChild),1!==r.nodeType||gt.check.isBreak(r)||(c=s)),t(r,c);else{b=a(r);let t="",o="";if(3===y.nodeType){const e=y;t=e.substringData(v,e.length-v),o=e.substringData(0,v)}const l=gt.utils.createTextNode(t),c=gt.utils.createTextNode(o);if(b){b=b.cloneNode(!1);const t=a(n);if(t.parentNode!==g){let e=t,i=null;for(;e.parentNode!==g;){for(n=i=e.parentNode.cloneNode(!1);e.childNodes[0];)i.appendChild(e.childNodes[0]);e.appendChild(i),e=e.parentNode}e.parentNode.insertBefore(t,e.parentNode.firstChild)}b=b.cloneNode(!1)}else h(e.parentNode)&&!b&&(e=e.cloneNode(!1),g.appendChild(e),p.push(e));for(gt.check.isZeroWidth(l)||n.insertBefore(l,n.firstChild),f=n,m=[];f!==g&&null!==f;)s=h(f)?null:i(f),s&&1===f.nodeType&&m.push(s),f=f.parentNode;const d=m.pop()||n;for(_=f=d;m.length>0;)f=m.pop(),_.appendChild(f),_=f;d!==n?(e.insertBefore(d,e.firstChild),n=f):n=e,gt.check.isBreak(r)&&e.appendChild(r.cloneNode(!1)),b?(b.insertBefore(e,b.firstChild),g.insertBefore(b,g.firstChild),b=null):g.insertBefore(e,g.firstChild),y=c,v=c.data.length,C=!0,n.insertBefore(y,n.firstChild)}}}(t,g),l&&!o&&!r.v)return{ancestor:t,container:s,offset:n};if(o=o&&l)for(let t=0;t<p.length;t++){const e=p[t],i=e.childNodes;let s=null;for(;i[0];)s=i[0],g.insertBefore(s,e);gt.utils.removeItem(e),t===p.length-1&&(y=s,v=s.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)Gi(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.nodeTransform.removeEmptyNode(g,e,!1),gt.check.isZeroWidth(g.textContent)?(y=g.firstChild,v=y.textContent.length):gt.check.isZeroWidth(y)&&(y=e,v=1);const i={s:0,e:0},s=gt.query.getNodePath(y,g,i);v+=i.s;const n=this.nodeTransform.mergeSameTags(g,[s],!0);t.parentNode.replaceChild(g,t),y=gt.query.getNodeFromPath(s,g),v+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=gt.utils.createTextNode(ut.zeroWidthSpace),t.appendChild(y));return{ancestor:g,container:y,offset:1===y.nodeType&&1===v?y.childNodes.length:v}},_sn_isSizeNode(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.isTextStyleNode(t)&&!!t.style.fontSize},_sn_getMaintainedNode(t,e,i){return!i||t?null:gt.query.getParentElement(i,this._isNonSplitNode.bind(this))||(e?null:gt.query.getParentElement(i,this._sn_isSizeNode.bind(this)))},_sn_isMaintainedNode(t,e,i){if(!i||t||1!==i.nodeType)return!1;const s=this._isNonSplitNode(i);return gt.query.getParentElement(i,this._isNonSplitNode.bind(this))?s:s||!e&&this._sn_isSizeNode(i)},_sn_setCommonListStyle(t,e){if(!gt.check.isListCell(t))return;const i=gt.utils.arrayFilter((e||t).childNodes,(t=>!gt.check.isBreak(t)));if(e=i[0],!gt.check.isElement(e)||i.length>1)return;const s=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.options.get("_defaultStyleTagMap")[o]===this.options.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=pt.getValues(s);if(r.length>0)for(let t=0,e=this._listCamel.length;t<e;t++)r.includes(this._listKebab[t])&&(n[this._listCamel[t]]=s[this._listCamel[t]],s.removeProperty(this._listKebab[t]),l=!0);if(this._sn_setCommonListStyle(t,e),l&&!s.length){const t=e.childNodes,i=e.parentNode,s=e.nextSibling;for(;t.length>0;)i.insertBefore(t[0],s);gt.utils.removeItem(e)}},_sn_resetCommonListCell(t,e){if(!gt.check.isListCell(t))return;e||(e=this._listKebab);const i=gt.utils.arrayFilter(t.childNodes,(t=>!gt.check.isBreak(t))),s=t.style,n=[],o=[],l=pt.getValues(s);for(let t=0,i=this._listKebab.length;t<i;t++)l.includes(this._listKebab[t])&&e.includes(this._listKebab[t])&&(n.push(this._listCamel[t]),o.push(this._listKebab[t]));if(!n.length)return;const r=gt.utils.createElement("SPAN");for(let t=0,e=n.length;t<e;t++)r.style[n[t]]=s[o[t]],s.removeProperty(o[t]);let a=r.cloneNode(!1),h=null,c=!1;for(let e,s,o=0,l=i.length;o<l;o++)e=i[o],this.options.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(s=pt.getValues(e.style),0===s.length||n.some((function(t){return!s.includes(t)}))&&s.some((function(t){n.includes(t)}))?(h=e.nextSibling,a.appendChild(e)):a.childNodes.length>0&&(t.insertBefore(a,h),a=r.cloneNode(!1),h=null,c=!0));return a.childNodes.length>0&&(t.insertBefore(a,h),c=!0),s.length||t.removeAttribute("style"),c},__resetBrLineBreak(t){this._brLineBreak="br"===t},constructor:qi};const Zi=qi;function Yi(t){ne.call(this,t);const e=this.options;this.fontSizeUnitRegExp=null,this._isAllowedClassName=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this._allowHTMLComment=null,this._disallowedStyleNodesRegExp=null,this._htmlCheckWhitelistRegExp=null,this._htmlCheckBlacklistRegExp=null,this._elementWhitelistRegExp=null,this._elementBlacklistRegExp=null,this._attributeWhitelist=null,this._attributeBlacklist=null,this._attributeWhitelistRegExp=null,this._attributeBlacklistRegExp=null,this._cleanStyleTagKeyRegExp=null,this._cleanStyleRegExpMap=null,this._textStyleTags=e.get("_textStyleTags"),this._autoStyleify=null,this.__disallowedTagsRegExp=null,this.__disallowedTagNameRegExp=null,this.__allowedTagNameRegExp=null;const i=e.get("tagStyles"),s={};for(const t in i){const e=t.split("|");for(let n,o=0,l=e.length;o<l;o++)n=e[o],s[n]?s[n]+="|":s[n]="",s[n]+=i[t]}for(const t in s)s[t]=new RegExp(`\\s*[^-a-zA-Z](${s[t]})\\s*:[^;]+(?!;)*`,"gi");const n=new Map,o={...s,line:e.get("_lineStylesRegExp")};this._textStyleTags.forEach((t=>{o[t]=e.get("_textStylesRegExp")}));for(const t in o)n.set(new RegExp(`^(${t})$`),o[t]);this._cleanStyleTagKeyRegExp=new RegExp(`^(${Object.keys(o).join("|")})$`,"i"),this._cleanStyleRegExpMap=n,this.fontSizeUnitRegExp=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const l=e.get("_allowedExtraTag"),r=e.get("_disallowedExtraTag");this.__disallowedTagsRegExp=new RegExp(`<(${r})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${r})[^>]*\\/?>`,"gi"),this.__disallowedTagNameRegExp=new RegExp(`^(${r})$`,"i"),this.__allowedTagNameRegExp=new RegExp(`^(${l})$`,"i");const a=Object.keys(e.get("_defaultStyleTagMap")),h=e.get("elementWhitelist")?e.get("elementWhitelist").split("|").filter((t=>/b|i|ins|s|strike/i.test(t))):[];for(let t=0;t<h.length;t++)a.splice(a.indexOf(h[t].toLowerCase()),1);this._disallowedStyleNodesRegExp=0===a.length?null:new RegExp("(<\\/?)("+a.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const c=e.get("__defaultAttributeWhitelist");this._allowHTMLComment=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this._htmlCheckWhitelistRegExp=new RegExp("^("+ji(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this._htmlCheckBlacklistRegExp=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this._elementWhitelistRegExp=pt.createElementWhitelist(ji(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this._elementBlacklistRegExp=pt.createElementBlacklist(e.get("elementBlacklist").replace("|//","|\x3c!--|--\x3e"));const d='\\s*=\\s*(")[^"]*\\1',u=e.get("attributeWhitelist");let p={},g="";if(u)for(const t in u)/^on[a-z]+$/i.test(u[t])||("*"===t?g=ji(u[t],c):p[t]=new RegExp("\\s(?:"+ji(u[t],"")+")"+d,"ig"));this._attributeWhitelistRegExp=new RegExp("\\s(?:"+(g||c)+"|data-se-[^\\s]+"+(e.get("v2Migration")?"|data-index|data-file-size|data-file-name|data-exp|data-font-size":"")+")"+d,"ig"),this._attributeWhitelist=p;const m=e.get("attributeBlacklist");if(p={},g="",m)for(const t in m)"*"===t?g=ji(m[t],""):p[t]=new RegExp("\\s(?:"+ji(m[t],"")+")"+d,"ig");this._attributeBlacklistRegExp=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this._attributeBlacklist=p,this.__resetAutoStyleify(e.get("autoStyleify"))}function Xi(t,e,i,s){if(/^<[a-z0-9]+:[a-z0-9]+/i.test(i))return i;let n=null;const o=s.match(/(?!<)[a-zA-Z0-9-]+/)[0].toLowerCase();if(t){const t=this._attributeBlacklist[o];i=i.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,""),i=t?i.replace(t,""):i.replace(this._attributeBlacklistRegExp,"");const e=this._attributeWhitelist[o];n=e?i.match(e):i.match(this._attributeWhitelistRegExp)}if(!e)return i;if("a"===o){const t=i.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||(n=[]),n.push(t[0]))}else n&&/style=/i.test(n.toString())||(this._textStyleTags.includes(o)?n=this._cleanStyle(i,n,o):this.format.isLine(o)?n=this._cleanStyle(i,n,"line"):this._cleanStyleTagKeyRegExp.test(o)&&(n=this._cleanStyle(i,n,o)));if(gt.check.isMedia(o)||gt.check.isFigure(o)){const t=i.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);n||(n=[]),t&&n.push(t[0])}if(n)for(let t,e=0,i=n.length;e<i;e++)t=/^(?:href|src)\s*=\s*('|"|\s)*javascript\s*:/i.test(n[e].trim())?"":n[e],s+=(/^\s/.test(t)?"":" ")+t;return s}function ji(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}Yi.prototype={filter(t,{tagWhitelist:e,tagBlacklist:i,validate:s,validateAll:n}){if(e&&(t=t.replace(pt.createElementWhitelist(e),"")),i&&(t=t.replace(pt.createElementBlacklist(i),"")),s){const e=(new DOMParser).parseFromString(t,"text/html");e.body.querySelectorAll("*").forEach((t=>{if(!t.closest(".se-component")&&!t.closest(".se-flex-component")){const e=s(t);null===e?t.remove():e instanceof Node?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}else if(n){const e=(new DOMParser).parseFromString(t,"text/html"),i=[".se-component",".se-flex-component"],n=t=>i.some((e=>t.closest(e)));e.body.querySelectorAll("*").forEach((t=>{if(!n(t)){const e=s(t);null===e?t.remove():e instanceof Node?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}return t},clean(t,{forceFormat:e,whitelist:i,blacklist:s,_freeCodeViewMode:n}={}){const{tagFilter:o,formatFilter:l,classFilter:r,styleNodeFilter:a,attrFilter:h,styleFilter:c}=this.options.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.__disallowedTagsRegExp,""),t=this._deleteDisallowedTags(t,this._elementWhitelistRegExp,this._elementBlacklistRegExp).replace(/<br\/?>$/i,"")),this._autoStyleify){const e=(new DOMParser).parseFromString(t,"text/html");gt.query.getListChildNodes(e.body,pt.spanToStyleNode.bind(null,this._autoStyleify)),t=e.body.innerHTML}(h||c)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,Xi.bind(this,h,c)));const u=this._d.createRange().createContextualFragment(t);if(o)try{this._consistencyCheckOfHTML(u,this._htmlCheckWhitelistRegExp,this._htmlCheckBlacklistRegExp,o,l,r,n)}catch(t){console.warn("[SUNEDITOR.html.clean.fail]",t.message)}const p=u.querySelectorAll("[data-se-iframe-holder]");for(let t=0,e=p.length;t<e;t++){const e=gt.utils.createElement("iframe"),i=JSON.parse(p[t].getAttribute("data-se-iframe-holder-attrs"));for(const[t,s]of Object.entries(i))e.setAttribute(t,s);p[t].replaceWith(e)}if(this.options.get("__pluginRetainFilter")&&this.editor._MELInfo.forEach(((t,e)=>{const i=u.querySelectorAll(e);for(let e=0,s=i.length;e<s;e++)t(i[e])})),l){let t=u.childNodes;e||(e=this._isFormatData(t)),e&&(t=this._editFormat(u).childNodes);for(let i,s=0,n=t.length;s<n;s++)i=t[s],this.__allowedTagNameRegExp.test(i.nodeName)?d+=i.outerHTML:d+=this._makeLine(i,e)}return d||(d=t),o&&(i&&(d=d.replace("string"==typeof i?pt.createElementWhitelist(i):i,"")),s&&(d=d.replace("string"==typeof s?pt.createElementBlacklist(s):s,""))),a&&(d=this._styleNodeConvertor(d)),d},insert(t,{selectInserted:e,skipCharCount:i,skipCleaning:s}={}){if(this.editor.frameContext.get("wysiwyg").contains(this.selection.get().focusNode)||this.editor.focus(),"string"==typeof t){s||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(gt.check.isListCell(this.format.getLine(this.selection.getNode(),null))){const e=this._d.createRange().createContextualFragment(t).childNodes;this._isFormatData(e)&&(t=this._convertListCell(e))}const s=this._d.createRange().createContextualFragment(t).childNodes;if(!i){const t="byte-html"===this.editor.frameOptions.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let i=0,n=s.length;i<n;i++)e+=s[i][t];if(!this.char.check(e))return}let n,o,l,r,a;for(;n=s[0];)3===r?.nodeType&&1===o?.nodeType&>.check.isBreak(n)?(r=n,gt.utils.removeItem(n)):(l=this.insertNode(n,{afterNode:o,skipCharCount:!0}),o=l.container||l,a||(a=l),r=n);3===r?.nodeType&&1===o?.nodeType&&(o=r);const h=3===o.nodeType?l.endOffset||o.textContent.length:o.childNodes.length;e?this.selection.setRange(a.container||a,a.startOffset||0,o,h):this.component.is(o)||this.selection.setRange(o,h,o,h)}catch(t){if(this.editor.frameContext.get("isReadOnly")||this.editor.frameContext.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.component.is(t))this.component.insert(t,{skipCharCount:i,skipSelection:!1,skipHistory:!1});else{let e=null;(this.format.isLine(t)||gt.check.isMedia(t))&&(e=this.format.getLine(this.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:i})}this.editor.effectNode=null,this.editor.focus(),this.history.push(!1)},insertNode(t,{afterNode:e,skipCharCount:i}={}){let s=null;if(this.editor.frameContext.get("isReadOnly")||!i&&!this.char.check(t))return s;let n,o,l,r=null,a=this.selection.getRange(),h=gt.check.isListCell(a.commonAncestorContainer)?a.commonAncestorContainer:this.format.getLine(this.selection.getNode(),null),c=gt.check.isListCell(h)&&(gt.check.isListCell(t)||gt.check.isList(t)),d=null;const u=this.format.isBrLine(h),p=!u&&(this.format.isLine(t)||this.format.isBlock(t))||this.component.isBasic(t);if(c&&(l=e||gt.check.isList(t)?h.lastChild:h.nextElementSibling,d=gt.check.isList(t)?h:(l||h).parentNode),!e&&(p||this.component.isBasic(t)||gt.check.isMedia(t))){const t=gt.check.isEdgePoint(a.endContainer,a.endOffset,"end"),i=this.remove(),s=i.container,n=s===i.prevContainer&&a.collapsed?null:i.prevContainer;if(c&&n)if(d=3===n.nodeType?n.parentNode:n,d.contains(s)){let t=!0;for(l=s;l.parentNode&&l.parentNode!==d;)l=l.parentNode,t=!1;t&&s===n&&(l=l.nextSibling)}else l=null;else if(c&>.check.isListCell(s)&&!h.parentElement)h=gt.utils.createElement("LI"),d.appendChild(h),s.appendChild(d),l=null;else if(3===s.nodeType||gt.check.isBreak(s)||c){const n=gt.query.getParentElement(s,(t=>this.format.isBlock(t)||gt.check.isListCell(t)));if(e=this.nodeTransform.split(s,i.offset,n?gt.query.getNodeDepth(n)+1:0))if(c){if(h.contains(s)){const i=gt.check.isList(h.lastElementChild);let s=null;t||(s=h.cloneNode(!1),s.appendChild(e.textContent.trim()?e:gt.utils.createTextNode(ut.zeroWidthSpace))),i&&(s||(s=h.cloneNode(!1),s.appendChild(gt.utils.createTextNode(ut.zeroWidthSpace))),s.appendChild(h.lastElementChild)),s&&(h.parentNode.insertBefore(s,h.nextElementSibling),l=e=s)}}else e=e.previousSibling;else l=e=h}}a=e||p?this.selection.getRange():this.selection.getRangeAndAddLine(this.selection.getRange(),null);const g=a.commonAncestorContainer,m=a.startOffset,f=a.endOffset,_=a.startContainer===g&&this.format.isLine(g),b=_&&(g.childNodes[m]||g.childNodes[0])||a.startContainer,y=_&&(g.childNodes[f]||g.childNodes[g.childNodes.length-1])||a.endContainer;if(!c)if(e)n=e.parentNode,e=e.nextSibling,o=!0;else if(n=b,3===b.nodeType&&(n=b.parentNode),a.collapsed)if(3===g.nodeType)e=g.textContent.length>f?g.splitText(f):g.nextSibling;else if(gt.check.isBreak(n))e=n,n=n.parentNode;else{const i=n.childNodes[m],s=3===i?.nodeType&>.check.isZeroWidth(i)&>.check.isBreak(i.nextSibling)?i.nextSibling:i;s?!s.nextSibling&>.check.isBreak(s)?(n.removeChild(s),e=null):e=gt.check.isBreak(s)&&!gt.check.isBreak(t)?s:s.nextSibling:e=null}else{if(b===y){e=gt.check.isEdgePoint(y,f)?y.nextSibling:y.splitText(f);let t=b;gt.check.isEdgePoint(b,m)||(t=b.splitText(m)),n.removeChild(t),0===n.childNodes.length&&p&&(n.innerHTML="<br>")}else{const i=this.remove(),s=i.container,o=i.prevContainer;if(0===s?.childNodes.length&&p&&(this.format.isLine(s)?s.innerHTML="<br>":this.format.isBlock(s)&&(s.innerHTML="<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">")),gt.check.isListCell(s)&&3===t.nodeType)n=s,e=null;else if(!p&&o)if(n=3===o.nodeType?o.parentNode:o,n.contains(s)){let t=!0;for(e=s;e.parentNode&&e.parentNode!==n;)e=e.parentNode,t=!1;t&&s===o&&(e=e.nextSibling)}else e=null;else gt.check.isWysiwygFrame(s)&&!this.format.isLine(t)?(n=s.appendChild(gt.utils.createElement(this.options.get("defaultLine"))),e=null):n=(e=p?y:s===o?s.nextSibling:s)&&e.parentNode?e.parentNode:g;for(;e&&!this.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const i=this.editor.frameContext.get("wysiwyg");if(!c){if((gt.check.isWysiwygFrame(e)||n===i.parentNode)&&(n=i,e=null),this.format.isLine(t)||this.format.isBlock(t)||!gt.check.isListCell(n)&&this.component.isBasic(t)){const t=n;if(gt.check.isList(e))n=e,e=null;else if(gt.check.isListCell(e))n=e.previousElementSibling||e;else if(!o&&!e){const t=this.remove(),i=3===t.container.nodeType?gt.check.isListCell(this.format.getLine(t.container,null))?t.container:this.format.getLine(t.container,null)||t.container.parentNode:t.container,s=gt.check.isWysiwygFrame(i)||this.format.isBlock(i);n=s?i:i.parentNode,e=s?null:i.nextSibling}0===t.childNodes.length&&n!==t&>.utils.removeItem(t)}if(!p||u||this.format.isBlock(n)||gt.check.isListCell(n)||gt.check.isWysiwygFrame(n)||(e=n.nextElementSibling,n=n.parentNode),gt.check.isWysiwygFrame(n)&&(3===t.nodeType||gt.check.isBreak(t))){const e=gt.utils.createElement(this.options.get("defaultLine"),null,t);r=t,t=e}}if(c?d.parentNode?(n=d,e=l):(n=i,e=null):e=n===e?n.lastChild:e,gt.check.isListCell(t)&&!gt.check.isList(n)){if(gt.check.isListCell(n))e=n.nextElementSibling,n=n.parentNode;else{const t=gt.utils.createElement("ol");n.insertBefore(t,e),n=t,e=null}c=!0}if(this._checkDuplicateNode(t,n),n.insertBefore(t,e),c)if(gt.check.isZeroWidth(h.textContent.trim()))gt.utils.removeItem(h),t=t.lastChild;else{const e=gt.utils.arrayFind(h.children,gt.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(n.appendChild(t),t=n),gt.check.isZeroWidth(h.textContent.trim())&>.utils.removeItem(h))}}catch(e){n.appendChild(t),console.warn("[SUNEDITOR.html.insertNode.warn]",e)}finally{r&&(t=r);const e=n.querySelectorAll("[data-duple]");if(e.length>0)for(let i,s,n,o,l=0,r=e.length;l<r;l++){for(i=e[l],n=i.childNodes,o=i.parentNode;n[0];)s=n[0],o.insertBefore(s,i);i===t&&(t=s),gt.utils.removeItem(i)}if((this.format.isLine(t)||this.component.isBasic(t))&&b===y){const t=this.format.getLine(g,null);1===t?.nodeType&>.check.isEmptyLine(t)&>.utils.removeItem(t)}if(u&&(this.format.isLine(t)||this.format.isBlock(t))&&(t=this._setIntoFreeFormat(t)),!this.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.selection.setRange(t,e,t,e);else if(!gt.check.isBreak(t)&&!gt.check.isListCell(t)&&this.format.isLine(n)){let i=null;t.previousSibling&&!gt.check.isBreak(t.previousSibling)||(i=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(i,t)),t.nextSibling&&!gt.check.isBreak(t.nextSibling)||(i=gt.utils.createTextNode(ut.zeroWidthSpace),t.parentNode.insertBefore(i,t.nextSibling)),this.format._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.selection.setRange(t,e,t,e)}}s=t}return s},remove(){this.selection._resetRangeToTextNode();const t=this.selection.getRange(),e=0===t.startOffset,i=gt.check.isEdgePoint(t.endContainer,t.endOffset,"end");let s=null,n=null,o=null;e&&(n=this.format.getLine(t.startContainer),s=n?n.previousElementSibling:null,n=n?s:n),i&&(o=this.format.getLine(t.endContainer),o=o?o.nextElementSibling:o);let l,r=0,a=t.startContainer,h=t.endContainer,c=t.startOffset,d=t.endOffset;const u=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===a.parentNode?a.parentNode:t.commonAncestorContainer;if(u===a&&u===h){if(this.component.isBasic(u)){const t=this.component.get(u).container,e=t.parentElement,i=t.nextSibling||t.previousSibling,s=i===t.previousSibling?i?.textContent?.length||1:0,n=e.nextElementSibling||e.previousElementSibling,o=n===e.previousElementSibling?n?.textContent?.length||1:0;return gt.utils.removeItem(t),this.format.isLine(e)?0===e.childNodes.length?(gt.utils.removeItem(e),{container:n,offset:o,commonCon:u}):{container:i,offset:s,commonCon:u}:{container:n,offset:o,commonCon:u}}if(1===u.nodeType&&0===c&&1===d||3===u.nodeType&&0===c&&d===u.textContent.length){const t=gt.query.getNextDeepestNode(u,this.editor.frameContext.get("wysiwyg")),e=gt.query.getPreviousDeepestNode(u,this.editor.frameContext.get("wysiwyg")),i=this.format.getLine(u);gt.utils.removeItem(u);let s=t||e,n=t?0:3===s?.nodeType?s.textContent.length:1;const o=this.format.getLine(s)||this.component.get(s);return i!==o&&(s=o,n=0===n?0:1),gt.check.isZeroWidth(i)&&!i.contains(s)&>.utils.removeItem(i),{container:s,offset:n,commonCon:u}}a=u.children[c],h=u.children[d],c=d=0}if(!a||!h)return{container:u,offset:0,commonCon:u};if(a===h&&t.collapsed&>.check.isZeroWidth(a.textContent?.substring(c)))return{container:a,offset:c,prevContainer:a&&a.parentNode?a:null,commonCon:u};let p=null,g=null;const m=gt.query.getListChildNodes(u,null);let f=gt.utils.getArrayIndex(m,a),_=gt.utils.getArrayIndex(m,h);if(m.length>0&&f>-1&&_>-1){for(let t=f+1,e=a;t>=0;t--)m[t]===e.parentNode&&m[t].firstChild===e&&0===c&&(f=t,e=e.parentNode);for(let t=_-1,e=h;t>f;t--)m[t]===e.parentNode&&1===m[t].nodeType&&(m.splice(t,1),e=e.parentNode,--_)}else{if(0===m.length){if(this.format.isLine(u)||this.format.isBlock(u)||gt.check.isWysiwygFrame(u)||gt.check.isBreak(u)||gt.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(gt.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=h=u}else if(a=h=m[0],gt.check.isBreak(a)||gt.check.isZeroWidth(a))return{container:gt.check.isMedia(u)?u:a,offset:0,commonCon:u};f=_=0}const b=gt.check.isText,y=gt.check.isElement;for(let t=f;t<=_;t++){const e=m[t];if(!b(e)||void 0!==e.data&&0!==e.length)if(e!==a)if(e!==h)this._nodeRemoveListItem(e);else{if(b(h))g=gt.utils.createTextNode(h.substringData(d,h.length-d));else{if(this.component.is(h))continue;g=gt.utils.createTextNode(h.textContent)}g.length>0?h.data=g.data:this._nodeRemoveListItem(h)}else{if(y(a)){if(this.component.is(a))continue;p=gt.utils.createTextNode(a.textContent)}else{const t=a,i=h;e===h?(p=gt.utils.createTextNode(t.substringData(0,c)+i.substringData(d,i.length-d)),r=c):p=gt.utils.createTextNode(t.substringData(0,c))}if(p.length>0?a.data=p.data:this._nodeRemoveListItem(a),e===h)break}else this._nodeRemoveListItem(e)}const v=gt.query.getParentElement(h,"ul"),C=gt.query.getParentElement(a,"li");if(v&&C&&C.contains(v)?(l=v.previousSibling,r=l.textContent.length):(l=h&&h.parentNode?h:a&&a.parentNode?a:t.endContainer||t.startContainer,(e||i)&&(i?1===l.nodeType&&0===l.childNodes.length?(l.appendChild(gt.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!gt.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.editor.frameContext.get("wysiwyg"))}return this.selection.setRange(l,r,l,r),{container:l,offset:r,prevContainer:s,commonCon:u}},get({withFrame:t,includeFullPage:e,rootKey:i}={}){i?Array.isArray(i)||(i=[i]):i=[this.status.rootKey];const s=this.status.rootKey,n={};for(let s,o=0,l=i.length;o<l;o++){this.editor.changeFrameContext(i[o]);const l=this.editor.frameContext,r=gt.utils.createElement("DIV",null,this._convertToCode(l.get("wysiwyg"),!0)),a=gt.check.isTableCell,h=gt.check.isEmptyLine,c=[],d=[];gt.query.getListChildren(r,(t=>{t.hasAttribute("contenteditable")&&c.push(t);const e=t.parentElement;return a(e)&&e.children.length<=1&&h(t)&&d.push(e),!1}));for(let t=0,e=c.length;t<e;t++)c[t].removeAttribute("contenteditable");for(let t=0,e=d.length;t<e;t++)d[t].innerHTML="<br>";const u=r.innerHTML;if(this.editor.frameOptions.get("iframe_fullPage"))if(e){const t=gt.utils.getAttributesToString(l.get("_wd").body,["contenteditable"]);s=`<!DOCTYPE html><html>${l.get("_wd").head.outerHTML}<body ${t}>${u}</body></html>`}else s=u;else s=t?`<div class="${this.options.get("_editableClass")+""+(this.options.get("_rtl")?" se-rtl":"")}">${u}</div>`:r.innerHTML;n[i[o]]=s}return this.editor.changeFrameContext(s),i.length>1?n:n[i[0]]},set(t,{rootKey:e}={}){this.selection.removeRange();const i=null==t?"":this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let t=0;t<e.length;t++)if(this.editor.changeFrameContext(e[t]),this.editor.frameContext.get("isCodeView")){const t=this._convertToCode(i,!1);this.viewer._setCodeView(t)}else this.editor.frameContext.get("wysiwyg").innerHTML=i,this.editor._resetComponents(),this.history.push(!1,e[t])},add(t,{rootKey:e}={}){e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++){this.editor.changeFrameContext(e[i]);const s=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.editor.frameContext.get("isCodeView"))this.viewer._setCodeView(this.viewer._getCodeView()+"\n"+this._convertToCode(s,!1));else{const t=gt.utils.createElement("DIV",null,s).children,n=t.length;for(let e=0;e<n;e++)t[e]&&this.editor.frameContext.get("wysiwyg").appendChild(t[e]);this.history.push(!1,e[i]),this.selection.scrollTo(t[n-1])}}},getJson({withFrame:t,rootKey:e}={}){return pt.htmlToJson(this.get({withFrame:t,rootKey:e}))},setJson(t,{rootKey:e}={}){this.set(pt.jsonToHtml(t),{rootKey:e})},async copy(t){try{return await _t.write(t),this.editor.ui.showToast(this.lang.message_copy_success,this.options.get("toastMessageTime").copy),!0}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.editor.ui.showToast(this.lang.message_copy_fail,this.options.get("toastMessageTime").copy,"error"),!1}},setFullPage(t,{rootKey:e}={}){if(!this.editor.frameOptions.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.status.rootKey];for(let i=0;i<e.length;i++)this.editor.changeFrameContext(e[i]),t.head&&(this.editor.frameContext.get("_wd").head.innerHTML=t.head.replace(this.__disallowedTagsRegExp,"")),t.body&&(this.editor.frameContext.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.editor._resetComponents()},compress:t=>t.replace(/>\s+</g,"> <").replace(/\n/g,"").trim(),_convertToCode(t,e){let i="";const s=RegExp,n=new s("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),o="string"==typeof t?this._d.createRange().createContextualFragment(t):t,l=t=>this.format.isLine(t)||this.component.is(t),r=e?"":"\n",a=e?0:1*this.status.codeIndentSize,h=a>0?new Array(a+1).join(" "):"";return function t(e,o){const a=e.childNodes,c=n.test(e.nodeName),d=c?o:"";for(let u,p,g,m,f,_,b=0,y=a.length;b<y;b++)u=a[b],m=n.test(u.nodeName),p=m?r:"",g=!l(u)||c||/^(TH|TD)$/i.test(e.nodeName)?"":r,8!==u.nodeType?3!==u.nodeType?0!==u.childNodes.length?u.outerHTML?(f=u.nodeName.toLowerCase(),_=d||m?o:"",i+=(g||(c?"":p))+_+u.outerHTML.match(s("<"+f+"[^>]*>","i"))[0]+p,t(u,o+h+""),i+=(/\n$/.test(i)?_:"")+"</"+f+">"+(g||p||c||/^(TH|TD)$/i.test(u.nodeName)?r:"")):i+=(new XMLSerializer).serializeToString(u):i+=(/^HR$/i.test(u.nodeName)?r:"")+(/^PRE$/i.test(u.parentElement.nodeName)&&/^BR$/i.test(u.nodeName)?"":d)+u.outerHTML+p:gt.check.isList(u.parentElement)||(i+=pt.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):i+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),i.trim()+r},_nodeRemoveListItem(t){const e=this.format.getLine(t,null);gt.utils.removeItem(t),gt.check.isListCell(e)&&(this.nodeTransform.removeAllParents(e,null,null),gt.check.isList(e?.firstChild)&&e.insertBefore(gt.utils.createTextNode(ut.zeroWidthSpace),e.firstChild))},_setIntoFreeFormat(t){const e=t.parentNode;let i,s;for(;this.format.isLine(t)||this.format.isBlock(t);){for(i=t.childNodes,s=null;i[0];)if(s=i[0],this.format.isLine(s)||this.format.isBlock(s)){if(this._setIntoFreeFormat(s),!t.parentNode)break;i=t.childNodes}else e.insertBefore(s,t);0===t.childNodes.length&>.utils.removeItem(t),t=gt.utils.createElement("BR"),e.insertBefore(t,s.nextSibling)}return t},_makeLine(t,e){const i=this.options.get("defaultLine");if(1===t.nodeType){if(this.__disallowedTagNameRegExp.test(t.nodeName))return"";if(gt.check.isExcludeFormat(t))return t.outerHTML;const s=gt.query.getListChildNodes(t,(t=>gt.check.isSpanWithoutAttr(t)&&!gt.query.getParentElement(t,gt.check.isExcludeFormat)))||[];for(let t,e=s.length-1;e>=0;e--)t=s[e],t.outerHTML=t.innerHTML;if(!e||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||gt.check.isMedia(t)||gt.check.isFigure(t)||gt.check.isAnchor(t)&>.check.isMedia(t.firstElementChild)){const e=t;return gt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+i+">"+(gt.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+i+">"}}if(3===t.nodeType){if(!e)return pt.htmlToEntity(t.textContent);const s=t.textContent.split(/\n/g);let n="";for(let t,e=0,o=s.length;e<o;e++)t=s[e].trim(),t.length>0&&(n+="<"+i+">"+pt.htmlToEntity(t)+"</"+i+">");return n}return 8===t.nodeType&&this._allowHTMLComment?"\x3c!--"+t.textContent.trim()+"--\x3e":""},_consistencyCheckOfHTML(t,e,i,s,n,o,l){const r=[],a=[],h=[],c=[],d=gt.query.getListChildNodes(t,(d=>{if(n&&1!==d.nodeType)return gt.check.isList(d.parentElement)&&r.push(d),!1;if(s&&(i.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&>.check.isExcludeFormat(d)))return r.push(d),!1;const u=!gt.query.getParentElement(d,gt.check.isExcludeFormat);if(n){if(!gt.check.isTableElements(d)&&!gt.check.isListCell(d)&&!gt.check.isAnchor(d)&&(this.format.isLine(d)||this.format.isBlock(d)||this.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(gt.check.isList(d.parentNode)&&!gt.check.isList(d)&&!gt.check.isListCell(d))return h.push(d),!1;if(gt.check.isTableCell(d)){const t=d.firstElementChild;if(!this.format.isLine(t)&&!this.format.isBlock(t)&&!this.component.is(t))return c.push(d),!1}}if(o&&u&&d.className){const t=new Array(d.classList).map(this._isAllowedClassName).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(gt.check.isListCell(d)&&!gt.check.isList(d.parentNode)||(this.format.isLine(d)||this.component.is(d))&&!this.format.isBlock(d.parentNode)&&!gt.query.getParentElement(d,this.component.is.bind(this.component)))}));for(let t=0,e=r.length;t<e;t++)gt.utils.removeItem(r[t]);const u=[];for(let t,e,i=0,s=d.length;i<s;i++)if(t=d[i],e=t.parentNode,e&&e.parentNode)if(gt.query.getParentElement(t,gt.check.isListCell)){const i=t.childNodes;for(let n=i.length-1;s>=0;n--)e.insertBefore(t,i[n]);u.push(t)}else e.parentNode.insertBefore(t,e),u.push(e);for(let t,e=0,i=u.length;e<i;e++)t=u[e],gt.check.isZeroWidth(t.textContent.trim())&>.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)gt.utils.removeItem(a[t]);for(let t,e,i,s,n=0,o=h.length;n<o;n++)if(t=h[n],s=t.parentNode,s)if(e=gt.utils.createElement("LI"),this.format.isLine(t)){for(i=t.childNodes;i[0];)e.appendChild(i[0]);s.insertBefore(e,t),gt.utils.removeItem(t)}else t=t.nextSibling,e.appendChild(h[n]),s.insertBefore(e,t);for(let t,e,i=0,s=c.length;i<s;i++)t=c[i],e=gt.utils.createElement("DIV"),e.innerHTML=0===t.textContent.trim().length&&0===t.children.length?"<br>":t.innerHTML,t.innerHTML=e.outerHTML},_styleNodeConvertor(t){if(!this._disallowedStyleNodesRegExp)return t;const e=this.options.get("_defaultStyleTagMap");return t.replace(this._disallowedStyleNodesRegExp,((t,i,s,n)=>i+("string"==typeof e[s]?e[s]:s)+(n?" "+n:"")))},_editFormat(t){let e,i="";const s=t.childNodes;for(let t,n=0,o=s.length;n<o;n++)t=s[n],this.__allowedTagNameRegExp.test(t.nodeName)?i+=t.outerHTML:8===t.nodeType?i+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.format.isLine(t)||this.format.isBlock(t)||this.component.is(t)||gt.check.isExcludeFormat(t)?(e&&(i+=e.outerHTML,e=null),i+=t.outerHTML):(e||(e=gt.utils.createElement(this.options.get("defaultLine"))),this.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(i+=e.outerHTML),this._d.createRange().createContextualFragment(i)},_convertListCell(t){let e="";for(let i,s=0,n=t.length;s<n;s++)i=t[s],1===i.nodeType?gt.check.isList(i)?e+=i.innerHTML:gt.check.isListCell(i)?e+=i.outerHTML:this.format.isLine(i)?e+="<li>"+(i.innerHTML.trim()||"<br>")+"</li>":this.format.isBlock(i)&&!gt.check.isTableElements(i)?e+=this._convertListCell(i.children):e+="<li>"+i.outerHTML+"</li>":e+="<li>"+(i.textContent||"<br>")+"</li>";return e},_isFormatData(t){let e=!1;for(let i,s=0,n=t.length;s<n;s++)if(i=t[s],1===i.nodeType&&!this.format.isTextStyleNode(i)&&!gt.check.isBreak(i)&&!this.__disallowedTagNameRegExp.test(i.nodeName)){e=!0;break}return e},_cleanStyle(t,e,i){let s=(t.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/)||[])[0];if(this._textStyleTags.includes(i)&&!s&&(t.match(/<[^\s]+\s(.+)/)||[])[1]){const e=(t.match(/\ssize="([^"]+)"/i)||[])[1],i=(t.match(/\sface="([^"]+)"/i)||[])[1],n=(t.match(/\scolor="([^"]+)"/i)||[])[1];(e||i||n)&&(s='style="'+(e?"font-size:"+mt.get(Number(e)/3.333,1)+"rem;":"")+(i?"font-family:"+i+";":"")+(n?"color:"+n+";":"")+'"')}if(s){let t;e||(e=[]);for(const[e,s]of this._cleanStyleRegExpMap)if(e.test(i)){t=s;break}if(!t)return e;const n=s.replace(/"/g,"").match(t);if(!n)return e;const o=[];for(let t,e=0,i=n.length;e<i;e++)if(t=n[e].match(/([a-zA-Z0-9-]+)(:)([^"']+)/),t&&!/inherit|initial|revert|unset/i.test(t[3])){const e=pt.kebabToCamelCase(t[1].trim()),i=this.editor.frameContext.get("wwComputedStyle")[e]?.replace(/"/g,""),s=t[3].trim();switch(e){case"fontFamily":if(!this.plugins.font||!this.plugins.font.fontArray.includes(s))continue;break;case"fontSize":if(!this.plugins.fontSize)continue;this.fontSizeUnitRegExp.test(t[0])||(t[0]=t[0].replace((t[0].match(/:\s*([^;]+)/)||[])[1],pt.toFontUnit.bind(null,this.options.get("fontSizeUnits")[0])));break;case"color":if(!this.plugins.fontColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue;break;case"backgroundColor":if(!this.plugins.backgroundColor||/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i.test(s))continue}i!==s&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e},_deleteDisallowedTags:(t,e,i)=>(e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(i,"")),_checkDuplicateNode(t,e){const i=this;!function t(s){i._dupleCheck(s,e);const n=s.childNodes;for(let e=0,i=n.length;e<i;e++)t(n[e])}(t)},_dupleCheck(t,e){if(!this.format.isTextStyleNode(t))return;const i=(t.style.cssText.match(/[^;]+;/g)||[]).map((function(t){return t.trim()})),s=t.nodeName;if(/^span$/i.test(s)&&0===i.length)return t;const n=this.format;let o=!1;return function e(l){if(!gt.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===s){o=!0;const e=l.style.cssText.match(/[^;]+;/g)||[];for(let t,s=0,n=e.length;s<n;s++)(t=i.indexOf(e[s].trim()))>-1&&i.splice(t,1);for(let e=0,i=l.classList.length;e<i;e++)t.classList.remove(l.classList[e])}e(l.parentElement)}}(e),o&&((t.style.cssText=i.join(" "))||(t.setAttribute("style",""),t.removeAttribute("style")),t.attributes.length||t.setAttribute("data-duple","true")),t},__resetAutoStyleify(t){if(t.length>0){const e=this.options.get("convertTextTags"),i={};t.forEach((t=>{switch(t){case"bold":i.bold={regex:/font-weight\s*:\s*bold/i,tag:e.bold};break;case"italic":i.italic={regex:/font-style\s*:\s*italic/i,tag:e.italic};break;case"underline":i.underline={regex:/text-decoration\s*:\s*underline/i,tag:e.underline};break;case"strike":i.strike={regex:/text-decoration\s*:\s*line-through/i,tag:e.strike}}})),this._autoStyleify=i}else this._autoStyleify=null},constructor:Yi};const Ki=Yi;function Ji(t){ne.call(this,t),this.targetMap={},this.index=-1,this.menus=[],this.currentDropdown=null,this.currentDropdownActiveButton=null,this.currentDropdownName="",this.currentDropdownType="",this.currentContainer=null,this.currentContainerActiveButton=null,this.currentContainerName="",this._dropdownCommands=[],this.__globalEventHandler={mousedown:Qi.bind(this),containerDown:this.containerOff.bind(this),keydown:es.bind(this),mousemove:is.bind(this),mouseout:ts.bind(this)},this._bindClose_dropdown_mouse=null,this._bindClose_dropdown_key=null,this._bindClose_cons_mouse=null,this.currentDropdownPlugin=null,this.__menuBtn=null,this.__menuContainer=null}function Qi(t){const e=gt.query.getEventTarget(t);gt.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}function ts(){this.index=-1}function es(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this._moveItem(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this._moveItem(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}function is(t){gt.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),gt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}Ji.prototype={initDropdownTarget({key:t,type:e},i){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");/free$/.test(e)||(i.setAttribute("data-key",t),this._dropdownCommands.push(t)),this.context.get("menuTray").appendChild(i),this.targetMap[t]=i},dropdownOn(t){this.__removeGlobalEvent();const e=this._checkMoreLayer(t);if(e){const i=gt.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(i)return this.editor.runFromTarget(i),void this.dropdownOn(t)}const i=t,s=this.currentDropdownName=i.getAttribute("data-command");this.currentDropdownType=i.getAttribute("data-type");const n=this.currentDropdown=this.targetMap[s];this.currentDropdownActiveButton=i,this._setMenuPosition(i,n),this._bindClose_dropdown_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.mousedown,!1),this._dropdownCommands.includes(s)&&(this.menus=pt.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this._bindClose_dropdown_key=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler.keydown,!1),n.addEventListener("mousemove",this.__globalEventHandler.mousemove,!1),n.addEventListener("mouseout",this.__globalEventHandler.mouseout,!1))),this.currentDropdownPlugin=this.plugins[s],"function"==typeof this.currentDropdownPlugin?.on&&this.currentDropdownPlugin.on(i),this.editor._preventBlur=!0},dropdownOff(){this.__removeGlobalEvent(),this.index=-1,this.menus=[],this.__menuBtn=null,this.__menuContainer=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&>.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1,"function"==typeof this.currentDropdownPlugin?.off&&this.currentDropdownPlugin.off(),this.currentDropdownPlugin=null},containerOn(t){this.__removeGlobalEvent(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this._setMenuPosition(t,this.currentContainer=this.targetMap[e]),this._bindClose_cons_mouse=this.eventManager.addGlobalEvent("mousedown",this.__globalEventHandler.containerDown,!1),this.plugins[e].on&&this.plugins[e].on(t),this.editor._preventBlur=!0},containerOff(){this.__removeGlobalEvent(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,gt.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.editor._notHideToolbar=!1),this.editor._preventBlur=!1},_setMenuPosition(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",gt.utils.addClass(t.parentElement.children,"on"),this.offset.setRelPosition(e,this.carrierWrapper,t.parentElement,gt.query.getParentElement(t,".se-toolbar"),!1),e.style.visibility="",this.__menuBtn=t,this.__menuContainer=e},_restoreMenuPosition(){this.__menuBtn&&this.__menuContainer&&this._setMenuPosition(this.__menuBtn,this.__menuContainer)},_checkMoreLayer(t){const e=gt.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null},_moveItem(t){gt.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),gt.utils.addClass(this.currentDropdown,"se-select-menu-key-action"),t=this.index+t;const e=this.menus.length,i=this.index=t>=e?0:t<0?e-1:t;for(let t=0;t<e;t++)t===i?gt.utils.addClass(this.menus[t],"on"):gt.utils.removeClass(this.menus[t],"on")},__removeGlobalEvent(){this._bindClose_dropdown_mouse&&(this._bindClose_dropdown_mouse=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_mouse)),this._bindClose_cons_mouse&&(this._bindClose_cons_mouse=this.eventManager.removeGlobalEvent(this._bindClose_cons_mouse)),this._bindClose_dropdown_key&&(this._bindClose_dropdown_key=this.eventManager.removeGlobalEvent(this._bindClose_dropdown_key),gt.utils.removeClass(this.menus,"on"),gt.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"),this.currentDropdown.removeEventListener("mousemove",this.__globalEventHandler.mousemove,!1),this.currentDropdown.removeEventListener("mouseout",this.__globalEventHandler.mouseout,!1))},constructor:Ji};const ss=Ji;function ns(t){ne.call(this,t)}ns.prototype={split(t,e,i){if(gt.check.isWysiwygFrame(t)||this.component.is(t)||!t)return t;if(e&&!mt.is(e)){const i=t.childNodes;let s=gt.query.getPositionIndex(e);const n=t.cloneNode(!1),o=t.cloneNode(!1);for(let t=0,e=i.length;t<e;t++){if(t<s)n.appendChild(i[t]);else{if(!(t>s))continue;o.appendChild(i[t])}t--,e--,s--}return n.childNodes.length>0&&t.parentNode.insertBefore(n,t),o.childNodes.length>0&&t.parentNode.insertBefore(o,t.nextElementSibling),t}const s=t.parentNode;let n,o,l,r=0,a=1,h=!0;if((!i||i<0)&&(i=0),gt.check.isText(t)){if(r=gt.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const i=gt.query.getNodeFromPath([r+1],s);gt.check.isZeroWidth(i)&&(i.data=ut.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=gt.utils.createTextNode(ut.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:gt.query.getNodeDepth(t)===i&&(h=!1)}1===t.nodeType&&(a=0);let c=t;for(;gt.query.getNodeDepth(c)>i;)for(r=gt.query.getPositionIndex(c)+a,c=c.parentNode,l=n,n=c.cloneNode(!1),o=c.childNodes,l&&(gt.check.isListCell(n)&>.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,gt.utils.removeItem(l.firstElementChild),l.children.length>0&&n.appendChild(l)):n.appendChild(l));o[r];)n.appendChild(o[r]);c.childNodes.length<=1&&(!c.firstChild||0===c.firstChild.textContent.length)&&(c.innerHTML="<br>");const d=c.parentNode;return h&&(c=c.nextSibling),n?(this.mergeSameTags(n,null,!1),this.mergeNestedTags(n,gt.check.isList),n.childNodes.length>0?d.insertBefore(n,c):n=c,gt.check.isListCell(n)&&n.children&>.check.isList(n.children[0])&&n.insertBefore(gt.utils.createElement("BR"),n.children[0]),0===s.childNodes.length&>.utils.removeItem(s),n):c},mergeSameTags(t,e,i){const s=this,n=e?e.length:0;let o=null;return n&&(o=Array.apply(null,new Array(n)).map(Number.prototype.valueOf,0)),function t(l,r,a){const h=l.childNodes;for(let c,d,u=0,p=h.length;u<p&&(c=h[u],d=h[u+1],c);u++)if(!(gt.check.isBreak(c)||gt.check.isMedia(c)||gt.check.isInputElement(c)))if(i&&s.format._isIgnoreNodeChange(c)||!i&&(gt.check.isTableElements(c)||gt.check.isListCell(c)||s.format.isLine(c)&&!s.format.isBrLine(c)))(gt.check.isTableElements(c)||gt.check.isListCell(c))&&t(c,r+1,u);else{if(1===p&&l.nodeName===c.nodeName&&l.parentNode){if(n){let t,i,s,o,a;for(let h=0;h<n;h++)if(t=e[h],t&&t[r]===u){for(i=c,s=l,o=r,a=!0;o>=0;){if(gt.utils.getArrayIndex(s.childNodes,i)!==t[o]){a=!1;break}i=c.parentNode,s=i.parentNode,o--}a&&(t.splice(r,1),t[r]=u)}}gt.utils.copyTagAttributes(c,l),l.parentNode.insertBefore(c,l),gt.utils.removeItem(l)}if(!d){1===c.nodeType&&t(c,r+1,u);break}if(c.nodeName===d.nodeName&>.check.isSameAttributes(c,d)&&c.getAttribute?.("href")===d.getAttribute?.("href")){const t=c.childNodes;let i=0;for(let e=0,s=t.length;e<s;e++)t[e].textContent.length>0&&i++;const s=c.lastChild,l=d.firstChild;let h=0;if(s&&l){const t=3===s.nodeType&&3===l.nodeType;h=s.textContent.length;let c=s.previousSibling;for(;c&&3===c.nodeType;)h+=c.textContent.length,c=c.previousSibling;if(i>0&&3===s.nodeType&&3===l.nodeType&&(s.textContent.length>0||l.textContent.length>0)&&i--,n){let c=null;for(let d=0;d<n;d++)if(c=e[d],c&&c[r]>u){if(r>0&&c[r-1]!==a)continue;c[r]-=1,c[r+1]>=0&&c[r]===u&&(c[r+1]+=i,t&&s&&3===s.nodeType&&l&&3===l.nodeType&&(o[d]+=h))}}}if(3===c.nodeType){if(h=c.textContent.length,c.textContent+=d.textContent,n){let t=null;for(let s=0;s<n;s++)if(t=e[s],t&&t[r]>u){if(r>0&&t[r-1]!==a)continue;t[r]-=1,t[r+1]>=0&&t[r]===u&&(t[r+1]+=i,o[s]+=h)}}}else c.innerHTML+=d.innerHTML;gt.utils.removeItem(d),u--}else 1===c.nodeType&&t(c,r+1,u)}}(t,0,0),o},mergeNestedTags(t,e){if("string"==typeof e){const t=new RegExp(`^(${e||".+"})$`,"i");e=e=>t.test(e.nodeName)}else"function"!=typeof e&&(e=()=>!0);!function t(i){let s=i.children;if(1===s.length&&s[0].nodeName===i.nodeName&&e(i)){const t=s[0];for(s=t.children;s[0];)i.appendChild(s[0]);i.removeChild(t)}for(let e=0,s=i.children.length;e<s;e++)t(i.children[e])}(t)},removeAllParents(t,e,i){if(!t)return null;let s=null;return e||(e=t=>{if(t===i||this.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)}),function t(i){if(!gt.check.isWysiwygFrame(i)){const n=i.parentNode;n&&e(i)&&(s={sc:i.previousElementSibling,ec:i.nextElementSibling},gt.utils.removeItem(i),t(n))}}(t),s},removeEmptyNode(t,e,i){const s=this,n=this.options.get("allowedEmptyTags");e&&(e=gt.query.getParentElement(e,(e=>t===e.parentElement))),function i(o){if(s.format._notTextNode(o)||o===e||gt.check.isNonEditable(o))return 0;if(o===t||!gt.check.isZeroWidth(o.textContent)||o.firstChild&>.check.isBreak(o.firstChild)||o.querySelector(n)){const t=o.children;for(let e=0,n=t.length,o=0;e<n;e++)t[e+o]&&!s.component.is(t[e+o])&&(o+=i(t[e+o]))}else if(o.parentNode)return o.parentNode.removeChild(o),-1;return 0}(t),0===t.childNodes.length&&(i?gt.utils.removeItem(t):t.innerHTML="<br>")},createNestedNode(t,e){"function"!=typeof e&&(e=()=>!0);const i=t[0].cloneNode(!1);let s=i;for(let i,n=1,o=t.length;n<o;n++)e(t[n])&&(i=t[n].cloneNode(!1),s.appendChild(i),s=i);return s.innerHTML="",{parent:i,inner:s}},constructor:ns};const os=ns;function ls(t){ne.call(this,t),this._scrollEvent=null,this._elTop=0,this._scrollY=0,this._isFixed=!1}function rs(e,i,s,n){const o=/^fixed$/i.test(t.getComputedStyle(n).position);this._isFixed?o?e.style.top=this._elTop-(this._scrollY-t.scrollY-n.offsetTop)+"px":this.setRelPosition(e,i,s,n,!0):o&&this.setRelPosition(e,i,s,n,!0)}ls.prototype={get(t){const e=this.editor.frameContext.get("wysiwygFrame"),i=/iframe/i.test(e?.nodeName),s=this.getLocal(t);return{left:s.left+(i?e.parentElement.offsetLeft:0),top:s.top+(i?e.parentElement.offsetTop:0)}},getLocal(t){const e=t;let i=0,s=0,n=0,o=0,l=0,r=3===e.nodeType?e.parentElement:e;const a=e.offsetWidth,h=J(e,O.bind(this)),c=r;for(;r&&!D(r,"se-wrapper")&&r!==h;)i+=r.offsetLeft-(c!==r?r.scrollLeft:0),s+=r.offsetTop+(c!==r?r.scrollTop:0),r=r.offsetParent;const d=this.editor.frameContext.get("wysiwygFrame");this.editor.frameContext.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.editor.frameContext.get("eventWysiwyg");return i+=n,s+=o-(h?h.scrollTop:0),{left:i,top:s,right:r?.offsetWidth?r.offsetWidth-(i-n+a)+l:0,scrollX:u.scrollX||u.scrollLeft||0,scrollY:u.scrollY||u.scrollTop||0}},getGlobal(e){const i=this.editor.frameContext.get("topArea"),s=this.editor.frameContext.get("wysiwygFrame");let n=!1,o=!1;e||(e=i),e===i&&(n=!0),!n&&I(e)&&(o="absolute"===t.getComputedStyle(e).position);let l=e;const r=l.offsetWidth,a=l.offsetHeight;let h=0,c=0,d=0,u=0;for(;l;)h+=l.offsetTop,c+=l.offsetLeft,d+=l.scrollTop,u+=l.scrollLeft,l=l.offsetParent;if(!o&&!n&&/^iframe$/i.test(s.nodeName)&&this.editor.frameContext.get("wysiwyg").contains(l))for(l=this.editor.frameContext.get("wrapper");l;)h+=l.offsetTop,c+=l.offsetLeft,l=l.offsetParent;return{top:h+d,left:c+u,width:r,height:a,scrollTop:d,scrollLeft:u}},getGlobalScroll(e){const i=this.editor.frameContext.get("topArea");let s=!1,n=!1;e||(e=i),e===i&&(s=!0),!s&&I(e)&&(n="absolute"===t.getComputedStyle(e).position);let o=0,l=0,r=0,a=0,h=0,c=0,d=0,u=0,p=null,g=null,m=null,f=null,_=e;for(;_;)o+=_.scrollTop,l+=_.scrollLeft,r+=_.scrollHeight,a+=_.scrollWidth,_.scrollTop>0&&(c+=_.offsetTop),_.scrollHeight>_.clientHeight&&(d=/^html$/i.test(_.nodeName)?d||_.clientHeight:_.clientHeight+(m?-m.clientTop:0),p=m||p||_,m=_),_.scrollLeft>0&&(h+=_.offsetLeft),_.scrollWidth>_.clientWidth&&(u=/^html$/i.test(_.nodeName)?u||_.clientWidth:_.clientWidth+(f?-f.clientLeft:0),g=f||g||_,f=_),_=_.parentElement;if(!n&&!s&&/^iframe$/i.test(this.editor.frameContext.get("wysiwygFrame").nodeName))for(_=this.editor.frameContext.get("wrapper"),p=g=i;_;)o+=_.scrollTop,l+=_.scrollLeft,r+=_.scrollHeight,a+=_.scrollWidth,_.scrollTop>0&&(c+=_.offsetTop),_.scrollHeight>_.clientHeight&&(d=/^html$/i.test(_.nodeName)?d||_.clientHeight:_.clientHeight+(m?-m.clientTop:0),m=_),_.scrollLeft>0&&(h+=_.offsetLeft),_.scrollWidth>_.clientWidth&&(u=/^html$/i.test(_.nodeName)?u||_.clientWidth:_.clientWidth+(f?-f.clientLeft:0),f=_),_=_.parentElement;for(_=this.editor._shadowRoot?.host,_&&(p=g=i);_;)o+=_.scrollTop,l+=_.scrollLeft,r+=_.scrollHeight,a+=_.scrollWidth,_.scrollTop>0&&(c+=_.offsetTop),_.scrollHeight>_.clientHeight&&(d=/^html$/i.test(_.nodeName)?d||_.clientHeight:_.clientHeight+(m?-m.clientTop:0),m=_),_.scrollLeft>0&&(h+=_.offsetLeft),_.scrollWidth>_.clientWidth&&(u=/^html$/i.test(_.nodeName)?u||_.clientWidth:_.clientWidth+(f?-f.clientLeft:0),f=_),_=_.parentElement;const b=i.contains(p),y=i.contains(g);p=b?i:p,g=y?i:g;const v=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?t.scrollY:0):0,C=g?g.getBoundingClientRect().left+(!g.parentElement||/^html$/i.test(g.parentElement.nodeName)?t.scrollX:0):0;d=b?i.clientHeight:d,u=y?i.clientWidth:u;const w=U(this.editor.frameContext.get("_wd"));return{top:o,left:l,ts:v,ls:C,width:a,height:r,x:h,y:c,ohOffsetEl:n?window:p,owOffsetEl:n?window:g,oh:n?w.h:d,ow:n?w.w:u,heightEditorRefer:b,widthEditorRefer:y}},getWWScroll(){const t=this.editor.frameContext.get("wysiwyg"),e=this.selection.getRects(t,"start").rects,i=t.scrollY||t.scrollTop||0,s=t.scrollHeight||0;return{top:i,left:t.scrollX||t.scrollLeft||0,width:t.scrollWidth||0,height:s,bottom:i+s,rects:e}},setRelPosition(i,s,n,o,l){this._scrollY=t.scrollY;let r=0,a=o;do{if(this._isFixed=/^fixed$/i.test(t.getComputedStyle(a).position)){r+=this._scrollY;break}}while(!D(a,"sun-editor")&&(a=a.parentElement));l||(this.__removeGlobalEvent(),this._scrollEvent=this.editor.eventManager.addGlobalEvent("scroll",rs.bind(this,i,s,n,o),!1));const h=i.offsetWidth,c=n.offsetWidth,d=this.getGlobal(n).left,u=this.getGlobal(o).left;if(this.options.get("_rtl")){const t=h>c?h-c:0,e=t>0?0:c-h;i.style.left=`${d-t+e+u}px`,u>this.getGlobal(i).left&&(i.style.left=u+"px")}else{const t=o.offsetWidth+u,e=t<=h?0:t-(d+h);i.style.left=e<0?`${d+e+u}px`:`${d}px`}const p=o.contains(i)?this.getGlobal(s).top:0,g=i.offsetHeight,m=this.getGlobalScroll().top;let f=r,_=n;for(;_&&_!==s;)f+=_.offsetTop,_=_.offsetParent;const b=U(e).h-(p-m+f+n.offsetHeight);if(b<g){let t=-1*(g-f+3);const e=p-m+t,s=g+(e<0?e:0);s>b?(i.style.height=`${s}px`,t=-1*(s-f+3)):(i.style.height=`${b}px`,t=f+n.offsetHeight),i.style.top=`${t}px`}else i.style.top=`${f+n.offsetHeight}px`;this._isFixed&&(this._elTop=i.offsetTop)},setAbsPosition(i,s,n){const o={left:0,top:0,...n.addOffset},l=n.position||"bottom",r=n.inst,a=!this.options.get("_rtl");a||(o.left*=-1);const h=this.editor.frameContext.get("wrapper").contains(s)||n.isWWTarget,c=J(s,".se-controller"),d=h&&!c,u=U(e),p=d?this.getWWScroll():this._getWindowScroll(),g=c?s.getBoundingClientRect():this.selection.getRects(s,"start").rects,m=this.getGlobal(s),f=D(i.firstElementChild,"se-arrow")?i.firstElementChild:null,_=f?f.offsetHeight:0,b=i.offsetHeight,y=s.offsetHeight,v=g.top,C=u.h-g.bottom,w=this.editor.toolbar._sticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar.main").offsetHeight:0,{rmt:x,rmb:k,rt:S}=this._getVMargin(v,C,w,u,g,d,p);if(h&&(k+y<=0||x+S+y<=0))return;let E=o.top,T=0,H="";"bottom"===l?(H="up",E+=g.bottom+_+t.scrollY,T=k-(b+_),T<0&&(H="down",E-=y+b+2*_,T=w+x-(b+_),T<0&&(H="",E-=T))):(H="down",E+=g.top-b-_+t.scrollY,T=x-(b+_),T<0&&(H="up",E+=y+b+2*_,T=k-(b+_),T<0&&(H="",E+=T))),this._setArrow(f,H),i.style.top=`${E}px`;const M=(1===i.nodeType?mt.get(t.getComputedStyle(i).borderRadius):0)||0,L=m.width,N=i.offsetWidth,A=f?f.offsetWidth:0,B=g.left,I=u.w-g.right;let V,O;if(this.editor.frameContext.get("isFullScreen")?(V=B,O=I):(V=g.left,O=u.w-g.right),h&&(V+L<=0||O+L<=0))return;f&&(f.style.left="",f.style.right="");let R=o.left,z=0,$=0,F=0;return a?(R+=g.left+t.scrollX-(V<0?V:0),z=L+V,z<A&&(F=A/2-1+(M<=2?0:M-2),$=F),z=L+O-N,z<0&&(R+=z,F=N-1-(A/2+(M<=2?0:M-2)),$=-(z-A/2),$=$>F?F:$),f&&$>0&&(f.style.left=$+"px")):(R+=g.right-N+t.scrollX+(O<0?O:0),z=L+O,z<A&&(F=A/2-1+(M<=2?0:M-2),$=F),z=L+V-N,z<0&&(R-=z,F=A/2-1+(M<=2?0:M-2),$=-(z-A/2),$=$<F?F:$>N-F?N-F:$),f&&$>0&&(f.style.right=$+"px")),i.style.left=`${R}px`,r.__offset={left:i.offsetLeft+p.left,top:i.offsetTop+p.top,addOffset:o},{position:"up"===H?"bottom":"top"}},setRangePosition(i,s,{position:n,addTop:o}={}){i.style.top="-10000px",i.style.visibility="hidden",i.style.display="block";let l="top"===n;s=s||this.selection.getRange();const r=this.selection.getRects(s,l?"start":"end");l="start"===r.position;const a=this.editor.frameContext.get("isFullScreen"),h=this.editor.frameContext.get("topArea"),c=r.rects,d=a?0:r.scrollLeft,u=a?0:r.scrollTop,p=h.offsetWidth,g=this.getGlobal(h),m=g.left,f=i.offsetWidth,_=i.offsetHeight;this._setOffsetOnRange(l,c,i,m,p,d,u,o),this.getGlobal(i).top-g.top<0&&(l=!l,this._setOffsetOnRange(l,c,i,m,p,d,u,o)),f===i.offsetWidth&&_===i.offsetHeight||this._setOffsetOnRange(l,c,i,m,p,d,u,o);const b=!this.carrierWrapper.contains(i),y=U(e),v=b?this.getWWScroll():this._getWindowScroll(),C=c.height,w=c.top,x=y.h-c.bottom,k=this.editor.toolbar._sticky||!this.editor.isBalloon&&!this.editor.isInline?this.context.get("toolbar.main").offsetHeight:0,{rmt:S,rmb:E,rt:T}=this._getVMargin(w,x,k,y,c,b,v);if(!(E+C<=0||S+T+C<=0))return t.setTimeout((()=>{i.style.visibility=""}),0),!0},_setOffsetOnRange(t,i,s,n,o,l,r,a=0){const h=s.querySelector(".se-arrow "),c=Math.round(h.offsetWidth/2),d=s.offsetWidth,u=i.noText&&!t?0:s.offsetHeight,p=(t?i.left:i.right)-n-d/2+l,g=p+d-o;let m=(t?i.top-u-c:i.bottom+c)-(i.noText?0:a)+r;const f=p<0?1:g<0?p:p-g-1-1;let _=!1;const b=m+(t?this.getGlobal(this.editor.frameContext.get("topArea")).top:s.offsetHeight-this.editor.frameContext.get("wysiwyg").offsetHeight);!t&&b>0&&this._getPageBottomSpace()<b?(t=!0,_=!0):t&&e.documentElement.offsetTop>b&&(t=!1,_=!0),_&&(m=(t?i.top-u-c:i.bottom+c)-(i.noText?0:a)+r),s.style.left=Math.floor(f)+"px",s.style.top=Math.floor(m)+"px",t?(W(h,"se-arrow-up"),q(h,"se-arrow-down")):(W(h,"se-arrow-down"),q(h,"se-arrow-up"));const y=Math.floor(d/2+(p-f));h.style.left=(y+c>s.offsetWidth?s.offsetWidth-c:y<c?c:y)+"px"},_getPageBottomSpace(){const t=this.editor.frameContext.get("topArea");return e.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)},_getVMargin(e,i,s,n,o,l,r){let a=0,h=0,c=0;if(this.editor.frameContext.get("isFullScreen"))a=e-s,h=i;else{const e=l&&this.editor.frameOptions.get("iframe"),i=o.top,d=n.h-o.bottom,u=this.getGlobal(),p=this.getGlobalScroll(),g=this.editor.frameContext.get("statusbar")?.offsetHeight||0;if(e){const t=u.top-p.top-p.ts,e=this.editor.frameContext.get("topArea").offsetHeight;a=o.top-t,h=d-(p.oh-(e+t)+g)}else{c=this.editor.toolbar._sticky||this.options.get("toolbar_container")?0:s;const e=!l&&/\d+/.test(this.editor.frameOptions.get("height"))?u.top-t.scrollY+c:0,i=!l&&/\d+/.test(this.editor.frameOptions.get("height"))?t.innerHeight-(u.top+u.height-t.scrollY):0;let n=e;s>e?this.editor.toolbar._sticky?(n=s,s=0):n=e+s:this.options.get("toolbar_container")?s=0:n=e+(this.editor.toolbar._sticky?s:0),a=o.top-n,h=r.rects.bottom-o.bottom-i-g}a=(a>0?i:a)-s,h=h>0?d:h}return{rmt:a,rmb:h,rt:c}},_setArrow(t,e){"up"===e?(t&&(t.style.visibility=""),q(t,"se-arrow-up"),W(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),q(t,"se-arrow-down"),W(t,"se-arrow-up")):t&&(t.style.visibility="hidden")},_getWindowScroll(){const i=U(e);return{top:t.scrollY,left:t.scrollX,width:i.w,height:i.h,bottom:t.scrollY+i.h,rects:{left:0,top:0,right:t.innerWidth,bottom:t.innerHeight,noText:!0}}},__removeGlobalEvent(){this._scrollEvent&&(this._scrollEvent=this.editor.eventManager.removeGlobalEvent(this._scrollEvent),this._scrollY=0,this._elTop=null)},constructor:ls};const as=ls;function hs(t){ne.call(this,t),this.range=null,this.selectionNode=null,this.__iframeFocus=!1}hs.prototype={get(){let t=null;return t="function"==typeof this.editor._shadowRoot?.getSelection?this.editor._shadowRoot.getSelection():this.editor.frameContext.get("_ww").getSelection(),t?(this.status._range||this.editor.frameContext.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this._createDefaultRange())),t):null},isRange:t=>t instanceof Range,getRange(){const t=this.status._range||this._createDefaultRange(),e=this.get();if(t.collapsed===e.isCollapsed||!this.editor.frameContext.get("wysiwyg").contains(e.focusNode)){if(this.component.is(t.startContainer)){const e=this.component.get(t.startContainer),i=e?.container;return i?this.setRange(i,0,i,1):t}return t}if(e.rangeCount>0)return this.status._range=e.getRangeAt(0),this.status._range;{const t=e.anchorNode,i=e.focusNode,s=e.anchorOffset,n=e.focusOffset,o=gt.query.compareElements(t,i),l=o.ancestor&&(0===o.result?s<=n:o.result>1);return this.setRange(l?t:i,l?s:n,l?i:t,l?n:s)}},setRange(t,e,i,s){let n,o,l,r;if(this.isRange(t)){const e=t;n=e.startContainer,o=e.startOffset,l=e.endContainer,r=e.endOffset}else n=t,o=e,l=i,r=s;if(!n||!l)return;(gt.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(gt.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||gt.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||gt.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.editor.frameContext.get("_wd").createRange();try{a.setStart(n,o),a.setEnd(l,r),this.status.hasFocus=!0}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.editor._nativeFocus()}const h=this.get();return h.removeAllRanges&&h.removeAllRanges(),h.addRange(a),this.status._range=a,this._rangeInfo(a,this.get()),this.editor.frameOptions.get("iframe")&&this.__focus(),a},removeRange(){this.status._range=null,this.selectionNode=null,this.editor.effectNode=null,this.status.hasFocus&&this.get().removeAllRanges(),this.eventManager._setKeyEffect([])},getNearRange(t){const e=t.nextSibling,i=t.previousSibling;return e?{container:e,offset:0}:i?{container:i,offset:1}:null},getRangeAndAddLine(t,e){if(this._isNone(t)){const i=e?.parentElement||this.editor.frameContext.get("wysiwyg"),s=gt.utils.createElement(this.options.get("defaultLine"),null,"<br>");i.insertBefore(s,e&&e!==i?e.previousElementSibling?e.nextElementSibling:e:i.firstElementChild),this.setRange(s.firstElementChild,0,s.firstElementChild,1),t=this.status._range}return t},getNode(){if(this.editor.frameContext.get("wysiwyg").contains(this.selectionNode)||this._init(),!this.selectionNode){const t=gt.query.getEdgeChild(this.editor.frameContext.get("wysiwyg").firstChild,(t=>0===t.childNodes.length||3===t.nodeType),!1);if(t)return this.selectionNode=t,t;this._init()}return this.selectionNode},getRects(t,e){const i=!!gt.check.isElement(t)&&"absolute"===this._w.getComputedStyle(t).position;t=!t||gt.check.isText(t)?this.getRange():t;const s=this.offset.getGlobalScroll();let n="start"===e,o=s.left,l=s.top,r=t.getClientRects();if(r=r[n?0:r.length-1],!r){const t=this.getNode();if(this.format.isLine(t)){const t=gt.utils.createTextNode(ut.zeroWidthSpace);this.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.setRange(t,1,t,1),this._init(),r=this.getRange().getClientRects(),r=r[n?0:r.length-1]}if(!r){const e=this.offset.get(t);r={left:e.left,top:e.top,right:e.left+t.offsetWidth,bottom:e.top+t.offsetHeight,noText:!0},o=0,l=0}n=!0}const a=/^iframe$/i.test(this.editor.frameContext.get("wysiwygFrame").nodeName)?this.editor.frameContext.get("wysiwygFrame").getClientRects()[0]:null;return!i&&a&&(r={left:r.left+a.left,top:r.top+a.top,right:r.right+a.right-a.width,bottom:r.bottom+a.bottom-a.height}),{rects:r,position:n?"start":"end",scrollLeft:o,scrollTop:l}},getDragEventLocationRange(t){const e=this.editor.frameContext.get("_wd");let i,s,n,o,l;return e.caretPositionFromPoint?(i=e.caretPositionFromPoint(t.clientX,t.clientY),s=i.offsetNode,n=i.offset,o=i.offsetNode,l=i.offset):e.caretRangeFromPoint&&(i=e.caretRangeFromPoint(t.clientX,t.clientY),s=i.startContainer,n=i.startOffset,o=i.endContainer,l=i.endOffset),{sc:s,so:n,ec:o,eo:l}},scrollTo(t,e){t instanceof Selection?t=t.getRangeAt(0):t instanceof Node?t=this.setRange(t,1,t,1):void 0===t?.startContainer&&console.warn('[SUNEDITOR.html.scrollTo.warn] "selectionRange" must be Selection or Range or Node object.',t);const i=t.getBoundingClientRect();if(i.top>=0&&i.bottom<=this.editor.frameContext.get("wysiwygFrame").innerHeight)return;const s=gt.query.getParentElement(t.startContainer,(t=>1===t.nodeType));s?.scrollIntoView?.(e||this.options.get("scrollToOptions"))},_isNone(t){const e=t.commonAncestorContainer;return gt.check.isWysiwygFrame(t.startContainer)&>.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.editor._fileManager.regExp.test(e.nodeName)&&(!this.editor._fileManager.tagAttrs[e.nodeName]||this.editor._fileManager.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.component.is(e)},_createDefaultRange(){const t=this.editor.frameContext.get("wysiwyg"),e=this.editor.frameContext.get("_wd").createRange();let i=t.firstElementChild,s=null;return i?(s=i.firstChild,s||(s=gt.utils.createElement("BR"),i.appendChild(s))):(s=gt.utils.createElement("BR"),i=gt.utils.createElement(this.options.get("defaultLine"),null,s),t.appendChild(i)),e.setStart(s,0),e.setEnd(s,0),e},_rangeInfo(t,e){let i=null;this.status._range=t,i=t.collapsed?gt.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=i},_init(){const t=this.editor.frameContext.get("_wd").activeElement;if(gt.check.isInputElement(t))return this.selectionNode=t,t;const e=this.get();if(!e)return null;let i=null;i=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._rangeInfo(i,e)},__focus(){try{this.__iframeFocus=!0;const t=gt.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.editor.frameContext.get("wysiwyg").focus()}finally{dt._w.setTimeout((()=>this.__iframeFocus=!1),0)}},_resetRangeToTextNode(){let t=this.getRange();if(this._isNone(t)){if(!gt.check.isWysiwygFrame(t.startContainer)||!gt.check.isWysiwygFrame(t.endContainer))return!1;const e=t.commonAncestorContainer,i=e.children[t.startOffset],s=e.children[t.endOffset];if(!(t=this.setRange(i,0,s,i===s?0:1)))return!1}const e=t,i=e.collapsed;let s,n,o,l=e.startContainer,r=e.startOffset,a=e.endContainer,h=e.endOffset;if(this.format.isLine(l))for(l.childNodes[r]?(l=l.childNodes[r]||l,r=0):(l=l.lastChild||l,r=l.textContent.length);1===l?.nodeType&&l.firstChild;)l=l.firstChild||l,r=0;if(this.format.isLine(a)){for(a=a.childNodes[h]||a.lastChild||a;1===a?.nodeType&&a.lastChild;)a=a.lastChild;i?h=0:h>0&&(h=a.textContent.length)}if(s=gt.check.isWysiwygFrame(l)?this.editor.frameContext.get("wysiwyg").firstChild:l,n=r,gt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=gt.check.isBreak(s);if(!t){const t=s;for(;s&&!gt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let e=this.format.getLine(s,null);e===this.format.getBlock(e,null)&&(s=s||t,e=gt.utils.createElement(gt.query.getParentElement(s,gt.check.isTableCell)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(e,s),s!==t&&e.appendChild(s))}if(gt.check.isBreak(s)||this.component.is(s)){const e=gt.utils.createTextNode(ut.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,t&&l===a&&(a=s,h=1)}}if(l=s,r=n,s=gt.check.isWysiwygFrame(a)?this.editor.frameContext.get("wysiwyg").lastChild:a,n=h,gt.check.isBreak(s)||1===s.nodeType&&s.childNodes.length>0){const t=gt.check.isBreak(s);if(!t){for(;s&&!gt.check.isBreak(s)&&1===s.nodeType&&(o=s.childNodes,0!==o.length);)s=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:s.previousElementSibling||s.previousSibling||l,n=n>0?s.textContent.length:n;let t=this.format.getLine(s,null);t===this.format.getBlock(t,null)&&(t=gt.utils.createElement(gt.check.isTableCell(t)?"DIV":this.options.get("defaultLine")),s.parentNode.insertBefore(t,s),t.appendChild(s))}if(gt.check.isBreak(s)){const e=gt.utils.createTextNode(ut.zeroWidthSpace);s.parentNode.insertBefore(e,s),s=e,n=1,t&&!s.previousSibling&>.utils.removeItem(a)}}return a=s,h=n,this.setRange(l,r,a,h),!0},constructor:hs};const cs=hs;function ds(t){this.editor=t,this.isDisabled=!1}ds.prototype={command(t,e,i,s,n,o,l,r){if(this.isDisabled)return!1;let a=null;return a=e?this.editor.shortcutsKeyMap.get(s+(i?"1000":"")):this.editor.shortcutsKeyMap.get(n)||this.editor.shortcutsKeyMap.get(n+t.key),!(!a||!i&&a.s||a.space&&!ft.isSpace(s)||a.enter&&!ft.isEnter(s)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.editor.plugins[a.plugin][a.method]?.({range:r,line:l,info:a,event:t,keyCode:s}):"function"==typeof a.method?a.method({range:r,line:l,info:a,event:t,keyCode:s,editor:this.editor}):this.editor.run(a.command,a.type,a.button),!0)},disable(){this.isDisabled=!0},enable(){this.isDisabled=!1},constructor:ds};const us=ds,{_w:ps}=dt;function gs(t,{keyName:e,balloon:i,inline:s,balloonAlways:n,res:o}){ne.call(this,t),this.keyName=e,this.isSub=/sub/.test(e),this.currentMoreLayerActiveButton=null,this._isBalloon=i,this._isInline=s,this._isBalloonAlways=n,this._responsiveCurrentSize="default",this._originRes=o,this._rButtonArray=o,this._rButtonsInfo=null,this._rButtonsize=null,this._sticky=!1,this._isViewPortSize="visualViewport"in ps,this._inlineToolbarAttr={top:"",width:"",isShow:!1},this._balloonOffset={top:0,left:0},this._setResponsive()}gs.prototype={disable(){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff(),gt.utils.setDisabled(this.context.get(this.keyName+".buttonTray").querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)},enable(){gt.utils.setDisabled(this.context.get(this.keyName+".buttonTray").querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!1)},show(){this._isInline?this._showInline():this._isBalloon?this._showBalloon():(this.context.get(this.keyName+".main").style.display="",this.isSub||(this.editor.frameContext.get("_stickyDummy").style.display="")),this.isSub||this.resetResponsiveToolbar()},hide(){this._isInline?(this.context.get(this.keyName+".main").style.display="none",this.context.get(this.keyName+".main").style.top="0px",this._inlineToolbarAttr.isShow=!1):(this.context.get(this.keyName+".main").style.display="none",this.isSub||(this.editor.frameContext.get("_stickyDummy").style.display="none"),this._isBalloon&&(this._balloonOffset={top:0,left:0}))},resetResponsiveToolbar(){this.menu.containerOff();const t=this._rButtonsize;if(t){let e=0;e=(this._isBalloon||this._isInline)&&"auto"===this.options.get("toolbar_width")||this.editor.isSubBalloon&&"auto"===this.options.get("toolbar.sub_width")?this.editor.frameContext.get("topArea").offsetWidth:this.context.get(this.keyName+".main").offsetWidth;let i="default";for(let s=1,n=t.length;s<n;s++)if(e<t[s]){i=t[s]+"";break}this._responsiveCurrentSize!==i&&(this._responsiveCurrentSize=i,this.setButtons(this._rButtonsInfo[i]))}},setButtons(t){this._moreLayerOff(),this.menu.dropdownOff(),this.menu.containerOff();const{options:e,icons:i,lang:s,isSub:n}=this,o=Gt(t,this.plugins,e,i,s,!0);let l;o.updateButtons.forEach((t=>Ut(t.button,t.plugin,this.icons,this.lang))),l=n?this.editor.subAllCommandButtons=new Map:this.editor.allCommandButtons=new Map,this.editor.commandTargets=new Map,this.editor.shortcutsKeyMap=new Map,this.editor.__saveCommandButtons(l,o.buttonTray),this.editor.__cachingShortcuts(),this.context.get(this.keyName+".main").replaceChild(o.buttonTray,this.context.get(this.keyName+".buttonTray")),this.context.set(this.keyName+".buttonTray",o.buttonTray),this.editor.__setDisabledButtons(),this.history.resetButtons(this.editor.frameContext.get("key"),null),this._resetSticky(),this.editor.effectNode=null,this.viewer._setButtonsActive(),this.status.hasFocus&&this.eventManager.applyTagEffect(),this.editor.frameContext.get("isReadOnly")&&this.ui.setControllerOnDisabledButtons(!0),this.triggerEvent("onSetToolbarButtons",{buttonTray:o.buttonTray,frameContext:this.editor.frameContext})},_resetSticky(){const t=this.editor.frameContext.get("wrapper");if(!t)return;const e=this.context.get(this.keyName+".main");if(this.editor.frameContext.get("isFullScreen")||0===e.offsetWidth||this.options.get("toolbar_sticky")<0)return;const i=this._isViewPortSize?ps.visualViewport.pageTop:ps.scrollY,s=this.editor.frameContext.get("_minHeight"),n=t.offsetHeight,o=this.offset.getGlobal(this.editor.frameContext.get("topArea")),l=i+this.options.get("toolbar_sticky"),r=(this._isBalloon||this._isInline?o.top:this.offset.getGlobal(this.options.get("toolbar_container")).top)-(this._isInline?e.offsetHeight:0),a=this.options.get("toolbar_container")?o.top-i+n-s-this.options.get("toolbar_sticky")-e.offsetHeight:n+r+this.options.get("toolbar_sticky")-l-s;l<r?this._offSticky():a<0?(this._sticky||this._onSticky(1),e.style.top=1+a+this.__getViewportTop()+"px"):this._onSticky(1)},_onSticky(t){const e=this.context.get(this.keyName+".main");if(!this._isInline){const t=this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.editor.frameContext.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}const i=this.options.get("toolbar_sticky")+t+this.__getViewportTop();e.style.top=`${i}px`,e.style.width=this._isInline?this._inlineToolbarAttr.width:e.offsetWidth+"px",gt.utils.addClass(e,"se-toolbar-sticky"),this._sticky=!0},__getViewportTop(){return this._isViewPortSize?ps.visualViewport.offsetTop:0},_offSticky(){(this.options.get("toolbar_container")?this.context.get("_stickyDummy"):this.editor.frameContext.get("_stickyDummy")).style.display="none";const t=this.context.get(this.keyName+".main");t.style.top=this._isInline?this._inlineToolbarAttr.top:"",t.style.width=this._isInline?this._inlineToolbarAttr.width:"",this.editor.frameContext.get("wrapper").style.marginTop="",gt.utils.removeClass(t,"se-toolbar-sticky"),this._sticky=!1},_setResponsive(){if(0===this._rButtonArray?.length)return void(this._rButtonArray=null);this._responsiveCurrentSize="default";const t=this._rButtonsize=[],e=this._originRes,i=this._rButtonsInfo={default:e[0]};for(let s,n,o=1,l=e.length;o<l;o++)n=e[o],s=1*n[0],t.push(s),i[s]=n[1];t.sort(((t,e)=>t-e)).unshift("default")},_showBalloon(t){if(!this._isBalloon)return;this.isSub&&this.resetResponsiveToolbar();const e=t||this.selection.getRange(),i=this.context.get(this.keyName+".main"),s=this.selection.get();let n;if(this._isBalloonAlways&&e.collapsed)n=!0;else if(s.focusNode===s.anchorNode)n=s.focusOffset<s.anchorOffset;else{const t=gt.query.getListChildNodes(e.commonAncestorContainer,null);n=gt.utils.getArrayIndex(t,s.focusNode)<gt.utils.getArrayIndex(t,s.anchorNode)}this._setBalloonOffset(n,e),this.triggerEvent("onShowToolbar",{toolbar:i,mode:"balloon",frameContext:this.editor.frameContext})},_setBalloonOffset(t,e){const i=this.context.get(this.keyName+".main"),s=this.editor.frameContext.get("topArea"),n=this.offset.getGlobal(s).top;if(!this.offset.setRangePosition(i,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.options.get("toolbar_container")){const t=s.parentElement;let e=this.options.get("toolbar_container"),n=e.offsetLeft,o=e.offsetTop;for(;!e.parentElement.contains(t)||!/^(BODY|HTML)$/i.test(e.parentElement.nodeName);)e=e.offsetParent,n+=e.offsetLeft,o+=e.offsetTop;i.style.left=i.offsetLeft-n+s.offsetLeft+"px",i.style.top=i.offsetTop-o+s.offsetTop+"px"}const o=this.offset.getWWScroll();this._balloonOffset={top:i.offsetTop+o.top,left:i.offsetLeft+o.left,position:t?"top":"bottom"}},_showInline(){if(!this._isInline)return;const t=this.context.get(this.keyName+".main");t.style.visibility="hidden",this._offSticky(),t.style.display="block",t.style.top="0px",this._inlineToolbarAttr.width=t.style.width=this.options.get(this.keyName+"_width"),this._inlineToolbarAttr.top=t.style.top=this.offset.getGlobal(this.editor.frameContext.get("topArea")).top-this.offset.getGlobal(t).top-t.offsetHeight-1+"px",this._resetSticky(),this._inlineToolbarAttr.isShow=!0,this.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline"}),t.style.visibility=""},_moreLayerOn(t,e){this._moreLayerOff(),this.currentMoreLayerActiveButton=t,e.style.display="block"},_moreLayerOff(){if(this.currentMoreLayerActiveButton){this.context.get(this.keyName+".main").querySelector("."+this.currentMoreLayerActiveButton.getAttribute("data-command")).style.display="none",gt.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}},constructor:gs};const ms=gs,{_w:fs}=dt;function _s(t){ne.call(this,t),this._controllerOnBtnDisabled=!1;const e=function({lang:t,icons:e}){const i='<div><button class="close" data-command="close" title="'+t.close+'">'+e.cancel+"</button></div><div><span></span></div>";return gt.utils.createElement("DIV",{class:"se-alert-content"},i)}(t);this.alertModal=e,this.alertMessage=e.querySelector("span"),this._alertArea=this.carrierWrapper.querySelector(".se-alert"),this._alertInner=this.carrierWrapper.querySelector(".se-alert .se-modal-inner"),this._alertInner.appendChild(e),this._closeListener=[ys.bind(this),bs.bind(this)],this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._bindClose=null,this._backWrapper=this.carrierWrapper.querySelector(".se-back-wrapper");const i=function(){const t='<div class="se-toast-container"><span></span></div>';return gt.utils.createElement("DIV",{class:"se-toast"},t)}();this.toastPopup=i,this.toastContainer=i.querySelector(".se-toast-container"),this.toastMessage=i.querySelector("span"),this.carrierWrapper.appendChild(i),this._toastToggle=null}function bs(t){const e=gt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this._alertInner)&&this.alertClose()}function ys(t){ft.isEsc(t.code)&&this.alertClose()}_s.prototype={setEditorStyle(t,e){const i=(e=e||this.editor.frameContext).get("options");i.set("editorStyle",t);const s=pt._setDefaultOptionStyle(i,t);i.set("_defaultStyles",s),e.get("topArea").style.cssText=s.top;const n=e.get("code");n.style.cssText=i.get("_defaultStyles").frame,n.style.display="none",i.get("iframe")?(e.get("wysiwygFrame").style.cssText=s.frame,e.get("wysiwyg").style.cssText=s.editor):e.get("wysiwygFrame").style.cssText=s.frame+s.editor},setTheme(t){if("string"!=typeof t)return;const e=this.options,i=e.get("_themeClass").trim();e.set("theme",t||""),e.set("_themeClass",t?` se-theme-${t}`:""),t=e.get("_themeClass").trim();const s=e=>{e&&(i&>.utils.removeClass(e,i),t&>.utils.addClass(e,t))};s(this.carrierWrapper),this.editor.applyFrameRoots((t=>{s(t.get("topArea")),s(t.get("wysiwyg"))})),s(this.context.get("statusbar._wrapper")),s(this.context.get("toolbar._wrapper"))},readOnly(t,e){const i=e?this.frameRoots.get(e):this.editor.frameContext;i.set("isReadOnly",!!t),gt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!!t),t?(this._offCurrentController(),this._offCurrentModal(),this.toolbar?.currentMoreLayerActiveButton?.disabled&&this.toolbar._moreLayerOff(),this.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.subToolbar._moreLayerOff(),this.menu?.currentDropdownActiveButton?.disabled&&this.menu.dropdownOff(),this.menu?.currentContainerActiveButton?.disabled&&this.menu.containerOff(),i.get("code").setAttribute("readOnly","true"),gt.utils.addClass(i.get("wysiwyg"),"se-read-only")):(i.get("code").removeAttribute("readOnly"),gt.utils.removeClass(i.get("wysiwyg"),"se-read-only")),this.options.get("hasCodeMirror")&&this.viewer._codeMirrorEditor("readonly",!!t,e)},disable(t){const e=t?this.frameRoots.get(t):this.editor.frameContext;this.toolbar.disable(),this._offCurrentController(),this._offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable",!1),e.set("isDisabled",!0),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0},enable(t){const e=t?this.frameRoots.get(t):this.editor.frameContext;this.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable",!0),e.set("isDisabled",!1),this.options.get("hasCodeMirror")?this.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1},show(t){const e=(t?this.frameRoots.get(t):this.editor.frameContext).get("topArea").style;"none"===e.display&&(e.display="block")},hide(t){(t?this.frameRoots.get(t):this.editor.frameContext).get("topArea").style.display="none"},showLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="block"},hideLoading(t){(t?this.frameRoots.get(t).get("container"):this.carrierWrapper).querySelector(".se-loading-box").style.display="none"},setControllerOnDisabledButtons(t){t&&!this._controllerOnBtnDisabled?(gt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!0),this._controllerOnBtnDisabled=!0):!t&&this._controllerOnBtnDisabled&&(gt.utils.setDisabled(this.editor._controllerOnDisabledButtons,!1),this._controllerOnBtnDisabled=!1)},enableBackWrapper(t){this._backWrapper.style.cursor=t,this._backWrapper.style.display="block"},disableBackWrapper(){this._backWrapper.style.display="none",this._backWrapper.style.cursor="default"},alertOpen(t,e){this.alertMessage.textContent=t,gt.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&>.utils.addClass(this.alertModal,`se-alert-${e}`),this._closeSignal&&this._alertInner.addEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),this._bindClose=this.eventManager.addGlobalEvent("keydown",this._closeListener[0]),this._alertArea.style.display="block",gt.utils.addClass(this.alertModal,"se-modal-show")},alertClose(){gt.utils.removeClass(this.alertModal,"se-modal-show"),gt.utils.removeClass(this.alertModal,"se-alert-*"),this._alertArea.style.display="none",this._closeSignal&&this._alertInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose))},showToast(t,e=1e3,i){gt.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),gt.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),i&>.utils.addClass(this.toastPopup,`se-toast-${i}`),this.toastPopup.style.display="block",this.toastMessage.textContent=t,gt.utils.addClass(this.toastContainer,"se-toast-show"),this._toastToggle=fs.setTimeout((()=>{this.closeToast()}),e)},closeToast(){this._toastToggle&&fs.clearTimeout(this._toastToggle),this._toastToggle=null,gt.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.style.display="none"},_visibleControllers(t,e){const i=t?"":"hidden",s=e??i?"":"hidden",n=this.editor.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=i);this.editor._lineBreaker_t.style.visibility=s,this.editor._lineBreaker_b.style.visibility=s},_offCurrentController(){this.component.__deselect()},__offControllers(){const t=this.editor.opendControllers,e=[];for(let i,s=0;s<t.length;s++)i=t[s],i.fixed?e.push(i):("function"==typeof i.inst.close&&i.inst.close(),i.form&&(i.form.style.display="none"));this.editor.opendControllers=e,this.editor.currentControllerName="",this.editor._preventBlur=!1},_offCurrentModal(){this.editor.opendModal&&this.editor.opendModal.close()},constructor:_s};const vs=_s;function Cs(t){ne.call(this,t),this.bodyOverflow="",this.editorAreaOriginCssText="",this.wysiwygOriginCssText="",this.codeWrapperOriginCssText="",this.codeOriginCssText="",this.codeNumberOriginCssText="",this.toolbarOriginCssText="",this.arrowOriginCssText="",this.fullScreenInnerHeight=0,this.fullScreenSticky=!1,this.fullScreenBalloon=!1,this.fullScreenInline=!1,this.toolbarParent=null}function ws(t){const e=dt._w.getComputedStyle(t).lineHeight;let i;if(mt.is(e))i=mt.get(e);else{const e=dt._w.getComputedStyle(t).fontSize;i=1.2*mt.get(e)}return i}Cs.prototype={codeView(t){const e=this.editor.frameContext;if(void 0===t&&(t=!e.get("isCodeView")),t===e.get("isCodeView"))return;e.set("isCodeView",t),this.ui._offCurrentController(),this.ui._offCurrentModal();const i=e.get("codeWrapper"),s=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this._setEditorDataToCodeView(),i.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?s.style.height="100%":"auto"!==this.editor.frameOptions.get("height")||this.options.get("hasCodeMirror")||(s.style.height=s.scrollHeight>0?s.scrollHeight+"px":"auto"),this.options.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.editor._notHideToolbar=!0,this.editor.isBalloon&&(this.context.get("toolbar._arrow").style.display="none",this.context.get("toolbar.main").style.left="",this.editor.isInline=this.toolbar._isInline=!0,this.editor.isBalloon=this.toolbar._isBalloon=!1,this.toolbar._showInline())),this.editor.isSubBalloon&&this.subToolbar.hide(),function(t){const e=t.get("codeNumbers");if(!e)return;const i=ws(e),s=t.get("code").scrollHeight/i;let n="";for(let t=1;t<=s;t++)n+=`${t}\n`;const{padding:o,margin:l}=dt._w.getComputedStyle(t.get("code"));e.value=n,e.style.padding=o||"",e.style.margin=l||""}(e),this.status._range=null,s.focus(),gt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"),gt.utils.addClass(o,"se-code-view-status")):(gt.check.isNonEditable(n)||this._setCodeDataToEditor(),n.scrollTop=0,i.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.editor.frameOptions.get("height")||this.options.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.editor._notHideToolbar=!1,/balloon/.test(this.options.get("mode"))&&(this.context.get("toolbar._arrow").style.display="",this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!0,this.eventManager._hideToolbar())),this.editor._nativeFocus(),gt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),gt.check.isNonEditable(n)||(this.history.push(!1),this.history.resetButtons(e.get("key"),null)),gt.utils.removeClass(o,"se-code-view-status")),this.editor._checkPlaceholder(e),gt.utils.setDisabled(this.editor._codeViewDisabledButtons,t),e.has("documentType-use-header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})},fullScreen(t){const e=this.editor.frameContext;if(void 0===t&&(t=!e.get("isFullScreen")),t===e.get("isFullScreen"))return;e.set("isFullScreen",t);const i=e.get("topArea"),s=this.context.get("toolbar.main"),n=e.get("wrapper"),o=e.get("wysiwygFrame"),l=e.get("codeWrapper"),r=e.get("code"),a=e.get("codeNumbers"),h=this.editor.frameContext.get("isCodeView"),c=this.context.get("toolbar._arrow");this.ui._offCurrentController();const d="none"===s.style.display||this.editor.isInline&&!this.editor.toolbar._inlineToolbarAttr.isShow;if(t){this._originCssText=i.style.cssText,this.editorAreaOriginCssText=n.style.cssText,this.wysiwygOriginCssText=o.style.cssText,this.codeWrapperOriginCssText=l.style.cssText,this.codeOriginCssText=r.style.cssText,this.codeNumberOriginCssText=a?.style.cssText,this.toolbarOriginCssText=s.style.cssText,c&&(this.arrowOriginCssText=c.style.cssText),(this.editor.isBalloon||this.editor.isInline)&&(c&&(c.style.display="none"),this.fullScreenInline=this.editor.isInline,this.fullScreenBalloon=this.editor.isBalloon,this.editor.isInline=this.toolbar._isInline=!1,this.editor.isBalloon=this.toolbar._isBalloon=!1),this.options.get("toolbar_container")&&(this.toolbarParent=s.parentElement,e.get("container").insertBefore(s,n)),i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.maxWidth="100%",i.style.height="100%",i.style.zIndex="2147483639","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.fullScreenSticky=!0,e.get("_stickyDummy").style.display="none",gt.utils.removeClass(s,"se-toolbar-sticky")),this.bodyOverflow=this._d.body.style.overflow,this._d.body.style.overflow="hidden",n.style.cssText=s.style.cssText="",o.style.cssText=(o.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+this.editor.frameOptions.get("_defaultStyles").editor+(h?"display: none;":""),l.style.cssText=(l.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${h?"flex":"none"} !important;`,l.style.overflow="auto",l.style.height="100%",r.style.height="",s.style.width=o.style.height="100%",s.style.position="relative",s.style.display="block",this.fullScreenInnerHeight=this._w.innerHeight-s.offsetHeight,n.style.height=this.fullScreenInnerHeight-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.options.get("fullScreenOffset")+"px",this.editor.frameOptions.get("iframe")&&"auto"===this.editor.frameOptions.get("height")&&(n.style.overflow="auto",this.editor._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.options.get("fullScreenOffset")+"px";const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.addClass(e,"active")}))}else{o.style.cssText=this.wysiwygOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(h?"display: none;":""),l.style.cssText=this.codeWrapperOriginCssText.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${h?"flex":"none"} !important;`,r.style.cssText=this.codeOriginCssText,a&&(a.style.cssText=this.codeNumberOriginCssText),s.style.cssText=this.toolbarOriginCssText,n.style.cssText=this.editorAreaOriginCssText,i.style.cssText=this._originCssText,c&&(c.style.cssText=this.arrowOriginCssText),this._d.body.style.overflow=this.bodyOverflow,"auto"!==this.editor.frameOptions.get("height")||this.options.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.toolbarParent&&(this.toolbarParent.appendChild(s),this.toolbarParent=null),this.options.get("toolbar_sticky")>-1&>.utils.removeClass(s,"se-toolbar-sticky"),this.fullScreenSticky&&!this.options.get("toolbar_container")&&(this.fullScreenSticky=!1,e.get("_stickyDummy").style.display="block",gt.utils.addClass(s,"se-toolbar-sticky")),this.editor.isInline=this.toolbar._isInline=this.fullScreenInline,this.editor.isBalloon=this.toolbar._isBalloon=this.fullScreenBalloon,e.get("isCodeView")||(this.editor.isInline?this.editor.toolbar._showInline():this.editor.isBalloon&&this.editor.toolbar._showBalloon()),this.editor.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.removeClass(e,"active")}))}d&&!e.get("isCodeView")&&this.editor.toolbar.hide(),this.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})},showBlocks(t){const e=this.editor.frameContext;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(gt.utils.addClass(e.get("wysiwyg"),"se-show-block"),gt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active")):(gt.utils.removeClass(e.get("wysiwyg"),"se-show-block"),gt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")),this.editor._resourcesStateChange(e)},_setButtonsActive(){const t=this.editor.frameContext;if(t.get("isCodeView")?gt.utils.addClass(this.editor.commandTargets.get("codeView"),"active"):gt.utils.removeClass(this.editor.commandTargets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.icons.reduction;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.addClass(e,"active")}))}else{const t=this.icons.expansion;this.editor.applyCommandTargets("fullScreen",(e=>{gt.utils.changeElement(e.firstElementChild,t),gt.utils.removeClass(e,"active")}))}t.get("isShowBlocks")?gt.utils.addClass(this.editor.commandTargets.get("showBlocks"),"active"):gt.utils.removeClass(this.editor.commandTargets.get("showBlocks"),"active")},print(){const t=gt.utils.createElement("IFRAME",{style:"display: none;"});this._d.body.appendChild(t);const e=this._w.getComputedStyle(this.editor.frameContext.get("wysiwyg")).padding,i=this.options.get("printTemplate")?this.options.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get()):this.html.get(),s=gt.query.getIframeDocument(t),n=this.editor.frameContext.get("_wd"),o=this.options.get("_rtl")?" se-rtl":"",l=`\n\t\t\t<style>\n\t\t\t\t@page {\n\t\t\t\t\tsize: A4;\n\t\t\t\t\tmargin: ${e};\n\t\t\t\t}\n\t\t\t</style>`;if(this.editor.frameOptions.get("iframe")){const t=this.options.get("printClass")?'class="'+this.options.get("printClass")+o+'"':this.editor.frameOptions.get("iframe_fullPage")?gt.utils.getAttributesToString(n.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+o+'"';s.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n.head.innerHTML}\n\t\t\t\t\t\t${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${t} style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const t=this._d.head.getElementsByTagName("link"),e=this._d.head.getElementsByTagName("style");let n="";for(let e=0,i=t.length;e<i;e++)n+=t[e].outerHTML;for(let t=0,i=e.length;t<i;t++)n+=e[t].outerHTML;s.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n}\n\t\t\t\t\t\t${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.options.get("printClass")||this.options.get("_editableClass"))+o}" style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${i}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.ui.showLoading(),this._w.setTimeout((()=>{try{if(t.focus(),dt.isEdge||dt.isChromium||"StyleMedia"in dt._w)try{t.contentWindow.document.execCommand("print",!1,null)}catch(e){console.warn("[SUNEDITOR.print.warn]",e),t.contentWindow.print()}else t.contentWindow.print()}catch(t){throw Error(`[SUNEDITOR.print.fail] error: ${t.message}`)}finally{this.ui.hideLoading(),gt.utils.removeItem(t)}}),1e3)},preview(){this.menu.dropdownOff(),this.menu.containerOff(),this.ui._offCurrentController(),this.ui._offCurrentModal();const t=this.options.get("previewTemplate")?this.options.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.html.get({withFrame:!0})):this.html.get({withFrame:!0}),e=this._w.open("","_blank"),i=this.editor.frameContext.get("_wd"),s=this.options.get("_rtl")?" se-rtl":"";if(this.editor.frameOptions.get("iframe")){const n=this.options.get("printClass")?'class="'+this.options.get("printClass")+s+'"':this.editor.frameOptions.get("iframe_fullPage")?gt.utils.getAttributesToString(i.body,["contenteditable"]):'class="'+this.options.get("_editableClass")+s+'"';e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${i.head.innerHTML}\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\tbody {overflow:auto !important; height:auto !important;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${n}>\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const i=this._d.head.getElementsByTagName("link"),n=this._d.head.getElementsByTagName("style");let o="";for(let t=0,e=i.length;t<e;t++)o+=i[t].outerHTML;for(let t=0,e=n.length;t<e;t++)o+=n[t].outerHTML;e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<meta charset="utf-8" />\n\t\t\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">\n\t\t\t\t\t\t<title>${this.lang.preview}</title>\n\t\t\t\t\t\t${o}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.options.get("printClass")?this.options.get("printClass"):this.options.get("_editableClass"))+s}" style="height:auto">\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}},_resetFullScreenHeight(){if(this.editor.frameContext.get("isFullScreen"))return this.fullScreenInnerHeight+=this._w.innerHeight-this.context.get("toolbar.main").offsetHeight-(this.editor.frameContext.has("statusbar")?this.editor.frameContext.get("statusbar").offsetHeight:0)-this.fullScreenInnerHeight,this.editor.frameContext.get("wrapper").style.height=this.fullScreenInnerHeight+"px",!0},_codeMirrorEditor(t,e,i){const s=i?this.frameRoots.get(i).get("options"):this.editor.frameOptions;switch(t){case"set":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").getDoc().setValue(e):s.has("codeMirror6Editor")&&s.get("codeMirror6Editor").dispatch({changes:{from:0,to:s.get("codeMirror6Editor").state.doc.length,insert:e}});break;case"get":if(s.has("codeMirror5Editor"))return s.get("codeMirror5Editor").getDoc().getValue();if(s.has("codeMirror6Editor"))return s.get("codeMirror6Editor").state.doc.toString();break;case"readonly":s.has("codeMirror5Editor")?s.get("codeMirror5Editor").setOption("readOnly",e):s.has("codeMirror6Editor")&&(e?s.get("codeMirror6Editor").contentDOM.removeAttribute("contenteditable"):s.get("codeMirror6Editor").contentDOM.setAttribute("contenteditable",!0));break;case"refresh":s.has("codeMirror5Editor")&&s.get("codeMirror5Editor").refresh()}},_setCodeView(t){this.options.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.editor.frameContext.get("code").value=t},_getCodeView(){return this.options.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.editor.frameContext.get("code").value},_setCodeDataToEditor(){const t=this._getCodeView();if(this.editor.frameOptions.get("iframe_fullPage")){const e=this.editor.frameContext.get("_wd"),i=(new DOMParser).parseFromString(t,"text/html");if(!this.options.get("__allowedScriptTag")){const t=i.head.children;for(let e=0,s=t.length;e<s;e++)/^script$/i.test(t[e].tagName)&&(i.head.removeChild(t[e]),e--,s--)}let s=i.head.innerHTML;i.head.querySelector('link[rel="stylesheet"]')&&("auto"!==this.editor.frameOptions.get("height")||i.head.querySelector("style"))||(s+=pt._setIframeStyleLinks(this.editor.frameOptions.get("iframe_cssFileName"))+pt._setAutoHeightStyle(this.editor.frameOptions.get("height"))),e.head.innerHTML=s,e.body.innerHTML=this.html.clean(i.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")});const n=i.body.attributes;for(let t=0,i=n.length;t<i;t++)"contenteditable"!==n[t].name&&e.body.setAttribute(n[t].name,n[t].value);if(!gt.utils.hasClass(e.body,"sun-editor-editable")){const t=this.options.get("_editableClass").split(" ");for(let i=0;i<t.length;i++)gt.utils.addClass(e.body,this.options.get("_editableClass")[i])}}else this.editor.frameContext.get("wysiwyg").innerHTML=t.length>0?this.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")}):"<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">"},_setEditorDataToCodeView(){const t=this.html._convertToCode(this.editor.frameContext.get("wysiwyg"),!1);let e="";if(this.editor.frameOptions.get("iframe_fullPage")){const i=gt.utils.getAttributesToString(this.editor.frameContext.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.editor.frameContext.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+i+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)},_codeViewAutoHeight(t,e,i){i&&(t.style.height=t.scrollHeight+"px"),this._updateLineNumbers(e,t)},_updateLineNumbers(t,e){if(!t)return;const i=ws(t),s=Math.ceil(e.scrollHeight/i),n=(t.value.match(/\n/g)||[]).length;if(s>n){let e="";for(let t=n+1;t<=s;t++)e+=`${t}\n`;t.value+=e}},_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft},constructor:Cs};const xs=Cs,ks=".se-menu-list .se-toolbar-btn[data-command]",Ss=`${ks}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,Es=`${ks}:not([class~="se-component-enabled"]):not([data-type="MORE"])`;function Ts(t,e){const i=t[0].target.ownerDocument||dt._d,s=i.defaultView||dt._w,n=Zt(t,e);this.rootKeys=n.rootKeys,this.frameRoots=n.frameRoots,this.context=n.context,this.frameContext=new Map,this.frameOptions=new Map,this._d=i,this._w=s,this.carrierWrapper=n.carrierWrapper,this.options=n.options,this.plugins=n.plugins||{},this.events=null,this.triggerEvent=null,this.icons=n.icons,this.lang=n.lang,this.status={hasFocus:!1,tabSize:4,indentSize:25,codeIndentSize:2,currentNodes:[],currentNodesMap:[],onSelected:!1,rootKey:n.rootId,_range:null,_onMousedown:!1},this.isClassic=!1,this.isInline=!1,this.isBalloon=!1,this.isBalloonAlways=!1,this.isSubBalloon=!1,this.isSubBalloonAlways=!1,this.allCommandButtons=new Map,this.subAllCommandButtons=new Map,this.shortcutsKeyMap=new Map,this.reverseKeys=[],this.commandTargets=new Map,this.activeCommands=null,this.effectNode=null,this.opendModal=null,this.opendControllers=[],this.currentControllerName="",this.opendBrowser=null,this.selectMenuOn=!1,this.history=null,this.eventManager=null,this.toolbar=null,this.subToolbar=null,this.char=null,this.component=null,this.format=null,this.html=null,this.menu=null,this.nodeTransform=null,this.offset=null,this.selection=null,this.shortcuts=null,this.ui=null,this.viewer=null,this._lineBreaker_t=null,this._lineBreaker_b=null,this._shadowRoot=null,this._onPluginEvents=null,this._onCopyFormatInfo=null,this._onCopyFormatInitMethod=null,this._controllerTargetContext=null,this._controllerOnDisabledButtons=[],this._codeViewDisabledButtons=[],this._pluginCallButtons=n.pluginCallButtons,this._pluginCallButtons_sub=n.pluginCallButtons_sub,this._responsiveButtons=n.responsiveButtons,this._responsiveButtons_sub=n.responsiveButtons_sub,this._notHideToolbar=!1,this._preventBlur=!1,this._preventFocus=!1,this._preventSelection=!1,this._componentsInfoInit=!0,this._componentsInfoReset=!1,this._MELInfo=null,this._fileInfoPluginsCheck=null,this._fileInfoPluginsReset=null,this._fileManager={tags:null,regExp:null,pluginRegExp:null,pluginMap:null},this._componentManager=[],this._figureContainer=null,this._originOptions=e,this.__Create(e)}function Hs(t,e,i,s,n,o){const l=e[t],r=Object.keys(l);if(Ls(r,null,t+"."),0===r.length)return!1;const a=t||null;s.set(a,new Map);const h=i.get(a).get("options").get("_origin"),c={},d=Object.prototype.hasOwnProperty;for(const t in l){if(!d.call(Bt,t))continue;const e=l[t];r.includes(t)&&h[t]!==e&&(s.get(a).set(Ms(t),!0),c[t]=e)}const u={...h,...c};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}function Ms(t){return/^statusbar|^charCounter/.test(t)?"statusbar-changed":t}function Ls(t,e,i){for(let s,n=0,o=t.length;n<o;n++)s=t[n],("fixed"===It[s]||"fixed"===Bt[s]||e&&e[s])&&(console.warn(`[SUNEDITOR.warn.resetOptions] The "[${i+s}]" option cannot be changed after the editor is created.`),t.splice(n--,1),o--)}Ts.prototype={registerPlugin(t,e,i){let s=this.plugins[t];if(!s)throw Error(`[SUNEDITOR.registerPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName: "${t}")`);if("function"==typeof this.plugins[t]&&(s=this.plugins[t]=new this.plugins[t](this,i||{}),"function"==typeof s.init&&s.init()),e){for(let t=0,i=e.length;t<i;t++)Ut(e[t],s,this.icons,this.lang);this.activeCommands.includes(t)||"function"!=typeof this.plugins[t].active||this.activeCommands.push(t)}},run(t,e,i){if(e){if(/more/i.test(e)){const e=gt.query.getParentElement(i,".se-toolbar"),s=gt.utils.hasClass(e,"se-toolbar-sub")?this.subToolbar:this.toolbar;if(i!==s.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(s._moreLayerOn(i,n),s._showBalloon(),s._showInline()),gt.utils.addClass(i,"on")}else s.currentMoreLayerActiveButton&&(s._moreLayerOff(),s._showBalloon(),s._showInline());return void this.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentContainerActiveButton))return void this.menu.containerOn(i);if(this.frameContext.get("isReadOnly")&>.utils.arrayIncludes(this._controllerOnDisabledButtons,i))return;if(/dropdown/.test(e)&&(null===this.menu.targetMap[t]||i!==this.menu.currentDropdownActiveButton))return void this.menu.dropdownOn(i);if(/modal/.test(e))return void this.plugins[t].open(i);/command/.test(e)?this.plugins[t].action(i):/browser/.test(e)?this.plugins[t].open(null):/popup/.test(e)&&this.plugins[t].show()}else t&&this.commandHandler(t,i);/dropdown/.test(e)?this.menu.dropdownOff():/command/.test(e)||(this.menu.dropdownOff(),this.menu.containerOff())},async commandHandler(t,e){if(!this.frameContext.get("isReadOnly")||/copy|cut|selectAll|codeView|fullScreen|print|preview|showBlocks/.test(t))switch(t){case"selectAll":!function(t){t.ui._offCurrentController(),t.menu.containerOff();const e=t.frameContext.get("wysiwyg");let i=null,s="";const n=t.options.get("scopeSelectionTags"),o=t.selection.getRange();if(!o.collapsed){let t=o.commonAncestorContainer,l=t.nodeName?.toLowerCase();for(;t&&(!t.nextSibling&&!t.previousSibling&&!n.includes(l)||gt.check.isContentLess(l))&&t!==e;)t=t.parentElement,l=t.nodeName?.toLowerCase();n.includes(l)&&(i=t,s=l)}const l=n.filter((t=>t!==s));let r=gt.query.getParentElement(i||t.selection.getNode(),(t=>l.includes(t.nodeName?.toLowerCase())))||e,{first:a,last:h}=Qt(r);if(!a||!h)return;const c=gt.check.isZeroWidth;for(;c(a)&&c(h)&&r!==e;)r=r.parentElement,({first:a,last:h}=Qt(gt.query.getParentElement(r,(t=>l.includes(t.nodeName?.toLowerCase())))||e));if(!a||!h)return;let d=null;if(gt.check.isMedia(a)||(d=t.component.get(a.parentElement))||gt.check.isTableElements(a)){const e=gt.utils.createElement("BR"),i=gt.utils.createElement(t.options.get("defaultLine"),null,e);a=d?d.container||d.cover:a,a.parentElement.insertBefore(i,a),a=e}if(gt.check.isMedia(h)||(d=t.component.get(h.parentElement))||gt.check.isTableElements(h)){const e=gt.utils.createElement("BR"),i=gt.utils.createElement(t.options.get("defaultLine"),null,e);h=d?d.container||d.cover:h,h.parentElement.appendChild(i),h=e}t.toolbar._showBalloon(t.selection.setRange(a,0,h,h.textContent.length))}(this);break;case"copy":{const t=this.selection.getRange();if(t.collapsed)break;const e=gt.utils.createElement("div",null,t.cloneContents());await this.html.copy(e.innerHTML);break}case"newDocument":this.html.set(`<${this.options.get("defaultLine")}><br></${this.options.get("defaultLine")}>`),this.focus(),this.history.push(!1);break;case"codeView":this.viewer.codeView(!this.frameContext.get("isCodeView"));break;case"fullScreen":this.viewer.fullScreen(!this.frameContext.get("isFullScreen"));break;case"indent":this.format.indent();break;case"outdent":this.format.outdent();break;case"undo":this.history.undo();break;case"redo":this.history.redo();break;case"removeFormat":this.format.removeInlineElement(),this.focus();break;case"print":this.viewer.print();break;case"preview":this.viewer.preview();break;case"showBlocks":this.viewer.showBlocks(!this.frameContext.get("isShowBlocks"));break;case"dir":this.setDir(this.options.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.setDir("ltr");break;case"dir_rtl":this.setDir("rtl");break;case"save":await async function(t){const e=t.frameContext;if(!e.get("isChanged"))return;const i=t.html.get(),s=await t.triggerEvent("onSave",{frameContext:e,data:i});if(s===Yt){const t=e.get("originElement");/^TEXTAREA$/i.test(t.nodeName)?t.value=i:t.innerHTML=i}else if(!1===s)return;e.set("isChanged",!1),e.set("savedIndex",t.history.getRootStack()[t.status.rootKey].index),t.applyCommandTargets("save",(t=>{t.disabled=!0}))}(this);break;case"copyFormat":ie(this,e);break;case"pageBreak":!function(t){const e=gt.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});t.component.insert(e,{skipCharCount:!0,skipSelection:!0,skipHistory:!1});const i=e.nextElementSibling||t.format.addLine(e);t.selection.setRange(i,1,i,1),t.history.push(!1)}(this);break;case"pageUp":this.frameContext.get("documentType").pageUp();break;case"pageDown":this.frameContext.get("documentType").pageDown();break;default:!function(t,e){e=t.options.get("_defaultTagCommand")[e.toLowerCase()]||e;let i=t.options.get("convertTextTags")[e]||e;const s=t.status.currentNodesMap,n=s.includes(t.options.get("_styleCommandMap")[i])?null:gt.utils.createElement(i);/^sub$/i.test(i)&&s.includes("superscript")?i="sup":/^sup$/i.test(i)&&s.includes("subscript")&&(i="sub"),t.format.applyInlineElement(n,{stylesToModify:Xt[e]||null,nodesToRemove:[i],strictRemove:!1}),t.focus()}(this,t)}},runFromTarget(t){if(gt.check.isInputElement(t))return;const e=gt.query.getCommandTarget(t);if(!e)return;const i=e.getAttribute("data-command"),s=e.getAttribute("data-type");(i||s)&&(e.disabled||this.run(i,s,t))},applyCommandTargets(t,e){this.commandTargets.has(t)&&this.commandTargets.get(t).forEach(e)},applyFrameRoots(t){this.frameRoots.forEach(t)},isEmpty(t){const e=(t=t||this.frameContext).get("wysiwyg");return gt.check.isZeroWidth(e.textContent)&&!e.querySelector(this.options.get("allowedEmptyTags"))&&(e.innerText.match(/\n/g)||"").length<=1},setDir(t){const e="rtl"===t;if(this.options.get("_rtl")!==e){try{this.options.set("_rtl",e),this.ui._offCurrentController();const i=this.frameContext,s=this.plugins;for(const e in s)"function"==typeof s[e].setDir&&s[e].setDir(t);const n=this.context.get("toolbar._wrapper"),o=this.context.get("statusbar._wrapper");e?(this.applyFrameRoots((t=>{gt.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),gt.utils.addClass([this.carrierWrapper,n,o],"se-rtl")):(this.applyFrameRoots((t=>{gt.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),gt.utils.removeClass([this.carrierWrapper,n,o],"se-rtl"));const l=gt.query.getListChildren(i.get("wysiwyg"),(t=>this.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)));for(let t,e,i,s=0;t=l[s];s++)t=l[s],i=t.style.marginRight,e=t.style.marginLeft,(i||e)&&(t.style.marginRight=e,t.style.marginLeft=i),i=t.style.textAlign,"left"===i?t.style.textAlign="right":"right"===i&&(t.style.textAlign="left");!function(t,e){const i=t.icons,s=t.commandTargets,n=t.shortcutsKeyMap;t.reverseKeys.forEach((t=>{const e=n.get(t);if(!e)return;const i=e.c;e.c=e.r,e.r=i})),t.applyCommandTargets("dir",(s=>{gt.utils.changeTxt(s.querySelector(".se-tooltip-text"),t.lang[e?"dir_ltr":"dir_rtl"]),gt.utils.changeElement(s.firstElementChild,i[e?"dir_ltr":"dir_rtl"])})),e?(gt.utils.addClass(s.get("dir_rtl"),"active"),gt.utils.removeClass(s.get("dir_ltr"),"active")):(gt.utils.addClass(s.get("dir_ltr"),"active"),gt.utils.removeClass(s.get("dir_rtl"),"active"))}(this,e),i.has("documentType-use-header")&&(e?i.get("wrapper").appendChild(i.get("documentTypeInner")):i.get("wrapper").insertBefore(i.get("documentTypeInner"),i.get("wysiwygFrame"))),i.has("documentType-use-page")&&(e?i.get("wrapper").insertBefore(i.get("documentTypePage"),i.get("wysiwygFrame")):i.get("wrapper").appendChild(i.get("documentTypePage"))),this.isBalloon?this.toolbar._showBalloon():this.isSubBalloon&&this.subToolbar._showBalloon()}catch(t){this.options.set("_rtl",!e),console.warn(`[SUNEDITOR.setDir.fail] ${t.toString()}`)}this.effectNode=null,this.eventManager.applyTagEffect()}},resetOptions(t){this.viewer.codeView(!1),this.viewer.showBlocks(!1);const e=new Map,i=this.frameRoots,s=[],n=new Map,o={};for(const e in t)void 0!==Bt[e]&&(o[e]=t[e],delete t[e]);for(const e of i.keys())t[e||""]={...o,...t[e||""]};const l=Object.keys(t);if(Ls(l,this.plugins,""),0===l.length)return;1===i.size&&l.unshift(null);const r=[this._originOptions,t].reduce(((t,o)=>{for(const l in o)i.has(l||null)?Hs(l,o,i,e,n,s):t[l]=o[l];return t}),{}),a=this.options,h=Rt(r,s,this.plugins),c=h.o,d=h.frameMap;for(let t,s=0,o=l.length;s<o;s++)if(t=l[s]||null,n.has(t)){const s=e.get(t),n=i.get(t),o=n.get("options"),l=d.get(t);if(n.set("options",l),s.has("statusbar-changed")){if(gt.utils.removeItem(n.get("statusbar")),l.get("statusbar")){const t=zt(l,null).statusbar;n.get("container").appendChild(t),xt(t,n),this.eventManager.__addStatusbarEvent(n,l)}else this.eventManager.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),xt(null,n);n.get("statusbar")&&this.char.display(n)}if(s.has("iframe_attributes")){const t=n.get("wysiwygFrame"),e=o.get("iframe_attributes"),i=l.get("iframe_attributes");for(const i in e)t.removeAttribute(i,e[i]);for(const e in i)t.setAttribute(e,i[e])}if(s.has("iframe_cssFileName")){const t=n.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const i=(new DOMParser).parseFromString(pt._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,s=t.querySelector("style");for(;i[0];)t.insertBefore(i[0],s)}s.has("placeholder")&&(n.get("placeholder").textContent=l.get("placeholder")),this.ui.setEditorStyle(l.get("editorStyle"),n);const r=n.get("wysiwyg"),a=o.get("editableFrameAttributes"),h=l.get("editableFrameAttributes");for(const t in a)r.removeAttribute(t,a[t]);for(const t in h)r.setAttribute(t,h[t])}else switch(a.set(t,c.get(t)),t){case"theme":this.ui.setTheme(a.get("theme"));break;case"events":{const t=a.get("events");for(const e in t)this.events[e]=t[e];break}case"autoStyleify":this.html.__resetAutoStyleify(a.get("autoStyleify"));break;case"textDirection":this.setDir(a.get("_rtl")?"ltr":"rtl");break;case"historyStackDelayTime":this.history.resetDelayTime(a.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":this.format.__resetBrLineBreak(a.get("defaultLineBreakFormat"))}this._originOptions=r;const u=this.context.get("toolbar.main");/inline|balloon/i.test(a.get("mode"))&&l.includes("toolbar_width")&&(u.style.width=a.get("toolbar_width")),a.get("toolbar_hide")?u.style.display="none":u.style.display="",a.get("shortcutsHint")?gt.utils.removeClass(u,"se-shortcut-hide"):gt.utils.addClass(u,"se-shortcut-hide"),this.effectNode=null,this._setFrameInfo(this.frameRoots.get(this.status.rootKey))},changeFrameContext(t){t!==this.status.rootKey&&(this.status.rootKey=t,this._setFrameInfo(this.frameRoots.get(t)),this.toolbar._resetSticky())},execCommand(t,e,i){this.frameContext.get("_wd").execCommand(t,e,"formatBlock"===t?"<"+i+">":i),this.history.push(!0)},focus(t){if(t&&this.changeFrameContext(t),"none"!==this.frameContext.get("wysiwygFrame").style.display){if(this._preventBlur=!1,this.frameOptions.get("iframe")||!this.frameContext.get("wysiwyg").contains(this.selection.getNode()))this._nativeFocus();else try{const t=this.selection.getRange();if(t.startContainer===t.endContainer&>.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.format.isLine(e)&&!this.component.is(e)){const t=gt.utils.createElement("BR"),i=gt.utils.createElement(this.options.get("defaultLine"),null,t);return this.frameContext.get("wysiwyg").insertBefore(i,e),void this.selection.setRange(t,0,t,0)}}this.selection.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(t){console.warn("[SUNEDITOR.focus.warn] ",t),this._nativeFocus()}this.isBalloon&&this.eventManager._toggleToolbarBalloon()}},focusEdge(t){this._preventBlur=!1,t||(t=this.frameContext.get("wysiwyg").lastElementChild);const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=gt.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.selection.setRange(t,t.textContent.length,t,t.textContent.length):this._nativeFocus()):this.focus()},blur(){this.frameOptions.get("iframe")?this.frameContext.get("wysiwygFrame").blur():this.frameContext.get("wysiwyg").blur()},destroy(){this.history.destroy(),this.eventManager._removeAllEvents(),this.options.get("codeMirror6Editor")&&this.options.get("codeMirror6Editor").destroy(),gt.utils.removeItem(this.carrierWrapper),gt.utils.removeItem(this.context.get("toolbar._wrapper")),gt.utils.removeItem(this.context.get("toolbar.sub._wrapper")),gt.utils.removeItem(this.context.get("statusbar._wrapper")),this.applyFrameRoots((t=>{gt.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.options.clear(),this.context.clear();let t=this.plugins;for(const e in t){const i=t[e];"function"==typeof i._destroy&&i._destroy();for(const t in i)delete i[t];delete t[e]}t=this.events;for(const e in t)delete t[e];t=["eventManager","char","component","format","html","menu","nodeTransform","offset","selection","shortcuts","toolbar","ui","viewer"];for(let e,i=0,s=t.length;i<s;i++){e=this[t[i]];for(const t in e)delete e[t]}if(t=this.subToolbar,t)for(const e in t)delete t[e];t=null;for(const t in this)delete this[t];return null},_setFrameInfo(t){this.frameContext=t,this.frameOptions=t.get("options"),t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this._lineBreaker_t=t.get("lineBreaker_t"),this._lineBreaker_b=t.get("lineBreaker_b")},_nativeFocus(){this.selection.__focus(),this.selection._init()},_checkComponents(t){for(let e=0,i=this._fileInfoPluginsCheck.length;e<i;e++)this._fileInfoPluginsCheck[e](t)},_resetComponents(){for(let t=0,e=this._fileInfoPluginsReset.length;t<e;t++)this._fileInfoPluginsReset[t]()},_initWysiwygArea(t,e){t.get("wysiwyg").innerHTML=this.html.clean("string"==typeof e?e:(/^TEXTAREA$/i.test(t.get("originElement").nodeName)?t.get("originElement").value:t.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.options.get("freeCodeViewMode")})||"<"+this.options.get("defaultLine")+"><br></"+this.options.get("defaultLine")+">",t.has("charCounter")&&(t.get("charCounter").textContent=this.char.getLength()),"document"===this.options.get("type")&&(t.set("documentType",new si(this,t)),t.get("documentType").useHeader&&t.set("documentType-use-header",!0),t.get("documentType").usePage&&(t.set("documentType-use-page",!0),t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML))},_resourcesStateChange(t){this._iframeAutoHeight(t),this._checkPlaceholder(t),"document"===this.options.get("type")&&t.get("documentType").usePage&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML)},_iframeAutoHeight(t){const e=t.get("_iframeAuto");e?this._w.setTimeout((()=>{const i=e.offsetHeight;t.get("wysiwygFrame").style.height=i+"px",dt.isResizeObserverSupported||this.__callResizeFunction(t,i,null)}),0):dt.isResizeObserverSupported||this.__callResizeFunction(t,t.get("wysiwygFrame").offsetHeight,null)},__callResizeFunction(t,e,i){e=-1===e?i?.borderBoxSize&&i.borderBoxSize[0]?i.borderBoxSize[0].blockSize:i.contentRect.height+mt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+mt.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.triggerEvent("onResizeEditor",{height:e,prevHeight:t.get("_editorHeight"),frameContext:t,observerEntry:i}),t.set("_editorHeight",e)),t.has("documentType-use-page")&&t.get("documentType").resizePage()},_checkPlaceholder(t){const e=(t=t||this.frameContext).get("placeholder");if(e){if(t.get("isCodeView"))return void(e.style.display="none");this.isEmpty(t)?e.style.display="block":e.style.display="none"}},__editorInit(t){this.applyFrameRoots((t=>{this.__setEditorParams(t)})),this._setFrameInfo(this.frameRoots.get(this.status.rootKey)),this.__init(t);for(const t of this._onPluginEvents.values())t.sort(((t,e)=>t.index-e.index));this.applyFrameRoots((t=>{this.eventManager._addFrameEvents(t),this._initWysiwygArea(t,t.get("options").get("value"))})),this.eventManager.__eventDoc=null,this._componentsInfoInit=!1,this._componentsInfoReset=!1,this._checkComponents(!0),this._w.setTimeout((()=>{this.context.get("toolbar.main").style.visibility="",this.applyFrameRoots((t=>{"function"==typeof this._resourcesStateChange&&(this.eventManager._wwFrameObserver&&this.eventManager._wwFrameObserver.observe(t.get("wysiwygFrame")),this.eventManager._toolbarObserver&&this.eventManager._toolbarObserver.observe(t.get("_toolbarShadow")),this._resourcesStateChange(t))})),this.history.reset(),this.triggerEvent("onload",{})}),0)},__init(t){this._fileInfoPluginsCheck=[],this._fileInfoPluginsReset=[],this._MELInfo=new Map,this.activeCommands=te,this._onPluginEvents=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]),this._fileManager.tags=[],this._fileManager.pluginMap={},this._fileManager.tagAttrs={};const e=this.plugins,i=[];let s;for(const n in e){if(this.registerPlugin(n,this._pluginCallButtons[n],t[n]),this.registerPlugin(n,this._pluginCallButtons_sub[n],t[n]),s=this.plugins[n],"object"==typeof s.__fileManagement){const t=s.__fileManagement;if(this._fileInfoPluginsCheck.push(t._checkInfo.bind(t)),this._fileInfoPluginsReset.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this._fileManager.tags=this._fileManager.tags.concat(e),i.push(n);for(let i,s=0,o=e.length;s<o;s++)i=e[s].toLowerCase(),this._fileManager.pluginMap[i]=n,t.tagAttrs&&(this._fileManager.tagAttrs[i]=t.tagAttrs)}}"function"==typeof s.constructor.component&&this._componentManager.push(function(t,e){return e&&(e=t.component?.call(this,e))?{target:e,pluginName:t.key,options:t.options}:null}.bind(s,s.constructor));const e=s.constructor.options||{};if(this._onPluginEvents.forEach(((t,i)=>{if("function"==typeof s[i]){const n=s[i].bind(s);n.index=e[`eventIndex_${i}`]||e.eventIndex||0,t.push(n)}})),s.retainFormat){const t=s.retainFormat();this._MELInfo.set(t.query,t.method)}}(this.options.get("buttons").has("pageBreak")||this.options.get("buttons_sub")?.has("pageBreak"))&&this._componentManager.push((t=>t&>.utils.hasClass(t,"se-page-break")?{target:t,launcher:{destroy:t=>{const e=t.previousElementSibling||t.nextElementSibling;gt.utils.removeItem(t),this.focusEdge(e),this.history.push(!1)}}}:null)),this._fileManager.regExp=new RegExp(`^(${this._fileManager.tags.join("|")||"\\^"})$`,"i"),this._fileManager.pluginRegExp=new RegExp(`^(${0===i.length?"\\^":i.join("|")})$`,"i"),delete this._pluginCallButtons,delete this._pluginCallButtons_sub,this.__cachingButtons(),this.__cachingShortcuts()},__cachingButtons(){const t=this.context;this.__setDisabledButtons(),this.__saveCommandButtons(this.allCommandButtons,t.get("toolbar.buttonTray")),this.options.has("_subMode")&&this.__saveCommandButtons(this.subAllCommandButtons,t.get("toolbar.sub.buttonTray"))},__setDisabledButtons(){const t=this.context;this._codeViewDisabledButtons=pt.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(Ss)),this._controllerOnDisabledButtons=pt.nodeListToArray(t.get("toolbar.buttonTray").querySelectorAll(Es)),this.options.has("_subMode")&&(this._codeViewDisabledButtons=this._codeViewDisabledButtons.concat(pt.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(Ss))),this._controllerOnDisabledButtons=this._controllerOnDisabledButtons.concat(pt.nodeListToArray(t.get("toolbar.sub.buttonTray").querySelectorAll(Es))))},__saveCommandButtons(t,e){const i=e.querySelectorAll(ks),s=this.options.get("shortcuts"),n=this.options.get("_reverseCommandArray"),o=this.shortcutsKeyMap,l=this.reverseKeys;for(let e,r,a=0,h=i.length;a<h;a++)e=i[a],r=e.getAttribute("data-command"),t.set(r,e),this.__setCommandTargets(r,e),Vt(r,e,s[r],o,n,l)},__cachingShortcuts(){const t=this.options.get("shortcuts"),e=this.options.get("_reverseCommandArray"),i=this.shortcutsKeyMap,s=this.reverseKeys;for(const n of Object.keys(t))n.startsWith("_")&&Vt("",null,t[n],i,e,s)},__setCommandTargets(t,e){if(!t||!e)return;(ee.includes(t)||this.plugins[t])&&(this.commandTargets.get(t)?this.commandTargets.get(t).includes(e)||this.commandTargets.get(t).push(e):this.commandTargets.set(t,[e]))},__setIframeDocument(t,e,i){t.setAttribute("scrolling","auto"),t.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+pt._setIframeStyleLinks(i.get("iframe_cssFileName"))+pt._setAutoHeightStyle(i.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true")},__setEditorParams(t){const e=t.get("options"),i=this._w;if(t.set("wwComputedStyle",i.getComputedStyle(t.get("wysiwyg"))),!e.get("iframe")&&"function"==typeof ShadowRoot){let e=t.get("wysiwygFrame");for(;e;){if(e.shadowRoot){this._shadowRoot=e.shadowRoot;break}if(e instanceof ShadowRoot){this._shadowRoot=e;break}e=e.parentNode}}const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e]);e.get("iframe")?(t.set("_ww",t.get("wysiwygFrame").contentWindow),t.set("_wd",t.get("wysiwygFrame").contentDocument),t.set("wysiwyg",t.get("_wd").body),e.get("_defaultStyles").editor&&(t.get("wysiwyg").style.cssText=e.get("_defaultStyles").editor),"auto"===e.get("height")&&t.set("_iframeAuto",t.get("_wd").body)):(t.set("_ww",i),t.set("_wd",this._d))},__registerClass(){this.events={...Je,...this.options.get("events")},this.triggerEvent=async(t,e)=>{if("false"===e?.frameContext?.get("wysiwyg").getAttribute("contenteditable"))return!1;const i=this.events[t];return"function"==typeof i?await i({editor:this,...e}):dt.NO_EVENT},this.history=se(this),this.eventManager=new Ke(this),this.offset=new as(this),this.shortcuts=new us(this),this.toolbar=new ms(this,{keyName:"toolbar",balloon:this.isBalloon,balloonAlways:this.isBalloonAlways,inline:this.isInline,res:this._responsiveButtons}),this.options.has("_subMode")&&(this.subToolbar=new ms(this,{keyName:"toolbar.sub",balloon:this.isSubBalloon,balloonAlways:this.isSubBalloonAlways,inline:!1,res:this._responsiveButtons_sub})),this.selection=new cs(this),this.html=new Ki(this),this.nodeTransform=new os(this),this.component=new Di(this),this.format=new Zi(this),this.menu=new ss(this),this.char=new ri(this),this.ui=new vs(this),this.viewer=new xs(this),ni.call(this.eventManager,this),ni.call(this.char,this),ni.call(this.component,this),ni.call(this.format,this),ni.call(this.html,this),ni.call(this.menu,this),ni.call(this.nodeTransform,this),ni.call(this.offset,this),ni.call(this.selection,this),ni.call(this.shortcuts,this),ni.call(this.toolbar,this),ni.call(this.ui,this),ni.call(this.viewer,this),this.options.has("_subMode")&&ni.call(this.subToolbar,this),delete this.eventManager.eventManager,delete this.char.char,delete this.component.component,delete this.format.format,delete this.html.html,delete this.menu.menu,delete this.nodeTransform.nodeTransform,delete this.offset.offset,delete this.selection.selection,delete this.shortcuts.shortcuts,delete this.toolbar.toolbar,delete this.ui.ui,delete this.viewer.viewer,this.subToolbar&&delete this.subToolbar.subToolbar,this._responsiveButtons=this._responsiveButtons_sub=null},async __Create(t){this.isInline=/inline/i.test(this.options.get("mode")),this.isBalloon=/balloon/i.test(this.options.get("mode")),this.isBalloonAlways=/balloon-always/i.test(this.options.get("mode")),this.isClassic=/classic/i.test(this.options.get("mode")),this.isSubBalloon=/balloon/i.test(this.options.get("_subMode")),this.isSubBalloonAlways=/balloon-always/i.test(this.options.get("_subMode")),this.__registerClass(),this.eventManager._addCommonEvents();const e=[];this.applyFrameRoots((t=>{const i=t.get("originElement"),s=t.get("topArea");if(i.style.display="none",s.style.display="block",i.parentNode.insertBefore(s,i.nextElementSibling),t.get("options").get("iframe")){const i=new Promise((e=>{this.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:i})=>{this.__setIframeDocument(i,this.options,t.get("options")),e()}))}));e.push(i)}})),this.applyFrameRoots((t=>{t.get("wrapper").appendChild(t.get("wysiwygFrame")),t.get("documentTypeInner")&&(this.options.get("_rtl")?t.get("wrapper").appendChild(t.get("documentTypeInner")):t.get("wrapper").insertBefore(t.get("documentTypeInner"),t.get("wysiwygFrame"))),t.get("documentTypePage")&&(this.options.get("_rtl")?t.get("wrapper").insertBefore(t.get("documentTypePage"),t.get("wysiwygFrame")):t.get("wrapper").appendChild(t.get("documentTypePage")),t.get("wrapper").appendChild(t.get("documentTypePageMirror")))})),e.length>0&&await Promise.all(e),this.__editorInit(t)},Constructor:Ts};const Ns=Ts,As={init(t){return{create:(e,i)=>this.create(e,i,t)}},create(t,e,i){if("object"!=typeof e&&(e={}),i&&(e=[i,e].reduce(((t,e)=>(Object.entries(e).forEach((([e,i])=>{if("plugins"===e&&i&&t[e]){const s=Array.isArray(t[e])?t[e]:Object.values(t[e]),n=Array.isArray(i)?i:Object.values(i);t[e]=[...n.filter((t=>!s.includes(t))),...s]}else t[e]=i})),t)),{})),!t)throw Error("[SUNEDITOR.create.fail] suneditor requires textarea's element");const s=[];if(1===t.nodeType)s.push({key:null,target:t});else{let e;for(const i in t){if(e=t[i],!e.target||1!==e.target.nodeType)throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');e.key=i,s.push(e)}}return new Ns(s,e)}};const Bs=class extends ai{static key="blockquote";static type="command";static className="";constructor(t){super(t),this.title=this.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=gt.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}action(){const t=gt.query.getParentElement(this.selection.getNode(),"blockquote");t?this.format.removeBlock(t,{selectedFormats:null,newBlockElement:null,shouldDelete:!1,skipHistory:!1}):this.format.applyBlock(this.quoteTag.cloneNode(!1))}};async function Is(t,e,i){if(4===t.readyState)if(200===t.status)try{await e(t)}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.callBack.fail] ${t.message}`)}finally{this.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=t.responseText?JSON.parse(t.responseText):t;let s="";"function"==typeof i&&(s=await i(e,t));const n=`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException] status: ${t.status}, response: ${s||e.errorMessage||t.responseText}`;this.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.ui.hideLoading()}}}const Vs=class{constructor(t,e){this.editor=t.editor,this.ui=this.editor.ui,this.kind=t.constructor.key||t.constructor.name,this._xhr=dt.getXMLHttpRequest(),this.method=e?.method,this.url=e?.url,this.headers=e?.headers,this.data=e?.data,this.callBack=e?.callBack,this.errorCallBack=e?.errorCallBack,this.responseType=e?.responseType}call({method:t,url:e,headers:i,data:s,callBack:n,errorCallBack:o,responseType:l}){this.cancel(),t=t||this.method,e=this._normalizeUrl(e||this.url),i=i||this.headers,s=s||this.data,n=n||this.callBack,o=o||this.errorCallBack,l=l||this.responseType;const r=this._xhr;if(l&&(r.responseType=l),r.onreadystatechange=Is.bind(this,r,n,o),r.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)r.setRequestHeader(t,i[t]);r.send(s)}asyncCall({method:t,url:e,headers:i,data:s,responseType:n}){this.cancel(),t=t||this.method,e=this._normalizeUrl(e||this.url),i=i||this.headers,s=s||this.data,n=n||this.responseType;const o=this._xhr;return n&&(o.responseType=n),new Promise(((n,l)=>{if(o.open(t,e,!0),null!==i&&"object"==typeof i&&Object.keys(i).length>0)for(const t in i)o.setRequestHeader(t,i[t]);o.onload=()=>{if(200===o.status)try{n(o)}finally{this.ui.hideLoading()}else try{const t=o.responseText?JSON.parse(o.responseText):o;l(t)}finally{this.ui.hideLoading()}},o.onerror=()=>{l(new Error("Network error"))},o.send(s)}))}cancel(){this._xhr&&this._xhr.abort()}_normalizeUrl(t){return t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1")}},{_w:Os,_d:Rs}=dt;const zs=class extends ai{static key="exportPDF";static type="command";static className="se-component-enabled";constructor(t,e){super(t),this.title=this.lang.exportPDF,this.icon="PDF",this.apiUrl=e.apiUrl,this.fileName=e.fileName||"suneditor-pdf",this.apiUrl?this.apiManager=new Vs(this,{method:"POST",url:this.apiUrl,headers:{"Content-Type":"application/json"},responseType:"blob"}):console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.')}async action(){if(!this.apiUrl)return void console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.');this.ui.showLoading();let t=null;try{const e=this.editor.frameContext.get("documentTypePageMirror")||this.editor.frameContext.get("wysiwygFrame"),i=gt.utils.createElement("div",{class:e.className},e.innerHTML);t=gt.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},i);const s=this._w.getComputedStyle(e).padding,n=gt.utils.applyInlineStylesAll(i,!0,this.options.get("allUsedStyles"));if(n.style.padding=n.style.paddingTop=n.style.paddingBottom=n.style.paddingLeft=n.style.paddingRight="0",t.innerHTML=`\n\t\t\t\t<style>\n\t\t\t\t\t@page {\n\t\t\t\t\t\tsize: A4;\n\t\t\t\t\t\tmargin: ${s};\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t${n.outerHTML}`,Rs.body.appendChild(t),!1===await this.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this._createByServer(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{gt.utils.removeItem(t),this.ui.hideLoading()}}async _createByServer(t){const e={fileName:this.fileName,htmlContent:t.innerHTML},i=await this.apiManager.asyncCall({data:JSON.stringify(e)});if(200!==i.status){const t=i.responseText?JSON.parse(i.responseText):i;throw Error(`[SUNEDITOR.plugins.exportPDF.error] ${t.errorMessage}`)}const s=new Blob([i.response],{type:"application/pdf"}),n=i.getResponseHeader("Content-Disposition"),o=URL.createObjectURL(s),l=(n.match(/filename="([^"]+)/)||[])[1]||this.fileName+".pdf",r=gt.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{Rs.body.appendChild(r),r.click()}finally{Os.setTimeout((()=>{gt.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}};function $s(t,e){const i=t.getAttribute(`data-se-${e}`);if(i)return i;const s=t.getAttribute(`data-${e}`);return s?(t.removeAttribute(`data-${e}`),t.setAttribute(`data-se-${e}`,s),s):null}const Fs=class extends ne{constructor(t,e){super(t.editor),this.ui=this.editor.ui,t.__fileManagement=this,this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.component=t.editor.component,this.query=e.query,this.loadHandler=e.loadHandler,this.eventHandler=e.eventHandler,this.infoList=[],this.infoIndex=0,this.uploadFileLength=0,this.__updateTags=[],this.apiManager=new Vs(this,null),this._resetInfo,this._checkInfo}upload(t,e,i,s,n){this.ui.showLoading();let o=null;if("length"in i){o=new FormData;for(let t=0,e=i.length;t<e;t++)o.append("file-"+t,i[t]);this.uploadFileLength=i.length}else o=i.formData,this.uploadFileLength=i.size;this.apiManager.call({method:"POST",url:t,headers:e,data:o,callBack:s,errorCallBack:n})}async asyncUpload(t,e,i){this.ui.showLoading();let s=null;if("length"in i){s=new FormData;for(let t=0,e=i.length;t<e;t++)s.append("file-"+t,i[t]);this.uploadFileLength=i.length}else s=i.formData,this.uploadFileLength=i.size;return await this.apiManager.asyncCall({method:"POST",url:t,headers:e,data:s})}setFileData(t,{name:e,size:i}){t&&(t.setAttribute("data-se-file-name",e),t.setAttribute("data-se-file-size",i+""))}_setInfo(t,e){let i=Number($s(t,"index")),s=null,n="";if(e||(e={name:$s(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number($s(t,"file-size"))||0}),!i||this.editor._componentsInfoInit)n="create",i=this.infoIndex++,t.setAttribute("data-se-index",i+""),t.setAttribute("data-se-file-name",e.name),t.setAttribute("data-se-file-size",e.size+""),s={src:t.src,index:i,name:e.name,size:e.size},this.infoList.push(s);else{n="update",i*=1;for(let t=0,e=this.infoList.length;t<e;t++)if(i===this.infoList[t].index){s=this.infoList[t];break}s||(i=this.infoIndex++,s={index:i},this.infoList.push(s)),s.src=t.src,s.name=$s(t,"file-name"),s.size=Number($s(t,"file-size"))}s.element=t,s.delete=function(t){"function"==typeof this.inst.destroy&&this.inst.destroy.call(this.inst,t),this._deleteInfo(Number($s(t,"index")))}.bind(this,t),this._deleteInfo,s.select=function(t){t.scrollIntoView(this.options.get("componentScrollToOptions"));const e=this.component.get(t);e?this.component.select(e.target,e.pluginName):"function"==typeof this.inst.select&&this.inst.select(t)}.bind(this,t);const o={editor:this.editor,element:t,index:i,state:n,info:s,remainingFilesCount:--this.uploadFileLength<0?0:this.uploadFileLength,pluginName:this.kind};"function"==typeof this.eventHandler&&this.eventHandler(o),this.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}getSize(){let t=0;for(let e=0,i=this.infoList.length;e<i;e++)t+=1*this.infoList[e].size;return t}_checkInfo(t){const e=[].slice.call(this.editor.frameContext.get("wysiwyg").querySelectorAll(this.query)),i=this.infoList;if(e.length===i.length){if(this.editor._componentsInfoReset){for(let t=0,i=e.length;t<i;t++)this._setInfo(e[t],null);return}{let t=!1;for(let s,n=0,o=i.length;n<o;n++)if(s=i[n],0===e.filter((function(t){return s.src===t.src&&s.index.toString()===$s(t,"index")})).length){t=!0;break}if(!t)return}}const s=[],n=[];for(let t=0,e=i.length;t<e;t++)n[t]=i[t].index;for(this.__updateTags=e;e.length>0;){const t=e.shift();$s(t,"index")&&n.includes(Number($s(t,"index")))?s.push(Number($s(t,"index"))):(s.push(this.infoIndex),t.removeAttribute("data-se-index"),this._setInfo(t,null))}if(t&&"function"==typeof this.loadHandler)this.loadHandler(i);else for(let t,e=0;e<i.length;e++){if(t=i[e].index,s.includes(t))continue;i.splice(e,1);const n={editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};"function"==typeof this.eventHandler&&this.eventHandler(n),this.triggerEvent("onFileManagerAction",{...n,pluginName:this.kind}),e--}}_resetInfo(){const t="function"==typeof this.eventHandler,e={editor:this.editor,element:null,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};for(let i=0,s=this.infoList.length;i<s;i++)t&&this.eventHandler({...e,index:this.infoList[i].index,pluginName:this.kind}),this.triggerEvent("onFileManagerAction",{...e,index:this.infoList[i].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}_deleteInfo(t){if(t>=0)for(let e=0,i=this.infoList.length;e<i;e++)if(t===this.infoList[e].index)return this.infoList.splice(e,1),void("function"==typeof this.eventHandler&&this.eventHandler({editor:this.editor,element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}},{NO_EVENT:Ps}=dt;class Ds extends ai{static key="fileUpload";static type="command";static className="";static options={eventIndex:1e4};static component(t){return gt.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}constructor(t,e){super(t),this.title=this.lang.fileUpload,this.icon="file_upload",e.uploadUrl||console.warn('[SUNEDITOR.fileUpload.warn] "fileUpload" plugin must be have "uploadUrl" option.'),this.uploadUrl=e.uploadUrl,this.uploadHeaders=e.uploadHeaders,this.uploadSizeLimit=mt.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=mt.get(e.uploadSingleSizeLimit,0),this.allowMultiple=!!e.allowMultiple,this.acceptedFormats="string"!=typeof e.acceptedFormats?"*":e.acceptedFormats.trim()||"*",this._acceptedCheck=this.acceptedFormats.split(", "),this.as=e.as||"box",this.input=gt.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this._element=null;const i={"custom-download":{command:"download",title:this.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&>.utils.createElement("A",{href:e},null).click()}},"custom-as":{command:"as",value:"link",title:this.lang.asLink,icon:"reduction",action:(t,e)=>{this.convertFormat(t,e)}}},s=(e.controls||[["custom-as","align","edit","custom-download","copy","remove"]]).map((t=>t.map((t=>t.startsWith("custom-")?i[t]:t))));if(this.figure=new Si(this,s,{}),this.fileManager=new Fs(this,{query:"a[download][data-se-file-download]",loadHandler:this.events.onFileLoad,eventHandler:this.events.onFileAction}),/\bedit\b/.test(JSON.stringify(s))){const t=function({lang:t,icons:e}){const i=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" />\n\t\t\t\t<button type="submit" data-command="edit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.controller=new mi(this,t,{position:"bottom",disabled:!0},Ds.key),this.editInput=t.querySelector("input")}this.eventManager.addEvent(this.input,"change",this.#S.bind(this))}action(){this.editor._preventBlur=!0,this.input.click()}select(t){this._element=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(!gt.check.isFigure(t.parentElement))return e.innerHTML=this.icons.expansion+gt.utils.createTooltipInner(this.lang.asBlock),e.setAttribute("data-value","box"),this.figure.controllerOpen(t,{isWWTarget:!0}),!0;e.innerHTML=this.icons.reduction+gt.utils.createTooltipInner(this.lang.asLink),e.setAttribute("data-value","link"),this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1})}onFilePasteAndDrop({file:t}){const e=t.type;if(this._acceptedCheck.some((t=>!!t.startsWith("*")||(!!t.startsWith(e)||void 0))))return this.submitFile([t]),this.editor.focus(),!1}edit(t){this.editInput.value=t.textContent,this.figure.controllerHide(),this.controller.open(t,null,{isWWTarget:!gt.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}controllerAction(t){const e=t.getAttribute("data-command");if(e){if("edit"===e){if(0===this.editInput.value.trim().length)return;this._element.textContent=this.editInput.value}this.controller.close(),this.component.select(this._element,Ds.key)}}async destroy(t){if(!t)return;const e=Si.GetContainer(t),i=gt.query.getParentElement(t,".se-component")||t;if(!1===await this.triggerEvent("onFileDeleteBefore",{element:e.target,container:e,url:e.target.getAttribute("href")}))return;const s=this.component.isInline(i)?i.previousSibling||i.nextSibling:i.previousElementSibling||i.nextElementSibling;gt.utils.removeItem(i),this.ui._offCurrentController(),this.editor.focusEdge(s),this.history.push(!1)}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=this.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++){if(n=t[l],o=n.size,s&&s>o){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onFileUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Ps?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable total files: "+n/1e3+"KB",i=await this.triggerEvent("onFileUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Ps?t:i||t,"error"),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:i},r=async function(t,e,i){e=i||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#E.bind(this),l),a=await this.triggerEvent("onFileUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Ps||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=Si.GetContainer(t),i=e.nextElementSibling,s=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),gt.utils.addClass(t,"se-component|se-inline-component");const n=gt.utils.createElement(this.options.get("defaultLine"),null,t);s.insertBefore(n,i),gt.utils.removeItem(e)}else{this.selection.setRange(t,0,t,1);const e=this.html.remove(),i=this.nodeTransform.split(e.container,e.offset,0);i?.previousElementSibling&>.check.isZeroWidth(i.previousElementSibling)&>.utils.removeItem(i.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),gt.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const s=Si.CreateContainer(t,"se-file-figure se-flex-component");(i||e.container).parentElement.insertBefore(s.container,i)}this.history.push(!1),this.component.select(t,Ds.key)}create(t,e,i){const s=e.name||t,n=gt.utils.createElement("A",{href:t,title:s,download:s,"data-se-file-download":"",contenteditable:"false","data-se-non-focus":"true","data-se-non-link":"true"},s);if(this.fileManager.setFileData(n,e),"link"===this.as)return n.className="se-component se-inline-component",void this.component.insert(n,{skipCharCount:!1,skipSelection:!1,skipHistory:!1});const o=Si.CreateContainer(n);if(gt.utils.addClass(o.container,"se-file-figure|se-flex-component"),this.component.insert(o.container,{skipCharCount:!1,skipSelection:!i||!this.options.get("componentAutoSelect"),skipHistory:!1})){if(i)if(this.options.get("componentAutoSelect"))this.component.select(n,Ds.key);else{const t=this.format.addLine(o.container,null);t&&this.selection.setRange(t,0,t,0)}}else this.editor.focus()}_register(t){t.result.forEach(((t,e,i)=>{this.create(t.url,{name:t.name,size:t.size},e===i.length-1)}))}async _error(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===Ps?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}#E(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)}async#S(t){const e=gt.query.getEventTarget(t);await this.submitFile(e.files)}}const qs=Ds;class Ws extends ai{static key="list_bulleted";static type="command";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.bulletedList,this.icon="list_bulleted",this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Ws.key,"data-type":"dropdown"},`${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.bulletedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${e=["disc","circle","square"],e.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ul style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}\n\t\t</ul>\n\t</div>`;var e;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ul"),this.menu.initDropdownTarget({key:Ws.key,type:"dropdown"},e)}active(t,e){return gt.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"disc":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?gt.utils.addClass(e.parentElement,"active"):gt.utils.removeClass(e.parentElement,"active")}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ul")?.style.listStyleType;gt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}shortcut({range:t,info:e}){const{startContainer:i}=t;if(gt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.textContent=t}this.submit()}submit(t){const e=this.format.applyList(`ul:${t||""}`,null,!1);e&&this.selection.setRange(e.sc,e.so,e.ec,e.eo),this.editor.focus(),this.history.push(!1)}}const Us=Ws;class Gs extends ai{static key="list_numbered";static type="command";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.numberedList,this.icon="list_numbered",this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Gs.key,"data-type":"dropdown"},`${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.numberedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${Zs(["decimal","upper-roman","lower-roman"])}\n\t\t</ul>\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t${Zs(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.listItems=e.querySelectorAll("li button ol"),this.menu.initDropdownTarget({key:Gs.key,type:"dropdown"},e)}active(t,e){return gt.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}on(){const t=this.listItems,e=this.format.getBlock(this.selection.getNode()),i=e?.style?e.style.listStyleType||"decimal":"";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i===e.style.listStyleType?gt.utils.addClass(e.parentElement,"active"):gt.utils.removeClass(e.parentElement,"active")}action(t){const e=this.format.getBlock(this.selection.getNode()),i=t?.querySelector("ol")?.style.listStyleType;gt.check.isList(e)&&i?e.style.listStyleType=i:this.submit(i),this.menu.dropdownOff()}shortcut({range:t,info:e}){const{startContainer:i}=t;if(gt.check.isText(i)){const t=i.substringData(e.key.length,i.textContent.length-1);i.textContent=t}this.submit()}submit(t){const e=this.format.applyList(`ol:${t||""}`,null,!1);e&&this.selection.setRange(e.sc,e.so,e.ec,e.eo),this.editor.focus(),this.history.push(!1)}}function Zs(t){return t.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ol style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ol>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}const Ys=Gs,{debounce:Xs}=pt;const js=class extends ai{static key="mention";static type="field";static className="";constructor(t,e){super(t),this.title=this.lang.mention,this.icon="mention",this.triggerText=e.triggerText||"@",this.limitSize=e.limitSize||5,this.searchStartLength=e.searchStartLength||0,this.delayTime="number"==typeof e.delayTime?e.delayTime:200,this.directData=e.data,this.apiUrl=e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,String(this.limitSize))||"",this._delay=0,this._lastAtPos=0,this._anchorOffset=0,this._anchorNode=null,this.apiManager=new Vs(this,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?[]:null;const i=gt.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new fi(this,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new mi(this,i,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(i.firstElementChild,this.#T.bind(this)),this.onInput=Xs(this.onInput.bind(this),this.delayTime)}async onInput(){this.directData||this.apiManager.cancel();const t=this.selection.get();if(!t.rangeCount)return this.selectMenu.close(),!0;const e=t.anchorNode,i=t.anchorOffset,s=e.textContent.substring(0,i),n=s.lastIndexOf(this.triggerText);if(n>-1){const t=s.substring(n+1,i),o=s[n-1]?.trim();if(!/\s/.test(t)&&(!o||gt.check.isZeroWidth(o))){if(t.length<this.searchStartLength)return!0;const s=e.parentNode;if(gt.check.isAnchor(s)&&!s.getAttribute("data-se-mention"))return!0;try{const s=await this._createMentionList(t,e);return this._lastAtPos=n,this._anchorNode=e,this._anchorOffset=i,!s}catch(t){console.warn("[SUNEDITOR.mention.api.file] ",t)}}}return this.selectMenu.close(),!0}async _createMentionList(t,e){const i=this.limitSize,s=t.toLowerCase();let n=null;if(this.cachingData&&(n=this.cachingData.get(t)),!n)if(this.directData)n=this.directData.filter((t=>t.key.toLowerCase().startsWith(s))).slice(0,i);else{const e=await this.apiManager.asyncCall({method:"GET",url:this._createUrl(t)});n=JSON.parse(e.responseText)}if(this.cachingFieldData){const t=new Set;n=this.cachingFieldData.concat(n).filter((({key:e})=>!t.has(e)&&(t.add(e),e.toLowerCase().startsWith(s)))).slice(0,i)}if(!n?.length)return this.selectMenu.close(),!1;const o=[],l=[];for(let t,e=0,i=n.length;e<i;e++)t=n[e],o.push(t),l.push(`<div class="se-mention-item"><span>${t.key}</span><span>${t.name}</span></div>`);return 0===o.length?(this.selectMenu.close(),!1):(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(o,l),this.selectMenu.open(),this.selectMenu.setItem(0),this.cachingData&&this.cachingData.set(t,o),!0)}_createUrl(t){return this.apiUrl.replace(/\{key\}/i,t)}#T(t){if(!t)return!1;let e=null;const{key:i,name:s,url:n}=t,o=this._anchorNode.parentNode;if(gt.check.isAnchor(o))e=o,e.setAttribute("data-se-mention",i),e.setAttribute("href",n),e.setAttribute("title",s),e.textContent=this.triggerText+i;else if(this.selection.setRange(this._anchorNode,this._lastAtPos,this._anchorNode,this._anchorOffset),e=gt.utils.createElement("A",{"data-se-mention":i,href:n,title:s,target:"_blank"},this.triggerText+i),!this.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;this.selectMenu.close();const l=gt.utils.createTextNode(" ");e.parentNode.insertBefore(l,e.nextSibling),this.selection.setRange(l,1,l,1),this.cachingFieldData&&!this.cachingFieldData.some((e=>e.key===t.key))&&this.cachingFieldData.push(t)}};class Ks extends ai{static key="align";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.align,this.icon=this.options.get("_rtl")?"align_right":"align_left";const i=function({lang:t,icons:e,options:i},s){const n=Array.isArray(s)?s:i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let o="";for(let i,s,l=0;l<n.length;l++)i=n[l],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],o+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${i}" title="${s}" aria-label="${s}">\n\t\t\t\t<span class="se-list-icon">${e["align_"+i]}</span>${s}\n\t\t\t</button>\n\t\t</li>`;return gt.utils.createElement("div",{class:"se-dropdown se-list-layer se-list-align"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${o}</ul>\n\t\t</div>`)}(t,e.items),s=this._itemMenu=i.querySelector("ul");this.defaultDir=t.options.get("_rtl")?"right":"left",this.alignIcons={justify:t.icons.align_justify,left:t.icons.align_left,right:t.icons.align_right,center:t.icons.align_center},this.alignList=s.querySelectorAll("li button"),this.menu.initDropdownTarget(Ks,i)}active(t,e){const i=e.firstElementChild;if(t){if(this.format.isLine(t)){const s=t.style.textAlign;return s?(gt.utils.changeElement(i,this.alignIcons[s]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",s),!0):void 0}}else gt.utils.changeElement(i,this.alignIcons[this.defaultDir]),e.removeAttribute("data-focus");return!1}on(t){const e=t.getAttribute("data-focus")||this.defaultDir;if(!e)return;const i=this.alignList;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?gt.utils.addClass(i[t],"active"):gt.utils.removeClass(i[t],"active")}setDir(t){const e="rtl"===t?"right":"left";if(this.defaultDir===e)return;this.defaultDir=e;const i=this._itemMenu.querySelector('[data-command="left"]'),s=this._itemMenu.querySelector('[data-command="right"]');if(i&&s){const t=i.parentElement,e=s.parentElement;t.appendChild(s),e.appendChild(i)}}action(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.defaultDir,s=this.format.getLines();for(let t=0,n=s.length;t<n;t++)gt.utils.setStyle(s[t],"textAlign",e===i?"":e);this.editor.effectNode=null,this.menu.dropdownOff(),this.editor.focus(),this.history.push(!1)}}const Js=Ks;class Qs extends ai{static key="font";static type="dropdown";static className="se-btn-select se-btn-tool-font";constructor(t,e){super(t),this.title=this.lang.font,this.inner='<span class="se-txt">'+this.lang.font+"</span>"+this.icons.arrow_down;const i=e.items||["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],s=function({lang:t},e){let i=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">(${t.default})</button>\n\t\t\t</li>`;for(let t,s,n=0,o=e.length;n<o;n++)t=e[n],s=t.split(",")[0],i+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t}" data-txt="${s}" title="${s}" aria-label="${s}" style="font-family:${t};">${s}</button>\n\t\t\t</li>`;return i+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-family"},i)}(t,i);this.currentFont="",this.fontList=s.querySelectorAll("ul li button"),this.fontArray=i,this.menu.initDropdownTarget(Qs,s)}active(t,e){const i=e.querySelector(".se-txt"),s=e.parentNode.querySelector(".se-tooltip-text");let n="";if(t){if(this.format.isLine(t))return;if(n=gt.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return gt.utils.changeTxt(i,t),gt.utils.changeTxt(s,this.lang.font+" ("+t+")"),!0}}else{const t=this.status.hasFocus?this.editor.frameContext.get("wwComputedStyle").fontFamily:this.lang.font;gt.utils.changeTxt(i,t),gt.utils.changeTxt(s,this.status.hasFocus?this.lang.font+(t?" ("+t+")":""):t)}return!1}on(t){const e=this.fontList,i=t.querySelector(".se-txt").textContent;if(i!==this.currentFont){for(let t=0,s=e.length;t<s;t++)i===(e[t].getAttribute("data-command")||"").replace(/'|"/g,"")?gt.utils.addClass(e[t],"active"):gt.utils.removeClass(e[t],"active");this.currentFont=i}}async action(t){let e=t.getAttribute("data-command");if(e){if(/[\s\d\W]/.test(e)&&!/^['"].*['"]$/.test(e)&&(e=`"${e}"`),!1===await this.triggerEvent("onFontActionBefore",{value:e}))return;const t=gt.utils.createElement("SPAN",{style:"font-family: "+e+";"});this.format.applyInlineElement(t,{stylesToModify:["font-family"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["font-family"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}}const tn=Qs,{isMobile:en}=dt,sn=240,nn=120,on={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let ln,rn=0,an=!1,hn=!1,cn=120,dn=120,un=on;const{slider:pn,offscreenCanvas:gn,offscreenCtx:mn,wheel:fn,wheelCtx:_n,wheelPointer:bn,gradientBar:yn,gradientPointer:vn,fanalColorHex:Cn,fanalColorBackground:wn}=function(){const t=document.createElement("canvas");t.width=sn,t.height=sn;const e=`\n\t<div class="se-hue-slider-container" style="width: 240px; height: 240px;">\n <canvas class="se-hue-wheel" width="240" height="240"></canvas>\n <div class="se-hue-wheel-pointer"></div>\n </div>\n <div class="se-hue-gradient-container">\n <canvas class="se-hue-gradient" width="240" height="28"></canvas>\n <div class="se-hue-gradient-pointer"></div>\n </div>\n <div class="se-hue-final-hex" style="width:240px; height: 28px;">\n\t\t<div style="flex: 3; line-height: 1.5;">${on.hex}</div>\n\t\t<div style="flex: 1; height: 100%; border: 1px solid #fff; outline: 1px solid #000;"></div>\n\t</div>\n\t`,i=gt.utils.createElement("DIV",{class:"se-hue-slider"},e),s=i.querySelector(".se-hue-wheel"),n=i.querySelector(".se-hue-gradient"),o=i.querySelector(".se-hue-final-hex").children;return{slider:i,offscreenCanvas:t,offscreenCtx:t.getContext("2d"),wheel:s,wheelCtx:s.getContext("2d"),wheelPointer:i.querySelector(".se-hue-wheel-pointer"),gradientBar:n,gradientPointer:i.querySelector(".se-hue-gradient-pointer"),fanalColorHex:o[0],fanalColorBackground:o[1]}}();function xn(t){const{target:e,touches:i}=t,s=i[0].clientX,n=i[0].clientY;e===fn?(t.preventDefault(),hn=!1,an=!0,Tn(s,n)):e===yn&&(t.preventDefault(),hn=!0,an=!1,Hn(s))}function kn(t){t.preventDefault();const{touches:e}=t,i=e[0].clientX,s=e[0].clientY;an?Tn(i,s):hn&&Hn(i)}function Sn({target:t,clientX:e,clientY:i}){t===fn?(hn=!1,an=!0,Tn(e,i)):t===yn&&(hn=!0,an=!1,Hn(e))}function En({clientX:t,clientY:e}){an?Tn(t,e):hn&&Hn(t)}function Tn(t,e){const i=fn.getBoundingClientRect();t=t-i.left-nn,e=e-i.top-nn;const s=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),nn),o=nn+n*Math.cos(s*Math.PI/180),l=nn+n*Math.sin(s*Math.PI/180);bn.style.left=`${o}px`,bn.style.top=`${l}px`,function(t,e){cn=t,dn=e,Mn(Ln())}(o,l),Nn()}function Hn(t){const e=yn.getBoundingClientRect();let i=t-e.left;i=Math.max(14,Math.min(i,e.width-14)),vn.style.left=`${i}px`,function(t){const e=yn.getBoundingClientRect();let i=t-e.left;i<0&&(i=0);i>e.width&&(i=e.width);const s=14;i>=yn.width-s?i=yn.width:i<=s&&(i=0);const n=1-i/e.width;rn=n,In()}(t),Nn()}function Mn(t){const e=yn.getContext("2d"),i=e.createLinearGradient(0,0,yn.width,0);i.addColorStop(0,"black"),i.addColorStop(1,t.hex),e.fillStyle=i,e.fillRect(0,0,yn.width,yn.height)}function Ln(){return Bn(mn)}function Nn(){ln.color=un=Bn(_n),An(un.hex)}function An(t){wn.style.backgroundColor=Cn.textContent=t}function Bn(t){const e=t.getImageData(cn,dn,1,1).data;let[i,s,n]=function([t,e,i]){t/=255,e/=255,i/=255;const s=Math.max(t,e,i),n=Math.min(t,e,i);let o,l;const r=(s+n)/2;if(s===n)o=l=0;else{const a=s-n;switch(l=r>.5?a/(2-s-n):a/(s+n),s){case t:o=(e-i)/a+(e<i?6:0);break;case e:o=(i-t)/a+2;break;case i:o=(t-e)/a+4}o/=6}return[On(o),On(l),On(r)]}(e);const o=cn-nn,l=dn-nn;Math.sqrt(o*o+l*l)<3&&(n=1-rn),n>1&&(n=1),n<0&&(n=0);const{r,g:a,b:h}=function([t,e,i]){let s,n,o;if(0===e)s=n=o=i;else{const l=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},r=i<.5?i*(1+e):i+e-i*e,a=2*i-r;s=l(a,r,t+1/3),n=l(a,r,t),o=l(a,r,t-1/3)}return{r:Math.round(255*s),g:Math.round(255*n),b:Math.round(255*o)}}([i,s,n]),c=`#${function({r:t,g:e,b:i}){let s=Math.floor(t).toString(16);t<16&&(s=`0${s}`);let n=Math.floor(e).toString(16);e<16&&(n=`0${n}`);let o=Math.floor(i).toString(16);i<16&&(o=`0${o}`);return`${s}${n}${o}`.toUpperCase()}({r,g:a,b:h})}`;return{hex:c,r,g:a,b:h,h:i,s,l:On(n)}}function In(){_n.clearRect(0,0,sn,sn),_n.drawImage(gn,0,0),_n.globalAlpha=rn,_n.fillStyle="black",_n.beginPath(),_n.arc(nn,nn,nn,0,2*Math.PI),_n.fill(),_n.globalAlpha=1}function Vn(t){return t*Math.PI/180}function On(t){const e=Math.pow(10,10);return Math.round(t*e)/e}!function(t){if(!t)throw new Error("Context not found.");for(let e=0;e<=360;e+=.5)for(let i=0;i<=nn;i+=1){t.beginPath();const s=50+(nn-i)/nn*50;t.fillStyle=`hsl(${e}, 100%, ${s}%)`;const n=nn+Math.cos(Vn(e))*i,o=nn-Math.sin(Vn(e))*i;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}}(mn),In();const Rn=class{constructor(t,e,i){if(e||(e={}),this.editor=t.editor,this.eventManager=t.eventManager,this.inst=t,this.form=e.form,this.ctx={wheelX:cn,wheelY:dn,lightness:rn,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:on},this.isOpen=!1,this.controlle=null,this.__globalMouseDown=null,this.__globalMouseMove=null,this.__globalMouseUp=null,!e.isNewForm){const s=function({lang:t,icons:e},i){const s=gt.utils.createElement("DIV",{class:`se-controller ${i}`},`\n\t\t<div class="se-hue"></div>\n\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t<button type="button" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>\n\t\t\t<button type="button" class="se-btn se-btn-danger" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t</div>\n\t`);return s}(t.editor,i);this.form=s.querySelector(".se-hue"),this.controller=new mi(this,s,{position:"top",isWWTarget:!1,...e.controllerOptions}),this.eventManager.addEvent(s.querySelector(".se-btn-success"),"click",(()=>{t.hueSliderAction(this.get()),this.close()})),this.eventManager.addEvent(s.querySelector(".se-btn-danger"),"click",(()=>{this.close()}))}}get(){return un}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}off(){this.ctx={gradientPointerX:vn.style.left,wheelPointerX:bn.style.left,wheelPointerY:bn.style.top,wheelX:cn,wheelY:dn,lightness:rn,color:ln?.color||Bn(_n)},this.controller.close(),this.init()}close(){this.off(),this.inst.hueSliderCancelAction()}attach(t){this.init(),(t||this.form).appendChild(pn),ln=this.ctx,ln&&(cn=ln.wheelX,dn=ln.wheelY,rn=ln.lightness,bn.style.left=ln.wheelPointerX,bn.style.top=ln.wheelPointerY,vn.style.left=ln.gradientPointerX,An(ln.color.hex),In(),Mn(Ln()));const e={name:"mousedown",func:Sn},i={name:"mousemove",func:En,option:!0},s={name:"mouseup",func:()=>{an=!1,hn=!1}};en&&(e.name="touchstart",i.name="touchmove",s.name="touchend",e.func=xn,i.func=kn),this.__globalMouseDown=this.eventManager.addGlobalEvent(e.name,e.func,{passive:!1,capture:!0}),this.__globalMouseMove=this.eventManager.addGlobalEvent(i.name,i.func,!0),this.__globalMouseUp=this.eventManager.addGlobalEvent(s.name,s.func,!0),this.isOpen=!0}init(){this.isOpen=!1,an=!1,hn=!1,this.__globalMouseDown&&(this.__globalMouseDown=this.eventManager.removeGlobalEvent(this.__globalMouseDown)),this.__globalMouseMove&&(this.__globalMouseMove=this.eventManager.removeGlobalEvent(this.__globalMouseMove)),this.__globalMouseUp&&(this.__globalMouseUp=this.eventManager.removeGlobalEvent(this.__globalMouseUp))}},zn=["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#f1f1f1","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];function $n(t,e){const i=`<ul class="se-color-pallet${e?" se-list-horizontal":""}">`;let s=i;for(let n,o,l,r=0,a=t.length;r<a;r++)n=t[r],"string"==typeof n?(o=n,l=n):"object"==typeof n&&(o=n.value,l=n.name||o),r>0&&r%e==0&&(s+=`</ul>${i}`),s+=`<li><button type="button" data-value="${o}" title="${l}" aria-label="${l}" style="background-color:${o};"></button></li>`;return s+="</ul>",s}const Fn=class extends ne{constructor(t,e,i){const s=t.editor;super(s),this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.target=function({lang:t,icons:e},{colorList:i,disableHEXInput:s,disableRemove:n,splitNum:o}){o=(i=i||zn)===zn?9:o;let l="";for(let t,e=0,s=i.length,n=[];e<s;e++)t=i[e],t&&(("string"==typeof t||t.value)&&(n.push(t),e<s-1)||(n.length>0&&(l+=`<div class="se-selector-color">${$n(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${$n(t,o)}</div>`)));return l+=`\n\t\t<form class="se-form-group se-form-w0">\n\t\t\t${s?"":`<button type="button" class="se-btn se-btn-info" title="${t.colorPicker}" aria-label="${t.colorPicker}">${e.color_palette}</button>`}\n\t\t\t<input type="text" class="se-color-input" ${s?"readonly":""} placeholder="${t.color}" />\n\t\t\t${s?"":`<button type="submit" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>`}\n\t\t\t${n?"":`<button type="button" class="se-btn __se_remove" title="${t.remove}" aria-label="${t.remove}">${e.remove_color}</button>`}\n\t\t</form>`,gt.utils.createElement("DIV",{class:"se-list-inner"},l)}(s,i),this.targetButton=null,this.inputElement=this.target.querySelector(".se-color-input"),this.styleProperties=e,this.splitNum=i.splitNum||0,this.defaultColor=i.defaultColor||"",this.hueSliderOptions=i.hueSliderOptions,this.parentDisplay="",this.currentColor="",this.parentForm=null,this.colorList=this.target.querySelectorAll("li button")||[],this.hueSlider=null;const n=(new DOMParser).parseFromString(this.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new Rn(this,i.hueSliderOptions,"se-dropdown"),this.parentFormDisplay=[],this.parentForm=i.hueSliderOptions?.controllerOptions?.parents?.length>0&&!i.hueSliderOptions?.controllerOptions?.isInsideForm?i.hueSliderOptions.controllerOptions.parents:null,this.eventManager.addEvent(this.target.querySelector(".se-btn-info"),"click",this.#H.bind(this)),this.eventManager.addEvent(this.inputElement,"input",this.#M.bind(this)),this.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#L.bind(this))),i.disableRemove||this.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#N.bind(this)),this.eventManager.addEvent(this.target,"click",this.#A.bind(this))}init(t,e,i){this.targetButton=e,"function"!=typeof i&&(i=()=>!1);let s=("string"==typeof t?t:this._getColorInNode(t,i))||this.defaultColor;s=pt.isHexColor(s)?s:pt.rgb2hex(s)||s||"";const n=this.colorList;for(let t,e=0,i=n.length;e<i;e++)t=n[e],s.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),gt.utils.addClass(t,"active")):(gt.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&>.utils.removeItem(this.checkedIcon));this._setInputText(this._colorName2hex(s))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.off()}_setInputText(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}_getColorInNode(t,e){let i="";const s=this.styleProperties;for(;t&&!e(t)&&!gt.check.isWysiwygFrame(t)&&0===i.length;)I(t)&&t.style[s]&&(i=t.style[s]),t=t.parentNode;return i}_colorName2hex(t){if(!t||/^#/.test(t))return t;const e=gt.utils.createElement("div",{style:"display: none; color: "+t}),i=this._w.getComputedStyle(this._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return gt.utils.removeItem(e),i.length>=3?"#"+((1<<24)+(i[0]<<16)+(i[1]<<8)+i[2]).toString(16).substring(1):""}hueSliderAction(t){this._setInputText(t.hex)}hueSliderCancelAction(){this.parentForm?.length>0&&this.parentFormDisplay.forEach((t=>t[0].style.display=t[1]))}#H(){this.parentForm?.length>0&&this.parentForm.forEach((t=>{this.parentFormDisplay.push([t,t.style.display]),t.style.display="none"})),this.hueSlider.open(this.targetButton)}#L(t){t.preventDefault(),"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(this.currentColor)}#A(t){const e=gt.query.getEventTarget(t).getAttribute("data-value");e&&"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(e)}#N(){"function"==typeof this.inst.colorPickerAction&&this.inst.colorPickerAction(null)}#M(t){const e=gt.query.getEventTarget(t);this.setHexColor(e.value)}};class Pn extends ai{static key="fontColor";static type="dropdown-free";static className="";constructor(t,e){super(t),this.title=this.lang.fontColor,this.icon="font_color";const i=gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Fn(this,"color",{colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{parents:[i],isOutsideForm:!0}}}),i.appendChild(this.colorPicker.target),this.menu.initDropdownTarget(Pn,i)}active(t,e){const i=e.querySelector(".se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=gt.utils.getStyle(t,"color"))return i.style.color=s,!0}else i.style.color=s;return!1}on(t){this.colorPicker.init(this.selection.getNode(),t,(t=>this.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=gt.utils.createElement("SPAN",{style:"color: "+t+";"});this.format.applyInlineElement(e,{stylesToModify:["color"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["color"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}}const Dn=Pn;class qn extends ai{static key="backgroundColor";static type="dropdown-free";static className="";constructor(t,e){super(t),this.title=this.lang.backgroundColor,this.icon="background_color";const i=gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new Fn(this,"backgroundColor",{colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{parents:[i],isOutsideForm:!0}}}),i.appendChild(this.colorPicker.target),this.menu.initDropdownTarget(qn,i)}active(t,e){const i=e.querySelector("path.se-svg-color-helper");if(!i)return;let s="";if(t){if(this.format.isLine(t))return;if(s=gt.utils.getStyle(t,"backgroundColor"))return i.style.color=s,!0}else i.style.color=s;return!1}on(t){this.colorPicker.init(this.selection.getNode(),t,(t=>this.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=gt.utils.createElement("SPAN",{style:"background-color: "+t+";"});this.format.applyInlineElement(e,{stylesToModify:["background-color"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["background-color"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}}const Wn=qn;class Un extends ai{static key="hr";static type="dropdown";static className="";static component(t){return/^hr$/i.test(t?.nodeName)?t:null}constructor(t,e){super(t),this.title=this.lang.horizontalLine,this.icon="horizontal_line";const i=function({lang:t},e){const i=e||[{name:t.hr_solid,class:"__se__solid"},{name:t.hr_dashed,class:"__se__dashed"},{name:t.hr_dotted,class:"__se__dotted"}];let s="";for(let t=0,e=i.length;t<e;t++)s+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="hr" title="${i[t].name}" aria-label="${i[t].name}">\n\t\t\t\t<hr${i[t].class?` class="${i[t].class}"`:""}${i[t].style?` style="${i[t].style}"`:""}/>\n\t\t\t</button>\n\t\t</li>`;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-line"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${s}</ul>\n\t\t</div>`)}(t,e.items);this.list=i.querySelectorAll("button"),this.menu.initDropdownTarget(Un,i)}select(t){gt.utils.addClass(t,"on")}deselect(t){gt.utils.removeClass(t,"on")}destroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;gt.utils.removeItem(t),this.editor.focusEdge(e),this.history.push(!1)}action(t){const e=this.submit(t.firstElementChild.className),i=this.format.addLine(e);this.selection.setRange(i,1,i,1),this.menu.dropdownOff()}shortcut({line:t,range:e}){const i=this.nodeTransform.split(e.endContainer,e.endOffset,0);this.submit("__se__solid"),gt.utils.removeItem(t),this.selection.setRange(i,0,i,0)}submit(t){const e=gt.utils.createElement("hr",{class:t});return this.editor.focus(),this.component.insert(e,{skipCharCount:!1,skipSelection:!0,skipHistory:!1}),e}}const Gn=Un;class Zn extends ai{static key="list";static type="dropdown";static className="se-icon-flip-rtl";constructor(t){super(t),this.title=this.lang.list,this.icon="list_numbered";const e=function({lang:t,icons:e}){const i=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ol" title="${t.numberedList}" aria-label="${t.numberedList}">\n\t\t\t\t\t${e.list_numbered}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ul" title="${t.bulletedList}" aria-label="${t.bulletedList}">\n\t\t\t\t\t${e.list_bulleted}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},i)}(t);this.listItems=e.querySelectorAll("li button"),this.icons={bulleted:t.icons.list_bulleted,numbered:t.icons.list_numbered},this.menu.initDropdownTarget(Zn,e)}active(t,e){const i=e.firstElementChild;if(gt.check.isList(t)){const s=t.nodeName.toLowerCase();return e.setAttribute("data-focus",s),gt.utils.addClass(e,"active"),/^ul$/.test(s)?gt.utils.changeElement(i,this.icons.bulleted):gt.utils.changeElement(i,this.icons.numbered),!0}return e.removeAttribute("data-focus"),gt.utils.changeElement(i,this.icons.number),gt.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",i=this.listItems;for(let t=0,s=i.length;t<s;t++)e===i[t].getAttribute("data-command")?gt.utils.addClass(i[t],"active"):gt.utils.removeClass(i[t],"active")}action(t){const e=t.getAttribute("data-command"),i=t.getAttribute("data-value")||"",s=this.format.applyList(`${e}:${i}`,null,!1);s&&this.selection.setRange(s.sc,s.so,s.ec,s.eo),this.menu.dropdownOff(),this.history.push(!1)}}const Yn=Zn,{_w:Xn,ON_OVER_COMPONENT:jn}=dt,Kn=".se-table-resize-line",Jn=".se-table-resize-line-prev",Qn=".se-table-resize-row",to=".se-table-resize-row-prev",eo=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],io={all:"border_all",inside:"border_inside",horizon:"border_horizontal",vertical:"border_vertical",outside:"border_outside",left:"border_left",top:"border_top",right:"border_right",bottom:"border_bottom",none:"border_none"},so=["all","inside","horizon","vertical"],no="borderLeft",oo="borderTop",lo="borderRight",ro="borderBottom",ao=["#b0dbb0","#efef7e","#f2acac","#dcb0f6","#99bdff","#5dbd5d","#e7c301","#f64444","#e57ff4","#4387f1","#27836a","#f69915","#ba0808","#a90bed","#134299","#e4e4e4","#B3B3B3","#808080","#4D4D4D","#000000"];class ho extends ai{static key="table";static type="dropdown-free";static className="";static options={isInputComponent:!0};static component(t){return gt.check.isTable(t)?t:null}constructor(t,e){super(t),this.title=this.lang.table,this.icon="table",this.figureScrollList=["se-scroll-figure-xy","se-scroll-figure-x","se-scroll-figure-y"],this.figureScroll="string"==typeof e.scrollType?e.scrollType.toLowerCase():"x",this.captionPosition="bottom"!==e.captionPosition?"top":"bottom",this.cellControllerTop="table"==("cell"!==e.cellControllerPosition?"table":"cell");const i=function(){const t='\n\t<div class="se-table-size">\n\t\t<div class="se-table-size-picker se-controller-table-picker"></div>\n\t\t<div class="se-table-size-highlighted"></div>\n\t\t<div class="se-table-size-unhighlighted"></div>\n\t</div>\n\t<div class="se-table-size-display">1 x 1</div>';return gt.utils.createElement("DIV",{class:"se-dropdown se-selector-table"},t)}(),s=i.querySelector(".se-controller-table-picker"),n=function({lang:t,icons:e}){const i=`\n\t<div class="se-arrow se-arrow-down se-visible-hidden"></div>\n\t<div class="se-btn-group">\n\t\t<button type="button" data-command="openTableProperties" class="se-btn se-tooltip">\n\t\t\t${e.table_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableProperties}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="layout" class="se-btn se-tooltip _se_table_fixed_column">\n\t\t\t${e.fixed_column_width}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.fixedColumnWidth}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="header" class="se-btn se-tooltip _se_table_header">\n\t\t\t${e.table_header}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableHeader}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="caption" class="se-btn se-tooltip _se_table_caption">\n\t\t\t${e.caption}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.caption}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="resize" class="se-btn se-tooltip _se_table_resize">\n\t\t\t${e.reduction}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.minSize}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="copy" class="se-btn se-tooltip">\n\t\t\t${e.copy}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.copy}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="remove" class="se-btn se-tooltip">\n\t\t\t${e.delete}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t</span>\n\t\t</button>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-table"},i)}(t),o=function({lang:t,icons:e},i){const s=`\n\t<div class="se-arrow se-arrow-${i?"down se-visible-hidden":"up"}"></div>\n <div class="se-btn-group">\n\t\t<button type="button" data-command="openCellProperties" class="se-btn se-tooltip">\n\t\t\t${e.cell_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.cellProperties}</span>\n\t\t\t</span>\n\t\t</button>\n <button type="button" data-command="oncolumn" class="se-btn se-tooltip">\n ${e.table_column}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.column}</span>\n </span>\n </button>\n <button type="button" data-command="onrow" class="se-btn se-tooltip">\n ${e.table_row}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.row}</span>\n </span>\n </button>\n <button type="button" data-command="merge" class="se-btn se-tooltip" style="display: none;">\n ${e.merge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.mergeCells}</span>\n </span>\n </button>\n <button type="button" data-command="onsplit" class="se-btn se-tooltip">\n ${e.split_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.splitCells}</span>\n </span>\n </button>\n\t\t<button type="button" data-command="unmerge" class="se-btn se-tooltip">\n ${e.unmerge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.unmergeCells}</span>\n </span>\n </button>\n </div>`,n=gt.utils.createElement("DIV",{class:"se-controller se-controller-table-cell"},s);return{html:n,splitButton:n.querySelector('[data-command="onsplit"]'),columnButton:n.querySelector('[data-command="oncolumn"]'),rowButton:n.querySelector('[data-command="onrow"]'),mergeButton:n.querySelector('[data-command="merge"]'),unmergeButton:n.querySelector('[data-command="unmerge"]')}}(t,this.cellControllerTop),l=function({lang:t,icons:e,options:i}){const s=i.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let n="";for(let i,o,l=0;l<s.length;l++)i=s[l],o=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],n+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align" data-value="${i}" title="${o}" aria-label="${o}">\n\t\t\t${e["align_"+i]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${o}</span>\n\t\t\t</span>\n\t\t</button>`;const o=["top","middle","bottom"];let l="";for(let i,s,n=0;n<o.length;n++)i=o[n],s=t["align"+i.charAt(0).toUpperCase()+i.slice(1)],l+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align_vertical" data-value="${i}" title="${s}" aria-label="${s}">\n\t\t\t${e["align_"+i]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${s}</span>\n\t\t\t</span>\n\t\t</button>`;const r=`\n\t\t<div class="se-controller-content">\n\t\t\t<div class="se-controller-header">\n\t\t\t\t<button type="button" data-command="close_props" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t\t<span class="se-controller-title">${t.tableProperties}</span>\n\t\t\t</div>\n\t\t\t<div class="se-controller-body">\n\n\t\t\t\t<label>${t.border}</label>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onborder_format" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e[io.all]}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_onborder_style" class="se-btn se-btn-select se-tooltip se-border-style">\n\t\t\t\t\t\t<span class="se-txt"></span>\n\t\t\t\t\t\t${e.arrow_down}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_border_color" placeholder="${t.color}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="border" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.color_palette}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.colorPicker}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-input-control __se__border_size" placeholder="${t.width}" />\n\t\t\t\t</div>\n\n\t\t\t\t<label>${t.color}</label>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="font" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.font_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.fontColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_font_color" placeholder="${t.fontColor}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="back" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.background_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.backgroundColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_back_color" placeholder="${t.backgroundColor}" />\n\t\t\t\t</div>\n\n\t\t\t\t<label>${t.font}</label>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="bold" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.bold}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.bold}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="underline" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.underline}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.underline}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="italic" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.italic}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.italic}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="strike" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.strike}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.strike}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class="se-table-props-align">\n\t\t\t\t\t<label>${t.align} <span class="__se__a_table_t">( ${t.table} )</span></label>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner">\n\t\t\t\t\t\t<div class="__se__a_h">\n\t\t\t\t\t\t\t${n}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="__se__a_v">\n\t\t\t\t\t\t\t${l}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t\t<button type="button" class="se-btn se-btn-success" data-command="props_submit" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>\n\t\t\t\t<button type="button" class="se-btn se-btn-danger" data-command="revert" title="${t.revert}" aria-label="${t.revert}">${e.revert}</button>\n\t\t\t</div>\n\t\t</div>`,a=gt.utils.createElement("DIV",{class:"se-controller se-table-props"},r);return{html:a,controller_props_title:a.querySelector(".se-controller-title"),borderButton:a.querySelector('[data-command="props_onborder_style"]'),borderFormatButton:a.querySelector('[data-command="props_onborder_format"]'),cell_alignment:a.querySelector(".se-table-props-align .__se__a_h"),cell_alignment_vertical:a.querySelector(".se-table-props-align .__se__a_v"),cell_alignment_table_text:a.querySelector(".se-table-props-align .__se__a_table_t"),border_style:a.querySelector('[data-command="props_onborder_style"] .se-txt'),border_color:a.querySelector(".__se_border_color"),border_width:a.querySelector(".__se__border_size"),back_color:a.querySelector(".__se_back_color"),font_color:a.querySelector(".__se_font_color"),palette_border_button:a.querySelector('[data-command="props_onpalette"][data-value="border"]'),font_bold:a.querySelector('[data-command="props_font_style"][data-value="bold"]'),font_underline:a.querySelector('[data-command="props_font_style"][data-value="underline"]'),font_italic:a.querySelector('[data-command="props_font_style"][data-value="italic"]'),font_strike:a.querySelector('[data-command="props_font_style"][data-value="strike"]')}}(t);t.applyFrameRoots((t=>{t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Kn.replace(/^\./,"")})),t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Jn.replace(/^\./,"")})),t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:Qn.replace(/^\./,"")})),t.get("wrapper").appendChild(gt.utils.createElement("DIV",{class:to.replace(/^\./,"")}))})),this.controller_cell=new mi(this,o.html,{position:this.cellControllerTop?"top":"bottom"}),this.controller_table=new mi(this,n,{position:"top"}),this.cellControllerTop&&(this.controller_cell.sibling=this.controller_table.form,this.controller_cell.siblingPosition="top");const r=[this.controller_table.form,this.controller_cell.form];this.controller_props=new mi(this,l.html,{position:"bottom",parents:r,isInsideForm:!0}),this.controller_props_title=l.controller_props_title;const a=gt.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.colorPicker=new Fn(this,"",{colorList:e.colorList||ao,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{parents:[a],isOutsideForm:!0}}}),a.appendChild(this.colorPicker.target),this.controller_colorPicker=new mi(this,a,{position:"bottom",parents:[this.controller_props.form].concat(r),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),gt.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.figure=new Si(this,null,{}),this.sliderType="";const h=bo.bind(this,!0),c=bo.bind(this,!1),d=(u=this.lang,{items:["vertical","horizontal"],menus:gt.utils.createElement("DIV",null,`\n\t\t<div title="${u.verticalSplit}" aria-label="${u.verticalSplit}">\n\t\t\t${u.verticalSplit}\n\t\t</div>\n\t\t<div title="${u.horizontalSplit}" aria-label="${u.horizontalSplit}">\n\t\t\t${u.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var u;this.splitButton=o.splitButton,this.selectMenu_split=new fi(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_split.on(this.splitButton,this.#B.bind(this)),this.selectMenu_split.create(d.items,d.menus);const p=function(t,e){const i=gt.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertColumnBefore}" aria-label="${t.insertColumnBefore}">\n\t\t\t<span class="se-list-icon">${e.insert_column_left}</span><span class="se-txt">${t.insertColumnBefore}</span>\n\t\t</div>\n\t\t<div title="${t.insertColumnAfter}" aria-label="${t.insertColumnAfter}">\n\t\t\t<span class="se-list-icon">${e.insert_column_right}</span><span class="se-txt">${t.insertColumnAfter}</span>\n\t\t</div>\n\t\t<div title="${t.deleteColumn}" aria-label="${t.deleteColumn}">\n\t\t\t<span class="se-list-icon">${e.delete_column}</span><span class="se-txt">${t.deleteColumn}</span>\n\t\t</div>`);return{items:["insert-left","insert-right","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),g=o.columnButton;this.selectMenu_column=new fi(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_column.on(g,this.#I.bind(this)),this.selectMenu_column.create(p.items,p.menus);const m=function(t,e){const i=gt.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertRowAbove}" aria-label="${t.insertRowAbove}">\n\t\t\t<span class="se-list-icon">${e.insert_row_above}</span><span class="se-txt">${t.insertRowAbove}</span>\n\t\t</div>\n\t\t<div title="${t.insertRowBelow}" aria-label="${t.insertRowBelow}">\n\t\t\t<span class="se-list-icon">${e.insert_row_below}</span><span class="se-txt">${t.insertRowBelow}</span>\n\t\t</div>\n\t\t<div title="${t.deleteRow}" aria-label="${t.deleteRow}">\n\t\t\t<span class="se-list-icon">${e.delete_row}</span><span class="se-txt">${t.deleteRow}</span>\n\t\t</div>`);return{items:["insert-above","insert-below","delete"],menus:i.querySelectorAll("div")}}(this.lang,this.icons),f=o.rowButton;this.selectMenu_row=new fi(this,{checkList:!1,position:"bottom-center",openMethod:h,closeMethod:c}),this.selectMenu_row.on(f,this.#V.bind(this)),this.selectMenu_row.create(m.items,m.menus);const _=function(){let t="";for(let e,i=0,s=eo.length;i<s;i++)e=eo[i],t+=`\n\t\t<div title="${e}" aria-label="${e}" style="padding: 0 12px;">\n\t\t\t<span class="se-txt">${e}</span>\n\t\t</div>`;const e=gt.utils.createElement("DIV",null,t);return{items:eo,menus:e.querySelectorAll("div")}}(),b=l.borderButton;this.selectMenu_props_border=new fi(this,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(b,fo.bind(this)),this.selectMenu_props_border.create(_.items,_.menus);const y=yo(this.lang,this.icons,[]),v=l.borderFormatButton;this.selectMenu_props_border_format=new fi(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(v,_o.bind(this,"all")),this.selectMenu_props_border_format.create(y.items,y.menus);const C=yo(this.lang,this.icons,so);this.selectMenu_props_border_format_oneCell=new fi(this,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(v,_o.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(C.items,C.menus),this.maxText=this.lang.maxSize,this.minText=this.lang.minSize,this.propTargets={cell_alignment:l.cell_alignment,cell_alignment_vertical:l.cell_alignment_vertical,cell_alignment_table_text:l.cell_alignment_table_text,border_format:v,border_style:l.border_style,border_color:l.border_color,border_width:l.border_width,back_color:l.back_color,font_color:l.font_color,palette_border_button:l.palette_border_button,font_bold:l.font_bold,font_underline:l.font_underline,font_italic:l.font_italic,font_strike:l.font_strike},this._propsCache=[],this._currentFontStyles=[],this._propsAlignCache="",this._propsVerticalAlignCache="",this._typeCache="",this.tableHighlight=i.querySelector(".se-table-size-highlighted"),this.tableUnHighlight=i.querySelector(".se-table-size-unhighlighted"),this.tableDisplay=i.querySelector(".se-table-size-display"),this.resizeButton=n.querySelector("._se_table_resize"),this.resizeText=n.querySelector("._se_table_resize > span > span"),this.columnFixedButton=n.querySelector("._se_table_fixed_column"),this.headerButton=n.querySelector("._se_table_header"),this.captionButton=n.querySelector("._se_table_caption"),this.mergeButton=o.mergeButton,this.unmergeButton=o.unmergeButton,this._resizing=!1,this._resizeLine=null,this._resizeLinePrev=null,this._figure=null,this._element=null,this._tdElement=null,this._trElement=null,this._trElements=null,this._tableXY=[],this._maxWidth=!0,this._fixedColumn=!1,this._physical_cellCnt=0,this._logical_cellCnt=0,this._cellCnt=0,this._rowCnt=0,this._rowIndex=0,this._physical_cellIndex=0,this._logical_cellIndex=0,this._current_colSpan=0,this._current_rowSpan=0,this._selectedTable=null,this._fixedCell=null,this._selectedCell=null,this._selectedCells=null,this._shift=!1,this.__s=!1,this._fixedCellName=null,this._ref=null,this._bindMultiOn=this.#O.bind(this),this._bindMultiOff=this.#R.bind(this),this._bindShiftOff=this.#z.bind(this),this._bindTouchOff=this.#$.bind(this),this.__globalEvents={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null},this.menu.initDropdownTarget(ho,i),this.eventManager.addEvent(s,"mousemove",this.#F.bind(this)),this.eventManager.addEvent(s,"click",this.#P.bind(this))}action(){const t=gt.utils.createElement("TABLE"),e=this._tableXY[0],i=this._tableXY[1],s=`<tbody>${`<tr>${go("td",e)}</tr>`.repeat(i)}</tbody>`,n=`<colgroup>${`<col style="width: ${mt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+s;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=gt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o});if(l.appendChild(t),this.component.insert(l,{skipCharCount:!1,skipSelection:!1,skipHistory:!1})){this._resetTablePicker();const e=t.querySelector("td div");this.selection.setRange(e,0,e,0)}}select(t){this._figureOpen(t),this._figure||this.setTableInfo(t);const e=this._figure?.style.width||"100%";if(this._maxWidth="100%"===e,this._fixedColumn=gt.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this._setTableStyle(this._maxWidth?"width|column":"width",!0),oe.get("__overInfo")===jn)return;if(!this._tdElement)return;this.setCellInfo(this._tdElement,!0);const i=this._selectedCells?.length>1,s=gt.query.getParentElement(t,gt.check.isFigure);this.controller_table.open(s,null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:i}),this._fixedCell&&(this._setUnMergeButton(),this.controller_cell.open(this._tdElement,this.cellControllerTop?s:null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:i}))}onCopyComponent({event:t,cloneContainer:e}){const i=e.querySelectorAll(".se-selected-table-cell");gt.utils.removeClass(i,"se-selected-table-cell|se-selected-cell-focus"),i.length>0&&(!function(t,e,i){t.preventDefault(),t.stopPropagation();const s=i[0].closest("table"),n=s.cloneNode(!1),o=gt.utils.createElement("tbody");n.appendChild(o);const l=new Map;i.forEach((t=>{l.set(t,!0)}));const r=s.rows,a=r.length,h=Array.from(r[0].cells).reduce(((t,e)=>t+(e.colSpan||1)),0),c=Array.from({length:a},(()=>Array(h).fill(null)));for(let t=0,e=0;t<a;t++,e++){const i=r[t].cells;for(let t=0,s=0,n=i.length;t<n;t++){for(;c[e][s];)s++;const n=i[t],o=n.rowSpan||1,l=n.colSpan||1;for(let t=0;t<o;t++)for(let i=0;i<l;i++)c[e+t][s+i]=n;s+=l}}for(let t=0;t<a;t++){let e;for(let i=0;i<h;i++){const s=c[t][i];if(!s||!l.has(s))continue;if(e||(e=gt.utils.createElement("tr"),o.appendChild(e)),e.lastChild&&c[t][i-1]===s)continue;if(t>0&&c[t-1][i]===s)continue;const n=s.cloneNode(!0);let r=1,d=1;for(;t+r<a&&c[t+r][i]===s;)r++;for(;i+d<h&&c[t][i+d]===s;)d++;r>1&&(n.rowSpan=r),d>1&&(n.colSpan=d),e.appendChild(n)}}const d=gt.utils.createElement("figure");d.className=e.className,d.appendChild(n);const u=`<html><body>\x3c!--StartFragment--\x3e${d.outerHTML}\x3c!--EndFragment--\x3e</body></html>`;t.clipboardData.setData("text/html",u)}(t,e,i),this.editor.ui.showToast(this.lang.message_copy_success,550))}onPaste({event:t,doc:e}){const i=gt.query.getParentElement(gt.query.getEventTarget(t),gt.check.isTableCell);if(!i)return;const s=e.body;if(1!==s.childElementCount)return;const n=this.component.get(s.firstElementChild);if(n.pluginName!==ho.key)return;const o=n.target;return this.pasteTableCellMatrix(o,i),!0}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let i=gt.check.isFigure(t.parentNode)?t.parentNode:null;if(!e){const e=t.rows[0],i=function(t){const e=t.rows;let i=0;for(let t=0,s=e.length;t<s;t++){const s=e[t].cells;let n=0;for(let t=0,e=s.length;t<e;t++)n+=s[t].colSpan;i=Math.max(i,n)}return i}(t),s=[];for(let t=0;t<i;t++){let i="";if(e&&e.cells[t]){const s=e.cells[t].style.width;s&&(i=` style="width: ${s};"`,gt.utils.setStyle(e.cells[t],"width",""))}s.push(`<col${i}>`)}const n=gt.utils.createElement("colgroup",null,s.join(""));t.insertBefore(n,t.firstElementChild)}if(i?gt.utils.addClass(i,"se-flex-component|se-input-component"):(i=gt.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(i,t),i.appendChild(t)),t.style.width&&(i.style.width=t.style.width,gt.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;gt.utils.addClass(i,t),gt.utils.removeClass(i,this.figureScrollList.filter((e=>e!==t)).join("|"))}else gt.utils.removeClass(i,this.figureScrollList.join("|"))}}}setDir(t){this.tableHighlight.style.left="rtl"===t?"167px":"",this._resetTablePicker(),this._resetPropsAlign()}onMouseMove({event:t}){if(this._resizing)return;const e=gt.query.getEventTarget(t),i=gt.query.getParentElement(e,co);if(!i)return void this.__hideResizeLine();const s=uo(t,i);if(s.is)return this._element&&(this._element.style.cursor=""),this.__removeGlobalEvents(),"block"===this._resizeLine?.style.display&&(this._resizeLine.style.display="none"),this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Kn),this._setResizeLinePosition(gt.query.getParentElement(i,gt.check.isTable),i,this._resizeLine,s.isLeft),void(this._resizeLine.style.display="block");if(po(t,i).is)return this.__removeGlobalEvents(),this._element=gt.query.getParentElement(i,gt.check.isTable),this._element.style.cursor="ns-resize","block"===this._resizeLine?.style.display&&(this._resizeLine.style.display="none"),this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Qn),this._setResizeRowPosition(gt.query.getParentElement(i,gt.check.isTable),i,this._resizeLine),void(this._resizeLine.style.display="block");this._element&&(this._element.style.cursor=""),this.__hideResizeLine()}onScroll(){"block"===this._resizeLine?.style.display&&(this._element&&(this._element.style.cursor=""),this._resizeLine.style.display="none")}onMouseDown({event:t}){this._ref=this._selectedCell=null;const e=gt.query.getEventTarget(t),i=gt.query.getParentElement(e,co);if(!i)return;this.cellControllerTop||this.controller_cell.hide();const s=uo(t,i);if(s.is){try{this._deleteStyleSelectedCells(),this.setCellInfo(i,!0);const t=this._logical_cellIndex-(s.isLeft?1:0);if(this.ui.enableBackWrapper("ew-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Kn)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(Jn),t<0||t===this._logical_cellCnt-1)return void this._startFigureResizing(s.startX,t<0);const e=this._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(e,s.startX,mt.get(Xn.getComputedStyle(e).width,0),s.isLeft),this._toggleEditor(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}finally{this._fixedCell=this._selectedCell=null}return}const n=po(t,i);if(n.is)try{let t=gt.query.getParentElement(i,gt.check.isTableRow),e=i.rowSpan;if(e>1)for(;gt.check.isTableRow(t)&&e>1;)t=t.nextElementSibling,--e;this._deleteStyleSelectedCells(),this.setRowInfo(t),this.ui.enableBackWrapper("ns-resize"),this._resizeLine||(this._resizeLine=this.editor.frameContext.get("wrapper").querySelector(Qn)),this._resizeLinePrev=this.editor.frameContext.get("wrapper").querySelector(to),this._startRowResizing(t,n.startY,mt.get(Xn.getComputedStyle(t).height,0)),this._toggleEditor(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.__removeGlobalEvents()}finally{this._fixedCell=this._selectedCell=null}else this._shift&&i!==this._fixedCell||(this._deleteStyleSelectedCells(),/^TR$/i.test(i.nodeName)||this.#D(i,!1))}onMouseUp(){this._shift=!1,this.cellControllerTop||this.controller_cell.resetPosition(this._fixedCell)}onMouseLeave(){this.__hideResizeLine()}onKeyDown({event:t,range:e,line:i}){this._ref=null;const s=t.code,n=ft.isTab(s);if(this.editor.selectMenuOn||this._resizing||!n&&this.__s||ft.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.__s=ft.isShift(t),n){this._deleteStyleSelectedCells();const s=gt.query.getParentElement(i,gt.check.isTableCell);if(s&&e.collapsed&>.check.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=this.__s;this._shift=this.__s=!1;const i=gt.query.getParentElement(s,"table"),n=gt.query.getListChildren(i,gt.check.isTableCell),o=e?gt.utils.prevIndex(n,s):gt.utils.nextIndex(n,s);if(o===n.length&&!e){if(!gt.query.getParentElement(s,"thead")){const t=i.rows,e=this.insertBodyRow(i,t.length,this._cellCnt).querySelector("td div");this.selection.setRange(e,0,e,0)}return t.preventDefault(),t.stopPropagation(),!1}if(-1===o&&e)return!1;const l=n[o];if(!l)return;const r=l.firstElementChild||l;return this.selection.setRange(r,0,r,0),t.preventDefault(),t.stopPropagation(),!1}}let o=null;if(!ft.isShift(t)){if(o=gt.query.getParentElement(i,gt.check.isTableCell),!gt.utils.hasClass(o,"se-selected-cell-focus"))return;return this._deleteStyleSelectedCells(),this._toggleEditor(!0),this.__removeGlobalEvents(),void this._closeController()}return this._shift||this._ref?void 0:(o=o||gt.query.getParentElement(i,gt.check.isTableCell),o?(this.__s=!1,this._fixedCell=o,this._closeController(),this.#D(o,t.shiftKey),!1):void 0)}onKeyUp({line:t}){this.__s=!1,this._shift&>.query.getParentElement(t,gt.check.isTableCell)===this._fixedCell&&(this._deleteStyleSelectedCells(),this._toggleEditor(!0),this.__removeGlobalEvents()),this._shift=!1}colorPickerAction(t){const e=this.propTargets[`${this.sliderType}_color`];e.style.borderColor=e.value=t,this.controller_colorPicker.close()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const{back_color:i,font_color:s,border_color:n}=this.propTargets,o=t.getAttribute("data-value");switch(e){case"header":this.toggleHeader(),this._historyPush();break;case"caption":this.toggleCaption(),this._historyPush();break;case"onsplit":this.selectMenu_split.open();break;case"oncolumn":this.selectMenu_column.open();break;case"onrow":this.selectMenu_row.menus[0].style.display=this.selectMenu_row.menus[1].style.display=/^TH$/i.test(this._tdElement?.nodeName)?"none":"",this.selectMenu_row.open();break;case"openTableProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.tableProperties,this._setCtrlProps("table"),this.controller_props.open(t,this.controller_table.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"openCellProperties":this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.lang.cellProperties,this._setCtrlProps("cell"),this.controller_props.open(t,this.controller_cell.form,{isWWTarget:!1,initMethod:null,addOffset:null}));break;case"props_onborder_format":1===this._propsCache.length?this.selectMenu_props_border_format_oneCell.open():this.selectMenu_props_border_format.open();break;case"props_onborder_style":this.selectMenu_props_border.open();break;case"props_onpalette":this._onColorPalette(t,o,"border"===o?n:"back"===o?i:s);break;case"props_font_style":gt.utils.toggleClass(this.propTargets[`font_${o}`],"on");break;case"props_submit":this._submitProps(t);break;case"revert":{const t=this._propsCache;for(let e=0,i=t.length;e<i;e++)t[e][0].style.cssText=t[e][1];this._setAlignProps(this.propTargets.cell_alignment,this._propsAlignCache,!0),this._setAlignProps(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),gt.check.isTable(t[0][0])&&this._figure&&(this._figure.style.float=this._propsAlignCache);break}case"close_props":this.controller_props.close();break;case"props_align":this._setAlignProps(this.propTargets.cell_alignment,t.getAttribute("data-value"),!1);break;case"props_align_vertical":this._setAlignProps(this.propTargets.cell_alignment_vertical,t.getAttribute("data-value"),!1);break;case"merge":this.mergeCells(this._selectedCells);break;case"unmerge":this.unmergeCells(this._selectedCells);break;case"resize":this._maxWidth=!this._maxWidth,this._setTableStyle("width",!1),this._historyPush(),this.component.select(this._element,ho.key,{isInput:!0});break;case"layout":this._fixedColumn=!this._fixedColumn,this._setTableStyle("column",!1),this._historyPush(),this.component.select(this._element,ho.key,{isInput:!0});break;case"copy":this.component.copy(this._figure);break;case"remove":{const t=this._figure?.parentNode;gt.utils.removeItem(this._figure),this._closeTableSelectInfo(),t!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(t,(function(t){return 0===t.childNodes.length}),null),this.editor.focus(),this.history.push(!1)}}/(^props_|^revert|Properties$)/.test(e)||(this.controller_props.close(),this.controller_colorPicker.close()),/^(remove|props_|on|open|merge)/.test(e)||this._setCellControllerPosition(this._tdElement,this._shift)}close(){this.__removeGlobalEvents(),this._deleteStyleSelectedCells(),this._toggleEditor(!0),this._figure=null,this._element=null,this._trElement=null,this._trElements=null,this._tableXY=[],this._maxWidth=!1,this._fixedColumn=!1,this._physical_cellCnt=0,this._logical_cellCnt=0,this._rowCnt=0,this._rowIndex=0,this._physical_cellIndex=0,this._logical_cellIndex=0,this._current_colSpan=0,this._current_rowSpan=0,this._shift=!1,this._selectedCells=null,this._selectedTable=null,this._ref=null,this._fixedCell=null,this._selectedCell=null,this._fixedCellName=null;const{border_format:t,border_color:e,border_style:i,border_width:s,back_color:n,font_color:o,cell_alignment:l,cell_alignment_vertical:r,font_bold:a,font_underline:h,font_italic:c,font_strike:d}=this.propTargets;gt.utils.removeClass([t,e,i,s,n,o,l,r,a,h,c,d],"on")}selectCells(t){const e=t[0],i=gt.query.findVisualLastCell(t);this._selectedCells=t,this._fixedCell=e,this._selectedCell=i,this._fixedCellName=e.nodeName,this._selectedTable=gt.query.getParentElement(e,"TABLE"),this._setMultiCells(e,i)}setTableInfo(t){const e=this._element=this._selectedTable=gt.query.getParentElement(t,"TABLE");return this._figure=gt.query.getParentElement(e,gt.check.isFigure)||e,e}setCellInfo(t,e){const i=this.setTableInfo(t);if(i&&(this._fixedCell=t,this._trElement=t.parentNode,i.querySelector("thead")?gt.utils.addClass(this.headerButton,"active"):gt.utils.removeClass(this.headerButton,"active"),i.querySelector("caption")?gt.utils.addClass(this.captionButton,"active"):gt.utils.removeClass(this.captionButton,"active"),e||0===this._physical_cellCnt)){this._tdElement!==t&&(this._tdElement=t,this._trElement=t.parentNode),this._selectedCells?.length||(this._selectedCells=[t]);const e=this._trElements=i.rows,s=t.cellIndex;let n=0;for(let t=0,i=e[0].cells,s=e[0].cells.length;t<s;t++)n+=i[t].colSpan;const o=this._rowIndex=this._trElement.rowIndex;this._rowCnt=e.length,this._physical_cellCnt=this._trElement.cells.length,this._logical_cellCnt=this._cellCnt=n,this._physical_cellIndex=s,this._current_colSpan=this._tdElement.colSpan-1,this._current_rowSpan=this._trElement.cells[s].rowSpan-1;let l=[],r=[];for(let t,i,n=0;n<=o;n++){t=e[n].cells,i=0;for(let e,a,h,c,d=0,u=t.length;d<u;d++){if(e=t[d],a=e.colSpan-1,h=e.rowSpan-1,c=d+i,r.length>0)for(let t,e=0;e<r.length;e++)t=r[e],t.row>n||(c>=t.index?(i+=t.cs,c+=t.cs,t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)):d===u-1&&(t.rs-=1,t.row=n+1,t.rs<1&&(r.splice(e,1),e--)));if(n===o&&d===s){this._logical_cellIndex=c;break}h>0&&l.push({index:c,cs:a+1,rs:h,row:-1}),i+=a}r=r.concat(l).sort((function(t,e){return t.index-e.index})),l=[]}l=null,r=null}}setRowInfo(t){const e=this.setTableInfo(t),i=this._trElements=e.rows;this._rowCnt=i.length,this._rowIndex=t.rowIndex}editTable(t,e){const i=this._element,s="row"===t;if(s){const t=this._trElement.parentElement;if(/^THEAD$/i.test(t.nodeName)){if("up"===e)return;if(!t.nextElementSibling||!/^TBODY$/i.test(t.nextElementSibling.nodeName))return void(e?i.innerHTML+="<tbody><tr>"+go("td",this._logical_cellCnt)+"</tr></tbody>":(gt.utils.removeItem(this._figure),this._closeTableSelectInfo()))}}if(this._ref){const t=this._tdElement,i=this._selectedCells;if(s)if(e)this.setCellInfo("up"===e?i[0]:i[i.length-1],!0),this.editRow(e,null,t);else{let t=i[0].parentNode;const s=[i[0]];for(let e,n=1,o=i.length;n<o;n++)e=i[n],t!==e.parentNode&&(s.push(e),t=e.parentNode);for(let t=0,i=s.length;t<i;t++)this.setCellInfo(s[t],!0),this.editRow(e)}else{const s=i[0].parentNode;if(e){let n=null;for(let t=0,e=i.length-1;t<e;t++)if(s!==i[t+1].parentNode){n=i[t];break}this.setCellInfo("left"===e?i[0]:n||i[0],!0),this.editCell(e,null,t)}else{const t=[i[0]];for(let e,n=1,o=i.length;n<o&&(e=i[n],s===e.parentNode);n++)t.push(e);for(let i=0,s=t.length;i<s;i++)this.setCellInfo(t[i],!0),this.editCell(e)}}e||this.close()}else this[s?"editRow":"editCell"](e);if(!e){const t=i.children;for(let e=0;e<t.length;e++)0===t[e].children.length&&(gt.utils.removeItem(t[e]),e--);0===i.children.length&>.utils.removeItem(i)}}editRow(t,e,i){this._deleteStyleSelectedCells(),e&&this.setCellInfo(e,!0);const s=!t,n="up"===t,o=this._rowIndex,l=s||n?o:o+this._current_rowSpan+1,r=s?-1:1,a=this._trElements;let h=this._logical_cellCnt;for(let t,e=0,i=o+(s?-1:0);e<=i;e++){if(t=a[e].cells,0===t.length)return;for(let i,s,n=0,o=t.length;n<o;n++)i=t[n].rowSpan,s=t[n].colSpan,i<2&&s<2||i+e>l&&l>e&&(t[n].rowSpan=i+r,h-=s)}if(s){const t=a[o+1];if(t){const e=[];let i=a[o].cells,s=0;for(let t,n,o=0,l=i.length;o<l;o++)t=i[o],n=o+s,s+=t.colSpan-1,t.rowSpan>1&&(t.rowSpan-=1,e.push({cell:t.cloneNode(!1),index:n}));if(e.length>0){let n=e.shift();i=t.cells,s=0;for(let o,l,r=0,a=i.length;r<a&&(o=i[r],l=r+s,s+=o.colSpan-1,!(l>=n.index)||(r--,s--,s+=n.cell.colSpan-1,t.insertBefore(n.cell,o),n=e.shift(),n));r++);if(n){t.appendChild(n.cell);for(let i=0,s=e.length;i<s;i++)t.appendChild(e[i].cell)}}}this._element.deleteRow(l)}else this.insertBodyRow(this._element,l,h);s?this._closeController():this._setCellControllerPosition(i||this._tdElement,!0)}editCell(t,e,i){e&&this.setCellInfo(e,!0);const s=!t,n="left"===t,o=this._current_colSpan,l=s||n?this._logical_cellIndex:this._logical_cellIndex+o+1,r=this._trElements;let a,h=[],c=[],d=0;const u=[],p=[];for(let t,e,i,n,g,m=0,f=this._rowCnt;m<f;m++){t=r[m],a=l,n=!1,e=t.cells,g=0;for(let t,i,r,f,_=0,b=e.length;_<b&&(t=e[_],t);_++)if(i=t.rowSpan-1,r=t.colSpan-1,s){if(f=_+g,c.length>0){const t=!e[_+1];for(let e,i=0;i<c.length;i++)e=c[i],e.row>m||(f>=e.index?(g+=e.cs,f=_+g,e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(c.splice(i,1),i--)))}i>0&&h.push({rs:i,cs:r+1,index:f,row:-1}),f>=a&&f+r<=a+o?u.push(t):f<=a+o&&f+r>=a?t.colSpan-=mt.getOverlapRangeAtIndex(l,l+o,f,f+r):i>0&&(f<a||f+r>a+o)&&p.push({cell:t,i:m,rs:m+i}),g+=r}else{if(_>=a)break;if(r>0){if(d<1&&r+_>=a){t.colSpan+=1,a=null,d=i+1;break}a-=r}if(!n){for(let t,e=0;e<c.length;e++)t=c[e],a-=t.cs,t.rs-=1,t.rs<1&&(c.splice(e,1),e--);n=!0}}if(c=c.concat(h).sort((function(t,e){return t.index-e.index})),h=[],!s){if(d>0){d-=1;continue}null!==a&&e.length>0&&(i=mo(e[0].nodeName),i=t.insertBefore(i,e[a]))}}const g=this._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(s)gt.utils.removeItem(t[a]);else{let e=0;for(let i,s=0,n=t.length;s<n;s++)i=mt.get(t[s].style.width),i-=Math.round(i*n*.1/2),e+=i,t[s].style.width=`${i}%`;const i=gt.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(i,t[a])}}if(s){let t,e;for(let i,s=0,n=u.length;s<n;s++)i=u[s].parentNode,gt.utils.removeItem(u[s]),0===i.cells.length&&(t||(t=gt.utils.getArrayIndex(r,i)),e=gt.utils.getArrayIndex(r,i),gt.utils.removeItem(i));for(let i,s=0,n=p.length;s<n;s++)i=p[s],i.cell.rowSpan=mt.getOverlapRangeAtIndex(t,e,i.i,i.rs);this._closeController()}else this._setCellControllerPosition(i||this._tdElement,!0);return i||this._tdElement}pasteTableCellMatrix(t,e){if(!t||!e)return;const i=t.rows;let s=0;const n=[];for(let t=0;t<i.length;t++){const e=i[t].cells;let o=0;for(let i=0;i<e.length;i++){const l=e[i];for(;n[t]?.[o];)o++;const r=l.rowSpan||1,a=l.colSpan||1;0===o&&(s+=r);for(let e=0;e<r;e++)for(let i=0;i<a;i++)n[t+e]||(n[t+e]=[]),n[t+e][o+i]=!0;o+=a}}let o=0;for(let t=0,e=i[0].cells,s=e.length;t<s;t++){o+=e[t].colSpan||1}const l={rowCnt:s,logicalCellCnt:o};this._deleteStyleSelectedCells();const r=e.closest("table"),{cloneTable:a,clonedSelectedCells:h}=this.#q(r,[e]),c=a;e=h[0];let d=c.rows;this.setTableInfo(c),this.setCellInfo(e,!0);const u={physicalCellCnt:this._physical_cellCnt,logicalCellCnt:this._logical_cellCnt,rowCnt:this._rowCnt,rowInex:this._rowIndex,physicalCellIndex:this._physical_cellIndex,logicalCellIndex:this._logical_cellIndex,currentColSpan:this._current_colSpan,currentRowSpan:this._current_rowSpan},p=l.rowCnt-(u.rowCnt-(u.rowInex+1))-1,g=l.logicalCellCnt-(u.logicalCellCnt-(u.logicalCellIndex+1))-1;if(u.rowCnt+=p,u.logicalCellCnt+=g,u.physicalCellCnt+=g,p>0||g>0){const t=d[d.length-1],e=t.cells[t.cells.length-1];for(let t=0;t<p;t++)this.editRow("down",e);for(let t=0;t<g;t++)this.editCell("right",e);d=this._trElements=c.rows}const m=u.rowInex,f=u.logicalCellIndex,_=f+l.logicalCellCnt-1,b=[],y=[];for(let t=0,e=m+l.rowCnt;t<e;t++){const e=d[t]?.cells;if(!e)continue;let i=0,s=0;for(let n=0;n<e.length;n++){for(;y[t]?.[i];)i++;const n=e[s++];if(!n)break;const o=n.colSpan||1,l=n.rowSpan||1,r=i,a=i+o-1;if(l>1||o>1)for(let e=1;e<l;e++){const s=t+e;y[s]||(y[s]=[]);for(let t=0;t<o;t++)y[s][i+t]=!0}r<=_&&a>=f&&(o>1||l>1)&&b.push(n),i+=o}}b.length>0&&(this.unmergeCells(b,!0),d=this._trElements=c.rows);const v=[],C=[],w=[];for(let t=0,e=l.rowCnt;t<e;t++){const e=i[t]?.cells;if(!e)break;let s=0;for(let i=0;i<e.length;i++){const n=e[i],o=n.colSpan||1,l=n.rowSpan||1;for(;C[t]?.[s];)s++;for(let e=1;e<l;e++){const i=t+e;C[i]||(C[i]=[]);for(let t=0;t<o;t++)C[i][s+t]=!0}if(o<=1&&l<=1){s+=o;continue}const r=s+u.logicalCellIndex,a=r+o-1,h=[];for(let e=u.rowInex+t,i=e+l,s=0;e<i;e++,s++){const t=d[e].cells;let i=0,s=0;for(;s<t.length&&i<=a;){for(;w[e]?.[i];)i++;const n=t[s++],o=n.colSpan||1,l=n.rowSpan||1,c=i,d=i+o-1;if(l>1)for(let t=1;t<l;t++){const s=e+t;w[s]||(w[s]=[]);for(let t=0;t<o;t++)w[s][i+t]=!0}d>=r&&c<=a&&h.push(n),i+=o}}h.length>0&&v.push(h),s+=o}}if(v.length>0){for(const t of v)this._ref=null,this._trElements=c.rows,this.mergeCells(t,!0);d=this._trElements=c.rows}const x=[],k=[];for(let t=0;t<l.rowCnt;t++){const e=d[u.rowInex+t],s=i[t];if(!e||!s)break;const n=e.cells,o=s.cells;let l=0,r=0,a=0;for(;r<n.length&&a<o.length&&l<=_;){for(;k[t]?.[l];)l++;const e=n[r++],i=o[a];if(!e||!i)break;const s=e.colSpan||1,h=e.rowSpan||1;if(h>1)for(let e=1;e<h;e++){const i=t+e;k[i]||(k[i]=[]);for(let t=0;t<s;t++)k[i][l+t]=!0}l>=f&&l+s-1<=_&&(e.innerHTML=i.innerHTML,x.push(e),a++),l+=s}}r.replaceWith(c),this._closeTableSelectInfo(),this.setTableInfo(c),this.selectCells(x),this._setMergeSplitButton(),this._setUnMergeButton(),this.#W(x[0]),this._historyPush()}insertBodyRow(t,e,i){const s=t.insertRow(e);return s.innerHTML=go("td",i),s}mergeCells(t,e=!1){const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this.#q(i,t);this.setTableInfo(s),t=n,this._ref=null,this._setMultiCells(t[0],gt.query.findVisualLastCell(t));const o=this._ref,l=t[0];let r=null,a=null;const h=o.ce-o.cs+1;let c=o.re-o.rs+1,d="",u=null;for(let e,i,s=1,n=t.length;s<n;s++){e=t[s],u!==e.parentNode&&(u=e.parentNode),i=e.children;for(let t=0,e=i.length;t<e;t++)this.format.isLine(i[t])&>.check.isZeroWidth(i[t].textContent)&>.utils.removeItem(i[t]);d+=e.innerHTML,gt.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,c-=1)}if(r){const t=this._trElements,e=gt.utils.getArrayIndex(t,r),i=gt.utils.getArrayIndex(t,a||r),s=[];for(let n,o=0;o<=i;o++)if(n=t[o].cells,0!==n.length)for(let t,s,l=0,r=n.length;l<r;l++)t=n[l],s=t.rowSpan-1,s>0&&o+s>=e&&(t.rowSpan-=mt.getOverlapRangeAtIndex(e,i,o,o+s));else s.push(t[o]);for(let t=0,e=s.length;t<e;t++)gt.utils.removeItem(s[t])}l.innerHTML+=d,l.colSpan=h,l.rowSpan=c,e||(i.replaceWith(s),this._closeTableSelectInfo(),this._setMergeSplitButton(),this._setController(l),this.#W(l),this._historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const i=t[0].closest("table"),{cloneTable:s,clonedSelectedCells:n}=e?{cloneTable:i,clonedSelectedCells:t}:this.#q(i,t);this._ref=null,this.setTableInfo(s);let o=(t=n)[0],l=gt.query.findVisualLastCell(t),r=null;const a=o.closest("table"),h=a.rows;for(const e of t){const t=e.parentElement.rowIndex,i=e.cellIndex,s=e.rowSpan,n=e.colSpan;if(1===s&&1===n)continue;this.setCellInfo(e,!0);const a=e.innerHTML;e.remove();for(let c=0;c<s;c++){const s=h[t+c];for(let t=0;t<n;t++){const n=mo("td");0===c&&0===t?(o===e&&(o=n),l===e&&(l=n),n.innerHTML=a,s.insertBefore(n,s.cells[i])):(s.insertBefore(n,s.cells[i+t]),r=n)}}}this._selectedCells=null,e||(i.replaceWith(s),this._closeTableSelectInfo(),this.setTableInfo(s),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this._setMultiCells(o,l),this._selectedCells=Array.from(a.querySelectorAll(".se-selected-table-cell"))):this.setCellInfo(l,!0),this._fixedCell=o,this._selectedCell=l,gt.utils.addClass(l,"se-selected-cell-focus"),this._setUnMergeButton(),this.controller_cell.resetPosition(l),this._historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}toggleHeader(){const t=this.headerButton,e=gt.utils.hasClass(t,"active"),i=this._element;if(e)gt.utils.removeItem(i.querySelector("thead"));else{const t=gt.utils.createElement("THEAD");t.innerHTML="<tr>"+go("th",this._logical_cellCnt)+"</tr>",i.insertBefore(t,i.firstElementChild)}gt.utils.toggleClass(t,"active"),/TH/i.test(this._tdElement.nodeName)?this._closeController():this._setCellControllerPosition(this._tdElement,!1)}toggleCaption(){const t=this.captionButton,e=gt.utils.hasClass(t,"active"),i=this._element;if(e)gt.utils.removeItem(i.querySelector("caption"));else{const t=gt.utils.createElement("CAPTION",{class:`se-table-caption-${this.captionPosition}`});t.innerHTML="<div><br></div>",i.insertBefore(t,i.firstElementChild)}gt.utils.toggleClass(t,"active"),this._setCellControllerPosition(this._tdElement,!1)}_setTableStyle(t,e){if(t.includes("width")){const t=this._figure;if(!t)return;let i,s;this._maxWidth?(i=this.icons.reduction,s=this.minText,e||(t.style.width="100%")):(i=this.icons.expansion,s=this.maxText,e||(t.style.width="min-content")),gt.utils.changeElement(this.resizeButton.firstElementChild,i),gt.utils.changeTxt(this.resizeText,s)}t.includes("column")&&(this._fixedColumn?(gt.utils.removeClass(this._element,"se-table-layout-auto"),gt.utils.addClass(this._element,"se-table-layout-fixed"),gt.utils.addClass(this.columnFixedButton,"active")):(gt.utils.removeClass(this._element,"se-table-layout-fixed"),gt.utils.addClass(this._element,"se-table-layout-auto"),gt.utils.removeClass(this.columnFixedButton,"active")))}_setMergeSplitButton(){this._ref?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")}_setUnMergeButton(){this.findMergedCells(this._selectedCells?.length?this._selectedCells:[this._fixedCell]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_setController(t){if(!this.selection.get().isCollapsed&&!this._selectedCell)return void this._deleteStyleSelectedCells();this._setUnMergeButton(),this._tdElement=t,this._fixedCell===t&>.utils.addClass(t,"se-selected-cell-focus"),this._selectedCells?.length||(this._selectedCells=[t]);const e=this._selectedTable||this._element||gt.query.getParentElement(t,"TABLE");this.component.select(e,ho.key,{isInput:!0})}_setCellControllerPosition(t,e){this.setCellInfo(t,e),this.controller_cell.resetPosition(this.cellControllerTop?gt.query.getParentElement(t,gt.check.isTable):t)}_historyPush(){this._deleteStyleSelectedCells(),this.history.push(!1),this._recallStyleSelectedCells()}_figureOpen(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1})}_startCellResizing(t,e,i,s){this._setResizeLinePosition(this._figure,this._tdElement,this._resizeLinePrev,s),this._resizeLinePrev.style.display="block";const n=t.style.width,o=t.nextElementSibling,l=o.style.width,r=gt.utils.hasClass(this._element,"se-table-layout-fixed")?l:pt.getWidthInPercentage(t);oe.get("__dragHandler")&&(oe.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._cellResize.bind(this,t,o,this._figure,this._tdElement,this._resizeLine,s,e,i,mt.get(n,0),mt.get(r,0),this._element.offsetWidth),(()=>{this.__removeGlobalEvents(),this.history.push(!0),this.component.select(this._element,ho.key,{isInput:!0})}),(e=>{this._stopResize(t,n,"width",e),this._stopResize(o,l,"width",e)}))}_cellResize(t,e,i,s,n,o,l,r,a,h,c,d){const u=(r+(d.clientX-l))/c*100;if(u>0){t.style.width=`${u}%`;const l=a-u;e.style.width=`${h+l}%`,this._setResizeLinePosition(i,s,n,o)}}_startRowResizing(t,e,i){this._setResizeRowPosition(this._figure,t,this._resizeLinePrev),this._resizeLinePrev.style.display="block";const s=t.style.height;this._addResizeGlobalEvents(this._rowResize.bind(this,t,this._figure,this._resizeLine,e,i),(()=>{this.__removeGlobalEvents(),this.history.push(!0)}),this._stopResize.bind(this,t,s,"height"))}_rowResize(t,e,i,s,n,o){const l=n+(o.clientY-s);t.style.height=`${l}px`,this._setResizeRowPosition(e,t,i)}_startFigureResizing(t,e){const i=this._figure;this._setResizeLinePosition(i,i,this._resizeLinePrev,e),this._resizeLinePrev.style.display="block";const s=pt.getWidthInPercentage(i);oe.get("__dragHandler")&&(oe.get("__dragHandler").style.display="none"),this._addResizeGlobalEvents(this._figureResize.bind(this,i,this._resizeLine,e,t,i.offsetWidth,mt.get(s,0)),(()=>{this.__removeGlobalEvents(),this.component.select(this._element,ho.key,{isInput:!0})}),this._stopResize.bind(this,i,i.style.width,"width"))}_figureResize(t,e,i,s,n,o,l){const r=(n+(i?s-l.clientX:l.clientX-s))/n*o;r>0&&(t.style.width=`${r}%`,this._setResizeLinePosition(t,t,e,i))}_setResizeLinePosition(t,e,i,s){const n=this.offset.getLocal(e),o=this.offset.getLocal(t);i.style.left=`${n.left+(s?0:e.offsetWidth)}px`,i.style.top=`${o.top}px`,i.style.height=`${t.offsetHeight}px`}_setResizeRowPosition(t,e,i){const s=this.offset.getLocal(e),n=this.offset.getLocal(t);i.style.top=`${s.top+e.offsetHeight}px`,i.style.left=`${n.left}px`,i.style.width=`${t.offsetWidth}px`}_stopResize(t,e,i,s){ft.isEsc(s.code)&&(this.__removeGlobalEvents(),t.style[i]=e,"width"===i&&this.component.select(this._element,ho.key,{isInput:!0}))}_deleteStyleSelectedCells(){gt.utils.removeClass([this._fixedCell,this._selectedCell],"se-selected-cell-focus");const t=this._fixedCell?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,i=e.length;t<i;t++)gt.utils.removeClass(e[t],"se-selected-table-cell")}}_recallStyleSelectedCells(){if(this._selectedCells){const t=this._selectedCells;for(let e=0,i=t.length;e<i;e++)gt.utils.addClass(t[e],"se-selected-table-cell")}}_addResizeGlobalEvents(t,e,i){this.__globalEvents.resize=this.eventManager.addGlobalEvent("mousemove",t,!1),this.__globalEvents.resizeStop=this.eventManager.addGlobalEvent("mouseup",e,!1),this.__globalEvents.resizeKeyDown=this.eventManager.addGlobalEvent("keydown",i,!1),this._resizing=!0}_toggleEditor(t){const e=this.editor.frameContext.get("wysiwyg");e.setAttribute("contenteditable",t.toString()),t?gt.utils.removeClass(e,"se-disabled"):gt.utils.addClass(e,"se-disabled")}_setCtrlProps(t){this._typeCache=t;const e="table"===t,i=e?[this._element]:this._selectedCells;if(!i||0===i.length)return;const{border_format:s,border_color:n,border_style:o,border_width:l,back_color:r,font_color:a,cell_alignment:h,cell_alignment_vertical:c,cell_alignment_table_text:d,font_bold:u,font_underline:p,font_italic:g,font_strike:m}=this.propTargets,{border:f,backgroundColor:_,color:b,textAlign:y,verticalAlign:v,fontWeight:C,textDecoration:w,fontStyle:x}=Xn.getComputedStyle(i[0]),k=this._getBorderStyle(f);h.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",c.style.display=e?"none":"";let S=pt.rgb2hex(k.c),E=k.s,T=k.w,H=pt.rgb2hex(_),M=pt.rgb2hex(b),L=/.+/.test(C),N=/underline/i.test(w),A=/line-through/i.test(w),B=/italic/i.test(x),I=e?this._figure?.style.float:y,V=v;this._propsCache=[];const O=Xn.getComputedStyle(this.eventManager.__focusTemp);for(let t,s,n=0;t=i[n];n++){const{cssText:i,border:n,backgroundColor:o,color:l,textAlign:r,verticalAlign:a,fontWeight:h,textDecoration:c,fontStyle:d}=t.style;if(this._propsCache.push([t,i]),s)continue;const{c:u,s:p,w:g}=this._getBorderStyle(n);let m=o,f=l;m&&(this.eventManager.__focusTemp.style.backgroundColor=m,m=O.backgroundColor),f&&(this.eventManager.__focusTemp.style.color=f,f=O.color),S&&k.c!==u&&(S=""),E&&k.s!==p&&(E=""),T&&k.w!==g&&(T=""),H!==pt.rgb2hex(m)&&(H=""),M!==pt.rgb2hex(f)&&(M=""),I!==(e?this._figure?.style.float:r)&&(I=""),V&&V!==a&&(V=""),L&&L!==/.+/.test(h)&&(L=!1),N&&N!==/underline/i.test(c)&&(N=!1),A&&A!==/line-through/i.test(c)&&(A=!1),B&&B!==/italic/i.test(d)&&(B=!1),S&&E&&T&&H&&M||(s=!0)}s.firstElementChild.innerHTML=this.icons[io[1===i.length?"outside":"all"]],s.setAttribute("se-border-format","all"),gt.utils.removeClass(s,"active"),E=E||eo[0],o.textContent=E,n.style.borderColor=n.value=S,l.value=T,this._disableBorderProps(E===eo[0]),r.value=r.style.borderColor=H,a.value=a.style.borderColor=M,L&>.utils.addClass(u,"on"),N&>.utils.addClass(p,"on"),A&>.utils.addClass(m,"on"),B&>.utils.addClass(g,"on"),this._setAlignProps(h,this._propsAlignCache=I,!0),this._setAlignProps(c,this._propsVerticalAlignCache=V,!0)}_setAlignProps(t,e,i){gt.utils.removeClass(t.querySelectorAll("button"),"on"),i||t.getAttribute("se-cell-align")!==e?(gt.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}_disableBorderProps(t){const{border_color:e,border_width:i,palette_border_button:s}=this.propTargets;t?(e.disabled=!0,i.disabled=!0,s.disabled=!0,i.disabled=!0):(e.disabled=!1,i.disabled=!1,s.disabled=!1,i.disabled=!1)}_getBorderStyle(t){const e=t.split(/\s(?![^()]*\))/);let i="",s="",n="";return 3===e.length?(i=e[0],s=e[1],n=e[2]):2===e.length?/\d/.test(e[0])?(i=e[0],s=e[1]):(s=e[0],n=e[1]):1===e.length&&(/\d/.test(e[0])?i=e[0]:s=e[0]),{w:i,s,c:pt.rgb2hex(n)}}_submitProps(t){try{t.disabled=!0;const e=this.controller_table.form.contains(this.controller_props.currentTarget),i=e?[this._element]:this._selectedCells,s=i[0],n=Xn.getComputedStyle(s),{border_format:o,border_color:l,border_style:r,border_width:a,back_color:h,font_color:c,cell_alignment:d,cell_alignment_vertical:u}=this.propTargets,p=o.getAttribute("se-border-format")||"",g="all"!==p,m=("none"===r.textContent?"":r.textContent)||"",f="none"===p||!m,_=d.getAttribute("se-cell-align")||"",b=u.getAttribute("se-cell-align")||"",y=f?"":l.value.trim()||n.borderColor;let v=f?"":a.value.trim()||n.borderWidth;v+=mt.is(v)?"px":"";const C=h.value.trim(),w=c.value.trim(),x=g&&!f&&v,k=`${v} ${m} ${y}`,S={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=s.style;this._figure&&(this._figure.style.float=_,this._figure.style.verticalAlign=b),t.backgroundColor=C,t.color=w,this._setFontStyle(t),x||(t.border=f?t.borderLeft=t.borderTop=t.borderRight=t.borderBottom="":k),S.left=S.top=S.right=S.bottom=i}else{const t=s.parentElement;let{rs:e,re:n,cs:o,ce:l}=this._ref||{rs:t.rowIndex||0,re:t.rowIndex||0,cs:s.cellIndex||0,ce:s.cellIndex||0};const r=new Array(n-e+1).fill(0).map((()=>new Array(l-o+1).fill(0))),a=o;n-=e,e-=e,l-=o,o-=o;let h=t;for(let t,s,c,d,u,p=0,g=0,m=i.length,y=0;p<m;p++,g++){t=i[p],d=t.colSpan,u=t.rowSpan,c=t.cellIndex-a,h!==t.parentElement&&(y++,g=0,h=t.parentElement);let m=0;for(;m<=c;)c+=r[y][m]||0,m++;try{if(u>1){const t=u-1;for(let e=y;e<=y+t;e++)r[e][c]+=d-(y===e?1:0)}else d>1&&(r[y][c]+=d-1)}catch(t){}const v=y+u-1===n;y===e&&S.top.push(t),(y===n||v)&&S.bottom.push(t),c===o&&S.left.push(t),c!==l&&c+d-1!==l||S.right.push(t),v||y===e||y===n||c===o||c===l||S.middle.push(t),s=t.style,s.textAlign=_,s.verticalAlign=b,s.backgroundColor=C,s.color=w,this._setFontStyle(s),x||(s.border=f?s.borderLeft=s.borderTop=s.borderRight=s.borderBottom="":k)}0===S.middle.length&&(S.middle=i)}S.all=i,x&&this._setBorderStyles(S,p,k),this._historyPush(),this.controller_props.close(),this._tdElement&&(this._recallStyleSelectedCells(),this.setCellInfo(this._tdElement,!0),gt.utils.addClass(this._tdElement,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.disabled=!1}}_setFontStyle(t){const{font_bold:e,font_italic:i,font_strike:s,font_underline:n}=this.propTargets;t.fontWeight=gt.utils.hasClass(e,"on")?"bold":"",t.fontStyle=gt.utils.hasClass(i,"on")?"italic":"",t.textDecoration=((gt.utils.hasClass(s,"on")?"line-through ":"")+(gt.utils.hasClass(n,"on")?"underline":"")).trim()}_setBorderStyles(t,e,i){const{left:s,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;gt.utils.setStyle(r.filter((t=>!l.includes(t))),ro,i),gt.utils.setStyle(r.filter((t=>!o.includes(t))),lo,i);break;case"horizon":if(1===r.length)return;gt.utils.setStyle(r.filter((t=>!l.includes(t))),ro,i);break;case"vertical":if(1===r.length)return;gt.utils.setStyle(r.filter((t=>!o.includes(t))),lo,i);break;case"outside":gt.utils.setStyle(s,no,i),gt.utils.setStyle(n,oo,i),gt.utils.setStyle(o,lo,i),gt.utils.setStyle(l,ro,i);break;case"left":gt.utils.setStyle(s,no,i);break;case"top":gt.utils.setStyle(n,oo,i);break;case"right":gt.utils.setStyle(o,lo,i);break;case"bottom":gt.utils.setStyle(l,ro,i)}}_setMultiCells(t,e){const i=this._selectedTable.rows;if(this._deleteStyleSelectedCells(),gt.utils.addClass(t,"se-selected-table-cell"),t===e&&!this._shift)return;let s=!0,n=[],o=[];const l=this._ref={_i:0,cs:null,ce:null,rs:null,re:null};for(let r,a,h=0,c=i.length;h<c;h++){r=i[h].cells,a=0;for(let i,c,d,u,p=0,g=r.length;p<g;p++){if(i=r[p],d=i.colSpan-1,u=i.rowSpan-1,c=p+a,n.length>0)for(let t,e=0;e<n.length;e++)t=n[e],t.row>h||(c>=t.index?(a+=t.cs,c+=t.cs,t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)):p===g-1&&(t.rs-=1,t.row=h+1,t.rs<1&&(n.splice(e,1),e--)));if(s){if(i!==t&&i!==e||(l.cs=null!==l.cs&&l.cs<c?l.cs:c,l.ce=null!==l.ce&&l.ce>c+d?l.ce:c+d,l.rs=null!==l.rs&&l.rs<h?l.rs:h,l.re=null!==l.re&&l.re>h+u?l.re:h+u,l._i+=1),2===l._i){s=!1,n=[],o=[],h=-1;break}}else if(mt.getOverlapRangeAtIndex(l.cs,l.ce,c,c+d)&&mt.getOverlapRangeAtIndex(l.rs,l.re,h,h+u)){const t=l.cs<c?l.cs:c,e=l.ce>c+d?l.ce:c+d,s=l.rs<h?l.rs:h,r=l.re>h+u?l.re:h+u;if(l.cs!==t||l.ce!==e||l.rs!==s||l.re!==r){l.cs=t,l.ce=e,l.rs=s,l.re=r,h=-1,n=[],o=[];break}gt.utils.addClass(i,"se-selected-table-cell")}u>0&&o.push({index:c,cs:d+1,rs:u,row:-1}),a+=i.colSpan-1}n=n.concat(o).sort(((t,e)=>t.index-e.index)),o=[]}}_resetTablePicker(){if(!this.tableHighlight)return;const t=this.tableHighlight.style,e=this.tableUnHighlight.style;t.width="1em",t.height="1em",e.width="10em",e.height="10em",gt.utils.changeTxt(this.tableDisplay,"1 x 1"),this.menu.dropdownOff()}_resetPropsAlign(){const{cell_alignment:t}=this.propTargets,e=t.querySelector('[data-value="left"]'),i=t.querySelector('[data-value="right"]'),s=e.parentElement,n=i.parentElement;s.appendChild(i),n.appendChild(e)}_onColorPalette(t,e,i){this.controller_colorPicker.isOpen&&e===this.sliderType?this.controller_colorPicker.close():(this.sliderType=e,gt.utils.addClass(t,"on"),this.colorPicker.init(i?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}_closeController(){this.controller_table.close(),this.controller_cell.close()}_closeTableSelectInfo(){this.component.deselect(),this._closeController()}__hideResizeLine(){this._resizeLine&&(this._resizeLine.style.display="none",this._resizeLine=null)}__removeGlobalEvents(){this._toggleEditor(!0),this._resizing=!1,this.ui.disableBackWrapper(),this.__hideResizeLine(),this._resizeLinePrev&&(this._resizeLinePrev.style.display="none",this._resizeLinePrev=null);const t=this.__globalEvents;for(const e in t)t[e]&&(t[e]=this.eventManager.removeGlobalEvent(t[e]))}#q(t,e){const i=gt.utils.clone(t,!0),s=Array.from(t.querySelectorAll("td, th")),n=Array.from(i.querySelectorAll("td, th"));return{cloneTable:i,clonedSelectedCells:e.map((t=>{const e=s.indexOf(t);return e>-1?n[e]:null})).filter((t=>null!==t))}}#D(t,e){this.__s=e,this._shift||this._ref||this.__removeGlobalEvents(),this._shift=e,this._fixedCell=t,this._selectedCells?.length||(this._selectedCells=[t]),this._fixedCellName=t.nodeName,this._selectedTable=gt.query.getParentElement(t,"TABLE"),this._deleteStyleSelectedCells(),gt.utils.addClass(t,"se-selected-cell-focus"),e?(this.__globalEvents.shiftOff=this.eventManager.addGlobalEvent("keyup",this._bindShiftOff,!1),this.__globalEvents.on=this.eventManager.addGlobalEvent("mousedown",this._bindMultiOn,!1)):this.__globalEvents.on=this.eventManager.addGlobalEvent("mousemove",this._bindMultiOn,!1),this.__globalEvents.off=this.eventManager.addGlobalEvent("mouseup",this._bindMultiOff,!1),this.__globalEvents.touchOff=this.eventManager.addGlobalEvent("touchmove",this._bindTouchOff,!1)}#B(t){const e="vertical"===t,i=this._tdElement,s=this._trElements,n=this._trElement,o=this._logical_cellIndex,l=this._rowIndex,r=mo(i.nodeName);if(e){const t=i.colSpan;if(r.rowSpan=i.rowSpan,t>1)r.colSpan=Math.floor(t/2),i.colSpan=t-r.colSpan,n.insertBefore(r,i.nextElementSibling);else{let e=[],l=[];for(let n,r,a=0,h=this._rowCnt;a<h;a++){n=s[a].cells,r=0;for(let s,h,c,d,u=0,p=n.length;u<p;u++){if(s=n[u],h=s.colSpan-1,c=s.rowSpan-1,d=u+r,l.length>0)for(let t,e=0;e<l.length;e++)t=l[e],t.row>a||(d>=t.index?(r+=t.cs,d+=t.cs,t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)):u===p-1&&(t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)));if(d<=o&&c>0&&e.push({index:d,cs:h+1,rs:c,row:-1}),s!==i&&d<=o&&d+h>=o+t-1){s.colSpan+=1;break}if(d>o)break;r+=h}l=l.concat(e).sort((function(t,e){return t.index-e.index})),e=[]}n.insertBefore(r,i.nextElementSibling)}}else{const t=i.rowSpan;if(r.colSpan=i.colSpan,t>1){r.rowSpan=Math.floor(t/2);const e=t-r.rowSpan,l=[],a=gt.utils.getArrayIndex(s,n)+e;for(let t,e,i=0;i<a;i++){t=s[i].cells,e=0;for(let s,n,r,h=0,c=t.length;h<c&&(r=h+e,!(r>=o));h++)s=t[h],n=s.rowSpan-1,n>0&&n+i>=a&&r<o&&l.push({index:r,cs:s.colSpan}),e+=s.colSpan-1}const h=s[a],c=h.cells;let d=l.shift();for(let t,e,i,s,n=0,a=c.length,u=0;n<a;n++){if(i=n+u,t=c[n],e=t.colSpan-1,s=i+e+1,d&&s>=d.index&&(u+=d.cs,s+=d.cs,d=l.shift()),s>=o||n===a-1){h.insertBefore(r,t.nextElementSibling);break}u+=e}i.rowSpan=e}else{r.rowSpan=i.rowSpan;const t=gt.utils.createElement("TR");t.appendChild(r);for(let t,e=0;e<l;e++){if(t=s[e].cells,0===t.length)return;for(let i=0,s=t.length;i<s;i++)e+t[i].rowSpan-1>=l&&(t[i].rowSpan+=1)}const e=this._physical_cellIndex,o=n.cells;for(let t=0,i=o.length;t<i;t++)t!==e&&(o[t].rowSpan+=1);n.parentNode.insertBefore(t,n.nextElementSibling)}}this.selectMenu_split.close(),this.#W(i),this._deleteStyleSelectedCells(),this.history.push(!1),this._setController(i),this._selectedCell=this._fixedCell=i,this._selectedCells?.length||(this._selectedCells=[i])}#I(t){switch(t){case"insert-left":this.editTable("cell","left");break;case"insert-right":this.editTable("cell","right");break;case"delete":this.editTable("cell",null)}this._historyPush()}#V(t){switch(t){case"insert-above":this.editTable("row","up");break;case"insert-below":this.editTable("row","down");break;case"delete":this.editTable("row",null)}this._historyPush()}#F(t){t.stopPropagation();let e=Math.ceil(t.offsetX/18),i=Math.ceil(t.offsetY/18);e=e<1?1:e,i=i<1?1:i,this.options.get("_rtl")&&(this.tableHighlight.style.left=18*e-13+"px",e=11-e),this.tableHighlight.style.width=e+"em",this.tableHighlight.style.height=i+"em";const s=e<5?5:e>8?10:e+2,n=i<5?5:i>8?10:i+2;this.tableUnHighlight.style.width=s+"em",this.tableUnHighlight.style.height=n+"em",gt.utils.changeTxt(this.tableDisplay,e+" x "+i),this._tableXY=[e,i]}#P(){this.action()}#O(t){this.editor._preventBlur=!0;const e=gt.query.getParentElement(gt.query.getEventTarget(t),gt.check.isTableCell);if(this._shift){if(e===this._fixedCell)return this._shift=!1,this._deleteStyleSelectedCells(),this._toggleEditor(!0),void this.__removeGlobalEvents();this._toggleEditor(!1)}else if(!this._ref){if(e===this._fixedCell)return;this._toggleEditor(!1)}e&&e!==this._selectedCell&&this._fixedCellName===e.nodeName&&this._selectedTable===gt.query.getParentElement(e,"TABLE")&&this._setMultiCells(this._fixedCell,this._selectedCell=e)}#R(t){if(t.stopPropagation(),this._shift?this.__globalEvents.touchOff&&(this.__globalEvents.touchOff=this.eventManager.removeGlobalEvent(this.__globalEvents.touchOff)):(this._toggleEditor(!0),this.__removeGlobalEvents()),!this._fixedCell||!this._selectedTable)return;if(this._setMergeSplitButton(),this._selectedCells=Array.from(this._selectedTable.querySelectorAll(".se-selected-table-cell")),this._shift)return;this._fixedCell&&this._selectedCell&&(this.#W(this._fixedCell),this._fixedCell===this._selectedCell&>.utils.removeClass(this._fixedCell,"se-selected-table-cell"));const e=this._selectedCells?.length>0?this._selectedCell:this._fixedCell;this._setController(e)}#z(){if(this._ref){this.__removeGlobalEvents(),this._toggleEditor(!0),this.#W(this._fixedCell);const t=this._selectedCells?.length>0?this._selectedCell:this._fixedCell;this._setController(t)}else this._closeController()}#$(){this.close()}#W(t){dt.isMobile||this.editor.focusEdge(t)}}function co(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function uo(t,e){const i=t.clientX,s=mt.get(Xn.getComputedStyle(e).width,0),n=e.getBoundingClientRect(),o=Math.round(i-n.left),l=o<=2;return{is:l||s-o<=2,isLeft:l,startX:i}}function po(t,e){const i=t.clientY,s=mt.get(Xn.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(s+n.top-i)<=5,startY:i}}function go(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function mo(t){return t=t.toLowerCase(),gt.utils.createElement(t,null,"<div><br></div>")}function fo(t){this.propTargets.border_style.textContent=t,this._disableBorderProps(t===eo[0]),this.selectMenu_props_border.close()}function _o(t,e){const{border_format:i}=this.propTargets;i.setAttribute("se-border-format",e),i.firstElementChild.innerHTML=this.icons[io[e]],e!==t?gt.utils.addClass(i,"active"):gt.utils.removeClass(i,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}function bo(t){this.controller_cell.bringToTop(t)}function yo(t,e,i){const s=[];let n="";for(const o in io){if(i.includes(o))continue;const l=io[o];s.push(o),n+=`\n\t\t\t<button type="button" class="se-btn se-tooltip">\n\t\t\t\t${e[l]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t[l]}</span>\n\t\t\t\t</span>\n\t\t\t</button>`}return{items:s,menus:gt.utils.createElement("DIV",null,n).querySelectorAll("button")}}const vo=ho;class Co extends ai{static key="formatBlock";static type="dropdown";static className="se-btn-select se-btn-tool-format";constructor(t,e){super(t),this.title=this.lang.formats,this.inner='<span class="se-txt">'+this.lang.formats+"</span>"+this.icons.arrow_down;const i=function({lang:t},e){const i=["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],s=e&&0!==e.length?e:i;let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let e,o,l,r,a,h,c,d=0,u=s.length;d<u;d++)e=s[d],"string"==typeof e&&i.includes(e)?(o=e.toLowerCase(),l="blockquote"===o?"block":"pre"===o?"br-line":"line",a=/^h/.test(o)?o.match(/\d+/)[0]:"",r=t["tag_"+(a?"h":o)]+a,c="",h=""):(o=e.tag.toLowerCase(),l=e.command,r=e.name||o,c=e.class,h=c?' class="'+c+'"':""),n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${l}" data-value="${o}" data-class="${c}" title="${r}" aria-label="${r}">\n\t\t\t\t\t<${o}${h}>${r}</${o}>\n\t\t\t\t</button>\n\t\t\t</li>`;return n+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.formatList=i.querySelectorAll("li button"),this.currentFormat="",this.menu.initDropdownTarget(Co,i)}active(t,e){let i=this.lang.formats;const s=e.querySelector(".se-txt");if(t){if(this.format.isLine(t)){const e=this.formatList,n=t.nodeName.toLowerCase(),o=(t.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let t,s=0,l=e.length;s<l;s++)if(t=e[s],n===t.getAttribute("data-value")&&o===t.getAttribute("data-class")){i=t.title;break}return gt.utils.changeTxt(s,i),s.setAttribute("data-value",n),s.setAttribute("data-class",o),!0}}else gt.utils.changeTxt(s,i);return!1}on(t){const e=this.formatList,i=t.querySelector(".se-txt"),s=(i.getAttribute("data-value")||"")+(i.getAttribute("data-class")||"");if(s!==this.currentFormat){for(let t,i=0,n=e.length;i<n;i++)t=e[i],s===t.getAttribute("data-value")+t.getAttribute("data-class")?gt.utils.addClass(t,"active"):gt.utils.removeClass(t,"active");this.currentFormat=s}}action(t){const e=t.getAttribute("data-command"),i=t.firstElementChild;"block"===e?this.format.applyBlock(i):"br-line"===e?this.format.setBrLine(i):this.format.setLine(i),this.menu.dropdownOff()}applyHeaderByShortcut({keyCode:t}){const e=t.match(/\d+$/)?.[0],i=gt.utils.createElement(`H${e}`);this.format.setLine(i)}}const wo=Co;class xo extends ai{static key="layout";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.layout,this.icon="layout",this.selectedIndex=-1,this.items=e.items;const i=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.layout.warn] To use the "layout" plugin, please define the "layouts" option.');let e='\n\t<div class="se-dropdown se-list-inner">\n\t\t<ul class="se-list-basic">';for(let i,s=0,n=(t||[]).length;s<n;s++)i=t[s],e+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-value="${s}" title="${i.name}" aria-label="${i.name}">\n\t\t\t\t\t${i.name}\n\t\t\t\t</button>\n\t\t\t</li>`;return e+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(xo,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.layout.fail] cause : "layouts[i].html not found"');this.html.set(i.html),this.menu.dropdownOff()}}const ko=xo;class So extends ai{static key="lineHeight";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.lineHeight,this.icon="line_height";const i=function({lang:t},e){const i=e||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}];let s=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">\n\t\t\t\t\t(${t.default})\n\t\t\t\t</button>\n\t\t\t</li>`;for(let t,e=0,n=i.length;e<n;e++)t=i[e],s+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t.value}" title="${t.text}" aria-label="${t.text}">\n\t\t\t\t\t${t.text}\n\t\t\t\t</button>\n\t\t\t</li>`;return s+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(t,e.items);this.sizeList=i.querySelectorAll("li button"),this.currentSize=null,this.menu.initDropdownTarget(So,i)}active(t,e){return this.format.isLine(t)&&t.style.lineHeight.length>0?(gt.utils.addClass(e,"active"),!0):(gt.utils.removeClass(e,"active"),!1)}on(){const t=this.format.getLine(this.selection.getNode()),e=t?t.style.lineHeight+"":"";if(e!==this.currentSize){const t=this.sizeList;for(let i=0,s=t.length;i<s;i++)e===t[i].getAttribute("data-command")?gt.utils.addClass(t[i],"active"):gt.utils.removeClass(t[i],"active");this.currentSize=e}}action(t){const e=t.getAttribute("data-command")||"",i=this.format.getLines();for(let t=0,s=i.length;t<s;t++)i[t].style.lineHeight=e;this.menu.dropdownOff(),this.editor.effectNode=null,this.history.push(!1)}}const Eo=So;class To extends ai{static key="template";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.template,this.icon="template",this.selectedIndex=-1,this.items=e.items;const i=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.template.warn] To use the "template" plugin, please define the "templates" option.');let e='<div class="se-dropdown se-list-inner"><ul class="se-list-basic">';for(let i,s=0,n=(t||[]).length;s<n;s++)i=t[s],e+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-value="${s}" \n\t\t\t\ttitle="${i.name}" \n\t\t\t\taria-label="${i.name}"\n\t\t\t>\n\t\t\t\t${i.name}\n\t\t\t</button>\n\t\t</li>`;return e+="</ul></div>",gt.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.menu.initDropdownTarget(To,i)}action(t){const e=Number(t.getAttribute("data-value")),i=this.items[this.selectedIndex=e];if(!i.html)throw this.menu.dropdownOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.html.insert(i.html,{selectInserted:!1,skipCharCount:!1,skipCleaning:!1}),this.menu.dropdownOff()}}const Ho=To;class Mo extends ai{static key="paragraphStyle";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.paragraphStyle,this.icon="paragraph_style";const i=function({lang:t},e){const i={spaced:{name:t.menu_spaced,class:"__se__p-spaced",_class:""},bordered:{name:t.menu_bordered,class:"__se__p-bordered",_class:""},neon:{name:t.menu_neon,class:"__se__p-neon",_class:""}},s=e&&0!==e.length?e:["spaced","bordered","neon"];let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,o,l,r=0,a=s.length;r<a;r++){if(t=s[r],"string"==typeof t){const e=i[t.toLowerCase()];if(!e)continue;t=e}e=t.name,o=t.class?` class="${t.class}"`:"",l=t._class,n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${l?" "+l:""}" data-command="${t.class}" title="${e}" aria-label="${e}">\n\t\t\t\t\t<div${o}>${e}</div>\n\t\t\t\t</button>\n\t\t\t</li>`}return n+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.classList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(Mo,i)}on(){const t=this.classList,e=this.format.getLine(this.selection.getNode());for(let i=0,s=t.length;i<s;i++)gt.utils.hasClass(e,t[i].getAttribute("data-command"))?gt.utils.addClass(t[i],"active"):gt.utils.removeClass(t[i],"active")}action(t){const e=t.getAttribute("data-command");let i=this.format.getLines();if(0===i.length&&(this.selection.getRangeAndAddLine(this.selection.getRange(),null),i=this.format.getLines(),0===i.length))return;const s=gt.utils.hasClass(t,"active")?gt.utils.removeClass:gt.utils.addClass;for(let t=0,n=i.length;t<n;t++)s(i[t],e);this.menu.dropdownOff(),this.history.push(!1)}}const Lo=Mo;class No extends ai{static key="textStyle";static type="dropdown";static className="";constructor(t,e){super(t),this.title=this.lang.textStyle,this.icon="text_style";const i=function({lang:t},e){const i={code:{name:t.menu_code,class:"__se__t-code",tag:"code"},shadow:{name:t.menu_shadow,class:"__se__t-shadow",tag:"span"}},s=e||Object.keys(i);let n='<div class="se-list-inner"><ul class="se-list-basic">';for(let t,e,o,l,r,a,h=0,c=s.length;h<c;h++){if(t=s[h],l="",a="",r=[],"string"==typeof t){const e=i[t.toLowerCase()];if(!e)continue;t=e}o=t.name,e=t.tag||"span",l+=` class="${t.class}"`,a+=`.${t.class.trim().replace(/\s+/g,",.")}`,r.push("class"),a=a.replace(/,$/,""),n+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-command="${e}" \n\t\t\t\tdata-value="${a}" \n\t\t\t\ttitle="${o}" \n\t\t\t\taria-label="${o}"\n\t\t\t>\n\t\t\t\t<${e}${l}>${o}</${e}>\n\t\t\t</button>\n\t\t</li>`}return n+="</ul></div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(t,e.items);this.styleList=i.querySelectorAll("li button"),this.menu.initDropdownTarget(No,i)}on(){const t=this.styleList,e=this.selection.getNode();for(let i,s,n,o=0,l=t.length;o<l;o++){i=t[o],s=i.getAttribute("data-value").split(",");for(let t,o,l=0;l<s.length;l++){for(t=e,n=!1;t&&!this.format.isLine(t)&&!this.component.is(t);){if(t.nodeName.toLowerCase()===i.getAttribute("data-command").toLowerCase()&&(o=s[l],/^\./.test(o)?gt.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?gt.utils.addClass(i,"active"):gt.utils.removeClass(i,"active")}}action(t){const e=t.firstElementChild,i=e.style.cssText.replace(/:.+(;|$)/g,",").split(",");i.pop();const s=e.classList;for(let t=0,e=s.length;t<e;t++)i.push("."+s[t]);const n=gt.utils.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.format.applyInlineElement(n,{stylesToModify:i,nodesToRemove:o,strictRemove:!0}),this.menu.dropdownOff()}}const Ao=No,{NO_EVENT:Bo}=dt;const Io=class extends ai{constructor(t,e,i){super(t.editor),this.openNewWindow=!!i.openNewWindow,this.relList=Array.isArray(i.relList)?i.relList:[],this.defaultRel=i.defaultRel||{},this.noAutoPrefix=!!i.noAutoPrefix,i.enableFileUpload&&(this.uploadUrl="string"==typeof i.uploadUrl?i.uploadUrl:null,this.uploadHeaders=i.uploadHeaders||null,this.uploadSizeLimit=mt.get(i.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=mt.get(i.uploadSingleSizeLimit,0)||null,this.input=gt.utils.createElement("input",{type:"file",accept:i.acceptedFormats||"*"}),this.eventManager.addEvent(this.input,"change",this.#S.bind(this)),this.fileManager=new Fs(this,{query:"a[download]:not([data-se-file-download])",loadHandler:this.events.onFileLoad,eventHandler:this.events.onFileAction}));const s=function(t,e,i){const s=t.lang,n=t.icons,o=e.textToDisplay?"":'style="display: none;"',l=e.title?"":'style="display: none;"';let r=`\n\t\t<div class="se-modal-body">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${s.link_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input data-focus class="se-input-form se-input-url" type="text" placeholder="${t.options.get("protocol")||""}" />\n\t\t\t\t\t${e.enableFileUpload?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_upload_button" aria-label="${s.fileUpload}">\n\t\t\t\t\t\t\t\t\t${n.file_upload}\n\t\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(s.fileUpload)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t\t<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_bookmark_button" aria-label="${s.link_modal_bookmark}">\n\t\t\t\t\t\t${n.bookmark}\n\t\t\t\t\t\t${gt.utils.createTooltipInner(s.link_modal_bookmark)}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div class="se-anchor-preview-form">\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_bookmark_icon">${n.bookmark}</span>\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_download_icon">${n.download}</span>\n\t\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t\t</div>\n\t\t\t\t<label ${o}>${s.link_modal_text}</label>\n\t\t\t\t<input class="se-input-form _se_display_text" type="text" ${o} />\n\t\t\t\t<label ${l}>${s.title}</label>\n\t\t\t\t<input class="se-input-form _se_title" type="text" ${l} />\n\t\t\t</div>\n\t\t\t<div class="se-modal-form-footer">\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_check" /> ${s.link_modal_newWindowCheck}</label>\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_download" /> ${s.link_modal_downloadLinkCheck}</label>`;i.length>0&&(r+=`\n\t\t\t<div class="se-anchor-rel">\n\t\t\t\t<button type="button" class="se-btn se-tooltip se-anchor-rel-btn" title="${s.link_modal_relAttribute}" aria-label="${s.link_modal_relAttribute}">\n\t\t\t\t\t${n.link_rel}\n\t\t\t\t\t${gt.utils.createTooltipInner(s.link_modal_relAttribute)}\n\t\t\t\t</button>\n\t\t\t\t<div class="se-anchor-rel-wrapper"><pre class="se-link-preview se-anchor-rel-preview"></pre></div>\n\t\t\t</div>\n\t\t</div>`);return r+="</div></div>",gt.utils.createElement("DIV",null,r)}(t.editor,i,this.relList);if(this.kink=t.constructor.key||t.constructor.name,this.inst=t,this.modalForm=e,this.host=(this._w.location.origin+this._w.location.pathname).replace(/\/$/,""),this.urlInput=s.querySelector(".se-input-url"),this.displayInput=s.querySelector("._se_display_text"),this.titleInput=s.querySelector("._se_title"),this.newWindowCheck=s.querySelector("._se_anchor_check"),this.downloadCheck=s.querySelector("._se_anchor_download"),this.download=s.querySelector("._se_anchor_download_icon"),this.preview=s.querySelector(".se-link-preview"),this.bookmark=s.querySelector("._se_anchor_bookmark_icon"),this.bookmarkButton=s.querySelector("._se_bookmark_button"),this.currentRel=[],this.currentTarget=null,this.linkValue="",this._change=!1,this._isRel=this.relList.length>0,this._isRel){this.relButton=s.querySelector(".se-anchor-rel-btn"),this.relPreview=s.querySelector(".se-anchor-rel-preview");const t=this.relList,e=(this.defaultRel.default||"").split(" "),i=[];for(let s,n=0,o=t.length;n<o;n++)s=t[n],i.push(gt.utils.createElement("BUTTON",{type:"button",class:"se-btn-list"+(e.includes(s)?" se-checked":""),"data-command":s,title:s,"aria-label":s},s+'<span class="se-svg">'+this.icons.checked+"</span>"));this.selectMenu_rel=new fi(this,{checkList:!0,position:"right-middle",dir:"ltr"}),this.selectMenu_rel.on(this.relButton,this.#U.bind(this)),this.selectMenu_rel.create(i),this.eventManager.addEvent(this.relButton,"click",this.#G.bind(this))}this.modalForm.querySelector(".se-anchor-editor").appendChild(s),this.selectMenu_bookmark=new fi(this,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_bookmark.on(this.urlInput,this.#Z.bind(this)),this.eventManager.addEvent(this.newWindowCheck,"change",this.#Y.bind(this)),this.eventManager.addEvent(this.downloadCheck,"change",this.#X.bind(this)),this.eventManager.addEvent(this.displayInput,"input",this.#j.bind(this)),this.eventManager.addEvent(this.urlInput,"input",this.#K.bind(this)),this.eventManager.addEvent(this.urlInput,"focus",this.#J.bind(this)),this.eventManager.addEvent(this.bookmarkButton,"click",this.#Q.bind(this)),this.eventManager.addEvent(s.querySelector("._se_upload_button"),"click",(()=>this.input.click()))}set(t){this.currentTarget=t}on(t){if(t){if(this.currentTarget){const t=this.currentTarget.href;this.linkValue=this.preview.textContent=this.urlInput.value=this._selfPathBookmark(t)?t.substring(t.lastIndexOf("#")):t,this.displayInput.value=this.currentTarget.textContent,this.titleInput.value=this.currentTarget.title,this.newWindowCheck.checked=!!/_blank/i.test(this.currentTarget.target),this.downloadCheck.checked=!!this.currentTarget.download}}else this.init(),this.displayInput.value=this.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this._setRel(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this._setLinkPreview(this.linkValue)}create(t){if(0===this.linkValue.length)return null;const e=this.linkValue,i=0===this.displayInput.value.length?e:this.displayInput.value,s=this.currentTarget||gt.utils.createElement("A");return this._updateAnchor(s,e,i,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",s}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this._change=!1,this._setRel(this.defaultRel.default||"")}_updateAnchor(t,e,i,s,n){!this._selfPathBookmark(e)&&this.downloadCheck.checked?t.setAttribute("download",i||e):t.removeAttribute("download"),this.newWindowCheck.checked?t.target="_blank":t.removeAttribute("target");const o=this.currentRel.join(" ");o?t.rel=o:t.removeAttribute("rel"),t.href=e,s?t.title=s:t.removeAttribute("title"),n?0===t.children.length&&(t.textContent=""):t.textContent=i}_selfPathBookmark(t){const e=this._w.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}_setRel(t){if(!this._isRel)return;const e=this.currentRel=t?t.split(" "):[],i=this.selectMenu_rel.form.querySelectorAll("button");for(let t,s=0,n=i.length;s<n;s++)t=i[s].getAttribute("data-command"),e.includes(t)?gt.utils.addClass(i[s],"se-checked"):gt.utils.removeClass(i[s],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?gt.utils.addClass(this.relButton,"on"):gt.utils.removeClass(this.relButton,"on")}_createBookmarkList(t){const e=gt.query.getListChildren(this.editor.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||gt.check.isAnchor(t)&&!!t.id));if(0===e.length)return;const i=new RegExp(`^${t.replace(/^#/,"")}`,"i"),s=[],n=[];for(let t,o=0,l=e.length;o<l;o++)t=e[o],i.test(t.textContent)&&(s.push(t),n.push(gt.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===s.length?this.selectMenu_bookmark.close():(this.selectMenu_bookmark.create(s,n),this.selectMenu_bookmark.open(this.options.get("_rtl")?"bottom-right":""))}_setLinkPreview(t){const e=this.preview,i=this.options.get("defaultUrlProtocol"),s=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(i),o=!!i&&RegExp("^"+ut.escapeStringRegexp(t.substring(0,i.length))).test(i);t=this.linkValue=e.textContent=t?s?t:!i||n||o?n?t:/^www\./.test(t)?"http://"+t:this.host+(/^\//.test(t)?"":"/")+t:i+t:"",this._selfPathBookmark(t)?(this.bookmark.style.display="block",gt.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",gt.utils.removeClass(this.bookmarkButton,"active")),!this._selfPathBookmark(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}_relMerge(t){const e=this.currentRel;if(!t)return e.join(" ");if(/^only:/.test(t))return t=t.replace(/^only:/,"").trim(),this.currentRel=t.split(" "),t;const i=t.split(" ");for(let t=0,s=i.length;t<s;t++)e.includes(i[t])||e.push(i[t]);return e.join(" ")}_relDelete(t){if(!t)return this.currentRel.join(" ");/^only:/.test(t)&&(t=t.replace(/^only:/,"").trim());const e=this.currentRel.join(" ").replace(RegExp(t+"\\s*"),"");return this.currentRel=e.split(" "),e}_register(t){const e=t.result[0];this.linkValue=this.preview.textContent=this.urlInput.value=e.url,this.displayInput.value=e.name,this.downloadCheck.checked=!0,this.download.style.display="block"}async _error(t){const e=await this.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const i=e===Bo?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",i)}_uploadCallBack(t){const e=JSON.parse(t.responseText);e.errorMessage?this._error(e):this._register(e)}async#S(t){const e=gt.query.getEventTarget(t).files;if(!e[0])return;const i={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:e},s=async function(t,e){t=e||t;const i=await this.fileManager.asyncUpload(t.url,t.uploadHeaders,t.files);this._uploadCallBack(i)}.bind(this,i);this._uploadCallBack;const n=await this.triggerEvent("onFileUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),void(!0!==n&&n!==Bo||s(null)))}#G(){this.selectMenu_rel.open(this.options.get("_rtl")?"left-middle":"")}#Z(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this._setLinkPreview(this.urlInput.value),this.selectMenu_bookmark.close(),this.urlInput.focus()}#U(t){const e=t.getAttribute("data-command");if(!e)return;const i=this.currentRel,s=i.indexOf(e);-1===s?i.push(e):i.splice(s,1),this.relPreview.title=this.relPreview.textContent=i.join(", ")}#j(t){const e=gt.query.getEventTarget(t);this._change=!!e.value.trim()}#K(t){const e=gt.query.getEventTarget(t).value.trim();this._setLinkPreview(e),this._selfPathBookmark(e)?this._createBookmarkList(e):this.selectMenu_bookmark.close()}#J(){const t=this.urlInput.value;this._selfPathBookmark(t)&&this._createBookmarkList(t)}#Q(){let t=this.urlInput.value;this._selfPathBookmark(t)?(t=t.substring(1),this.bookmark.style.display="none",gt.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",gt.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this._createBookmarkList(t)),this.urlInput.value=t,this._setLinkPreview(t),this.urlInput.focus()}#Y(t){if("string"!=typeof this.defaultRel.check_new_window)return;gt.query.getEventTarget(t).checked?this._setRel(this._relMerge(this.defaultRel.check_new_window)):this._setRel(this._relDelete(this.defaultRel.check_new_window))}#X(t){gt.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",gt.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this._setRel(this._relMerge(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this._setRel(this._relDelete(this.defaultRel.check_bookmark)))}},{_w:Vo}=dt,Oo={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const Ro=class extends ne{constructor(t,e){super(t.editor),this.offset=this.editor.offset,this.ui=this.editor.ui,this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=e,this.isUpdate=!1,this.focusElement=e.querySelector("[data-focus]"),this._modalArea=this.carrierWrapper.querySelector(".se-modal"),this._modalInner=this.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this._closeListener=[this.#tt.bind(this),this.#et.bind(this)],this._bindClose=null,this._onClickEvent=null,this._closeSignal=!1,this._resizeBody=null,this._modalInner.appendChild(e),this.eventManager.addEvent(e.querySelector("form"),"submit",this.#i.bind(this)),this._closeSignal=!this.eventManager.addEvent(e.querySelector('[data-command="close"]'),"click",this.close.bind(this)),(e.querySelector(".se-modal-resize-handle-w")||e.querySelector(".se-modal-resize-handle-h")||e.querySelector(".se-modal-resize-handle-c")||e.querySelector(".se-modal-resize-form"))&&!(this._resizeBody=e.querySelector(".se-modal-resize-form"))&&(this._resizeBody=e.querySelector(".se-modal-body"))&&(this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#it.bind(this,"w")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#it.bind(this,"h")),this.eventManager.addEvent(e.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#it.bind(this,"c")),this._currentHandle=null,this.__resizeDir="",this.__offetTop=0,this.__offetLeft=0,this.__globalEventHandlers={mousemove:this.#st.bind(this),mouseup:this.#nt.bind(this)},this._bindClose_mousemove=null,this._bindClose_mouseup=null)}static CreateFileInput({icons:t,lang:e},{acceptedFormats:i,allowMultiple:s}){return`\n\t\t<div class="se-modal-form-files">\n\t\t\t<div class="se-flex-input-wrapper">\n\t\t\t\t<div class="se-input-form-abs">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="se-input-file-w">\n\t\t\t\t\t\t\t<div class="se-input-file-icon-up">${t.upload_tray}</div>\n\t\t\t\t\t\t\t<div class="se-input-file-icon-files">${t.file_plus}</div>\n\t\t\t\t\t\t\t<span class="se-input-file-cnt"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-form __se__file_input" data-focus type="file" accept="${i}"${s?' multiple="multiple"':""}/>\n\t\t\t</div>\n\t\t\t<button type="button" class="se-btn se-modal-files-edge-button se-file-remove se-tooltip" aria-label="${e.remove}">\n\t\t\t\t${t.selection_remove}\n\t\t\t\t${gt.utils.createTooltipInner(e.remove)}\n\t\t\t</button>\n\t\t</div>`}static OnChangeFile(t,e){if(!t||!e)return;const i=t.querySelector(".se-input-file-cnt"),s=t.querySelector(".se-input-file-icon-up"),n=t.querySelector(".se-input-file-icon-files");e.length>1?(s.style.display="none",n.style.display="inline-block",i.style.display="",i.textContent=` ..${e.length}`):e.length>0?(s.style.display="none",n.style.display="none",i.style.display="block",i.textContent=e[0].name):(s.style.display="inline-block",n.style.display="none",i.style.display="",i.textContent="")}open(){if(this.ui._offCurrentModal(),this._fixCurrentController(!0),this._closeSignal&&this._modalInner.addEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),this._bindClose=this.eventManager.addGlobalEvent("keydown",this._closeListener[0]),this.isUpdate=this.kind===this.editor.currentControllerName,this.editor.opendModal=this,this.isUpdate||"function"!=typeof this.inst.init||this.inst.init(),"function"==typeof this.inst.on&&this.inst.on(this.isUpdate),gt.utils.addClass(this._modalArea,"se-backdrop-show"),gt.utils.addClass(this.form,"se-modal-show"),this._resizeBody){const t=this._saveOffset(),{maxWidth:e,maxHeight:i}=Vo.getComputedStyle(this.form),s=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this._resizeBody.offsetHeight)}px`;e&&"string"==typeof this.__resizeDir&>.utils.setStyle(this._resizeBody,"max-width",`calc(${e} - ${s})`),i&>.utils.setStyle(this._resizeBody,"max-height",`calc(${i} - ${n})`)}this.focusElement&&this.focusElement.focus()}close(){this.__removeGlobalEvent(),this._fixCurrentController(!1),Vo.setTimeout((()=>{this.editor.opendModal=null}),0),this._closeSignal&&this._modalInner.removeEventListener("click",this._closeListener[1]),this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose)),gt.utils.removeClass(this._modalArea,"se-backdrop-show"),gt.utils.removeClass(this.form,"se-modal-show"),"function"==typeof this.inst.init&&this.inst.init(),"function"==typeof this.inst.off&&this.inst.off(this.isUpdate),this.editor.focus()}_fixCurrentController(t){const e=this.editor.opendControllers;for(let i=0;i<e.length;i++)e[i].fixed=t,e[i].form.style.display=t?"none":"block"}_saveOffset(){const t=this.offset.getGlobal(this._resizeBody);return this.__offetTop=t.top,this.__offetLeft=t.left,t}__addGlobalEvent(t){this.__removeGlobalEvent(),this.ui.enableBackWrapper(Oo[t]),this._bindClose_mousemove=this.eventManager.addGlobalEvent("mousemove",this.__globalEventHandlers.mousemove,!0),this._bindClose_mouseup=this.eventManager.addGlobalEvent("mouseup",this.__globalEventHandlers.mouseup,!0)}__removeGlobalEvent(){this.ui.disableBackWrapper(),this._bindClose_mousemove&&(this._bindClose_mousemove=this.eventManager.removeGlobalEvent(this._bindClose_mousemove)),this._bindClose_mouseup&&(this._bindClose_mouseup=this.eventManager.removeGlobalEvent(this._bindClose_mouseup))}async#i(t){t.preventDefault(),t.stopPropagation(),this.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.ui.hideLoading():void 0===t?this.close():(this.close(),this.ui.hideLoading())}catch(t){throw this.close(),this.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#et(t){const e=gt.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this._modalInner)&&this.close()}#tt(t){ft.isEsc(t.code)&&this.close()}#it(t,e){this._currentHandle=gt.query.getEventTarget(e),gt.utils.addClass(this._currentHandle,"active"),this.__addGlobalEvent(this.__resizeDir=t+(this.options.get("_rtl")?"RTL":""))}#st(t){switch(this.__resizeDir){case"w":case"wRTL":{const e=t.clientY-this.__offetTop-this._resizeBody.offsetHeight;this._resizeBody.style.height=this._resizeBody.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.__offetLeft-this._resizeBody.offsetWidth;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px";break}case"hRTL":{const e=this.__offetLeft-t.clientX;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.__offetLeft-this._resizeBody.offsetWidth,i=t.clientY-this.__offetTop-this._resizeBody.offsetHeight;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px",this._resizeBody.style.height=this._resizeBody.offsetHeight+i+"px";break}case"cRTL":{const e=this.__offetLeft-t.clientX,i=t.clientY-this.__offetTop-this._resizeBody.offsetHeight;this._resizeBody.style.width=this._resizeBody.offsetWidth+e+"px",this._resizeBody.style.height=this._resizeBody.offsetHeight+i+"px";break}}this._saveOffset(),"function"==typeof this.inst.modalResize&&this.inst.modalResize()}#nt(){gt.utils.removeClass(this._currentHandle,"active"),this._currentHandle=null,this.__removeGlobalEvent()}};const zo=class extends ai{static key="link";static type="modal";static className="se-icon-flip-rtl";constructor(t,e){super(t),this.title=this.lang.link,this.icon="link",e.textToDisplay=!0,e.title=!0;const i=function({lang:t,icons:e}){const i=`\n\t<form>\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.link_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-anchor-editor"></div>\n\t\t<div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n\t\t</div>\n\t</form>`;return gt.utils.createElement("DIV",{class:"se-modal-content"},i)}(t),s=function({lang:t,icons:e}){const i=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<span><a target="_blank" href=""></a> </span>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="unlink" tabindex="-1" class="se-btn se-tooltip se-icon-flip-rtl">\n\t\t\t\t${e.unlink}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.unlink}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t),n="string"==typeof e.uploadUrl?e.uploadUrl:null;this.isUpdateState=!1,this.pluginOptions={...e,uploadUrl:n,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new Io(this,i,this.pluginOptions),this.modal=new Ro(this,i),this.controller=new mi(this,s,{position:"bottom",disabled:!1})}active(t){if(gt.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.controller.form.querySelector("a");return e.href=t.href,e.title=t.textContent,e.textContent=t.textContent,gt.utils.addClass(t,"on"),this.anchor.set(t),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}),!0}return this.controller.close(),!1}open(){this.modal.open()}on(t){this.isUpdateState=t,this.anchor.on(t)}modalAction(){const t=this.anchor.create(!1);if(null===t)return!1;if(this.isUpdateState){const t=this.controller.currentTarget.childNodes[0];this.selection.setRange(t,0,t,t.textContent.length)}else{const e=this.format.getLines();if(e.length>1){if(!this.html.insertNode(gt.utils.createElement(e[0].nodeName,null,t),{afterNode:null,skipCharCount:!1}))return!0}else if(!this.html.insertNode(t,{afterNode:null,skipCharCount:!1}))return!0;this.selection.setRange(t.childNodes[0],0,t.childNodes[0],t.textContent.length)}return!0}init(){this.controller.close(),this.anchor.init()}controllerAction(t){const e=t.getAttribute("data-command");if(/update/.test(e))this.modal.open();else if(/unlink/.test(e)){const t=gt.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=gt.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0);this.selection.setRange(t,0,e,e.textContent.length),this.format.applyInlineElement(null,{stylesToModify:null,nodesToRemove:["A"],strictRemove:!1})}else gt.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.editor.focus(),this.history.push(!1)}close(){gt.utils.removeClass(this.controller.currentTarget,"on")}},{NO_EVENT:$o}=dt;class Fo extends ai{static key="image";static type="modal";static className="";static component(t){const e=gt.check.isFigure(t)||/^span$/i.test(t.nodeName)&>.utils.hasClass(t,"se-component")?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:gt.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}constructor(t,e){super(t),this.title=this.lang.image,this.icon="image",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"auto",defaultHeight:e.defaultHeight?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"auto",percentageOnlySize:!!e.percentageOnlySize,createFileInput:void 0===e.createFileInput||e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"image/*":e.acceptedFormats.trim()||"image/*",useFormatType:e.useFormatType??!0,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){const n=s.createFileInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_file}</label>\n\t\t\t${Ro.CreateFileInput({icons:e,lang:t},s)}\n\t\t</div>`:"",o=s.createUrlInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${i.imageGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.imageGallery}">\n\t\t\t\t\t\t\t${e.image_gallery}\n\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.imageGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n\t\t\t<pre class="se-link-preview"></pre>\n\t\t</div>`:"",l=s.canResize?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-size-text">\n\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t<label class="size-h">${t.height}</label>\n\t\t\t</div>\n\t\t\t<input class="se-input-control _se_size_x" placeholder="auto" type="text" />\n\t\t\t<label class="se-modal-size-x">x</label>\n\t\t\t<input type="text" class="se-input-control _se_size_y" placeholder="auto" />\n\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_check_proportion" checked/> ${t.proportion}</label>\n\t\t\t<button type="button" aria-label="${t.revert}" class="se-btn se-tooltip se-modal-btn-revert">\n\t\t\t\t${e.revert}\n\t\t\t\t${gt.utils.createTooltipInner(t.revert)}\n\t\t\t</button>\n\t\t</div>`:"",r=s.useFormatType?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t<button type="button" data-command="asBlock" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_block}\n\t\t\t\t\t${gt.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="asInline" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t${gt.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>`:"",a=`\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t<span class="se-modal-title">${t.image_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-tabs">\n\t\t\t<button type="button" class="_se_tab_link active" data-tab-link="image">${t.image}</button>\n\t\t\t<button type="button" class="_se_tab_link" data-tab-link="url">${t.link}</button>\n\t\t</div>\n\t\t<form method="post" enctype="multipart/form-data">\n\t\t\t<div class="_se_tab_content _se_tab_content_image">\n\t\t\t\t<div class="se-modal-body">\n\t\t\t\t\t${n}\n\t\t\t\t\t${o}\n\t\t\t\t\t<div style="border-bottom: 1px dashed #ccc;"></div>\n\t\t\t\t\t<div class="se-modal-form">\n\t\t\t\t\t\t<label>${t.image_modal_altText}</label><input class="se-input-form _se_image_alt" type="text" />\n\t\t\t\t\t</div>\n\t\t\t\t\t${l}\n\t\t\t\t\t${r}\n\t\t\t\t\t<div class="se-modal-form se-modal-form-footer">\n\t\t\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_image_check_caption" /> ${t.caption}</label>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-anchor-editor _se_tab_content _se_tab_content_url" style="display: none;">\n\t\t\t</div>\n\t\t\t<div class="se-modal-footer">\n\t\t\t\t<div class="se-figure-align">\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t\t</div>\n\t\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t\t</div>\n\t\t</form>`,h=gt.utils.createElement("DIV",{class:"se-modal-content"},a);return{html:h,alignForm:h.querySelector(".se-figure-align"),fileModalWrapper:h.querySelector(".se-flex-input-wrapper"),imgInputFile:h.querySelector(".__se__file_input"),imgUrlFile:h.querySelector(".se-input-url"),altText:h.querySelector("._se_image_alt"),captionCheckEl:h.querySelector("._se_image_check_caption"),previewSrc:h.querySelector("._se_tab_content_image .se-link-preview"),tabs:h.querySelector(".se-modal-tabs"),galleryButton:h.querySelector(".__se__gallery"),proportion:h.querySelector("._se_check_proportion"),inputX:h.querySelector("._se_size_x"),inputY:h.querySelector("._se_size_y"),revertBtn:h.querySelector(".se-modal-btn-revert"),asBlock:h.querySelector('[data-command="asBlock"]'),asInline:h.querySelector('[data-command="asInline"]'),fileRemoveBtn:h.querySelector(".se-file-remove")}}(t,this.pluginOptions),n=this.pluginOptions.useFormatType?"as":"",o=e.controls||!this.pluginOptions.canResize?[[n,"mirror_h","mirror_v","align","caption","edit","revert","copy","remove"]]:[[n,"resize_auto,100,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["align","caption","edit","revert","copy","remove"]];this.alignForm=s.alignForm,o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.plugins.link?this.plugins.link.pluginOptions:{};this.anchor=new Io(this,s.html,{textToDisplay:!1,title:!0,openNewWindow:l.openNewWindow,relList:l.relList,defaultRel:l.defaultRel,noAutoPrefix:l.noAutoPrefix,enableFileUpload:e.linkEnableFileUpload}),this.modal=new Ro(this,s.html),this.figure=new Si(this,o,{sizeUnit:i}),this.fileManager=new Fs(this,{query:"img",loadHandler:this.events.onImageLoad,eventHandler:this.events.onImageAction}),this.fileModalWrapper=s.fileModalWrapper,this.imgInputFile=s.imgInputFile,this.imgUrlFile=s.imgUrlFile,this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=s.altText,this.captionCheckEl=s.captionCheckEl,this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=s.previewSrc,this.sizeUnit=i,this.as="block",this.proportion=null,this.inputX=null,this.inputY=null,this._linkElement=null,this._linkValue="",this._align="none",this._svgDefaultSize="30%",this._base64RenderIndex=0,this._element=null,this._cover=null,this._container=null,this._caption=null,this._ratio={w:1,h:1},this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this._resizing=this.pluginOptions.canResize,this._onlyPercentage=this.pluginOptions.percentageOnlySize,this._nonResizing=!this._resizing||!this.pluginOptions.showHeightInput||this._onlyPercentage,this.eventManager.addEvent(s.tabs,"click",this.#ot.bind(this)),this.imgInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#lt.bind(this)),this.imgUrlFile&&this.eventManager.addEvent(this.imgUrlFile,"input",this.#rt.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.eventManager.addEvent(this.imgInputFile,"change",this.#at.bind(this));const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#ht.bind(this)),this._resizing){this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#ct.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#dt.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#dt.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(s.revertBtn,"click",this.#ut.bind(this))}this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=s.asBlock,this.asInline=s.asInline,this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#pt.bind(this)))}open(){this.modal.open()}edit(){this.modal.open()}on(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(this._resizing&&(this.inputX.value=this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight),this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.setAttribute("multiple","multiple")),this.anchor.on(t)}onFilePasteAndDrop({file:t}){if(/^image/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1}async modalAction(){return this._align=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this._update(this.inputX?.value,this.inputY?.value),this.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this._linkValue.length>0)&&await this.submitURL(this._linkValue)}retainFormat(){return{query:"img",method:t=>{const e=Si.GetContainer(t);e&&e.container&&e.cover||(this._ready(t),this._fileCheck(this._origin_w,this._origin_h))}}}init(){Ro.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=""),this.imgInputFile&&this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.altText.value="",this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,this.captionCheckEl.checked=!1,this._element=null,this._ratio={w:1,h:1},this.#ot("init"),this._resizing&&(this.inputX.value="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.checked=!0),this.pluginOptions.useFormatType&&this._activeAsInline("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.anchor.init()}select(t){this._ready(t)}_ready(t){if(!t)return;const e=this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!1});this.anchor.set(gt.check.isAnchor(t.parentNode)?t.parentNode:null),this._linkElement=this.anchor.currentTarget,this._element=t,this._cover=e.cover,this._container=e.container,this._caption=e.caption,this._align=e.align,t.style.float="",this._origin_w=String(e.originWidth||e.w||""),this._origin_h=String(e.originHeight||e.h||""),this.altText.value=this._element.alt,this.imgUrlFile&&(this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=this._element.src);if((this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this._align+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this._caption,!this._resizing)return;const i=this._onlyPercentage&&this.figure.isVertical;let s=i?"":e.width;if(this._onlyPercentage&&(s=mt.get(s,2),s>100&&(s=100)),this.inputX.value=String("auto"===s?"":s),!this._onlyPercentage){const t=i?"":e.height;this.inputY.value=String("auto"===t?"":t)}this.proportion.checked=!0,this.inputX.disabled=!!i,this.inputY.disabled=!!i,this.proportion.disabled=!!i,this._ratio=this.proportion.checked?e.ratio:{w:1,h:1},this.pluginOptions.useFormatType&&this._activeAsInline(this.component.isInline(e.container))}async destroy(t){const e=t||this._element,i=gt.query.getParentElement(e,Si.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onImageDeleteBefore",{element:e,container:i,align:this._align,alt:this.altText.value,url:this._linkValue})&&(gt.utils.removeItem(i),this.init(),n!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}_getInfo(){return{element:this._element,anchor:this.anchor.create(!0),inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this._align,isUpdate:this.modal.isUpdate,alt:this.altText.value}}_activeAsInline(t){t?(gt.utils.addClass(this.asInline,"on"),gt.utils.removeClass(this.asBlock,"on"),this.as="inline",this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(gt.utils.addClass(this.asBlock,"on"),gt.utils.removeClass(this.asInline,"on"),this.as="block",this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/image/i.test(n.type)){if(o=n.size,s&&s>o){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onImageUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===$o?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+n/1e3+"KB",i=await this.triggerEvent("onImageUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===$o?t:i||t,"error"),!1}const l={files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l);this._serverUpload;const a=await this.triggerEvent("onImageUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==$o||r(null)))}async submitURL(t){if(t||(t=this._linkValue),!t)return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,...this._getInfo()},s=function(t,e){const i=(t=e||t).url;this.modal.isUpdate?this._updateSrc(i,t.element,t.files):this._produce(i,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt)}.bind(this,i),n=await this.triggerEvent("onImageUploadBefore",{info:i,handler:s});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==$o||s(null),!0)}_update(t,e){t||(t=this.inputX?.value||"auto"),e||(e=this.inputY?.value||"auto");let i=this._element;const s=this._cover,n=this._container===this._cover?null:this._container;let o;const l=mt.is(t)?t+this.sizeUnit:t,r=mt.is(e)?e+this.sizeUnit:e;o=/%$/.test(i.style.width)?l!==n.style.width||r!==n.style.height:l!==i.style.width||r!==i.style.height,i.alt=this.altText.value;let a=!1;this.captionCheckEl.checked?this._caption||(this._caption=Si.CreateCaption(s,this.lang.caption),a=!0):this._caption&&(gt.utils.removeItem(this._caption),this._caption=null,a=!0);let h=!1;const c=this.anchor.create(!0);if(c)this._linkElement===c&&n.contains(c)||(this._linkElement=c.cloneNode(!1),s.insertBefore(this._setAnchor(i,this._linkElement),this._caption),h=!0);else if(null!==this._linkElement&&s.contains(this._linkElement)){const t=i.cloneNode(!0);s.removeChild(this._linkElement),s.insertBefore(t,this._caption),i=t}this._resizing&&o&&this._applySize(t,e),h&>.utils.removeItem(c),(a||!this._onlyPercentage&&o)&&(/\d+/.test(i.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(i):this.figure.setTransform(i,t,e,0)),this.figure.setAlign(i,this._align),i.onload=()=>{this.select(i)}}_fileCheck(t,e){t||(t=this.inputX?.value||"auto"),e||(e=this.inputY?.value||"auto");let i,s=this._element,n=this._cover,o=null,l=this._container===this._cover?null:this._container,r=!1;if(!n||!l){r=!0,s=this._element.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this._element.parentElement?.nodeName)||this.format.isLine(this._element.parentElement))?Si.CreateInlineContainer(s,"se-image-container"):Si.CreateContainer(s,"se-image-container");n=e.cover,l=e.container,o=e.inlineCover,this.figure.open(s,{nonResizing:!0,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0})}const a=mt.is(t)?t+this.sizeUnit:t,h=mt.is(e)?e+this.sizeUnit:e;i=/%$/.test(s.style.width)?a!==l.style.width||h!==l.style.height:a!==s.style.width||h!==s.style.height,s.alt=this.altText.value;let c=!1;o||(this.captionCheckEl.checked?this._caption&&!r||(this._caption=Si.CreateCaption(n,this.lang.caption),c=!0):this._caption&&(gt.utils.removeItem(this._caption),this._caption=null,c=!0));let d=null;const u=this.anchor.create(!0);if(u)(this._linkElement!==u||r&&!l.contains(u))&&(this._linkElement=u.cloneNode(!1),n.insertBefore(this._setAnchor(s,this._linkElement),this._caption),d=this._element);else if(null!==this._linkElement&&n.contains(this._linkElement)){const t=s.cloneNode(!0);n.removeChild(this._linkElement),n.insertBefore(t,this._caption),s=t}r&&(s=this._element,this.figure.retainFigureFormat(l,this._element,d?u:null,this.fileManager),this._element=s=l.querySelector("img"),this._cover=n,this._container=l),this._resizing&&i&&this._applySize(t,e),d&&(r?(gt.utils.removeItem(d),0===gt.query.getListChildren(u,(t=>/IMG/i.test(t.tagName))).length&>.utils.removeItem(u)):gt.utils.removeItem(u)),(c||!this._onlyPercentage&&i)&&(/\d+/.test(s.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(s):this.figure.setTransform(s,t,e,0)),this.figure.setAlign(s,this._align)}#ot(t){const e=this.modal.form,i="string"==typeof t?e.querySelector("._se_tab_link"):gt.query.getEventTarget(t);if(!/^BUTTON$/i.test(i.tagName))return!1;const s=i.getAttribute("data-tab-link");let n;const o=e.getElementsByClassName("_se_tab_content");for(n=0;n<o.length;n++)o[n].style.display="none";const l=e.getElementsByClassName("_se_tab_link");for(n=0;n<l.length;n++)gt.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+s).style.display="block",gt.utils.addClass(i,"active"),"init"!==t&&("image"===s?this.focusElement.focus():"url"===s&&this.anchor.urlInput.focus()),!1}_produce(t,e,i,s,n,o,l){"inline"!==this.as?this.create(t,e,i,s,n,o,l):this.createInline(t,e,i,s,o,l)}_applySize(t,e){t||(t=this.inputX?.value||this.pluginOptions.defaultWidth),e||(e=this.inputY?.value||this.pluginOptions.defaultHeight),this._onlyPercentage&&(t?/%$/.test(t)&&(t+="%"):t="100%"),this.figure.setSize(t,e)}create(t,e,i,s,n,o,l){const r=gt.utils.createElement("IMG");r.src=t,r.alt=l,e=this._setAnchor(r,e?e.cloneNode(!1):null);const a=Si.CreateContainer(e,"se-image-container"),h=a.cover,c=a.container;this.captionCheckEl.checked&&(this._caption=Si.CreateCaption(h,this.lang.caption)),this._element=r,this._cover=h,this._container=c,this.figure.open(r,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),this._applySize(i,s),this.figure.setAlign(r,n),this.fileManager.setFileData(r,o),r.onload=this.#gt.bind(this,r,this._svgDefaultSize,c),this.component.insert(c,{skipCharCount:!1,skipSelection:!this.options.get("componentAutoSelect"),skipHistory:!1})}createInline(t,e,i,s,n,o){const l=gt.utils.createElement("IMG");l.src=t,l.alt=o,e=this._setAnchor(l,e?e.cloneNode(!1):null);const r=Si.CreateInlineContainer(e,"se-image-container").container;this._element=l,this._container=r,this.figure.open(l,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),this._applySize(i,s),this.fileManager.setFileData(l,n),l.onload=this.#gt.bind(this,l,this._svgDefaultSize,r),this.component.insert(r,{skipCharCount:!1,skipSelection:!0,skipHistory:!1})}_updateSrc(t,e,i){e.src=t,this.fileManager.setFileData(e,i),this.component.select(e,Fo.key)}_register(t,e){const i=e.result;for(let e,s=0,n=i.length;s<n;s++){if(e={name:i[s].name,size:i[s].size},t.isUpdate){this._updateSrc(i[s].url,t.element,e);break}this._produce(i[s].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt)}}_serverUpload(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0?this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#mt.bind(this,t),this._error.bind(this)):this._setBase64(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.alt,t.isUpdate)}_setBase64(t,e,i,s,n,o,l){try{const r=this.modal.isUpdate?1:t.length;if(0===r)return this.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=r;const a=new Array(r);this._resizing&&(this.inputX.value=i,this.inputY.value=s);for(let h,c,d=0;d<r;d++)h=new FileReader,c=t[d],h.onload=function(t,l,r,h,c){a[c]={result:t.result,file:h},0==--this._base64RenderIndex&&(this._onRenderBase64(l,a,r,e,i,s,n,o),this.ui.hideLoading())}.bind(this,h,l,this._element,c,d),this._onRenderBase64,h.readAsDataURL(c)}catch(t){throw this.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}_onRenderBase64(t,e,i,s,n,o,l,r){for(let a=0,h=e.length;a<h;a++)t?this._updateSrc(e[a].result,i,e[a].file):this._produce(e[a].result,s,n,o,l,e[a].file,r)}_setAnchor(t,e){return e?(e.appendChild(t),e):t}async _error(t){const e=await this.triggerEvent("onImageUploadError",{error:t}),i=e===$o?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.image.error]",i)}async#mt(t,e){if(await this.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===$o){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}#lt(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),Ro.OnChangeFile(this.fileModalWrapper,[])}#dt(t,e){if(ft.isSpace(e.code))e.preventDefault();else if("x"===t&&this._onlyPercentage&&e.target.value>100)e.target.value=100;else if(this.proportion.checked){const e=Si.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}#ct(){this._ratio=this.proportion.checked?Si.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}#ut(){this._onlyPercentage?this.inputX.value=Number(this._origin_w)>100?"100":this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}#pt({target:t}){this._activeAsInline("asInline"===t.getAttribute("data-command"))}#rt(t){const e=t.target.value.trim();this._linkValue=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#at({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),Ro.OnChangeFile(this.fileModalWrapper,t.files)}#ht(){this.plugins.imageGallery.open(this.#ft.bind(this))}#ft(t){this.altText.value=t.getAttribute("data-value")||t.alt,this._linkValue=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#gt(t,e,i){if(0===t.offsetWidth&&this._applySize(e,""),this.options.get("componentAutoSelect"))this.component.select(t,Fo.key);else if(this.component.isInline(i)){const e=this.selection.getNearRange(i);e?this.selection.setRange(e.container,e.offset,e.container,e.offset):this.component.select(t,Fo.key)}else{const t=this.format.addLine(i,null);t&&this.selection.setRange(t,0,t,0)}this.editor._iframeAutoHeight(this.editor.frameContext),this.history.push(!1),delete t.onload}}const Po=Fo,{NO_EVENT:Do}=dt;class qo extends ai{static key="video";static type="modal";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.checkContentType(t.src)?t:null}constructor(t,e){super(t),this.title=this.lang.video,this.icon="video",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&mt.get(e.defaultWidth,0)?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&mt.get(e.defaultHeight,0)?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:mt.get(e.defaultRatio,4)||.5625,showRatioOption:void 0===e.showRatioOption||!!e.showRatioOption,ratioOptions:e.ratioOptions?e.ratioOptions:null,videoTagAttributes:e.videoTagAttributes||null,iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||""};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e,plugins:i},s){let n=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.video_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">`;s.createFileInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_file}</label>\n\t\t\t\t${Ro.CreateFileInput({lang:t,icons:e},s)}\n\t\t\t</div>`);s.createUrlInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input class="se-input-form se-input-url" type="text" data-focus />\n\t\t\t\t\t${i.videoGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.videoGallery}">\n\t\t\t\t\t\t\t\t${e.video_gallery}\n\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.videoGallery)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t</div>\n\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t</div>`);if(s.canResize){const i=s.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285},{name:"9:16",value:1.78}],o=s.defaultRatio,l=s.percentageOnlySize,r=l?' style="display: none !important;"':"",a=s.showHeightInput?"":' style="display: none !important;"',h=s.showRatioOption?"":' style="display: none !important;"',c=l||s.showHeightInput||s.showRatioOption?"":' style="display: none !important;"';n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t\t<label class="size-h"${a}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${h}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="100%"${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${c}>${l?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="${100*s.defaultRatio}%"\n\t\t\t\t${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}${a}/>\n\t\t\t\t<select class="se-input-select se-modal-ratio" title="${t.ratio}" aria-label="${t.ratio}"${h}>\n\t\t\t\t\t${a?"":'<option value=""> - </option>'} \n\t\t\t\t\t${i.map((t=>`<option value="${t.value}"${o.toString()===t.value.toString()?" selected":""}>${t.name}</option>`)).join("")}\n\t\t\t\t</select>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${r}${c}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}n+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const o=gt.utils.createElement("DIV",{class:"se-modal-content"},n);return{html:o,alignForm:o.querySelector(".se-figure-align"),fileModalWrapper:o.querySelector(".se-flex-input-wrapper"),videoInputFile:o.querySelector(".__se__file_input"),videoUrlFile:o.querySelector(".se-input-url"),previewSrc:o.querySelector(".se-link-preview"),galleryButton:o.querySelector(".__se__gallery"),proportion:o.querySelector("._se_check_proportion"),frameRatioOption:o.querySelector(".se-modal-ratio"),inputX:o.querySelector("._se_size_x"),inputY:o.querySelector("._se_size_y"),revertBtn:o.querySelector(".se-modal-btn-revert"),fileRemoveBtn:o.querySelector(".se-file-remove")}}(t,this.pluginOptions),n=e.controls||!this.pluginOptions.canResize?[["align","edit","copy","remove"]]:[["resize_auto,75,50","align","edit","revert","copy","remove"]];n.some((t=>t.includes("align")))||(s.alignForm.style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";this.modal=new Ro(this,s.html),this.figure=new Si(this,n,{sizeUnit:i,autoRatio:{current:o,default:o}}),this.fileManager=new Fs(this,{query:"iframe, video",loadHandler:this.events.onVideoLoad,eventHandler:this.events.onVideoAction}),this.fileModalWrapper=s.fileModalWrapper,this.videoInputFile=s.videoInputFile,this.videoUrlFile=s.videoUrlFile,this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=s.previewSrc,this._linkValue="",this._align="none",this._frameRatio=o,this._defaultRatio=o,this._defaultSizeX="100%",this._defaultSizeY=100*this.pluginOptions.defaultRatio+"%",this.sizeUnit=i,this.proportion=null,this.frameRatioOption=null,this.inputX=null,this.inputY=null,this._element=null,this._cover=null,this._container=null,this._ratio={w:1,h:1},this._origin_w="100%"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this._origin_h=this.pluginOptions.defaultHeight===o?"":this.pluginOptions.defaultHeight,this._resizing=this.pluginOptions.canResize,this._onlyPercentage=this.pluginOptions.percentageOnlySize,this._nonResizing=!this._resizing||!this.pluginOptions.showHeightInput||this._onlyPercentage,this.query={youtube:{pattern:/youtu\.?be/i,action:t=>(t=this.convertUrlYoutube(t),pt.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),pt.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery};const l=[];for(const t in this.query)l.push(this.query[t].pattern);this.extensions=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"].concat(this.pluginOptions.extensions||[]),this.urlPatterns=l.concat([/youtu\.?be/,/vimeo\.com\//,/dailymotion\.com\/video\//,/facebook\.com\/.+\/videos\//,/facebook\.com\/watch\/\?v=/,/twitter\.com\/.+\/status\//,/twitch\.tv\/videos\//,/twitch\.tv\/[^/]+$/,/tiktok\.com\/@[^/]+\/video\//,/instagram\.com\/p\//,/instagram\.com\/tv\//,/instagram\.com\/reel\//,/linkedin\.com\/posts\//,/\.(wistia\.com|wi\.st)\/(medias|embed)\//,/loom\.com\/share\//]).concat(e.urlPatterns||[]);const r=s.galleryButton;if(r&&this.eventManager.addEvent(r,"click",this.#ht.bind(this)),this.videoInputFile&&this.eventManager.addEvent(s.fileRemoveBtn,"click",this.#lt.bind(this)),this.videoUrlFile&&this.eventManager.addEvent(this.videoUrlFile,"input",this.#rt.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.eventManager.addEvent(this.videoInputFile,"change",this.#at.bind(this)),this._resizing){this.proportion=s.proportion,this.frameRatioOption=s.frameRatioOption,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight;const t=this.#ct.bind(this);this.eventManager.addEvent(this.inputX,"keyup",this.#dt.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#dt.bind(this,"y")),this.eventManager.addEvent(this.inputX,"change",t),this.eventManager.addEvent(this.inputY,"change",t),this.eventManager.addEvent(this.proportion,"change",t),this.eventManager.addEvent(this.frameRatioOption,"change",this.#_t.bind(this)),this.eventManager.addEvent(s.revertBtn,"click",this.#ut.bind(this))}}open(){this.modal.open()}edit(){this.modal.open()}on(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):(this._resizing&&(this.inputX.value=this._origin_w=this.pluginOptions.defaultWidth===this._defaultSizeX?"":this.pluginOptions.defaultWidth,this.inputY.value=this._origin_h=this.pluginOptions.defaultHeight===this._defaultSizeY?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0),this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.setAttribute("multiple","multiple")),this._resizing&&this._setRatioSelect(this._origin_h||this._defaultRatio)}onFilePasteAndDrop({file:t}){if(/^video/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1}async modalAction(){this._align=this.modal.form.querySelector('input[name="suneditor_video_radio"]:checked').value;let t=!1;return this.videoInputFile&&this.videoInputFile.files.length>0?t=await this.submitFile(this.videoInputFile.files):this.videoUrlFile&&this._linkValue.length>0&&(t=await this.submitURL(this._linkValue)),t&&this._w.setTimeout(this.component.select.bind(this.component,this._element,qo.key),0),t}retainFormat(){return{query:"iframe, video",method:async t=>{if(/^(iframe)$/i.test(t?.nodeName)&&!this.checkContentType(t.src))return;const e=Si.GetContainer(t);if(e&&e.container&&e.cover)return;this._ready(t);const i=this.format.getLine(t);i&&(this._align=i.style.textAlign||i.style.float),this._update(t)}}}init(){Ro.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=""),this.videoInputFile&&this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,this._ratio={w:1,h:1},this._nonResizing=!1,this._resizing&&(this.inputX.value=this.pluginOptions.defaultWidth===this._defaultSizeX?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this._defaultSizeY?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0,this._setRatioSelect(this._defaultRatio))}select(t){this._ready(t)}_ready(t){if(!t)return;const e=this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!1});this._element=t,this._cover=e.cover,this._container=e.container,this._align=e.align,t.style.float="",this._origin_w=String(e.width||e.originWidth||e.w||""),this._origin_h=String(e.height||e.originHeight||e.h||"");let i=e.width||e.w||this._origin_w||"";const s=e.height||e.h||this._origin_h||"";this.videoUrlFile&&(this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=this._element.src||this._element.querySelector("source")?.src||"");if((this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this._align+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,!this._resizing)return;const n=this._onlyPercentage&&this.figure.isVertical;if(this._onlyPercentage&&(i=mt.get(i,2),i>100&&(i=100)),this.inputX.value=String("auto"===i?"":i),!this._onlyPercentage){const t=n?"":e.height;this.inputY.value=String("auto"===t?"":t)}this._setRatioSelect(s)||(this.inputY.value=String(this._onlyPercentage?mt.get(s,2):s)),this.proportion.checked=!0,this.inputX.disabled=!!n,this.inputY.disabled=!!n,this.proportion.disabled=!!n,this._ratio=this.proportion.checked?e.ratio:{w:1,h:1}}async destroy(t){const e=t||this._element,i=gt.query.getParentElement(e,Si.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onVideoDeleteBefore",{element:e,container:i,align:this._align,url:this._linkValue})&&(gt.utils.removeItem(i),this.init(),n!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!(!this.extensions.some((e=>t.endsWith(e)))&&!this.urlPatterns.some((e=>e.test(t))))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.tag}}return null}convertUrlYoutube(t){return/^http/.test(t)||(t="https://"+t),t=t.replace("watch?v=",""),/^\/\/.+\/embed\//.test(t)||(t=t.replace(t.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t}convertUrlVimeo(t){return t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1)}addQuery(t,e){if(e.length>0)if(/\?/.test(t)){const i=t.split("?");t=i[0]+"?"+e+"&"+i[1]}else t+="?"+e;return t}create(t,e,i,s,n,o,l){let r=null,a=null;if(o){if((t=this._element).src!==e){const i=this.findProcessUrl(e);if(/^iframe$/i.test(i?.tag)&&!/^iframe$/i.test(t.nodeName)){const i=this.createIframeTag();i.src=e,t.replaceWith(i),this._element=t=i}else if(/^video$/i.test(i?.tag)&&!/^video$/i.test(t.nodeName)){const i=this.createVideoTag();i.src=e,t.replaceWith(i),this._element=t=i}else t.src=e}a=this._container,r=gt.query.getParentElement(t,"FIGURE")}else{t.src=e,this._element=t;const i=Si.CreateContainer(t,"se-video-container");r=i.cover,a=i.container}this._element=t,this._cover=r,this._container=a,this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),i=i||this._defaultSizeX,s=s||this._frameRatio;const h=this.figure.getSize(t),c=h.w!==i||h.h!==s,d=!o||c;if(d&&this._applySize(i,s),this.figure.setAlign(t,n),this.fileManager.setFileData(t,l),o)this._resizing&&d&&this.figure.isVertical&&this.figure.setTransform(t,i,s,0),this.history.push(!1);else if(this.component.insert(a,{skipCharCount:!1,skipSelection:!0,skipHistory:!1}),!this.options.get("componentAutoSelect")){const t=this.format.addLine(a,null);t&&this.selection.setRange(t,0,t,0)}}createIframeTag(t){const e=gt.utils.createElement("IFRAME");if(t)for(const i in t)e[i]=t[i];return this._setIframeAttrs(e),e}createVideoTag(t){const e=gt.utils.createElement("VIDEO");if(t)for(const i in t)e[i]=t[i];return this._setTagAttrs(e),e}_applySize(t,e){t||(t=this.inputX?.value||this.pluginOptions.defaultWidth),e||(e=this.inputY?.value||this.pluginOptions.defaultHeight),this._onlyPercentage&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}_getInfo(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this._align,isUpdate:this.modal.isUpdate,element:this._element}}async submitFile(t){if(0===t.length)return;let e=0;const i=[],s=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/video/i.test(n.type)){if(o=n.size,s&&s>o){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Do?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+n/1e3+"KB",i=await this.triggerEvent("onVideoUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.ui.alertOpen(i===Do?t:i||t,"error"),!1}const l={url:null,files:i,...this._getInfo()},r=function(t,e){t=e||t,this._serverUpload(t,t.files)}.bind(this,l);this._serverUpload;const a=await this.triggerEvent("onVideoUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Do||r(null)))}async submitURL(t){if(t||(t=this._linkValue),!t)return!1;if(/^<iframe.*\/iframe>$/.test(t)){if(0===(t=(new DOMParser).parseFromString(t,"text/html").querySelector("iframe").src).length)return!1}const e=this.findProcessUrl(t);e&&(t=e.url);const i={name:t.split("/").pop(),size:0},s={url:t,files:i,...this._getInfo(),process:e},n=function(t,e){t=e||t,this.create(this[/^iframe$/i.test(t.process?.tag)?"createIframeTag":"createVideoTag"](),t.url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,t.files)}.bind(this,s),o=await this.triggerEvent("onVideoUploadBefore",{info:s,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==Do||n(null),!0)}_update(t){if(!t)return;/^video$/i.test(t.nodeName)?this._setTagAttrs(t):/^iframe$/i.test(t.nodeName)&&this._setIframeAttrs(t);let e=this.format.isBlock(t.parentNode)||gt.check.isWysiwygFrame(t.parentNode)?t:this.format.getLine(t)||t;const i=t,s=t.cloneNode(!0),n=Si.CreateContainer(s,"se-video-container").container,o=e.querySelector("figcaption");let l=null;o&&(l=gt.utils.createElement("DIV"),l.innerHTML=o.innerHTML,gt.utils.removeItem(o)),this.figure.open(s,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0});const r=(s.getAttribute("data-se-size")||",").split(",");this._applySize(r[0]||i.style.width||i.width||"",r[1]||i.style.height||i.height||"");const a=this.format.getLine(i);if(a&&(this._align=a.style.textAlign||a.style.float),this.figure.setAlign(s,this._align),gt.query.getParentElement(i,gt.check.isExcludeFormat))i.replaceWith(n);else if(gt.check.isListCell(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e.insertBefore(n,t),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(t,null,!0)}else if(this.format.isLine(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e=this.nodeTransform.split(e,t),e.parentNode.insertBefore(n,e),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(e,null,!0)}else e.replaceWith(n);return l&&e.parentNode.insertBefore(l,n.nextElementSibling),s}_register(t,e){const i=e.result,s=this.createVideoTag();for(let e=0,n=i.length;e<n;e++){const n=t.isUpdate?t.element:s.cloneNode(!1);this.create(n,i[e].url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,{name:i[e].name,size:i[e].size})}}_serverUpload(t,e){if(!e)return;const i=this.pluginOptions.uploadUrl;"string"==typeof i&&i.length>0&&this.fileManager.upload(i,this.pluginOptions.uploadHeaders,e,this.#mt.bind(this,t),this._error.bind(this))}_setTagAttrs(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}_setIframeAttrs(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}_setRatioSelect(t){let e=!1;const i=this.frameRatioOption.options;/%$/.test(t+"")||this._onlyPercentage?t=mt.get(t,2)/100+"":(!mt.is(t)||Number(t)>=1)&&(t=""),this.inputY.placeholder="";for(let s=0,n=i.length;s<n;s++)i[s].value===t?(e=i[s].selected=!0,this.inputY.placeholder=t?100*Number(t)+"%":""):i[s].selected=!1;return e}async _error(t){const e=await this.triggerEvent("onVideoUploadError",{error:t}),i=e===Do?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#mt(t,e){if(await this.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===Do){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}#lt(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),Ro.OnChangeFile(this.fileModalWrapper,[])}#rt(t){const e=gt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this._linkValue=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this._linkValue=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ht(){this.plugins.videoGallery.open(this.#ft.bind(this))}#ft(t){this._linkValue=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#at(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=gt.query.getEventTarget(t);Ro.OnChangeFile(this.fileModalWrapper,e.files)}#ut(){this._onlyPercentage?this.inputX.value=Number(this._origin_w)>100?"100":this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}#_t(t){const e=gt.query.getEventTarget(t),i=e.options[e.selectedIndex].value;this._defaultSizeY=this.figure.autoRatio.current=this._frameRatio=i?100*Number(i)+"%":this._defaultSizeY,this.inputY.placeholder=i?100*Number(i)+"%":"",this.inputY.value=""}#ct(){this._ratio=this.proportion.checked?Si.GetRatio(this.inputX.value,this.inputY.value,this.sizeUnit):{w:1,h:1}}#dt(t,e){if(ft.isSpace(e.code))return void e.preventDefault();const i=gt.query.getEventTarget(e);if("x"===t&&this._onlyPercentage&&Number(i.value)>100)i.value="100";else if(this.proportion.checked){const e=Si.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}"y"===t&&this._setRatioSelect(i.value||this._defaultRatio)}}const Wo=qo,{NO_EVENT:Uo,ON_OVER_COMPONENT:Go}=dt;class Zo extends ai{static key="audio";static type="modal";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}constructor(t,e){super(t),this.title=this.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"audio/*":e.acceptedFormats.trim()||"audio/*",audioTagAttributes:e.audioTagAttributes||null};const i=function({lang:t,icons:e,plugins:i},s){let n=`\n <form method="post" enctype="multipart/form-data">\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.audio_modal_title}</span>\n </div>\n <div class="se-modal-body">`;s.createFileInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${Ro.CreateFileInput({lang:t,icons:e},s)}\n </div>`);s.createUrlInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${i.audioGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.audioGallery}">\n\t\t\t\t\t\t\t${e.audio_gallery}\n\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.audioGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n <pre class="se-link-preview"></pre>\n </div>`);return n+=`\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n <span>${t.submitButton}</span>\n </button>\n </div>\n </form>`,gt.utils.createElement("DIV",{class:"se-modal-content"},n)}(t,this.pluginOptions),s=function({lang:t,icons:e}){const i=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return gt.utils.createElement("DIV",{class:"se-controller"},i)}(t);this.modal=new Ro(this,i),this.controller=new mi(this,s,{position:"bottom",disabled:!0}),this.fileManager=new Fs(this,{query:"audio",loadHandler:this.events.onAudioLoad,eventHandler:this.events.onAudioAction}),this.figure=new Si(this,null,{}),this.fileModalWrapper=i.querySelector(".se-flex-input-wrapper"),this.audioInputFile=i.querySelector(".__se__file_input"),this.audioUrlFile=i.querySelector(".se-input-url"),this.preview=i.querySelector(".se-link-preview"),this._element=null,this.defaultWidth=this.pluginOptions.defaultWidth,this.defaultHeight=this.pluginOptions.defaultHeight,this.urlValue="";const n=i.querySelector(".__se__gallery");n&&this.eventManager.addEvent(n,"click",this.#ht.bind(this)),this.audioInputFile&&(this.eventManager.addEvent(i.querySelector(".se-modal-files-edge-button"),"click",this.#lt.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.eventManager.addEvent(this.audioInputFile,"change",this.#bt.bind(this))),this.audioUrlFile&&this.eventManager.addEvent(this.audioUrlFile,"input",this.#rt.bind(this))}open(){this.modal.open()}on(t){t?this._element?(this.urlValue=this.preview.textContent=this.audioUrlFile.value=this._element.src,this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple")):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple"):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.setAttribute("multiple","multiple")}onFilePasteAndDrop({file:t}){if(/^audio/.test(t.type))return this.submitFile([t]),this.editor.focus(),!1}async modalAction(){return this.audioInputFile&&this.audioInputFile?.files.length>0?await this.submitFile(this.audioInputFile.files):!!(this.audioUrlFile&&this.urlValue.length>0)&&await this.submitURL(this.urlValue)}init(){Ro.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=""),this.audioInputFile&&this.audioUrlFile&&(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration="")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.audioUrlFile&&(this.urlValue=this.preview.textContent=this.audioUrlFile.value=this._element.src),this.open();break;case"copy":{const t=Si.GetContainer(this._element);this.component.copy(t.container);break}case"delete":this.destroy()}}retainFormat(){return{query:"audio",method:t=>{const e=Si.GetContainer(t);if(e&&e.container&&e.cover)return;this._setTagAttrs(t);const i=Si.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(i.container,t,null,this.fileManager)}}}select(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,__fileManagerInfo:!1}),this._ready(t)}_ready(t){oe.get("__overInfo")!==Go&&(this._element=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}async destroy(t){const e=t||this._element,i=Si.GetContainer(e),s=i.container||e,n=s.previousElementSibling||s.nextElementSibling;if(!1===await this.triggerEvent("onAudioDeleteBefore",{element:e,container:i,url:e.getAttribute("src")}))return;const o=s.parentNode;gt.utils.removeItem(s),this.init(),this.controller.close(),o!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(o,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(n),this.history.push(!1)}_register(t,e){const i=e.result;for(let e,s,n=0,o=i.length;n<o;n++)s=t.isUpdate?t.element:this._createAudioTag(),e={name:i[n].name,size:i[n].size},this._createComp(s,i[n].url,e,t.isUpdate)}async submitFile(t){if(0===t.length)return!1;let e=0;const i=[],s=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/audio/i.test(n.type)){if(o=n.size,s&&s>o){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable single file: "+s/1e3+"KB",e=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:s,uploadSize:o,file:n});return this.ui.alertOpen(e===Uo?t:e||t,"error"),!1}i.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit;if(n>0&&e+this.fileManager.getSize()>n){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+n/1e3+"KB",i=await this.triggerEvent("onAudioUploadError",{error:t,limitSize:n,currentSize:this.fileManager.getSize(),uploadSize:e});return this.ui.alertOpen(i===Uo?t:i||t,"error"),!1}const o={files:i,isUpdate:this.modal.isUpdate,element:this._element},l=function(t,e){e=t||e,this._serverUpload(e,e.files)}.bind(this,o),r=await this.triggerEvent("onAudioUploadBefore",{info:o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==Uo||l(null),!0)}async submitURL(t){if(0===t.length)return!1;const e={name:t.split("/").pop(),size:0},i={url:t,files:e,isUpdate:this.modal.isUpdate,element:this._createAudioTag()},s=function(t,e){e=t||e,this._createComp(e.element,e.url,e.files,e.isUpdate)}.bind(this,i),n=await this.triggerEvent("onAudioUploadBefore",{info:i,handler:s});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&s(n),!0!==n&&n!==Uo||s(null),!0)}_createComp(t,e,i,s){if(s){if(this._element&&(t=this._element),this.fileManager.setFileData(t,i),!t||t.src===e)return void this.component.select(t,Zo.key);t.src=e,this.component.select(t,Zo.key)}else{this.fileManager.setFileData(t,i),t.src=e;const s=Si.CreateContainer(t,"se-flex-component");if(!this.component.insert(s.container,{skipCharCount:!1,skipSelection:!this.options.get("componentAutoSelect"),skipHistory:!1}))return void this.editor.focus();if(!this.options.get("componentAutoSelect")){const t=this.format.addLine(s.container,null);t&&this.selection.setRange(t,0,t,0)}}s&&this.history.push(!1)}_createAudioTag(){const t=this.defaultWidth,e=this.defaultHeight,i=gt.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this._setTagAttrs(i),i}_setTagAttrs(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}_serverUpload(t,e){if(!e)return;const i=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,i,this.#mt.bind(this,t),this._error.bind(this))}async _error(t){const e=await this.triggerEvent("onAudioUploadError",{error:t}),i=e===Uo?t.errorMessage:e||t.errorMessage;this.ui.alertOpen(i,"error"),console.error("[SUNEDITOR.plugin.audio.error]",i)}async#mt(t,e){if(await this.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===Uo){const i=JSON.parse(e.responseText);i.errorMessage?this._error(i):this._register(t,i)}}#rt(t){const e=gt.query.getEventTarget(t).value.trim();this.urlValue=this.preview.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ht(){this.plugins.audioGallery.open(this.#ft.bind(this))}#ft(t){this.urlValue=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#lt(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),Ro.OnChangeFile(this.fileModalWrapper,[])}#bt(t){const e=gt.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),Ro.OnChangeFile(this.fileModalWrapper,e.files)}}const Yo=Zo,{NO_EVENT:Xo}=dt;class jo extends ai{static key="embed";static type="modal";static className="";static component(t){let e="";return gt.check.isIFrame(t)&&(e=t.src),/^DIV$/i.test(t?.nodeName)&>.check.isIFrame(t.firstElementChild)&&(e=t.firstElementChild.src),e&&this.checkContentType(e)?t:null}constructor(t,e){super(t),this.title=this.lang.embed,this.icon="embed",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&mt.get(e.defaultWidth,0)?mt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&mt.get(e.defaultHeight,0)?mt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:mt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:mt.get(e.uploadSingleSizeLimit,0),iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||""};const i=this.pluginOptions.percentageOnlySize?"%":"px",s=function({lang:t,icons:e},i){let s=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.embed_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">\n\t\t\t<div class='se-modal-form'>\n\t\t\t\t<label>${t.embed_modal_source}</label>\n\t\t\t\t<input class='se-input-form se-input-url' type='text' data-focus />\n\t\t\t\t<pre class='se-link-preview'></pre>\n\t\t\t</div>`;if(i.canResize){const n=i.percentageOnlySize,o=n?' style="display: none !important;"':"",l=i.showHeightInput?"":' style="display: none !important;"',r=i.showRatioOption?"":' style="display: none !important;"',a=n||i.showHeightInput||i.showRatioOption?"":' style="display: none !important;"';s+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t\t<label class="size-h"${l}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${r}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="auto"${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${a}>${n?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="auto"\n\t\t\t\t${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}${l}/>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${o}${a}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}s+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const n=gt.utils.createElement("DIV",{class:"se-modal-content"},s);return{html:n,figureAlignBtn:n.querySelector(".se-figure-align"),fileModalWrapper:n.querySelector(".se-flex-input-wrapper"),embedInput:n.querySelector(".se-input-url"),previewSrc:n.querySelector(".se-link-preview"),proportion:n.querySelector("._se_check_proportion"),inputX:n.querySelector("._se_size_x"),inputY:n.querySelector("._se_size_y"),revertBtn:n.querySelector(".se-modal-btn-revert")}}(t,this.pluginOptions),n=e.controls||!this.pluginOptions.canResize?[["align","edit","copy","remove"]]:[["resize_auto,75,50","align","edit","revert","copy","remove"]];n.some((t=>t.includes("align")))||(s.figureAlignBtn.style.display="none"),this.modal=new Ro(this,s.html),this.figure=new Si(this,n,{sizeUnit:i}),this.fileModalWrapper=s.fileModalWrapper,this.embedInput=s.embedInput,this.focusElement=this.embedInput,this.previewSrc=s.previewSrc,this._linkValue="",this._align="none",this._defaultSizeX=this.pluginOptions.defaultWidth,this._defaultSizeY=this.pluginOptions.defaultHeight,this.sizeUnit=i,this.proportion=null,this.inputX=null,this.inputY=null,this._element=null,this._cover=null,this._container=null,this._ratio={w:1,h:1},this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this._resizing=this.pluginOptions.canResize,this._onlyPercentage=this.pluginOptions.percentageOnlySize,this._nonResizing=!this._resizing||!this.pluginOptions.showHeightInput||this._onlyPercentage,this.query={facebook:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:facebook\.com)\/(.+)/i,action:t=>`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(t)}&show_text=true&width=500`,tag:"iframe"},twitter:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:twitter\.com)\/(status|embed)\/(.+)/i,action:t=>`https://platform.twitter.com/embed/Tweet.html?url=${encodeURIComponent(t)}`,tag:"iframe"},instagram:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:instagram\.com)\/p\/(.+)/i,action:t=>`https://www.instagram.com/p/${t.match(this.query.instagram.pattern)[1]}/embed`,tag:"iframe"},linkedin:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:linkedin\.com)\/(.+)\/(.+)/i,action:t=>`https://www.linkedin.com/embed/feed/update/${encodeURIComponent(t.split("/").pop())}`,tag:"iframe"},pinterest:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:pinterest\.com)\/pin\/(.+)/i,action:t=>`https://assets.pinterest.com/ext/embed.html?id=${t.match(this.query.pinterest.pattern)[1]}`,tag:"iframe"},spotify:{pattern:/(?:https?:\/\/)?(?:open\.)?(?:spotify\.com)\/(track|album|playlist|show|episode)\/(.+)/i,action:t=>{const e=t.match(this.query.spotify.pattern);return`https://open.spotify.com/embed/${e[1]}/${e[2]}`},tag:"iframe"},codepen:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:codepen\.io)\/(.+)\/pen\/(.+)/i,action:t=>{const[,e,i]=t.match(this.query.codepen.pattern);return`https://codepen.io/${e}/embed/${i}`},tag:"iframe"},...e.embedQuery};const o=[];for(const t in this.query)o.push(this.query[t].pattern);this.urlPatterns=o.concat(e.urlPatterns||[]),this.eventManager.addEvent(this.embedInput,"input",this.#rt.bind(this)),this._resizing&&(this.proportion=s.proportion,this.inputX=s.inputX,this.inputY=s.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight,this.eventManager.addEvent(this.inputX,"keyup",this.#dt.bind(this,"x")),this.eventManager.addEvent(this.inputY,"keyup",this.#dt.bind(this,"y")),this.eventManager.addEvent(s.revertBtn,"click",this.#ut.bind(this)))}open(){this.modal.open()}edit(){this.modal.open()}on(t){!t&&this._resizing&&(this.inputX.value=this._origin_w="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this._origin_h="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0)}async modalAction(){this._align=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this._linkValue.length>0&&(t=await this.submitSRC(this._linkValue)),t&&this._w.setTimeout(this.component.select.bind(this.component,this._element,jo.key),0),t}retainFormat(){return{query:"iframe",method:async t=>{if(!this.checkContentType(t.src))return;const e=Si.GetContainer(t);if(e&&e.container&&e.cover)return;this._ready(t);const i=this.format.getLine(t);i&&(this._align=i.style.textAlign||i.style.float),this._update(t)}}}init(){Ro.OnChangeFile(this.fileModalWrapper,[]),this._linkValue=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this._ratio={w:1,h:1},this._nonResizing=!1,this._resizing&&(this.inputX.value=this.pluginOptions.defaultWidth===this._defaultSizeX?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this._defaultSizeY?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}select(t){this._ready(t)}_ready(t){if(!t)return;const e=this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!1});this._element=t,this._cover=e.cover,this._container=e.container,this._caption=e.caption,this._align=e.align,t.style.float="",this._origin_w=String(e.originWidth||e.w||""),this._origin_h=String(e.originHeight||e.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this._align+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this._resizing)return;const i=this._onlyPercentage&&this.figure.isVertical;let s=i?"":e.width;if(this._onlyPercentage&&(s=mt.get(s,2),s>100&&(s=100)),this.inputX.value=String("auto"===s?"":s),!this._onlyPercentage){const t=i?"":e.height;this.inputY.value=String("auto"===t?"":t)}this.proportion.checked=!0,this.inputX.disabled=!!i,this.inputY.disabled=!!i,this.proportion.disabled=!!i,this._ratio=this.proportion.checked?e.ratio:{w:1,h:1}}async destroy(t){const e=t||this._element,i=gt.query.getParentElement(e,Si.is)||e,s=i.previousElementSibling||i.nextElementSibling,n=i.parentNode;!1!==await this.triggerEvent("onEmbedDeleteBefore",{element:e,container:i,align:this._align,url:this._linkValue})&&(gt.utils.removeItem(i),this.init(),n!==this.editor.frameContext.get("wysiwyg")&&this.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.editor.focusEdge(s),this.history.push(!1))}checkContentType(t){return t=t?.toLowerCase()||"",!!this.urlPatterns.some((e=>e.test(t)))}findProcessUrl(t){const e=this.query;for(const i in e){const s=e[i];if(s.pattern.test(t))return{origin:t,url:s.action(t),tag:s.tag}}return null}async submitSRC(t){if(t||(t=this._linkValue),!t)return!1;let e=null;if(/^<iframe\s|^<blockquote\s/i.test(t)){const i=(new DOMParser).parseFromString(t,"text/html").body.children;if(0===i.length)return!1;e={children:i,...this._getInfo(),process:null}}else{const i=this.findProcessUrl(t);if(!i)return!1;e={url:t=i.url,...this._getInfo(),process:i}}const i=function(t,e){t=e||t,this._create(t.process,t.url,t.children,t.inputWidth,t.inputHeight,t.align,t.isUpdate)}.bind(this,e);this._create;const s=await this.triggerEvent("onEmbedInputBefore",{...e,handler:i});return void 0===s||!1!==s&&(null!==s&&"object"==typeof s&&i(s),!0!==s&&s!==Xo||i(null),!0)}_createIframeTag(){const t=gt.utils.createElement("IFRAME");return this._setIframeAttrs(t),t}_createEmbedTag(){return gt.utils.createElement("BLOCKQUOTE")}_create(t,e,i,s,n,o,l){let r=null,a=null,h=null,c=null;if(l){if(r=this._element,r.src!==e){const t=this.findProcessUrl(e);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(r.nodeName)){const t=this._createIframeTag();t.src=e,r.replaceWith(t),r=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(r.nodeName)){const t=this._createEmbedTag();t.setAttribute("src",e),r.replaceWith(t),r=t}else r.src=e}h=this._container,a=gt.query.getParentElement(r,"FIGURE")}else if(t){r=this._createIframeTag(),r.src=e;const t=Si.CreateContainer(r,"se-embed-container");a=t.cover,h=t.container}else{r=i[0];const t=Si.CreateContainer(r,"se-embed-container");a=t.cover,h=t.container;let e=null,s=0;for(;e=i[s];)/^script$/i.test(e.nodeName)?(c=gt.utils.createElement("script",{src:e.getAttribute("src"),async:"true"},null),s++):a.appendChild(e)}this._element=r,this._cover=a,this._container=h,this.figure.open(r,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0}),s=s||this._defaultSizeX,n=n||this._defaultSizeY;const d=this.figure.getSize(r),u=d.w!==s||d.h!==n,p=!l||u;if(p&&this._applySize(s,n),this.figure.setAlign(r,o),l)this._resizing&&p&&this.figure.isVertical&&this.figure.setTransform(r,s,n,0),c||this.history.push(!1);else{if(this.component.insert(h,{skipCharCount:!1,skipSelection:!0,skipHistory:!0}),c)try{this.history.pause(),c.onload=()=>{gt.utils.removeItem(c),c=null},a.appendChild(c);const t=new MutationObserver((e=>{for(const i of e)if("childList"===i.type&&!r.parentElement){this.history.resume(),this.history.push(!1),t.disconnect();break}}));t.observe(this.editor.frameContext.get("wysiwyg"),{subtree:!0,childList:!0})}catch(t){this.history.resume(),console.warn("[SUNEDITOR] Embed tag script load error.",t)}if(!this.options.get("componentAutoSelect")){const t=this.format.addLine(h,null);t&&this.selection.setRange(t,0,t,0)}}}_update(t){if(!t)return;this._setIframeAttrs(t);let e=this.format.isBlock(t.parentNode)||gt.check.isWysiwygFrame(t.parentNode)?t:this.format.getLine(t)||t;const i=t;t=t.cloneNode(!0);const s=Si.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this._nonResizing,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,__fileManagerInfo:!0});const n=(t.getAttribute("data-se-size")||",").split(",");this._applySize(n[0]||i.style.width||i.width||"",n[1]||i.style.height||i.height||"");const o=this.format.getLine(i);if(o&&(this._align=o.style.textAlign||o.style.float),this.figure.setAlign(t,this._align),gt.query.getParentElement(i,gt.check.isExcludeFormat))i.replaceWith(s);else if(gt.check.isListCell(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e.insertBefore(s,t),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(t,null,!0)}else if(this.format.isLine(e)){const t=gt.query.getParentElement(i,(t=>t.parentNode===e));e=this.nodeTransform.split(e,t),e.parentNode.insertBefore(s,e),gt.utils.removeItem(i),this.nodeTransform.removeEmptyNode(e,null,!0)}else e.replaceWith(s);return t}_applySize(t,e){t||(t=this.inputX?.value||this.pluginOptions.defaultWidth),e||(e=this.inputY?.value||this.pluginOptions.defaultHeight),this._onlyPercentage&&(t?/%$/.test(t+"")&&(t+="%"):t="100%"),this.figure.setSize(t,e)}_getInfo(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this._align,isUpdate:this.modal.isUpdate,element:this._element}}_setIframeAttrs(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const i in e)t.setAttribute(i,e[i])}#rt(t){const e=gt.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this._linkValue=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this._linkValue=this.previewSrc.textContent=e?this.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ut(){this._onlyPercentage?this.inputX.value=Number(this._origin_w)>100?"100":this._origin_w:(this.inputX.value=this._origin_w,this.inputY.value=this._origin_h)}#dt(t,e){if(ft.isSpace(e.code))return void e.preventDefault();const i=gt.query.getEventTarget(e);if("x"===t&&this._onlyPercentage&&Number(i.value)>100)i.value="100";else if(this.proportion.checked){const e=Si.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this._ratio);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const Ko=jo,{_w:Jo}=dt;class Qo extends ai{static key="math";static type="modal";static className="";static component(t){return gt.utils.hasClass(t,"se-math|katex")&>.utils.hasClass(t,"se-component")?t:null}constructor(t,e){super(t),this.title=this.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#yt(t.options.get("externalLibs").katex))||(this.mathjax=this.#vt(t.options.get("externalLibs").mathjax,t))||console.warn('[SUNEDITOR.plugins.math.warn] The math plugin must need either "KaTeX" or "MathJax" library. Please add the katex or mathjax option.'),this.pluginOptions={formSize:{width:"460px",height:"14em",maxWidth:"",maxHeight:"",minWidth:"400px",minHeight:"40px",...e.formSize},canResize:e.canResize??!0,autoHeight:!!e.autoHeight,fontSizeList:e.fontSizeList||[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],onPaste:"function"==typeof e.onPaste?e.onPaste:null},this.pluginOptions.autoHeight&&(this.pluginOptions.formSize.height=this.pluginOptions.formSize.minHeight),this.defaultFontSize=null;const i=function(t){const{lang:e,icons:i,pluginOptions:s,katex:n}=t,{formSize:o,fontSizeList:l,canResize:r,autoHeight:a}=s,{width:h,height:c,maxWidth:d,maxHeight:u,minWidth:p,minHeight:g}=o,m=r?a?"horizontal":"auto":"none";let f=l[0].value,_=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${e.close}" aria-label="${e.close}">\n ${i.cancel}\n </button>\n <span class="se-modal-title">${e.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${e.math_modal_inputLabel} ${n?`(<a href="${dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${dt.MATHJAX_WEBSITE}" target="_blank">MathJax</a>)`}</label>\n <textarea class="se-input-form se-math-exp se-modal-resize-form" type="text" data-focus style="width: ${h}; height: ${c}; min-width: ${p}; min-height: ${g}; resize: ${m};"></textarea>\n </div>\n <div class="se-modal-form">\n <label>${e.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,i=l.length;e<i;e++)t=l[e],t.default&&(f=t.value),_+=`<option value="${t.value}"${t.default?" selected":""}>${t.text}</option>`;return _+=`</select>\n </div>\n <div class="se-modal-form">\n <label>${e.math_modal_previewLabel}</label>\n <p class="se-math-preview"></p>\n </div>\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${e.submitButton}" aria-label="${e.submitButton}">\n <span>${e.submitButton}</span>\n </button>\n </div>\n </form>`,t.defaultFontSize=f,gt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${d}; max-height: ${u};`},_)}(this),s=function({lang:t,icons:e}){const i=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(t);this.modal=new Ro(this,i),this.controller=new mi(this,s,{position:"bottom",disabled:!0}),this.textArea=i.querySelector(".se-math-exp"),this.previewElement=i.querySelector(".se-math-preview"),this.fontSizeElement=i.querySelector(".se-math-size"),this.isUpdateState=!1,this._element=null,this.previewElement.style.fontSize=this.defaultFontSize,this.eventManager.addEvent(this.textArea,"input",this.#Ct.bind(this)),this.eventManager.addEvent(this.fontSizeElement,"change",function(t){this.fontSize=t.target.value}.bind(this.previewElement.style)),this.pluginOptions.onPaste&&this.eventManager.addEvent(this.textArea,"paste",this.pluginOptions.onPaste.bind(this))}select(t){if(gt.utils.hasClass(t,"se-math|katex")&&tl(t))return this._element=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this._element=null}retainFormat(){return{query:".se-math, .katex, .MathJax",method:t=>{if(!this.katex&&!this.mathjax)return;const e=tl(t);if(!e)return;const i=this._d.createRange().createContextualFragment(this._renderer(pt.entityToHTML(this._escapeBackslashes(e,!0))));t.innerHTML=i.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),gt.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?gt.utils.addClass(t,"katex"):gt.utils.removeClass(t,"katex"),this.mathjax&&this.#wt(this.mathjax)}}}open(){this.modal.open()}on(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=pt.entityToHTML(this._escapeBackslashes(tl(t),!0)),i=function(t){const e=t.getAttribute("data-se-type");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-font-size"),t.setAttribute("data-se-type",i),i):null}(t)||"1em";this.textArea.value=e,this.fontSizeElement.value=i,this.previewElement.innerHTML=this._renderer(e),this.previewElement.style.fontSize=i}}else this.init()}modalAction(){if(0===this.textArea.value.trim().length||gt.utils.hasClass(this.textArea,"se-error"))return this.textArea.focus(),!1;const t=this.textArea.value,e=this.previewElement.querySelector(".se-math, .katex");if(!e)return!1;if(gt.utils.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable","false"),e.setAttribute("data-se-value",pt.htmlToEntity(this._escapeBackslashes(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(gt.utils.addClass(e,"katex"),gt.utils.removeClass(e,"MathJax")):gt.utils.removeClass(e,"katex"),this.isUpdateState){gt.query.getParentElement(this.controller.currentTarget,".se-component").replaceWith(e);const t=this.component.get(e);return this.component.select(t.target,t.pluginName),!0}{const t=this.format.getLines();if(t.length>1){const i=gt.utils.createElement(t[0].nodeName,null,e);this.component.insert(i,{skipCharCount:!1,skipSelection:!0,skipHistory:!1})}else this.component.insert(e,{skipCharCount:!1,skipSelection:!0,skipHistory:!1})}this.mathjax&&this.#wt(this.mathjax);const i=this.selection.getNearRange(e);return i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,Qo.key),!0}init(){this.textArea.value="",this.previewElement.innerHTML="",gt.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#xt(this._element);break;case"delete":this.destroy(this.controller.currentTarget)}}destroy(t){gt.utils.removeItem(t),this.controller.close(),this.editor.focus(),this.history.push(!1)}_renderer(t){let e="";try{gt.utils.removeClass(this.textArea,"se-error"),this.katex?e=this.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0}):this.mathjax&&(e=this.mathjax.convert(t).outerHTML,/<mjx-merror/.test(e)?(gt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`)}catch(t){gt.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${dt.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${dt.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}_escapeBackslashes(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#xt(t){if(navigator.clipboard&&t)try{const e=tl(t);await this.html.copy(e),gt.utils.addClass(t,"se-copy"),Jo.setTimeout((()=>{gt.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#Ct(t){const e=gt.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this._renderer(e.value),this.mathjax&&this.#wt(this.mathjax)}#wt(t){t.clear(),t.updateDocument()}#yt(t){if(!t)return null;if(!t.src)return console.warn("[SUNEDITOR.math.katex.fail] The katex option is set incorrectly."),null;const e=[{throwOnError:!1},t.options||{}].reduce(((t,e)=>{for(const i in e)t[i]=e[i];return t}),{});return t.options=e,t}#vt(t,e){if(!t)return null;e.frameOptions.get("iframe")&&console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is not supported in the iframe.");try{const e=t.browserAdaptor();t.RegisterHTMLHandler(e);const i=new t.TeX,s=new t.CHTML;return t.src.document(document,{InputJax:i,OutputJax:s})}catch(t){return console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is set incorrectly.",t),null}}}function tl(t){const e=t.getAttribute("data-se-value");if(e)return e;const i=t.getAttribute("data-exp");return i?(t.removeAttribute("data-exp"),t.setAttribute("data-se-value",i),i):null}const el=Qo,{_w:il,isMobile:sl}=dt;const nl=class extends ai{static key="drawing";static type="modal";static className="";constructor(t,e){super(t),this.title=this.lang.drawing,this.icon="drawing",this.pluginOptions={outputFormat:e.outputFormat||"dataurl",useFormatType:e.useFormatType??!1,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1,lineWidth:e.lineWidth||5,lineReconnect:!!e.lineReconnect,lineCap:["butt","round","square"].includes(e.lineCap)?e.lineCap:"round",lineColor:e.lineColor||"",formSize:{width:"750px",height:"50vh",maxWidth:"",maxHeight:"",minWidth:"150px",minHeight:"100px",...e.formSize},canResize:e.canResize??!0,maintainRatio:e.maintainRatio??!0},this.plugins.image?"svg"!==this.pluginOptions.outputFormat||this.plugins.image.pluginOptions.uploadUrl||console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need the "image" plugin with the "uploadUrl" option. Please add the "image" plugin with the "uploadUrl" option.'):console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need either "image" plugin. Please add the "image" plugin.');const i=function({lang:t,icons:e,pluginOptions:i}){const{width:s,height:n,maxWidth:o,maxHeight:l,minWidth:r,minHeight:a}=i.formSize,h=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.drawing_modal_title}</span>\n </div>\n <div class="se-modal-body" style="width: ${s}; height: ${n}; min-width: ${r}; min-height: ${a};">\n <canvas class="se-drawing-canvas" style="width: 100%; height: 100%;"></canvas>\n\t\t\t${i.canResize?'<div class="se-modal-resize-handle-w"></div><div class="se-modal-resize-handle-h"></div><div class="se-modal-resize-handle-c"></div>':""}\n\t\t</div>\n\t\t<div class="se-modal-body-bottom">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t\t${i.useFormatType?`\n\t\t\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asBlock" aria-label="${t.blockStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_block}\n\t\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asInline" aria-label="${t.inlineStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>`:""}\n\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="remove" aria-label="${t.remove}">\n\t\t\t\t\t\t\t${e.eraser}\n\t\t\t\t\t\t\t${gt.utils.createTooltipInner(t.remove)}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n <div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n </div>\n </form>`;return gt.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},h)}(this);this.modal=new Ro(this,i),this.as=this.pluginOptions.defaultFormatType,this.pluginOptions.useFormatType&&(this.asBlock=i.querySelector('[data-command="asBlock"]'),this.asInline=i.querySelector('[data-command="asInline"]'),this.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#pt.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.__events={mousedown:sl?this.#kt.bind(this):this.#St.bind(this),mousemove:sl?this.#Et.bind(this):this.#Tt.bind(this),mouseup:this.#Ht.bind(this),mouseleave:this.#Mt.bind(this),mouseenter:this.#Lt.bind(this)},this.__eventsRegister={mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.__eventNameMap={mousedown:sl?"touchstart":"mousedown",mousemove:sl?"touchmove":"mousemove",mouseup:sl?"touchend":"mouseup",mouseleave:"mouseleave",mouseenter:"mouseenter"},this.eventManager.addEvent(i.querySelector('[data-command="remove"]'),"click",this.#Nt.bind(this))}open(){this.pluginOptions.useFormatType&&this._activeAsInline("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this._initDrawing()}off(){this._destroyDrawing()}modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this._getSVGFileList();this.plugins.image.init(),this.plugins.image.submitFile(t)}else{const t=this.canvas.toDataURL(),e={name:"drawing",size:0};this.plugins.image.init(),"inline"!==this.as?this.plugins.image.create(t,null,"auto","","none",e,""):this.plugins.image.createInline(t,null,"auto","","none",e,"")}return!0}_initDrawing(){const t=this.canvas=this.modal.form.querySelector(".se-drawing-canvas");this.ctx=t.getContext("2d"),t.width=t.offsetWidth,t.height=t.offsetHeight,this.points=[],this.paths=[],this._setCtx(),this.__eventsRegister.mousedown=this.eventManager.addEvent(t,this.__eventNameMap.mousedown,this.__events.mousedown,{passive:!1,capture:!0}),this.__eventsRegister.mousemove=this.eventManager.addEvent(t,this.__eventNameMap.mousemove,this.__events.mousemove,!0),this.__eventsRegister.mouseup=this.eventManager.addEvent(t,this.__eventNameMap.mouseup,this.__events.mouseup,!0),this.__eventsRegister.mouseleave=this.eventManager.addEvent(t,this.__eventNameMap.mouseleave,this.__events.mouseleave),this.__eventsRegister.mouseenter=this.eventManager.addEvent(t,this.__eventNameMap.mouseenter,this.__events.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),dt.isResizeObserverSupported&&(this.resizeObserver=new ResizeObserver((()=>{const e=t.width,i=t.height,s=t.offsetWidth,n=t.offsetHeight;t.width=s,t.height=n,e===t.width&&i===t.height||(this.pluginOptions.maintainRatio&&this._adjustPathsToNewDimensions(e,i,s,n),this._drawAll())})),this.resizeObserver.observe(t))}_destroyDrawing(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.eventManager.removeEvent(this.__eventsRegister.mousedown),this.eventManager.removeEvent(this.__eventsRegister.mousemove),this.eventManager.removeEvent(this.__eventsRegister.mouseup),this.eventManager.removeEvent(this.__eventsRegister.mouseleave),this.eventManager.removeEvent(this.__eventsRegister.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}_setCtx(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||il.getComputedStyle(this.carrierWrapper).color}_draw(){this._setCtx(),this.ctx.beginPath(),this.points.forEach((([t,e],i)=>{0===i?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}_drawAll(){this._setCtx(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this._draw()})),this.points=[]}_adjustPathsToNewDimensions(t,e,i,s){const n=i/t,o=s/e;this.paths=this.paths.map((t=>t.map((([t,e])=>[t*n,e*o]))))}_clearCanvas(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}_getSVG(){const t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");return e.setAttribute("width",this.canvas.width+""),e.setAttribute("height",this.canvas.height+""),e.setAttribute("viewBox",`0 0 ${this.canvas.width} ${this.canvas.height}`),e.setAttribute("xmlns",t),this.paths.forEach((i=>{const s=i.reduce(((t,[e,i],s)=>t+(0===s?`M ${e} ${i}`:` L ${e} ${i}`)),""),n=document.createElementNS(t,"path");n.setAttribute("d",s),n.setAttribute("fill","none"),n.setAttribute("stroke",String(this.ctx.strokeStyle)),n.setAttribute("stroke-width",this.ctx.lineWidth+""),e.appendChild(n)})),e}_getSVGFileList(){const t=this._getSVG(),e=(new XMLSerializer).serializeToString(t),i=new Blob([e],{type:"image/svg+xml"}),s=new File([i],"drawing.svg",{type:"image/svg+xml"}),n=new DataTransfer;return n.items.add(s),n.files}_getCanvasTouchPointer(t){const{touches:e}=t,i=this.canvas.getBoundingClientRect();return{x:e[0].clientX-i.left,y:e[0].clientY-i.top}}_activeAsInline(t){t?(gt.utils.addClass(this.asInline,"on"),gt.utils.removeClass(this.asBlock,"on"),this.as="inline"):(gt.utils.addClass(this.asBlock,"on"),gt.utils.removeClass(this.asInline,"on"),this.as="block")}#St(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this._draw()}#Tt(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this._draw())}#kt(t){t.preventDefault();const{x:e,y:i}=this._getCanvasTouchPointer(t);this.isDrawing=!0,this.points.push([e,i]),this._draw()}#Et(t){t.preventDefault();const{x:e,y:i}=this._getCanvasTouchPointer(t);this.isDrawing&&(this.points.push([e,i]),this._draw())}#Ht(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#Mt(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#Lt(t){if(1===t.buttons){if(this.isDrawing=!0,this.pluginOptions.lineReconnect){const e=this.paths[this.paths.length-1],i=e[e.length-1];this.points.push([i[0],i[1]]),this.points.push([t.offsetX,t.offsetY])}else this.points.push([t.offsetX,t.offsetY]);this._draw()}}#Nt(){this._clearCanvas()}#pt(t){this._activeAsInline("asInline"===gt.query.getEventTarget(t).getAttribute("data-command"))}};function ol(t){const e=t.src.split("/").pop(),i=t.thumbnail||"",s=i||t.src,n=this.props?.map((e=>`data-${e}="${t[e]}"`)).join(" ")||"",o=`data-type="${t.type}" data-command="${t.src}" data-name="${t.name||e}" data-thumbnail="${i}" data-extension="${t.src.split(".").pop()}" ${n}`,l=`class="${i||"se-browser-empty-image"}" src="${s}" alt="${t.alt||e}" ${o}`;return`\n\t\t<div class="se-file-item-img">\n\t\t\t${this.thumbnail&&!i&&"image"!==t.type?`<div class="se-browser-empty-thumbnail" ${l}>${this.thumbnail(t)}</div>`:`<img class="${i||"se-browser-empty-image"}" ${l}>`}\n\t\t\t<div class="se-file-name-image se-file-name-back"></div>\n\t\t\t<div class="se-file-name-image">${t.name||e}</div>\n\t\t</div>`}const ll=class extends ne{constructor(t,e){super(t.editor),this.useSearch=e.useSearch??!0;const i=gt.utils.createElement("DIV",{class:"se-browser sun-editor-common"+(e.className?` ${e.className}`:"")}),s=function(t,e){const i=t.lang,s=t.icons,n=`\n\t\t<div class="se-browser-content">\n\t\t\t<div class="se-browser-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-browser-close" class="close" title="${i.close}" aria-label="${i.close}">\n\t\t\t\t\t${s.cancel}\n\t\t\t\t</button>\n\t\t\t\t<span class="se-browser-title"></span>\n\t\t\t</div>\n\t\t\t<div class="se-browser-wrapper">\n\t\t\t\t<div class="se-browser-side"></div>\n\t\t\t\t<div class="se-browser-main"> \n\t\t\t\t\t<div class="se-browser-bar">\n\t\t\t\t\t\t<div class="se-browser-search">\n\t\t\t\t\t\t\t<button class="se-btn se-side-open-btn">${s.side_menu_hamburger}</button>\n\t\t\t\t\t\t\t${e?`\n\t\t\t\t\t\t\t\t\t\t<form class="se-browser-search-form">\n\t\t\t\t\t\t\t\t\t\t\t<input type="text" class="se-input-form" placeholder="${i.search}" aria-label="${i.search}">\n\t\t\t\t\t\t\t\t\t\t\t<button type="submit" class="se-btn" title="${i.search}" aria-label="${i.search}">${s.search}</button>\n\t\t\t\t\t\t\t\t\t\t</form>`:""}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="se-browser-body">\n\t\t\t\t\t\t<div class="se-browser-tags"></div>\n\t\t\t\t\t\t<div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div>\n\t\t\t\t\t\t<div class="se-browser-menus"></div>\n\t\t\t\t\t\t<div class="se-browser-list"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>`,o=gt.utils.createElement("DIV",{class:"se-browser-inner"},n);return{html:o,header:o.querySelector(".se-browser-header"),titleArea:o.querySelector(".se-browser-title"),tagArea:o.querySelector(".se-browser-tags"),body:o.querySelector(".se-browser-body"),list:o.querySelector(".se-browser-list"),side:o.querySelector(".se-browser-side"),wrapper:o.querySelector(".se-browser-wrapper"),_loading:o.querySelector(".se-loading-box")}}(t.editor,this.useSearch),n=s.html;this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.area=i,this.header=s.header,this.titleArea=s.titleArea,this.tagArea=s.tagArea,this.body=s.body,this.list=s.list,this.side=s.side,this.wrapper=s.wrapper,this._loading=s._loading,this.title=e.title,this.listClass=e.listClass||"se-preview-list",this.directData=e.data,this.url=e.url,this.urlHeader=e.headers,this.searchUrl=e.searchUrl,this.searchUrlHeader=e.searchUrlHeader,this.drawItemHandler=(e.drawItemHandler||ol).bind({thumbnail:e.thumbnail,props:e.props||[]}),this.selectorHandler=e.selectorHandler,this.columnSize=e.columnSize||4,this.folderDefaultPath="",this.closeArrow=this.icons.menu_arrow_right,this.openArrow=this.icons.menu_arrow_down,this.icon_folder=this.icons.side_menu_folder_item,this.icon_folder_item=this.icons.side_menu_folder,this.icon_item=this.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this._closeSignal=!1,this._bindClose=null,this.__globalEventHandler=t=>{ft.isEsc(t.code)&&this.close()},this.apiManager=new Vs(this,{method:"GET"}),i.appendChild(gt.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(n),this.carrierWrapper.appendChild(i),this.eventManager.addEvent(this.tagArea,"click",this.#At.bind(this)),this.eventManager.addEvent(this.list,"click",this.#Bt.bind(this)),this.eventManager.addEvent(this.side,"click",this.#It.bind(this)),this.eventManager.addEvent(n,"mousedown",this.#Vt.bind(this)),this.eventManager.addEvent(n,"click",this.#Ot.bind(this)),this.eventManager.addEvent(i.querySelector("form.se-browser-search-form"),"submit",this.#Rt.bind(this)),this.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#zt.bind(this)),this.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#$t.bind(this))}open(t){t||(t={}),this.__addGlobalEvent();const e=t.listClass||this.listClass;gt.utils.hasClass(this.list,e)||(this.list.className="se-browser-list "+e),this.titleArea.textContent=t.title||this.title,this.area.style.display="block",this.editor.opendBrowser=this,this.closeArrow=this.options.get("_rtl")?this.icons.menu_arrow_left:this.icons.menu_arrow_right,this.directData?this.__drowItems(this.directData):this._drawFileList(t.url||this.url,t.urlHeader||this.urlHeader,!1)}close(){this.__removeGlobalEvent(),this.apiManager.cancel(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.folders={},this.tree={},this.data={},this.keyword="",this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="",this.editor.opendBrowser=null,this.sideInner=null,"function"==typeof this.inst.init&&this.inst.init()}search(t){this.searchUrl?(this.keyword=t,this._drawFileList(this.searchUrl+"?keyword="+t,this.searchUrlHeader,!1)):(this.keyword=t.toLowerCase(),this._drawListItem(this.items,!1))}tagfilter(t){const e=this.selectedTags;return 0===e.length?t:t.filter((t=>!Array.isArray(t.tag)||t.tag.some((t=>e.includes(t)))))}showBrowserLoading(){this._loading.style.display="block"}closeBrowserLoading(){this._loading.style.display="none"}_drawFileList(t,e,i){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Ft.bind(this),errorCallBack:this.#Pt.bind(this)}),i||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}_drawListItem(t,e){const i=this.keyword,s=[],n=(t=this.tagfilter(t).filter((t=>t.name.toLowerCase().indexOf(i)>-1))).length,o=this.columnSize,l=o<=1?1:Math.round(n/o)||1,r=this.drawItemHandler;let a="",h='<div class="se-file-item-column">',c=1;for(let i,d,u=0;u<n;u++)if(i=t[u],d=i.tag?"string"==typeof i.tag?i.tag.split(","):i.tag:[],d=i.tag=d.map((t=>t.trim())),h+=r(i),(u+1)%l==0&&c<o&&u+1<n&&(c++,h+='</div><div class="se-file-item-column">'),e&&d.length>0)for(let t,e=0,i=d.length;e<i;e++)t=d[e],t&&!s.includes(t)&&(s.push(t),a+=`<a title="${t}" aria-label="${t}">${t}</a>`);h+="</div>",this.list.innerHTML=h,e&&(this.items=t,this.tagArea.innerHTML=a)}__addGlobalEvent(){this.__removeGlobalEvent(),this._bindClose=this.eventManager.addGlobalEvent("keydown",this.__globalEventHandler,!0)}__removeGlobalEvent(){this._bindClose&&(this._bindClose=this.eventManager.removeGlobalEvent(this._bindClose))}__drowItems(t){if(Array.isArray(t))return t.length>0&&this._drawListItem(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.__parseFolderData(t),this.side.innerHTML="";const e=this.sideInner=gt.utils.createElement("div",null);if(this.__createFolderList(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(gt.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}__parseFolderData(t,e){let i=this.tree;if(t._data){this.data[e]=t._data,this.folderDefaultPath&&!t.default||(this.folderDefaultPath=e);const s=e.split("/"),n=s.length-1;s.forEach(((t,s)=>{i[t]||(i[t]={children:{}}),s===n?(i[t].key=e,i[t].name=this.folders[e].name):i=i[t].children}))}else e&&(i[e]={name:this.folders[e].name,children:{}});Object.entries(t).forEach((([t,i])=>{if("_data"===t||!i||"object"!=typeof i)return;const s=i,n=e?`${e}/${t}`:t;this.folders[n]={name:s.name||t,meta:s.meta||{}},this.__parseFolderData(s,n)}))}__createFolderList(t,e){for(const i in t){const s=t[i];if(s)if(Object.keys(s.children).length>0){const t=gt.utils.createElement("div",s.key?{"data-command":s.key,"aria-label":s.name}:null,`<span class="se-menu-icon">${s.key?this.icon_folder:this.icon_folder_item}</span><span>${s.name}</span>`),i=gt.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(gt.utils.createElement("button",null,this.closeArrow),t.firstElementChild);const n=document.createElement("div");gt.utils.addClass(n,"se-menu-child|se-menu-hidden"),this.__createFolderList(s.children,n),i.appendChild(n),e.appendChild(i)}else{const t=gt.utils.createElement("div",{"data-command":s.key,"aria-label":s.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${s.name}</span>`);if(e===this.sideInner){const i=gt.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(i)}else e.appendChild(t)}}}#Ft(t){try{const e=JSON.parse(t.responseText),i=e.result;if(this.__drowItems(i))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading(),this.body.style.maxHeight=gt.utils.getClientSize().h-this.header.offsetHeight-50+"px"}}#Pt(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#At(t){const e=gt.query.getEventTarget(t);if(!gt.check.isAnchor(e))return;const i=e.textContent,s=this.tagArea.querySelector('a[title="'+i+'"]'),n=this.selectedTags.indexOf(i);n>-1?(this.selectedTags.splice(n,1),gt.utils.removeClass(s,"on")):(this.selectedTags.push(i),gt.utils.addClass(s,"on")),this._drawListItem(this.items,!1)}#Bt(t){const e=gt.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const i=gt.query.getCommandTarget(e);i&&(this.close(),this.selectorHandler(i))}#It(t){const e=gt.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(gt.utils.hasClass(t,"se-menu-hidden")?(gt.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(gt.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const i=gt.query.getCommandTarget(e);if(!i||gt.utils.hasClass(i,"active"))return;const s=this.data[i.getAttribute("data-command")];gt.utils.removeClass(this.side.querySelectorAll(".active"),"active"),gt.utils.addClass([i,gt.query.getParentElement(i,".se-menu-folder")],"active"),this.tagArea.innerHTML="","string"==typeof s?this._drawFileList(s,this.urlHeader,!0):this._drawListItem(s,!1)}#Vt(t){const e=gt.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this._closeSignal=!0:this._closeSignal=!1}#Ot(t){const e=gt.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this._closeSignal)&&this.close()}#Rt(t){const e=t.currentTarget;t.preventDefault(),this.search(e.querySelector('input[type="text"]').value)}#zt(t){const e=gt.query.getEventTarget(t);gt.utils.hasClass(e,"active")?(gt.utils.removeClass(this.side,"se-side-show"),gt.utils.removeClass(e,"active")):(gt.utils.addClass(this.side,"se-side-show"),gt.utils.addClass(e,"active"))}#$t({target:t}){t!==this.sideOpenBtn&>.utils.hasClass(this.sideOpenBtn,"active")&&(gt.utils.removeClass(this.side,"se-side-show"),gt.utils.removeClass(this.sideOpenBtn,"active"))}};const rl=class extends ai{static key="imageGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.imageGallery,this.icon="image_gallery",this.onSelectfunction=null,this.browser=new ll(this,{title:this.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-image-gallery"}),this.width="auto"===this.plugins.image.pluginOptions.defaultWidth?"":this.plugins.image.pluginOptions.defaultWidth,this.height="auto"===this.plugins.image.pluginOptions.defaultHeight?"":this.plugins.image.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.plugins.image.init(),this.plugins.image.create(t.getAttribute("data-command"),null,this.width,this.height,"none",e,t.alt)}}};const al=class extends ai{static key="videoGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.videoGallery,this.icon="video_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.video_thumbnail;this.browser=new ll(this,{title:this.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-video-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i,props:["frame"]}),this.width="auto"===this.plugins.video.pluginOptions.defaultWidth?"":this.plugins.video.pluginOptions.defaultWidth,this.height="auto"===this.plugins.video.pluginOptions.defaultHeight?"":this.plugins.video.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{let e=t.getAttribute("data-command");const i=this.plugins.video.findProcessUrl(e);i&&(e=i.url);const s={name:t.getAttribute("data-name"),size:0};this.plugins.video.init(),this.plugins.video.create(this.plugins.video["iframe"===t.getAttribute("data-frame")?"createIframeTag":"createVideoTag"]({poster:t.getAttribute("data-thumbnail")}),e,null,this.width,this.height,!1,s)}}};const hl=class extends ai{static key="audioGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.audioGallery,this.icon="audio_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.audio_thumbnail;this.browser=new ll(this,{title:this.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-audio-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){this.onSelectfunction?this.onSelectfunction(t):(this.plugins.audio.init(),this.plugins.audio.submitURL(t.getAttribute("data-command")))}};const cl=class extends ai{static key="fileGallery";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.fileGallery,this.icon="file_gallery",this.onSelectfunction=null;const i="string"==typeof e.thumbnail?e.thumbnail:this.icons.file_thumbnail;this.browser=new ll(this,{title:this.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-file-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>i})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.plugins.fileUpload.create(t.getAttribute("data-command"),e,!0)}}};const dl=class extends ai{static key="fileBrowser";static type="browser";static className="";constructor(t,e){super(t),this.title=this.lang.fileBrowser,this.icon="file_browser",this.onSelectfunction=null;const i={video:this.icons.video_thumbnail,audio:this.icons.audio_thumbnail,file:this.icons.file_thumbnail},s=this.icons.file_thumbnail;this.browser=new ll(this,{title:this.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Dt.bind(this),columnSize:4,className:"se-file-browser",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:t=>i[t.type]||s,props:[...new Set((e.props??[]).concat(["frame"]))]})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Dt(t){if(this.onSelectfunction)this.onSelectfunction(t);else{switch(t.getAttribute("data-type")){case"image":this.plugins.imageGallery.browser.selectorHandler(t);break;case"video":this.plugins.videoGallery.browser.selectorHandler(t);break;case"audio":this.plugins.audioGallery.browser.selectorHandler(t);break;case"file":this.plugins.fileGallery.browser.selectorHandler(t)}}}},ul={text:{default:"13px",list:[{title:"XX-Small",size:"8px"},{title:"X-Small",size:"10px"},{title:"Small",size:"13px"},{title:"Medium",size:"16px"},{title:"Large",size:"18px"},{title:"X-Large",size:"24px"},{title:"XX-Large",size:"32px"}]},px:{default:13,inc:1,min:8,max:72,list:[8,10,13,15,18,20,22,26,28,36,48,72]},pt:{default:10,inc:1,min:6,max:72,list:[6,8,10,12,14,18,22,26,32]},em:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},rem:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},vw:{inc:.1,min:.5,max:10,list:[2,3.5,4,4.5,6,8]},vh:{default:1.5,inc:.1,min:.5,max:10,list:[1,1.5,2,2.5,3,3.5,4]},"%":{default:100,inc:1,min:50,max:200,list:[50,70,90,100,120,140,160,180,200]}};class pl extends ai{static key="fontSize";static type="input";static className="se-btn-select se-btn-input se-btn-tool-font-size";constructor(t,e){super(t),this.unitMap={...ul,...e.unitMap||{}},this.sizeUnit=/text/.test(e.sizeUnit)?"":e.sizeUnit||this.options.get("fontSizeUnits")[0];const i=function({lang:t},e,i,s){const n=e.list,o=e.default,l=s?t.default:"";let r='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,s,a,h,c=0,d=n.length;c<d;c++)t=n[c],"object"==typeof t?(e=t.title,s=t.size):e=s=t+i,a=o===s?" default_value":"",h=a&&l||e,r+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${a}" data-command="${s}" data-value="${e}" title="${h}" aria-label="${h}" style="font-size:${s};">${h}</button>\n\t\t\t</li>`;return r+="\n\t\t</ul>\n\t</div>",gt.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-size"},r)}(t,this.unitMap[this.sizeUnit||"text"],this.sizeUnit,e.showDefaultSizeLabel),s=!!this.sizeUnit&&(e.showIncDecControls??!1),n=!this.sizeUnit||(e.disableInput??!1);this.title=this.lang.fontSize,this.inner=!(n&&!s)&&(n?`<span class="se-txt se-not-arrow-text __se__font_size">${this.lang.fontSize}</span>`:`<input type="text" class="__se__font_size se-not-arrow-text" placeholder="${this.lang.fontSize}" />`),s?(this.beforeItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":pl.key,"data-type":"command","data-value":"dec"},`${this.icons.minus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.decrease}</span></span>`),this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":pl.key,"data-type":"command","data-value":"inc"},`${this.icons.plus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.increase}</span></span>`)):n?n&&!s&&(this.replaceButton=gt.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":pl.key,"data-type":"dropdown"},`<span class="se-txt __se__font_size">${this.lang.fontSize}</span>${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.fontSize}</span></span>`),this.menu.initDropdownTarget({key:pl.key,type:"dropdown"},i)):(this.afterItem=gt.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":pl.key,"data-type":"dropdown"},`${this.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.lang.fontSize}</span></span>`),this.menu.initDropdownTarget({key:pl.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this._disableInput=n,this.menu.initDropdownTarget(pl,i)}active(t,e){if(!gt.utils.hasClass(e,"__se__font_size"))return!1;let i="";if(t){if(this.format.isLine(t))return;if(i=gt.utils.getStyle(t,"fontSize"))return this._setSize(e,i),!0}else this._setSize(e,this._getDefaultSize());return!1}onInputKeyDown({target:t,event:e}){const i=e.code;if(this._disableInput||ft.isSpace(i))return void e.preventDefault();if(!/^(38|40|13)$/.test(i))return;const{value:s,unit:n}=this._getSize(t);if(!s)return;const o=mt.get(s),l=this.unitMap[n];let r=o;switch(i){case"ArrowUp":r+=l.inc,r>l.max&&(r=o);break;case"ArrowDown":r-=l.inc,r<l.min&&(r=o)}e.preventDefault();try{this.isInputActive=!0;const e=this._setSize(t,r+n);if(this._disableInput)return;const s=gt.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(s,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),ft.isEnter(i)||t.focus()}finally{this.isInputActive=!1}}onInputChange({target:t,value:e,event:i}){if(!this._disableInput)try{this.isInputActive=!0;let{value:i,unit:s}=this._getSize(e);const{max:n,min:o}=this.unitMap[s];i=i>n?n:i<o?o:i;const l=gt.utils.createElement("SPAN",{style:"font-size: "+this._setSize(t,i+s)+";"});this.format.applyInlineElement(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}finally{this.isInputActive=!1,i.preventDefault(),this.editor.focus()}}on(t){const{value:e,unit:i}=this._getSize(t),s=e+i;if(s===this.currentSize)return;const n=this.sizeList;for(let t=0,e=n.length;t<e;t++)s===n[t].getAttribute("data-value")?gt.utils.addClass(n[t],"active"):gt.utils.removeClass(n[t],"active");this.currentSize=s}action(t){const e=t.getAttribute("data-command");if(e===pl.key){const{value:e,unit:i}=this._getSize(t);let s=mt.get(e)+("inc"===t.getAttribute("data-value")?1:-1);const{min:n,max:o}=this.unitMap[i];s=s<n?n:s>o?o:s;const l=gt.utils.createElement("SPAN",{style:"font-size: "+s+i+";"});this.format.applyInlineElement(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=gt.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.format.applyInlineElement(t,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else this.format.applyInlineElement(null,{stylesToModify:["font-size"],nodesToRemove:["span"],strictRemove:!0});this.menu.dropdownOff()}_getDefaultSize(){return this.editor.frameContext.get("wwComputedStyle").fontSize}_getSize(t){if(!(t="string"==typeof t?t:t.parentElement.querySelector(".__se__font_size")))return{unit:this.sizeUnit,value:this.sizeUnit?0:""};const e="string"==typeof t?t:gt.check.isInputElement(t)?t.value:t.textContent,i=this.sizeUnit?e.split(/(\d+)/):[e,""];let s=(i.pop()||"").trim().toLowerCase();s=this.options.get("fontSizeUnits").includes(s)?s:this.sizeUnit;const n=i.pop();return{unit:s,value:s?Number(n):n}}_setSize(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?gt.check.isInputElement(t)?t.value=String(e):t.textContent=String(this.sizeUnit?e:this.unitMap.text.list.find((t=>t.size===e))?.title||e):0}}const gl=pl;const ml=class extends ai{static key="pageNavigator";static type="input";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.lang.pageNumber,this.inner=gt.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=gt.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.eventManager.addEvent(this.inner,"change",this.#qt.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#qt(t){if(!this.editor.frameContext.has("documentType-use-page"))return;const e=gt.query.getEventTarget(t),i=Number(e.value)||1;this.editor.frameContext.get("documentType").pageGo(i)}},{_w:fl}=dt;class _l extends ai{static key="anchor";static type="popup";static className="";static component(t){return gt.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}constructor(t){super(t),this.title=this.lang.anchor,this.icon="bookmark_anchor";const e=(new DOMParser).parseFromString(this.icons.bookmark_anchor,"image/svg+xml");this.bookmarkIcon=e.documentElement,this._element=null,this._range=null;const i=function({lang:t,icons:e}){const i=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<div class="se-controller-display"></div>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="edit" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-link"},i)}(this);this.displayId=i.querySelector(".se-controller-display"),this.controllerSelect=new mi(this,i,{position:"bottom",disabled:!0},_l.key);const s=function({lang:t,icons:e}){const i=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-controller-display">${t.id}</div>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" required />\n\t\t\t\t<button type="submit" data-command="submit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return gt.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},i)}(this);this.inputEl=s.querySelector("input"),this.controller=new mi(this,s,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},_l.key)}show(){this.controller.open(this._range=this.selection.getRange()),fl.setTimeout((()=>{this.inputEl.focus()}),0)}select(t){this._element=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}deselect(){this._init()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const i=this._element;switch(e){case"submit":if(i)this.controller.close(),i.id=this.inputEl.value,this.select(i);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=gt.utils.createElement("A",{id:t,"data-se-anchor":this.inputEl.value,"data-se-non-link":"true",contenteditable:"false",class:"se-component se-inline-component"});this.component.insert(e,{skipCharCount:!1,skipSelection:!0,skipHistory:!1});const i=this.selection.getNearRange(e);i?this.selection.setRange(i.container,i.offset,i.container,i.offset):this.component.select(e,_l.key),this._init()}break;case"cancel":this.controller.close(!i),this._range&&this.selection.setRange(this._range),this._init(),i&&this.select(i);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controllerSelect.hide(),this.controller.open(i);break;case"delete":{const t=this.selection.getNearRange(i);gt.utils.removeItem(i),this.controllerSelect.close(!0),t&&this.selection.setRange(t.container,t.offset,t.container,t.offset),this._init();break}}}_init(){this._element=null,this._range=null,this.inputEl.value="",this.displayId.textContent=""}}const bl={blockquote:Bs,exportPDF:zs,fileUpload:qs,list_bulleted:Us,list_numbered:Ys,mention:js,align:Js,font:tn,fontColor:Dn,backgroundColor:Wn,list:Yn,table:vo,formatBlock:wo,hr:Gn,layout:ko,lineHeight:Eo,template:Ho,paragraphStyle:Lo,textStyle:Ao,link:zo,image:Po,video:Wo,audio:Yo,embed:Ko,math:el,drawing:nl,imageGallery:rl,videoGallery:al,audioGallery:hl,fileGallery:cl,fileBrowser:dl,fontSize:gl,pageNavigator:ml,anchor:_l},yl={_DragHandle:oe,ApiManager:Vs,ColorPicker:Fn,Controller:mi,Browser:ll,FileManager:Fs,HueSlider:Rn,Figure:Si,Modal:Ro,ModalAnchorEditor:Io,SelectMenu:fi};i("+qkj"),i("JybH"),Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...As,EditorInjector:ai,Plugins:bl,Modules:yl,Helper:bt}})})()})();
|
|
1
|
+
(()=>{var t={cfbI(t){var e,s;e="undefined"!=typeof window?window:this,s=function(t,e){const s={code:"en",align:"Align",alignBottom:"Align bottom",alignCenter:"Align center",alignJustify:"Align justify",alignLeft:"Align left",alignMiddle:"Align middle",alignRight:"Align right",alignTop:"Align top",anchor:"Anchor",asBlock:"As a block",asInline:"As a inline",asLink:"As a link",audio:"Audio",audioGallery:"Audio gallery",audio_modal_file:"Select from files",audio_modal_title:"Insert Audio",audio_modal_url:"Audio URL",autoSize:"Auto size",backgroundColor:"Background color",basic:"Basic",blockStyle:"Block style",bold:"Bold",border:"Border",border_all:"Border all",border_inside:"Border inside",border_horizontal:"Border horizontal",border_vertical:"Border vertical",border_outside:"Border outside",border_left:"Border left",border_top:"Border top",border_right:"Border right",border_bottom:"Border bottom",border_none:"Border none",bulletedList:"Bulleted list",cancel:"Cancel",caption:"Insert description",cellProperties:"Cell properties",center:"Center",close:"Close",codeView:"Code view",color:"Color",colorPicker:"Color picker",column:"Column",comment:"Comments",commentAdd:"Add comment",commentShow:"Show comments",copy:"Copy",copyFormat:"Paint Formatting",cut:"Cut",default:"Default",deleteColumn:"Delete column",deleteRow:"Delete row",dir_ltr:"Left to right",dir_rtl:"Right to left",download:"Download",drag:"Drag",drawing:"Drawing",drawing_modal_title:"Drawing",edit:"Edit",embed:"Embed",embed_modal_title:"Embed",embed_modal_source:"Embed Source / URL",exportPDF:"Export to PDF",exportWord:"Export to Word",find:"Find",decrease:"Decrease",increase:"Increase",fileBrowser:"File browser",fileGallery:"File gallery",fileUpload:"File upload",fixedColumnWidth:"Fixed column width",font:"Font",fontColor:"Font color",fontSize:"Size",formats:"Formats",fullScreen:"Full screen",height:"Height",horizontalLine:"Horizontal line",horizontalSplit:"Horizontal split",hr_dashed:"Dashed",hr_dotted:"Dotted",hr_solid:"Solid",id:"ID",image:"Image",imageGallery:"Image gallery",image_modal_altText:"Alternative text",image_modal_file:"Select from files",image_modal_title:"Insert image",image_modal_url:"Image URL",importWord:"Import from Word",indent:"Indent",inlineStyle:"Inline style",insertColumnAfter:"Insert column after",insertColumnBefore:"Insert column before",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertLine:"Insert line",italic:"Italic",layout:"Layout",left:"Left",lineHeight:"Line height",link:"Link",link_modal_bookmark:"Bookmark",link_modal_downloadLinkCheck:"Download link",link_modal_newWindowCheck:"Open in new window",link_modal_text:"Text to display",link_modal_title:"Insert Link",link_modal_url:"URL to link",link_modal_relAttribute:"Rel attribute",list:"List",math:"Math",math_modal_fontSizeLabel:"Font Size",math_modal_inputLabel:"Mathematical Notation",math_modal_previewLabel:"Preview",math_modal_title:"Math",maxSize:"Max size",mediaGallery:"Media gallery",mention:"Mention",menu_bordered:"Bordered",menu_code:"Code",menu_neon:"Neon",menu_shadow:"Shadow",menu_spaced:"Spaced",menu_translucent:"Translucent",mergeCells:"Merge cells",minSize:"Min size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",newDocument:"New document",numberedList:"Numbered list",outdent:"Outdent",pageBreak:"Page break",pageDown:"Page down",pageNumber:"Page number",pageUp:"Page up",paragraphStyle:"Paragraph style",preview:"Preview",print:"print",proportion:"Constrain proportions",ratio:"Ratio",redo:"Redo",remove:"Remove",removeFormat:"Remove Format",replace:"Replace",replaceAll:"Replace all",resize100:"Zoom 100%",resize25:"Zoom 25%",resize50:"Zoom 50%",resize75:"Zoom 75%",resize:"Resize",revert:"Revert",revisionHistory:"Revision History",right:"Right",rotateLeft:"Rotate left",rotateRight:"Rotate right",row:"Row",save:"Save",search:"Search",selectAll:"Select All",showBlocks:"Show blocks",size:"Size",splitCells:"Split cells",strike:"Strike",submitButton:"Submit",subscript:"Subscript",superscript:"Superscript",table:"Table",tableHeader:"Table header",tableProperties:"Table properties",tags:"Tags",tag_blockquote:"Quote",tag_div:"Normal (DIV)",tag_h:"Header",tag_p:"Paragraph",tag_pre:"Code",template:"Template",textStyle:"Text style",title:"Title",underline:"Underline",undo:"Undo",unmergeCells:"Unmerge cells",unlink:"Unlink",verticalSplit:"Vertical split",video:"Video",videoGallery:"Video gallery",video_modal_file:"Select from files",video_modal_title:"Insert Video",video_modal_url:"Media embed URL, YouTube/Vimeo",width:"Width",message_copy_success:"Copied to clipboard",message_copy_fail:"Copy failed. Please copy manually."};return void 0===e&&(t.SUNEDITOR_LANG||Object.defineProperty(t,"SUNEDITOR_LANG",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(t.SUNEDITOR_LANG,"en",{enumerable:!0,writable:!0,configurable:!0,value:s})),s},"object"==typeof t.exports?t.exports=e.document?s(e,!0):function(t){if(!t.document)throw new Error("SUNEDITOR_LANG a window with a document");return s(t)}:s(e)}},e={};function s(i){var n=e[i];if(void 0!==n)return n.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,s),o.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};s.r(t),s.d(t,{Browser:()=>In,ColorPicker:()=>xo,Controller:()=>ps,Figure:()=>Es,HueSlider:()=>Co,Modal:()=>ko});var e={};s.r(e),s.d(e,{ApiManager:()=>An,FileManager:()=>To});var i={};s.r(i),s.d(i,{ModalAnchorEditor:()=>Lo,SelectMenu:()=>ms,_DragHandle:()=>os});var n={};s.r(n),s.d(n,{EditorComponent:()=>la,ModuleBrowser:()=>ia,ModuleColorPicker:()=>na,ModuleController:()=>sa,ModuleHueSlider:()=>oa,ModuleModal:()=>ea,PluginBrowser:()=>Bo,PluginCommand:()=>Io,PluginDropdown:()=>Vo,PluginDropdownFree:()=>Oo,PluginField:()=>Ro,PluginInput:()=>zo,PluginModal:()=>Fo,PluginPopup:()=>Po});const o=window,l=document,r=Symbol("noEventHandler"),a=Symbol("onOverComponent"),c=navigator.userAgent.toLowerCase();const h="function"==typeof ResizeObserver,d="function"==typeof navigator.clipboard?.write,u=/Edg/.test(navigator.userAgent),p=/(Mac|iPhone|iPod|iPad)/.test(navigator.userAgent),g=c.includes("chrome/")&&!c.includes("edge/"),m=!!c.match(/gecko\/\d+/),f=!!o.chrome,v=c.includes("applewebkit/")&&!c.includes("chrome"),b=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(c),y=navigator.maxTouchPoints>0&&"ontouchstart"in o,C=c.includes("android"),w=p?"⌘":"CTRL",_=p?"⇧":"+SHIFT",x=o.devicePixelRatio,$={_w:o,_d:l,NO_EVENT:r,ON_OVER_COMPONENT:a,getXMLHttpRequest:function(){return new XMLHttpRequest},getPageStyle:function(t){let e="";const s=(t||l).styleSheets;for(let t,i=0,n=s.length;i<n;i++){try{t=s[i].cssRules}catch{continue}if(t)for(let s=0,i=t.length;s<i;s++)e+=t[s].cssText}return e},getIncludePath:function(t,e){let s="";const i=[],n="js"===e?"script":"link",o="js"===e?"src":"href";let r="(?:";for(let e=0,s=t.length;e<s;e++)r+=t[e]+(e<s-1?"|":")");const a=new RegExp(`(^|.*[\\/])${r}(\\.[^\\/]+)?.${e}(?:\\?.*|;.*)?$`,"i"),c=new RegExp(`.+\\.${e}(?:\\?.*|;.*)?$`,"i");for(let t=l.getElementsByTagName(n),e=0;e<t.length;e++)c.test(t[e][o])&&i.push(t[e]);for(let t=0;t<i.length;t++){const e=i[t][o].match(a);if(e){s=e[0];break}}if(!s)throw new Error("[SUNEDITOR.helper.env.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (path: +"+s+", extension: "+e+")");return""===s&&(s=i.length>0?i[0][o]:""),s.includes(":/")||"//"===s.slice(0,2)||(s=!1===s.includes("/")?location.href.match(/^.*?:\/\/[^/]*/)[0]+s:location.href.match(/^[^?]*\/(?:)/)[0]+s),s},isResizeObserverSupported:h,isClipboardSupported:d,isEdge:u,isBlink:g,isGecko:m,isChromium:f,isSafari:v,isOSX_IOS:p,isAndroid:C,isMobile:b,isTouchDevice:y,cmdIcon:w,shiftIcon:_,DPI:x,KATEX_WEBSITE:"https://katex.org/docs/supported.html",MATHJAX_WEBSITE:"https://www.mathjax.org/"},S=8203,k=String.fromCharCode(S),E=new RegExp(String.fromCharCode(S),"g"),T=new RegExp("^"+String.fromCharCode(S)+"+$");const M={zeroWidthSpace:k,zeroWidthRegExp:E,onlyZeroWidthRegExp:T,escapeStringRegexp:function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}},H=/&|\u00A0|'|"|<|>/g,L=/&| |'|"|<|>/g,N={"&":"&"," ":" ","'":"'",'"':""","<":"<",">":">"},A={"&":"&"," ":" ","'":"'",""":'"',"<":"<",">":">"},B=/[A-Z]/g,I=/-[a-zA-Z]/g,V={"xx-small":.5625,"x-small":.625,small:.8333,medium:1,large:1.125,"x-large":1.5,"xx-large":2,"xxx-large":2.5};function O(t){if(3===t.nodeType){const e=t.nodeValue.trim();return e?{type:"text",content:e}:null}if(1===t.nodeType){const e={type:"element",tag:t.tagName.toLowerCase(),attributes:{},children:[]};for(const s of t.attributes)e.attributes[s.name]=s.value;for(const s of t.childNodes){const t=O(s);t&&e.children.push(t)}return e}return null}function R(t){return t.replace(H,(t=>N[t]||t))}function z(t){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(t)}const F={htmlToJson:function(t){return O((new DOMParser).parseFromString(t,"text/html").body)},jsonToHtml:function t(e){if(!e)return"";if("text"===e.type)return R(e.content||"");if("element"===e.type){const{tag:s,attributes:i={},children:n=[]}=e,o=Object.entries(i).map((([t,e])=>`${t}="${R(e)}"`)).join(" "),l=`</${s}>`;return`${o?`<${s} ${o}>`:`<${s}>`}${n.map(t).join("")}${l}`}return""},htmlToEntity:R,entityToHTML:function(t){return t.replace(L,(t=>A[t]||t))},debounce:function(t,e){let s;return function(...i){o.clearTimeout(s),s=o.setTimeout((()=>{o.clearTimeout(s),t(...i)}),e)}},syncMaps:function(t,e){e.forEach(((e,s)=>{t.set(s,e)})),t.forEach(((s,i)=>{e.has(i)||t.delete(i)}))},mergeMaps:function(...t){const e=t.filter((t=>t instanceof Map)).flatMap((t=>[...t]));return new Map(e)},getValues:function(t){return t?Object.keys(t).map((function(e){return t[e]})):[]},camelToKebabCase:function t(e){return"string"==typeof e?e.replace(B,(t=>"-"+t.toLowerCase())):e.map((function(e){return t(e)}))},kebabToCamelCase:function t(e){return"string"==typeof e?e.replace(I,(t=>t.replace("-","").toUpperCase())):e.map((function(e){return t(e)}))},toFontUnit:function(t,e){const s=e.match(/(\d+(?:\.\d+)?)(.+)/),i=s?Number(s[1]):V[e],n=s?s[2]:"rem";let o=i;switch(/em/.test(n)?o=Math.round(i/.0625):"pt"===n?o=Math.round(1.333*i):"%"===n&&(o=i/100),t){case"em":case"rem":return(.0625*o).toFixed(2)+t;case"%":return 100*Number((.0625*o).toFixed(2))+t;case"pt":return Math.round(o/1.333)+t;default:return o+t}},nodeListToArray:function(t){return t?Array.prototype.slice.call(t):[]},swapKeyValue:function(t){const e={},s=Object.prototype.hasOwnProperty;for(const i in t)s.call(t,i)&&(e[t[i]]=i);return e},createElementWhitelist:function(t){return new RegExp(`<\\/?\\b(?!\\b${(t||"").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},createElementBlacklist:function(t){return new RegExp(`<\\/?\\b(?:\\b${(t||"^").replace(/\|/g,"\\b|\\b")}\\b)[^>]*>`,"gi")},isHexColor:z,rgb2hex:function(t){if(z(t)||!t)return t;const e=t.match(/^rgba?[\s+]?\(([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?,[\s+]?([\d]+)[\s+]?/i);if(e&&e.length>=4){const s=("0"+parseInt(e[1],10).toString(16)).slice(-2),i=("0"+parseInt(e[2],10).toString(16)).slice(-2),n=("0"+parseInt(e[3],10).toString(16)).slice(-2);let o="";if(t.includes("rgba")){const e=t.match(/,\s*([\d]+\.?[\d]*)\s*\)/);e&&(o=("0"+Math.round(255*parseFloat(e[1])).toString(16)).slice(-2))}return`#${s}${i}${n}${o}`}return t},getWidthInPercentage:function(t,e){const s=e||t.parentElement,i=o.getComputedStyle(s),n=parseFloat(i.paddingLeft),l=parseFloat(i.paddingRight),r=s.offsetWidth-s.clientWidth,a=s.offsetWidth-n-l-r;return t.offsetWidth/a*100},textToAnchor:function(t){const e=/https?:\/\/[^\s]+/g;if(3===t.nodeType&&e.test(t.textContent)&&!/^A$/i.test(t.parentNode?.nodeName)){const s=t.textContent,i=l.createDocumentFragment();let n=0;return s.replace(e,((t,e)=>{e>n&&i.appendChild(l.createTextNode(s.slice(n,e)));const o=l.createElement("a");return o.href=t,o.target="_blank",o.textContent=t,i.appendChild(o),n=e+t.length,t})),n<s.length&&i.appendChild(l.createTextNode(s.slice(n))),t.parentNode.replaceChild(i,t),!0}return!1},spanToStyleNode:function(t,e){if(1===e.nodeType&&/^SPAN$/i.test(e.nodeName)&&e.hasAttribute("style")){const s=e.getAttribute("style"),i=[];if(Object.keys(t).forEach((e=>{if(t[e].regex.test(s)){const s=l.createElement(t[e].tag);i.push(s)}})),i.length>0){const t=l.createElement("span");let s=e.firstChild;i.forEach(((e,s)=>{0===s?t.appendChild(e):i[s-1].appendChild(e)}));const n=i[i.length-1];for(;s;){const t=s.nextSibling;n.appendChild(s),s=t}e.appendChild(t)}}},addUrlQuery:function(t,e){if(e.length>0)if(/\?/.test(t)){const s=t.split("?");t=s[0]+"?"+e+"&"+s[1]}else t+="?"+e;return t},_setDefaultOptionStyle:function(t,e){let s="";t.get("height")&&(s+="height:"+t.get("height")+";"),t.get("minHeight")&&(s+="min-height:"+t.get("minHeight")+";"),t.get("maxHeight")&&(s+="max-height:"+t.get("maxHeight")+";"),t.get("width")&&(s+="width:"+t.get("width")+";"),t.get("minWidth")&&(s+="min-width:"+t.get("minWidth")+";"),t.get("maxWidth")&&(s+="max-width:"+t.get("maxWidth")+";");let i="",n="",o="";const l=(e=s+e).split(";");for(let e,s=0,r=l.length;s<r;s++)e=l[s].trim(),e&&(/^(min-|max-)?width\s*:/.test(e)||/^(z-index|position|display)\s*:/.test(e)?i+=e+";":/^(min-|max-)?height\s*:/.test(e)?(/^height/.test(e)&&"auto"===e.split(":")[1].trim()&&t.set("height","auto"),n+=e+";"):o+=e+";");return{top:i,frame:n,editor:o}},_setIframeStyleLinks:function(t){let e="";if(t){const s=l.getElementsByTagName("link");for(let i,n=0,o=t.length;n<o;n++){i=[];const o=t[n];if("*"===o)for(let t=0,e=s.length;t<e;t++)"stylesheet"===s[t].rel&&s[t].href&&i.push(s[t].href);else if(/(^https?:\/\/)|(^data:text\/css,)/.test(o))i.push(o);else{const t=new RegExp(`(^|.*[\\/])${o}(\\..+)?.css((\\??.+?)|\\b)$`,"i");for(let e,n=0,o=s.length;n<o;n++)e=s[n].href.match(t),e&&i.push(e[0])}if(!i||0===i.length)throw new Error('[SUNEDITOR.constructor.iframe.fail] The suneditor CSS files installation path could not be automatically detected. Please set the option property "iframe_cssFileName" before creating editor instances.');for(let t=0,s=i.length;t<s;t++)e+='<link href="'+i[t]+'" rel="stylesheet">'}}return e},_setAutoHeightStyle:function(t){return"auto"===t?"<style>\n/** Iframe height auto */\nbody{height: min-content; overflow: hidden;}\n</style>":""}},P=F,D=/(\s|^)(katex|MathJax|se-exclude-format)(\s|$)/;function q(t){if(null==t)return!1;if("string"!=typeof t){if(W(t)){const e=t.children;for(let t=0,s=e.length;t<s;t++){if(!j(e[t]))return!1}}t=t.textContent}return""===t||T.test(t)}function W(t){return 1===t?.nodeType}function U(t){return/^(OL|UL)$/i.test("string"==typeof t?t:t?.nodeName)}function G(t){return/^TABLE$/i.test("string"==typeof t?t:t?.nodeName)}function Z(t){return/^BR$/i.test("string"==typeof t?t:t?.nodeName)}function j(t){return/^(BR|COLGROUP|COL|THEAD|TBODY|TFOOT|TR|AREA|BASE|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/i.test("string"==typeof t?t:t?.nodeName)}function K(t){if(1!==t?.nodeType)return!1;const e=t.classList;return!!e&&("BODY"===t.nodeName.toUpperCase()||e.contains("se-wrapper-wysiwyg")||e.contains("sun-editor-carrier-wrapper")||e.contains("se-wrapper"))}function Y(t){return t?.hasAttribute("data-important-disabled")}const X={isZeroWidth:q,isEdgePoint:function(t,e,s){return"end"!==s&&0===e||(!s||"front"!==s)&&!t.nodeValue&&e<=1||(!s||"end"===s)&&t.nodeValue&&e>=t.nodeValue.length},isText:function(t){return 3===t?.nodeType},isElement:W,isInputElement:function(t){return W(t)&&/^(INPUT|TEXTAREA|SELECT|OPTION)$/i.test(t.nodeName)},isButtonElement:function(t){return W(t)&&/^(BUTTON)$/i.test(t.nodeName)},isList:U,isListCell:function(t){return/^LI$/i.test("string"==typeof t?t:t?.nodeName)},isTable:G,isTableElements:function(t){return/^(TABLE|THEAD|TBODY|TR|TH|TD|COL)$/i.test("string"==typeof t?t:t?.nodeName)},isTableCell:function(t){return/^(TD|TH)$/i.test("string"==typeof t?t:t?.nodeName)},isTableRow:function(t){return/^TR$/i.test("string"==typeof t?t:t?.nodeName)},isBreak:Z,isAnchor:function(t){return/^A$/i.test("string"==typeof t?t:t?.nodeName)},isMedia:function(t){return/^(IMG|IFRAME|AUDIO|VIDEO|CANVAS)$/i.test("string"==typeof t?t:t?.nodeName)},isIFrame:function(t){return/^IFRAME$/i.test("string"==typeof t?t:t?.nodeName)},isFigure:function(t){return/^FIGURE$/i.test("string"==typeof t?t:t?.nodeName)},isContentLess:j,isEmptyLine:function(t){if(!t?.parentNode)return!0;const e=t;return!e.querySelector("IMG, IFRAME, AUDIO, VIDEO, CANVAS, TABLE")&&(e.children.length<=1||Z(e.firstElementChild))&&q(e.textContent)},isComponentContainer:function(t){if(1!==t?.nodeType)return!1;const e=t.classList;return!!e&&(e.contains("se-component")||e.contains("se-flex-component"))},isWysiwygFrame:K,isNonEditable:function(t){return 1===t?.nodeType&&"false"===t.getAttribute("contenteditable")},isSpanWithoutAttr:function(t){if(1!==t?.nodeType)return!1;const e=t;return/^SPAN$/i.test(e.nodeName)&&!e.className&&0===e.style.length},isSameAttributes:function(t,e){if(3===t.nodeType&&3===e.nodeType)return!0;if(3===t.nodeType||3===e.nodeType)return!1;const s=t,i=e,n=s.style,o=i.style;let l=0;for(let t=0,e=n.length;t<e;t++)n[n[t]]===o[n[t]]&&l++;const r=s.classList,a=i.classList;let c=0;for(let t=0,e=r.length;t<e;t++)a.contains(r[t])&&c++;return l===o.length&&l===n.length&&c===a.length&&c===r.length},isExcludeFormat:function(t){return D.test(t?.className)},isUneditable:function(t){return t?.classList.contains("__se__uneditable")},isImportantDisabled:Y},J=X;function Q(t){const e=Object.prototype.toString.call(t);return"[object HTMLCollection]"===e||"[object NodeList]"===e||"[object Array]"===e}function tt(t,e,s){const i=l.createElement(t);if(e)for(const t in e)void 0!==e[t]&&null!==e[t]&&i.setAttribute(t,e[t]);return s&&("string"==typeof s?i.innerHTML=s:"object"==typeof s&&i.appendChild(s)),i}function et(t,e){let s=-1;for(let i=0,n=t.length;i<n;i++)if(t[i]===e){s=i;break}return s}function st(t,e,s){const i=t,n=e;if(n.style.length>0){const t=n.style;for(let e=0,s=t.length;e<s;e++)i.style[t[e]]=t[t[e]]}const o=n.attributes;for(let t,e=0,n=o.length;e<n;e++)t=o[e].name.toLowerCase(),s?.includes(t)||!o[e].value?i.removeAttribute(t):"style"!==t&&i.setAttribute(o[e].name,o[e].value)}function it(t,e){if(t&&1===t.nodeType)return t.classList.contains(e)}function nt(t,e){if(!t)return;const s=Q(t)?t:[t],i=e.split("|");for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e&&1===e.nodeType)for(const t of i)t&&e.classList.add(t)}}function ot(t,e){if(!t)return;const s=Q(t)?t:[t],i=e.split("|");for(let t=0,e=s.length;t<e;t++){const e=s[t];if(e&&1===e.nodeType)for(const t of i)t&&e.classList.remove(t)}}function lt(t=l){return{w:t.documentElement.clientWidth,h:t.documentElement.clientHeight}}const rt={clone:function(t,e=!1){return t.cloneNode(e)},createElement:tt,createTextNode:function(t){return l.createTextNode(t||"")},getAttributesToString:function(t,e){const s=t.attributes;if(!s)return"";let i="";for(let t=0,n=s.length;t<n;t++)e?.includes(s[t].name)||(i+=s[t].name+'="'+R(s[t].value)+'" ');return i},arrayFilter:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;const s=[];for(let i,n=0,o=t.length;n<o;n++)i=t[n],e(i)&&s.push(i);return s},arrayFind:function(t,e){if(!t||0===t.length)return null;e||=()=>!0;for(let s,i=0,n=t.length;i<n;i++)if(s=t[i],e(s))return s;return null},arrayIncludes:function(t,e){for(let s=0;s<t.length;s++)if(t[s]===e)return!0;return!1},getArrayIndex:et,nextIndex:function(t,e){const s=et(t,e);return-1===s?-1:s+1},prevIndex:function(t,e){const s=et(t,e);return-1===s?-1:s-1},copyTagAttributes:st,copyFormatAttributes:function(t,e){const s=e.cloneNode(!1);s.className=s.className.replace(/(\s|^)__se__format__[^\s]+/g,""),st(t,s)},removeItem:function(t){t&&("remove"in t&&"function"==typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t))},changeElement:function(t,e){if(t)if("string"==typeof e)if("outerHTML"in t)t.outerHTML=e;else{const s=tt("DIV");s.innerHTML=e,t.parentNode.replaceChild(s.firstChild,t)}else 1===e?.nodeType&&t.parentNode.replaceChild(e,t)},changeTxt:function(t,e){t&&e&&(t.textContent=e)},setStyle:function(t,e,s){for(let i,n=0,o=(t=Array.isArray(t)?t:[t]).length;n<o;n++)i=t[n],i.style[e]=s,0===i.style.length&&i.removeAttribute("style")},getStyle:function(t,e){if(1===t?.nodeType)return t.style[e]},setDisabled:function(t,e,s){for(let i=0,n=t.length;i<n;i++){const n=t[i];!s&&Y(n)||(n.disabled=e),s&&(e?n.setAttribute("data-important-disabled",""):n.removeAttribute("data-important-disabled"))}},hasClass:it,addClass:nt,removeClass:ot,toggleClass:function(t,e){if(!t||1!==t.nodeType)return;const s=t;let i=!1;const n=new RegExp(`(\\s|^)${e}(\\s|$)`);return n.test(s.className)?s.className=s.className.replace(n," ").trim():(s.className+=" "+e,i=!0),s.className.trim()||s.removeAttribute("class"),i},flashClass:function(t,e,s=120){nt(t,e),o.setTimeout((()=>{ot(t,e)}),s)},getClientSize:lt,getViewportSize:function(){return"visualViewport"in o?{top:o.visualViewport.pageTop,left:o.visualViewport.pageLeft,scale:o.visualViewport.scale}:{top:0,left:0,scale:1}},applyInlineStylesAll:function(t,e,s){if(!t)return console.warn('"parentTarget" is not exist'),null;let i=t;const n=l.createElement("DIV");if(n.style.display="none",/body/i.test(i.nodeName)){const t=l.createElement("DIV"),e=i.attributes;for(let s=0,i=e.length;s<i;s++)t.setAttribute(e[s].name,e[s].value);t.innerHTML=i.innerHTML,i=t}else i=i.cloneNode(!0);n.appendChild(i),l.body.appendChild(n);const r=Array.from(i.querySelectorAll("*")),a=e?[i].concat(r):r;for(let t,e=0;t=a[e];e++){if(1!==t.nodeType)continue;const e=o.getComputedStyle(t),i=t.style;for(const t of s)i.setProperty(t,e.getPropertyValue(t)||"")}return l.body.removeChild(n),i},waitForMediaLoad:function(t,e=5e3){const s=t||l;return new Promise((t=>{const i=["img","video","audio","iframe"].flatMap((t=>Array.from(s.querySelectorAll(t))));if(0===i.length)return void t();const n=i.map((t=>{if(function(t){return"[object HTMLImageElement]"===Object.prototype.toString.call(t)}(t)){if(t.complete)return Promise.resolve()}else if(function(t){const e=Object.prototype.toString.call(t);return"[object HTMLVideoElement]"===e||"[object HTMLAudioElement]"===e}(t)){if(t.readyState>=2)return Promise.resolve()}else if(function(t){return"[object HTMLIFrameElement]"===Object.prototype.toString.call(t)}(t))try{if("complete"===t.contentDocument?.readyState)return Promise.resolve()}catch(t){console.warn(["[SUNEDITOR] Iframe load error",t])}return new Promise((e=>{t.addEventListener("load",e,{once:!0}),t.addEventListener("error",e,{once:!0})}))}));Promise.race([Promise.all(n),new Promise((t=>o.setTimeout(t,e)))]).then((()=>{t()}))}))},getRootCssVar:function(t){return l.documentElement.style.getPropertyValue(t)},setRootCssVar:function(t,e){l.documentElement.style.setProperty(t,e)},createTooltipInner:function(t){return`<span class="se-tooltip-inner"><span class="se-tooltip-text">${t}</span></span>`}};function at(t){let e=0;for(;t=t.previousSibling;)e+=1;return e}function ct(t,e,s){const i=[];let n=!0;return pt(t,(t=>{if(t===e&&(n=!1),n&&!J.isWysiwygFrame(t)){if(s&&3===t.nodeType){let e=null,i=null;s.s=s.e=0;let n=t.previousSibling;for(;3===n?.nodeType;)i=n.textContent.replace(E,""),s.s+=i.length,t.textContent=i+t.textContent,e=n,n=n.previousSibling,rt.removeItem(e);let o=t.nextSibling;for(;3===o?.nodeType;)i=o.textContent.replace(E,""),s.e+=i.length,t.textContent+=i,e=o,o=o.nextSibling,rt.removeItem(e)}i.push(t)}return!1})),i.map(at).reverse()}function ht(t,e){let s,i=e;for(let e=0,n=t.length;e<n&&(s=i.childNodes,0!==s.length);e++)i=s.length<=t[e]?s[s.length-1]:s[t[e]];return i}function dt(t,e,s){const i=[];return s??=1/0,!t||s<=0||0===t.childNodes.length||(e||=()=>!0,function t(n,o){if(o>s)return;if(o>0&&e(n)&&i.push(n),o===s)return;const l=n.childNodes;for(let e=0,s=l.length;e<s;e++)t(l[e],o+1)}(t,0)),i}function ut(t){if(!t||J.isWysiwygFrame(t))return-1;let e=0;for(t=t.parentNode;t&&!J.isWysiwygFrame(t);)e+=1,t=t.parentNode;return e}function pt(t,e,s){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const s=new RegExp(e,"i");i=e=>s.test(e[t])}s||=1/0;let n=0;for(;t&&!i(t);){if(n>=s||J.isWysiwygFrame(t))return null;t=t.parentElement,n++}return t}const gt={getPositionIndex:at,getNodePath:ct,getNodeFromPath:ht,getChildNode:function(t,e){let s=null;if(!t)return s;const i=t;return i.children&&0!==i.children.length?(e||=()=>!0,function t(n){if(i!==n&&e(n))return s=n,!0;if(n.children)for(let e=0,s=n.children.length;e<s;e++)t(n.children[e])}(i),s):s},getListChildren:function(t,e,s){const i=[];if(s??=1/0,!t||s<=0)return i;const n=t;return n.children&&0!==n.children.length?(e||=()=>!0,function t(o,l){if(!(l>s)&&(l>0&&n!==o&&e(o)&&i.push(o),l!==s&&o.children))for(let e=0,s=o.children.length;e<s;e++)t(o.children[e],l+1)}(n,0),i):i},getListChildNodes:dt,getNodeDepth:ut,sortNodeByDepth:function(t,e){const s=e?1:-1,i=-1*s;t.sort((function(t,e){if(!J.isListCell(t)||!J.isListCell(e))return 0;const n=ut(t),o=ut(e);return n>o?s:n<o?i:0}))},compareElements:function(t,e){let s=t,i=e;const n=ut(t),o=ut(e);if(n>o){let t=n-o;for(;t>0&&s;)s=s.parentElement,t--}else if(o>n){let t=o-n;for(;t>0&&i;)i=i.parentElement,t--}for(;s&&i&&s.parentElement!==i.parentElement;)s=s.parentElement,i=i.parentElement;if(!s?.parentNode||!i?.parentNode)return{ancestor:null,a:t,b:e,result:0};const l=s.parentNode.childNodes,r=rt.getArrayIndex(l,s),a=rt.getArrayIndex(l,i);return{ancestor:s.parentElement,a:s,b:i,result:r>a?1:r<a?-1:0}},getParentElement:pt,getParentElements:function(t,e,s){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=t=>t===e;else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+e+"$");const s=new RegExp(e,"i");i=e=>s.test(e[t])}const n=[];s||=1/0;let o=0;for(;o<=s&&t&&!J.isWysiwygFrame(t);)i(t)&&n.push(t),t=t.parentElement,o++;return n},getCommandTarget:function(t){let e=t;for(;e&&!/^(UL)$/i.test(e.nodeName)&&!rt.hasClass(e,"sun-editor");){if(e.hasAttribute("data-command"))return e;e=e.parentElement}return null},getEventTarget:function(t){return t.target},getEdgeChild:function(t,e,s){let i;if("function"==typeof e)i=e;else if("object"==typeof e)i=function(t){return t===e};else{let t;/^\./.test(e)?(t="className",e="(\\s|^)"+e.split(".")[1]+"(\\s|$)"):/^#/.test(e)?(t="id",e="^"+e.split("#")[1]+"$"):/^:/.test(e)?(t="name",e="^"+e.split(":")[1]+"$"):(t="nodeName",e="^"+("text"===e?"#"+e:e)+"$");const s=new RegExp(e,"i");i=function(e){return s.test(e[t])}}const n=dt(t,(t=>i(t)),null);return n[s?n.length-1:0]},getEdgeChildNodes:function(t,e){if(t){for(e||=t;t&&1===t.nodeType&&t.childNodes.length>0&&!J.isBreak(t);)t=t.firstChild;for(;e&&1===e.nodeType&&e.childNodes.length>0&&!J.isBreak(e);)e=e.lastChild;return{sc:t,ec:e||t}}},getPreviousDeepestNode:function(t,e){let s=t.previousSibling;if(!s){for(let i=t.parentNode;i;i=i.parentNode){if(i===e)return null;if(i.previousSibling){s=i.previousSibling;break}}if(!s)return null}if(J.isNonEditable(s))return s;for(;s.lastChild;)s=s.lastChild;return s},getNextDeepestNode:function(t,e){let s=t.nextSibling;if(!s){for(let i=t.parentNode;i;i=i.parentNode){if(i===e)return null;if(i.nextSibling){s=i.nextSibling;break}}if(!s)return null}if(J.isNonEditable(s))return s;for(;s.firstChild;)s=s.firstChild;return s},findTextIndexOnLine:function(t,e,s,i){if(!t)return 0;i||=()=>!0;let n=0,o=!1;return function t(l){if(!o&&8!==l.nodeType&&!i(l))if(3===l.nodeType){if(l===e)return n+=s,void(o=!0);n+=l.textContent.length}else if(1===l.nodeType){const e=l.childNodes;for(let s=0,i=e.length;s<i;s++)if(t(e[s]),o)return}}(t),n},findTabEndIndex:function(t,e,s){if(!t)return 0;const i=t.textContent,n=new RegExp(`((\\u00A0|\\s){${s},})`,"g");let o;for(n.lastIndex=e;null!==(o=n.exec(i));)if(o.index>=e){const t=o.index+o[0].length-1;return t+(i.slice(0,t+1).match(/[^\u00A0\s]/g)||[]).length+s}return 0},findVisualLastCell:function(t){if(!t||0===t.length)return null;const e={};let s=null,i=-1,n=-1;for(const o of t){const t=o.parentElement.rowIndex,l=o.rowSpan||1,r=o.colSpan||1;e[t]||=[];let a=0;const c=e[t];for(;c[a];)a++;for(let t=0;t<r;t++)c[a+t]=!0;for(let s=1;s<l;s++){const i=t+s;e[i]||=[];for(let t=0;t<r;t++)e[i][a+t]=!0}const h=t+l-1,d=a+r-1;(h>i||h===i&&d>n)&&(i=h,n=d,s=o)}return s},getScrollParents:function(t){const e=[];let s=t?.parentElement;for(;s&&!/^(body|html)$/i.test(s.nodeName);){const t=o.getComputedStyle(s),{overflow:i,overflowX:n,overflowY:l}=t;[i,n,l].some((t=>["auto","scroll","overlay"].includes(t)))&&e.push(s),s=s.parentElement}return e},getIframeDocument:function(t){return t.contentWindow?.document||t.contentDocument}};const mt={query:gt,check:J,utils:rt};function ft(t,e=0){if(!t)return 0;const s=(t+"").match(/-?\d+(\.\d+)?/);if(!s||!s[0])return 0;const i=Number(s[0]);return e<0?i:0===e?Math.round(i):Number(i.toFixed(e))}const vt={is:function(t){return/^-?\d+(\.\d+)?$/.test(t+"")},get:ft,getOverlapRangeAtIndex:function(t,e,s,i){if(t<=i?e<s:e>s)return 0;const n=(t>s?t:s)-(e<i?e:i);return(n<0?-1*n:n)+1},isEven:function(t){return!(1&t)},isOdd:function(t){return!(1&~t)}},bt="ArrowLeft|ArrowUp|ArrowRight|ArrowDown",yt="F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12",Ct=bt.split("|"),wt="Backspace|Delete".split("|"),_t=`Backspace|Tab|Enter|ShiftLeft|ShiftRight|ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|PageUp|PageDown|End|Home|${bt}|Insert|Delete|${yt}|NumLock|ScrollLock`.split("|"),xt="Backspace|Enter|Delete".split("|"),$t="Backspace|Enter|Delete".split("|"),St=`ControlLeft|ControlRight|AltLeft|AltRight|Pause|CapsLock|Escape|Insert|${yt}|NumLock|ScrollLock`.split("|");const kt={write:async function(t){if(!d)return console.error("Clipboard is not supported in this browser."),!1;let e="",s="";"string"==typeof t?(e=t,s=t):W(t)?(t.querySelectorAll("iframe").forEach((t=>{const e=document.createElement("div"),s={};for(const e of Array.from(t.attributes))s[e.name]=e.value;e.setAttribute("data-se-iframe-holder","1"),e.setAttribute("data-se-iframe-holder-attrs",JSON.stringify(s)),e.innerText=`[iframe: ${t.src}]`,t.replaceWith(e)})),e=t.outerHTML,s=t.textContent):(e=t.textContent,s=t.textContent);try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([e],{type:"text/html"}),"text/plain":new Blob([s],{type:"text/plain"})})])}catch{console.warn("[SUNEDITOR.copy.warn] This browser is not supported Clipboard API");try{await navigator.clipboard.writeText(s||function(t){const e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""}(e))}catch(t){console.error("[SUNEDITOR.copy.fail] "+t)}}}},Et=$,Tt=M,Mt=P,Ht=mt,Lt=vt,Nt={isShift:function(t){return t.shiftKey||16===t.keyCode},isCtrl:function(t){const e=t.code;return t.ctrlKey||t.metaKey||"MetaLeft"===e||"MetaRight"===e},isAlt:function(t){return t.altKey},isComposing:function(t){return t.isComposing||"Process"===t.key||229===t.keyCode},isBackspace:function(t){return"Backspace"===t},isTab:function(t){return"Tab"===t},isEnter:function(t){return"Enter"===t},isEsc:function(t){return"Escape"===t},isSpace:function(t){return"Space"===t},isDirectionKey:function(t){return Ct.includes(t)},isRemoveKey:function(t){return wt.includes(t)},isNonTextKey:function(t){return _t.includes(t)},isHistoryRelevantKey:function(t){return xt.includes(t)},isDocumentTypeObserverKey:function(t){return $t.includes(t)},isNonResponseKey:function(t){return St.includes(t)}},At=kt,Bt={env:Et,unicode:Tt,converter:Mt,dom:Ht,numbers:Lt,keyCodeMap:Nt,clipboard:At},It={redo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.4,10.6C16.55,9 14.15,8 11.5,8C6.85,8 2.92,11.03 1.54,15.22L3.9,16C4.95,12.81 7.95,10.5 11.5,10.5C13.45,10.5 15.23,11.22 16.62,12.38L13,16H22V7L18.4,10.6Z" /></svg>',undo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z" /></svg>',bold:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M304.793 243.891c33.639-18.537 53.657-54.16 53.657-95.693 0-48.236-26.25-87.626-68.626-104.179C265.138 34.01 240.849 32 209.661 32H24c-8.837 0-16 7.163-16 16v33.049c0 8.837 7.163 16 16 16h33.113v318.53H24c-8.837 0-16 7.163-16 16V464c0 8.837 7.163 16 16 16h195.69c24.203 0 44.834-1.289 66.866-7.584C337.52 457.193 376 410.647 376 350.014c0-52.168-26.573-91.684-71.207-106.123zM142.217 100.809h67.444c16.294 0 27.536 2.019 37.525 6.717 15.828 8.479 24.906 26.502 24.906 49.446 0 35.029-20.32 56.79-53.029 56.79h-76.846V100.809zm112.642 305.475c-10.14 4.056-22.677 4.907-31.409 4.907h-81.233V281.943h84.367c39.645 0 63.057 25.38 63.057 63.057.001 28.425-13.66 52.483-34.782 61.284z"/></svg>',underline:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9.78 15.74"><g><path d="M14.64,3.76h2.52v7.72a4.51,4.51,0,0,1-.59,2.31,3.76,3.76,0,0,1-1.71,1.53,6.12,6.12,0,0,1-2.64.53,5,5,0,0,1-3.57-1.18,4.17,4.17,0,0,1-1.27-3.24V3.76H9.9v7.3a3,3,0,0,0,.55,2,2.3,2.3,0,0,0,1.83.65,2.26,2.26,0,0,0,1.8-.65,3.09,3.09,0,0,0,.55-2V3.76Zm2.52,13.31V19.5H7.39V17.08h9.77Z" transform="translate(-7.38 -3.76)"/></g></svg>',italic:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4V7H12.21L8.79,15H6V18H14V15H11.79L15.21,7H18V4H10Z" /></svg>',strike:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.2 9.8C6 7.5 7.7 4.8 10.1 4.3C13.2 3.3 17.7 4.7 17.6 8.5H14.6C14.6 8.2 14.5 7.9 14.5 7.7C14.3 7.1 13.9 6.8 13.3 6.6C12.5 6.3 11.2 6.4 10.5 6.9C9 8.2 10.4 9.5 12 10H7.4C7.3 9.9 7.3 9.8 7.2 9.8M21 13V11H3V13H12.6C12.8 13.1 13 13.1 13.2 13.2C13.8 13.5 14.3 13.7 14.5 14.3C14.6 14.7 14.7 15.2 14.5 15.6C14.3 16.1 13.9 16.3 13.4 16.5C11.6 17 9.4 16.3 9.5 14.1H6.5C6.4 16.7 8.6 18.5 11 18.8C14.8 19.6 19.3 17.2 17.3 12.9L21 13Z" /></svg>',subscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,21.03H16.97V20.03L17.86,19.23C18.62,18.58 19.18,18.04 19.56,17.6C19.93,17.16 20.12,16.75 20.13,16.36C20.14,16.08 20.05,15.85 19.86,15.66C19.68,15.5 19.39,15.38 19,15.38C18.69,15.38 18.42,15.44 18.16,15.56L17.5,15.94L17.05,14.77C17.32,14.56 17.64,14.38 18.03,14.24C18.42,14.1 18.85,14 19.32,14C20.1,14.04 20.7,14.25 21.1,14.66C21.5,15.07 21.72,15.59 21.72,16.23C21.71,16.79 21.53,17.31 21.18,17.78C20.84,18.25 20.42,18.7 19.91,19.14L19.27,19.66V19.68H21.85V21.03Z" /></svg>',superscript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,7.41L11.41,12L16,16.59L14.59,18L10,13.41L5.41,18L4,16.59L8.59,12L4,7.41L5.41,6L10,10.59L14.59,6L16,7.41M21.85,9H16.97V8L17.86,7.18C18.62,6.54 19.18,6 19.56,5.55C19.93,5.11 20.12,4.7 20.13,4.32C20.14,4.04 20.05,3.8 19.86,3.62C19.68,3.43 19.39,3.34 19,3.33C18.69,3.34 18.42,3.4 18.16,3.5L17.5,3.89L17.05,2.72C17.32,2.5 17.64,2.33 18.03,2.19C18.42,2.05 18.85,2 19.32,2C20.1,2 20.7,2.2 21.1,2.61C21.5,3 21.72,3.54 21.72,4.18C21.71,4.74 21.53,5.26 21.18,5.73C20.84,6.21 20.42,6.66 19.91,7.09L19.27,7.61V7.63H21.85V9Z" /></svg>',remove_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22.11 21.46L2.39 1.73L1.11 3L7.65 9.54C6.74 11.03 6 12.65 6 14.23C6 17.54 8.69 20.23 12 20.23C13.74 20.23 15.3 19.5 16.4 18.29L20.84 22.73L22.11 21.46M12 18.23C9.78 18.23 8 16.45 8 14.23C8 13.5 8.5 12.27 9.14 11.03L15 16.88C14.26 17.71 13.2 18.23 12 18.23M11.14 7.94L9.71 6.5C10.57 5.38 11.25 4.61 11.25 4.61L12 3.77L12.75 4.61C12.75 4.61 14.03 6.06 15.32 7.94S18 12.07 18 14.23C18 14.41 18 14.59 17.97 14.77L15.46 12.26C15 11.23 14.37 10.07 13.68 9.07C12.84 7.85 12.44 7.42 12 6.9C11.73 7.21 11.5 7.5 11.14 7.94Z" /></svg>',remove_format:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6,5V5.18L8.82,8H11.22L10.5,9.68L12.6,11.78L14.21,8H20V5H6M3.27,5L2,6.27L8.97,13.24L6.5,19H9.5L11.07,15.34L16.73,21L18,19.73L3.55,5.27L3.27,5Z" /></svg>',indent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M11,17H21V15H11M3,8V16L7,12M3,21H21V19H3V21Z" /></svg>',outdent:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M3,21H21V19H3M3,12L7,16V8M11,17H21V15H11V17Z" /></svg>',expansion:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,21V19H6.41L10.91,14.5L9.5,13.09L5,17.59V14H3V21H10M14.5,10.91L19,6.41V10H21V3H14V5H17.59L13.09,9.5L14.5,10.91Z" /></svg>',reduction:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.5,3.09L15,7.59V4H13V11H20V9H16.41L20.91,4.5L19.5,3.09M4,13V15H7.59L3.09,19.5L4.5,20.91L9,16.41V20H11V13H4Z" /></svg>',code_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z" /></svg>',preview:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z" /></svg>',print:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,3H6V7H18M19,12A1,1 0 0,1 18,11A1,1 0 0,1 19,10A1,1 0 0,1 20,11A1,1 0 0,1 19,12M16,19H8V14H16M19,8H5A3,3 0 0,0 2,11V17H6V21H18V17H22V11A3,3 0 0,0 19,8Z" /></svg>',template:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,7.5H18V9.5H13V7.5M13,14.5H18V16.5H13V14.5M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M19,19V5H5V19H19M11,6V11H6V6H11M10,10V7H7V10H10M11,13V18H6V13H11M10,17V14H7V17H10Z" /></svg>',layout:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 13H3A1 1 0 0 0 2 14V20A1 1 0 0 0 3 21H21A1 1 0 0 0 22 20V14A1 1 0 0 0 21 13M20 19H4V15H20M21 3H3A1 1 0 0 0 2 4V10A1 1 0 0 0 3 11H21A1 1 0 0 0 22 10V4A1 1 0 0 0 21 3M20 9H4V5H20Z" /></svg>',new_document:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',select_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,9H15V15H9M7,17H17V7H7M15,5H17V3H15M15,21H17V19H15M19,17H21V15H19M19,9H21V7H19M19,21A2,2 0 0,0 21,19H19M19,13H21V11H19M11,21H13V19H11M9,3H7V5H9M3,17H5V15H3M5,21V19H3A2,2 0 0,0 5,21M19,3V5H21A2,2 0 0,0 19,3M13,3H11V5H13M3,9H5V7H3M7,21H9V19H7M3,13H5V11H3M3,5H5V3A2,2 0 0,0 3,5Z" /></svg>',line_height:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 22H3V20H21V22M21 4H3V2H21V4M10 13.7H14L12 8.3L10 13.7M11.2 6H12.9L17.6 18H15.6L14.7 15.4H9.4L8.5 18H6.5L11.2 6Z" /></svg>',paragraph_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,11A4,4 0 0,1 6,7A4,4 0 0,1 10,3H18V5H16V21H14V5H12V21H10V11Z" /></svg>',text_style:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,3H16V6H11V18H8V6H3V3M12,7H14V9H12V7M15,7H17V9H15V7M18,7H20V9H18V7M12,10H14V12H12V10M12,13H14V15H12V13M12,16H14V18H12V16M12,19H14V21H12V19Z" /></svg>',save:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z" /></svg>',blockquote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11 18V10H9.12L11.12 6H5.38L3 10.76V18M9 16H5V11.24L6.62 8H7.88L5.88 12H9M21 18V10H19.12L21.12 6H15.38L13 10.76V18M19 16H15V11.24L16.62 8H17.88L15.88 12H19Z" /></svg>',arrow_down:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 8.67"><g><path d="M18.79,7.52a.8.8,0,0,1,.56-.23.82.82,0,0,1,.79.79.8.8,0,0,1-.23.56l-7.07,7.07a.79.79,0,0,1-.57.25.77.77,0,0,1-.57-.25h0L4.64,8.65a.8.8,0,0,1-.23-.57.82.82,0,0,1,.79-.79.8.8,0,0,1,.56.23L12.28,14l3.26-3.26,3.25-3.26Z" transform="translate(-4.41 -7.29)"/></g></svg>',align_justify:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm0,5.9H20.15v-2H4.41v2Zm0,3.94H20.15v-2H4.41v2Zm0,3.93h7.87v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_left:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm11.8,3.94H4.41v2H16.22v-2Zm-11.8,5.9H18.18v-2H4.41v2Zm0,3.93h9.84v-2H4.41v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_right:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm3.93,5.9H20.15v-2H8.34v2Zm-2,3.94H20.14v-2H6.37v2Zm3.94,3.93h9.84v-2H10.31v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_center:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.77"><g><path d="M4.41,4.74v2H20.15v-2H4.41Zm2,3.94v2H18.18v-2H6.37Zm-1,5.9H19.16v-2H5.39v2Zm2,3.93H17.2v-2H7.36v2Z" transform="translate(-4.41 -4.74)"/></g></svg>',align_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,11H11V21H13V11H16L12,7L8,11M4,3V5H20V3H4Z" /></svg>',align_middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,19H11V23H13V19H16L12,15L8,19M16,5H13V1H11V5H8L12,9L16,5M4,11V13H20V11H4Z" /></svg>',align_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,13H13V3H11V13H8L12,17L16,13M4,19V21H20V19H4Z" /></svg>',format_float_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,7H9V13H3V7M3,3H21V5H3V3M21,7V9H11V7H21M21,11V13H11V11H21M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,7H21V13H15V7M3,3H21V5H3V3M13,7V9H3V7H13M9,11V13H3V11H9M3,15H17V17H3V15M3,19H21V21H3V19Z" /></svg>',format_float_center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,7H15V13H9V7M3,3H21V5H3V3M3,15H21V17H3V15M3,19H17V21H3V19Z" /></svg>',font_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M9.62,12L12,5.67L14.37,12M11,3L5.5,17H7.75L8.87,14H15.12L16.25,17H18.5L13,3H11Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',background_color:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M4,17L6.75,14.25L6.72,14.23C6.14,13.64 6.14,12.69 6.72,12.11L11.46,7.37L15.7,11.61L10.96,16.35C10.39,16.93 9.46,16.93 8.87,16.37L8.24,17H4M15.91,2.91C16.5,2.33 17.45,2.33 18.03,2.91L20.16,5.03C20.74,5.62 20.74,6.57 20.16,7.16L16.86,10.45L12.62,6.21L15.91,2.91Z" /><path class="se-svg-color-helper" d="M0,24H24V20H0V24Z" /></g></svg>',list_bulleted:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 12.37"><g><path d="M7.77,16.12a1.59,1.59,0,0,0-.49-1.18,1.62,1.62,0,0,0-1.19-.49,1.68,1.68,0,1,0,0,3.36,1.67,1.67,0,0,0,1.68-1.69Zm0-4.48A1.67,1.67,0,0,0,6.09,10,1.68,1.68,0,0,0,4.9,12.82a1.62,1.62,0,0,0,1.19.49,1.67,1.67,0,0,0,1.68-1.67Zm12.38,3.64a.27.27,0,0,0-.08-.19.28.28,0,0,0-.2-.09H9.19a.28.28,0,0,0-.2.08.29.29,0,0,0-.08.19V17a.27.27,0,0,0,.28.28H19.87a.27.27,0,0,0,.19-.08.24.24,0,0,0,.08-.2V15.28ZM7.77,7.13a1.63,1.63,0,0,0-.49-1.2,1.61,1.61,0,0,0-1.19-.49,1.61,1.61,0,0,0-1.19.49,1.71,1.71,0,0,0,0,2.4,1.62,1.62,0,0,0,1.19.49,1.61,1.61,0,0,0,1.19-.49,1.63,1.63,0,0,0,.49-1.2Zm12.38,3.66a.28.28,0,0,0-.08-.2.29.29,0,0,0-.19-.08H9.19a.27.27,0,0,0-.28.28v1.69a.27.27,0,0,0,.08.19.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08.25.25,0,0,0,.08-.19V10.79Zm0-4.5a.27.27,0,0,0-.08-.19A.25.25,0,0,0,19.88,6H9.19A.28.28,0,0,0,9,6.1a.26.26,0,0,0-.08.19V8A.27.27,0,0,0,9,8.17a.24.24,0,0,0,.2.08H19.87a.27.27,0,0,0,.19-.08A.25.25,0,0,0,20.14,8V6.29Z" transform="translate(-4.41 -5.44)"/></g></svg>',list_numbered:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.69 15.74"><g><path d="M7.66,18a1.24,1.24,0,0,0-.26-.78,1.17,1.17,0,0,0-.72-.42l.85-1V15H4.58v1.34h.94v-.46l.85,0h0c-.11.11-.22.23-.32.35s-.23.27-.37.47L5.39,17l.23.51c.61-.05.92.11.92.49a.42.42,0,0,1-.18.37.79.79,0,0,1-.45.12A1.41,1.41,0,0,1,5,18.15l-.51.77A2.06,2.06,0,0,0,6,19.5a1.8,1.8,0,0,0,1.2-.41A1.38,1.38,0,0,0,7.66,18Zm0-5.54H6.75V13H5.63A.72.72,0,0,1,6,12.51a5.45,5.45,0,0,1,.66-.45,2.71,2.71,0,0,0,.67-.57,1.19,1.19,0,0,0,.31-.81,1.29,1.29,0,0,0-.45-1,1.86,1.86,0,0,0-2-.11,1.51,1.51,0,0,0-.62.7l.74.52A.87.87,0,0,1,6,10.28a.51.51,0,0,1,.35.12.42.42,0,0,1,.13.33.55.55,0,0,1-.21.4,3,3,0,0,1-.5.38c-.19.13-.39.27-.58.42a2,2,0,0,0-.5.6,1.63,1.63,0,0,0-.21.81,3.89,3.89,0,0,0,.05.48h3.2V12.44Zm12.45,2.82a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2V17a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V15.26ZM7.69,7.32h-1V3.76H5.8L4.6,4.88l.63.68a1.85,1.85,0,0,0,.43-.48h0l0,2.24H4.74V8.2h3V7.32Zm12.43,3.42a.27.27,0,0,0-.08-.19.28.28,0,0,0-.21-.08H9.1a.32.32,0,0,0-.21.08.24.24,0,0,0-.08.2v1.71a.27.27,0,0,0,.08.19.3.3,0,0,0,.21.08H19.83a.32.32,0,0,0,.21-.08.25.25,0,0,0,.08-.19V10.74Zm0-4.52A.27.27,0,0,0,20,6,.28.28,0,0,0,19.83,6H9.1A.32.32,0,0,0,8.89,6a.24.24,0,0,0-.08.19V7.93a.27.27,0,0,0,.08.19.32.32,0,0,0,.21.08H19.83A.32.32,0,0,0,20,8.12a.26.26,0,0,0,.08-.2V6.22Z" transform="translate(-4.43 -3.76)"/></g></svg>',list_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,19V17H8V19H21M21,13V11H8V13H21M8,7H21V5H8V7M4,5V7H6V5H4M3,5A1,1 0 0,1 4,4H6A1,1 0 0,1 7,5V7A1,1 0 0,1 6,8H4A1,1 0 0,1 3,7V5M4,11V13H6V11H4M3,11A1,1 0 0,1 4,10H6A1,1 0 0,1 7,11V13A1,1 0 0,1 6,14H4A1,1 0 0,1 3,13V11M4,17V19H6V17H4M3,17A1,1 0 0,1 4,16H6A1,1 0 0,1 7,17V19A1,1 0 0,1 6,20H4A1,1 0 0,1 3,19V17Z" /></svg>',table:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M4.41,8.05V3.76H8.7V8.05H4.41Zm5.71,0V3.76h4.3V8.05h-4.3Zm5.74-4.29h4.29V8.05H15.86V3.76Zm-11.45,10V9.48H8.7v4.3H4.41Zm5.71,0V9.48h4.3v4.3h-4.3Zm5.74,0V9.48h4.29v4.3H15.86ZM4.41,19.5V15.21H8.7V19.5H4.41Zm5.71,0V15.21h4.3V19.5h-4.3Zm5.74,0V15.21h4.29V19.5H15.86Z" transform="translate(-4.41 -3.76)"/></g></svg>',table_header:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 15.74"><g><path d="M17,19.5v-.78H15.5v.78H17Zm-3,0v-.78H12.5v.78H14Zm-3,0v-.78H9.53v.78H11Zm-3,0v-.78H6.53v.78H8Zm10.55,0a1.73,1.73,0,0,0,.85-.35,1.67,1.67,0,0,0,.56-.76l-.71-.31a1.21,1.21,0,0,1-.35.4,1.34,1.34,0,0,1-.53.23l.08.38c.06.24.09.38.1.41Zm-13.7-.63.55-.55A.77.77,0,0,1,5.25,18a1.31,1.31,0,0,1-.06-.38v-.38H4.41v.38a2,2,0,0,0,.12.68,1.6,1.6,0,0,0,.35.57Zm15.27-2.12V15.26h-.78v1.49h.78Zm-15-1V14.23H4.41v1.49h.78Zm15-2V12.26h-.78v1.49h.78Zm-15-1V11.22H4.41v1.51h.78Zm15-2V9.26h-.78v1.51h.78Zm-15-1V8.17H4.41V9.74h.78Zm15-2V6.28h-.78V7.77h.78Zm-15-1.11V5.33L4.48,5.1a.77.77,0,0,0-.07.27,2.72,2.72,0,0,0,0,.28v1h.79ZM19.21,5l.63-.4A1.62,1.62,0,0,0,19.16,4a1.94,1.94,0,0,0-.91-.22v.78a1.31,1.31,0,0,1,.56.12.88.88,0,0,1,.4.36ZM6,4.54H7.78V3.76H6a.82.82,0,0,0-.28.06l.12.35c.07.21.1.33.11.36Zm10.8,0V3.76H15.28v.78h1.49Zm-3,0V3.76H12.28v.78h1.49Zm-3,0V3.76H9.28v.78h1.51ZM6,10.84h12.6V6.91H6Z" transform="translate(-4.4 -3.76)"/></g></svg>',table_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.88 12L2.2 16.06L6.26 17.74L7.94 21.8L11 20.53V18.36L9 19.19L7.79 16.21L4.81 15L6.05 12L4.81 9L7.79 7.79L9 4.81L12 6.05L15 4.81L16.21 7.79L19.19 9L17.95 12L18 12.13L19.38 10.75C19.82 10.3 20.38 10.06 20.94 10L21.8 7.94L17.74 6.26L16.06 2.2L12 3.88L7.94 2.2L6.26 6.26L2.2 7.94L3.88 12M22.85 13.47L21.53 12.15C21.33 11.95 21 11.95 20.81 12.15L19.83 13.13L21.87 15.17L22.85 14.19C23.05 14 23.05 13.67 22.85 13.47M13 19.96V22H15.04L21.17 15.88L19.13 13.83L13 19.96Z" /></svg>',cell_properties:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.58,17L12,14.84L8.42,17L9.37,12.93L6.21,10.2L10.38,9.84L12,6L13.62,9.83L17.79,10.19L14.63,12.92L15.58,17M19,3A2,2 0 0,1 21,5V19C21,20.11 20.1,21 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',table_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,2H16A2,2 0 0,1 18,4V20A2,2 0 0,1 16,22H8A2,2 0 0,1 6,20V4A2,2 0 0,1 8,2M8,10V14H16V10H8M8,16V20H16V16H8M8,4V8H16V4H8Z" /></svg>',table_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,1 20,16H4A2,2 0 0,1 2,14V10A2,2 0 0,1 4,8H20A2,2 0 0,1 22,10V14M4,14H8V10H4V14M10,14H14V10H10V14M16,14H20V10H16V14Z" /></svg>',color_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z" /></svg>',color_palette:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z" /></svg>',border_all:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,11H13V5H19M19,19H13V13H19M11,11H5V5H11M11,19H5V13H11M3,21H21V3H3V21Z" /></svg>',border_inside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,17H21V15H19M19,21H21V19H19M13,3H11V11H3V13H11V21H13V13H21V11H13M15,21H17V19H15M19,5H21V3H19M19,9H21V7H19M17,3H15V5H17M5,3H3V5H5M9,3H7V5H9M3,17H5V15H3M5,7H3V9H5M7,21H9V19H7M3,21H5V19H3V21Z" /></svg>',border_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H21V19H19M15,21H17V19H15M11,17H13V15H11M19,9H21V7H19M19,5H21V3H19M3,13H21V11H3M11,21H13V19H11M19,17H21V15H19M13,3H11V5H13M13,7H11V9H13M17,3H15V5H17M9,3H7V5H9M5,3H3V5H5M7,21H9V19H7M3,17H5V15H3M5,7H3V9H5M3,21H5V19H3V21Z" /></svg>',border_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M15,21H17V19H15M15,5H17V3H15M19,9H21V7H19M19,5H21V3H19M19,13H21V11H19M19,21H21V19H19M11,21H13V3H11M19,17H21V15H19M7,5H9V3H7M3,17H5V15H3M3,21H5V19H3M3,13H5V11H3M7,13H9V11H7M7,21H9V19H7M3,5H5V3H3M3,9H5V7H3V9Z" /></svg>',border_outside:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9,11H7V13H9M13,15H11V17H13M19,19H5V5H19M3,21H21V3H3M17,11H15V13H17M13,11H11V13H13M13,7H11V9H13V7Z" /></svg>',border_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M19,21H21V19H19M19,13H21V11H19M19,5H21V3H19M19,17H21V15H19M15,21H17V19H15M19,9H21V7H19M3,21H5V3H3M7,13H9V11H7M7,5H9V3H7M7,21H9V19H7M11,13H13V11H11M11,9H13V7H11M11,5H13V3H11M11,17H13V15H11M11,21H13V19H11V21Z" /></svg>',border_top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,13H17V11H15M19,21H21V19H19M11,9H13V7H11M15,21H17V19H15M19,17H21V15H19M3,5H21V3H3M19,13H21V11H19M19,9H21V7H19M11,17H13V15H11M3,9H5V7H3M3,13H5V11H3M3,21H5V19H3M3,17H5V15H3M11,21H13V19H11M11,13H13V11H11M7,13H9V11H7M7,21H9V19H7V21Z" /></svg>',border_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,5H13V3H11M15,5H17V3H15M15,21H17V19H15M19,21H21V3H19M3,9H5V7H3M3,17H5V15H3M3,13H5V11H3M11,21H13V19H11M3,21H5V19H3M7,5H9V3H7M3,5H5V3H3M7,21H9V19H7V21Z" /></svg>',border_bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,15H3V17H5M3,21H21V19H3M5,11H3V13H5M19,9H21V7H19M19,5H21V3H19M5,7H3V9H5M19,17H21V15H19M19,13H21V11H19M17,3H15V5H17M13,3H11V5H13M5,3H3V5H5M9,3H7V5H9" /></svg>',border_none:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15,5H17V3H15M15,13H17V11H15M15,21H17V19H15M11,5H13V3H11M19,5H21V3H19M11,9H13V7H11M19,9H21V7H19M19,21H21V19H19M19,13H21V11H19M19,17H21V15H19M11,13H13V11H11M3,5H5V3H3M3,9H5V7H3M3,13H5V11H3M3,17H5V15H3M3,21H5V19H3M11,21H13V19H11M11,17H13V15H11M7,21H9V19H7M7,13H9V11H7M7,5H9V3H7V5Z" /></svg>',horizontal_line:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 2.24"><g><path d="M20.15,12.75V10.51H4.41v2.24H20.15Z" transform="translate(-4.41 -10.51)"/></g></svg>',show_blocks:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 3C3.9 3 3 3.9 3 5S2.1 7 1 7V9C2.1 9 3 9.9 3 11S3.9 13 5 13H7V11H5V10C5 8.9 4.1 8 3 8C4.1 8 5 7.1 5 6V5H7V3M11 3C12.1 3 13 3.9 13 5S13.9 7 15 7V9C13.9 9 13 9.9 13 11S12.1 13 11 13H9V11H11V10C11 8.9 11.9 8 13 8C11.9 8 11 7.1 11 6V5H9V3H11M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V15H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" /></svg>',cancel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',selection_remove:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 20V17H22V20C22 21.11 21.1 22 20 22H17V20H20M2 20V17H4V20H7V22H4C2.9 22 2 21.1 2 20M10 20H14V22H10V20M14.59 8L12 10.59L9.41 8L8 9.41L10.59 12L8 14.59L9.41 16L12 13.41L14.59 16L16 14.59L13.41 12L16 9.41L14.59 8M20 10H22V14H20V10M2 10H4V14H2V10M2 4C2 2.89 2.9 2 4 2H7V4H4V7H2V4M22 4V7H20V4H17V2H20C21.1 2 22 2.9 22 4M10 2H14V4H10V2Z" /></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M13.96,12.29L11.21,15.83L9.25,13.47L6.5,17H17.5L13.96,12.29Z" /></svg>',image_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M17,13V19H7L12,14L14,16M10,10.5A1.5,1.5 0 0,1 8.5,12A1.5,1.5 0 0,1 7,10.5A1.5,1.5 0 0,1 8.5,9A1.5,1.5 0 0,1 10,10.5Z" /></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,19H5V5H19M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10,8V16L15,12L10,8Z" /></svg>',video_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M16,18L13.5,16.3V18H8V13H13.5V14.7L16,13V18Z" /></svg>',link:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z" /></svg>',link_rel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 1C1.89 1 1 1.89 1 3V14C1 15.11 1.89 16 3 16H14C15.11 16 16 15.11 16 14V11H14V14H3V3H14V5H16V3C16 1.89 15.11 1 14 1M9 7C7.89 7 7 7.89 7 9V12H9V9H20V20H9V18H7V20C7 21.11 7.89 22 9 22H20C21.11 22 22 21.11 22 20V9C22 7.89 21.11 7 20 7H9" /></svg>',math:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.81 15.73"><g><path d="M17.19,5.73a1,1,0,0,0,.71-.29,1,1,0,0,0,.28-.7,1,1,0,0,0-1-1H7.35a1,1,0,0,0-1,1,.77.77,0,0,0,.13.47h0l4.58,6.43L6.68,17.81a1.25,1.25,0,0,0-.29.71.94.94,0,0,0,.28.7.92.92,0,0,0,.69.28H17.2a1,1,0,0,0,.71-.28,1,1,0,0,0,0-1.39.92.92,0,0,0-.71-.29H9.26l3.87-5.43a.86.86,0,0,0,0-.95L9.26,5.73h7.93Z" transform="translate(-6.38 -3.77)"/></g></svg>',unlink:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.43 19.12,14.63 17.79,15L19.25,16.44C20.88,15.61 22,13.95 22,12A5,5 0 0,0 17,7M16,11H13.81L15.81,13H16V11M2,4.27L5.11,7.38C3.29,8.12 2,9.91 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12C3.9,10.41 5.11,9.1 6.66,8.93L8.73,11H8V13H10.73L13,15.27V17H14.73L18.74,21L20,19.74L3.27,3L2,4.27Z" /></svg>',merge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4M8,13V15L11,12L8,9V11H3V13H8M16,11V9L13,12L16,15V13H21V11H16Z" /></svg>',split_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 14H21V20H3V14H5V18H19V14M3 4V10H5V6H19V10H21V4H3M11 11V13H8V15L5 12L8 9V11H11M16 11V9L19 12L16 15V13H13V11H16Z" /></svg>',unmerge_cell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,10H3V4H11V6H5V10M19,18H13V20H21V14H19V18M5,18V14H3V20H11V18H5M21,4H13V6H19V10H21V4"/><line x1="7.5" y1="12" x2="16.5" y2="12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',caption:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 13.79"><g><path d="M4.41,18.52H20.15v-2H4.41ZM20,4.73H18.07V6h.65v.65H20V4.73ZM17,6V4.73H14.55V6H17ZM13.49,6V4.73H11V6h2.47ZM10,6V4.73H7.5V6H10ZM5.79,6h.65V4.73H4.5V6.67H5.8V6ZM4.5,11.34H5.79V8.48H4.5ZM6.44,13.8H5.79v-.65H4.5v1.94H6.44ZM17,15.09V13.8H14.55v1.29H17Zm-3.52,0V13.8H11v1.29h2.47Zm-3.53,0V13.8H7.5v1.29H10ZM20,13.16H18.72v.65h-.65V15.1H20Zm-1.29-1.82H20V8.48h-1.3v2.86Z" transform="translate(-4.41 -4.73)"/></g></svg>',edit:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.73"><g><path d="M7.51,5.68h6l1.52-1.57H6.94a2.4,2.4,0,0,0-1.79.82A2.8,2.8,0,0,0,4.41,6.8V17a2.55,2.55,0,0,0,.75,1.8A2.48,2.48,0,0,0,7,19.5H17.22a2.57,2.57,0,0,0,1.83-.74,2.52,2.52,0,0,0,.77-1.8V8.83l-1.58,1.54v6a1.54,1.54,0,0,1-1.53,1.53H7.51A1.54,1.54,0,0,1,6,16.41V7.21A1.52,1.52,0,0,1,7.51,5.68Zm5.63,7.47h0L10.7,10.74l-1,3.38,1.71-.48,1.7-.49Zm.34-.34h0l5.36-5.32L16.4,5.08,11,10.4l1.23,1.21,1.21,1.2ZM19.93,6.4a.82.82,0,0,0,.22-.48A.54.54,0,0,0,20,5.47L18.45,4A.67.67,0,0,0,18,3.77a.7.7,0,0,0-.48.21l-.74.72,2.44,2.43.37-.37.35-.36Z" transform="translate(-4.41 -3.77)"/></g></svg>',delete:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.74"><g><path d="M19.16,6.71a.94.94,0,0,0,.69-.28.91.91,0,0,0,.29-.68A1,1,0,0,0,19.85,5a.93.93,0,0,0-.69-.3H14.24A.94.94,0,0,0,14,4.06a.92.92,0,0,0-.7-.3h-2a1,1,0,0,0-.7.3.93.93,0,0,0-.28.68H5.39A.92.92,0,0,0,4.7,5a1,1,0,0,0-.29.71.91.91,0,0,0,.29.68,1,1,0,0,0,.69.28H19.16Zm-12.79,1a1,1,0,0,0-.7.3.94.94,0,0,0-.28.69v8.85A1.88,1.88,0,0,0,6,18.93a1.9,1.9,0,0,0,1.39.57H17.2a1.87,1.87,0,0,0,1.39-.58,1.91,1.91,0,0,0,.58-1.39V8.68A1,1,0,0,0,18.88,8a.89.89,0,0,0-.7-.29,1,1,0,0,0-.69.29.92.92,0,0,0-.29.68v7.87a1,1,0,0,1-1,1H8.34a.94.94,0,0,1-.69-.28,1,1,0,0,1-.29-.71V8.68a1,1,0,0,0-1-1Z" transform="translate(-4.41 -3.76)"/></g></svg>',revert:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.76 14.69"><g><path d="M18.26,15V12.3l1.89-2V15a2.58,2.58,0,0,1-.24,1c-.2.58-.75.92-1.65,1H7.56v2L4.41,15.63,7.56,13v2h10.7ZM6.3,8.28V11L4.41,13V8.28a2.58,2.58,0,0,1,.24-1c.2-.58.75-.92,1.65-1H17v-2l3.15,3.34L17,10.3v-2H6.3Z" transform="translate(-4.4 -4.28)"/></g></svg>',auto_size:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 15.74"><g><path d="M6.71,17.19,6.89,16l1.21-.15A6,6,0,0,1,6.81,13.9a5.78,5.78,0,0,1-.45-2.27A6,6,0,0,1,8.1,7.45a5.83,5.83,0,0,1,4.17-1.73l1-1-1-1A7.89,7.89,0,0,0,5,14.64a7.73,7.73,0,0,0,1.71,2.55Zm5.57,2.31h0A7.86,7.86,0,0,0,17.85,6.07L17.67,7.3l-1.21.15a5.9,5.9,0,0,1,1.29,1.92,5.81,5.81,0,0,1,.45,2.26,5.91,5.91,0,0,1-5.9,5.9l-1,1,.49.49.47.5Z" transform="translate(-4.41 -3.76)"/></g></svg>',resize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M23,15H21V17H23V15M23,11H21V13H23V11M23,19H21V21C22,21 23,20 23,19M15,3H13V5H15V3M23,7H21V9H23V7M21,3V5H23C23,4 22,3 21,3M3,21H11V15H1V19A2,2 0 0,0 3,21M3,7H1V9H3V7M15,19H13V21H15V19M19,3H17V5H19V3M19,19H17V21H19V19M3,3C2,3 1,4 1,5H3V3M3,11H1V13H3V11M11,3H9V5H11V3M7,3H5V5H7V3Z" /></svg>',insert_row_below:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,10A2,2 0 0,1 20,12H4A2,2 0 0,1 2,10V3H4V5H8V3H10V5H14V3H16V5H20V3H22V10M4,10H8V7H4V10M10,10H14V7H10V10M20,10V7H16V10H20M11,14H13V17H16V19H13V22H11V19H8V17H11V14Z" /></svg>',insert_row_above:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,14A2,2 0 0,0 20,12H4A2,2 0 0,0 2,14V21H4V19H8V21H10V19H14V21H16V19H20V21H22V14M4,14H8V17H4V14M10,14H14V17H10V14M20,14V17H16V14H20M11,10H13V7H16V5H13V2H11V5H8V7H11V10Z" /></svg>',insert_column_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,2A2,2 0 0,0 11,4V20A2,2 0 0,0 13,22H22V2H13M20,10V14H13V10H20M20,16V20H13V16H20M20,4V8H13V4H20M9,11H6V8H4V11H1V13H4V16H6V13H9V11Z" /></svg>',insert_column_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,2A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H2V2H11M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M15,11H18V8H20V11H23V13H20V16H18V13H15V11Z" /></svg>',delete_row:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.41,13L12,15.59L14.59,13L16,14.41L13.41,17L16,19.59L14.59,21L12,18.41L9.41,21L8,19.59L10.59,17L8,14.41L9.41,13M22,9A2,2 0 0,1 20,11H4A2,2 0 0,1 2,9V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V9M4,9H8V6H4V9M10,9H14V6H10V9M16,9H20V6H16V9Z" /></svg>',delete_column:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4,2H11A2,2 0 0,1 13,4V20A2,2 0 0,1 11,22H4A2,2 0 0,1 2,20V4A2,2 0 0,1 4,2M4,10V14H11V10H4M4,16V20H11V16H4M4,4V8H11V4H4M17.59,12L15,9.41L16.41,8L19,10.59L21.59,8L23,9.41L20.41,12L23,14.59L21.59,16L19,13.41L16.41,16L15,14.59L17.59,12Z" /></svg>',fixed_column_width:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,8H19A2,2 0 0,1 21,10V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V10A2,2 0 0,1 5,8M5,12V15H11V12H5M13,12V15H19V12H13M5,17V20H11V17H5M13,17V20H19V17H13M11,2H21V6H19V4H13V6H11V2Z" /></svg>',rotate_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,4.07V1L8.45,5.55L13,10V6.09C15.84,6.57 18,9.03 18,12C18,14.97 15.84,17.43 13,17.91V19.93C16.95,19.44 20,16.08 20,12C20,7.92 16.95,4.56 13,4.07M7.1,18.32C8.26,19.22 9.61,19.76 11,19.93V17.9C10.13,17.75 9.29,17.41 8.54,16.87L7.1,18.32M6.09,13H4.07C4.24,14.39 4.79,15.73 5.69,16.89L7.1,15.47C6.58,14.72 6.23,13.88 6.09,13M7.11,8.53L5.7,7.11C4.8,8.27 4.24,9.61 4.07,11H6.09C6.23,10.13 6.58,9.28 7.11,8.53Z" /></svg>',rotate_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.89,15.5L18.31,16.89C19.21,15.73 19.76,14.39 19.93,13H17.91C17.77,13.87 17.43,14.72 16.89,15.5M13,17.9V19.92C14.39,19.75 15.74,19.21 16.9,18.31L15.46,16.87C14.71,17.41 13.87,17.76 13,17.9M19.93,11C19.76,9.61 19.21,8.27 18.31,7.11L16.89,8.53C17.43,9.28 17.77,10.13 17.91,11M15.55,5.55L11,1V4.07C7.06,4.56 4,7.92 4,12C4,16.08 7.05,19.44 11,19.93V17.91C8.16,17.43 6,14.97 6,12C6,9.03 8.16,6.57 11,6.09V10L15.55,5.55Z" /></svg>',mirror_horizontal:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.75 15.74"><g><path d="M13.75,3.76l5.9,15.74h-5.9V3.76ZM4.9,19.5,10.8,3.76V19.5H4.9Z" transform="translate(-4.9 -3.76)"/></g></svg>',mirror_vertical:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.74 14.75"><g><path d="M20.15,13.1,4.41,19V13.1H20.15ZM4.41,4.25l15.74,5.9H4.41V4.25Z" transform="translate(-4.41 -4.25)"/></g></svg>',checked:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.75 12.1"><g><path d="M4.59,12.23l.12.18L9.43,17.5a.58.58,0,0,0,.84,0L20,7.45h0a.58.58,0,0,0,0-.84l-.85-.85a.58.58,0,0,0-.84,0H18.2l-8.12,8.41a.29.29,0,0,1-.42,0l-3.4-3.63a.58.58,0,0,0-.84,0l-.85.85a.6.6,0,0,0-.14.21.51.51,0,0,0,0,.44c.05.06.1.13.16.19Z" transform="translate(-4.38 -5.58)"/></g></svg>',line_break:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,6a1,1,0,0,0-1,1v4a1,1,0,0,1-1,1H7.41l1.3-1.29A1,1,0,0,0,7.29,9.29l-3,3a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76,1,1,0,0,0,.21.33l3,3a1,1,0,0,0,1.42,0,1,1,0,0,0,0-1.42L7.41,14H17a3,3,0,0,0,3-3V7A1,1,0,0,0,19,6Z"/></svg>',audio:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,9H13V14.5A2.5,2.5 0 0,1 10.5,17A2.5,2.5 0 0,1 8,14.5A2.5,2.5 0 0,1 10.5,12C11.07,12 11.58,12.19 12,12.5V7H16V9M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5A2,2 0 0,1 5,3H19M5,5V19H19V5H5Z" /></svg>',audio_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6A2,2 0 0,0 20,4M7.76,16.24L6.35,17.65C4.78,16.1 4,14.05 4,12C4,9.95 4.78,7.9 6.34,6.34L7.75,7.75C6.59,8.93 6,10.46 6,12C6,13.54 6.59,15.07 7.76,16.24M12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16M17.66,17.66L16.25,16.25C17.41,15.07 18,13.54 18,12C18,10.46 17.41,8.93 16.24,7.76L17.65,6.35C19.22,7.9 20,9.95 20,12C20,14.05 19.22,16.1 17.66,17.66M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10Z" /></svg>',image_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,17H7V3H21M21,1H7A2,2 0 0,0 5,3V17A2,2 0 0,0 7,19H21A2,2 0 0,0 23,17V3A2,2 0 0,0 21,1M3,5H1V21A2,2 0 0,0 3,23H19V21H3M15.96,10.29L13.21,13.83L11.25,11.47L8.5,15H19.5L15.96,10.29Z" /></svg>',audio_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M20,16H8V4H20M12.5,15A2.5,2.5 0 0,0 15,12.5V7H18V5H14V10.5C13.58,10.19 13.07,10 12.5,10A2.5,2.5 0 0,0 10,12.5A2.5,2.5 0 0,0 12.5,15M4,6H2V20A2,2 0 0,0 4,22H18V20H4" /></svg>',video_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6H2V20C2 21.1 2.9 22 4 22H18V20H4V6M20 4V16H8V4H20M20 2H8C6.9 2 6 2.9 6 4V16C6 17.1 6.9 18 8 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M12 14.5V5.5L18 10L12 14.5Z" /></svg>',file_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,15H9V13H16V15M19,11H9V9H19V11M19,7H9V5H19V7M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3M21,1A2,2 0 0,1 23,3V17C23,18.11 22.11,19 21,19H7A2,2 0 0,1 5,17V3C5,1.89 5.89,1 7,1H21M7,3V17H21V3H7Z" /></svg>',file_browser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 6V20H20V22H2C.895 22 0 21.11 0 20V6H2M12.78 10.05L15.81 9.79L17 7L18.19 9.79L21.22 10.05L18.92 12.04L19.61 15L17 13.47L14.39 15L15.08 12.04L12.78 10.05M24 6V16C24 17.11 23.11 18 22 18H6C4.9 18 4 17.11 4 16V4C4 2.89 4.9 2 6 2H12L14 4H22C23.11 4 24 4.9 24 6M22 6H6V16H22V6Z" /></svg>',bookmark:'<svg viewBox="0 0 24 24"><path d="M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',bookmark_anchor:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17,18L12,15.82L7,18V5H17M17,3H7A2,2 0 0,0 5,5V21L12,18L19,21V5C19,3.89 18.1,3 17,3Z" /></svg>',download:'<svg viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 15L17.55 9.54L16.13 8.13L13 11.25V2H11V11.25L7.88 8.13L6.46 9.55L12 15Z" /></svg>',dir_ltr:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M9 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2H9C6.79 2 5 3.79 5 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zm0 12v3H5v2h12v3l4-4-4-4z"/></svg>',dir_rtl:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M10 4v4c-1.1 0-2-.9-2-2s.9-2 2-2m8-2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4v5h2V4h2v11h2V4h2V2zM8 14l-4 4 4 4v-3h12v-2H8v-3z"/></svg>',file_upload:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2L20,8V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2H14M18,20V9H13V4H6V20H18M12,12L16,16H13.5V19H10.5V16H8L12,12Z" /></svg>',file_thumbnail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" /></svg>',file_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.81 22H6C4.89 22 4 21.11 4 20V4C4 2.9 4.89 2 6 2H14L20 8V13.09C19.67 13.04 19.34 13 19 13S18.33 13.04 18 13.09V9H13V4H6V20H13.09C13.21 20.72 13.46 21.39 13.81 22M23 18H20V15H18V18H15V20H18V23H20V20H23V18Z" /></svg>',upload_tray:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 12H4V17H20V12H22V17C22 18.11 21.11 19 20 19H4C2.9 19 2 18.11 2 17V12M12 2L6.46 7.46L7.88 8.88L11 5.75V15H13V5.75L16.13 8.88L17.55 7.45L12 2Z" /></svg>',folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z" /></svg>',plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z" /></svg>',minus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,13H5V11H19V13Z" /></svg>',selection:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,4C2,2.89 2.9,2 4,2H7V4H4V7H2V4M22,4V7H20V4H17V2H20A2,2 0 0,1 22,4M20,20V17H22V20C22,21.11 21.1,22 20,22H17V20H20M2,20V17H4V20H7V22H4A2,2 0 0,1 2,20M10,2H14V4H10V2M10,20H14V22H10V20M20,10H22V14H20V10M2,10H4V14H2V10Z" /></svg>',copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" /></svg>',cut:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z" /></svg>',PDF:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M9.5 11.5C9.5 12.3 8.8 13 8 13H7V15H5.5V9H8C8.8 9 9.5 9.7 9.5 10.5V11.5M14.5 13.5C14.5 14.3 13.8 15 13 15H10.5V9H13C13.8 9 14.5 9.7 14.5 10.5V13.5M18.5 10.5H17V11.5H18.5V13H17V15H15.5V9H18.5V10.5M12 10.5H13V13.5H12V10.5M7 10.5H8V11.5H7V10.5Z" /></svg>',format_paint:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,4V3A1,1 0 0,0 17,2H5A1,1 0 0,0 4,3V7A1,1 0 0,0 5,8H17A1,1 0 0,0 18,7V6H19V10H9V21A1,1 0 0,0 10,22H12A1,1 0 0,0 13,21V12H21V4H18Z" /></svg>',find_replace:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6C12.38,6 13.63,6.56 14.54,7.46L12,10H18V4L15.95,6.05C14.68,4.78 12.93,4 11,4C7.47,4 4.57,6.61 4.08,10H6.1C6.56,7.72 8.58,6 11,6M16.64,15.14C17.3,14.24 17.76,13.17 17.92,12H15.9C15.44,14.28 13.42,16 11,16C9.62,16 8.37,15.44 7.46,14.54L10,12H4V18L6.05,15.95C7.32,17.22 9.07,18 11,18C12.55,18 14,17.5 15.14,16.64L20,21.5L21.5,20L16.64,15.14Z" /></svg>',drawing:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.75 20.85C11.53 20.15 11.14 18.22 10.24 17C9.35 15.75 8.12 14.89 6.88 14.06C6 13.5 5.19 12.8 4.54 12C4.26 11.67 3.69 11.06 4.27 10.94C4.86 10.82 5.88 11.4 6.4 11.62C7.31 12 8.21 12.44 9.05 12.96L10.06 11.26C8.5 10.23 6.5 9.32 4.64 9.05C3.58 8.89 2.46 9.11 2.1 10.26C1.78 11.25 2.29 12.25 2.87 13.03C4.24 14.86 6.37 15.74 7.96 17.32C8.3 17.65 8.71 18.04 8.91 18.5C9.12 18.94 9.07 18.97 8.6 18.97C7.36 18.97 5.81 18 4.8 17.36L3.79 19.06C5.32 20 7.88 21.47 9.75 20.85M20.84 5.25C21.06 5.03 21.06 4.67 20.84 4.46L19.54 3.16C19.33 2.95 18.97 2.95 18.76 3.16L17.74 4.18L19.82 6.26M11 10.92V13H13.08L19.23 6.85L17.15 4.77L11 10.92Z" /></svg>',eraser:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.14,3C14.63,3 14.12,3.2 13.73,3.59L2.59,14.73C1.81,15.5 1.81,16.77 2.59,17.56L5.03,20H12.69L21.41,11.27C22.2,10.5 22.2,9.23 21.41,8.44L16.56,3.59C16.17,3.2 15.65,3 15.14,3M17,18L15,20H22V18" /></svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>',selection_search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.27 18.9C19.7 18.21 19.95 17.38 19.95 16.5C19.95 14 17.95 12 15.46 12S10.96 14 10.96 16.5 12.96 21 15.46 21C16.33 21 17.15 20.75 17.84 20.32L20.96 23.39L22.35 22L19.27 18.9M15.46 19C14.07 19 12.96 17.88 12.96 16.5S14.07 14 15.46 14 17.95 15.12 17.95 16.5 16.84 19 15.46 19M22 14H21.45C21.12 13.19 20.62 12.47 20 11.86V10H22V14M20 4H17V2H20C21.11 2 22 2.9 22 4V7H20V4M14 4H10V2H14V4M4 2H7V4H4V7H2V4C2 2.89 2.9 2 4 2M12 22H10V20C10.5 20.82 11.2 21.5 12 22M4 20H7V22H4C2.9 22 2 21.11 2 20V17H4V20M4 14H2V10H4V14Z" /></svg>',embed:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 19H15V21H19C20.1 21 21 20.1 21 19V15H19M19 3H15V5H19V9H21V5C21 3.9 20.1 3 19 3M5 5H9V3H5C3.9 3 3 3.9 3 5V9H5M5 15H3V19C3 20.1 3.9 21 5 21H9V19H5V15M7 11H9V13H7V11M11 11H13V13H11V11M15 11H17V13H15V11Z" /></svg>',menu_arrow_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,10L12,15L17,10H7Z" /></svg>',menu_arrow_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7,15L12,10L17,15H7Z" /></svg>',menu_arrow_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,17L15,12L10,7V17Z" /></svg>',menu_arrow_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,7L9,12L14,17V7Z" /></svg>',side_menu_hamburger:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /></svg>',side_menu_folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4A2,2 0 0,1 24,6V16A2,2 0 0,1 22,18H6A2,2 0 0,1 4,16V4A2,2 0 0,1 6,2H12L14,4H22M2,6V20H20V22H2A2,2 0 0,1 0,20V11H0V6H2M6,6V16H22V6H6Z" /></svg>',side_menu_folder_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,4H14L12,2H6A2,2 0 0,0 4,4V16A2,2 0 0,0 6,18H22A2,2 0 0,0 24,16V6A2,2 0 0,0 22,4M2,6H0V11H0V20A2,2 0 0,0 2,22H20V20H2V6Z" /></svg>',side_menu_item:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z" /></svg>',side_menu_folder_plus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 19C13 19.34 13.04 19.67 13.09 20H4C2.9 20 2 19.11 2 18V6C2 4.89 2.89 4 4 4H10L12 6H20C21.1 6 22 6.89 22 8V13.81C21.12 13.3 20.1 13 19 13C15.69 13 13 15.69 13 19M20 18V15H18V18H15V20H18V23H20V20H23V18H20Z" /></svg>',alert_outline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" /></svg>',more_media:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 13V5C9 3.9 9.9 3 11 3H20C21.1 3 22 3.9 22 5V11H18.57L17.29 9.26C17.23 9.17 17.11 9.17 17.05 9.26L15.06 12C15 12.06 14.88 12.07 14.82 12L13.39 10.25C13.33 10.18 13.22 10.18 13.16 10.25L11.05 12.91C10.97 13 11.04 13.15 11.16 13.15H17.5V15H11C9.89 15 9 14.11 9 13M6 22V21H4V22H2V2H4V3H6V2H8.39C7.54 2.74 7 3.8 7 5V13C7 15.21 8.79 17 11 17H15.7C14.67 17.83 14 19.08 14 20.5C14 21.03 14.11 21.53 14.28 22H6M4 7H6V5H4V7M4 11H6V9H4V11M4 15H6V13H4V15M6 19V17H4V19H6M23 13V15H21V20.5C21 21.88 19.88 23 18.5 23S16 21.88 16 20.5 17.12 18 18.5 18C18.86 18 19.19 18.07 19.5 18.21V13H23Z" /></svg>',more_gallery:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6V20H18V22H3C2.4 22 2 21.6 2 21V6H4M8 2H20C21.11 2 22 2.9 22 4V16C22 17.11 21.11 18 20 18H8C6.9 18 6 17.11 6 16V4C6 2.9 6.9 2 8 2M16.3 13.3L15.9 10.7L17.8 8.8L15.2 8.4L14 6L12.8 8.4L10.2 8.8L12.1 10.6L11.6 13.2L14 12L16.3 13.3Z" /></svg>',more_folder:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 20V6H0V20C0 21.1 .9 22 2 22H20V20H2M22 4H14L12 2H6C5.6 2 5.2 2.1 4.9 2.3L4.3 2.9C4.1 3.2 4 3.6 4 4V16C4 16.4 4.1 16.8 4.3 17.1C4.4 17.2 4.5 17.3 4.5 17.4C5 17.8 5.5 18 6 18H22C23.1 18 24 17.1 24 16V6C24 4.9 23.1 4 22 4M22 12H19V15H17V12H14V10H17V7H19V10H22V12Z" /></svg>',more_list:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 14V17H14V19H17V22H19V19H22V17H19V14M20 11V12.3C19.4 12.1 18.7 12 18 12C16.8 12 15.6 12.4 14.7 13H7V11H20M12.1 17H7V15H12.8C12.5 15.6 12.2 16.3 12.1 17M7 7H20V9H7V7M5 19H7V21H3V3H7V5H5V19Z" /></svg>',more_file:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2M18 20H6V4H13V9H18V20M9.5 18L10.2 15.2L8 13.3L10.9 13.1L12 10.4L13.1 13L16 13.2L13.8 15.1L14.5 17.9L12 16.5L9.5 18Z" /></svg>',more_view:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 21H11V13H3M5 15H9V19H5M3 11H11V3H3M5 5H9V9H5M13 3V11H21V3M19 9H15V5H19M18 16H21V18H18V21H16V18H13V16H16V13H18Z" /></svg>',more_page:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,3H5A2,2 0 0,0 3,5V9H5V5H22V19H5V15H3V19A2,2 0 0,0 5,21H22A2,2 0 0,0 24,19V5A2,2 0 0,0 22,3M7,15V13H0V11H7V9L11,12L7,15M20,13H13V11H20V13M20,9H13V7H20V9M17,17H13V15H17V17Z" /></svg>',more_text:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M49.711,142.188h49.027c2.328,0.002,4.394,1.492,5.129,3.699l9.742,29.252c0.363,1.092,1.385,1.828,2.537,1.83l15.883,0.01c0.859,0,1.667-0.412,2.17-1.109s0.641-1.594,0.37-2.41l-16.625-50.045L86.503,28.953c-0.36-1.097-1.383-1.839-2.537-1.842H64.532c-1.153-0.001-2.178,0.736-2.542,1.831L13.847,173.457c-0.271,0.816-0.135,1.713,0.369,2.412c0.503,0.697,1.311,1.109,2.171,1.109h15.872c1.151,0,2.173-0.736,2.537-1.828l9.793-29.287C45.325,143.66,47.39,142.18,49.711,142.188L49.711,142.188z M53.493,119.098l15.607-46.9c0.744-2.196,2.806-3.674,5.125-3.674s4.381,1.478,5.125,3.674l15.607,46.904c0.537,1.621,0.263,3.402-0.736,4.789c-1.018,1.408-2.649,2.24-4.386,2.24H58.615c-1.736,0-3.368-0.832-4.386-2.24C53.23,122.504,52.956,120.721,53.493,119.098L53.493,119.098z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_paragraph:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="10 10 180 180"><g><path d="M128.39,28.499H63.493c-25.558,0-46.354,20.796-46.354,46.354c0,25.559,20.796,46.353,46.354,46.353h9.271v55.625h18.542V47.04h9.271V176.83h18.543V47.04h9.271V28.499z M72.764,102.664h-9.271c-15.337,0-27.813-12.475-27.813-27.812c0-15.336,12.476-27.813,27.813-27.813h9.271V102.664z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.633,190.465,66.178,190.465,63.32L190.465,63.32z M190.465,101.994c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.887,1.026,5.352,3.056,7.395c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.994L190.465,101.994z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_plus:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="35 30 140 140"><g><path d="M137.215,102.045c0,3.498-2.835,6.332-6.333,6.332H24.549c-3.498,0-6.334-2.834-6.334-6.332l0,0c0-3.498,2.836-6.333,6.334-6.333h106.333C134.38,95.711,137.215,98.547,137.215,102.045L137.215,102.045z M77.715,161.545c-3.498,0-6.333-2.836-6.333-6.334V48.878c0-3.498,2.836-6.333,6.333-6.333l0,0c3.498,0,6.334,2.835,6.334,6.333v106.333C84.049,158.709,81.213,161.545,77.715,161.545L77.715,161.545z M190.465,63.32c0-2.919-1.015-5.396-3.059-7.428c-2.029-2.031-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.016-7.388,3.047c-2.029,2.032-3.056,4.498-3.056,7.386c0,2.889,1.026,5.354,3.056,7.385c2.032,2.032,4.499,3.059,7.388,3.059c2.887,0,5.354-1.026,7.383-3.059C189.45,68.632,190.465,66.177,190.465,63.32L190.465,63.32z M190.465,101.993c0-2.858-1.015-5.313-3.059-7.333c-2.029-2.042-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.005-7.388,3.047c-2.029,2.021-3.056,4.486-3.056,7.376c0,2.888,1.026,5.353,3.056,7.396c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,107.389,190.465,104.914,190.465,101.993L190.465,101.993z M190.465,140.76c0-2.918-1.015-5.395-3.059-7.438c-2.029-2.041-4.496-3.047-7.383-3.047c-2.889,0-5.355,1.006-7.388,3.047c-2.029,2.043-3.056,4.52-3.056,7.438c0,2.922,1.026,5.398,3.056,7.439c2.032,2.021,4.499,3.047,7.388,3.047c2.887,0,5.354-1.025,7.383-3.047C189.45,146.158,190.465,143.682,190.465,140.76L190.465,140.76z"/></g></svg>',more_horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z" /></svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" /></svg>',as_inline:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8,7L13,17H3L8,7M3,3H21V5H3V3M21,15V17H14V15H21M3,19H21V21H3V19Z" /></svg>',as_block:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,7L17,17H7L12,7M3,3H21V5H3V3M3,19H21V21H3V19Z" /></svg>',page_break:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18,20H6V18H4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V18H18V20M14,2H6A2,2 0 0,0 4,4V12H6V4H14V8H18V12H20V8L14,2M11,16H8V14H11V16M16,16H13V14H16V16M3,14H6V16H3V14M21,16H18V14H21V16Z" /></svg>',page_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,6H13V14L16.5,10.5L17.92,11.92L12,17.84L6.08,11.92L7.5,10.5L11,14V6M12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20Z" /></svg>',page_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13,18H11V10L7.5,13.5L6.08,12.08L12,6.16L17.92,12.08L16.5,13.5L13,10V18M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" /></svg>',collapse_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.92,19.92L4,12L11.92,4.08L13.33,5.5L7.83,11H22V13H7.83L13.34,18.5L11.92,19.92M4,12V2H2V22H4V12Z" /></svg>',collapse_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.08,4.08L20,12L12.08,19.92L10.67,18.5L16.17,13H2V11H16.17L10.67,5.5L12.08,4.08M20,12V22H22V2H20V12Z" /></svg>',map:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11.7 15.62"><g><path d="M12.05,12.42a2.93,2.93,0,1,1,2.07-5A2.88,2.88,0,0,1,15,9.49a3,3,0,0,1-.86,2.07,2.89,2.89,0,0,1-2.07.86Zm0-5.36a2.43,2.43,0,0,0-1.72,4.16,2.48,2.48,0,0,0,1.72.72,2.44,2.44,0,0,0,0-4.88Zm0-3.3A5.84,5.84,0,0,1,17.9,9.62a9.94,9.94,0,0,1-1.73,5A33.59,33.59,0,0,1,12.84,19a1.52,1.52,0,0,1-.23.2,1,1,0,0,1-.55.2h0a1,1,0,0,1-.55-.2,1.52,1.52,0,0,1-.23-.2,33.59,33.59,0,0,1-3.33-4.32,9.93,9.93,0,0,1-1.72-5,5.84,5.84,0,0,1,5.85-5.86ZM12,18.34l.08.05.06-.06a35.58,35.58,0,0,0,3.06-3.93,9.35,9.35,0,0,0,1.74-4.77,4.88,4.88,0,0,0-4.88-4.88A4.79,4.79,0,0,0,8.6,6.17,4.84,4.84,0,0,0,7.17,9.62,9.29,9.29,0,0,0,8.91,14.4,36,36,0,0,0,12,18.34Z" transform="translate(-6.2 -3.76)"/></g></svg>',magic_stick:'<svg class="se-ci" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15.73 15.75"><g><path d="M19.86,19.21a1,1,0,0,0,.28-.68,1,1,0,0,0-.28-.7L13,10.93a1,1,0,0,0-.7-.28,1,1,0,0,0-.68,1.65l6.9,6.9a1,1,0,0,0,.69.29.93.93,0,0,0,.69-.28ZM9.19,8.55a3,3,0,0,0,1.68,0,14.12,14.12,0,0,0,1.41-.32A11.26,11.26,0,0,0,10.8,7.06c-.56-.36-.86-.56-.91-.58S10,5.91,10,5.11s0-1.26-.15-1.37a4.35,4.35,0,0,0-1.19.71c-.53.4-.81.62-.87.68a9,9,0,0,0-2-.6,6.84,6.84,0,0,0-.76-.09s0,.27.08.77a8.6,8.6,0,0,0,.61,2q-.09.09-.69.87a3.59,3.59,0,0,0-.68,1.17c.12.17.57.23,1.36.15S7,9.26,7.15,9.23s.21.36.57.91a10.49,10.49,0,0,0,1.14,1.48c0-.1.14-.57.31-1.4a3,3,0,0,0,0-1.67Z" transform="translate(-4.41 -3.74)"/></g></svg>',open_in_new:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" /></svg>'};var Vt=s("cfbI"),Ot=s.n(Vt);function Rt(t,e,s,i,n){const o=new Map([["menuTray",s],["toolbar_main",t],["toolbar_buttonTray",t.querySelector(".se-btn-tray")],["toolbar_arrow",t.querySelector(".se-arrow")]]);return i&&(o.set("toolbar_sub_main",i),o.set("toolbar_sub_buttonTray",i.querySelector(".se-btn-tray")),o.set("toolbar_sub_arrow",i.querySelector(".se-arrow")),o.set("toolbar_sub_wrapper",i.parentElement.parentElement)),e&&(o.set("toolbar_wrapper",e.querySelector(".sun-editor")),o.set("_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy"))),n&&o.set("statusbar_wrapper",n.querySelector(".sun-editor")),o}function zt(t,e,s,i,n,o,l,r){const a=new Map([["key",r],["options",t.options],["originElement",t.target],["topArea",e],["container",e.querySelector(".se-container")],["wrapper",e.querySelector(".se-wrapper")],["wysiwygFrame",s],["wysiwyg",s],["codeWrapper",i],["code",n],["codeNumbers",i?.querySelector(".se-code-view-line")],["lineBreaker_t",e.querySelector(".se-line-breaker-component-t")],["lineBreaker_b",e.querySelector(".se-line-breaker-component-b")],["_stickyDummy",e.querySelector(".se-toolbar-sticky-dummy")],["_toolbarShadow",e.querySelector(".se-toolbar-shadow")],["_minHeight",ft(s.style.minHeight||"65",0)],["isCodeView",!1],["isFullScreen",!1],["isReadOnly",!1],["isDisabled",!1],["isChanged",!1],["historyIndex",-1],["savedIndex",-1],["documentTypeInner",l.inner],["documentTypePage",l.page],["documentTypePageMirror",l.pageMirror]]);o&&Ft(o,a);const c=e.querySelector(".se-placeholder");return c&&a.set("placeholder",c),a}function Ft(t,e){t?e.set("statusbar",t):e.delete("statusbar");const s=t?t.querySelector(".se-navigation"):null,i=t?t.querySelector(".se-char-counter-wrapper"):null,n=t?t.querySelector(".se-char-counter-wrapper .se-char-counter"):null;s?e.set("navigation",s):e.delete("navigation"),i?e.set("charWrapper",i):e.delete("charWrapper"),n?e.set("charCounter",n):e.delete("charCounter")}const Pt={BUTTON_LIST:[["undo","redo"],"|",["bold","underline","italic","strike","|","subscript","superscript"],"|",["removeFormat"],"|",["outdent","indent"],"|",["fullScreen","showBlocks","codeView"],"|",["preview","print"]],REQUIRED_FORMAT_LINE:"div",REQUIRED_ELEMENT_WHITELIST:"br|div",ELEMENT_WHITELIST:"p|pre|blockquote|h1|h2|h3|h4|h5|h6|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|colgroup|col|thead|tbody|tr|th|td|caption|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup|code|svg|path|details|summary",TEXT_STYLE_TAGS:"strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label|code|summary",SCOPE_SELECTION_TAGS:["td","table","li","ol","ul","pre","figcaption","blockquote","dl","dt","dd"],ATTRIBUTE_WHITELIST:"contenteditable|target|href|title|download|rel|src|alt|class|type|colspan|rowspan|width|height|controls|autoplay|loop|muted|poster|preload|playsinline|volume|crossorigin|disableRemotePlayback|controlsList|allowfullscreen|sandbox|loading|allow|referrerpolicy|frameborder|scrolling",FORMAT_LINE:"P|H[1-6]|LI|TH|TD|DETAILS",FORMAT_BR_LINE:"PRE",FORMAT_CLOSURE_BR_LINE:"",FORMAT_BLOCK:"BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|CAPTION|DETAILS",FORMAT_CLOSURE_BLOCK:"TH|TD",ALLOWED_EMPTY_NODE_LIST:".se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas, details",SIZE_UNITS:["px","pt","em","rem"],CLASS_NAME:"^__se__|^se-|^katex|^MathJax",CLASS_MJX:"mjx-container|mjx-math|mjx-mrow|mjx-mi|mjx-mo|mjx-mn|mjx-msup|mjx-mfrac|mjx-munderover",EXTRA_TAG_MAP:{script:!1,style:!1,meta:!1,link:!1,"[a-z]+:[a-z]+":!1},CONTENT_STYLES:"background|background-clip|background-color|border|border-bottom|border-collapse|border-color|border-image|border-left-width|border-radius|border-right-width|border-spacing|border-style|border-top|border-width|box-shadow|box-sizing|caption-side|color|content|direction|display|position|float|font|font-family|font-size|font-style|font-weight|height|min-height|max-height|width|min-width|max-width|left|letter-spacing|line-height|list-style-position|list-style-type|margin|margin-block-end|margin-block-start|margin-bottom|margin-inline-end|margin-inline-start|margin-left|margin-right|margin-top|padding|padding-bottom|padding-inline-start|padding-left|padding-right|padding-top|outline|overflow|page-break-before|page-break-after|page-break-inside|rotate|rotateX|rotateY|table-layout|text-align|text-decoration|text-shadow|text-transform|top|text-indent|text-rendering|vertical-align|visibility|white-space|word-break|word-wrap",TAG_STYLES:{"table|th|td":"border|border-[a-z]+|color|background-color|text-align|float|font-weight|text-decoration|font-style|vertical-align","table|td":"width",tr:"height",col:"width",caption:"text-align|caption-side","ol|ul":"list-style-type",figure:"display|width|height|padding|padding-bottom",figcaption:"margin|margin-top|margin-bottom|text-align","img|video|iframe":"transform|transform-origin|width|min-width|max-width|height|min-height|max-height|float|margin|margin-top",hr:""},SPAN_STYLES:"font-family|font-size|color|background-color|width|height",LINE_STYLES:"text-align|margin|margin-left|margin-right|line-height",RETAIN_STYLE_MODE:["repeat","always","none"]},Dt={value:"fixed",placeholder:!0,editableFrameAttributes:!0,width:!0,minWidth:!0,maxWidth:!0,height:!0,minHeight:!0,maxHeight:!0,editorStyle:!0,iframe:"fixed",iframe_fullPage:"fixed",iframe_attributes:!0,iframe_cssFileName:!0,statusbar:!0,statusbar_showPathLabel:!0,statusbar_resizeEnable:"fixed",charCounter:!0,charCounter_max:!0,charCounter_label:!0,charCounter_type:!0},qt={plugins:"fixed",excludedPlugins:"fixed",buttonList:"fixed",v2Migration:"fixed",strictMode:"fixed",mode:"fixed",type:"fixed",theme:!0,lang:"fixed",fontSizeUnits:"fixed",allowedClassName:"fixed",closeModalOutsideClick:"fixed",copyFormatKeepOn:!0,syncTabIndent:!0,tabDisable:!0,autoLinkify:!0,autoStyleify:!0,retainStyleMode:!0,allowedExtraTags:"fixed",events:!0,__textStyleTags:"fixed",textStyleTags:"fixed",convertTextTags:"fixed",__tagStyles:"fixed",tagStyles:"fixed",spanStyles:"fixed",lineStyles:"fixed",textDirection:!0,reverseButtons:"fixed",historyStackDelayTime:!0,lineAttrReset:!0,printClass:!0,defaultLine:"fixed",defaultLineBreakFormat:!0,scopeSelectionTags:!0,__defaultElementWhitelist:"fixed",elementWhitelist:"fixed",elementBlacklist:"fixed",__defaultAttributeWhitelist:"fixed",attributeWhitelist:"fixed",attributeBlacklist:"fixed",__defaultFormatLine:"fixed",formatLine:"fixed",__defaultFormatBrLine:"fixed",formatBrLine:"fixed",__defaultFormatClosureBrLine:"fixed",formatClosureBrLine:"fixed",__defaultFormatBlock:"fixed",formatBlock:"fixed",__defaultFormatClosureBlock:"fixed",formatClosureBlock:"fixed",allowedEmptyTags:!0,toolbar_width:!0,toolbar_container:"fixed",toolbar_sticky:!0,toolbar_hide:!0,subToolbar:"fixed",statusbar_container:"fixed",shortcutsHint:!0,shortcutsDisable:"fixed",shortcuts:"fixed",fullScreenOffset:!0,previewTemplate:!0,printTemplate:!0,componentInsertBehavior:!0,defaultUrlProtocol:!0,allUsedStyles:"fixed",toastMessageTime:!0,icons:"fixed",freeCodeViewMode:!0,__lineFormatFilter:!0,__pluginRetainFilter:!0,__listCommonStyle:"fixed",externalLibs:"fixed"},Wt=Et._d;function Ut(t,e,s,i,n,o){if(!s||s.length<2)return;const l=e?.querySelector(".se-tooltip-text");for(let c,h,d,u,p,g,m,f,v,b,y,C,w,_,x=0;x<s.length;x+=2+_){if(_=0,c=s[x].split("+"),v=null,b=c.at(-1).trim?.(),b.startsWith("~"))v=t,b=c.pop().trim().substring(1);else if(b.startsWith("$~")){const t=c.pop().trim().substring(2).split(".");v=t[0],b=t[1]}else b.startsWith("$")?(_=1,b=s[x+2]):b="";d=u=p=g=m=f=h=null;for(const t of c)switch(t.trim()){case"c":d=!0;break;case"!":p=!0;break;case"s":u=!0;break;case"_":g=!0;break;case"=":f=!0;break;case"/":m=!0;break;default:h=t}h=h.split("|");for(let s=0,l=h.length;s<l;s++)C=d?h[s]+(u?"1000":""):h[s],i.has(C)||(w=n.indexOf(t),w=-1===w?"":Lt.isOdd(w)?n[w+1]:n[w-1],w&&o.add(C),i.set(C,{c:d,s:u,edge:p,space:g,enter:m,textTrigger:f,plugin:v,command:t,method:b,r:w,type:e?.getAttribute("data-type"),button:e,key:C}));(y=s[x+1])&&(l&&(r=u,a=y,l.appendChild(Ht.utils.createElement("SPAN",{class:"se-shortcut"},Et.cmdIcon+(r?Et.shiftIcon:"")+'+<span class="se-shortcut-key">'+a+"</span>"))))}var r,a}function Gt(t,e){return[t,e].reduce(((t,e)=>{for(const s in e)t[s]=(e[s]||"").toLowerCase();return t}),{})}function Zt(t,e,s){const i=t.buttonList||Pt.BUTTON_LIST,n=new Map;if(e.length>1&&!t.toolbar_container&&!/inline|balloon/i.test(t.mode))throw Error('[SUNEDITOR.create.fail] In multi root, The "mode" option cannot be "classic" without using the "toolbar_container" option.');n.set("v2Migration",!!t.v2Migration),n.set("buttons",new Set(i.toString().split(","))),n.set("strictMode",{tagFilter:!0,formatFilter:!0,classFilter:!0,textStyleTagFilter:!0,attrFilter:!0,styleFilter:!0,..."boolean"==typeof t.strictMode?{}:t.strictMode}),n.set("freeCodeViewMode",!!t.freeCodeViewMode),n.set("__lineFormatFilter",t.__lineFormatFilter??!0),n.set("__pluginRetainFilter",t.__pluginRetainFilter??!0),n.set("mode",t.mode||"classic"),n.set("type",t.type?.split(":")[0]||""),n.set("theme",t.theme||""),n.set("_themeClass",t.theme?` se-theme-${t.theme}`:""),n.set("_type_options",t.type?.split(":")[1]||""),n.set("externalLibs",t.externalLibs||{}),n.set("fontSizeUnits",Array.isArray(t.fontSizeUnits)&&t.fontSizeUnits.length>0?t.fontSizeUnits.map((t=>t.toLowerCase())):Pt.SIZE_UNITS),n.set("allowedClassName",new RegExp(`${t.allowedClassName&&"string"==typeof t.allowedClassName?t.allowedClassName+"|":""}${Pt.CLASS_NAME}`)),n.set("closeModalOutsideClick",!!t.closeModalOutsideClick),n.set("copyFormatKeepOn",!!t.copyFormatKeepOn),n.set("syncTabIndent",t.syncTabIndent??!0),n.set("autoLinkify",t.autoLinkify??!!s.link),n.set("autoStyleify",Array.isArray(t.autoStyleify)?t.autoStyleify:["bold","underline","italic","strike"]);let o=t.retainStyleMode||"repeat";"string"!=typeof o||Pt.RETAIN_STYLE_MODE.includes(o)||(console.error(`Invalid retainStyleMode: ${o}. Valid options are ${Pt.RETAIN_STYLE_MODE.join(", ")}. Using default 'repeat'.`),o="repeat"),n.set("retainStyleMode",o);const l={...Pt.EXTRA_TAG_MAP,...t.allowedExtraTags,"-":!0},r=Object.keys(l),a=r.filter((t=>l[t])).join("|"),c=r.filter((t=>!l[t])).join("|");n.set("_allowedExtraTag",a),n.set("_disallowedExtraTag",c),n.set("events",t.events||{}),n.set("textStyleTags",("string"==typeof t.__textStyleTags?t.__textStyleTags:Pt.TEXT_STYLE_TAGS)+(t.textStyleTags?"|"+t.textStyleTags:""));const h=Gt({bold:"strong",underline:"u",italic:"em",strike:"del",subscript:"sub",superscript:"sup"},t.convertTextTags||{});n.set("convertTextTags",h),n.set("_textStyleTags",Object.values(h).concat(["span","li"])),n.set("tagStyles",[{...Pt.TAG_STYLES,...t.__tagStyles||{}},t.tagStyles||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{})),n.set("_textStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Pt.SPAN_STYLES}${t.spanStyles?"|"+t.spanStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_lineStylesRegExp",new RegExp(`\\s*[^-a-zA-Z](${Pt.LINE_STYLES}${t.lineStyles?"|"+t.lineStyles:""})\\s*:[^;]+(?!;)*`,"gi")),n.set("_defaultStyleTagMap",{strong:h.bold,b:h.bold,u:h.underline,ins:h.underline,em:h.italic,i:h.italic,del:h.strike,strike:h.strike,s:h.strike,sub:h.subscript,sup:h.superscript}),n.set("_styleCommandMap",Gt(Mt.swapKeyValue(h),{strong:"bold",b:"bold",u:"underline",ins:"underline",em:"italic",i:"italic",del:"strike",strike:"strike",s:"strike",sub:"subscript",sup:"superscript"})),n.set("_defaultTagCommand",{bold:h.bold,underline:h.underline,italic:h.italic,strike:h.strike,subscript:h.sub,superscript:h.sup}),n.set("textDirection",t.textDirection??"ltr"),n.set("_rtl","rtl"===n.get("textDirection")),n.set("reverseCommands",["indent-outdent"].concat(t.reverseButtons||[])),n.set("_reverseCommandArray",("-"+n.get("reverseCommands").join("-")).split("-")),Lt.isEven(n.get("_reverseCommandArray").length)&&console.warn('[SUNEDITOR.create.warning] The "reverseCommands" option is invalid, Shortcuts key may not work properly.'),n.set("historyStackDelayTime","number"==typeof t.historyStackDelayTime?t.historyStackDelayTime:400),n.set("_editableClass","sun-editor-editable"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")+("document"===n.get("type")?" se-type-document-editable-a4":"")),n.set("lineAttrReset",["id"].concat(t.lineAttrReset&&"string"==typeof t.lineAttrReset?t.lineAttrReset.toLowerCase().split("|"):[])),n.set("printClass","string"==typeof t.printClass?t.printClass+" "+n.get("_editableClass"):null),n.set("defaultLine","string"==typeof t.defaultLine&&t.defaultLine.length>0?t.defaultLine:"p"),n.set("defaultLineBreakFormat",t.defaultLineBreakFormat||"line"),n.set("scopeSelectionTags",t.scopeSelectionTags||Pt.SCOPE_SELECTION_TAGS);const d=("string"==typeof t.elementWhitelist?t.elementWhitelist:"").toLowerCase(),u=n.get("externalLibs").mathjax?Pt.CLASS_MJX+"|":"";n.set("elementWhitelist",d+(d?"|":"")+u+n.get("_allowedExtraTag"));const p=(g=("string"==typeof t.elementBlacklist?t.elementBlacklist:"").toLowerCase(),m=(m=n.get("defaultLine")).toLowerCase(),g.split("|").filter((function(t){return t!==m||(console.warn(`[SUNEDITOR.constructor.createBlacklist.warn] defaultLine("<${m}>") cannot be included in the blacklist and will be removed.`),!1)})).join("|"));var g,m;if(n.set("elementBlacklist",p+(p?"|":"")+n.get("_disallowedExtraTag")),n.set("attributeWhitelist",t.attributeWhitelist&&"object"==typeof t.attributeWhitelist?t.attributeWhitelist:null),n.set("attributeBlacklist",t.attributeBlacklist&&"object"==typeof t.attributeBlacklist?t.attributeBlacklist:null),n.set("formatClosureBrLine",Jt(t.formatClosureBrLine,(t.__defaultFormatClosureBrLine="string"==typeof t.__defaultFormatClosureBrLine?t.__defaultFormatClosureBrLine:Pt.FORMAT_CLOSURE_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBrLine",Jt((t.formatBrLine||"")+"|"+n.get("formatClosureBrLine").str,(t.__defaultFormatBrLine="string"==typeof t.__defaultFormatBrLine?t.__defaultFormatBrLine:Pt.FORMAT_BR_LINE).toLowerCase(),n.get("elementBlacklist"))),n.set("formatLine",Jt(Pt.REQUIRED_FORMAT_LINE+"|"+(t.formatLine||"")+"|"+n.get("formatBrLine").str,(t.__defaultFormatLine="string"==typeof t.__defaultFormatLine?t.__defaultFormatLine:Pt.FORMAT_LINE).toLowerCase(),n.get("elementBlacklist"))),!n.get("formatLine").reg.test(n.get("defaultLine")))throw Error(`[SUNEDITOR.create.fail] The "defaultLine(${n.get("defaultLine")})" option must be included in the "formatLine(${n.get("formatLine").str})" option.`);n.set("formatClosureBlock",Jt(t.formatClosureBlock,(t.__defaultFormatClosureBlock="string"==typeof t.__defaultFormatClosureBlock?t.__defaultFormatClosureBlock:Pt.FORMAT_CLOSURE_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("formatBlock",Jt((t.formatBlock||"")+"|"+n.get("formatClosureBlock").str,(t.__defaultFormatBlock="string"==typeof t.__defaultFormatBlock?t.__defaultFormatBlock:Pt.FORMAT_BLOCK).toLowerCase(),n.get("elementBlacklist"))),n.set("allowedEmptyTags",Pt.ALLOWED_EMPTY_NODE_LIST+(t.allowedEmptyTags?", "+t.allowedEmptyTags:"")),n.set("__defaultElementWhitelist",Pt.REQUIRED_ELEMENT_WHITELIST+"|"+("string"==typeof t.__defaultElementWhitelist?t.__defaultElementWhitelist:Pt.ELEMENT_WHITELIST).toLowerCase()),n.set("__defaultAttributeWhitelist",("string"==typeof t.__defaultAttributeWhitelist?t.__defaultAttributeWhitelist:Pt.ATTRIBUTE_WHITELIST).toLowerCase()),n.set("_editorElementWhitelist","*"===n.get("elementWhitelist")?"*":function(t){const e=t.get("elementBlacklist").split("|"),s=(t.get("__defaultElementWhitelist")+"|"+t.get("elementWhitelist")+"|"+t.get("formatLine").str+"|"+t.get("formatBrLine").str+"|"+t.get("formatClosureBlock").str+"|"+t.get("formatClosureBrLine").str).replace(/(^\||\|$)/g,"").split("|").filter(((t,s,i)=>t&&i.indexOf(t)===s&&!e.includes(t)));return s.join("|")}(n)),n.set("toolbar_width",t.toolbar_width?Lt.is(t.toolbar_width)?t.toolbar_width+"px":t.toolbar_width:"auto"),n.set("toolbar_container",t.toolbar_container&&!/inline/i.test(n.get("mode"))?"string"==typeof t.toolbar_container?Wt.querySelector(t.toolbar_container):t.toolbar_container:null),n.set("toolbar_sticky",/balloon/i.test(n.get("mode"))?-1:void 0===t.toolbar_sticky?0:Lt.is(t.toolbar_sticky)?Lt.get(t.toolbar_sticky,0):-1),n.set("toolbar_hide",!!t.toolbar_hide);let f=null;const v=t.subToolbar;v?.buttonList?.length>0&&(/balloon/.test(n.get("mode"))?console.warn('[SUNEDITOR.create.subToolbar.fail] When the "mode" option is "balloon-*", the "subToolbar" option is omitted.'):(n.set("_subMode",v.mode||"balloon"),n.set("toolbar_sub_width",v.width?Lt.is(v.width)?v.width+"px":v.width:"auto"),f=n.get("_rtl")?v.buttonList.reverse():v.buttonList,n.set("buttons_sub",new Set(f.toString().split(",")))));const b=new Map;for(let s=0,i=e.length;s<i;s++)b.set(e[s].key,Kt(e[s].options||{},t));n.set("tabDisable",!!t.tabDisable),n.set("shortcutsHint",void 0===t.shortcutsHint||!!t.shortcutsHint);const y=void 0===t.shortcutsDisable||t.shortcutsDisable?[{selectAll:["c+KeyA","A"],bold:["c+KeyB","B"],strike:["c+s+KeyS","S"],underline:["c+KeyU","U"],italic:["c+KeyI","I"],redo:["c+KeyY","Y","c+s+KeyZ","Z"],undo:["c+KeyZ","Z"],indent:["c+BracketRight","]"],outdent:["c+BracketLeft","["],save:["c+KeyS","S"],link:["c+KeyK","K"],hr:["!+---+=+~shortcut",""],list_numbered:["!+1.+_+~shortcut",""],list_bulleted:["!+*.+_+~shortcut",""],_h1:["c+s+Digit1|Numpad1+$~blockStyle.applyHeaderByShortcut",""],_h2:["c+s+Digit2|Numpad2+$~blockStyle.applyHeaderByShortcut",""],_h3:["c+s+Digit3|Numpad3+$~blockStyle.applyHeaderByShortcut",""]},t.shortcuts||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{}):{};n.set("shortcuts",y),n.set("fullScreenOffset",void 0===t.fullScreenOffset?0:Lt.is(t.fullScreenOffset)?Lt.get(t.fullScreenOffset,0):0),n.set("previewTemplate","string"==typeof t.previewTemplate?t.previewTemplate:null),n.set("printTemplate","string"==typeof t.printTemplate?t.printTemplate:null),n.set("componentInsertBehavior",["auto","select","line","none"].includes(t.componentInsertBehavior)?t.componentInsertBehavior:"auto"),n.set("defaultUrlProtocol","string"==typeof t.defaultUrlProtocol?t.defaultUrlProtocol:null);const C=n.get("externalLibs").codeMirror;C&&(n.set("codeMirror",C),C.EditorView?n.set("codeMirror6Editor",!0):C.src?n.set("codeMirror5Editor",!0):(console.warn("[SUNEDITOR.options.externalLibs.codeMirror.fail] The codeMirror option is set incorrectly. See: https://github.com/ARA-developer/suneditor/blob/develop/guide/external-libraries.md"),n.set("codeMirror",null))),n.set("__listCommonStyle",t.__listCommonStyle||["fontSize","color","fontFamily","fontWeight","fontStyle"]);const w=t.icons&&"object"==typeof t.icons?[It,t.icons].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{}):It;n.set("icons",w);const _=new Set(Pt.CONTENT_STYLES.split("|")),x=t.spanStyles?.split("|")||[],$=n.get("__listCommonStyle"),S=Pt.SPAN_STYLES.split("|");for(let t=0,e=S.length;t<e;t++)_.add(S[t]);for(const t of Object.values(n.get("tagStyles"))){const e=t.split("|");for(let t=0,s=e.length;t<s;t++)_.add(e[t])}for(let t=0,e=x.length;t<e;t++)_.add(x[t]);for(let t=0,e=$.length;t<e;t++)_.add($[t]);const k=("string"==typeof t.allUsedStyles?t.allUsedStyles.split("|"):t.allUsedStyles)||[];for(let t=0,e=k.length;t<e;t++)_.add(k[t]);return n.set("allUsedStyles",_),n.set("toastMessageTime",{copy:1500,...t.toastMessageTime}),{o:n,i:w,l:t.lang||Ot(),v:t.value="string"==typeof t.value?t.value:null,buttons:n.get("_rtl")?i.reverse():i,subButtons:f,statusbarContainer:"string"==typeof t.statusbar_container?Wt.querySelector(t.statusbar_container):t.statusbar_container,frameMap:b}}function jt(t,e){let s=null,i=null,n=null;if(t.get("statusbar")&&(e||=Ht.utils.createElement("DIV",{class:"se-status-bar sun-editor-common"}),s=e.querySelector(".se-navigation")||Ht.utils.createElement("DIV",{class:"se-navigation sun-editor-common"}),e.appendChild(s),t.get("charCounter"))){if(i=e.querySelector(".se-char-counter-wrapper")||Ht.utils.createElement("DIV",{class:"se-char-counter-wrapper"}),t.get("charCounter_label")){const e=i.querySelector(".se-char-label")||Ht.utils.createElement("SPAN",{class:"se-char-label"});e.textContent=t.get("charCounter_label"),i.appendChild(e)}if(n=i.querySelector(".se-char-counter")||Ht.utils.createElement("SPAN",{class:"se-char-counter"}),n.textContent="0",i.appendChild(n),t.get("charCounter_max")>0){const e=i.querySelector(".se-char-max")||Ht.utils.createElement("SPAN",{class:"se-char-max"});e.textContent=" / "+t.get("charCounter_max"),i.appendChild(e)}e.appendChild(i)}return{statusbar:e,navigation:s,charWrapper:i,charCounter:n}}function Kt(t,e){const s=new Map;s.set("_origin",t);const i=e.statusbar_container,n=void 0===t.value?e.value:t.value,o=void 0===t.placeholder?e.placeholder:t.placeholder,l=void 0===t.editableFrameAttributes?e.editableFrameAttributes:t.editableFrameAttributes,r=void 0===t.width?e.width:t.width,a=void 0===t.minWidth?e.minWidth:t.minWidth,c=void 0===t.maxWidth?e.maxWidth:t.maxWidth,h=void 0===t.height?e.height:t.height,d=void 0===t.minHeight?e.minHeight:t.minHeight,u=void 0===t.maxHeight?e.maxHeight:t.maxHeight,p=void 0===t.editorStyle?e.editorStyle:t.editorStyle,g=void 0===t.iframe?e.iframe:t.iframe,m=void 0===t.iframe_fullPage?e.iframe_fullPage:t.iframe_fullPage,f=void 0===t.iframe_attributes?e.iframe_attributes:t.iframe_attributes,v=void 0===t.iframe_cssFileName?e.iframe_cssFileName:t.iframe_cssFileName,b=i||void 0===t.statusbar?e.statusbar:t.statusbar,y=i||void 0===t.statusbar_showPathLabel?e.statusbar_showPathLabel:t.statusbar_showPathLabel,C=!i&&(void 0===t.statusbar_resizeEnable?e.statusbar_resizeEnable:t.statusbar_resizeEnable),w=i||void 0===t.charCounter?e.charCounter:t.charCounter,_=i||void 0===t.charCounter_max?e.charCounter_max:t.charCounter_max,x=i||void 0===t.charCounter_label?e.charCounter_label:t.charCounter_label,$=i||void 0===t.charCounter_type?e.charCounter_type:t.charCounter_type;s.set("value",n),s.set("placeholder",o),s.set("editableFrameAttributes",{spellcheck:"false",...l}),s.set("width",r?String(Lt.is(r)?r+"px":r):"100%"),s.set("minWidth",a?String(Lt.is(a)?a+"px":a):""),s.set("maxWidth",c?String(Lt.is(c)?c+"px":c):""),s.set("height",h?String(Lt.is(h)?h+"px":h):"auto"),s.set("minHeight",d?String(Lt.is(d)?d+"px":d):""),s.set("maxHeight",u?String(Lt.is(u)?u+"px":u):""),s.set("editorStyle",p),s.set("_defaultStyles",Mt._setDefaultOptionStyle(s,"string"==typeof p?p:"")),s.set("iframe",!(!m&&!g)),s.set("iframe_fullPage",!!m),s.set("iframe_attributes",f||{}),s.set("iframe_cssFileName",g?("string"==typeof v?[v]:v)||["suneditor"]:null);const S=void 0===b||!!b;return s.set("statusbar",S),s.set("statusbar_showPathLabel",!!S&&("boolean"!=typeof y||y)),s.set("statusbar_resizeEnable",!!S&&(void 0===C||!!C)),s.set("charCounter",_>0||"boolean"==typeof w&&w),s.set("charCounter_max",Lt.is(_)&&_>-1?1*_:null),s.set("charCounter_label","string"==typeof x?x.trim():null),s.set("charCounter_type","string"==typeof $?$:"char"),s}function Yt(t,e,s,i){const n=i.get("_defaultStyles");s.style.cssText=n.top;const o=Ht.utils.createElement(i.get("iframe")?"IFRAME":"DIV",{class:"se-wrapper-inner se-wrapper-wysiwyg"+("document"===e.get("type")?" se-type-document-iframe-a4":""),"data-root-key":t});if(i.get("iframe")){const t=o,e=i.get("iframe_attributes");let s=e.sandbox;if(s){const t=["allow-same-origin"],e=s.split(/\s+/),i=t.filter((t=>!e.includes(t)));i.length>0&&(s=e.concat(i).join(" "))}else s="allow-same-origin";t.setAttribute("sandbox",s),t.setAttribute("frameBorder","0");for(const s in e)"sandbox"!==s&&t.setAttribute(s,e[s]);t.allowFullscreen=!0,t.setAttribute("scrolling","auto"===i.get("height")?"no":"auto"),t.style.cssText=n.frame}else o.setAttribute("contenteditable","true"),o.className+=" "+e.get("_editableClass"),o.style.cssText=n.frame+n.editor;const l=Ht.utils.createElement("TEXTAREA",{class:"se-wrapper-inner se-code-viewer",style:n.frame}),r=Ht.utils.createElement("SPAN",{class:"se-placeholder"});return i.get("placeholder")&&(r.textContent=i.get("placeholder")),{bottomBar:jt(i,null),wysiwygFrame:o,codeView:l,placeholder:r}}function Xt(t,e,s){let i=null,n=!1;if(t.get("codeMirror6Editor")){const o=t.get("codeMirror"),l=s.style.cssText,r=new o.EditorView({parent:s.parentElement,extensions:o.extensions,state:o.state});e.set("codeMirror6Editor",r),i=r.dom,i.style.cssText=l,n=!0}else if(t.get("codeMirror5Editor")){const o=t.get("codeMirror"),l=[{mode:"htmlmixed",htmlMode:!0,lineNumbers:!0,lineWrapping:!0},o.options||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{});"auto"===e.get("height")&&(l.viewportMargin=1/0,l.height="auto");const r=s.style.cssText,a=o.src.fromTextArea(s,l);e.set("codeMirror5Editor",a),i=a.display.wrapper,i.style.cssText=r,n=!0}return t.set("hasCodeMirror",n),i?(Ht.utils.removeItem(s),i.className+=" se-code-viewer-mirror",i):s}function Jt(t,e,s){const i=s.split("|"),n=(e+"|"+("string"==typeof t?t.toLowerCase():"")).replace(/^\||\|$/g,"").split("|").filter((t=>t&&!i.includes(t))).join("|");return{reg:new RegExp(`^(${n})$`,"i"),str:n}}function Qt(){const t=Ht.utils.createElement("UL",{class:"se-menu-list"});return{div:Ht.utils.createElement("DIV",{class:"se-btn-module se-btn-module-border"},t),ul:t}}function te(t,e,s,i,n,o,l){n||="";const r=Ht.utils.createElement("LI"),a=e||"",c=/^INPUT|FIELD$/i.test(i),h="se-toolbar-separator-vertical"===t?Ht.utils.createElement("DIV",{class:t,tabindex:"-1"},null):Ht.utils.createElement(c?"DIV":"BUTTON",{class:"se-toolbar-btn se-btn se-tooltip"+(t?" "+t:""),"data-command":s,"data-type":i,"aria-label":a.replace(/<span .+<\/span>/,""),tabindex:"-1"});return c||h.setAttribute("type","button"),/^default\./i.test(n)&&(n=l[n.replace(/^default\./i,"")]),/^text\./i.test(n)&&(n=n.replace(/^text\./i,""),h.className+=" se-btn-more-text"),o&&(h.disabled=!0),/^FIELD$/i.test(i)&&Ht.utils.addClass(r,"se-toolbar-hidden-btn"),a&&(n+=Ht.utils.createTooltipInner(a)),n&&(h.innerHTML=n),r.appendChild(h),{li:r,button:h}}function ee(t,e,s,i){if(!t)return;const n=!1===e.inner;if(1===e.inner?.nodeType?t.appendChild(e.inner):t.innerHTML=n?"":(e.inner||s[e.icon]||e.icon||'<span class="se-icon-text">!</span>')+'<span class="se-tooltip-inner"><span class="se-tooltip-text">'+(i[e.title]||e.title)+"</span></span>",t.setAttribute("aria-label",e.title),e.type&&t.setAttribute("data-type",e.type),e.className&&(t.className+=" "+e.className),e.afterItem&&(Ht.utils.addClass(e.afterItem,"se-toolbar-btn"),t.parentElement.appendChild(e.afterItem),Ht.utils.addClass(t,"se-side-btn-a"),Ht.utils.addClass(e.afterItem,"se-side-btn-after")),e.beforeItem&&(Ht.utils.addClass(e.beforeItem,"se-toolbar-btn"),t.parentElement.insertBefore(e.beforeItem,t),e.afterItem?(Ht.utils.addClass(t,"se-side-btn"),Ht.utils.removeClass(t,"se-side-btn-a")):Ht.utils.addClass(t,"se-side-btn-b"),Ht.utils.addClass(e.beforeItem,"se-side-btn-before")),e.replaceButton&&(t.parentElement.appendChild(e.replaceButton),t.style.display="none"),!e.replaceButton&&/^INPUT$/i.test(t.getAttribute("data-type"))){const e=t.querySelector("input");e&&(Ht.utils.addClass(e,"se-toolbar-btn"),e.setAttribute("data-command",t.getAttribute("data-command")),e.setAttribute("data-type",t.getAttribute("data-type")),t.hasAttribute("disabled")&&(e.disabled=!0))}}function se(t,e,s,i,n,o){t=JSON.parse(JSON.stringify(t));const l=function(t,e,s){return{bold:["",s.bold,"bold","",e.bold],underline:["",s.underline,"underline","",e.underline],italic:["",s.italic,"italic","",e.italic],strike:["",s.strike,"strike","",e.strike],subscript:["",s.subscript,"subscript","",e.subscript],superscript:["",s.superscript,"superscript","",e.superscript],removeFormat:["",s.removeFormat,"removeFormat","",e.remove_format],copyFormat:["",s.copyFormat,"copyFormat","",e.format_paint],indent:["se-icon-flip-rtl",s.indent,"indent","",t?e.outdent:e.indent],outdent:["se-icon-flip-rtl",s.outdent,"outdent","",t?e.indent:e.outdent],fullScreen:["se-code-view-enabled se-component-enabled",s.fullScreen,"fullScreen","",e.expansion],showBlocks:["",s.showBlocks,"showBlocks","",e.show_blocks],codeView:["se-code-view-enabled se-component-enabled",s.codeView,"codeView","",e.code_view],undo:["se-component-enabled",s.undo,"undo","",e.undo],redo:["se-component-enabled",s.redo,"redo","",e.redo],preview:["se-component-enabled",s.preview,"preview","",e.preview],print:["se-component-enabled",s.print,"print","",e.print],copy:["",s.copy,"copy","",e.copy],dir:["",s[t?"dir_ltr":"dir_rtl"],"dir","",e[t?"dir_ltr":"dir_rtl"]],dir_ltr:["",s.dir_ltr,"dir_ltr","",e.dir_ltr],dir_rtl:["",s.dir_rtl,"dir_rtl","",e.dir_rtl],save:["se-component-enabled",s.save,"save","",e.save],newDocument:["se-component-enabled",s.newDocument,"newDocument","",e.new_document],selectAll:["se-component-enabled",s.selectAll,"selectAll","",e.select_all],pageBreak:["se-component-enabled",s.pageBreak,"pageBreak","",e.page_break],pageUp:["se-component-enabled",s.pageUp,"pageUp","",e.page_up],pageDown:["se-component-enabled",s.pageDown,"pageDown","",e.page_down],pageNavigator:["se-component-enabled","","pageNavigator","input",""]}}(s.get("_rtl"),i,n),r={},a=[],c=[];let h=null,d=null,u=null,p=null,g=null;const m=Ht.utils.createElement("DIV",{class:"se-toolbar-more-layer"}),f=Ht.utils.createElement("DIV",{class:"se-btn-tray"}),v=Ht.utils.createElement("DIV",{class:"se-toolbar-separator-vertical"});t:for(let s,b,y,C,w,_=0;_<t.length;_++)if(s=!1,w="",C=t[_],p=Qt(),"object"==typeof C){for(let f,v=0;v<C.length;v++){if(d=C[v],f=!1,u=e[d],/^%\d+/.test(d)&&0===v){C[0]=d.replace(/[^\d]/g,""),a.push(C),t.splice(_--,1);continue t}if("function"==typeof u)h=[u.className,u.title,d,u.type,u.innerHTML,u._disabled];else if("object"==typeof u){const t=u.constructor;h=[u.className||t.className,u.title||t.title,d,u.type||t.type,u.innerHTML||t.innerHTML,u._disabled||t._disabled]}else{if(/^-/.test(d)){w=d.substring(1),p.div.className+=" module-float-"+w;continue}if(/^#/.test(d)){"fix"===d.substring(1)&&(p.ul.className+=" se-menu-dir-fix");continue}if(/^:/.test(d)){f=!0;const t=d.match(/^:([^-]+)-([^-]+)/);y="__se__more_"+_;const e=t[1].trim(),s=t[2].trim();h=["se-btn-more",/^lang\./i.test(e)?n[e.replace(/^lang\./i,"")]:e,y,"MORE",s]}else"|"===d?h=["se-toolbar-separator-vertical","","","separator",""]:("copy"!==d||Et.isClipboardSupported||console.warn("[SUNEDITOR.constructor.warn] Clipboard is not supported in this browser. : [copy] button is not rendered."),h=l[d]);if(!h){if(!u)throw Error(`[SUNEDITOR.create.toolbar.fail] The button name of a plugin that does not exist. [${d}]`);u="object"==typeof u?u.constructor:u,h=[u.className,u.title,u.key,u.type,u.innerHTML,u._disabled]}}g=te(h[0],h[1],h[2],h[3],h[4],h[5],i),(s?b:p.ul).appendChild(g.li),u&&(r[d]?r[d].push(g.button):r[d]=[g.button],o&&c.push({button:g.button,plugin:u,key:d})),f&&(s=!0,b=Ht.utils.createElement("DIV"),b.className="se-more-layer "+y,b.setAttribute("data-ref",y),b.innerHTML='<div class="se-more-form"><ul class="se-menu-list"'+(w?' style="float: '+w+';"':"")+"></ul></div>",m.appendChild(b),b=b.firstElementChild.firstElementChild)}f.appendChild(p.div)}else{if("|"===C){const t=v.cloneNode(!1);f.appendChild(t);continue}if(/^\/$/.test(C)){const t=Ht.utils.createElement("DIV",{class:"se-btn-module-enter"});f.appendChild(t)}}switch(f.children.length){case 0:f.style.display="none";break;case 1:Ht.utils.removeClass(f.firstElementChild,"se-btn-module-border")}m.children.length>0&&f.appendChild(m),a.length>0&&a.unshift(t);const b=Ht.utils.createElement("DIV",{class:"se-toolbar sun-editor-common"+(s.get("shortcutsHint")?"":" se-shortcut-hide")},f);return s.get("toolbar_hide")&&(b.style.display="none"),{element:b,pluginCallButtons:r,responsiveButtons:a,buttonTray:f,updateButtons:c}}const ie=function(t,e){"object"!=typeof e&&(e={});const s={};if(e.plugins){const t=e.excludedPlugins||[],i=e.plugins,n=(Array.isArray(i)?i:Object.keys(i)).filter((e=>!t.includes(e))).map((t=>i[t]));for(let t,e=0,i=n.length;e<i;e++)t=n[e].default||n[e],s[t.key]=t}const i=Zt(e,t,s),n=i.o,o=i.i,l=i.l,r=Ht.utils.createElement("DIV",{class:"se-loading-box sun-editor-common"},'<div class="se-loading-effect"></div>'),a=Ht.utils.createElement("DIV",{class:"sun-editor sun-editor-carrier-wrapper sun-editor-common"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),c=Ht.utils.createElement("DIV",{class:"se-menu-tray"});a.appendChild(c);const h=Ht.utils.createElement("INPUT",{class:"__se__focus__temp__",style:"position: fixed !important; top: -10000px !important; left: -10000px !important; display: block !important; width: 0 !important; height: 0 !important; margin: 0 !important; padding: 0 !important;"});h.tabIndex=0,a.appendChild(h);const d=Ht.utils.createElement("DIV",{class:"se-modal se-modal-area sun-editor-common"}),u=Ht.utils.createElement("DIV",{class:"se-modal-back"}),p=Ht.utils.createElement("DIV",{class:"se-modal-inner"});d.appendChild(u),d.appendChild(p),a.appendChild(d);const g=Ht.utils.createElement("DIV",{class:"se-alert se-modal-area sun-editor-common",style:"display: none;"}),m=Ht.utils.createElement("DIV",{class:"se-modal-back"}),f=Ht.utils.createElement("DIV",{class:"se-modal-inner"});g.appendChild(m),g.appendChild(f),a.appendChild(g),a.appendChild(Ht.utils.createElement("DIV",{class:"se-back-wrapper"})),a.appendChild(r.cloneNode(!0));const v=Ht.utils.createElement("DIV",{class:"se-drag-cursor"});a.appendChild(v),Wt.body.appendChild(a);let b=null,y=null;const C=se(i.buttons,s,n,o,l,!1),w=C.element;w.style.visibility="hidden",/inline/i.test(n.get("mode"))?(w.className+=" se-toolbar-inline",w.style.width=n.get("toolbar_width")):/balloon/i.test(n.get("mode"))&&(w.className+=" se-toolbar-balloon",w.style.width=n.get("toolbar_width"),w.appendChild(Ht.utils.createElement("DIV",{class:"se-arrow"}))),i.subButtons&&(y=se(i.subButtons,s,n,o,l,!1),b=y.element,b.style.visibility="hidden",b.className+=" se-toolbar-balloon se-toolbar-sub",b.style.width=n.get("toolbar_sub_width"),b.appendChild(Ht.utils.createElement("DIV",{class:"se-arrow"})));const _=t[0].key||null,x=[],$=new Map,S=i.statusbarContainer;let k=null;for(let e=0,s=t.length;e<s;e++){const s=t[e],a=i.frameMap.get(s.key),c=Ht.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),h=Ht.utils.createElement("DIV",{class:"se-container"}),d=Ht.utils.createElement("DIV",{class:"se-wrapper"+("document"===n.get("type")?" se-type-document":"")+(n.get("_type_options").includes("header")?" se-type-document-header":"")});h.appendChild(Ht.utils.createElement("DIV",{class:"se-toolbar-shadow"}));const u=Yt(s.key,n,c,a),p=u.bottomBar.statusbar,g=u.wysiwygFrame,m=u.placeholder;let f=u.codeView;const v=Ht.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-t",title:l.insertLine},o.line_break),b=Ht.utils.createElement("DIV",{class:"se-line-breaker-component se-line-breaker-component-b",title:l.insertLine},o.line_break);d.appendChild(v),d.appendChild(b),m&&d.appendChild(m),h.appendChild(Ht.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"})),h.appendChild(d),p&&(S?k||(S.appendChild(Ht.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")},p)),k=p):h.appendChild(p)),h.appendChild(r.cloneNode(!0));const y=s.key||null,C=Ht.utils.createElement("DIV",{class:"se-code-wrapper"},f);C.style.setProperty("display","none","important"),d.appendChild(C);const w=Xt(n,a,f);if(f===w){const t=Ht.utils.createElement("TEXTAREA",{class:"se-code-view-line",readonly:"true"},null);C.insertBefore(t,f)}else f=w;const _={inner:null,page:null,pageMirror:null};n.get("_type_options").includes("header")&&(_.inner=Ht.utils.createElement("DIV",{class:"se-document-lines",style:`height: ${a.get("height")};`},'<div class="se-document-lines-inner"></div>')),n.get("_type_options").includes("page")&&(_.page=Ht.utils.createElement("DIV",{class:"se-document-page"},null),_.pageMirror=Ht.utils.createElement("DIV",{class:"sun-editor-editable se-document-page-mirror-a4",style:"position: absolute; width: 21cm; columns: 21cm; border: 0; overflow: hidden; height: auto; top: -10000px; left: -10000px;"},null)),c.appendChild(h),x.push(y),$.set(y,zt({target:s.target,key:s.key,options:a},c,g,C,f,k||p,_,y))}const E=n.get("toolbar_container");if(E){const t=Ht.utils.createElement("DIV",{class:"sun-editor"+n.get("_themeClass")+(n.get("_rtl")?" se-rtl":"")}),e=Ht.utils.createElement("DIV",{class:"se-container"});e.appendChild(w),b&&e.appendChild(b),t.appendChild(e),E.appendChild(t),E.appendChild(Ht.utils.createElement("DIV",{class:"se-toolbar-sticky-dummy"}))}else{const t=$.get(_).get("container");t.insertBefore(w,t.firstElementChild),b&&t.insertBefore(b,t.firstElementChild)}return{context:Rt(w,E,c,b,S),carrierWrapper:a,options:n,plugins:s,icons:o,lang:l,value:i.v,rootId:_,rootKeys:x,frameRoots:$,pluginCallButtons:C.pluginCallButtons,responsiveButtons:C.responsiveButtons,pluginCallButtons_sub:y?y.pluginCallButtons:[],responsiveButtons_sub:y?y.responsiveButtons:[]}},{_w:ne}=Et,oe=Math.floor(96/72*841.89105);const le=class{#t;#e;#s;#i;#n;#o;#l;#r;#a;#c;#h;#d;#u;#p;#g;#m;#f=-1;#v=-1;#b=null;#y=null;#C=0;#w=0;#_=-1;#x=0;#$=[];#S=null;#k=0;#E=0;#T=new Map;#M=null;constructor(t,e){const s=t.$;this.#t=s.store,this.#e=s.context,this.#s=this.#t.get("isScrollable"),this.#i=s.offset,this.#n=s.selection,this.#o=s.toolbar,this.useHeader=s.options.get("_type_options").includes("header"),this.usePage=s.options.get("_type_options").includes("page"),this.#l=e,this.#r=e.get("wysiwyg"),this.#a=e.get("wysiwygFrame"),this.#c=e.get("documentTypeInner"),this.#p=e.get("documentTypePageMirror");const i=ne.getComputedStyle(this.#p);if(this.#g=Lt.get(i.paddingTop),this.#m=Lt.get(i.paddingBottom),this.useHeader){const t=this._getHeaders(),e=this.#h=this.#c.querySelector(".se-document-lines-inner");let i="";for(let e,s=0,n=t.length;s<n;s++)e=t[s],i+=`<div class="se-doc-item se-doc-h${Lt.get(e.nodeName)}" title="${e.textContent}">${e.textContent}</div>`;e.innerHTML=i,this.#b=e.querySelectorAll("div"),s.eventManager.addEvent(e,"click",this.#H.bind(this,this.#r))}this.usePage&&(this.#d=e.get("documentTypePage"),this.#u=s.plugins.pageNavigator)}reHeader(){if(!this.useHeader)return;const t=this._getHeaders(),e=this.#h,s=this.#b;for(let i,n,o,l=0,r=t.length;l<r;l++)if(i=t[l],n=`se-doc-h${Lt.get(i.nodeName)}`,o=s[l],l<s.length)o.classList.contains(n)&&o.textContent===i.textContent||(o.textContent=o.title=i.textContent,o.className=`se-doc-item ${n}`);else{const t=document.createElement("div");t.className=`se-doc-item ${n}`,t.textContent=t.title=i.textContent,e.appendChild(t)}if(s.length>t.length)for(let i=t.length;i<s.length;i++)e.removeChild(s[i]);this.#b=e.querySelectorAll("div")}async rePage(t){this.#d&&(this.#M&&ne.clearTimeout(this.#M),this.#M=ne.setTimeout((async()=>{await Ht.utils.waitForMediaLoad(this.#p,1500);const e=this.#r.scrollHeight>this.#p.scrollHeight?this.#r.scrollHeight-this.#p.scrollHeight:0,s=this.#p.scrollHeight+e,i=this.#r.querySelectorAll(".se-page-break");if(!t&&this.#_===s&&this.#x===i.length)return;this.#_=s,this.#x=i.length;let n=0,o=0,l=0;if(i.length>0){n=i[0].offsetHeight;for(let t=0;t<i.length;t++){const e=i[t].offsetTop;(e-o)%oe!=0&&l++,o=e}const t=s-o;t>0&&t%oe!=0&&l++}const r=this.#s(this.#l)?this._getWWScrollTop():0,a=Math.ceil(s/oe)+l,c=this.#a.offsetWidth+1,h=[];for(let t=0;t<i.length;t++)h.push({number:t,top:i[t].offsetTop+n/2-r});this.#E=0;const d=this.#r.children,u=this.#p.children;this._initializeCache(u),h.push({number:0,top:0});for(let t=1,e=0;t<a;t++)if(e+=oe+(1===t?this.#g+this.#m:this.#g),!h.some((t=>Math.abs(t.top-e)<3))){const s=this._calcPageBreakTop(e,d,u);if(null===s)break;h.push({number:t,top:s})}if(0===h.length)return this.#S=null,this.#C=1,void this._displayCurrentPage();h.sort(((t,e)=>t.top-e.top)),this.#d.innerHTML="",this.#$=[];for(let t,e=0;e<a;e++){if(!h[e])continue;if(t=h[e].top,s<t)break;const i=Ht.utils.createElement("DIV",{style:`top:${t-r}px`,innerHTML:String(e+1)},`<div class="se-document-page-line" style="width: ${c}px;"></div>${e+1}`);this.#d.appendChild(i),this.#$.push(i)}this.#S=this.#d.querySelectorAll(".se-document-page-line"),this.#C=this.#$.length,this._displayCurrentPage()}),400))}_getDisplayPage(){return this.#s(this.#l)?this.#l.get("wysiwyg"):ne}_calcPageBreakTop(t,e,s){const{ci:i}=this._getElementAtPosition(t,s),n=s[i],o=e[i];if(!n||!o)return null;const l=t+(o.offsetTop-n.offsetTop)+(o.offsetHeight-n.offsetHeight)/2;return Math.round(l)}_initializeCache(t){this.#T.clear();for(let e=0,s=t.length;e<s;e++){const s=t[e],i=s.offsetTop,n=s.offsetHeight,o=i+n;this.#T.set(e,{top:i,height:n,bottom:o})}}_getElementAtPosition(t,e){let s=this.#E,i=e.length-1;for(;s<=i;){const e=Math.floor((s+i)/2),{top:n,height:o,bottom:l}=this.#T.get(e);if(t>=n&&t<=l)return this.#E=e,{ci:e,cm:t-l,ch:o};t<n?i=e-1:s=e+1}const n=e[s]?s:i;this.#E=n;const o=this.#T.get(n);return{ci:n,cm:t-o.bottom,ch:o.height}}resizePage(){const t=this.#a.offsetWidth+1,e=this.#a.offsetHeight+1;let s=!1;if(t===this.#f&&(s=e===this.#v))return;t>800?Ht.utils.removeClass(this.#c,"se-document-responsible"):Ht.utils.addClass(this.#c,"se-document-responsible"),this.#f=t,this.#v=e;const i=this.#S;for(let e=0,s=i?.length;e<s;e++)i[e].style.width=`${t}px`;s||this.rePage(!0),this._displayCurrentPage()}scrollPage(){const t=this.#k,e=this._getWWScrollTop();if(t===e)return;const s=this.#$;for(let i=0,n=s.length;i<n;i++)s[i].style.top=Lt.get(s[i].style.top)-(e-t)+"px";this.#k=e,this._displayCurrentPage()}scrollWindow(){this.#s(this.#l)||this._displayCurrentPage()}getCurrentPageNumber(){if(this.#C<=1)return 1;let t=0;if(this.#s(this.#l))t=this.#v/2;else{const e=this._getGlobalTop();if(t=ne.scrollY-e+oe/2,t<=0)return 1}const e=this.#$;for(let s=0,i=e.length;s<i;s++)if(e[s].offsetTop>=t)return this.#w=s;return this.#w=this.#C}pageUp(){const t=this.#w-1<=1?1:this.#w-1;this._movePage(t,!1)}pageDown(){const t=this.#w+1>this.#$.length?this.#$.length:this.#w+1;this._movePage(t,!1)}pageGo(t){t<1?t=1:t>this.#$.length&&(t=this.#$.length),this._movePage(t,!0)}on(t){if(!this.useHeader)return;if(this._is(t)||(t=this._findLinesHeader(t)),!t)return;const e=this._findItem(t);e&&(Ht.utils.removeClass(this.#b,"active"),Ht.utils.addClass(e,"active"))}onChangeText(t){if(!this.useHeader)return;if(!this._is(t))return;const e=this._findItem(t);e&&(e.textContent=t.textContent)}_displayCurrentPage(){const t=this.getCurrentPageNumber();this.#u?.display(t,this.#C)}_getWWScrollTop(){const t=this._getDisplayPage();return t.scrollTop||t.scrollY||0}_movePage(t,e){const s=this._getGlobalTop(),i=this.#s(this.#l),n=Mt.nodeListToArray(this.#r.children),o=this.#d.offsetTop+Lt.get(this.#$[t-1].style.top)+(i?this._getWWScrollTop():0);for(let l,r=0,a=n.length;r<a;r++)if(l=n[r],l.offsetTop>=o){e||this.#n.setRange(l,0,l,0);const n=0===r&&i?0:l.offsetTop-this.#d.offsetTop-l.offsetHeight+s;this._applyPageScroll(n,(()=>{this.#o.isSticky&&this._getDisplayPage().scrollTo({top:n-this.#e.get("toolbar_main").offsetHeight,behavior:"smooth"})})),this.#w=t;break}}_applyPageScroll(t,e){const s=this._getDisplayPage();s.scrollTo({top:t,behavior:"smooth"});const i=()=>{Math.abs((s.scrollY??s.scrollTop)-t)<1?e():ne.requestAnimationFrame(i)};ne.requestAnimationFrame(i)}_getGlobalTop(){return this.#s(this.#l)?0:this.#i.getGlobal(this.#a).top}_findItem(t){const e=this.#y,s=Array.prototype.indexOf.call(e,t);return-1!==s&&this.#b[s]?this.#b[s]:null}_findLinesHeader(t){for(;t&&t!==this.#r;){if(this._is(t))return t;t=t.previousElementSibling||t.parentElement}return null}_is(t){return/^h[1-6]$/i.test(t?.nodeName)}_getHeaders(){return this.#y=this.#r.querySelectorAll("h1, h2, h3, h4, h5, h6")}#H(t,e){e.preventDefault();try{this.#t.set("_preventBlur",!0);const t=Ht.query.getEventTarget(e);if(Ht.utils.hasClass(t,"se-doc-item")){const e=Array.prototype.indexOf.call(this.#b,t);if(-1===e)return;const s=this.#y[e];s&&this.#n.scrollTo(s)}}finally{this.#t.set("_preventBlur",!1)}}_destroy(){this.#M&&(ne.clearTimeout(this.#M),this.#M=null),this.#T&&(this.#T.clear(),this.#T=null),this.#l=null,this.#r=null,this.#a=null,this.#c=null,this.#h=null,this.#d=null,this.#$=null,this.#S=null,this.#b=null,this.#y=null,this.#u=null,this.#p=null}};const re=class{#L;#N=new Map;constructor(t){const e=t.options,s=e.get("mode"),i=e.get("_subMode");this._editorInitFinished=!1,this.mode={isClassic:/classic/i.test(s),isInline:/inline/i.test(s),isBalloon:/balloon/i.test(s),isBalloonAlways:/balloon-always/i.test(s),isSubBalloon:/balloon/i.test(i),isSubBalloonAlways:/balloon-always/i.test(i)},this.#L={rootKey:t.rootId,hasFocus:!1,tabSize:4,indentSize:25,codeIndentSize:2,currentNodes:[],currentNodesMap:[],initViewportHeight:0,currentViewportHeight:0,controlActive:!1,_lastSelectionNode:null,isScrollable:t=>{const e=t.get("options"),s=e.get("height"),i=e.get("maxHeight");return"auto"!==s||!!i&&t.get("wysiwyg").offsetHeight>=Lt.get(i)},_range:null,_mousedown:!1,_preventBlur:!1,_preventFocus:!1}}get(t){return this.#L[t]}set(t,e){const s=this.#L[t];this.#L[t]=e,this.#A(t,e,s)}subscribe(t,e){return this.#N.has(t)||this.#N.set(t,new Set),this.#N.get(t).add(e),()=>this.#N.get(t).delete(e)}#A(t,e,s){const i=this.#N.get(t);if(i)for(const n of i)try{n(e,s)}catch(e){console.error(`[Store] Subscriber error for "${t}":`,e)}}_reset(){}_destroy(){this.#N.clear(),this.#L=null}},{_w:ae,_d:ce}=Et;class he{#B;#I;#V;constructor(t){this.#B=t.frameRoots,this.#I=this.#O(t.context),this.#V=this.#R({value:new Map}),this.rootKeys=t.rootKeys,this.carrierWrapper=t.carrierWrapper,this.icons=t.icons,this.lang=t.lang,this.shadowRoot=null}get frameRoots(){return this.#B}get context(){return this.#I}get frameContext(){return this.#V}init(){this.applyToRoots((t=>{this.#z(t)}))}reset(t){this.#V.reset(t)}applyToRoots(t){this.#B.forEach(t)}#z(t){const e=t.get("options");if(t.set("wwComputedStyle",ae.getComputedStyle(t.get("wysiwyg"))),!e.get("iframe")&&"function"==typeof ShadowRoot){let e=t.get("wysiwygFrame");for(;e;){if(e.shadowRoot){this.shadowRoot=e.shadowRoot;break}if(e instanceof ShadowRoot){this.shadowRoot=e;break}e=e.parentNode}}e.get("iframe")?(t.set("_ww",t.get("wysiwygFrame").contentWindow),t.set("_wd",t.get("wysiwygFrame").contentDocument),t.set("wysiwyg",t.get("_wd").body),e.get("_defaultStyles").editor&&(t.get("wysiwyg").style.cssText=e.get("_defaultStyles").editor),"auto"===e.get("height")&&t.set("_iframeAuto",t.get("_wd").body)):(t.set("_ww",ae),t.set("_wd",ce));const s=e.get("editableFrameAttributes");for(const e in s)t.get("wysiwyg").setAttribute(e,s[e])}#O(t){const e=t;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),get size(){return e.size},clear(){e.clear()}}}#R(t){let e=t.value;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),delete:t=>e.delete(t),getAll:()=>Object.fromEntries(e.entries()),reset(s){e=t.value=s},get size(){return e.size},clear(){e.clear()}}}_destroy(){this.applyToRoots((t=>{const e=t.get("documentType");e&&e._destroy(),Ht.utils.removeItem(t.get("topArea")),t.get("options").clear(),t.clear()})),this.#I.clear(),this.#V.clear(),this.#B.clear(),Ht.utils.removeItem(this.carrierWrapper),this.rootKeys=null,this.carrierWrapper=null,this.icons=null,this.lang=null,this.shadowRoot=null}}class de{#F;#P;#D;#q;constructor(t,e,s){this.#F=t,this.#P=s,this.#D=this.#W({value:e.options}),this.#q=this.#U({value:new Map})}get options(){return this.#D}get frameOptions(){return this.#q}reset(t){const{$:e}=this.#F,s=e.frameRoots,i=e.context,n=e.eventManager,o=e.format,l=e.html,r=e.char,a=e.viewer,c=e.plugins,h=e.history,d=e.ui,u=this.#F._eventOrchestrator;a.codeView(!1),a.showBlocks(!1);const p=new Map,g=[],m=new Map,f={};for(const e in t)void 0!==Dt[e]&&(f[e]=t[e],delete t[e]);for(const e of s.keys())t[e||""]={...f,...t[e||""]};const v=Object.keys(t);if(this.#G(v,c,""),0===v.length)return;1===s.size&&v.unshift(null);const b=[this.#P,t].reduce(((t,e)=>{for(const i in e)s.has(i||null)?this.#Z(i,e,s,p,m,g):t[i]=e[i];return t}),{}),y=this.#D,C=Zt(b,g,c),w=C.o,_=C.frameMap;for(let t,e=0,i=v.length;e<i;e++)if(t=v[e]||null,m.has(t)){const e=p.get(t),i=s.get(t),o=i.get("options"),l=_.get(t);if(i.set("options",l),e.has("statusbar-changed")){if(Ht.utils.removeItem(i.get("statusbar")),l.get("statusbar")){const t=jt(l,null).statusbar;i.get("container").appendChild(t),Ft(t,i),u.__addStatusbarEvent(i,l)}else n.removeEvent(o.get("__statusbarEvent")),l.set("__statusbarEvent",null),Ft(null,i);i.get("statusbar")&&r.display(i)}if(e.has("iframe_attributes")){const t=i.get("wysiwygFrame"),e=o.get("iframe_attributes"),s=l.get("iframe_attributes");for(const s in e)t.removeAttribute(s);for(const e in s)t.setAttribute(e,s[e])}if(e.has("iframe_cssFileName")){const t=i.get("_wd").head,e=t.getElementsByTagName("link");for(;e[0];)t.removeChild(e[0]);const s=(new DOMParser).parseFromString(Mt._setIframeStyleLinks(l.get("iframe_cssFileName")),"text/html").head.children,n=t.querySelector("style");for(;s[0];)t.insertBefore(s[0],n)}e.has("placeholder")&&(i.get("placeholder").textContent=l.get("placeholder")),d.setEditorStyle(l.get("editorStyle"),i);const a=i.get("wysiwyg"),c=o.get("editableFrameAttributes"),h=l.get("editableFrameAttributes");for(const t in c)a.removeAttribute(t);for(const t in h)a.setAttribute(t,h[t])}else switch(t){case"theme":d.setTheme(w.get("theme"));break;case"events":{const t=w.get("events");for(const e in t)n.events[e]=t[e];break}case"autoStyleify":l.__resetAutoStyleify(w.get("autoStyleify"));break;case"textDirection":d.setDir("rtl"===w.get("textDirection")?"rtl":"ltr");break;case"historyStackDelayTime":h.resetDelayTime(w.get("historyStackDelayTime"));break;case"defaultLineBreakFormat":o.__resetBrLineBreak(w.get("defaultLineBreakFormat"))}y.setMany(w),this.#P=b;const x=i.get("toolbar_main");/inline|balloon/i.test(y.get("mode"))&&v.includes("toolbar_width")&&(x.style.width=y.get("toolbar_width")),y.get("toolbar_hide")?x.style.display="none":x.style.display="",y.get("shortcutsHint")?Ht.utils.removeClass(x,"se-shortcut-hide"):Ht.utils.addClass(x,"se-shortcut-hide")}resetFrame(t){this.#q.reset(t)}#Z(t,e,s,i,n,o){const l=e[t],r=Object.keys(l);if(this.#G(r,null,t+"."),0===r.length)return!1;const a=t||null;i.set(a,new Map);const c=s.get(a).get("options").get("_origin"),h={},d=Object.prototype.hasOwnProperty;for(const t in l){if(!d.call(Dt,t))continue;const e=l[t];r.includes(t)&&c[t]!==e&&(i.get(a).set(this.#j(t),!0),h[t]=e)}const u={...c,...h};n.set(a,new Map(Object.entries(u))),o.push({key:a,options:u})}#j(t){return/^statusbar|^charCounter/.test(t)?"statusbar-changed":t}#G(t,e,s){for(let i,n=0,o=t.length;n<o;n++)i=t[n],("fixed"===qt[i]||"fixed"===Dt[i]||e&&e[i])&&(console.warn(`[SUNEDITOR.warn.resetOptions] The "[${s+i}]" option cannot be changed after the editor is created.`),t.splice(n--,1),o--)}#W(t){let e=t.value;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){t.forEach(((t,s)=>e.set(s,t)))},reset(s){e=t.value=s},size:()=>e.size,clear(){e.clear()}}}#U(t){let e=t.value;return{get:t=>e.get(t),set:(t,s)=>e.set(t,s),has:t=>e.has(t),getAll:()=>Object.fromEntries(e.entries()),setMany(t){t.forEach(((t,s)=>e.set(s,t)))},reset(s){e=t.value=s},size:()=>e.size,clear(){e.clear()}}}_destroy(){this.#P=null,this.#D.clear(),this.#q.clear()}}const ue=class{#K;constructor(t){this.#K=t}isNode(t){return t&&"number"==typeof t.nodeType||t instanceof this.#Y().Node}isElement(t){return t&&1===t.nodeType||t instanceof this.#Y().Element}isRange(t){return t&&"Range"===t.constructor?.name||t instanceof this.#Y().Range}isSelection(t){return t&&"Selection"===t.constructor?.name||t instanceof this.#Y().Selection}#Y(){return this.#K.get("_ww")}},{_w:pe,_d:ge,NO_EVENT:me}=Et;const fe=class{#X;#K;#J;#Q=null;#tt=[];constructor(t,e,s){this.#X=s,this.#K=t.frameContext,this.#J=e.frameOptions,this.events=e.options.get("events")||{},this.triggerEvent=async(t,e)=>{if(Ht.check.isNonEditable(e?.frameContext?.get("wysiwyg")))return!1;const s=this.events[t];if("function"==typeof s)try{return await s({$:this.#X,...e})}catch(e){return console.error(`[SUNEDITOR.triggerEvent.${t}]`,e),!1}return me},this.__focusTemp=t.carrierWrapper.querySelector(".__se__focus__temp__")}addEvent(t,e,s,i){if(!t)return null;if((t===pe||t===ge||"number"!=typeof t.length||t.nodeType||!Array.isArray(t)&&t.length<1)&&(t=[t]),0===t.length)return null;const n=t.length;for(let o=0;o<n;o++)t[o].addEventListener(e,s,i),this.#tt.push({target:t[o],type:e,listener:s,useCapture:i});return{target:n>1?t:t[0],type:e,listener:s,useCapture:i}}removeEvent(t){if(!t)return;let e=t.target;const s=t.type,i=t.listener,n=t.useCapture;if(e&&((!Lt.is(e.length)||e.nodeName||!Array.isArray(e)&&e.length<1)&&(e=[e]),0!==e.length)){for(let t=0,o=e.length;t<o;t++)e[t].removeEventListener(s,i,n);return null}}addGlobalEvent(t,e,s){return this.#J.get("iframe")&&this.#K.get("_ww").addEventListener(t,e,s),pe.addEventListener(t,e,s),{type:t,listener:e,useCapture:s}}removeGlobalEvent(t,e,s){if(t)return"object"==typeof t&&(e=t.listener,s=t.useCapture,t=t.type),this.#J.get("iframe")&&this.#K.get("_ww").removeEventListener(t,e,s),pe.removeEventListener(t,e,s),null}_injectActiveEvent(t){Ht.utils.addClass(t,"__se__active"),this.#Q=this.addGlobalEvent("mouseup",(()=>{Ht.utils.removeClass(t,"__se__active"),this.#Q=this.removeGlobalEvent(this.#Q)}))}_init(){for(let t,e=0,s=this.#tt.length;e<s;e++)t=this.#tt[e],t.target.removeEventListener(t.type,t.listener,t.useCapture);this.#tt=null,this.#Q&&=this.removeGlobalEvent(this.#Q)}};const ve=class{#X;#t;#et;#st;#e;#K;#it;#J;constructor(t){this.#X=t.$,this.#t=t.store,this.#et=this.#X.contextProvider.shadowRoot,this.#st=this.#X.contextProvider.carrierWrapper,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#J=this.#X.frameOptions}get(t){const e=this.#K.get("wysiwygFrame"),s=/iframe/i.test(e?.nodeName),i=this.getLocal(t);return{left:i.left+(s?e.parentElement.offsetLeft:0),top:i.top+(s?e.parentElement.offsetTop:0)}}getLocal(t){const e=t;let s=0,i=0,n=0,o=0,l=0,r=3===e.nodeType?e.parentElement:e;const a=e.offsetWidth,c=pt(e,K.bind(this)),h=r;for(;r&&!it(r,"se-wrapper")&&r!==c;)s+=r.offsetLeft-(h!==r?r.scrollLeft:0),i+=r.offsetTop+(h!==r?r.scrollTop:0),r=r.offsetParent;const d=this.#K.get("wysiwygFrame");this.#K.get("wysiwyg").contains(e)&&(n=d.offsetLeft,o=d.offsetTop,l=d.parentElement.offsetWidth-(d.offsetLeft+d.offsetWidth));const u=this.#K.get("eventWysiwyg");return s+=n-(c?c.scrollLeft:0),i+=o-(c?c.scrollTop:0),{left:s,top:i,right:r?.offsetWidth?r.offsetWidth-(s-n+a)+l:0,scrollX:u.scrollLeft||u.scrollX||0,scrollY:u.scrollTop||u.scrollY||0,scrollH:this.#K.get("wysiwyg").scrollHeight||0}}getGlobal(t){const e=this.#K.get("topArea"),s=this.#K.get("wysiwygFrame");if(t||=e,!W(t))return{top:0,left:0,fixedTop:0,fixedLeft:0,width:0,height:0};const i=t,n=i.getBoundingClientRect();let l=n.top,r=n.left;if(/^iframe$/i.test(s.nodeName)&&s.contentDocument.contains(i)){const t=s.getBoundingClientRect();l+=t.top,r+=t.left}return{top:l+o.scrollY,left:r+o.scrollX,fixedTop:l,fixedLeft:r,width:i.offsetWidth,height:i.offsetHeight}}getGlobalScroll(t){const e=this.#K.get("topArea");let s=!1,i=!1;t||=e,t===e&&(s=!0),!s&&W(t)&&(i="absolute"===o.getComputedStyle(t).position);let n=0,l=0,r=0,a=0,c=0,h=0,d=0,u=0,p=null,g=null,m=null,f=null,v=t;for(;v;)n+=v.scrollTop,l+=v.scrollLeft,r+=v.scrollHeight,a+=v.scrollWidth,v.scrollTop>0&&(h+=v.offsetTop),v.scrollHeight>=v.clientHeight&&(d=/^html$/i.test(v.nodeName)?d||v.clientHeight:v.clientHeight+(m?-m.clientTop:0),p=m||p||v,m=v),v.scrollLeft>0&&(c+=v.offsetLeft),v.scrollWidth>=v.clientWidth&&(u=/^html$/i.test(v.nodeName)?u||v.clientWidth:v.clientWidth+(f?-f.clientLeft:0),g=f||g||v,f=v),v=v.parentElement;if(!i&&!s&&/^iframe$/i.test(this.#K.get("wysiwygFrame").nodeName))for(v=this.#K.get("wrapper"),p=g=e;v;)n+=v.scrollTop,l+=v.scrollLeft,r+=v.scrollHeight,a+=v.scrollWidth,v.scrollTop>0&&(h+=v.offsetTop),v.scrollHeight>=v.clientHeight&&(d=/^html$/i.test(v.nodeName)?d||v.clientHeight:v.clientHeight+(m?-m.clientTop:0),m=v),v.scrollLeft>0&&(c+=v.offsetLeft),v.scrollWidth>=v.clientWidth&&(u=/^html$/i.test(v.nodeName)?u||v.clientWidth:v.clientWidth+(f?-f.clientLeft:0),f=v),v=v.parentElement;for(v=this.#et?.host,v&&(p=g=e);v;)n+=v.scrollTop,l+=v.scrollLeft,r+=v.scrollHeight,a+=v.scrollWidth,v.scrollTop>0&&(h+=v.offsetTop),v.scrollHeight>=v.clientHeight&&(d=/^html$/i.test(v.nodeName)?d||v.clientHeight:v.clientHeight+(m?-m.clientTop:0),m=v),v.scrollLeft>0&&(c+=v.offsetLeft),v.scrollWidth>=v.clientWidth&&(u=/^html$/i.test(v.nodeName)?u||v.clientWidth:v.clientWidth+(f?-f.clientLeft:0),f=v),v=v.parentElement;const b=e.contains(p),y=e.contains(g);p=b?e:p,g=y?e:g;const C=p?p.getBoundingClientRect().top+(!p.parentElement||/^html$/i.test(p.parentElement.nodeName)?o.scrollY:0):0,w=g?g.getBoundingClientRect().left+(!g.parentElement||/^html$/i.test(g.parentElement.nodeName)?o.scrollX:0):0;d=b?e.clientHeight:d,u=y?e.clientWidth:u;const _=lt(this.#K.get("_wd"));return{top:n,left:l,ts:C,ls:w,width:a,height:r,x:c,y:h,ohOffsetEl:i?window:p,owOffsetEl:i?window:g,oh:i?_.h:d,ow:i?_.w:u,heightEditorRefer:b,widthEditorRefer:y}}getWWScroll(){const t=this.#K.get("eventWysiwyg"),e=t.scrollTop||t.scrollY||0,s=t.scrollHeight||t.document?.documentElement.scrollHeight||0;return{top:e,left:t.scrollLeft||t.scrollX||0,width:t.scrollWidth||t.document?.documentElement.scrollWidth||0,height:s,bottom:e+s}}setRelPosition(t,e,s,i){const n=/^fixed$/i.test(o.getComputedStyle(i).position),r=this.getGlobal(s);if(n)t.style.position="fixed",t.style.top=`${r.fixedTop+r.height}px`;else{t.style.position="";const n=i.contains(t)?this.getGlobal(e).top:0,o=t.offsetHeight,a=this.getGlobalScroll().top,c=r.top,h=lt(l).h-(n-a+c+s.offsetHeight);if(h<o){let e=-1*(o-c+3);const i=n-a+e,l=o+(i<0?i:0);l>h?(t.style.height=`${l}px`,e=-1*(l-c+3)):(t.style.height=`${h}px`,e=c+s.offsetHeight),t.style.top=`${e}px`}else t.style.top=`${c+s.offsetHeight}px`}const a=t.offsetWidth,c=s.offsetWidth,h=r.left,d=this.getGlobal(i).left;if(this.#it.get("_rtl")){const e=a>c?a-c:0,s=e>0?0:c-a;t.style.left=`${h-e+s}px`,d>this.getGlobal(t).left&&(t.style.left=d+"px")}else{const e=i.offsetWidth+d,s=e<=a?0:e-(h+a);t.style.left=s<0?`${h+s}px`:`${h}px`}}setAbsPosition(t,e,s){const i={left:0,top:0,...s.addOffset},n=s.position||"bottom",r=s.inst,a=!this.#it.get("_rtl");a||(i.left*=-1);const c=this.#J.get("iframe"),h=this.#K.get("wrapper").contains(e)||s.isWWTarget||!!c&&this.#K.get("wysiwyg").contains(e),d=Boolean(pt(e,".se-toolbar")),u=1===e.nodeType,p=h&&!u,g=u&&/inline/.test(o.getComputedStyle(e).display),m=lt(l),f=p?this.getWWScroll():this.#nt(),v=!h||!c&&u?e.getBoundingClientRect():this.#X.selection.getRects(e,"start").rects,b=this.getGlobal(e),y=it(t.firstElementChild,"se-arrow")?t.firstElementChild:null,C=s.sibling?.offsetHeight||0,w=y?y.offsetHeight:0,_=t.offsetHeight,x=e.offsetHeight,$=v.top,S=m.h-v.bottom,k=this.getGlobal(this.#K.get("topArea")).top,E=o.scrollY,T=this.#e.get("toolbar_main").offsetHeight,M=this.#it.get("toolbar_container"),H=this.#t.mode.isBalloon||this.#t.mode.isInline||M,L=M&&k-E-T>0||!this.#X.toolbar.isSticky&&H?0:T+(this.#X.toolbar.isSticky?this.#it.get("toolbar_sticky"):0),N=this.#K.get("statusbar")?.offsetHeight||0,{rmt:A,rmb:B,bMargin:I,rt:V}=this.#ot($,S,L,m,v,p,d);if(h&&(B-N+x<=0||A+V+x-(this.#X.toolbar.isSticky&&g?L:0)<=0)||A+x<0)return;const O=this.#X.toolbar.isSticky&&"none"!==this.#e.get("toolbar_main").style.display&&(!H||this.#K.get("topArea").getBoundingClientRect().top<=T);let R=i.top,z=0,F="";"bottom"===n?(F="up",R+=v.bottom+w+E,z=B-(_+w),z-C<0&&(F="down",R-=x+_+2*w,z=A-(_+w),z-C<0&&(F="",R-=z-C-Math.max(1,z+_+w)))):(F="down",R+=v.top-_-w+E,z=(O?v.top-L:A)-_-w,z-C<0&&(F="up",R+=x+_+2*w,z=(B>0?I:B)-(_+w)-N,z-C<0&&(F="",R+=z-2))),this.#lt(y,F),t.style.top=`${R}px`;const P=(1===t.nodeType?Lt.get(o.getComputedStyle(t).borderRadius):0)||0,D=b.width,q=t.offsetWidth,W=y?y.offsetWidth:0,U=v.left,G=m.w-v.right;if(h&&(U+D<=0||G+D<=0))return;y&&(y.style.left="",y.style.right="");let Z=i.left,j=0,K=0,Y=0;return a?(Z+=v.left+o.scrollX-(U<0?U:0),j=D+U,j<W&&(Y=W/2-1+(P<=2?0:P-2),K=Y),j=D+G-q,j<0&&(Z+=j,Y=q-1-(W/2+(P<=2?0:P-2)),K=-(j-W/2),K=K>Y?Y:K),y&&K>0&&(y.style.left=K+"px")):(Z+=v.right-q+o.scrollX+(G<0?G:0),j=D+G,j<W&&(Y=W/2-1+(P<=2?0:P-2),K=Y),j=D+U-q,j<0&&(Z-=j,Y=W/2-1+(P<=2?0:P-2),K=-(j-W/2),K=K<Y?Y:K>q-Y?q-Y:K),y&&K>0&&(y.style.right=K+"px")),t.style.left=`${Z}px`,r.__offset={left:t.offsetLeft+f.left,top:t.offsetTop+f.top,addOffset:i},{position:"up"===F?"bottom":"top"}}setRangePosition(t,e,{position:s,addTop:i}={}){t.style.top="-10000px",t.style.visibility="hidden",t.style.display="block";let n="top"===s;e||=this.#X.selection.getRange();const o=this.#X.selection.getRects(e,n?"start":"end");n="start"===o.position;const r=this.#K.get("isFullScreen"),a=this.#K.get("topArea"),c=o.rects,h=r?0:o.scrollLeft,d=r?0:o.scrollTop,u=a.offsetWidth,p=this.getGlobal(a),g=p.left,m=t.offsetWidth,f=t.offsetHeight;this.#rt(n,c,t,g,u,h,d,i),this.getGlobal(t).top-p.top<0&&(n=!n,this.#rt(n,c,t,g,u,h,d,i)),m===t.offsetWidth&&f===t.offsetHeight||this.#rt(n,c,t,g,u,h,d,i);const v=!this.#st.contains(t),b=lt(l),y=c.height,C=c.top,w=b.h-c.bottom,_=this.#X.toolbar.isSticky||!this.#t.mode.isBalloon&&!this.#t.mode.isInline?this.#e.get("toolbar_main").offsetHeight:0,{rmt:x,rmb:$,rt:S}=this.#ot(C,w,_,b,c,v,!1);if(!($+y<=0||x+S+y<=0))return t.style.visibility="",!0}#rt(t,e,s,i,n,o,r,a=0){const c=s.querySelector(".se-arrow "),h=Math.round(c.offsetWidth/2),d=s.offsetWidth,u=e.noText&&!t?0:s.offsetHeight,p=(t?e.left:e.right)-i-d/2+o,g=p+d-n;let m=(t?e.top-u-h:e.bottom+h)-(e.noText?0:a)+r;const f=p<0?1:g<0?p:p-g-1-1;let v=!1;const b=m+(t?this.getGlobal(this.#K.get("topArea")).top:s.offsetHeight-this.#K.get("wysiwyg").offsetHeight);!t&&b>0&&this.#at()<b?(t=!0,v=!0):t&&l.documentElement.offsetTop>b&&(t=!1,v=!0),v&&(m=(t?e.top-u-h:e.bottom+h)-(e.noText?0:a)+r),s.style.left=Math.floor(f)+"px",s.style.top=Math.floor(m)+"px",t?(ot(c,"se-arrow-up"),nt(c,"se-arrow-down")):(ot(c,"se-arrow-down"),nt(c,"se-arrow-up"));const y=Math.floor(d/2+(p-f));c.style.left=(y+h>s.offsetWidth?s.offsetWidth-h:y<h?h:y)+"px"}#at(){const t=this.#K.get("topArea");return l.documentElement.scrollHeight-(this.getGlobal(t).top+t.offsetHeight)}#ot(t,e,s,i,n,l,r){const a=this.#X.selection.getRects(this.#K.get("wysiwyg"),"start").rects;let c=0,h=0,d=0,u=0,p=0;const g=this.#J.get("iframe");u=n.top,p=i.h-n.bottom;const m=this.getGlobal();if(l){d=r||this.#X.toolbar.isSticky||this.#it.get("toolbar_container")?0:s;const t=g?0:m.top-o.scrollY+d,e=g?0:this.#t.get("currentViewportHeight")-(m.top+m.height-o.scrollY);let i=t;s>t?i=this.#X.toolbar.isSticky?s:t+s:this.#it.get("toolbar_container")&&!this.#X.toolbar.isSticky?s=0:i=t+s,c=n.top-(a.top-i)+s,h=a.bottom-(n.bottom-e),c=c>0?c:c-s}else{const t=m.fixedTop>0?m.fixedTop:0,e=o.innerHeight-(m.fixedTop+m.height);d=r||!this.#X.toolbar.isSticky&&this.#X.toolbar.isBalloonMode?0:s,c=u-(r?0:t)-d,h=p-(e>0?e:0)}return{rmt:c,rmb:h,rt:d,tMargin:u,bMargin:p}}#lt(t,e){"up"===e?(t&&(t.style.visibility=""),nt(t,"se-arrow-up"),ot(t,"se-arrow-down")):"down"===e?(t&&(t.style.visibility=""),nt(t,"se-arrow-down"),ot(t,"se-arrow-up")):t&&(t.style.visibility="hidden")}#nt(){const t=lt(l);return{top:o.scrollY,left:o.scrollX,width:t.w,height:t.h,bottom:o.scrollY+t.h,rects:{left:0,top:0,right:o.innerWidth,bottom:this.#t.get("currentViewportHeight")||o.innerHeight,noText:!0}}}},{_w:be}=Et;const ye=class{#F;#X;#t;#et;#ct;#e;#K;#it;#J;#ht=0;#dt=!1;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#et=this.#X.contextProvider.shadowRoot,this.#ct=this.#X.instanceCheck,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#J=this.#X.frameOptions,this.range=null,this.selectionNode=null,this.__iframeFocus=!1}get(){let t=null;return t="function"==typeof this.#et?.getSelection?this.#et.getSelection():this.#K.get("_ww").getSelection(),t?(this.#t.get("_range")||this.#K.get("wysiwyg").contains(t.focusNode)||(t.removeAllRanges(),t.addRange(this.#ut())),t):null}isRange(t){return this.#ct.isRange(t)}getRange(){const t=this.#t.get("_range")||this.#ut(),e=this.get();if(t.collapsed===e.isCollapsed||!this.#K.get("wysiwyg").contains(e.focusNode)){if(this.#X.component.is(t.startContainer)){const e=this.#X.component.get(t.startContainer),s=e?.container;return s?this.setRange(s,0,s,1):t}return t}if(e.rangeCount>0){const t=e.getRangeAt(0);return this.#t.set("_range",t),t}{const t=e.anchorNode,s=e.focusNode,i=e.anchorOffset,n=e.focusOffset,o=Ht.query.compareElements(t,s),l=o.ancestor&&(0===o.result?i<=n:o.result>1);return this.setRange(l?t:s,l?i:n,l?s:t,l?n:i)}}setRange(t,e,s,i){let n,o,l,r;if(this.isRange(t)){const e=t;n=e.startContainer,o=e.startOffset,l=e.endContainer,r=e.endOffset}else n=t,o=e,l=s,r=i;if(!n||!l)return;(Ht.check.isBreak(n)||3===n.nodeType)&&o>n.textContent.length&&(o=n.textContent.length),(Ht.check.isBreak(l)||3===l.nodeType)&&r>l.textContent.length&&(r=l.textContent.length),this.#X.format.isLine(n)&&(n=n.childNodes[o>0?n.childNodes.length-1:0]||n,o=o>0?1!==n.nodeType||Ht.check.isBreak(n)?n.textContent?n.textContent.length:0:1:0),this.#X.format.isLine(l)&&(l=l.childNodes[r>0?l.childNodes.length-1:0]||l,r=r>0?1!==l.nodeType||Ht.check.isBreak(l)?l.textContent?l.textContent.length:0:1:0);const a=this.#K.get("_wd").createRange();try{o=Math.min(o,n.textContent?.length||0),r=r>0&&0===(l.textContent?.length||0)&&1===l.nodeType?1:Math.min(Math.max(r,0),l.textContent?.length||0),a.setStart(n,o),a.setEnd(l,r),this.#t.set("hasFocus",!0)}catch(t){return console.warn("[SUNEDITOR.selection.focus.warn]",t.message),void this.#X.focusManager.nativeFocus()}const c=this.get();return c.removeAllRanges&&c.removeAllRanges(),c.addRange(a),this.#t.set("_range",a),this.#pt(a,this.get()),this.#J.get("iframe")&&this.__focus(),a}removeRange(){this.#t.set("_range",null),this.#t.set("_lastSelectionNode",null),this.selectionNode=null,this.#t.get("hasFocus")&&this.get().removeAllRanges(),this.#F._eventOrchestrator.selectionState.reset()}getNearRange(t){const e=t.nextSibling,s=t.previousSibling;return e?{container:e,offset:0}:s?{container:s,offset:1}:null}getRangeAndAddLine(t,e){if(this.#gt(t)){const s=e?.parentElement||this.#K.get("wysiwyg"),i=Ht.utils.createElement(this.#it.get("defaultLine"),null,"<br>");s.insertBefore(i,e&&e!==s?e.previousElementSibling?e.nextElementSibling:e:s.firstElementChild),this.setRange(i.firstElementChild,0,i.firstElementChild,1),t=this.#t.get("_range")}return t}getNode(){if(this.#K.get("wysiwyg").contains(this.selectionNode)||this.init(),!this.selectionNode){const t=Ht.query.getEdgeChild(this.#K.get("wysiwyg").firstChild,(t=>0===t.childNodes.length||3===t.nodeType),!1);if(t)return this.selectionNode=t,t;this.init()}return this.selectionNode}getRects(t,e){const s=!!Ht.check.isElement(t)&&"absolute"===be.getComputedStyle(t).position;t=!t||Ht.check.isText(t)?this.getRange():t;const i=this.#X.offset.getGlobalScroll();let n="start"===e,o=i.left,l=i.top,r=t.getClientRects();if(r=r[n?0:r.length-1],!r){const t=this.getNode();if(this.#X.format.isLine(t)){const t=Ht.utils.createTextNode(Tt.zeroWidthSpace);this.#X.html.insertNode(t,{afterNode:null,skipCharCount:!0}),this.setRange(t,1,t,1),this.init(),r=this.getRange().getClientRects(),r=r[n?0:r.length-1]}if(!r){const e=this.#X.offset.get(t);r={left:e.left,top:e.top,right:e.left+t.offsetWidth,bottom:e.top+t.offsetHeight,noText:!0},o=0,l=0}n=!0}const a=/^iframe$/i.test(this.#K.get("wysiwygFrame").nodeName)?this.#K.get("wysiwygFrame").getClientRects()[0]:null;return!s&&a&&(r={left:r.left+a.left,top:r.top+a.top,right:r.right+a.right-a.width,bottom:r.bottom+a.bottom-a.height}),{rects:r,position:n?"start":"end",scrollLeft:o,scrollTop:l}}getDragEventLocationRange(t){const e=this.#K.get("_wd");let s,i,n,o,l;return e.caretPositionFromPoint?(s=e.caretPositionFromPoint(t.clientX,t.clientY),i=s.offsetNode,n=s.offset,o=s.offsetNode,l=s.offset):e.caretRangeFromPoint&&(s=e.caretRangeFromPoint(t.clientX,t.clientY),i=s.startContainer,n=s.startOffset,o=s.endContainer,l=s.endOffset),{sc:i,so:n,ec:o,eo:l}}scrollTo(t,e){this.#ct.isSelection(t)?t=t.getRangeAt(0):this.#ct.isNode(t)?t=this.setRange(t,1,t,1):void 0===t?.startContainer&&console.warn('[SUNEDITOR.html.scrollTo.warn] "selectionRange" must be Selection or Range or Node object.',t);const s=Ht.query.getParentElement(t?.startContainer,(t=>1===t.nodeType));if(!s)return;e={behavior:"smooth",block:"nearest",inline:"nearest",...e};const i=this.#K.get("_ww"),n=this.#K.get("wysiwygFrame"),o=this.#J.get("iframe"),l=!this.#t.get("isScrollable")(this.#K),r=this.#t.get("currentViewportHeight"),a=l?be.scrollY:o?i.scrollY:n.scrollTop,c=this.#e.get("toolbar_main").offsetHeight,h=this.#X.toolbar.isSticky?c:0,d=this.#X.toolbar.isSticky?h+this.#it.get("toolbar_sticky"):h,u=this.#K.get("statusbar")?.offsetHeight||0;if(this.#dt)return s?.scrollIntoView(e),void("auto"===e?.behavior&&a!==be.scrollY&&(d&&a>be.scrollY?be.scrollBy(0,-d):l&&be.scrollBy(0,u)));const p=this.#ht,g=l?r:n.offsetHeight,m=s.offsetHeight||0,f=e?.behavior;if(l)if(o){const e=this.getRects(t,"end").rects,s=e.top+m-d,i=g-p-(e.top+m);if(s>=0&&i>=0)return;const n=a-(s<0?-(s-p):i);be.scrollTo({top:n<a?n-d:n,behavior:f})}else{const t=g+a-this.#X.offset.getGlobal(s).top-m;if(t-p>0&&g>t+p+d)return;const e=t<=p?a-t+p+u:a-t+(g-m-p);be.scrollTo({top:e<a?e-d:e,behavior:f})}else{const{rects:t}=this.getRects(s,"start"),{top:e}=this.#X.offset.getLocal(s),l=e<0&&t.top<0?e:t.top,d=l-p>0&&l+p<=g;let v=a+(l-p>0?l+p-g:l-(h+m));const b=be.scrollY,y=this.#X.offset.getGlobal(),C=b-y.top+c,w=y.top+y.height-(b+r)+c;if(C>0){const t=(d?l:l+a-v)-m-p-C;t<0&&(v+=c,be.scrollTo({top:b+t,behavior:"smooth"}))}if(w>0){const t=(d?l:l+a-v)+m+p-(y.height-w);t>0&&(v+=u,be.scrollTo({top:b+t,behavior:"smooth"}))}d||(o?i:n).scrollTo({top:v,behavior:f})}}resetRangeToTextNode(){let t=this.getRange();if(this.#gt(t)){if(!Ht.check.isWysiwygFrame(t.startContainer)||!Ht.check.isWysiwygFrame(t.endContainer))return!1;const e=t.commonAncestorContainer,s=e.children[t.startOffset],i=e.children[t.endOffset];if(!(t=this.setRange(s,0,i,s===i?0:1)))return!1}const e=t,s=e.collapsed;let i,n,o,l=e.startContainer,r=e.startOffset,a=e.endContainer,c=e.endOffset;if(this.#X.format.isLine(l))for(l.childNodes[r]?(l=l.childNodes[r]||l,r=0):(l=l.lastChild||l,r=l.textContent.length);1===l?.nodeType&&l.firstChild;)l=l.firstChild||l,r=0;if(this.#X.format.isLine(a)){for(a=a.childNodes[c]||a.lastChild||a;1===a?.nodeType&&a.lastChild;)a=a.lastChild;s?c=0:c>0&&(c=a.textContent.length)}if(i=Ht.check.isWysiwygFrame(l)?this.#K.get("wysiwyg").firstChild:l,n=r,Ht.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ht.check.isBreak(i);if(!t){const t=i;for(;i&&!Ht.check.isBreak(i)&&1===i.nodeType&&(o=i.childNodes,0!==o.length);)i=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:i.previousElementSibling||i.previousSibling||l,n=n>0?i.textContent.length:n;let e=this.#X.format.getLine(i,null);e===this.#X.format.getBlock(e,null)&&(i||=t,e=Ht.utils.createElement(Ht.query.getParentElement(i,Ht.check.isTableCell)?"DIV":this.#it.get("defaultLine")),i.parentNode.insertBefore(e,i),i!==t&&e.appendChild(i))}if(Ht.check.isBreak(i)||this.#X.component.is(i)){const e=Ht.utils.createTextNode(Tt.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,t&&l===a&&(a=i,c=1)}}if(l=i,r=n,i=Ht.check.isWysiwygFrame(a)?this.#K.get("wysiwyg").lastChild:a,n=c,Ht.check.isBreak(i)||1===i.nodeType&&i.childNodes.length>0){const t=Ht.check.isBreak(i);if(!t){for(;i&&!Ht.check.isBreak(i)&&1===i.nodeType&&(o=i.childNodes,0!==o.length);)i=o[n>0?n-1:n]||!/FIGURE/i.test(o[0].nodeName)?o[0]:i.previousElementSibling||i.previousSibling||l,n=n>0?i.textContent.length:n;let t=this.#X.format.getLine(i,null);t===this.#X.format.getBlock(t,null)&&(t=Ht.utils.createElement(Ht.check.isTableCell(t)?"DIV":this.#it.get("defaultLine")),i.parentNode.insertBefore(t,i),t.appendChild(i))}if(Ht.check.isBreak(i)){const e=Ht.utils.createTextNode(Tt.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e,n=1,t&&!i.previousSibling&&Ht.utils.removeItem(a)}}return a=i,c=n,this.setRange(l,r,a,c),!0}init(){const t=this.#K.get("_wd").activeElement;if(Ht.check.isInputElement(t))return this.selectionNode=t,t;const e=this.get();if(!e)return null;let s=null;s=e.rangeCount>0?e.getRangeAt(0):this.#ut(),this.#pt(s,e)}#pt(t,e){let s=null;this.#t.set("_range",t),s=t.collapsed?Ht.check.isWysiwygFrame(t.commonAncestorContainer)&&t.commonAncestorContainer.children[t.startOffset]||t.commonAncestorContainer:e.anchorNode,this.selectionNode=s}#gt(t){const e=t.commonAncestorContainer;return Ht.check.isWysiwygFrame(t.startContainer)&&Ht.check.isWysiwygFrame(t.endContainer)||/FIGURE/i.test(e.nodeName)||this.#X.pluginManager.fileInfo.regExp.test(e.nodeName)&&(!this.#X.pluginManager.fileInfo.tagAttrs[e.nodeName]||this.#X.pluginManager.fileInfo.tagAttrs[e.nodeName]?.every((t=>e.hasAttribute(t))))||this.#X.component.is(e)}#ut(){const t=this.#K.get("wysiwyg"),e=this.#K.get("_wd").createRange();let s=t.firstElementChild,i=null;return s?(i=s.firstChild,i||(i=Ht.utils.createElement("BR"),s.appendChild(i))):(i=Ht.utils.createElement("BR"),s=Ht.utils.createElement(this.#it.get("defaultLine"),null,i),t.appendChild(s)),e.setStart(i,0),e.setEnd(i,0),e}__focus(){try{this.__iframeFocus=!0;const t=Ht.query.getParentElement(this.getNode(),"figcaption");t?t.focus():this.#K.get("wysiwyg").focus()}finally{be.setTimeout((()=>this.__iframeFocus=!1),0)}}__init(){this.#dt=this.#F._eventOrchestrator.scrollparents?.length>0,this.#ht=this.#K?.get("wysiwyg")?(Lt.get(be.getComputedStyle(this.#K.get("wysiwyg")).scrollMargin,0)||40)+Lt.get(be.getComputedStyle(this.#K.get("wrapper")).paddingBottom,0):40}};function Ce(t,e,s){const i=[];for(let n,o,l=0,r=t.length;l<r;l++)n=t[l],Ht.check.isListCell(n)?(e<0||n.previousElementSibling)&&i.push(n):(o=/\d+/.test(n.style[s])?Lt.get(n.style[s],0):0,o+=e,Ht.utils.setStyle(n,s,o<=0?"":o+"px"));return i}const we=class{#X;#t;#it;#K;#mt;#ft;#vt;#bt;#yt;#Ct;#wt=null;constructor(t){this.#X=t.$,this.#t=t.store,this.#it=this.#X.options,this.#K=this.#X.frameContext,this.#mt=this.#it.get("formatLine").reg,this.#ft=this.#it.get("formatBrLine").reg,this.#vt=this.#it.get("formatBlock").reg,this.#bt=this.#it.get("formatClosureBlock").reg,this.#yt=this.#it.get("formatClosureBrLine").reg,this.#Ct=new RegExp("^("+this.#it.get("textStyleTags")+")$","i"),this.__resetBrLineBreak(this.#it.get("defaultLineBreakFormat"))}setLine(t){if(!this.isLine(t))throw new Error('[SUNEDITOR.format.setLine.fail] The "element" must satisfy "format.isLine()".');const e=this.#_t(),s=e.lines,i=t.className,n=t.nodeName;let o=e.firstNode,l=e.lastNode;for(let e,r,a=0,c=s.length;a<c;a++)e=s[a],e.nodeName===n&&(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim()===i||this.#X.component.is(e)||(r=t.cloneNode(!1),Ht.utils.copyFormatAttributes(r,e),r.innerHTML=e.innerHTML,e.parentNode.replaceChild(r,e)),0===a&&(o=r||e),a===c-1&&(l=r||e),r=null;this.#X.selection.setRange(Ht.query.getNodeFromPath(e.firstPath,o),e.startOffset,Ht.query.getNodeFromPath(e.lastPath,l),e.endOffset),this.#X.history.push(!1),this.#K.has("documentType_use_header")&&this.#K.get("documentType").reHeader()}getLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ht.check.isWysiwygFrame(t))return null;if(this.isBlock(t)){if(this.isLine(t.firstElementChild))return t.firstElementChild;if(this.isLine(t))return t}if(this.isLine(t)&&e(t))return t;t=t.parentNode}return null}setBrLine(t){if(!this.isBrLine(t))throw new Error('[SUNEDITOR.format.setBrLine.fail] The "element" must satisfy "format.isBrLine()".');const e=this.#_t().lines,s=e.length-1;let i=e[s].parentNode,n=t.cloneNode(!1);const o=n;for(let o,l,r,a,c,h,d=s,u=!0;d>=0;d--)if(o=e[d],o!==(e[d+1]?e[d+1].parentNode:null)){if(h=this.#X.component.is(o),l=h?"":o.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),r=Ht.query.getParentElement(o,(t=>t.parentNode===i)),(i!==o.parentNode||h)&&(this.isLine(i)?(i.parentNode.insertBefore(n,i.nextSibling),i=i.parentNode):(i.insertBefore(n,r?r.nextSibling:null),i=o.parentNode),a=n.nextSibling,a&&n.nodeName===a.nodeName&&Ht.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ht.utils.removeItem(a)),n=t.cloneNode(!1),u=!0),c=n.innerHTML,n.innerHTML=(u||!l||!c||/<br>$/i.test(l)?l:l+"<BR>")+c,0===d){i.insertBefore(n,o),a=o.nextSibling,a&&n.nodeName===a.nodeName&&Ht.check.isSameAttributes(n,a)&&(n.innerHTML+="<BR>"+a.innerHTML,Ht.utils.removeItem(a));const t=n.previousSibling;t&&n.nodeName===t.nodeName&&Ht.check.isSameAttributes(n,t)&&(t.innerHTML+="<BR>"+n.innerHTML,Ht.utils.removeItem(n))}h||Ht.utils.removeItem(o),l&&(u=!1)}this.#X.selection.setRange(o,0,o,0),this.#X.history.push(!1)}getBrLine(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ht.check.isWysiwygFrame(t))return null;if(this.isBrLine(t)&&e(t))return t;t=t.parentNode}return null}addLine(t,e){if(!t||!t.parentNode)return null;const s=this.getLine(this.#X.selection.getNode(),null);let i=null;if(this.isBrLine(t)||!this.isBrLine(s||t.parentNode)||this.#X.component.is(t)){const t=e?"string"==typeof e?e:e.nodeName:this.isNormalLine(s)?s.nodeName:this.#it.get("defaultLine");i=Ht.utils.createElement(t,null,"<br>"),(e&&"string"!=typeof e||!e&&this.isLine(s))&&Ht.utils.copyTagAttributes(i,e||s,["id"])}else i=Ht.utils.createElement("BR");return Ht.check.isTableCell(t)?t.insertBefore(i,t.nextElementSibling):t.parentNode.insertBefore(i,t.nextElementSibling),i}getBlock(t,e){if(!t)return null;for(e||=()=>!0;t;){if(Ht.check.isWysiwygFrame(t))return null;if(this.isBlock(t)&&!/^(THEAD|TBODY|TR)$/i.test(t.nodeName)&&e(t))return t;t=t.parentNode}return null}applyBlock(t){this.#X.selection.getRangeAndAddLine(this.#X.selection.getRange(),null);const e=this.getLinesAndComponents(!1);if(!e||0===e.length)return;t:for(let t,s,i,n,o,l,r=0,a=e.length;r<a;r++)if(t=e[r],Ht.check.isListCell(t))if(s=t.lastElementChild,s&&Ht.check.isListCell(t.nextElementSibling)&&e.includes(t.nextElementSibling)&&(n=s.lastElementChild,e.includes(n))){let t=null;for(;t=n.lastElementChild;)if(Ht.check.isList(t)){if(!e.includes(t.lastElementChild))continue t;n=t.lastElementChild}i=s.firstElementChild,o=e.indexOf(i),l=e.indexOf(n),e.splice(o,l-o+1),a=e.length}else;const s=e.at(-1);let i,n,o;i=this.isBlock(s)||this.isLine(s)?s:this.getBlock(s,null)||this.getLine(s,null),Ht.check.isTableCell(i)?(n=null,o=i):(n=i.nextSibling,o=i.parentNode);const l=t.cloneNode(!1);let r=Ht.query.getNodeDepth(i),a=null;const c=[],h=(t,e,s)=>{let i=null;if(t!==e&&!Ht.check.isTableElements(e)){if(e&&Ht.query.getNodeDepth(t)===Ht.query.getNodeDepth(e))return s;i=this.#X.nodeTransform.removeAllParents(e,null,t)}return i?i.ec:s};for(let t,s,i,d,u,p,g,m=0,f=e.length;m<f;m++)if(t=e[m],s=t.parentNode,s&&!l.contains(s))if(i=Ht.query.getNodeDepth(t),Ht.check.isList(s)){if(null===a&&(p?(a=p,g=!0,p=null):a=s.cloneNode(!1)),c.push(t),u=e[m+1],m===f-1||u?.parentNode!==s){t.contains(u?.parentNode)&&(p=u.parentNode.cloneNode(!1));let e,m=s.parentNode;for(;Ht.check.isList(m);)e=Ht.utils.createElement(m.nodeName),e.appendChild(a),a=e,m=m.parentNode;const f=this.removeBlock(s,{selectedFormats:c,newBlockElement:null,shouldDelete:!0,skipHistory:!0});r>=i?(r=i,o=f.cc,n=h(o,s,f.ec),n&&(o=n.parentNode)):o===f.cc&&(n=f.ec),o!==f.cc&&(d=h(o,f.cc,d),n=void 0!==d?d:f.cc);for(let t=0,e=f.removeArray.length;t<e;t++)a.appendChild(f.removeArray[t]);g||l.appendChild(a),p&&f.removeArray.at(-1).appendChild(p),a=null,g=!1}}else r>=i&&(r=i,o=s,n=t.nextSibling),l.appendChild(t),o!==s&&(d=h(o,s),void 0!==d&&(n=d));if(this.#t.set("_lastSelectionNode",null),this.#X.nodeTransform.mergeSameTags(l,null,!1),this.#X.nodeTransform.mergeNestedTags(l,(t=>Ht.check.isList(t))),n&&Ht.query.getNodeDepth(n)>0&&(Ht.check.isList(n.parentNode)||Ht.check.isList(n.parentNode.parentNode))){const t=Ht.query.getParentElement(n,(t=>this.isBlock(t)&&!Ht.check.isList(t))),e=this.#X.nodeTransform.split(n,null,t?Ht.query.getNodeDepth(t)+1:0);e.parentNode.insertBefore(l,e)}else o.insertBefore(l,n),h(l,n);const d=Ht.query.getEdgeChildNodes(l.firstElementChild,l.lastElementChild);e.length>1?this.#X.selection.setRange(d.sc,0,d.ec,d.ec.textContent.length):this.#X.selection.setRange(d.ec,d.ec.textContent.length,d.ec,d.ec.textContent.length),this.#X.history.push(!1)}removeBlock(t,{selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}={}){const o=this.#X.selection.getRange();let l=o.startOffset,r=o.endOffset,a=Ht.query.getListChildNodes(t,null,1),c=t.parentNode,h=null,d=null,u=t.cloneNode(!1);const p=[],g=Ht.check.isList(s);let m=!1,f=!1,v=!1;const b=(e,s,i,n)=>{if(1===s.childNodes.length&&Ht.check.isZeroWidth(s)&&(s.innerHTML=Tt.zeroWidthSpace,l=r=1),3===s.nodeType)return e.insertBefore(s,i),s;const o=(v?s:n).childNodes;let a=s.cloneNode(!1),c=null,h=null;for(;o[0];)h=o[0],!this._isNotTextNode(h)||Ht.check.isBreak(h)||Ht.check.isListCell(a)?a.appendChild(h):(a.childNodes.length>0&&(c||=a,e.insertBefore(a,i),a=s.cloneNode(!1)),e.insertBefore(h,i),c||=h);if(a.childNodes.length>0){if(Ht.check.isListCell(e)&&Ht.check.isListCell(a)&&Ht.check.isList(i))if(g){for(c=i;i;)a.appendChild(i),i=i.nextSibling;e.parentNode.insertBefore(a,e.nextElementSibling)}else{const e=n.nextElementSibling,s=this.#X.listFormat.removeNested(n,!1);if(t!==s||e!==n.nextElementSibling){const e=a.childNodes;for(;e[0];)n.appendChild(e[0]);t=s,f=!0}}else e.insertBefore(a,i);c||=a}return c};for(let n,o,l,r=0,y=a.length;r<y;r++)if(n=a[r],3!==n.nodeType||!Ht.check.isList(u))if(v=!1,i&&0===r&&(h=e&&e.length!==y&&e[0]!==n?u:t.previousSibling),e&&(o=e.indexOf(n)),e&&-1===o)u||=t.cloneNode(!1),u.appendChild(n);else{if(e&&(l=e[o+1]),u&&u.children.length>0&&(c.insertBefore(u,t),u=null),!g&&Ht.check.isListCell(n))if(l&&Ht.query.getNodeDepth(n)!==Ht.query.getNodeDepth(l)&&(Ht.check.isListCell(c)||Ht.utils.arrayFind(n.children,Ht.check.isList))){const e=n.nextElementSibling,s=this.#X.listFormat.removeNested(n,!1);t===s&&e===n.nextElementSibling||(t=s,f=!0)}else{const e=n;n=Ht.utils.createElement(i?e.nodeName:Ht.check.isList(t.parentNode)||Ht.check.isListCell(t.parentNode)?"LI":Ht.check.isTableCell(t.parentNode)?"DIV":this.#it.get("defaultLine"));const s=Ht.check.isListCell(n),o=e.childNodes;for(;o[0]&&(!Ht.check.isList(o[0])||s);)n.appendChild(o[0]);Ht.utils.copyFormatAttributes(n,e),v=!0}else n=n.cloneNode(!1);if(!f&&(i?(p.push(n),Ht.utils.removeItem(a[r])):(s?(m||(c.insertBefore(s,t),m=!0),n=b(s,n,null,a[r])):n=b(c,n,t,a[r]),f||(e?(d=n,h||=n):h||(h=d=n))),f)){f=v=!1,a=Ht.query.getListChildNodes(t,null,1),u=t.cloneNode(!1),c=t.parentNode,r=-1,y=a.length;continue}}const y=t.parentNode;let C=t.nextSibling;u?.children.length>0&&y.insertBefore(u,C),s?h=s.previousSibling:h||=t.previousSibling,C=t.nextSibling!==u?t.nextSibling:u?u.nextSibling:null,0===t.children.length||0===t.textContent.length?Ht.utils.removeItem(t):this.#X.nodeTransform.removeEmptyNode(t,null,!1);let w=null;if(this.#t.set("_lastSelectionNode",null),i)w={cc:y,sc:h,so:l,ec:C,eo:r,removeArray:p};else{h||=d,d||=h;const t=Ht.query.getEdgeChildNodes(h,d?.parentNode?h:d);t?w={cc:(t.sc||t.ec).parentNode,sc:t.sc,so:l,ec:t.ec,eo:r,removeArray:null}:this.#X.focusManager.focus()}if(n)return w;!i&&w&&(e?this.#X.selection.setRange(w.sc,l,w.ec,r):this.#X.selection.setRange(w.sc,0,w.sc,0)),this.#X.history.push(!1)}indent(){const t=this.#X.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ce(this.getLines(null),this.#t.get("indentSize"),this.#it.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#X.listFormat.applyNested(o,!1),this.#t.set("_lastSelectionNode",null),this.#X.selection.setRange(e,i,s,n),this.#X.history.push(!1)}outdent(){const t=this.#X.selection.getRange(),e=t.startContainer,s=t.endContainer,i=t.startOffset,n=t.endOffset,o=Ce(this.getLines(null),-1*this.#t.get("indentSize"),this.#it.get("_rtl")?"marginRight":"marginLeft");o.length>0&&this.#X.listFormat.applyNested(o,!0),this.#t.set("_lastSelectionNode",null),this.#X.selection.setRange(e,i,s,n),this.#X.history.push(!1)}isEdgeLine(t,e,s){if(!Ht.check.isEdgePoint(t,e,s))return!1;let i=!1;const n="front"===s?"previousSibling":"nextSibling";for(;t&&!this.isLine(t)&&!Ht.check.isWysiwygFrame(t);){if(t[n]&&(!Ht.check.isBreak(t[n])||t[n][n]))return!1;i=!0,t=t.parentNode}return i}isTextStyleNode(t){return"string"==typeof t?this.#Ct.test(t):1===t?.nodeType&&this.#Ct.test(t.nodeName)}isLine(t){return"string"==typeof t?this.#mt.test(t):1===t?.nodeType&&(this.#mt.test(t.nodeName)||Ht.utils.hasClass(t,"__se__format__line_.+|__se__format__br_line_.+"))&&!this.#xt(t)}isNormalLine(t){return this.isLine(t)&&(this.#wt||!this.isBrLine(t))&&!this.isBlock(t)}isBrLine(t){return this.#wt&&this.isLine(t)||("string"==typeof t?this.#ft.test(t):1===t?.nodeType&&(this.#ft.test(t.nodeName)||Ht.utils.hasClass(t,"__se__format__br_line_.+"))&&!this.#xt(t))}isBlock(t){return"string"==typeof t?this.#vt.test(t):1===t?.nodeType&&(this.#vt.test(t.nodeName)||Ht.utils.hasClass(t,"__se__format__block_.+"))&&!this.#xt(t)}isClosureBlock(t){return"string"==typeof t?this.#bt.test(t):1===t?.nodeType&&(this.#bt.test(t.nodeName)||Ht.utils.hasClass(t,"__se__format__block_closure_.+"))&&!this.#xt(t)}isClosureBrLine(t){return"string"==typeof t?this.#yt.test(t):1===t?.nodeType&&(this.#yt.test(t.nodeName)||Ht.utils.hasClass(t,"__se__format__br_line__closure_.+"))&&!this.#xt(t)}getLines(t){if(!this.#X.selection.resetRangeToTextNode())return[];let e=this.#X.selection.getRange();if(Ht.check.isWysiwygFrame(e.startContainer)){const t=this.#K.get("wysiwyg").children,s=t.length;if(0===s)return[];this.#X.selection.setRange(t[0],0,t[s-1],t[s-1].textContent.trim().length),e=this.#X.selection.getRange()}const s=e.startContainer,i=e.endContainer,n=e.commonAncestorContainer;t||=this.isLine.bind(this);const o=Ht.query.getListChildren(n,(e=>t(e)),null);if(3!==n.nodeType&&(Ht.check.isWysiwygFrame(n)||this.isBlock(n))||o.unshift(this.getLine(n,null)),s===i||1===o.length)return o;const l=this.getLine(s,null),r=this.getLine(i,null);let a=null,c=null;const h=function(t){return!Ht.check.isTableElements(t)||/^TABLE$/i.test(t.nodeName)};let d=this.getBlock(l,h),u=this.getBlock(r,h);Ht.check.isTableElements(d)&&Ht.check.isListCell(d.parentNode)&&(d=d.parentNode),Ht.check.isTableElements(u)&&Ht.check.isListCell(u.parentNode)&&(u=u.parentNode);const p=d===u;for(let t,e=0,s=o.length;e<s;e++)if(t=o[e],l===t||!p&&t===d)a=e;else if(r===t||!p&&t===u){c=e;break}return null===a&&(a=0),null===c&&(c=o.length-1),o.slice(a,c+1)}getLinesAndComponents(t){const e=this.#X.selection.getRange().commonAncestorContainer,s=Ht.query.getParentElement(e,this.#X.component.is.bind(this.#X.component)),i=Ht.check.isTableElements(e)?this.getLines(null):this.getLines((t=>{const e=Ht.query.getParentElement(t,this.#X.component.is.bind(this.#X.component));return this.isLine(t)&&(!e||e===s)||Ht.check.isComponentContainer(t)&&!this.getLine(t)}));if(t)for(let t=0,e=i.length;t<e;t++)for(let s=t-1;s>=0;s--)if(i[s].contains(i[t])){i.splice(t,1),t--,e--;break}return i}_isNotTextNode(t){if(!t)return!1;const e=/^(br|input|select|canvas|img|iframe|audio|video)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&(this.#X.component.is(t)||e.test(t.nodeName))}_isExcludeSelectionElement(t){return!/FIGCAPTION/i.test(t.nodeName)&&(this.#X.component.is(t)||/FIGURE/i.test(t.nodeName))}#xt(t){return Ht.check.isExcludeFormat(t)||this.#X.component.is(t)||Ht.check.isWysiwygFrame(t)}#_t(){let t=this.#X.selection.getRange(),e=this.getLinesAndComponents(!1);if(0===e.length&&(t=this.#X.selection.getRangeAndAddLine(t,null),e=this.getLinesAndComponents(!1),0===e.length))return;const s=t.startOffset,i=t.endOffset;let n=e[0],o=e.at(-1);const l=Ht.query.getNodePath(t.startContainer,n,null),r=Ht.query.getNodePath(t.endContainer,o,null),a=this.#X.listFormat.remove(e,!1);return a.sc&&(n=a.sc),a.ec&&(o=a.ec),this.#X.selection.setRange(Ht.query.getNodeFromPath(l,n),s,Ht.query.getNodeFromPath(r,o),i),{lines:this.getLinesAndComponents(!1),firstNode:n,lastNode:o,firstPath:l,lastPath:r,startOffset:s,endOffset:i}}__resetBrLineBreak(t){return this.#wt="br"===t}};function _e(t){const e=t.parentNode;if(!t||3===t.nodeType||!e)return;const s=t.childNodes;for(;s[0];)e.insertBefore(s[0],t);e.removeChild(t)}const xe=class{#X;#it;#$t;#St;constructor(t){this.#X=t.$,this.#it=this.#X.options,this.#$t=this.#it.get("__listCommonStyle"),this.#St=Mt.camelToKebabCase(this.#it.get("__listCommonStyle"))}apply(t,{stylesToModify:e,nodesToRemove:s,strictRemove:i}={}){if(Ht.query.getParentElement(this.#X.selection.getNode(),Ht.check.isNonEditable))return;this.#X.selection.resetRangeToTextNode();let n=this.#X.selection.getRangeAndAddLine(this.#X.selection.getRange(),null);e=e?.length>0?e:null,s=s?.length>0?s:null;const o=!t,l=o&&!s&&!e;let r=n.startContainer,a=n.startOffset,c=n.endContainer,h=n.endOffset;if(l&&n.collapsed&&this.#X.format.isLine(r.parentNode)&&this.#X.format.isLine(c.parentNode)||r===c&&1===r.nodeType&&Ht.check.isNonEditable(r)){const t=r.parentNode;if(!Ht.check.isListCell(t)||!Mt.getValues(t.style).some((t=>this.#St.includes(t))))return}if(n.collapsed&&!l&&1===r.nodeType&&!Ht.check.isBreak(r)&&!this.#X.component.is(r)){let t=null;const e=r.childNodes[a];e&&(t=e.nextSibling?Ht.check.isBreak(e)?e:e.nextSibling:null);const s=Ht.utils.createTextNode(Tt.zeroWidthSpace);r.insertBefore(s,t),this.#X.selection.setRange(s,1,s,1),n=this.#X.selection.getRange(),r=n.startContainer,a=n.startOffset,c=n.endContainer,h=n.endOffset}this.#X.format.isLine(r)&&(r=r.childNodes[a]||r.firstChild,a=0),this.#X.format.isLine(c)&&(c=c.childNodes[h]||c.lastChild,h=c.textContent.length),o&&(t=Ht.utils.createElement("DIV"));const d=RegExp,u=t.nodeName;if(!l&&r===c&&!s&&t){let e=r,s=0;const i=[],n=t.style;for(let t=0,e=n.length;t<e;t++)i.push(n[t]);const l=t.className,a=t.classList;for(let t=0,e=a.length;t<e;t++)i.push("."+a[t]);if(i.length>0){for(;!this.#X.format.isLine(e)&&!Ht.check.isWysiwygFrame(e);){for(let t=0;t<i.length;t++)if(1===e.nodeType){const r=i[t],a=!!/^\./.test(r)&&new d("\\s*"+r.replace(/^\./,"")+"(\\s+|$)","ig"),c=e.style,h=e.className,u=o?!!c[r]:!!c[r]&&!!n[r]&&c[r]===n[r],p=!1!==a&&(o?!!h.match(a):!!h.match(a)&&!!l.match(a));(u||p)&&s++}e=e.parentNode}if(s>=i.length)return}}let p,g,m={},f={},v="",b="";if(e){for(let t,s=0,i=e.length;s<i;s++)t=e[s],/^\./.test(t)?b+=(b?"|":"\\s*(?:")+t.replace(/^\./,""):v+=(v?"|":"(?:;|^|\\s)(?:")+t;v&&(v+=")\\s*:[^;]*\\s*(?:;|$)",v=new d(v,"ig")),b&&(b+=")(?=\\s+|$)",b=new d(b,"ig"))}if(s){g="^(?:"+s[0];for(let t=1;t<s.length;t++)g+="|"+s[t];g+=")$",g=new d(g,"i")}const y={v:!1},C=function(t){const e=t.cloneNode(!1);if(3===e.nodeType||Ht.check.isBreak(e))return e;if(l)return null;const s=!g&&o||g?.test(e.nodeName);if(s&&!i)return y.v=!0,null;const n=e.style.cssText;let r="";v&&n.length>0&&(r=n.replace(v,"").trim(),r!==n&&(y.v=!0));const a=e.className;let c="";return b&&a.length>0&&(c=a.replace(b,"").trim(),c!==a&&(y.v=!0)),(!o||!b&&a||!v&&n||r||c||!s)&&(r||c||e.nodeName!==u||Boolean(v)!==Boolean(n)||Boolean(b)!==Boolean(a))?(v&&n.length>0&&(e.style.cssText=r),e.style.cssText||e.removeAttribute("style"),b&&a.length>0&&(e.className=c.trim()),e.className.trim()||e.removeAttribute("class"),e.style.cssText||e.className||e.nodeName!==u&&!s?e:(y.v=!0,null)):(y.v=!0,null)},w=this.#X.format.getLines(null);if(0===w.length)return void console.warn("[SUNEDITOR.inline.apply.warn] There is no line to apply.");n=this.#X.selection.getRange(),r=n.startContainer,a=n.startOffset,c=n.endContainer,h=n.endOffset,this.#X.format.getLine(r,null)||(r=Ht.query.getEdgeChild(w[0],(function(t){return 3===t.nodeType}),!1),a=0),this.#X.format.getLine(c,null)||(c=Ht.query.getEdgeChild(w.at(-1),(function(t){return 3===t.nodeType}),!1),h=c.textContent.length);const _=this.#X.format.getLine(r,null)===this.#X.format.getLine(c,null),x=w.length-(_?0:1);p=t.cloneNode(!1);const $=l||o&&(t=>{for(let e=0,s=t?.length;e<s;e++)if(this._isNonSplitNode(t[e]))return!0;return!1})(s),S=o||this.#kt(p),k=this.#Et.bind(this,$,S),E=this.#Tt.bind(this,$,S);if(_){this.#Mt(w[0],e)&&(n=this.#X.selection.setRange(r,a,c,h));const t=this.#Ht(w[0],p,C,r,a,c,h,l,o,n.collapsed,y,k,E);m.container=t.startContainer,m.offset=t.startOffset,f.container=t.endContainer,f.offset=t.endOffset,m.container===f.container&&Ht.check.isZeroWidth(m.container)&&(m.offset=f.offset=1),this.#Lt(t.ancestor,null)}else{let s=!1;x>0&&this.#Mt(w[x],e)&&(s=!0),this.#Mt(w[0],e)&&(s=!0),s&&this.#X.selection.setRange(r,a,c,h),x>0&&(p=t.cloneNode(!1),f=this.#Nt(w[x],p,C,c,h,l,o,y,k,E));for(let s,i=x-1;i>0;i--)this.#Mt(w[i],e),p=t.cloneNode(!1),s=this.#At(w[i],p,C,l,o,y,f.container),s.endContainer&&s.ancestor.contains(s.endContainer)&&(f.ancestor=null,f.container=s.endContainer),this.#Lt(s.ancestor,null);p=t.cloneNode(!1),m=this.#Bt(w[0],p,C,r,a,l,o,y,k,E,f.container),m.endContainer&&(f.ancestor=null,f.container=m.endContainer),x<=0?f=m:f.container||(f.ancestor=null,f.container=m.container,f.offset=m.container.textContent.length),this.#Lt(m.ancestor,null),this.#Lt(f.ancestor||this.#X.format.getLine(f.container),null)}return this.#X.ui.offCurrentController(),this.#X.selection.setRange(m.container,m.offset,f.container,f.offset),this.#X.history.push(!1),p}remove(){this.apply(null,{stylesToModify:null,nodesToRemove:null,strictRemove:null})}_isNonSplitNode(t){if(!t)return!1;const e=/^(a|label|code|summary)$/i;return"string"==typeof t?e.test(t):1===t.nodeType&&e.test(t.nodeName)}_isIgnoreNodeChange(t){return t&&1===t.nodeType&&(Ht.check.isNonEditable(t)||!this.#X.format.isTextStyleNode(t)||this.#X.component.is(t))}#Ht(t,e,s,i,n,o,l,r,a,c,h,d,u){let p=i.parentNode;for(;!(p.nextSibling||p.previousSibling||this.#X.format.isLine(p.parentNode)||Ht.check.isWysiwygFrame(p.parentNode))&&p.nodeName!==e.nodeName;)p=p.parentNode;if(!a&&!r&&p===o.parentNode&&p.nodeName===e.nodeName&&Ht.check.isZeroWidth(i.textContent.slice(0,n))&&Ht.check.isZeroWidth(o.textContent.slice(l))){const s=p.childNodes;let r=!0;for(let t,e,n,l,a=0,c=s.length;a<c;a++)if(t=s[a],l=!Ht.check.isZeroWidth(t),t!==i&&t!==o){if(!e&&l||e&&n&&l){r=!1;break}}else t===i&&(e=!0),t===o&&(n=!0);if(r)return Ht.utils.copyTagAttributes(p,e),{ancestor:t,startContainer:i,startOffset:n,endContainer:o,endOffset:l}}h.v=!1;const g=this,m=t,f=[e],v=t.cloneNode(!1),b=i===o;let y,C,w,_,x,$=i,S=n,k=o,E=l,T=!1,M=!1;const H=RegExp;function L(t){const e=new H("(?:;|^|\\s)(?:"+_+"null)\\s*:[^;]*\\s*(?:;|$)","ig");let s=!1;return e&&t.style.cssText.length>0&&(s=e.test(t.style.cssText)),!s}if(function t(i,n){const o=i.childNodes;for(let i,l=0,a=o.length;l<a;l++){const a=o[l];if(!a)continue;let h,p=n;if(!T&&a===$){let t=v;x=d(a);let o="",l="";if(3===$.nodeType){const t=$;o=t.substringData(0,S),l=t.substringData(S,b&&E>=S?E-S:t.data.length-S)}const r=Ht.utils.createTextNode(o),c=Ht.utils.createTextNode(l);if(x){const e=d(n);if(e.parentNode!==t){let s=e,i=null;for(;s.parentNode!==t;){for(n=i=s.parentNode.cloneNode(!1);s.childNodes[0];)i.appendChild(s.childNodes[0]);s.appendChild(i),s=s.parentNode}s.parentNode.appendChild(e)}x=x.cloneNode(!1)}Ht.check.isZeroWidth(r)||n.appendChild(r);const h=d(n);for(h&&(x=h),x&&(t=x),C=a,y=[],_="";C!==t&&C!==m&&null!==C;)i=u(C)?null:s(C),i&&1===C.nodeType&&L(C)&&(y.push(i),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;const p=y.pop()||c;for(w=C=p;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(e.appendChild(p),t.appendChild(e),x&&!d(k)&&(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),$=c,S=0,T=!0,C!==c&&C.appendChild($),!b)continue}if(M||a!==k){if(T){if(1===a.nodeType&&!Ht.check.isBreak(a)){g._isIgnoreNodeChange(a)?(v.appendChild(a.cloneNode(!0)),c||(e=e.cloneNode(!1),v.appendChild(e),f.push(e))):t(a,a);continue}C=a,y=[],_="";const o=[];for(;null!==C.parentNode&&C!==m&&C!==e;)i=M?C.cloneNode(!1):s(C),1===C.nodeType&&!Ht.check.isBreak(a)&&i&&L(C)&&(u(C)?x||o.push(i):y.push(i),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;y=y.concat(o);const l=y.pop()||a;for(w=C=l;y.length>0;)C=y.pop(),w.appendChild(C),w=C;if(!u(e.parentNode)||u(l)||Ht.check.isZeroWidth(e)||(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),M||x||!u(l))l===a?n=M?v:e:M?(v.appendChild(l),n=C):(e.appendChild(l),n=C);else{e=e.cloneNode(!1);const t=l.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);l.appendChild(e),v.appendChild(l),f.push(e),n=e.children.length>0?C:e}if(x&&3===a.nodeType)if(d(a)){const t=Ht.query.getParentElement(n,(t=>g._isNonSplitNode(t.parentNode)||t.parentNode===v));x.appendChild(t),e=t.cloneNode(!1),f.push(e),v.appendChild(e)}else x=null}h=a.cloneNode(!1),n.appendChild(h),1!==a.nodeType||Ht.check.isBreak(a)||(p=h),t(a,p)}else{x=d(a);let t="",n="";if(3===k.nodeType){const e=k;t=e.substringData(E,e.length-E),n=b?"":e.substringData(0,E)}const o=Ht.utils.createTextNode(t),l=Ht.utils.createTextNode(n);if(x?x=x.cloneNode(!1):u(e.parentNode)&&!x&&(e=e.cloneNode(!1),v.appendChild(e),f.push(e)),!Ht.check.isZeroWidth(o)){C=a,_="",y=[];const t=[];for(;C!==v&&C!==m&&null!==C;)1===C.nodeType&&L(C)&&(u(C)?t.push(C.cloneNode(!1)):y.push(C.cloneNode(!1)),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;for(y=y.concat(t),h=w=C=y.pop()||o;y.length>0;)C=y.pop(),w.appendChild(C),w=C;v.appendChild(h),C.textContent=o.data}if(x&&h){const t=d(h);t&&(x=t)}for(C=a,y=[],_="";C!==v&&C!==m&&null!==C;)i=u(C)?null:s(C),i&&1===C.nodeType&&L(C)&&(y.push(i),_+=C.style.cssText.substring(0,C.style.cssText.indexOf(":"))+"|"),C=C.parentElement;const p=y.pop()||l;for(w=C=p;y.length>0;)C=y.pop(),w.appendChild(C),w=C;x?((e=e.cloneNode(!1)).appendChild(p),x.insertBefore(e,x.firstChild),v.appendChild(x),f.push(e),x=null):e.appendChild(p),k=l,E=l.data.length,M=!0,!r&&c&&(e=l,l.textContent=Tt.zeroWidthSpace),C!==l&&C.appendChild(k)}}}(t,v),a&&!r&&!h.v)return{ancestor:t,startContainer:i,startOffset:n,endContainer:o,endOffset:l};if(r&&=a,r)for(let t=0;t<f.length;t++){const e=f[t];let s,i,n;if(c)s=Ht.utils.createTextNode(Tt.zeroWidthSpace),v.replaceChild(s,e);else{const t=e.childNodes;for(i=t[0];t[0];)n=t[0],v.insertBefore(n,e);Ht.utils.removeItem(e)}0===t&&(c?$=k=s:($=i,k=n))}else{if(a)for(let t=0;t<f.length;t++)_e(f[t]);c&&($=k=e)}this.#X.nodeTransform.removeEmptyNode(v,e,!1),c&&(S=$.textContent.length,E=k.textContent.length);const N=r||0===k.textContent.length;Ht.check.isBreak(k)||0!==k.textContent.length||(Ht.utils.removeItem(k),k=$),E=N?k.textContent.length:E;const A={s:0,e:0},B=Ht.query.getNodePath($,v,A),I=!k.parentNode;I&&(k=$);const V={s:0,e:0},O=Ht.query.getNodePath(k,v,I||N?null:V);S+=A.s,E=c?S:I?$.textContent.length:N?E+A.s:E+V.s;const R=this.#X.nodeTransform.mergeSameTags(v,[B,O],!0);return t.parentNode.replaceChild(v,t),$=Ht.query.getNodeFromPath(B,v),k=Ht.query.getNodeFromPath(O,v),{ancestor:v,startContainer:$,startOffset:S+R[0],endContainer:k,endOffset:E+R[1]}}#Bt(t,e,s,i,n,o,l,r,a,c,h){let d=i.parentNode;for(;!(d.nextSibling||d.previousSibling||this.#X.format.isLine(d.parentNode)||Ht.check.isWysiwygFrame(d.parentNode))&&d.nodeName!==e.nodeName;)d=d.parentNode;if(!l&&!o&&d.nodeName===e.nodeName&&!this.#X.format.isLine(d)&&!d.nextSibling&&Ht.check.isZeroWidth(i.textContent.slice(0,n))){let s=!0,o=i.previousSibling;for(;o;){if(!Ht.check.isZeroWidth(o)){s=!1;break}o=o.previousSibling}if(s)return Ht.utils.copyTagAttributes(d,e),{ancestor:t,container:i,offset:n}}r.v=!1;const u=this,p=t,g=[e],m=t.cloneNode(!1);let f,v,b,y,C=i,w=n,_=!1;if(function t(i,n){const o=i.childNodes;for(let i,l,r=0,d=o.length;r<d;r++){const d=o[r];if(!d)continue;let x=n;if(_&&!Ht.check.isBreak(d)){if(1===d.nodeType){if(u._isIgnoreNodeChange(d)){if(e=e.cloneNode(!1),l=d.cloneNode(!0),m.appendChild(l),m.appendChild(e),g.push(e),h&&d.contains(h)){const t=Ht.query.getNodePath(h,d);h=Ht.query.getNodeFromPath(t,l)}}else t(d,d);continue}v=d,f=[];const o=[];for(;null!==v.parentNode&&v!==p&&v!==e;)i=s(v),1===v.nodeType&&i&&(c(v)?y||o.push(i):f.push(i)),v=v.parentNode;f=f.concat(o);const r=f.length>0,C=f.pop()||d;for(b=v=C;f.length>0;)v=f.pop(),b.appendChild(v),b=v;if(c(e.parentNode)&&!c(C)&&(e=e.cloneNode(!1),m.appendChild(e),g.push(e)),!y&&c(C)){e=e.cloneNode(!1);const t=C.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);C.appendChild(e),m.appendChild(C),n=c(v)?e:v,g.push(e)}else r?(e.appendChild(C),n=v):n=e;if(y&&3===d.nodeType)if(a(d)){const t=Ht.query.getParentElement(n,(t=>u._isNonSplitNode(t.parentNode)||t.parentNode===m));y.appendChild(t),e=t.cloneNode(!1),g.push(e),m.appendChild(e)}else y=null}if(_||d!==C)i=_?s(d):d.cloneNode(!1),i&&(n.appendChild(i),1!==d.nodeType||Ht.check.isBreak(d)||(x=i)),t(d,x);else{let t=m;y=a(d);let o="",l="";if(3===C.nodeType){const t=C;o=t.substringData(0,w),l=t.substringData(w,t.length-w)}const r=Ht.utils.createTextNode(o),c=Ht.utils.createTextNode(l);if(y){const e=a(n);if(e&&e.parentNode!==t){let s=e,i=null;for(;s.parentNode!==t;){for(n=i=s.parentNode.cloneNode(!1);s.childNodes[0];)i.appendChild(s.childNodes[0]);s.appendChild(i),s=s.parentNode}s.parentNode.appendChild(e)}y=y.cloneNode(!1)}Ht.check.isZeroWidth(r)||n.appendChild(r);const h=a(n);for(h&&(y=h),y&&(t=y),v=n,f=[];v!==t&&null!==v;)i=s(v),1===v.nodeType&&i&&f.push(i),v=v.parentNode;const u=f.pop()||n;for(b=v=u;f.length>0;)v=f.pop(),b.appendChild(v),b=v;u!==n?(e.appendChild(u),n=v):n=e,Ht.check.isBreak(d)&&e.appendChild(d.cloneNode(!1)),t.appendChild(e),C=c,w=0,_=!0,n.appendChild(C)}}}(t,m),l&&!o&&!r.v)return{ancestor:t,container:i,offset:n,endContainer:h};if(o&&=l,o)for(let t=0;t<g.length;t++){const e=g[t],s=e.childNodes,i=s[0];for(;s[0];)m.insertBefore(s[0],e);Ht.utils.removeItem(e),0===t&&(C=i)}else if(l){e=e.firstChild;for(let t=0;t<g.length;t++)_e(g[t])}if(o||0!==m.childNodes.length){this.#X.nodeTransform.removeEmptyNode(m,e,!1),Ht.check.isZeroWidth(m.textContent)&&(C=m.firstChild,w=0);const s={s:0,e:0},i=Ht.query.getNodePath(C,m,s);w+=s.s;const n=this.#X.nodeTransform.mergeSameTags(m,[i],!0);t.parentNode.replaceChild(m,t),C=Ht.query.getNodeFromPath(i,m),w+=n[0]}else t.childNodes?C=t.childNodes[0]:(C=Ht.utils.createTextNode(Tt.zeroWidthSpace),t.appendChild(C));return{ancestor:m,container:C,offset:w,endContainer:h}}#At(t,e,s,i,n,o,l){if(!n){let s=null;l&&t.contains(l)&&(s=Ht.query.getNodePath(l,t));const i=t.cloneNode(!0),n=e.nodeName,o=e.style.cssText,r=e.className;let a=i.childNodes,c=0,h=a.length;for(let t;c<h&&(t=a[c],3!==t.nodeType);c++){if(t.nodeName!==n){if(!Ht.check.isBreak(t)&&this._isIgnoreNodeChange(t))continue;if(1===h){a=t.childNodes,h=a.length,c=-1;continue}break}t.style.cssText+=o,Ht.utils.addClass(t,r)}if(h>0&&c===h)return t.innerHTML=i.innerHTML,{ancestor:t,endContainer:s?Ht.query.getNodeFromPath(s,t):null}}o.v=!1;const r=this,a=t.cloneNode(!1),c=[e];let h=!0;if(function t(i,n){const o=i.childNodes;for(let i,d,u=0,p=o.length;u<p;u++){const p=o[u];if(!p)continue;let g=n;if(Ht.check.isBreak(p)||!r._isIgnoreNodeChange(p))i=s(p),i&&(h=!1,n.appendChild(i),1===p.nodeType&&(g=i)),Ht.check.isBreak(p)||t(p,g);else if(e.childNodes.length>0&&(a.appendChild(e),e=e.cloneNode(!1)),d=p.cloneNode(!0),a.appendChild(d),a.appendChild(e),c.push(e),n=e,l&&p.contains(l)){const t=Ht.query.getNodePath(l,p);l=Ht.query.getNodeFromPath(t,d)}}}(t,e),h||n&&!i&&!o.v)return{ancestor:t,endContainer:l};if(a.appendChild(e),i&&n)for(let t=0;t<c.length;t++){const e=c[t],s=e.childNodes;for(;s[0];)a.insertBefore(s[0],e);Ht.utils.removeItem(e)}else if(n){e=e.firstChild;for(let t=0;t<c.length;t++)_e(c[t])}return this.#X.nodeTransform.removeEmptyNode(a,e,!1),this.#X.nodeTransform.mergeSameTags(a,null,!0),t.parentNode.replaceChild(a,t),{ancestor:a,endContainer:l}}#Nt(t,e,s,i,n,o,l,r,a,c){let h=i.parentNode;for(;!(h.nextSibling||h.previousSibling||this.#X.format.isLine(h.parentNode)||Ht.check.isWysiwygFrame(h.parentNode))&&h.nodeName!==e.nodeName;)h=h.parentNode;if(!l&&!o&&h.nodeName===e.nodeName&&!this.#X.format.isLine(h)&&!h.previousSibling&&Ht.check.isZeroWidth(i.textContent.slice(n))){let s=!0,o=i.nextSibling;for(;o;){if(!Ht.check.isZeroWidth(o)){s=!1;break}o=o.nextSibling}if(s)return Ht.utils.copyTagAttributes(h,e),{ancestor:t,container:i,offset:n}}r.v=!1;const d=this,u=t,p=[e],g=t.cloneNode(!1);let m,f,v,b,y=i,C=n,w=!1;if(function t(i,n){const o=i.childNodes;for(let i,l=o.length-1;0<=l;l--){const r=o[l];if(!r)continue;let h=n;if(w&&!Ht.check.isBreak(r)){if(1===r.nodeType){if(d._isIgnoreNodeChange(r)){e=e.cloneNode(!1);const t=r.cloneNode(!0);g.insertBefore(t,n),g.insertBefore(e,t),p.push(e)}else t(r,r);continue}f=r,m=[];const o=[];for(;null!==f.parentNode&&f!==u&&f!==e;)i=s(f),i&&1===f.nodeType&&(c(f)?b||o.push(i):m.push(i)),f=f.parentNode;m=m.concat(o);const l=m.length>0,h=m.pop()||r;for(v=f=h;m.length>0;)f=m.pop(),v.appendChild(f),v=f;if(c(e.parentNode)&&!c(h)&&(e=e.cloneNode(!1),g.insertBefore(e,g.firstChild),p.push(e)),!b&&c(h)){e=e.cloneNode(!1);const t=h.childNodes;for(let s=0,i=t.length;s<i;s++)e.appendChild(t[s]);h.appendChild(e),g.insertBefore(h,g.firstChild),p.push(e),n=e.children.length>0?f:e}else l?(e.insertBefore(h,e.firstChild),n=f):n=e;if(b&&3===r.nodeType)if(a(r)){const t=Ht.query.getParentElement(n,(t=>d._isNonSplitNode(t.parentNode)||t.parentNode===g));b.appendChild(t),e=t.cloneNode(!1),p.push(e),g.insertBefore(e,g.firstChild)}else b=null}if(w||r!==y)i=w?s(r):r.cloneNode(!1),i&&(n.insertBefore(i,n.firstChild),1!==r.nodeType||Ht.check.isBreak(r)||(h=i)),t(r,h);else{b=a(r);let t="",o="";if(3===y.nodeType){const e=y;t=e.substringData(C,e.length-C),o=e.substringData(0,C)}const l=Ht.utils.createTextNode(t),h=Ht.utils.createTextNode(o);if(b){b=b.cloneNode(!1);const t=a(n);if(t.parentNode!==g){let e=t,s=null;for(;e.parentNode!==g;){for(n=s=e.parentNode.cloneNode(!1);e.childNodes[0];)s.appendChild(e.childNodes[0]);e.appendChild(s),e=e.parentNode}e.parentNode.insertBefore(t,e.parentNode.firstChild)}b=b.cloneNode(!1)}else c(e.parentNode)&&!b&&(e=e.cloneNode(!1),g.appendChild(e),p.push(e));for(Ht.check.isZeroWidth(l)||n.insertBefore(l,n.firstChild),f=n,m=[];f!==g&&null!==f;)i=c(f)?null:s(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const d=m.pop()||n;for(v=f=d;m.length>0;)f=m.pop(),v.appendChild(f),v=f;d!==n?(e.insertBefore(d,e.firstChild),n=f):n=e,Ht.check.isBreak(r)&&e.appendChild(r.cloneNode(!1)),b?(b.insertBefore(e,b.firstChild),g.insertBefore(b,g.firstChild),b=null):g.insertBefore(e,g.firstChild),y=h,C=h.data.length,w=!0,n.insertBefore(y,n.firstChild)}}}(t,g),l&&!o&&!r.v)return{ancestor:t,container:i,offset:n};if(o&&=l,o)for(let t=0;t<p.length;t++){const e=p[t],s=e.childNodes;let i=null;for(;s[0];)i=s[0],g.insertBefore(i,e);Ht.utils.removeItem(e),t===p.length-1&&(y=i,C=i.textContent.length)}else if(l){e=e.firstChild;for(let t=0;t<p.length;t++)_e(p[t])}if(o||0!==g.childNodes.length){if(!l&&0===e.textContent.length)return this.#X.nodeTransform.removeEmptyNode(g,null,!1),{ancestor:null,container:null,offset:0};this.#X.nodeTransform.removeEmptyNode(g,e,!1),Ht.check.isZeroWidth(g.textContent)?(y=g.firstChild,C=y.textContent.length):Ht.check.isZeroWidth(y)&&(y=e,C=1);const s={s:0,e:0},i=Ht.query.getNodePath(y,g,s);C+=s.s;const n=this.#X.nodeTransform.mergeSameTags(g,[i],!0);t.parentNode.replaceChild(g,t),y=Ht.query.getNodeFromPath(i,g),C+=n[0]}else t.childNodes?y=t.childNodes[0]:(y=Ht.utils.createTextNode(Tt.zeroWidthSpace),t.appendChild(y));return{ancestor:g,container:y,offset:1===y.nodeType&&1===C?y.childNodes.length:C}}#kt(t){return t&&"string"!=typeof t&&3!==t.nodeType&&this.#X.format.isTextStyleNode(t)&&!!t.style.fontSize}#Et(t,e,s){return!s||t?null:Ht.query.getParentElement(s,this._isNonSplitNode.bind(this))||(e?null:Ht.query.getParentElement(s,this.#kt.bind(this)))}#Tt(t,e,s){if(!s||t||1!==s.nodeType)return!1;const i=this._isNonSplitNode(s);return Ht.query.getParentElement(s,this._isNonSplitNode.bind(this))?i:i||!e&&this.#kt(s)}#Lt(t,e){if(!Ht.check.isListCell(t))return;const s=Ht.utils.arrayFilter((e||t).childNodes,(t=>!Ht.check.isBreak(t)));if(e=s[0],!Ht.check.isElement(e)||s.length>1)return;const i=e.style,n=t.style,o=e.nodeName.toLowerCase();let l=!1;this.#it.get("_defaultStyleTagMap")[o]===this.#it.get("_defaultTagCommand").bold.toLowerCase()&&(n.fontWeight="bold"),this.#it.get("_defaultStyleTagMap")[o]===this.#it.get("_defaultTagCommand").italic.toLowerCase()&&(n.fontStyle="italic");const r=Mt.getValues(i);if(r.length>0)for(let t=0,e=this.#$t.length;t<e;t++)r.includes(this.#St[t])&&(n[this.#$t[t]]=i[this.#$t[t]],i.removeProperty(this.#St[t]),l=!0);if(this.#Lt(t,e),l&&0===i.length){const t=e.childNodes,s=e.parentNode,i=e.nextSibling;for(;t.length>0;)s.insertBefore(t[0],i);Ht.utils.removeItem(e)}}#Mt(t,e){if(!Ht.check.isListCell(t))return;e||=this.#St;const s=Ht.utils.arrayFilter(t.childNodes,(t=>!Ht.check.isBreak(t))),i=t.style,n=[],o=[],l=Mt.getValues(i);for(let t=0,s=this.#St.length;t<s;t++)l.includes(this.#St[t])&&e.includes(this.#St[t])&&(n.push(this.#$t[t]),o.push(this.#St[t]));if(0===n.length)return;const r=Ht.utils.createElement("SPAN");for(let t=0,e=n.length;t<e;t++)r.style[n[t]]=i[o[t]],i.removeProperty(o[t]);let a=r.cloneNode(!1),c=null,h=!1;for(let e,i,o=0,l=s.length;o<l;o++)e=s[o],this.#it.get("_defaultStyleTagMap")[e.nodeName.toLowerCase()]||(i=Mt.getValues(e.style),0===i.length||n.some((function(t){return!i.includes(t)}))&&i.some((function(t){return n.includes(t)}))?(c=e.nextSibling,a.appendChild(e)):a.childNodes.length>0&&(t.insertBefore(a,c),a=r.cloneNode(!1),c=null,h=!0));return a.childNodes.length>0&&(t.insertBefore(a,c),h=!0),0===i.length&&t.removeAttribute("style"),h}};function $e(t){const e=t.parentNode;let s,i,n,o,l,r=e.parentNode,a=e;for(;Ht.check.isListCell(r);){for(o=Ht.query.getPositionIndex(t),s=r.nextElementSibling,i=r.parentNode,n=a;n;){if(a=a.nextSibling,Ht.check.isList(n)){for(l=n.childNodes;l[o];)i.insertBefore(l[o],s);0===l.length&&Ht.utils.removeItem(n)}else i.appendChild(n);n=a}r=i.parentNode}return 0===e.children.length&&Ht.utils.removeItem(e),i}const Se=class{#X;#t;constructor(t){this.#X=t.$,this.#t=t.store}apply(t,e,s){const i=(t.split(":")[0]||"ol").toUpperCase(),n=t.split(":")[1]||"";let o=this.#X.selection.getRange(),l=e||this.#X.format.getLinesAndComponents(!1);if(0===l.length){if(e)return;if(o=this.#X.selection.getRangeAndAddLine(o,null),l=this.#X.format.getLinesAndComponents(!1),0===l.length)return}Ht.query.sortNodeByDepth(l,!0);const r=l[0],a=l.at(-1);let c=!Ht.check.isListCell(r)&&!this.#X.component.is(r)||r.previousElementSibling?r.previousElementSibling:r.parentElement.previousElementSibling,h=!Ht.check.isListCell(a)&&!this.#X.component.is(a)||a.nextElementSibling?a.nextElementSibling:a.parentElement.nextElementSibling;const d=o.collapsed,u={sc:o.startContainer,so:o.startContainer===o.endContainer&&Ht.check.isZeroWidth(o.startContainer)&&0===o.startOffset&&1===o.endOffset?o.endOffset:o.startOffset,ec:o.endContainer,eo:o.endOffset};let p=null,g=!0;for(let t=0,e=l.length;t<e;t++)if(!Ht.check.isList(this.#X.format.getBlock(l[t],(e=>this.#X.format.getBlock(e)&&e!==l[t])))){g=!1;break}if(!g||c&&r.tagName===c.tagName&&i===c.tagName.toUpperCase()||h&&a.tagName===h.tagName&&i===h.tagName.toUpperCase()){const t=c?c.parentNode:c,e=h?h.parentNode:h;c=t&&!Ht.check.isWysiwygFrame(t)&&t.nodeName===i?t:c,h=e&&!Ht.check.isWysiwygFrame(e)&&e.nodeName===i?e:h;const s=c?.tagName===i,o=h?.tagName===i;let r=s?c:Ht.utils.createElement(i,{style:"list-style-type: "+n}),a=null,d=null;const u=t=>!Ht.check.isComponentContainer(t)&&!Ht.check.isList(t);for(let t,e,o,c,h,p,g,m,f,v=0,b=l.length;v<b;v++)if(e=l[v],0!==e.childNodes.length||this.#X.inline._isIgnoreNodeChange(e)){if(c=l[v+1],h=e.parentNode,p=c?c.parentNode:null,o=Ht.check.isListCell(e),f=this.#X.format.isBlock(h)?h:null,g=o&&!Ht.check.isWysiwygFrame(h)?h.parentNode:h,m=o&&!Ht.check.isWysiwygFrame(h)?!c||Ht.check.isListCell(g)?h:h.nextSibling:e.nextSibling,t=Ht.utils.createElement("LI"),this.#X.component.is(e)){const s=/^HR$/i.test(e.nodeName);s||(t.innerHTML="<br>"),t.innerHTML+=e.outerHTML,s&&(t.innerHTML+="<br>")}else{Ht.utils.copyFormatAttributes(t,e);const s=e.childNodes;for(;s[0];)t.appendChild(s[0])}r.appendChild(t),c&&g===p&&!this.#X.format.isBlock(m)||(a||=r,s&&c&&g===p||c&&Ht.check.isList(p)&&p===h||r.parentNode!==g&&g.insertBefore(r,m)),Ht.utils.removeItem(e),s&&null===d&&(d=r.children.length-1),c&&(this.#X.format.getBlock(p,u)!==this.#X.format.getBlock(h,u)||Ht.check.isList(p)&&Ht.check.isList(h)&&Ht.query.getNodeDepth(p)!==Ht.query.getNodeDepth(h))&&(r=Ht.utils.createElement(i,{style:"list-style-type: "+n})),0===f?.children.length&&Ht.utils.removeItem(f)}else Ht.utils.removeItem(e);d&&(a=a.children[d]),o&&(r.innerHTML+=h.innerHTML,Ht.utils.removeItem(h))}else{if(s)for(let t=0,e=l.length;t<e;t++)for(let s=t-1;s>=0;s--)if(l[s].contains(l[t])){l.splice(t,1),t--,e--;break}const t=this.#X.format.getBlock(r),e=t?.tagName===i;let o,a;const c=t=>!Ht.check.isComponentContainer(t);e||(a=Ht.utils.createElement(i,{style:"list-style-type: "+n}));for(let t,r,h=0,d=l.length;h<d;h++)r=this.#X.format.getBlock(l[h],c),r&&Ht.check.isList(r)&&(t?t!==r?(s&&Ht.check.isListCell(r.parentNode)?this.#It(o.f):p=this.#X.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0}),r=l[h].parentNode,e||(a=Ht.utils.createElement(i,{style:"list-style-type: "+n})),t=r,o={r:t,f:[Ht.query.getParentElement(l[h],"LI")]}):o.f.push(Ht.query.getParentElement(l[h],"LI")):(t=r,o={r:t,f:[Ht.query.getParentElement(l[h],"LI")]}),h===d-1&&(s&&Ht.check.isListCell(r.parentNode)?this.#It(o.f):p=this.#X.format.removeBlock(o.f[0].parentElement,{selectedFormats:o.f,newBlockElement:a,shouldDelete:!1,skipHistory:!0})))}return this.#t.set("_lastSelectionNode",null),g&&d&&p||u}remove(t,e){let s={},i=!1,n=!1,o=null,l=null;const r=t=>!Ht.check.isComponentContainer(t);for(let a,c,h,d,u=0,p=t.length;u<p;u++){if(h=u===p-1,c=this.#X.format.getBlock(t[u],r),d=Ht.check.isList(c),!a&&d)a=c,s={r:a,f:[Ht.query.getParentElement(t[u],"LI")]},0===u&&(i=!0);else if(a&&d)if(a!==c){const r=this.#X.format.removeBlock(s.f[0].parentNode,{selectedFormats:s.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});c=t[u].parentNode,i&&(o=r.sc,i=!1),h&&(l=r.ec),d?(a=c,s={r:a,f:[Ht.query.getParentElement(t[u],"LI")]},h&&(n=!0)):a=null}else s.f.push(Ht.query.getParentElement(t[u],"LI")),h&&(n=!0);if(h&&Ht.check.isList(a)){const t=this.#X.format.removeBlock(s.f[0].parentNode,{selectedFormats:s.f,newBlockElement:null,shouldDelete:e,skipHistory:!0});(n||1===p)&&(l=t.ec),i&&(o=t.sc||l)}}return{sc:o,ec:l}}applyNested(t,e){const s=(t=t||this.#X.format.getLines().filter((function(t){return Ht.check.isListCell(t)}))).length;if(0===s||!e&&!Ht.check.isListCell(t[0].previousElementSibling)&&!Ht.check.isListCell(t.at(-1).nextElementSibling))return{sc:t[0],so:0,ec:t.at(-1),eo:1};let i=t[0].parentElement,n=t.at(-1),o=null;if(e){if(i!==n.parentElement&&Ht.check.isList(n.parentElement?.parentElement)&&n.nextElementSibling)for(n=n.nextElementSibling;n;)t.push(n),n=n.nextElementSibling;o=this.apply(i.nodeName+":"+i.style.listStyleType,t,!0)}else{let e=Ht.utils.createElement(i.nodeName),l=t[0].previousElementSibling,r=n.nextElementSibling;const a={s:null,e:null,sl:i,el:i},{startContainer:c,startOffset:h,endContainer:d,endOffset:u}=this.#X.selection.getRange();for(let n,o=0,c=s;o<c;o++)n=t[o],n.parentElement!==i&&(this.#Vt(i,e,l,r,a),i=n.parentElement,e=Ht.utils.createElement(i.nodeName)),l=n.previousElementSibling,r=n.nextElementSibling,e.appendChild(n);if(this.#Vt(i,e,l,r,a),s>1){const t=Ht.query.getNodeFromPath(a.s,a.sl),e=Ht.query.getNodeFromPath(a.e,a.el);o={sc:t,so:0,ec:e,eo:e.textContent.length}}else o={sc:c,so:h,ec:d,eo:u}}return o}removeNested(t,e){const s=$e(t);let i,n,o;if(s){i=s.cloneNode(!1),n=s.childNodes;const e=Ht.query.getPositionIndex(t);for(;n[e];)i.appendChild(n[e])}else i=t;if(e)o=Ht.query.getListChildren(i,(t=>Ht.check.isListCell(t)&&!t.previousElementSibling),null);else{const e=Ht.query.getNodeDepth(t)+2;o=Ht.query.getListChildren(t,(t=>Ht.check.isListCell(t)&&!t.previousElementSibling&&Ht.query.getNodeDepth(t)===e),null)}for(let t=0,e=o.length;t<e;t++)$e(o[t]);return s&&(s.parentNode.insertBefore(i,s.nextSibling),0===n?.length&&Ht.utils.removeItem(s)),i===t?i.parentNode:i}#Vt(t,e,s,i,n){let o=!1;if(e.tagName===s?.tagName){const t=e.children;for(;t[0];)s.appendChild(t[0]);e=s,o=!0}if(e.tagName===i?.tagName){const t=i.children;for(;t[0];)e.appendChild(t[0]);const s=i.nextElementSibling;i.parentNode.removeChild(i),i=s}if(!o){Ht.check.isListCell(s)&&(t=s,i=null),t.insertBefore(e,i),n.s||(n.s=Ht.query.getNodePath(e.firstElementChild.firstChild,t,null),n.sl=t);const o=t.contains(n.sl)?Ht.query.getNodePath(n.sl,t):null;n.e=Ht.query.getNodePath(e.lastElementChild.firstChild,t,null),n.el=t,this.#X.nodeTransform.mergeSameTags(t,[n.s,n.e,o],!1),this.#X.nodeTransform.mergeNestedTags(t),o&&(n.sl=Ht.query.getNodeFromPath(o,t))}return e}#It(t){const e=t[0],s=t.at(-1),i=s.nextElementSibling,n=e.parentElement,o=n.parentElement.nextElementSibling,l=n.parentElement.parentElement;for(let e=0,s=t.length;e<s;e++)l.insertBefore(t[e],o);if(i&&n.children.length>0){const t=n.cloneNode(!1),e=n.childNodes,o=Ht.query.getPositionIndex(i);for(;e[o];)t.appendChild(e[o]);s.appendChild(t)}0===n.children.length&&Ht.utils.removeItem(n),this.#X.nodeTransform.mergeSameTags(l);const r=Ht.query.getEdgeChildNodes(e,s);return{cc:e.parentNode,sc:r.sc,ec:r.ec}}},{_d:ke}=Et;const Ee=/^<[a-z0-9]+:[a-z0-9]+/i,Te=/(?!<)[a-zA-Z0-9-]+/,Me=/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/gi,He=/style=/i,Le=/style\s*=\s*(?:"|')[^"']*(?:"|')/,Ne=/^\s/,Ae=/<[^\s]+\s(.+)/,Be=/\ssize="([^"]+)"/i,Ie=/\sface="([^"]+)"/i,Ve=/\scolor="([^"]+)"/i,Oe=/"/g,Re=/([a-zA-Z0-9-]+)(:)([^"']+)/,ze=/inherit|initial|revert|unset/i,Fe=/"/g,Pe=/:\s*([^;]+)/,De=/rgba\(([0-9]+\s*,\s*){3}0\)|windowtext/i,qe=/[^;]+;/g,We=/^span$/i,Ue=/^(?:https?|ftps?|mailto|tel|blob|sms|geo|webcal|callto):|^[#/]|^data:image\//i,Ge=/^(?:href|src)\s*=\s*(?:'|"|\s)*/i,Ze=/=\s*(?:"|'|)\s*([^"'\s>]*)/,je=/[\s\r\n\t]+/g,Ke=/&(#x?[0-9a-f]+|[a-z]+);/gi,Ye=/:/i;function Xe(t){if(!Ge.test(t))return!0;const e=t.match(Ze);if(!e)return!0;const s=e[1].replace(je,"").replace(Ke,"");return Ue.test(s)||!Ye.test(s)}function Je(t,e){return t?"*"===t?"[a-z-]+":e?t+"|"+e:t:"^"}const Qe=class{#X;#t;#K;#J;#it;#ct;#Ot;#Rt;#zt;#Ft;#Pt;#Dt;#qt;#Wt;#Ut;#Gt;#Zt;#jt;#Kt;#Yt;#Xt;#Jt;#Qt;#te;#ee;constructor(t){this.#X=t.$,this.#t=t.store;const e=this.#it=this.#X.options;this.#J=this.#X.frameOptions,this.#K=this.#X.frameContext,this.#ct=this.#X.instanceCheck,this.#Rt=function(t){return this.test(t)?t:""}.bind(e.get("allowedClassName")),this.#Kt=e.get("_textStyleTags");const s=e.get("tagStyles"),i={};for(const t in s){const e=t.split("|");for(let n,o=0,l=e.length;o<l;o++)n=e[o],i[n]?i[n]+="|":i[n]="",i[n]+=s[t]}for(const t in i)i[t]=new RegExp(`\\s*[^-a-zA-Z](${i[t]})\\s*:[^;]+(?!;)*`,"gi");const n=new Map,o={...i,line:e.get("_lineStylesRegExp")};this.#Kt.forEach((t=>{o[t]=e.get("_textStylesRegExp")}));for(const t in o)n.set(new RegExp(`^(${t})$`),o[t]);this.#Zt=new RegExp(`^(${Object.keys(o).join("|")})$`,"i"),this.#jt=n,this.#Ot=new RegExp("\\d+("+e.get("fontSizeUnits").join("|")+")$","i");const l=e.get("_allowedExtraTag"),r=e.get("_disallowedExtraTag");this.#Yt=new RegExp(`<(${r})[^>]*>([\\s\\S]*?)<\\/\\1>|<(${r})[^>]*\\/?>`,"gi"),this.#Xt=new RegExp(`^(${r})$`,"i"),this.#Jt=new RegExp(`^(${l})$`,"i");const a=Object.keys(e.get("_defaultStyleTagMap")),c=e.get("elementWhitelist")?e.get("elementWhitelist").split("|").filter((t=>/b|i|ins|s|strike/i.test(t))):[];for(let t=0;t<c.length;t++)a.splice(a.indexOf(c[t].toLowerCase()),1);this.#Ft=0===a.length?null:new RegExp("(<\\/?)("+a.join("|")+")\\b\\s*([^>^<]+)?\\s*(?=>)","gi");const h=e.get("__defaultAttributeWhitelist");this.#zt=e.get("_editorElementWhitelist").includes("//")||"*"===e.get("_editorElementWhitelist"),this.#Pt=new RegExp("^("+Je(e.get("_editorElementWhitelist").replace("|//",""),"")+")$","i"),this.#Dt=new RegExp("^("+(e.get("elementBlacklist")||"^")+")$","i"),this.#qt=Mt.createElementWhitelist(Je(e.get("_editorElementWhitelist").replace("|//","|\x3c!--|--\x3e"),"")),this.#Wt=Mt.createElementBlacklist(e.get("elementBlacklist").replace("|//","|\x3c!--|--\x3e"));const d='\\s*=\\s*(")[^"]*\\1',u=e.get("attributeWhitelist");let p={},g="";if(u)for(const t in u)/^on[a-z]+$/i.test(u[t])||("*"===t?g=Je(u[t],h):p[t]=new RegExp("\\s(?:"+Je(u[t],h)+")"+d,"ig"));this.#Ut=new RegExp("\\s(?:"+(g||h)+"|data-se-[^\\s]+"+(e.get("v2Migration")?"|data-index|data-file-size|data-file-name|data-exp|data-font-size":"")+")"+d,"ig"),this.#Qt=p;const m=e.get("attributeBlacklist");if(p={},g="",m)for(const t in m)"*"===t?g=Je(m[t],""):p[t]=new RegExp("\\s(?:"+Je(m[t],"")+")"+d,"ig");this.#Gt=new RegExp("\\s(?:"+(g||"^")+")"+d,"ig"),this.#te=p,this.__resetAutoStyleify(e.get("autoStyleify"))}filter(t,{tagWhitelist:e,tagBlacklist:s,validate:i,validateAll:n}){if(e&&(t=t.replace(Mt.createElementWhitelist(e),"")),s&&(t=t.replace(Mt.createElementBlacklist(s),"")),i){const e=(new DOMParser).parseFromString(t,"text/html");e.body.querySelectorAll("*").forEach((t=>{if(n||!t.closest(".se-component")&&!t.closest(".se-flex-component")){const e=i(t);null===e?t.remove():this.#ct.isNode(e)?t.replaceWith(e):"string"==typeof e&&(t.outerHTML=e)}})),t=e.body.innerHTML}return t}clean(t,{forceFormat:e,whitelist:s,blacklist:i,_freeCodeViewMode:n}={}){const{tagFilter:o,formatFilter:l,classFilter:r,textStyleTagFilter:a,attrFilter:c,styleFilter:h}=this.#it.get("strictMode");let d="";if(t=this.compress(t),o&&(t=t.replace(this.#Yt,""),t=this.#se(t,this.#qt,this.#Wt).replace(/<br\/?>$/i,"")),this.#ee){const e=(new DOMParser).parseFromString(t,"text/html");Ht.query.getListChildNodes(e.body,Mt.spanToStyleNode.bind(null,this.#ee),null),t=e.body.innerHTML}(c||h)&&(t=t.replace(/(<[a-zA-Z0-9-]+)[^>]*(?=>)/g,this.#ie.bind(this,c,h)));const u=ke.createRange().createContextualFragment(t);if(o)try{this.#ne(u,this.#Pt,this.#Dt,o,l,r,n)}catch(t){console.warn("[SUNEDITOR.html.clean.fail]",t.message)}const p=u.querySelectorAll("[data-se-iframe-holder]");for(let t=0,e=p.length;t<e;t++){const e=Ht.utils.createElement("iframe"),s=JSON.parse(p[t].getAttribute("data-se-iframe-holder-attrs"));for(const[t,i]of Object.entries(s))/^on/i.test(t)||("src"!==t||Ue.test(String(i).replace(/[\s\r\n\t]+/g,"")))&&e.setAttribute(t,i);p[t].replaceWith(e)}if(this.#X.pluginManager.applyRetainFormat(u),l){let t=u.childNodes;e||=this.#oe(t),e&&(t=this.#le(u).childNodes);for(let s,i=0,n=t.length;i<n;i++)s=t[i],this.#Jt.test(s.nodeName)?d+=s.outerHTML:d+=this.#re(s,e)}return d||=t,o&&(s&&(d=d.replace("string"==typeof s?Mt.createElementWhitelist(s):s,"")),i&&(d=d.replace("string"==typeof i?Mt.createElementBlacklist(i):i,""))),a&&(d=this.#ae(d)),d}insert(t,{selectInserted:e,skipCharCount:s,skipCleaning:i}={}){this.#K.get("wysiwyg").contains(this.#X.selection.get().focusNode)||this.#X.focusManager.focus(),this.remove(),this.#X.focusManager.focus();let n=null;if("string"==typeof t){i||(t=this.clean(t,{forceFormat:!1,whitelist:null,blacklist:null}));try{if(Ht.check.isListCell(this.#X.format.getLine(this.#X.selection.getNode(),null))){const e=ke.createRange().createContextualFragment(t).childNodes;this.#oe(e)&&(t=this.#ce(e))}const i=ke.createRange().createContextualFragment(t).childNodes;if(!s){const t="byte-html"===this.#J.get("charCounter_type")?"outerHTML":"textContent";let e="";for(let s=0,n=i.length;s<n;s++)e+=i[s][t];if(!this.#X.char.check(e))return}let o,l,r,a,c;for(;o=i[0];)3===a?.nodeType&&1===l?.nodeType&&Ht.check.isBreak(o)?(a=o,Ht.utils.removeItem(o)):(r=this.insertNode(o,{afterNode:l,skipCharCount:!0}),l=r.container||r,c||=r,a=o);3===a?.nodeType&&1===l?.nodeType&&(l=a);const h=3===l.nodeType?r.endOffset||l.textContent.length:l.childNodes.length;n=l,e?this.#X.selection.setRange(c.container||c,c.startOffset||0,l,h):this.#X.component.is(l)||this.#X.selection.setRange(l,h,l,h)}catch(t){if(this.#K.get("isReadOnly")||this.#K.get("isDisabled"))return;throw Error(`[SUNEDITOR.html.insert.error] ${t.message}`)}}else if(this.#X.component.is(t))this.#X.component.insert(t,{skipCharCount:s,insertBehavior:"none"});else{let e=null;(this.#X.format.isLine(t)||Ht.check.isMedia(t))&&(e=this.#X.format.getLine(this.#X.selection.getNode(),null)),this.insertNode(t,{afterNode:e,skipCharCount:s})}if(this.#t.set("_lastSelectionNode",null),n){const t=Ht.query.getListChildNodes(n,null,null);if(t.length>0){n=t.at(-1);const e=3===n?.nodeType?n.textContent.length:1;this.#X.selection.setRange(n,e,n,e)}else this.#X.focusManager.focus()}else this.#X.focusManager.focus();this.#X.history.push(!1)}insertNode(t,{afterNode:e,skipCharCount:s}={}){let i=null;if(this.#K.get("isReadOnly")||!s&&!this.#X.char.check(t))return i;let n=null,o=null;if(e){const t=this.#X.format.isLine(e)||this.#X.format.isBlock(e)||this.#X.component.is(e)?this.#X.format.addLine(e,null):e;o=this.#X.selection.setRange(t,1,t,1)}else o=this.#X.selection.getRange();let l,r,a,c=Ht.check.isListCell(o.commonAncestorContainer)?o.commonAncestorContainer:this.#X.format.getLine(this.#X.selection.getNode(),null),h=Ht.check.isListCell(c)&&(Ht.check.isListCell(t)||Ht.check.isList(t)),d=null;const u=this.#X.format.isBrLine(c),p=this.#X.format.isLine(t)||this.#X.format.isBlock(t)||this.#X.component.isBasic(t);if(h&&(a=e||Ht.check.isList(t)?c.lastChild:c.nextElementSibling,d=Ht.check.isList(t)?c:(a||c).parentNode),!e&&(p||this.#X.component.isBasic(t)||Ht.check.isMedia(t))){const t=Ht.check.isEdgePoint(o.endContainer,o.endOffset,"end"),s=this.remove(),i=s.container,n=i===s.prevContainer&&o.collapsed?null:s.prevContainer;if(h&&n)if(d=3===n.nodeType?n.parentNode:n,d.contains(i)){let t=!0;for(a=i;a.parentNode&&a.parentNode!==d;)a=a.parentNode,t=!1;t&&i===n&&(a=a.nextSibling)}else a=null;else if(h&&Ht.check.isListCell(i)&&!c.parentElement)c=Ht.utils.createElement("LI"),d.appendChild(c),i.appendChild(d),a=null;else if(3===i.nodeType||Ht.check.isBreak(i)||h){const n=Ht.query.getParentElement(i,(t=>this.#X.format.isBlock(t)||Ht.check.isListCell(t)));if(e=this.#X.nodeTransform.split(i,s.offset,n?Ht.query.getNodeDepth(n)+1:0))if(h){if(c.contains(i)){const s=Ht.check.isList(c.lastElementChild);let i=null;t||(i=c.cloneNode(!1),i.appendChild(e.textContent.trim()?e:Ht.utils.createTextNode(Tt.zeroWidthSpace))),s&&(i||(i=c.cloneNode(!1),i.appendChild(Ht.utils.createTextNode(Tt.zeroWidthSpace))),i.appendChild(c.lastElementChild)),i&&(c.parentNode.insertBefore(i,c.nextElementSibling),a=e=i)}}else e=e.previousSibling;else Ht.check.isListCell(c)||(a=e=c)}}o=e||p?this.#X.selection.getRange():this.#X.selection.getRangeAndAddLine(this.#X.selection.getRange(),null);const g=o.commonAncestorContainer,m=o.startOffset,f=o.endOffset,v=o.startContainer===g&&this.#X.format.isLine(g),b=v&&(g.childNodes[m]||g.childNodes[0])||o.startContainer,y=v&&(g.childNodes[f]||g.childNodes[g.childNodes.length-1])||o.endContainer;if(!h)if(e)l=e.parentNode,e=e.nextSibling,r=!0;else if(l=b,3===b.nodeType&&(l=b.parentNode),o.collapsed)if(3===g.nodeType)e=g.textContent.length>f?g.splitText(f):g.nextSibling;else if(Ht.check.isBreak(l))e=l,l=l.parentNode;else{const s=l.childNodes[m],i=3===s?.nodeType&&Ht.check.isZeroWidth(s)&&Ht.check.isBreak(s.nextSibling)?s.nextSibling:s;i?!i.nextSibling&&Ht.check.isBreak(i)?(l.removeChild(i),e=null):e=Ht.check.isBreak(i)&&!Ht.check.isBreak(t)?i:i.nextSibling:e=null}else{if(b===y){e=Ht.check.isEdgePoint(y,f)?y.nextSibling:y.splitText(f);let t=b;Ht.check.isEdgePoint(b,m)||(t=b.splitText(m)),l.removeChild(t),0===l.childNodes.length&&p&&(l.innerHTML="<br>")}else{const s=this.remove(),i=s.container,n=s.prevContainer;if(0===i?.childNodes.length&&p&&(this.#X.format.isLine(i)?i.innerHTML="<br>":this.#X.format.isBlock(i)&&(i.innerHTML="<"+this.#it.get("defaultLine")+"><br></"+this.#it.get("defaultLine")+">")),Ht.check.isListCell(i)&&3===t.nodeType)l=i,e=null;else if(!p&&n)if(l=3===n.nodeType?n.parentNode:n,l.contains(i)){let t=!0;for(e=i;e.parentNode&&e.parentNode!==l;)e=e.parentNode,t=!1;t&&i===n&&(e=e.nextSibling)}else e=null;else Ht.check.isWysiwygFrame(i)&&!this.#X.format.isLine(t)?(l=i.appendChild(Ht.utils.createElement(this.#it.get("defaultLine"))),e=null):l=(e=p?y:i===n?i.nextSibling:i)&&e.parentNode?e.parentNode:g;for(;e&&!this.#X.format.isLine(e)&&e.parentNode!==g;)e=e.parentNode}}try{const s=this.#K.get("wysiwyg");if(!h){if((Ht.check.isWysiwygFrame(e)||l===s.parentNode)&&(l=s,e=null),this.#X.format.isLine(t)||this.#X.format.isBlock(t)||!Ht.check.isListCell(l)&&this.#X.component.isBasic(t)){const t=l;if(Ht.check.isListCell(e))l=e.previousElementSibling||e;else if(!r&&!e){const t=this.remove(),s=3===t.container.nodeType?Ht.check.isListCell(this.#X.format.getLine(t.container,null))?t.container:this.#X.format.getLine(t.container,null)||t.container.parentNode:t.container,i=Ht.check.isWysiwygFrame(s)||this.#X.format.isBlock(s);l=i?s:s.parentNode,e=i?null:s.nextSibling}0===t.childNodes.length&&l!==t&&Ht.utils.removeItem(t)}if(!p||u||this.#X.format.isBlock(l)||Ht.check.isListCell(l)||Ht.check.isWysiwygFrame(l)||(e=l.nextElementSibling,l=l.parentNode),Ht.check.isWysiwygFrame(l)&&(3===t.nodeType||Ht.check.isBreak(t))){const e=Ht.utils.createElement(this.#it.get("defaultLine"),null,t);n=t,t=e}}if(h?d.parentNode?(l=d,e=a):(l=s,e=null):e=l===e?l.lastChild:e,Ht.check.isListCell(t)&&!Ht.check.isList(l)){if(Ht.check.isListCell(l))e=l.nextElementSibling,l=l.parentNode;else{const t=Ht.utils.createElement("ol");l.insertBefore(t,e),l=t,e=null}h=!0}if(this.#he(t,l),l.insertBefore(t,e),h)if(Ht.check.isZeroWidth(c.textContent.trim()))Ht.utils.removeItem(c),t=t.lastChild;else{const e=Ht.utils.arrayFind(c.children,Ht.check.isList);e&&(t!==e?(t.appendChild(e),t=e.previousSibling):(l.appendChild(t),t=l),Ht.check.isZeroWidth(c.textContent.trim())&&Ht.utils.removeItem(c))}}catch(e){l.appendChild(t),console.warn("[SUNEDITOR.html.insertNode.warn]",e)}finally{n&&(t=n);const e=l.querySelectorAll("[data-duple]");if(e.length>0)for(let s,i,n,o,l=0,r=e.length;l<r;l++){for(s=e[l],n=s.childNodes,o=s.parentNode;n[0];)i=n[0],o.insertBefore(i,s);s===t&&(t=i),Ht.utils.removeItem(s)}if((this.#X.format.isLine(t)||this.#X.component.isBasic(t))&&b===y){const t=this.#X.format.getLine(g,null);1===t?.nodeType&&Ht.check.isEmptyLine(t)&&Ht.utils.removeItem(t)}if(u&&!Ht.check.isList(t)&&(this.#X.format.isLine(t)||this.#X.format.isBlock(t))&&(t=this.#de(t)),!this.#X.component.isBasic(t)){let e=1;if(3===t.nodeType)e=t.textContent.length,this.#X.selection.setRange(t,e,t,e);else if(!Ht.check.isBreak(t)&&!Ht.check.isListCell(t)&&this.#X.format.isLine(l)){let s=null;t.previousSibling&&!Ht.check.isBreak(t.previousSibling)||(s=Ht.utils.createTextNode(Tt.zeroWidthSpace),t.parentNode.insertBefore(s,t)),t.nextSibling&&!Ht.check.isBreak(t.nextSibling)||(s=Ht.utils.createTextNode(Tt.zeroWidthSpace),t.parentNode.insertBefore(s,t.nextSibling)),this.#X.inline._isIgnoreNodeChange(t)&&(t=t.nextSibling,e=0),this.#X.selection.setRange(t,e,t,e)}}i=t}return i}remove(){this.#X.selection.resetRangeToTextNode();const t=this.#X.selection.getRange(),e=0===t.startOffset,s=Ht.check.isEdgePoint(t.endContainer,t.endOffset,"end");let i=null,n=null,o=null;e&&(n=this.#X.format.getLine(t.startContainer),i=n?n.previousElementSibling:null,n=n?i:n),s&&(o=this.#X.format.getLine(t.endContainer),o=o?o.nextElementSibling:o);let l,r=0,a=t.startContainer,c=t.endContainer,h=t.startOffset,d=t.endOffset;const u=3===t.commonAncestorContainer.nodeType&&t.commonAncestorContainer.parentNode===a.parentNode?a.parentNode:t.commonAncestorContainer;if(Ht.check.isWysiwygFrame(a)&&Ht.check.isWysiwygFrame(c)){this.set("");return{container:this.#X.selection.getNode(),offset:0,commonCon:u}}if(u===a&&u===c){if(this.#X.component.isBasic(u)){const t=this.#X.component.get(u).container,e=t.parentElement,s=t.nextSibling||t.previousSibling,i=s===t.previousSibling?s?.textContent?.length||1:0,n=e.nextElementSibling||e.previousElementSibling,o=n===e.previousElementSibling?n?.textContent?.length||1:0;return Ht.utils.removeItem(t),this.#X.format.isLine(e)?0===e.childNodes.length?(Ht.utils.removeItem(e),{container:n,offset:o,commonCon:u}):{container:s,offset:i,commonCon:u}:{container:n,offset:o,commonCon:u}}if(1===u.nodeType&&0===h&&1===d||3===u.nodeType&&0===h&&d===u.textContent.length){const t=Ht.query.getNextDeepestNode(u,this.#K.get("wysiwyg")),e=Ht.query.getPreviousDeepestNode(u,this.#K.get("wysiwyg")),s=this.#X.format.getLine(u);Ht.utils.removeItem(u);let i=t||e,n=t?0:3===i?.nodeType?i.textContent.length:1;const o=this.#X.format.getLine(i)||this.#X.component.get(i);return s!==o&&(i=o,n=0===n?0:1),Ht.check.isZeroWidth(s)&&!s.contains(i)&&Ht.utils.removeItem(s),{container:i,offset:n,commonCon:u}}a=u.children[h],c=u.children[d],h=d=0}if(!a||!c)return{container:u,offset:0,commonCon:u};if(a===c&&t.collapsed&&Ht.check.isZeroWidth(a.textContent?.substring(h)))return{container:a,offset:h,prevContainer:a&&a.parentNode?a:null,commonCon:u};let p=null,g=null;const m=Ht.query.getListChildNodes(u,null,null);let f=Ht.utils.getArrayIndex(m,a),v=Ht.utils.getArrayIndex(m,c);if(m.length>0&&f>-1&&v>-1){for(let t=f+1,e=a;t>=0;t--)m[t]===e.parentNode&&m[t].firstChild===e&&0===h&&(f=t,e=e.parentNode);for(let t=v-1,e=c;t>f;t--)m[t]===e.parentNode&&1===m[t].nodeType&&(m.splice(t,1),e=e.parentNode,--v)}else{if(0===m.length){if(this.#X.format.isLine(u)||this.#X.format.isBlock(u)||Ht.check.isWysiwygFrame(u)||Ht.check.isBreak(u)||Ht.check.isMedia(u))return{container:u,offset:0,commonCon:u};if(Ht.check.isText(u))return{container:u,offset:d,commonCon:u};m.push(u),a=c=u}else if(a=c=m[0],Ht.check.isBreak(a)||Ht.check.isZeroWidth(a))return{container:Ht.check.isMedia(u)?u:a,offset:0,commonCon:u};f=v=0}const b=Ht.check.isText,y=Ht.check.isElement,C=f===v;let w=null;for(let t=f;t<=v;t++){const e=m[t];if(!b(e)||void 0!==e.data&&0!==e.length)if(e!==a)if(e!==c)w=this.#ue(e,C);else{if(b(c))g=Ht.utils.createTextNode(c.substringData(d,c.length-d));else{if(this.#X.component.is(c))continue;g=Ht.utils.createTextNode(c.textContent)}g.length>0?c.data=g.data:w=this.#ue(c,C)}else{if(y(a)){if(this.#X.component.is(a))continue;p=Ht.utils.createTextNode(a.textContent)}else{const t=a,s=c;e===c?(p=Ht.utils.createTextNode(t.substringData(0,h)+s.substringData(d,s.length-d)),r=h):p=Ht.utils.createTextNode(t.substringData(0,h))}if(p.length>0?a.data=p.data:w=this.#ue(a,C),e===c)break}else w=this.#ue(e,C)}const _=Ht.query.getParentElement(c,"ul"),x=Ht.query.getParentElement(a,"li");if(_&&x&&x.contains(_)?(l=_.previousSibling,r=l.textContent.length):(l=c&&c.parentNode?c:a&&a.parentNode?a:t.endContainer||t.startContainer,(e||s)&&(s?1===l.nodeType&&0===l.childNodes.length?(l.appendChild(Ht.utils.createElement("BR")),r=1):r=l.textContent.length:r=0)),this.#X.format.getLine(l)||a&&a.parentNode||(o?(l=o,r=0):n&&(l=n,r=1)),!Ht.check.isWysiwygFrame(l)&&0===l.childNodes.length){const t=this.#X.nodeTransform.removeAllParents(l,null,null);t&&(l=t.sc||t.ec||this.#K.get("wysiwyg"))}return l&&(1!==l.nodeType||this.#X.format.isLine(l)||Ht.check.isBreak(l))||(l=w?.sc||w?.ec,r=3===l?.nodeType?l.textContent.length:1),this.#X.selection.setRange(l,r,l,r),{container:l,offset:r,prevContainer:i,commonCon:u?.parentElement?u:null}}get({withFrame:t,includeFullPage:e,rootKey:s}={}){s?Array.isArray(s)||(s=[s]):s=[this.#t.get("rootKey")];const i=this.#t.get("rootKey"),n={};for(let i,o=0,l=s.length;o<l;o++){this.#X.facade.changeFrameContext(s[o]);const l=Ht.utils.createElement("DIV",null,this._convertToCode(this.#K.get("wysiwyg"),!0)),r=Ht.check.isTableCell,a=Ht.check.isEmptyLine,c=[],h=[];Ht.query.getListChildren(l,(t=>{t.hasAttribute("contenteditable")&&c.push(t);const e=t.parentElement;return r(e)&&e.children.length<=1&&a(t)&&h.push(e),!1}),null);for(let t=0,e=c.length;t<e;t++)c[t].removeAttribute("contenteditable");for(let t=0,e=h.length;t<e;t++)h[t].innerHTML="<br>";const d=l.innerHTML;if(this.#J.get("iframe_fullPage"))if(e){const t=Ht.utils.getAttributesToString(this.#K.get("_wd").body,["contenteditable"]);i=`<!DOCTYPE html><html>${this.#K.get("_wd").head.outerHTML}<body ${t}>${d}</body></html>`}else i=d;else i=t?`<div class="${this.#it.get("_editableClass")+""+(this.#it.get("_rtl")?" se-rtl":"")}">${d}</div>`:l.innerHTML;n[s[o]]=i}return this.#X.facade.changeFrameContext(i),s.length>1?n:n[s[0]]}set(t,{rootKey:e}={}){this.#X.ui.offCurrentController(),this.#X.selection.removeRange();const s=null==t?"":this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let t=0;t<e.length;t++)if(this.#X.facade.changeFrameContext(e[t]),this.#K.get("isCodeView")){const t=this._convertToCode(s,!1);this.#X.viewer._setCodeView(t)}else this.#K.get("wysiwyg").innerHTML=s,this.#X.pluginManager.resetFileInfo(),this.#X.history.push(!1,e[t])}add(t,{rootKey:e}={}){this.#X.ui.offCurrentController(),e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++){this.#X.facade.changeFrameContext(e[s]);const i=this.clean(t,{forceFormat:!0,whitelist:null,blacklist:null});if(this.#K.get("isCodeView"))this.#X.viewer._setCodeView(this.#X.viewer._getCodeView()+"\n"+this._convertToCode(i,!1));else{const t=Ht.utils.createElement("DIV",null,i),n=Array.from(t.children);for(let t=0,e=n.length;t<e;t++)this.#K.get("wysiwyg").appendChild(n[t]);this.#X.history.push(!1,e[s]),this.#X.selection.scrollTo(n.at(-1))}}}getJson({withFrame:t,rootKey:e}={}){return Mt.htmlToJson(this.get({withFrame:t,rootKey:e}))}setJson(t,{rootKey:e}={}){this.set(Mt.jsonToHtml(t),{rootKey:e})}async copy(t){try{return!("string"!=typeof t&&!Ht.check.isElement(t)&&!Ht.check.isText(t))&&(!1===await At.write(t)?(this.#X.ui.showToast(this.#X.lang.message_copy_fail,this.#it.get("toastMessageTime").copy,"error"),!1):(this.#X.ui.showToast(this.#X.lang.message_copy_success,this.#it.get("toastMessageTime").copy),!0))}catch(t){return console.error("[SUNEDITOR.html.copy.fail] :",t),this.#X.ui.showToast(this.#X.lang.message_copy_fail,this.#it.get("toastMessageTime").copy,"error"),!1}}setFullPage(t,{rootKey:e}={}){if(!this.#J.get("iframe"))return!1;e?Array.isArray(e)||(e=[e]):e=[this.#t.get("rootKey")];for(let s=0;s<e.length;s++)this.#X.facade.changeFrameContext(e[s]),t.head&&(this.#K.get("_wd").head.innerHTML=t.head.replace(this.#Yt,"")),t.body&&(this.#K.get("_wd").body.innerHTML=this.clean(t.body,{forceFormat:!0,whitelist:null,blacklist:null})),this.#X.pluginManager.resetFileInfo()}compress(t){return t.replace(/>\s+</g,"> <").replace(/\n/g,"").trim()}_convertToCode(t,e){let s="";const i=RegExp,n=new i("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),o="string"==typeof t?ke.createRange().createContextualFragment(t):t,l=t=>this.#X.format.isLine(t)||this.#X.component.is(t),r=e?"":"\n",a=e?0:1*this.#t.get("codeIndentSize"),c=a>0?new Array(a+1).join(" "):"";return function t(e,o){const a=e?.childNodes;if(!a)return;const h=n.test(e.nodeName),d=h?o:"";for(let u,p,g,m,f,v,b=0,y=a.length;b<y;b++)u=a[b],m=n.test(u.nodeName),p=m?r:"",g=!l(u)||h||/^(TH|TD)$/i.test(e.nodeName)?"":r,8!==u.nodeType?3!==u.nodeType?0!==u.childNodes.length?u.outerHTML?(f=u.nodeName.toLowerCase(),v=d||m?o:"",s+=(g||(h?"":p))+v+u.outerHTML.match(i("<"+f+"[^>]*>","i"))[0]+p,t(u,o+c+""),s+=(/\n$/.test(s)?v:"")+"</"+f+">"+(g||p||h||/^(TH|TD)$/i.test(u.nodeName)?r:"")):s+=(new XMLSerializer).serializeToString(u):s+=(/^HR$/i.test(u.nodeName)?r:"")+(/^PRE$/i.test(u.parentElement.nodeName)&&/^BR$/i.test(u.nodeName)?"":d)+u.outerHTML+p:Ht.check.isList(u.parentElement)||(s+=Mt.htmlToEntity(/^\n+$/.test(u.data)?"":u.data)):s+="\n\x3c!-- "+u.textContent.trim()+" --\x3e"+p}(o,""),s.trim()+r}#ue(t,e){const s=this.#X.format.getLine(t,null);if(Ht.utils.removeItem(t),!Ht.check.isListCell(s)||e)return;const i=this.#X.nodeTransform.removeAllParents(s,null,null);return Ht.check.isList(s?.firstChild)&&s.insertBefore(Ht.utils.createTextNode(Tt.zeroWidthSpace),s.firstChild),i?{sc:i.sc,ec:i.ec}:null}#de(t){const e=t.parentNode;let s,i;for(;this.#X.format.isLine(t)||this.#X.format.isBlock(t);){for(s=t.childNodes,i=null;s[0];)if(i=s[0],this.#X.format.isLine(i)||this.#X.format.isBlock(i)){if(this.#de(i),!t.parentNode)break;s=t.childNodes}else e.insertBefore(i,t);0===t.childNodes.length&&Ht.utils.removeItem(t),t=Ht.utils.createElement("BR"),e.insertBefore(t,i.nextSibling)}return t}#re(t,e){const s=this.#it.get("defaultLine");if(1===t.nodeType){if(this.#Xt.test(t.nodeName))return"";if(Ht.check.isExcludeFormat(t))return t.outerHTML;const i=Ht.query.getListChildNodes(t,(t=>Ht.check.isSpanWithoutAttr(t)&&!Ht.query.getParentElement(t,Ht.check.isExcludeFormat)),null)||[];for(let t,e=i.length-1;e>=0;e--)t=i[e],t.outerHTML=t.innerHTML;if(!e||this.#X.format.isLine(t)||this.#X.format.isBlock(t)||this.#X.component.is(t)||Ht.check.isMedia(t)||Ht.check.isFigure(t)||Ht.check.isAnchor(t)&&Ht.check.isMedia(t.firstElementChild)){const e=t;return Ht.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML}{const e=t;return"<"+s+">"+(Ht.check.isSpanWithoutAttr(t)?e.innerHTML:e.outerHTML)+"</"+s+">"}}if(3===t.nodeType){if(!e)return Mt.htmlToEntity(t.textContent);const i=t.textContent.split(/\n/g);let n="";for(let t,e=0,o=i.length;e<o;e++)t=i[e].trim(),t.length>0&&(n+="<"+s+">"+Mt.htmlToEntity(t)+"</"+s+">");return n}return 8===t.nodeType&&this.#zt?"\x3c!--"+t.textContent.trim()+"--\x3e":""}#ne(t,e,s,i,n,o,l){const r=[],a=[],c=[],h=[],d=Ht.query.getListChildNodes(t,(d=>{if(1!==d.nodeType)return n&&Ht.check.isList(d.parentElement)&&r.push(d),3!==d.nodeType||d.textContent.trim()||r.push(d),!1;if(i&&(s.test(d.nodeName)||!e.test(d.nodeName)&&0===d.childNodes.length&&Ht.check.isExcludeFormat(d)))return r.push(d),!1;const u=!Ht.query.getParentElement(d,Ht.check.isExcludeFormat);if(n){if(!Ht.check.isTableElements(d)&&!Ht.check.isListCell(d)&&!Ht.check.isAnchor(d)&&(this.#X.format.isLine(d)||this.#X.format.isBlock(d)||this.#X.format.isTextStyleNode(d))&&0===d.childNodes.length&&u)return a.push(d),!1;if(Ht.check.isList(d.parentNode)&&!Ht.check.isList(d)&&!Ht.check.isListCell(d))return c.push(d),!1;if(Ht.check.isTableCell(d)){const t=d.firstElementChild;if(!this.#X.format.isLine(t)&&!this.#X.format.isBlock(t)&&!this.#X.component.is(t))return h.push(d),!1}}if(o&&u&&d.className){const t=Array.from(d.classList).map(this.#Rt).join(" ").trim();t?d.className=t:d.removeAttribute("class")}if(!n)return!1;return!l&&d.parentNode!==t&&u&&(Ht.check.isListCell(d)&&!Ht.check.isList(d.parentNode)||(this.#X.format.isLine(d)||this.#X.component.is(d))&&!this.#X.format.isBlock(d.parentNode)&&!Ht.query.getParentElement(d,this.#X.component.is.bind(this.#X.component)))}),null);for(let t=0,e=r.length;t<e;t++)Ht.utils.removeItem(r[t]);const u=[];for(let t,e,s=0,i=d.length;s<i;s++)if(t=d[s],e=t.parentNode,e&&e.parentNode)if(Ht.query.getParentElement(t,Ht.check.isListCell)){const s=t.childNodes;for(let i=s.length-1;i>=0;i--)e.insertBefore(s[i],t);u.push(t)}else e.parentNode.insertBefore(t,e),u.push(e);for(let t,e=0,s=u.length;e<s;e++)t=u[e],Ht.check.isZeroWidth(t.textContent.trim())&&Ht.utils.removeItem(t);for(let t=0,e=a.length;t<e;t++)Ht.utils.removeItem(a[t]);for(let t,e,s,i,n=0,o=c.length;n<o;n++)if(t=c[n],i=t.parentNode,i)if(e=Ht.utils.createElement("LI"),this.#X.format.isLine(t)){for(s=t.childNodes;s[0];)e.appendChild(s[0]);i.insertBefore(e,t),Ht.utils.removeItem(t)}else t=t.nextSibling,e.appendChild(c[n]),i.insertBefore(e,t);for(let t,e,s=0,i=h.length;s<i;s++)t=h[s],e=Ht.utils.createElement("DIV"),e.innerHTML=0===t.textContent.trim().length&&0===t.children.length?"<br>":t.innerHTML,t.innerHTML=e.outerHTML}#ae(t){if(!this.#Ft)return t;const e=this.#it.get("_defaultStyleTagMap");return t.replace(this.#Ft,((t,s,i,n)=>s+("string"==typeof e[i]?e[i]:i)+(n?" "+n:"")))}#le(t){let e,s="";const i=t.childNodes;for(let t,n=0,o=i.length;n<o;n++)t=i[n],this.#Jt.test(t.nodeName)?s+=t.outerHTML:8===t.nodeType?s+="\x3c!-- "+t.textContent+" --\x3e":/meta/i.test(t.nodeName)||this.#X.format.isLine(t)||this.#X.format.isBlock(t)||this.#X.component.is(t)||Ht.check.isExcludeFormat(t)?(e&&(s+=e.outerHTML,e=null),s+=t.outerHTML):(e||=Ht.utils.createElement(this.#it.get("defaultLine")),this.#X.format.isTextStyleNode(t)&&t.removeAttribute("style"),e.appendChild(t),n--,o--);return e&&(s+=e.outerHTML),ke.createRange().createContextualFragment(s)}#ce(t){let e="";for(let s,i=0,n=t.length;i<n;i++)s=t[i],1===s.nodeType?Ht.check.isList(s)?e+=s.innerHTML:Ht.check.isListCell(s)?e+=s.outerHTML:this.#X.format.isLine(s)?e+="<li>"+(s.innerHTML.trim()||"<br>")+"</li>":this.#X.format.isBlock(s)&&!Ht.check.isTableElements(s)?e+=this.#ce(s.children):e+="<li>"+s.outerHTML+"</li>":e+="<li>"+(s.textContent||"<br>")+"</li>";return e}#oe(t){let e=!1;for(let s,i=0,n=t.length;i<n;i++)if(s=t[i],1===s.nodeType&&!this.#X.format.isTextStyleNode(s)&&!Ht.check.isBreak(s)&&!this.#Xt.test(s.nodeName)){e=!0;break}return e}#pe(t,e,s){let i=(t.match(Le)||[])[0];if(this.#Kt.includes(s)&&!i&&(t.match(Ae)||[])[1]){const e=(t.match(Be)||[])[1],s=(t.match(Ie)||[])[1],n=(t.match(Ve)||[])[1];(e||s||n)&&(i='style="'+(e?"font-size:"+Lt.get(Number(e)/3.333,1)+"rem;":"")+(s?"font-family:"+s+";":"")+(n?"color:"+n+";":"")+'"')}if(i){let t;e||=[];for(const[e,i]of this.#jt)if(e.test(s)){t=i;break}if(!t)return e;const n=i.replace(Oe,"").match(t);if(!n)return e;const o=[];for(let t,e=0,s=n.length;e<s;e++)if(t=n[e].match(Re),t&&!ze.test(t[3])){const e=Mt.kebabToCamelCase(t[1].trim()),s=this.#K.get("wwComputedStyle")[e]?.replace(Fe,""),i=t[3].trim();switch(e){case"fontFamily":if(!this.#X.plugins.font||!this.#X.plugins.font.fontArray.includes(i))continue;break;case"fontSize":if(!this.#X.plugins.fontSize)continue;this.#Ot.test(t[0])||(t[0]=t[0].replace((t[0].match(Pe)||[])[1],Mt.toFontUnit.bind(null,this.#it.get("fontSizeUnits")[0])));break;case"color":if(!this.#X.plugins.fontColor||De.test(i))continue;break;case"backgroundColor":if(!this.#X.plugins.backgroundColor||De.test(i))continue}s!==i&&o.push(t[0])}o.length>0&&e.push('style="'+o.join(";")+'"')}return e}#se(t,e,s){return e.test("<font>")&&(t=t.replace(/(<\/?)font(\s?)/gi,"$1span$2")),t.replace(e,"").replace(s,"")}#he(t,e){const s=t=>{this.#ge(t,e);const i=t.childNodes;for(let t=0,e=i.length;t<e;t++)s(i[t])};s(t)}#ge(t,e){if(!this.#X.format.isTextStyleNode(t))return;const s=(t.style.cssText.match(qe)||[]).map((function(t){return t.trim()})),i=t.nodeName;if(We.test(i)&&0===s.length)return t;const n=this.#X.format;let o=!1;return function e(l){if(!Ht.check.isWysiwygFrame(l)&&n.isTextStyleNode(l)){if(l.nodeName===i){o=!0;const e=l.style.cssText.match(qe)||[];for(let t,i=0,n=e.length;i<n;i++)(t=s.indexOf(e[i].trim()))>-1&&s.splice(t,1);for(let e=0,s=l.classList.length;e<s;e++)t.classList.remove(l.classList[e])}e(l.parentElement)}}(e),o&&((t.style.cssText=s.join(" "))||(t.setAttribute("style",""),t.removeAttribute("style")),0===t.attributes.length&&t.setAttribute("data-duple","true")),t}#ie(t,e,s,i){if(Ee.test(s))return s;let n=null;const o=i.match(Te)[0].toLowerCase();if(t){const t=this.#te[o];s=s.replace(Me,""),s=t?s.replace(t,""):s.replace(this.#Gt,"");const e=this.#Qt[o];n=e?s.match(e):s.match(this.#Ut)}if(!e)return s;if("a"===o){const t=s.match(/(?:(?:id|name)\s*=\s*(?:"|')[^"']*(?:"|'))/g);t&&(n||=[],n.push(t[0]))}else n&&He.test(n.toString())||(this.#Kt.includes(o)?n=this.#pe(s,n,o):this.#X.format.isLine(o)?n=this.#pe(s,n,"line"):this.#Zt.test(o)&&(n=this.#pe(s,n,o)));if(Ht.check.isMedia(o)||Ht.check.isFigure(o)){const t=s.match(Le);n||=[],t&&n.push(t[0])}if(n)for(let t,e=0,s=n.length;e<s;e++)t=Xe(n[e].trim())?n[e]:"",i+=(Ne.test(t)?"":" ")+t;return i}__resetAutoStyleify(t){if(t.length>0){const e=this.#it.get("convertTextTags"),s={};t.forEach((t=>{switch(t){case"bold":s.bold={regex:/font-weight\s*:\s*bold/i,tag:e.bold};break;case"italic":s.italic={regex:/font-style\s*:\s*italic/i,tag:e.italic};break;case"underline":s.underline={regex:/text-decoration\s*:\s*underline/i,tag:e.underline};break;case"strike":s.strike={regex:/text-decoration\s*:\s*line-through/i,tag:e.strike}}})),this.#ee=s}else this.#ee=null}_destroy(){this.#jt&&this.#jt.clear()}};const ts=class{#X;#it;constructor(t){this.#X=t.$,this.#it=this.#X.options}split(t,e,s){if(Ht.check.isWysiwygFrame(t)||this.#X.component.is(t)||!t)return t;if(e&&!Lt.is(e)){const s=t.childNodes;let i=Ht.query.getPositionIndex(e);const n=t.cloneNode(!1),o=t.cloneNode(!1);for(let t=0,e=s.length;t<e;t++){if(t<i)n.appendChild(s[t]);else{if(!(t>i))continue;o.appendChild(s[t])}t--,e--,i--}return n.childNodes.length>0&&t.parentNode.insertBefore(n,t),o.childNodes.length>0&&t.parentNode.insertBefore(o,t.nextElementSibling),t}const i=t.parentNode;let n,o,l,r=0,a=1,c=!0;if((!s||s<0)&&(s=0),Ht.check.isText(t)){if(r=Ht.query.getPositionIndex(t),(e=Number(e))>=0&&t.length!==e){t.splitText(e);const s=Ht.query.getNodeFromPath([r+1],i);Ht.check.isZeroWidth(s)&&(s.data=Tt.zeroWidthSpace)}}else if(1===t.nodeType){if(0===e){for(;t.firstChild;)t=t.firstChild;if(3===t.nodeType){const e=Ht.utils.createTextNode(Tt.zeroWidthSpace);t.parentNode.insertBefore(e,t),t=e}}t.previousSibling?t=t.previousSibling:Ht.query.getNodeDepth(t)===s&&(c=!1)}1===t.nodeType&&(a=0);let h=t;for(;Ht.query.getNodeDepth(h)>s;)for(r=Ht.query.getPositionIndex(h)+a,h=h.parentNode,l=n,n=h.cloneNode(!1),o=h.childNodes,l&&(Ht.check.isListCell(n)&&Ht.check.isList(l)&&l.firstElementChild?(n.innerHTML=l.firstElementChild.innerHTML,Ht.utils.removeItem(l.firstElementChild),l.children.length>0&&n.appendChild(l)):n.appendChild(l));o[r];)n.appendChild(o[r]);1===h.nodeType&&h.childNodes.length<=1&&!h.firstChild?.textContent?.length&&(h.innerHTML="<br>");const d=h.parentNode;return c&&(h=h.nextSibling),n?(this.mergeSameTags(n,null,!1),this.mergeNestedTags(n,Ht.check.isList),n.childNodes.length>0?d.insertBefore(n,h):n=h,Ht.check.isListCell(n)&&n.children&&Ht.check.isList(n.children[0])&&n.insertBefore(Ht.utils.createElement("BR"),n.children[0]),0===i.childNodes.length&&Ht.utils.removeItem(i),n):h}mergeSameTags(t,e,s){const i=e?e.length:0;let n=null;i&&(n=Array.apply(null,new Array(i)).map(Number.prototype.valueOf,0));const o=(t,l,r)=>{const a=t.childNodes;for(let c,h,d=0,u=a.length;d<u&&(c=a[d],h=a[d+1],c);d++)if(!(Ht.check.isBreak(c)||Ht.check.isMedia(c)||Ht.check.isInputElement(c)))if(s&&this.#X.inline._isIgnoreNodeChange(c)||!s&&(Ht.check.isTableElements(c)||Ht.check.isListCell(c)||this.#X.format.isLine(c)&&!this.#X.format.isBrLine(c)))(Ht.check.isTableElements(c)||Ht.check.isListCell(c))&&o(c,l+1,d);else{if(1===u&&t.nodeName===c.nodeName&&t.parentNode){if(i){let s,n,o,r,a;for(let h=0;h<i;h++)if(s=e[h],s&&s[l]===d){for(n=c,o=t,r=l,a=!0;r>=0;){if(Ht.utils.getArrayIndex(o.childNodes,n)!==s[r]){a=!1;break}n=c.parentNode,o=n.parentNode,r--}a&&(s.splice(l,1),s[l]=d)}}Ht.utils.copyTagAttributes(c,t),t.parentNode.insertBefore(c,t),Ht.utils.removeItem(t)}if(!h){1===c.nodeType&&o(c,l+1,d);break}if(c.nodeName===h.nodeName&&Ht.check.isSameAttributes(c,h)&&c.getAttribute?.("href")===h.getAttribute?.("href")){const t=c.childNodes;let s=0;for(let e=0,i=t.length;e<i;e++)t[e].textContent.length>0&&s++;const o=c.lastChild,a=h.firstChild;let u=0;if(o&&a){const t=3===o.nodeType&&3===a.nodeType;u=o.textContent.length;let c=o.previousSibling;for(;c&&3===c.nodeType;)u+=c.textContent.length,c=c.previousSibling;if(s>0&&3===o.nodeType&&3===a.nodeType&&(o.textContent.length>0||a.textContent.length>0)&&s--,i){let c=null;for(let h=0;h<i;h++)if(c=e[h],c&&c[l]>d){if(l>0&&c[l-1]!==r)continue;c[l]-=1,c[l+1]>=0&&c[l]===d&&(c[l+1]+=s,t&&o&&3===o.nodeType&&a&&3===a.nodeType&&(n[h]+=u))}}}if(3===c.nodeType){if(u=c.textContent.length,c.textContent+=h.textContent,i){let t=null;for(let o=0;o<i;o++)if(t=e[o],t&&t[l]>d){if(l>0&&t[l-1]!==r)continue;t[l]-=1,t[l+1]>=0&&t[l]===d&&(t[l+1]+=s,n[o]+=u)}}}else c.innerHTML+=h.innerHTML;Ht.utils.removeItem(h),d--}else 1===c.nodeType&&o(c,l+1,d)}};return o(t,0,0),n}mergeNestedTags(t,e){if("string"==typeof e){const t=new RegExp(`^(${e||".+"})$`,"i");e=e=>t.test(e.nodeName)}else"function"!=typeof e&&(e=()=>!0);!function t(s){let i=s.children;if(1===i.length&&i[0].nodeName===s.nodeName&&e(s)){const t=i[0];for(i=t.children;i[0];)s.appendChild(i[0]);s.removeChild(t)}for(let e=0,i=s.children.length;e<i;e++)t(s.children[e])}(t)}removeAllParents(t,e,s){if(!t)return null;let i=null;return e||=t=>{if(t===s||this.#X.component.is(t))return!1;const e=t.textContent.trim();return 0===e.length||/^(\n|\u200B)+$/.test(e)},function t(s){if(!Ht.check.isWysiwygFrame(s)){const n=s.parentNode;n&&e(s)&&(i={sc:s.previousElementSibling,ec:s.nextElementSibling},Ht.utils.removeItem(s),t(n))}}(t),i}removeEmptyNode(t,e,s){const i=this.#it.get("allowedEmptyTags");e&&=Ht.query.getParentElement(e,(e=>t===e.parentElement));const n=s=>{if(this.#X.format._isNotTextNode(s)||s===e||Ht.check.isNonEditable(s))return 0;if(s===t||!Ht.check.isZeroWidth(s.textContent)||s.firstChild&&Ht.check.isBreak(s.firstChild)||s.querySelector(i)){const t=s.children;for(let e=0,s=t.length,i=0;e<s;e++)t[e+i]&&!this.#X.component.is(t[e+i])&&(i+=n(t[e+i]))}else if(s.parentNode)return s.parentNode.removeChild(s),-1;return 0};n(t),0===t.childNodes.length&&(s?Ht.utils.removeItem(t):t.innerHTML="<br>")}createNestedNode(t,e){"function"!=typeof e&&(e=()=>!0);const s=t[0].cloneNode(!1);let i=s;for(let s,n=1,o=t.length;n<o;n++)e(t[n])&&(s=t[n].cloneNode(!1),i.appendChild(s),i=s);return i.innerHTML="",{parent:s,inner:i}}};function es(t){t&&!it(t,"se-blink")&&(nt(t,"se-blink"),o.setTimeout((()=>{ot(t,"se-blink")}),600))}const ss=class{#X;#K;#J;constructor(t){this.#X=t.$,this.#K=this.#X.frameContext,this.#J=this.#X.frameOptions}check(t){const e=this.#J.get("charCounter_max");if(e){const s=this.getLength("string"==typeof t?t:"byte-html"===this.#J.get("charCounter_type")&&1===t.nodeType?t.outerHTML:t.textContent);if(s>0&&s+this.getLength()>e)return es(this.#K.get("charWrapper")),!1}return!0}getLength(t){return"string"!=typeof t&&(t="byte-html"===this.#J.get("charCounter_type")?this.#K.get("wysiwyg").innerHTML:this.#K.get("wysiwyg").textContent),/byte/.test(this.#J.get("charCounter_type"))?this.getByteLength(t):t.length}getByteLength(t){if(!t||!t.toString)return 0;let e,s;return t=t.toString(),u?(s=decodeURIComponent(encodeURIComponent(t)).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),s+e):(s=(new TextEncoder).encode(t).length,e=0,null!==encodeURIComponent(t).match(/(%0A|%0D)/gi)&&(e=encodeURIComponent(t).match(/(%0A|%0D)/gi).length),s+e)}display(t){const e=(t||this.#K).get("charCounter");e&&o.setTimeout((()=>{e.textContent=String(this.getLength())}),0)}test(t,e){let s=0;t&&(s=this.getLength(t)),this.display();const i=this.#J.get("charCounter_max");if(i>0){let t=!1;const n=this.getLength();if(n>i){if(t=!0,s>0&&e){this.#X.selection.init();const t=this.#X.selection.getRange(),e=t.endOffset-1,s=this.#X.selection.getNode().textContent,i=t.endOffset-1;this.#X.selection.getNode().textContent=s.slice(0,i<0?0:i)+s.slice(t.endOffset,s.length),this.#X.selection.setRange(t.endContainer,e,t.endContainer,e)}}else n+s>i&&(t=!0);if(t&&(es(this.#K.get("charWrapper")),s>0))return!1}return!0}};const is=class{#X;#it;#me=!1;constructor(t){this.#X=t.$,this.#it=this.#X.options,this.keyMap=new Map,this.reverseKeys=new Set}command(t,e,s,i,n,o,l,r){if(this.#me)return!1;let a=null;return a=e?this.keyMap.get(i+(s?"1000":"")):this.keyMap.get(n)||this.keyMap.get(n+t.key),!(!a||!s&&a.s||a.space&&!Nt.isSpace(i)||a.enter&&!Nt.isEnter(i)||a.textTrigger&&!t.key.trim()||a.edge&&!o)&&(a.plugin&&"string"==typeof a.method?this.#X.plugins[a.plugin][a.method]?.({range:r,line:l,info:a,event:t,keyCode:i}):"function"==typeof a.method?a.method({range:r,line:l,info:a,event:t,keyCode:i}):this.#X.commandDispatcher.run(a.command,a.type,a.button),!0)}disable(){this.#me=!0}enable(){this.#me=!1}_registerCustomShortcuts(){const t=this.#it.get("shortcuts"),e=this.#it.get("_reverseCommandArray"),s=this.keyMap=new Map,i=this.reverseKeys;for(const n of Object.keys(t))n.startsWith("_")&&Ut("",null,t[n],s,e,i)}_destroy(){this.keyMap.clear(),this.reverseKeys.clear()}},ns=new Map([["__figureInst",null],["__dragInst",null],["__dragHandler",null],["__dragContainer",null],["__dragCover",null],["__dragMove",null],["__overInfo",null]]),os=ns,{_w:ls,isMobile:rs,ON_OVER_COMPONENT:as}=Et,cs="2147483646",hs="2147483645",ds="2147483642",us="2147483641";const ps=class{#X;#fe;#ve;#be={left:0,top:0};#ye=!1;#Ce=!1;#we=null;#_e=null;#xe=null;#$e=null;#Se=[];#ke=new Map;constructor(t,e,s,i,n){this.#X=e,this.kind=n||t.constructor.key||t.constructor.name,this.host=t,this.form=s,this.isOpen=!1,this.currentTarget=null,this.currentPositionTarget=null,this.isWWTarget=i.isWWTarget??!0,this.position=i.position||"bottom",this.disabled=!!i.disabled,this.parents=i.parents||[],this.parentsForm=[],this.parentsHide=!!i.parentsHide,this.sibling=i.sibling||null,this.siblingMain=!!i.siblingMain,this.isInsideForm=!!i.isInsideForm,this.isOutsideForm=!!i.isOutsideForm,this.toTop=!1,this.__offset={},this.#fe="function"==typeof i.initMethod?i.initMethod:null,this.#ve={keydown:this.#Ee.bind(this),mousedown:this.#Te.bind(this)};for(const t of this.parents)Ht.check.isElement(t)?this.parentsForm.push(t):(t.#Se.push(this),this.parentsForm.push(t.form));this.#X.contextProvider.carrierWrapper.appendChild(s),this.#X.eventManager.addEvent(s,"click",this.#Me.bind(this)),this.#X.eventManager.addEvent(s,"mouseenter",this.#He.bind(this)),this.#X.eventManager.addEvent(s,"mouseleave",this.#Le.bind(this))}open(t,e,{isWWTarget:s,initMethod:i,disabled:n,addOffset:o}={}){if(ns.get("__overInfo")===as)return;if(!t)return void console.warn("[SUNEDITOR.Controller.open.fail] The target element is required.");this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#ke.clear(),this.#X.store.mode.isBalloon?this.#X.toolbar.hide():this.#X.store.mode.isSubBalloon&&this.#X.subToolbar.hide(),this.#X.store.get("hasFocus")||(n??this.disabled?this.#X.ui.setControllerOnDisabledButtons(!0):this.#X.ui.setControllerOnDisabledButtons(!1)),this.currentPositionTarget=e||t,this.isWWTarget=s??this.isWWTarget,"function"==typeof i&&(this.#fe=i),this.#X.ui.currentControllerName=this.kind,this.#be={left:0,top:0},o&&(this.#be={...this.#be,...o});const l=this.isOutsideForm?this.parentsForm:[];this.#X.ui.opendControllers?.forEach((t=>{l.includes(t.form)||(t.form.style.zIndex=us)})),this.parentsHide&&this.parentsForm.forEach((t=>{t.style.display="none",t.setAttribute("data-se-hidden-by-children","1")})),this.#Ne(),this.#Ae(this.form,this.currentPositionTarget,!1);const r=this.#X.instanceCheck.isRange(t);this.currentTarget=r?null:t,this.#Be(this.form,t,r),ls.setTimeout((()=>ns.set("__overInfo",!1)),0)}close(t){(t||this.isOpen&&!this.#Ce)&&(this.form.removeAttribute("data-se-hidden-by-parent"),this.form.removeAttribute("data-se-hidden-by-children"),this.#ke.clear(),this.#Ie("close"),this.toTop=!1,this.isOpen=!1,this.#Ce=!1,this.__offset={},this.#be={left:0,top:0},this.#Ve(),this.#fe?.(),this.#Oe(),this.parentsHide&&!t&&this.parentsForm.forEach((t=>{t.style.display="block",t.removeAttribute("data-se-hidden-by-children")})),this.host.controllerClose?.(),this.parentsForm.length>0||this.#X.component.deselect())}hide(){this.#Ie("hide"),this.form.style.display="none"}show(){this.#Ae(this.form,this.currentPositionTarget,!1)}bringToTop(t){this.toTop=t,this.form.style.zIndex=t?cs:hs}resetPosition(t){this.#Ae(this.form,t||this.currentPositionTarget,!0)}_scrollReposition(){this.form.hasAttribute("data-se-hidden-by-parent")||this.form.hasAttribute("data-se-hidden-by-children")||this.#Ae(this.form,this.currentPositionTarget,!1)&&ls.setTimeout((()=>{this.#Ie("show")}),0)}#Ie(t){for(const e of this.#Se)if("hide"===t&&"none"!==e.form.style.display){const t=this.#Re(e);e.#ke.set(this,!0);const s=this.#Re(e);!t&&s&&(e.form.setAttribute("data-se-hidden-by-parent","1"),e.hide())}else if("show"===t){if(e.form.hasAttribute("data-se-hidden-by-children")){e.#Ie("show");continue}const t=this.#Re(e);e.#ke.set(this,!1);const s=this.#Re(e);t&&!s&&(e.form.removeAttribute("data-se-hidden-by-parent"),e.show())}else e[t]?.(!0)}#Re(t){for(const e of t.#ke.values())if(!0===e)return!0;return!1}async#Be(t,e,s){const i={position:this.position,inst:this,form:t,target:e,isRangeTarget:s,notInCarrier:!this.#X.contextProvider.carrierWrapper.contains(t)};!1!==await this.#X.eventManager.triggerEvent("onBeforeShowController",{caller:this.kind,frameContext:this.#X.frameContext,info:i})&&(t.style.display="block",this.#X.contextProvider.shadowRoot&&(this.#we=t,this.#_e=t=>t.stopPropagation(),t.addEventListener("mousedown",this.#_e)),this.#X.ui.onControllerContext(),this.isOpen||this.#X.ui.opendControllers.push(i),this.isOpen=!0,this.#X.store.set("_preventBlur",!0),this.#X.store.set("controlActive",!0),this.host.controllerOn?.(t,e),this.#X.eventManager.triggerEvent("onShowController",{caller:this.kind,frameContext:this.#X.frameContext,info:i}))}#Oe(){this.form.style.display="none",this.#X.ui.opendControllers=this.#X.ui.opendControllers.filter((t=>t.form!==this.form)),this.#X.ui.currentControllerName!==this.kind&&this.#X.ui.opendControllers.length>0||(this.#X.ui.setControllerOnDisabledButtons(!1),this.#X.ui.offControllerContext(),this.#X.frameContext.get("lineBreaker_t").style.display=this.#X.frameContext.get("lineBreaker_b").style.display="none",this.#X.store.set("_lastSelectionNode",null),this.#X.ui.currentControllerName="",this.#X.store.set("_preventBlur",!1),ls.setTimeout((()=>{this.#X.store.set("controlActive",!1)}),0),this.#we&&(this.#we.removeEventListener("mousedown",this.#_e),this.#we=this.#_e=null))}#Ae(t,e,s){if(!e)return!1;if(t.style.visibility="hidden",t.style.display="block",this.sibling&&"block"!==this.sibling.style.display&&(this.sibling.style.visibility="hidden",this.sibling.style.display="block"),this.#X.selection.isRange(e)){if(!this.#X.offset.setRangePosition(this.form,e,{position:"bottom"}))return this.hide(),!1}else{const i=this.#X.offset.setAbsPosition(t,e,{addOffset:this.#be,position:this.position,isWWTarget:this.isWWTarget,inst:this,sibling:this.sibling});if(!i)return this.hide(),!1;if(s||!this.sibling||this.siblingMain)this.#ye=!1;else{const e=t.offsetTop-this.#be.top;"bottom"===i.position?(this.#ye=!0,t.style.top=e+this.sibling.offsetHeight-1+"px"):(this.#ye=!1,t.style.top=e-this.sibling.offsetHeight+2+"px")}}return t.style.zIndex=this.toTop?hs:this.#ye?ds:us,t.style.visibility="",!0}#Ne(){this.#Ve(),this.#xe=this.#X.eventManager.addGlobalEvent("keydown",this.#ve.keydown,!0),this.#$e=this.#X.eventManager.addGlobalEvent(rs?"click":"mousedown",this.#ve.mousedown,!0)}#Ve(){this.#X.component.__removeGlobalEvent(),this.#xe&&=this.#X.eventManager.removeGlobalEvent(this.#xe),this.#$e&&=this.#X.eventManager.removeGlobalEvent(this.#$e)}#ze(){if(this.#X.ui.selectMenuOn)return!0;const t=this.#X.ui.opendControllers;for(let e=0;e<t.length;e++)if(t[e].inst===this&&t[e].fixed)return!0;return!1}#Fe(t){if(Ht.check.isWysiwygFrame(t)||t.contains(this.form))return!1;if(Ht.utils.hasClass(t,"se-drag-handle"))return!0;let e=!1;this.isInsideForm&&this.parentsForm?.length>0&&this.parentsForm.some((s=>{if(s.contains(t))return e=!0,!0}));const s=this.host._element;return!e&&(!!Ht.query.getParentElement(t,".se-controller")||(this.#X.component.isInline(s)?t===s:t?.contains(s)))}#Me(t){const e=Ht.query.getEventTarget(t),s=Ht.query.getCommandTarget(e);s&&(t.stopPropagation(),t.preventDefault(),this.host.controllerAction(s))}#He(t){if(this.#X.ui.currentControllerName=this.kind,this.parentsForm.length>0&&this.isInsideForm)return;Ht.query.getEventTarget(t).style.zIndex=this.toTop?cs:hs}#Le(t){if(this.parentsForm.length>0&&this.isInsideForm)return;Ht.query.getEventTarget(t).style.zIndex=this.toTop?hs:this.#ye?ds:us}#Ee(t){if(this.#ze())return;const e=t.code;if(Nt.isCtrl(t)||!Nt.isNonResponseKey(e))return;const s=Ht.query.getEventTarget(t);if(Nt.isEsc(e)){if(this.#Se.some((({isOpen:t})=>t)))return}else{if(this.form.contains(s)||this.#Fe(s))return;if(this.#X.pluginManager.fileInfo.pluginRegExp.test(this.kind))return}this.#Pe(s),this.close()}#Te(t){const e=Ht.query.getEventTarget(t);this.host?._element?.contains(e)?this.#Ce=!0:(this.#Ce=!1,e===this.host._element||e===this.currentTarget||this.#ze()||this.form.contains(e)||this.#Fe(e)||Ht.query.getParentElement(e,".se-line-breaker-component")||(this.#Pe(e),this.close(!0)))}#Pe(t){this.#X.frameContext.get("wysiwyg").contains(t)||(this.#X.component.__prevent=!1)}},{_w:gs}=Et;const ms=class{#X;#De;#qe;#We;#Ue;#ve;#Ge=null;#Ze=null;#je=null;#xe=null;#Ke=null;#Ye=null;#tt=null;constructor(t,e){this.#X=t;const s=e.position.split("-");this.form=null,this.items=[],this.menus=null,this.menuLen=0,this.index=-1,this.item=null,this.isOpen=!1,this.checkList=!!e.checkList,this.position=s[0],this.subPosition=s[1],this.splitNum=e.splitNum||0,this.horizontal=!!this.splitNum,this.openMethod=e.openMethod,this.closeMethod=e.closeMethod,this.#De=/^(left|right)$/.test(this.position)?"left"===this.position?"right":"left":this.position,this.#qe=/^(left|right)$/.test(this.subPosition)?"left"===this.subPosition?"right":"left":this.subPosition,this.#We="ltr"!==e.dir&&("rtl"===e.dir||null),this.#Ue={mousedown:this.#Xe.bind(this),mousemove:this.#Je.bind(this),click:this.#Qe.bind(this),keydown:this.#ts.bind(this)},this.#ve={keydown:this.#es.bind(this),mousedown:this.#Te.bind(this),click:this.#ss.bind(this)}}create(t,e){this.form.firstElementChild.innerHTML="",e||=t;let s="";for(let t=0,i=e.length;t<i;t++)t>0&&t%this.splitNum==0&&(this.#is(s),s=""),s+=`<li class="se-select-item" data-index="${t}">${"string"==typeof e[t]?e[t]:e[t].outerHTML}</li>`;this.#is(s),this.items=t,this.menus=Array.from(this.form.querySelectorAll("li")),this.menuLen=this.menus.length}on(t,e,s={}){this.#Ge=t,this.#Ze=Ht.check.isInputElement(t)?t:this.#X.frameContext.get("_ww"),this.#je=e,this.form=Ht.utils.createElement("DIV",{class:"se-select-menu"+(s.class?" "+s.class:""),style:s.style||""},'<div class="se-list-inner"></div>'),t.parentNode.insertBefore(this.form,t)}open(t,e){this.#X.ui.selectMenuOn=!0,this.openMethod?.(),this.#ns(),this.#Ne();const s=t?t.split("-"):[],i=s[0]||(null!==this.#We&&this.#We!==this.#X.options.get("_rtl")?this.#De:this.position),n=s[1]||(null!==this.#We&&this.#We!==this.#X.options.get("_rtl")?this.#qe:this.subPosition);this.#os(i,n,e),this.isOpen=!0}close(){this.#X.ui.selectMenuOn=!1,Ht.utils.removeClass(this.#Ge,"on"),this.#ls(),this.form?.removeAttribute("style"),this.isOpen=!1,this.closeMethod?.()}getItem(t){return this.items[t]}setItem(t){this.#rs(t)}#is(t){this.form.firstElementChild.innerHTML+=`<ul class="se-list-basic se-list-checked${this.horizontal?" se-list-horizontal":""}">${t}</ul>`}#ls(){this.#as(),this.#Ve(),this.index=-1,this.item=null,this._onItem&&(Ht.utils.removeClass(this._onItem,"se-select-on"),this._onItem=null)}#cs(t){t=this.index+t;const e=this.menuLen,s=this.index=t>=e?0:t<0?e-1:t;this.#rs(s)}#rs(t){Ht.utils.removeClass(this.form,"se-select-menu-mouse-move");const e=this.menuLen;for(let s=0;s<e;s++)s===t?Ht.utils.addClass(this.menus[s],"active"):Ht.utils.removeClass(this.menus[s],"active");this.index=t,this.item=this.items[t]}#os(t,e,s,i){const n=t,o=this.form,l=this.#Ge;o.style.visibility="hidden",o.style.display="block",Ht.utils.removeClass(o,"se-select-menu-scroll"),Ht.utils.addClass(l,"on");const r=o.offsetWidth,a=l.offsetWidth,c=l.offsetLeft;let h=!1,d=0,u=0;"left"===t?(d=c-r-1,t=e,h=!0):"right"===t&&(d=c+a+1,t=e,h=!0);const p=this.#X.offset.get(l),g=l.offsetTop,m=p.top,f=l.offsetHeight,v=Ht.utils.getClientSize().h-(m-gs.scrollY+f),b=h?f:0;let y=1e4;switch(t){case"middle":{let t=o.offsetHeight;const e=f/2;u=g-t/2+e,m<t/2&&(u+=t/2-m-e+4,o.style.top=u+"px");let s=this.#X.offset.getGlobal(o).top;const i=t-(m-s)-v-f;i>0&&(u-=i+4,o.style.top=u+"px"),s=this.#X.offset.getGlobal(o).top,s<0&&(t+=s-4,u-=s-4),o.style.height=t+"px";break}case"top":if(m<o.offsetHeight-b){if(!i){y=0;break}y=m-4+b,y>=38&&(o.style.height=y+"px")}u=g-o.offsetHeight+b;break;case"bottom":if(v<o.offsetHeight+b){if(!i){y=0;break}y=v-4+b,y>=38&&(o.style.height=y+"px")}u=g+(h?0:f)}if(y<38&&!i&&"middle"!==t)return void this.#os("top"===t?"bottom":"top",e,s,!0);if(!h)switch(e){case"center":d=c+a/2-r/2;break;case"left":d=c;break;case"right":d=c-(r-a)}o.style.left=d+"px";const C=this.#X.offset.getGlobal(o).left;let w=0;switch(h+"-"+(h?n:e)){case"true-left":w=p.left-gs.scrollX+C,w<0&&(d=d=c+a+1);break;case"true-right":w=gs.innerWidth-(C+r),w<0&&(d=c-r-1);break;case"false-center":{w=gs.innerWidth-(C+r),w<0&&(d+=w-4),o.style.left=d+"px";const t=this.#X.offset.getGlobal(o).left;t<0&&(d-=t-4);break}case"false-left":w=gs.innerWidth-(p.left-gs.scrollX+r),w<0&&(d+=w-4);break;case"false-right":C<0&&(d-=C-4)}if(s){const t=o.firstElementChild.querySelector(s);t&&(this._onItem=t,Ht.utils.addClass(t,"se-select-on"))}o.style.left=d+"px",o.style.top=u+"px",o.style.visibility=""}#hs(t){this.checkList&&Ht.utils.toggleClass(this.menus[t],"se-checked"),this.#je(this.getItem(t))}#ns(){this.#as(),this.#tt=this.#Ue,this.form.addEventListener("mousedown",this.#tt.mousedown),this.form.addEventListener("mousemove",this.#tt.mousemove),this.form.addEventListener("click",this.#tt.click),this.#Ze.addEventListener("keydown",this.#tt.keydown)}#as(){this.#tt&&(this.form.removeEventListener("mousedown",this.#tt.mousedown),this.form.removeEventListener("mousemove",this.#tt.mousemove),this.form.removeEventListener("click",this.#tt.click),this.#Ze.removeEventListener("keydown",this.#tt.keydown),this.#tt=null)}#Ne(){this.#Ve(),this.#xe=this.#X.eventManager.addGlobalEvent("keydown",this.#ve.keydown,!0),this.#Ke=this.#X.eventManager.addGlobalEvent("mousedown",this.#ve.mousedown,!0)}#Ve(){this.#xe&&=this.#X.eventManager.removeGlobalEvent(this.#xe),this.#Ke&&=this.#X.eventManager.removeGlobalEvent(this.#Ke),this.#Ye&&=this.#X.eventManager.removeGlobalEvent(this.#Ye)}#ts(t){let e;switch(t.code){case"ArrowUp":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index-t<0?t:-t}else e=-1;break;case"ArrowDown":if(t.preventDefault(),t.stopPropagation(),this.horizontal&&this.index>-1){const t=this.splitNum;e=this.index+t>this.menuLen?-t:t}else e=1;break;case"ArrowLeft":t.preventDefault(),t.stopPropagation(),e=-1;break;case"ArrowRight":t.preventDefault(),t.stopPropagation(),e=1;break;case"Enter":case"Space":this.index>-1?(t.preventDefault(),t.stopPropagation(),this.#hs(this.index)):this.close()}e&&this.#cs(e)}#Xe(t){if(Et.isGecko){const e=Ht.query.getEventTarget(t),s=Ht.query.getParentElement(e,".se-select-item");s&&this.#X.eventManager._injectActiveEvent(s)}}#Je(t){const e=Ht.query.getEventTarget(t);Ht.utils.addClass(this.form,"se-select-menu-mouse-move");const s=e.getAttribute("data-index");s&&(this.index=Number(s))}#Qe(t){let e=Ht.query.getEventTarget(t),s=null;for(;!s&&!/UL/i.test(e.tagName)&&!Ht.utils.hasClass(e,"se-select-menu");)s=e.getAttribute("data-index"),e=e.parentElement;s&&this.#hs(Number(s))}#es(t){Nt.isEsc(t.code)&&this.close()}#Te(t){const e=Ht.query.getEventTarget(t);this.form.contains(e)||(t.target!==this.#Ge?this.close():Ht.check.isInputElement(e)||(this.#Ye=this.#X.eventManager.addGlobalEvent("click",this.#ve.click,!0)))}#ss(t){this.#Ye=this.#X.eventManager.removeGlobalEvent(this.#Ye),t.target===this.#Ge&&(t.stopPropagation(),this.close())}},{_w:fs,ON_OVER_COMPONENT:vs}=Et,bs={tl:"nwse-resize",tr:"nesw-resize",bl:"nesw-resize",br:"nwse-resize",lw:"ew-resize",th:"ns-resize",rw:"ew-resize",bh:"ns-resize"};let ys=!1,Cs=!1,ws=0,_s=0;class xs{#X;#ds;#us;#ps="";#gs="";#ms=0;#fs=0;#vs=0;#bs=0;#ys="__se__float-none|__se__float-left|__se__float-center|__se__float-right";#Cs=!1;#ws={w:"",h:""};#_s=null;constructor(t,e,s,i){this.#X=e,this.kind=t.constructor.key||t.constructor.name,this._alignIcons={none:this.#X.icons.format_float_none,left:this.#X.icons.format_float_left,right:this.#X.icons.format_float_right,center:this.#X.icons.format_float_center},this._action={};const n=function(t,e,s){let i=null;if(s?.length>0){const{lang:n,icons:o}=e;i='<div class="se-arrow se-arrow-up"></div>';for(let e,l=0;l<s.length;l++){e=s[l],i+='<div class="se-btn-group">';for(let s,l=0,r=e.length;l<r;l++){if(s=e[l],"function"==typeof s?.action){const e=s;s={c:`__c__${e.command}`,v:e.value||"",l:e.title,i:e.icon},t._action[s.c]=e.action}else if(s=ks(s),!s)continue;i+=`\n\t\t\t\t\t<button type="button" data-command="${s.c}" data-value="${s.v}" class="se-btn se-tooltip">\n\t\t\t\t\t\t${o[s.i]||s.i}\n\t\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${n[s.l]||s.l}</span></span>\n\t\t\t\t\t</button>`}i+="</div>"}}return i?Ht.utils.createElement("DIV",{class:"se-controller se-controller-resizing"},i):null}(this,e,s||[]);if(this.controller=n?new ps(this,e,n,{position:"bottom",disabled:!0},this.kind):null,n){this.alignButton=n.querySelector('[data-command="onalign"]');const t=function(t,e,s){if(!s)return null;const i=[t._alignIcons.none,t._alignIcons.left,t._alignIcons.center,t._alignIcons.right],n=[e.lang.basic,e.lang.left,e.lang.center,e.lang.right],o=["none","left","center","right"],l=[],r=[];for(let t=0;t<o.length;t++)l.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${o[t]}" data-type="selectMenu" >\n\t\t\t${i[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${n[t]}</span>\n\t\t\t</span>\n\t\t</button>`),r.push(o[t]);return{html:l,items:r}}(this,e,this.alignButton);t&&(this.selectMenu_align=new ms(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_align.on(this.alignButton,this.#xs.bind(this),{class:"se-figure-select-list"}),this.selectMenu_align.create(t.items,t.html)),this.asButton=n.querySelector('[data-command="onas"]');const s=function(t,e){if(!e)return null;const s=[t.icons.as_block,t.icons.as_inline],i=[t.lang.asBlock,t.lang.asInline],n=["block","inline"],o=[],l=[];for(let t=0;t<n.length;t++)o.push(`\n\t\t<button type="button" class="se-btn-list se-tooltip" data-command="${n[t]}" data-type="selectMenu" >\n\t\t\t${s[t]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${i[t]}</span>\n\t\t\t</span>\n\t\t</button>`),l.push(n[t]);return{html:o,items:l}}(e,this.asButton);s&&(this.selectMenu_as=new ms(e,{checkList:!1,position:"bottom-center"}),this.selectMenu_as.on(this.asButton,this.#$s.bind(this),{class:"se-figure-select-list"}),this.selectMenu_as.create(s.items,s.html)),this.resizeButton=n.querySelector('[data-command="onresize"]');const i=function(t,e){if(!e)return null;const s=e.getAttribute("data-value").split(","),i=[];for(let e,n,o,l,r=0;r<s.length;r++)o=s[r],e=Lt.is(o),n=e?"resize_percent"+o:"auto",l=e?o+"%":t.lang.autoSize,i.push('<button type="button" class="se-btn-list" data-command="'+n+'" data-value="'+o+'"><span>'+l+"</span></button>");return{html:i,items:s}}(e,this.resizeButton);i&&(this.selectMenu_resize=new ms(e,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.selectMenu_resize.on(this.resizeButton,this.#Ss.bind(this)),this.selectMenu_resize.create(i.items,i.html))}this.inst=t,this.sizeUnit=i.sizeUnit||"px",this.autoRatio=i.autoRatio,this.isVertical=!1,this.percentageButtons=n?.querySelectorAll('[data-command="resize_percent"]')||[],this.captionButton=n?.querySelector('[data-command="caption"]'),this.align="none",this.as="block",this.__offset={},this._element=null,this._cover=null,this._inlineCover=null,this._container=null,this._caption=null,this._resizeClientX=0,this._resizeClientY=0,this._resize_direction="",this.__containerResizingOff=this.#ks.bind(this),this.__containerResizing=this.#Es.bind(this),this.__onContainerEvent=null,this.__offContainerEvent=null,this.#ds=this.#Ts.bind(this),this.#us=this.#Ms.bind(this),this.#X.eventManager.addEvent(this.alignButton,"click",this.#Hs.bind(this)),this.#X.eventManager.addEvent(this.asButton,"click",this.#Ls.bind(this)),this.#X.eventManager.addEvent(this.resizeButton,"click",this.#Ns.bind(this)),this.#X.contextProvider.applyToRoots((t=>{if(!t.get("wrapper").querySelector(".se-controller.se-resizing-container")){const e=function(){const t='\n\t\t<div class="se-resize-dot">\n\t\t\t<span class="tl"></span>\n\t\t\t<span class="tr"></span>\n\t\t\t<span class="bl"></span>\n\t\t\t<span class="br"></span>\n\t\t\t<span class="lw"></span>\n\t\t\t<span class="th"></span>\n\t\t\t<span class="rw"></span>\n\t\t\t<span class="bh"></span>\n\t\t\t<div class="se-resize-display"></div>\n\t\t</div>';return Ht.utils.createElement("DIV",{class:"se-controller se-resizing-container",style:"display: none;"},t)}(),s=e.querySelectorAll(".se-resize-dot > span");t.set("_figure",{main:e,border:e.querySelector(".se-resize-dot"),display:e.querySelector(".se-resize-display"),handles:s}),t.get("wrapper").appendChild(e),this.#X.eventManager.addEvent(s,"mousedown",this.#As.bind(this))}}))}static CreateContainer(t,e){return Ht.utils.createElement("DIV",{class:"se-component"+(e?" "+e:"")},Ht.utils.createElement("FIGURE",null,t)),xs.GetContainer(t)}static CreateInlineContainer(t,e){return Ht.utils.createElement("SPAN",{class:"se-component se-inline-component"+(e?" "+e:"")},t),xs.GetContainer(t)}static CreateCaption(t,e){const s=Ht.utils.createElement("FIGCAPTION",null,"<div>"+e+"</div>");return t.appendChild(s),s}static GetContainer(t){const e=Ht.query.getParentElement(t,"FIGURE",2),s=Ht.query.getParentElement(t,"SPAN",2),i=e||s,n=Ht.query.getParentElement(t,(t=>t.parentElement===i),0)||t;return{target:n,container:Ht.query.getParentElement(n,xs.is,3)||e,cover:e,inlineCover:Ht.utils.hasClass(s,"se-inline-component")?s:null,caption:Ht.query.getEdgeChild(n.parentElement,"FIGCAPTION",!1),isVertical:Ss(n)}}static GetRatio(t,e,s){let i=0,n=0;if(/\d+/.test(t+"")&&/\d+/.test(e+"")){if((!Lt.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px")===(!Lt.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px")){const s=Lt.get(t,4),o=Lt.get(e,4);i=s/o,n=o/s}}return{w:Lt.get(i,4),h:Lt.get(n,4)}}static CalcRatio(t,e,s,i){if(i?.w&&i?.h&&/\d+/.test(t+"")&&/\d+/.test(e+"")){const n=!Lt.is(t)&&String(t).replace(/\d+|\./g,"")||s||"px",o=!Lt.is(e)&&String(e).replace(/\d+|\./g,"")||s||"px";if(n===o){const s="%"===n?2:0,l=t,r=e;e=Lt.get(i.h*Lt.get(l,s),s)+o,t=Lt.get(i.w*Lt.get(r,s),s)+n}}return{w:t,h:e}}static is(t){return Ht.check.isComponentContainer(t)||/^(HR)$/.test(t?.nodeName)}close(){this.#X.store.set("_preventBlur",!1),Ht.utils.removeClass(this._cover,"se-figure-selected"),this.#X.component.__removeDragEvent(),this.#Bs(),this.controller?.close()}open(t,{nonResizing:e,nonSizeInfo:s,nonBorder:i,figureTarget:n,infoOnly:o}){if(!t)return void console.warn('[SUNEDITOR.modules.Figure.open] The "targetNode" is null.');ns.get("__overInfo")===vs&&(i=!0);const l=xs.GetContainer(t),r=l.target;let a=!1;if(!l.container){if(this.#X.options.get("strictMode").formatFilter)return{container:null,cover:null,width:r.style.width||r.width||"",height:r.style.height||r.height||"",isVertical:this.isVertical};l.container=r,l.cover=r,a=!0}ns.set("__figureInst",this),this.#Is(l);const c=n&&(this._cover||this._container)||r,h=c.offsetWidth||null,d=c.offsetHeight||null,{top:u,left:p,scrollX:g,scrollY:m}=this.#X.offset.getLocal(c),f=(r.getAttribute("data-se-size")||"").split(",");let v=Lt.get(r.style.width,2)||h,b=Lt.get(r.style.height,2)||d;this.isVertical&&([v,b]=[b,v]);const y=xs.GetRatio(v,b,this.sizeUnit),C={container:l.container,cover:l.cover,caption:l.caption,align:this.align,ratio:y,isVertical:this.isVertical,w:h||"",h:d||"",t:u,l:p,width:f[0]||"auto",height:f[1]||"auto",originWidth:r.naturalWidth||r.offsetWidth,originHeight:r.naturalHeight||r.offsetHeight};if(this.#ps=C.width,this.#gs=C.height,o)return C;const w=this.#X.frameContext.get("_figure");this.#X.ui.setFigureContainer(w.main),this.#X.ui.opendControllers=this.#X.ui.opendControllers.filter((t=>t.form!==w.main)),w.main.style.top=u+"px",w.main.style.left=p+"px",w.main.style.width=(this.isVertical?d:h)+"px",w.main.style.height=(this.isVertical?h:d)+"px",w.border.style.top="0px",w.border.style.left="0px",w.border.style.width=(this.isVertical?d:h)+"px",w.border.style.height=(this.isVertical?h:d)+"px",this.__offset={left:p+g,top:u+m},this.#X.ui.opendControllers.push({position:"none",form:w.main,target:c,inst:this,notInCarrier:!0});const _=/%$/.test(r.style.width)&&/%$/.test(l.container.style.width)?Lt.get(l.container.style.width,0)/100+"":"";for(let t=0,e=this.percentageButtons.length;t<e;t++)this.percentageButtons[t].getAttribute("data-value")===_?Ht.utils.addClass(this.percentageButtons[t],"active"):Ht.utils.removeClass(this.percentageButtons[t],"active");if(this.captionButton&&(l.caption?Ht.utils.addClass(this.captionButton,"active"):Ht.utils.removeClass(this.captionButton,"active")),w.display.style.display=s||this._inlineCover?"none":"",w.border.style.display=i?"none":"",w.main.style.display="block",ns.get("__overInfo")!==vs){const t=e?"none":"flex",s=w.handles;for(let e=0,i=s.length;e<i;e++)s[e].style.display=t;if(this.controller){const t=this.getSize(r);Ht.utils.changeTxt(w.display,this.#X.lang["none"===this.align?"basic":this.align]+" ("+t.dw+", "+t.dh+")"),this.#Vs(),this.#Os(),this.#X.ui._visibleControllers(!0,!0);const e=this.controller.form.querySelectorAll('[data-command="rotate"][data-value="90"], [data-command="rotate"][data-value="-90"], [data-command="caption"], [data-command="onalign"], [data-command="onresize"]'),s=this._inlineCover||a?"none":"";e?.forEach((t=>{t.style.display=s}));const i=this.controller.form.querySelector('[data-command="onas"]');i&&(i.style.display=a?"none":"")}Ht.utils.removeClass(this._cover,"se-figure-over-selected"),this.controller?.open(w.main,null,{initMethod:this.#ds,isWWTarget:!1,addOffset:null}),fs.setTimeout((()=>ns.set("__overInfo",!1)),0)}else Ht.utils.addClass(this._cover,"se-figure-over-selected");return Ht.utils.addClass(this._cover,"se-figure-selected"),this.#vs=this.#ms=h,this.#bs=this.#fs=d,this._inlineCover||ns.get("__overInfo")===vs&&!Ht.utils.hasClass(l.container,"se-input-component")||this.#Rs(w.main),C}controllerHide(){this.controller?.hide()}controllerShow(){this.controller?.show()}controllerOpen(t,e){this._element=t,this.controller?.open(t,null,e)}setFigureSize(t,e){/%$/.test(t+"")?this._setPercentSize(t,e):t&&"auto"!==t||e&&"auto"!==e?this._applySize(t,e,""):this.autoRatio?this._setPercentSize(100,this.autoRatio.default||this.autoRatio.current):this._setAutoSize()}setSize(t,e){const s=this.isVertical;s&&([t,e]=[e,t]),this.setFigureSize(t,e),s&&this.setTransform(this._element,t,e,0)}getSize(t){t||=this._element;const e=Ss(t);let s="",i="",n="",o="";if(!t)return{w:s,h:i,dw:n,dh:o};const l=xs.GetContainer(t),r=l.target;return l.container?(s=/%$/.test(r.style.width)?(l.container&&Lt.get(l.container.style.width,2)||100)+"%":r.style.width,i=l.inlineCover?l.inlineCover.style.height||t.style.height||String(t.height||""):Lt.get(l.cover?.style.paddingBottom,0)>0&&!e?l.cover?.style.height:/%$/.test(r.style.height)&&/%$/.test(r.style.width)?(l.container&&Lt.get(l.container.style.height,2)||100)+"%":r.style.height,s||="auto",i||="auto"):this.#X.options.get("strictMode").formatFilter?(s="",i=r.style.height):(s=r.style.width||"auto",i=r.style.height||"auto"),n=e?i:s,o=e?s:i,{w:s,h:i,dw:n,dh:o}}setAlign(t,e){t||=this._element,this.align=e||="none";const s=xs.GetContainer(t);if(!s.cover)return;const i=s.target,n=s.container,o=s.cover;if(/%$/.test(i.style.width)&&"center"===e&&!this.#X.component.isInline(n)?(n.style.minWidth="100%",o.style.width=n.style.width):(n.style.minWidth="",o.style.width=this.isVertical?i.style.height||i.offsetHeight+"px":i.style.width&&"auto"!==i.style.width?i.style.width||"100%":""),Ht.utils.hasClass(n,"__se__float-"+e)||(Ht.utils.removeClass(n,this.#ys),Ht.utils.addClass(n,"__se__float-"+e)),this.autoRatio){const{w:t,h:e}=this.getSize(this._element);this.__setCoverPaddingBottom(t,e)}this.#Vs()}convertAsFormat(t,e){t||=this._element,this.as=e||"block";const{container:s,inlineCover:i,target:n}=xs.GetContainer(t),{w:o,h:l}=this.getSize(n),r=n.cloneNode(!1);switch(r.style.width="",r.style.height="",r.removeAttribute("width"),r.removeAttribute("height"),e){case"inline":{if(i)break;this.#X.component.deselect();const t=s.nextElementSibling,e=s.parentElement,n=xs.CreateInlineContainer(r);Ht.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#zs(n,o,l);const a=Ht.utils.createElement(this.#X.options.get("defaultLine"),null,n.container);e.insertBefore(a,t),Ht.utils.removeItem(s);break}case"block":{if(!i)break;this.#X.component.deselect(),this.#X.selection.setRange(s,0,s,1);const t=this.#X.html.remove(),e=this.#X.nodeTransform.split(t.container,t.offset,0);e?.previousElementSibling&&Ht.check.isZeroWidth(e.previousElementSibling)&&Ht.utils.removeItem(e.previousElementSibling);const n=xs.CreateContainer(r);Ht.utils.addClass(n.container,s.className.split(" ").filter((t=>"se-inline-component"!==t&&"se-figure-selected"!==t&&"se-component-selected"!==t)).join("|")),this.#zs(n,o,l),(e||t.container).parentElement.insertBefore(n.container,e);break}}return r}controllerAction(t){const e=t.getAttribute("data-command"),s=t.getAttribute("data-value"),i=t.getAttribute("data-type"),n=this._element;if(!/^on.+/.test(e)&&"selectMenu"!==i){switch(e){case"mirror":{const t=$s(n);let e=t.x,i=t.y;"h"===s&&!this.isVertical||"v"===s&&this.isVertical?i=i?"":"180":e=e?"":"180",this._setRotate(n,t.r,e,i);break}case"rotate":this.setTransform(n,null,null,Number(s));break;case"caption":if(this._caption)Ht.utils.removeItem(this._caption),fs.setTimeout(this.#X.component.select.bind(this.#X.component,n,this.kind),0),this._caption=null;else{const t=xs.CreateCaption(this._cover,this.#X.lang.caption),e=Ht.query.getEdgeChild(t,(t=>3===t.nodeType),!1);e?this.#X.selection.setRange(e,0,e,e.textContent.length):t.focus(),this._caption=t,this.controller.close()}(/\d+/.test(n.style.height)||this.isVertical&&this._caption)&&(/%$/.test(n.style.width)||/auto/.test(n.style.height)?this.deleteTransform():this.setTransform(n,n.style.width,n.style.height,0));break;case"revert":this._setRevert();break;case"edit":this.inst.componentEdit(n);break;case"copy":this.#X.component.copy(this._container);break;case"remove":this.inst.componentDestroy(n),this.controller.close()}/^__c__/.test(e)?this._action[e](n,s,t):"edit"!==e&&(this.#X.history.push(!1),/^remove|caption$/.test(e)||this.#X.component.select(n,this.kind))}}retainFigureFormat(t,e,s,i){const n=this.#X.component.isInline(t),o=e.parentNode;let l=this.#X.format.isBlock(o)||Ht.check.isWysiwygFrame(o)?e:xs.GetContainer(e)?.container||o||e;if(Ht.query.getParentElement(e,Ht.check.isExcludeFormat))l=s&&s!==e?s:e,l.parentNode.replaceChild(t,l);else if(n&&this.#X.format.isLine(l)){const s=n&&/^SPAN$/i.test(e.parentElement.nodeName)?e.parentElement:e;s.parentElement.replaceChild(t,s)}else if(Ht.check.isListCell(l)){const s=Ht.query.getParentElement(e,(t=>t.parentNode===l));l.insertBefore(t,s),Ht.utils.removeItem(e),this.#X.nodeTransform.removeEmptyNode(s,null,!0)}else if(this.#X.format.isLine(l)){const s=Ht.query.getParentElement(e,(t=>t.parentNode===l));l=this.#X.nodeTransform.split(l,s),l.parentNode.insertBefore(t,l),Ht.utils.removeItem(e),this.#X.nodeTransform.removeEmptyNode(l,null,!0)}else if(this.#X.format.isLine(l.parentNode)){const e=l.parentNode;e.parentNode.insertBefore(t,l.previousSibling?e.nextElementSibling:e),(0===i?.__updateTags.map((t=>l.contains(t))).length||Ht.check.isZeroWidth(l))&&Ht.utils.removeItem(l)}else l=Ht.check.isFigure(l.parentNode)?Ht.query.getParentElement(l.parentNode,xs.is):l,l.parentNode.replaceChild(t,l)}deleteTransform(t){t||=this._element;const e=t,s=(e.getAttribute("data-se-size")||"").split(",");this.isVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",this.#Fs(e),this._applySize(s[0]||"auto",s[1]||"","")}setTransform(t,e,s,i){try{this.#Cs=!0;const n=$s(t),o=n.r+1*(i||0);i=Math.abs(o)>=360?0:o;const l=this.isVertical=Ss(i);e=Lt.get(e,0),s=Lt.get(s,0);const r=t,a=(r.getAttribute("data-se-size")||"auto,auto").split(",");l&&this._setRotate(r,i,n.x,n.y);let c="";if(/auto|%$/.test(a[0])&&!l)"auto"===a[0]&&"auto"===a[1]?this._setAutoSize():this._setPercentSize(a[0],a[1]);else{const t=xs.GetContainer(r),n=t.cover||t.inlineCover,o=e||r.offsetWidth,a=s||r.offsetHeight,h=(l?a:o)+"px",d=(l?o:a)+"px";if(this.#Ps(),this._applySize(o+"px",a+"px",""),n&&(n.style.width=h,n.style.height=t.caption||t.inlineCover?"":d),l){c=90===i||-270===i?a/2+"px "+a/2+"px 0":o/2+"px "+o/2+"px 0"}}r.style.transformOrigin=c,l||this._setRotate(r,i,n.x,n.y),r.style.maxWidth=l?"none":"",this.#Ds(r)}finally{this.#Cs=!1}}_displayResizeHandles(t){const e=t?"flex":"none";this.controller&&(this.controller.form.style.display=e);const s=this.#X.frameContext.get("_figure"),i=s.handles;for(let t=0,s=i.length;t<s;t++)i[t].style.display=e;"none"===e?(Ht.utils.addClass(s.main,"se-resize-ing"),this.#_s=this.#X.eventManager.addGlobalEvent("keydown",this.#us)):Ht.utils.removeClass(s.main,"se-resize-ing")}#zs(t,e,s){const i=this.kind;t.target.onload=()=>this.#X.component.select(t.target,i),this.#Is(t),t.inlineCover&&(this.setAlign(t.target,"none"),this.deleteTransform()),this.setFigureSize(e,s)}#Is(t){this._inlineCover=t.inlineCover,this._cover=t.cover||this._inlineCover,this._container=t.container,this._caption=t.caption,this._element=t.target,this.align=(this._container.className.match(/(?:^|\s)__se__float-(none|left|center|right)(?:$|\s)/)||[])[1]||t.target.style.float||"none",this.as=this._inlineCover?"inline":"block",this.isVertical=Ss(t.target)}_setRotate(t,e,s,i){let n=(t.offsetWidth-t.offsetHeight)*(/^-/.test(e+"")?1:-1),o="";if(/[1-9]/.test(e+"")&&(s||i))switch(o=s?"Y":"X",e+""){case"90":o=s&&i?"X":i?o:"";break;case"270":n*=-1,o=s&&i?"Y":s?o:"";break;case"-90":o=s&&i?"Y":s?o:"";break;case"-270":n*=-1,o=s&&i?"X":i?o:"";break;default:o=""}e%180==0&&(t.style.maxWidth=""),t.style.transform="rotate("+e+"deg)"+(s?" rotateX("+s+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+n+"px)":"")}_applySize(t,e,s){const i=/^(rw|lw)$/.test(s)&&/\d+/.test(this._element.style.height),n=/^(th|bh)$/.test(s)&&/\d+/.test(this._element.style.width);e=e||(this.autoRatio?this.autoRatio.current||this.autoRatio.default:e),t=Lt.is(t)?t+this.sizeUnit:t,/%$/.test(t)||/%$/.test(e)||i||n||this.#Ps();const o=this._cover||this._element;this.autoRatio&&this._cover&&(this._cover.style.width=t),n||(o.style.width=this._element.style.width=t),i||(e=Lt.is(e)?e+this.sizeUnit:e,o.style.height=this._element.style.height=this.autoRatio&&!this.isVertical?"100%":e,this.autoRatio&&this._cover&&(this._cover.style.height=e,this.__setCoverPaddingBottom(t,e))),"center"===this.align&&this.setAlign(this._element,this.align),this.#qs()}__setCoverPaddingBottom(t,e){this._inlineCover!==this._cover&&(this.isVertical&&([t,e]=[e,t]),this._cover.style.height=e,/%$/.test(t)&&"center"===this.align?this._cover.style.paddingBottom=/%$/.test(e)?Lt.get(Lt.get(e,2)/100*Lt.get(t,2),2)+"%":e:this._cover.style.paddingBottom=e)}_setAutoSize(){this._caption&&(this._caption.style.marginTop=""),this.deleteTransform(),this.#Ps(),this.autoRatio?this._setPercentSize("100%",this.autoRatio.current||this.autoRatio.default):(this._element.style.maxWidth="",this._element.style.width="",this._element.style.height="",this._cover&&(this._cover.style.width="",this._cover.style.height="")),this.setAlign(this._element,this.align),this.#qs()}_setPercentSize(t,e){e||=this.autoRatio?/%$/.test(this.autoRatio.current)?this.autoRatio.current:this.autoRatio.default:e,e=!e||/%$/.test(e+"")||Lt.get(e,0)?Lt.is(e)?e+this.sizeUnit:e||(this.autoRatio?this.autoRatio.default:""):Lt.is(e)?e+"%":e;const s=/%$/.test(e+"");this._container.style.width=String(Lt.is(t)?t+"%":t),this._container.style.height="",this._element!==this._cover||this.#X.options.get("strictMode").formatFilter?(this._inlineCover!==this._cover&&this._cover&&(this._cover.style.width="100%",this._cover.style.height=String(e)),this._element.style.width="100%",this._element.style.maxWidth="",this._element.style.height=String(this.autoRatio?"100%":s?"":e),"center"===this.align&&this.setAlign(this._element,this.align),this.autoRatio&&this.__setCoverPaddingBottom(String(t),String(e)),this.#Ds(this._element),this.#qs()):this.#qs()}#Ps(){this._cover&&(this._cover.style.width="",this._cover.style.height=""),this._container.style.width="",this._container.style.height="",Ht.utils.removeClass(this._container,this.#ys),Ht.utils.addClass(this._container,"__se__float-"+this.align),"center"===this.align&&this.setAlign(this._element,this.align)}_setRevert(){this.setFigureSize(this.#ws.w,this.#ws.h)}#Vs(){this.alignButton&&Ht.utils.changeElement(this.alignButton.firstElementChild,this._alignIcons[this.align])}#Os(){this.asButton&&Ht.utils.changeElement(this.asButton.firstElementChild,this.#X.icons[`as_${this.as}`])}#qs(){if(this.#Cs)return;const t=(this._element.getAttribute("data-se-size")||",").split(",");this.#ws.w=t[0],this.#ws.h=t[1];const e=this.getSize(this._element);this._element.setAttribute("width",e.w.replace("px","")),this._element.setAttribute("height",e.h.replace("px","")),this._element.setAttribute("data-se-size",e.w+","+e.h),this.autoRatio&&(this.autoRatio.current=/%$/.test(e.h)?e.h:"")}#Ds(t){const e=Ht.query.getEdgeChild(Ht.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop=(this.isVertical&&!this.autoRatio?t.offsetWidth-t.offsetHeight:0)+"px",this.isVertical&&this.autoRatio?t.style.marginTop=e.offsetHeight+"px":t.style.marginTop="")}#Fs(t){const e=Ht.query.getEdgeChild(Ht.query.getParentElement(t,"FIGURE"),"FIGCAPTION",!1);e&&(e.style.marginTop="")}#Ws(){this.#X.component.__removeDragEvent(),this.#Bs(),this._displayResizeHandles(!0),this.#X.ui.offCurrentController(),this.#X.ui.disableBackWrapper()}#Bs(){this.#X.eventManager.removeGlobalEvent(this.__onContainerEvent),this.#X.eventManager.removeGlobalEvent(this.__offContainerEvent),this.#X.eventManager.removeGlobalEvent(this.#_s)}#Rs(t){const e=this.#X.frameContext.get("wrapper").querySelector(".se-drag-handle");Ht.utils.removeClass(e,"se-drag-handle-full"),e.style.opacity="",e.style.width="",e.style.height="",ns.set("__dragHandler",e),ns.set("__dragContainer",this._container),ns.set("__dragCover",this._cover),ns.set("__dragMove",this.#Us.bind(this,e,t)),ns.get("__dragMove")(),e.style.display="block"}#Us(t,e){t.style.display="block",t.style.left=e.offsetLeft+(this.#X.options.get("_rtl")?t.offsetWidth:e.offsetWidth-1.5*t.offsetWidth)+"px",t.style.top=e.offsetTop-t.offsetHeight+.5+"px"}#As(t){t.stopPropagation(),t.preventDefault();const e=ns.get("__figureInst");if(!e)return;const s=Ht.query.getEventTarget(t),i=e._resize_direction=s.classList[0];e._resizeClientX=t.clientX,e._resizeClientY=t.clientY,this.#X.frameContext.get("_figure").main.style.float=/l/.test(i)?"right":/r/.test(i)?"left":"none",this.#X.ui.enableBackWrapper(bs[i]);const{w:n,h:o,dw:l,dh:r}=this.getSize(e._element);if(ys=Cs=!1,ws=_s=0,!this.isVertical){const t=!n||/auto|%$/.test(n),s=!o||/auto|%$/.test(o);if("tl|bl|tr|br".includes(i)&&t&&s?ys=!0:"lw|rw".includes(i)&&t&&(Cs=!0),ys||Cs){const t=e._cover||e._element;_s=t.offsetWidth,ws=Mt.getWidthInPercentage(t,this.#X.frameContext.get("wysiwygFrame"))/100}}e.__onContainerEvent=this.#X.eventManager.addGlobalEvent("mousemove",e.__containerResizing),e.__offContainerEvent=this.#X.eventManager.addGlobalEvent("mouseup",e.__containerResizingOff),e._displayResizeHandles(!1);const a=this.#X.frameContext.get("_figure").display;a.style.display="block",Ht.utils.changeTxt(a,l+" * "+r)}#Es(t){const e=this._resize_direction,s=t.clientX,i=t.clientY,n=this.isVertical;let o=n?this.#bs:this.#vs,l=n?this.#vs:this.#bs;const r=o+(/r/.test(e)?s-this._resizeClientX:this._resizeClientX-s),a=l+(/b/.test(e)?i-this._resizeClientY:this._resizeClientY-i),c=l/o*r,h=this.#X.frameContext.get("_figure").border;/t/.test(e)&&(h.style.top=l-(/h/.test(e)?a:c)+"px"),/l/.test(e)&&(h.style.left=o-r+"px"),/r|l/.test(e)&&(h.style.width=r+"px",o=r),/^(t|b)[^h]$/.test(e)?(h.style.height=c+"px",l=c):/^(t|b)h$/.test(e)&&(h.style.height=a+"px",l=a);const d=!n&&/h$/.test(e)?this.#ps:Math.round(o),u=!n&&/w$/.test(e)?this.#gs:Math.round(l),p=ws?d/_s*ws*100:d;Ht.utils.changeTxt(this.#X.frameContext.get("_figure").display,ws?Lt.get(p>100?100:p,2).toFixed(2)+"%":p+" * "+u),this.#ms=d,this.#fs=u}#ks(){this.#Ws();let t=this.isVertical?this.#fs:this.#ms,e=this.isVertical?this.#ms:this.#fs;if(t=Math.round(t)||t,e=Math.round(e)||e,!this.isVertical&&!/%$/.test(t+"")){const s=this.#X.frameContext.get("wysiwygFrame").clientWidth-Lt.get(this.#X.frameContext.get("wwComputedStyle").getPropertyValue("padding-left"))+Lt.get(this.#X.frameContext.get("wwComputedStyle").getPropertyValue("padding-right"))-2;Lt.get(t,0)>s&&(e=Math.round(e/t*s),t=s)}if(ys||Cs){t=t/(this._cover||this._element).offsetWidth*ws*100;const e=Lt.get(t>100?100:t,2)+"%";this._setPercentSize(e,Cs?this.getSize(this._element).h:"")}else this._applySize(t,e,this._resize_direction),this.isVertical&&this.setTransform(this._element,t,e,0);this.#X.history.push(!1),this.#X.component.select(this._element,this.kind)}#Ms(t){Nt.isEsc(t.code)&&(this.#Ws(),this.#X.component.select(this._element,this.kind))}#xs(t){this.setAlign(this._element,t),this.selectMenu_align.close(),this.#X.component.select(this._element,this.kind)}#$s(t){this.convertAsFormat(this._element,t),this.selectMenu_as.close()}#Ss(t){if("auto"===t)this.deleteTransform(),this._setAutoSize();else{let e=this.getSize(this._element).h;if(this.isVertical){const t=(this._element.getAttribute("data-se-size")||",").split(",");t[1]&&(e=t[1])}this.deleteTransform(),this._setPercentSize(1*t,null!==Lt.get(e,0)&&/%$/.test(e)?e:"")}this.selectMenu_resize.close(),this.#X.component.select(this._element,this.kind)}#Ts(){const t=this.#X.frameContext.get("_figure");t.main.style.display="none",this.#X.ui.setFigureContainer(null),this.#X.ui.opendControllers=this.#X.ui.opendControllers.filter((e=>e.form!==t.main))}#Hs(){this.selectMenu_align.open("",'[data-command="'+this.align+'"]')}#Ls(){this.selectMenu_as.open("",'[data-command="'+this.as+'"]')}#Ns(){const t=this.getSize(this._element),e=t.w,s=t.h;let i="";if(this.autoRatio){if(s===this.autoRatio.default&&/%$/.test(e)){const t=Lt.get(e);i=100===t?"auto":"resize_percent"+t}}else"auto"===s&&("auto"===e?i="auto":/%$/.test(e)&&(i="resize_percent"+Lt.get(e)));this.selectMenu_resize.open("",'[data-command="'+i+'"]')}}function $s(t){const e=t.style.transform;return e?{r:Number((e.match(/rotate\(([-0-9]+)deg\)/)||[])[1]||0),x:(e.match(/rotateX\(([-0-9]+)deg\)/)||[])[1]||"",y:(e.match(/rotateY\(([-0-9]+)deg\)/)||[])[1]||""}:{r:0,x:"",y:""}}function Ss(t){return/^(90|270)$/.test(Math.abs(Lt.is(t)?t:$s(t).r).toString())}function ks(t){const e=t.split("_"),s=e[0],i=e[1];let n,o,l,r;switch(s){case"resize":n="onresize",o=i,l="resize",r="resize";break;case"auto":n="auto",l="autoSize",r="auto_size";break;case"rotate":n="rotate",o="l"===i?-90:"r"===i?90:Lt.get(i),l=o<0?"rotateLeft":"rotateRight",r=o<0?"rotate_left":"rotate_right";break;case"mirror":n="mirror",o=i,l="h"===i?"mirrorHorizontal":"mirrorVertical",r="h"===i?"mirror_horizontal":"mirror_vertical";break;case"align":n="onalign",l="align",r="align_justify";break;case"caption":n="caption",l="caption",r="caption";break;case"revert":n="revert",l="revert",r="revert";break;case"edit":n="edit",l="edit",r="edit";break;case"as":n="onas",l="blockStyle",r="as_block";break;case"copy":n="copy",l="copy",r="copy";break;case"remove":n="remove",l="remove",r="delete"}return n?{c:n,v:o,l,t:undefined,i:r}:null}const Es=xs,{_w:Ts,ON_OVER_COMPONENT:Ms,isMobile:Hs}=Et,Ls=/^Arrow(Left|Up|Right|Down)$/,Ns=/^Arrow(Left|Up)$/;function As(t,e,s){t.preventDefault(),t.stopPropagation(),Bs(e),s.setData("text/html",e.outerHTML)}function Bs(t){Ht.utils.removeClass(t,"se-component-selected"),Ht.utils.removeClass(t.querySelectorAll(".se-figure-selected"),"se-figure-selected"),Ht.utils.removeClass(t.querySelectorAll(".se-selected-table-cell"),"se-selected-table-cell"),Ht.utils.removeClass(t.querySelector(".se-selected-cell-focus"),"se-selected-cell-focus")}const Is=class{#F;#X;#t;#Gs;#st;#it;#K;#Zs;#js;#Ks=null;#Ys=null;#Xs=null;#Ke=null;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Gs=this.#X.contextProvider,this.#st=this.#Gs.carrierWrapper,this.#it=this.#X.options,this.#K=this.#X.frameContext,this.#Zs=this.#X.eventManager,this.info=null,this.isSelected=!1,this.currentTarget=null,this.currentPlugin=null,this.currentPluginName="",this.currentInfo=null,this.#js={copy:this.#Js.bind(this),cut:this.#Qs.bind(this),keydown:this.#ti.bind(this),mousedown:this.#Te.bind(this)},this.__selectionSelected=!1,this.__prevent=!1}_init(){this.#Gs.applyToRoots((t=>{const e=Ht.utils.createElement("DIV",{class:"se-drag-handle",draggable:"true"},this.#Gs.icons.selection);t.get("wrapper").appendChild(e),this.#Zs.addEvent(e,"mouseenter",this.#ei.bind(this)),this.#Zs.addEvent(e,"mouseleave",this.#si.bind(this)),this.#Zs.addEvent(e,"dragstart",this.#ii.bind(this)),this.#Zs.addEvent(e,"dragend",this.#ni.bind(this)),this.#Zs.addEvent(e,"click",this.#oi.bind(this))}))}insert(t,{skipCharCount:e=!1,skipHistory:s=!1,scrollTo:i=!0,insertBehavior:n}={}){if(this.#K.get("isReadOnly")||!e&&!this.#X.char.check(t))return null;void 0===n&&(n=this.#it.get("componentInsertBehavior"));const o=this.#X.html.remove(),l=this.isInline(t);this.#X.selection.getRangeAndAddLine(this.#X.selection.getRange(),o.container);const r=this.#X.selection.getNode();let a=null,c=this.#X.format.getLine(r,null);try{if(Ht.check.isListCell(c))this.#X.html.insertNode(t,{afterNode:l?null:Ht.check.isZeroWidth(r)?(r||o.container||{}).nextSibling:null,skipCharCount:!0}),l||t.nextSibling||t.parentNode.appendChild(Ht.utils.createElement("BR"));else{if(!l&&this.#X.selection.getRange().collapsed&&(3===o.container?.nodeType||Ht.check.isBreak(o.container))){const t=Ht.query.getParentElement(o.container,this.#X.format.isBlock.bind(this.#X.format));a=this.#X.nodeTransform.split(o.container,o.offset,t?Ht.query.getNodeDepth(t)+1:0),a&&(c=a.previousSibling)}this.#X.html.insertNode(t,{afterNode:l||this.#X.format.isBlock(c)?null:c,skipCharCount:!0}),!l&&c&&Ht.check.isZeroWidth(c)&&Ht.utils.removeItem(c)}if(l){const e=Ht.utils.createTextNode(Tt.zeroWidthSpace);t.parentNode.insertBefore(e,t.nextSibling)}}catch(t){console.error("Component insert error:",t)}s||this.#X.history.push(!1),this.#K.has("documentType_use_header")&&this.#K.get("documentType").reHeader();const h=a||t;return i&&this.#X.selection.scrollTo(h,{behavior:"auto"}),null!==n&&this.applyInsertBehavior(t,a,n),h}applyInsertBehavior(t,e,s){const i=this.get(t);if(this.isInline(t)){const e=this.#X.selection.getNearRange(t);e?this.#X.selection.setRange(e.container,e.offset,e.container,e.offset):this.select(i.target,i.pluginName)}else switch(s){case"auto":this.#li(t)||this.select(i.target,i.pluginName);break;case"select":this.#X.selection.setRange(t,0,t,0),i?this.select(i.target,i.pluginName):e&&(e=Ht.query.getEdgeChildNodes(e,null).sc||e,this.#X.selection.setRange(e,0,e,0));break;case"line":if(!this.#li(t)){const e=this.#X.format.addLine(t,null);e&&this.#X.selection.setRange(e,0,e,0)}}}get(t){if(!t)return null;let e,s="",i={},n=!1,o=null;if(this.is(t)){if(Ht.check.isComponentContainer(t)&&!Ht.utils.hasClass(t,"se-inline-component")&&(t=t.firstElementChild||t),/^FIGURE$/i.test(t.nodeName)&&(t=t.firstElementChild),!t)return null;const n=this.#X.pluginManager.findComponentInfo(t);if(!n)return null;e=n.target,s=n.pluginName,i=n.options,o=n.launcher}if(!e&&t.nodeName){this.#ri(t)&&(n=!0);const l=this.#X.pluginManager.findComponentInfo(t);if(!l)return null;e=l.target,s=l.pluginName,i=l.options,o=l.launcher}if(!e)return null;const l=Es.GetContainer(e),r=l.container||l.cover||e;return this.info={target:l.target,pluginName:s,options:i,container:r,cover:l.cover,inlineCover:l.inlineCover,caption:l.caption,isFile:n,launcher:o,isInputType:Ht.utils.hasClass(r,"se-input-component")}}select(t,e,{isInput:s=!1}={}){const i=this.get(t);if(!i||Ht.check.isUneditable(Ht.query.getParentElement(t,this.is.bind(this)))||Ht.check.isUneditable(t))return!1;const n=i.launcher||this.#X.plugins[e];if(!n)return;const o=os.get("__overInfo")!==Ms;if(!s&&o){if(this.#t.get("_mousedown"))return;this.#t.set("_preventBlur",!0),this.__selectionSelected=!0,this.isInline(i.container)&&this.#X.selection.setRange(i.container,0,i.container,0),this.#X.focusManager.blur(),Ts.setTimeout((()=>{this.__selectionSelected=!1}))}let l;this.isSelected=!0,this.__prevent=!0,"function"==typeof n.componentSelect&&(l=n.componentSelect(t));const r=Ht.utils.hasClass(i.target,"se-component-line-break");(r||!l&&!Ht.utils.hasClass(i.container,"se-inline-component"))&&this._setComponentLineBreaker(i.container||i.cover||t),this.currentTarget=t,this.currentPlugin=n,this.currentPluginName=e,this.currentInfo=i,os.set("__dragInst",this);const a=os.get("__overInfo");if(Ts.setTimeout((()=>{os.set("__overInfo",a===Ms&&void 0),a!==Ms&&this.#Ne(),i.isFile||this.#ai()}),0),Mt.debounce((()=>{Ht.utils.addClass(i.container,"se-component-selected")}),0)(),!o||this.#t.get("hasFocus")||this.#t.get("_preventFocus")||(this.#F._eventOrchestrator.__postFocusEvent(this.#K,null),this.#t.set("_preventFocus",!0)),r||a===Ms){if(r||!Ht.utils.hasClass(i.container,"se-input-component")){const t=this.#K.get("wrapper").querySelector(".se-drag-handle");Ht.utils.addClass(t,"se-drag-handle-full"),this.#X.ui._visibleControllers(!1,!1);const e=i.caption?i.target:i.cover||i.container||i.target,s=e.offsetWidth,n=e.offsetHeight,{top:o,left:l}=this.#X.offset.getLocal(e);t.style.opacity="0",t.style.width=s+"px",t.style.height=n+"px",t.style.top=o+"px",t.style.left=l+"px",os.set("__dragHandler",t),os.set("__dragContainer",i.container),os.set("__dragCover",i.cover),t.style.display="block"}}else{if(!this.isInline(i.container))return;const t=i.container;let e=null;t.previousSibling&&!Ht.check.isBreak(t.previousSibling)||(e=Ht.utils.createTextNode(Tt.zeroWidthSpace),t.parentNode.insertBefore(e,t)),t.nextSibling&&!Ht.check.isBreak(t.nextSibling)||(e=Ht.utils.createTextNode(Tt.zeroWidthSpace),t.parentNode.insertBefore(e,t.nextSibling)),this.#t.set("controlActive",!0)}}deselect(){Ts.setTimeout((()=>{this.#t.set("controlActive",!1)}),0),this.__deselect(),this.#X.ui.setControllerOnDisabledButtons(!1),!this.#t.get("_preventFocus")||this.#t.get("hasFocus")||this.__prevent||(this.#F._eventOrchestrator.__postBlurEvent(this.#K,null),this.#t.set("_preventFocus",!1))}is(t){return!!t&&(!(!/^FIGURE$/i.test(t.nodeName)&&!Ht.check.isComponentContainer(t))||!!this.#X.pluginManager.findComponentInfo(t))}isInline(t){if(!t)return!1;if(/^FIGURE$/i.test(t.nodeName)&&(t=t.parentElement),Ht.utils.hasClass(t,"se-inline-component"))return!0;return!(!this.#X.pluginManager.findComponentInfo(t)||!Ht.utils.hasClass(t,"se-inline-component")&&!Ht.utils.hasClass(t.parentElement,"se-inline-component"))}isBasic(t){return this.is(t)&&!this.isInline(t)}async copy(t){const e=Ht.utils.clone(t,!0);Bs(e),!1!==await this.#X.html.copy(e)&&Ht.utils.flashClass(t,"se-copy")}hoverSelect(t){const e=Ht.query.getParentElement(t,Ht.check.isFigure);let s=this.get(t);s||e?(s||=this.get(e),s&&!Ht.utils.hasClass(s.container,"se-component-selected")&&(this.#X.ui.offCurrentController(),os.set("__overInfo",Ms),this.select(s.target,s.pluginName))):null===os.get("__overInfo")||Ht.utils.hasClass(t,"se-drag-handle")||(this.__deselect(),os.set("__overInfo",null))}__deselect(){if(this.#t.set("_preventBlur",!1),os.set("__overInfo",null),this.__removeDragEvent(),this.currentInfo){const t=this.currentInfo.container,e=this.currentInfo.cover;Mt.debounce((()=>{Bs(t),Ht.utils.removeClass(e,"se-figure-over-selected")}),0)()}this.#K.get("lineBreaker_t")&&(this.#K.get("lineBreaker_t").style.display=this.#K.get("lineBreaker_b").style.display="none"),this.currentPlugin&&this.currentPlugin.componentDeselect?.(this.currentTarget),this.isSelected=!1,this.currentPlugin=null,this.currentTarget=null,this.currentPluginName="",this.currentInfo=null,this.__removeGlobalEvent(),this.#X.ui._offControllers()}_setComponentLineBreaker(t){const e=os.get("__overInfo")===Ms;this.#F._eventOrchestrator._lineBreakComp=null;const s=this.get(t);if(!s)return;const i=this.#K,n=s.container,o=Ht.utils.hasClass(n,"se-flex-component"),l=i.get("lineBreaker_t"),r=i.get("lineBreaker_b"),a=l.style,c=r.style,h=n.offsetWidth<t.offsetWidth?n:t,d=this.#X.ui.getVisibleFigure()||h,u=Ht.check.isListCell(n.parentNode);let p,g;const m=this.#it.get("_rtl"),f=m?["right","left"]:["left","right"],{top:v,left:b,right:y,scrollX:C,scrollY:w}=this.#X.offset.getLocal(h),_=m?y:b;if(u?!Ht.check.isBreak(n.previousElementSibling)&&!n.previousSibling?.textContent?.trim()||this.is(n.previousElementSibling):!this.#X.format.isLine(n.previousElementSibling)){const t=Ts.getComputedStyle(l),s=Lt.get(t.height,1),i=Lt.get(t.width,1);this.#F._eventOrchestrator._lineBreakComp=n,p=v,g=d.offsetWidth/2/2,a.top=p-s/2+"px",a[f[0]]=(o?_-i/2:_+g)+"px",a[f[1]]="",l.setAttribute("data-offset",w+","+C),e?Ht.utils.removeClass(l,"se-on-selected"):Ht.utils.addClass(l,"se-on-selected"),a.display="block",a.visibility=""}else a.display="none";if(u?!Ht.check.isBreak(n.nextElementSibling)&&!n.nextSibling?.textContent?.trim()||this.is(n.nextElementSibling):!this.#X.format.isLine(n.nextElementSibling)){const t=Ts.getComputedStyle(r),s=Lt.get(t.height,1),i=Lt.get(t.width,1);p||(this.#F._eventOrchestrator._lineBreakComp=n,p=v,g=d.offsetWidth/2/2),c.top=p+d.offsetHeight-s/2+"px",c[f[0]]=_+d.offsetWidth-(o?0:g)-(o?i/2:i)+"px",c[f[1]]="",r.setAttribute("data-offset",w+","+f[0]+","+C),e?Ht.utils.removeClass(r,"se-on-selected"):Ht.utils.addClass(r,"se-on-selected"),c.display="block",c.visibility=""}else c.display="none"}__removeGlobalEvent(){this.#ci(),this.#Ks&&=this.#Zs.removeGlobalEvent(this.#Ks),this.#Ys&&=this.#Zs.removeGlobalEvent(this.#Ys),this.#Xs&&=this.#Zs.removeGlobalEvent(this.#Xs)}__removeDragEvent(){this.#st.querySelector(".se-drag-cursor").style.left="-10000px",os.get("__dragHandler")&&(os.get("__dragHandler").style.display="none"),Ht.utils.removeClass([os.get("__dragHandler"),os.get("__dragContainer")],"se-dragging"),Ht.utils.removeClass([os.get("__dragCover"),os.get("__dragContainer")],"se-drag-over"),os.set("__figureInst",null),os.set("__dragInst",null),os.set("__dragHandler",null),os.set("__dragContainer",null),os.set("__dragCover",null),os.set("__dragMove",null),os.set("__overInfo",null)}#Ne(){this.__removeGlobalEvent(),this.#Ks=this.#Zs.addGlobalEvent("copy",this.#js.copy),this.#Ys=this.#Zs.addGlobalEvent("cut",this.#js.cut),this.#Xs=this.#Zs.addGlobalEvent("keydown",this.#js.keydown)}#ai(){this.#ci(),this.#Ke=this.#Zs.addGlobalEvent(Hs?"click":"mousedown",this.#js.mousedown,!0)}#ci(){this.#Ke&&=this.#Zs.removeGlobalEvent(this.#Ke)}#li(t){const e=t.nextElementSibling;if(!e){const e=this.#X.format.addLine(t,null);return e&&this.#X.selection.setRange(e,0,e,0),!0}return!!this.#X.format.isLine(e)&&(this.#X.selection.setRange(e,0,e,0),!0)}#ri(t){const e=t.nodeName.toLowerCase();return this.#X.pluginManager.fileInfo.regExp.test(e)&&(!this.#X.pluginManager.fileInfo.tagAttrs[e]||this.#X.pluginManager.fileInfo.tagAttrs[e]?.every((e=>t.hasAttribute(e))))}#ei(){this.#t.set("_preventBlur",!0),this.#X.ui._visibleControllers(!1,Ht.utils.hasClass(os.get("__dragHandler"),"se-drag-handle-full")),Ht.utils.addClass(os.get("__dragCover")||os.get("__dragContainer"),"se-drag-over")}#si(){this.#t.set("_preventBlur",!1),Ht.utils.hasClass(os.get("__dragHandler"),"se-drag-handle-full")||this.#X.ui._visibleControllers(!0,!0),Ht.utils.removeClass([os.get("__dragCover"),os.get("__dragContainer")],"se-drag-over")}#ii(t){const e=os.get("__dragCover")||os.get("__dragContainer");e?(this.#t.set("_preventBlur",!1),Ht.utils.addClass(os.get("__dragHandler"),"se-dragging"),Ht.utils.addClass(os.get("__dragContainer"),"se-dragging"),t.dataTransfer.setDragImage(e,this.#it.get("_rtl")?e.offsetWidth:-5,-5)):t.preventDefault()}#ni(){this.#t.set("_preventBlur",!1),Ht.utils.removeClass([os.get("__dragHandler"),os.get("__dragContainer")],"se-dragging"),this.__removeDragEvent()}#oi(t){const e=Ht.query.getEventTarget(t);if(!Ht.utils.hasClass(e,"se-drag-handle-full"))return;const s=os.get("__dragInst");s&&(this.__removeDragEvent(),this.select(s.currentTarget,s.currentPluginName))}#Te(t){const e=Ht.query.getEventTarget(t);this.currentTarget?.contains(e)||Ht.query.getParentElement(e,".se-controller")||Ht.utils.hasClass(e,"se-drag-handle")||this.currentPluginName===this.#X.ui.currentControllerName&&this.#X.ui.opendControllers.some((({form:t})=>t.contains(e)))||this.deselect()}#Js(t){const e=Ht.query.getEventTarget(t);if(Ht.check.isInputElement(e)&&Ht.query.getParentElement(e,".se-modal"))return;const s=this.info;if(!s)return;const i=s.container.cloneNode(!0);"function"==typeof this.#X.plugins[s.pluginName]?.componentCopy&&!1!==this.#X.plugins[s.pluginName].componentCopy({event:t,cloneContainer:i,info:s})||As(t,i,t.clipboardData),Ht.utils.flashClass(s.container,"se-copy")}#Qs(t){const e=this.info;if(!e)return;const s=e.container.cloneNode(!0);Ht.utils.removeClass(s,"se-component-selected"),As(t,s,t.clipboardData),this.deselect(),Ht.utils.removeItem(e.container)}async#ti(t){if(this.#X.ui.selectMenuOn)return;const e=t.code;if(Nt.isCtrl(t)){if("ControlRight"!==e&&"ControlLeft"!==e){const s=this.#X.shortcuts.keyMap.get(e+(t.shiftKey?"1000":""));/^(redo|undo)$/.test(s?.command)&&(t.preventDefault(),t.stopPropagation(),this.#X.commandDispatcher.run(s.command,s.type,s.button))}}else if(!Nt.isRemoveKey(e)||(t.preventDefault(),t.stopPropagation(),"function"!=typeof this.currentPlugin?.componentDestroy||this.info.isInputType&&this.#t.get("hasFocus"))){if(Nt.isEnter(e)){t.preventDefault();const e=this.currentInfo||this.get(this.currentTarget),s=e.container||e.target,i=s.previousElementSibling||s.nextElementSibling;let n=null;n=Ht.check.isListCell(s.parentNode)?Ht.utils.createElement("BR"):Ht.utils.createElement(this.#X.format.isLine(i)?i.nodeName:this.#it.get("defaultLine"),null,"<br>");const o=this.currentPluginName;return this.deselect(),s.parentNode.insertBefore(n,s),!1===this.select(e.target,o)&&this.#X.focusManager.blur(),void this.#X.history.push(!1)}if(Ls.lastIndex=0,Ls.test(e)){const{container:s}=this.get(this.currentTarget);let i=null,n=1;if(this.isInline(s||this.currentTarget))switch(e){case"ArrowLeft":i=s.previousSibling,n=3===i?.nodeType?i.textContent.length:1;break;case"ArrowRight":i=s.nextSibling,n=0;break;case"ArrowUp":{const t=this.#X.format.getLine(s,null);i=t?.previousElementSibling,n=0;break}case"ArrowDown":{const t=this.#X.format.getLine(s,null);i=t?.nextElementSibling;break}}else Ns.lastIndex=0,Ns.test(e)?i=s.previousElementSibling:(i=s.nextElementSibling,n=0);if(!i)return;this.deselect();const o=this.get(i);if(o?.container)t.stopPropagation(),t.preventDefault(),this.select(o.target,o.pluginName);else try{this.#t.set("_preventBlur",!0),t.stopPropagation(),t.preventDefault(),this.#X.selection.setRange(i,n,i,n)}finally{this.#t.set("_preventBlur",!1)}}else Nt.isEsc(e)&&this.deselect()}else{const t=this.info.container.previousSibling;if(await this.currentPlugin.componentDestroy(this.currentTarget),this.deselect(),t){const e=3===t.nodeType?t.textContent.length:1;this.#X.selection.setRange(t,e,t,e)}else this.#X.focusManager.focus()}}_destroy(){this.__removeGlobalEvent(),this.__removeDragEvent()}};const Vs=class{#F;#X;#hi;#Gs;#it;#di;#ui;#pi=[];#gi=[];#mi={tags:null,regExp:null,pluginRegExp:null,pluginMap:null};#fi=[];#vi=new Map;#bi=new Map([["onMouseMove",[]],["onMouseLeave",[]],["onMouseDown",[]],["onMouseUp",[]],["onScroll",[]],["onClick",[]],["onBeforeInput",[]],["onInput",[]],["onKeyDown",[]],["onKeyUp",[]],["onFocus",[]],["onBlur",[]],["onPaste",[]],["onFilePasteAndDrop",[]]]);constructor(t,e){this.#F=t,this.#X=t.$,this.#hi=e.plugins||{},this.#Gs=this.#X.contextProvider,this.#it=this.#X.options,this.#di=e.pluginCallButtons,this.#ui=e.pluginCallButtons_sub}get plugins(){return this.#hi}get fileInfo(){return this.#mi}findComponentInfo(t){for(const e of this.#fi){const s=e(t);if(s)return s}return null}applyRetainFormat(t){let e;(e=this.#it.get("__pluginRetainFilter"))&&this.#vi.forEach(((s,i)=>{const n=t.querySelectorAll(i);for(let t=0,i=n.length;t<i;t++)!0!==e&&!1===e[s.key]||s.method(n[t])}))}emitEvent(t,e){const s=this.#bi.get(t);for(let t,i=0;i<s.length;i++)if(t=s[i](e),"boolean"==typeof t)return t}async emitEventAsync(t,e){const s=this.#bi.get(t);for(let t,i=0;i<s.length;i++)if(t=await s[i](e),"boolean"==typeof t)return t}checkFileInfo(t){for(let e=0,s=this.#pi.length;e<s;e++)this.#pi[e](t)}resetFileInfo(){for(let t=0,e=this.#gi.length;t<e;t++)this.#gi[t]()}register(t,e,s){let i=this.#hi[t];if(!i)throw Error(`[SUNEDITOR.registerPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName: "${t}")`);if("function"==typeof this.#hi[t]&&(i=this.#hi[t]=new this.#hi[t](this.#F,s||{})),e){const{icons:s,lang:n}=this.#Gs;for(let t=0,o=e.length;t<o;t++)ee(e[t],i,s,n);this.#X.commandDispatcher.activeCommands.includes(t)||"function"!=typeof this.#hi[t].active||this.#X.commandDispatcher.activeCommands.push(t)}}init(t){this.#mi.tags=[],this.#mi.pluginMap={},this.#mi.tagAttrs={};const e=this.#hi,s=[];let i;for(const n in e){if(this.register(n,this.#di[n],t[n]),this.register(n,this.#ui[n],t[n]),i=this.#hi[n],"object"==typeof i.__fileManagement){const t=i.__fileManagement;if(this.#pi.push(t._checkInfo.bind(t)),this.#gi.push(t._resetInfo.bind(t)),Array.isArray(t.tagNames)){const e=t.tagNames;this.#mi.tags=this.#mi.tags.concat(e),s.push(n);for(let s,i=0,o=e.length;i<o;i++)s=e[i].toLowerCase(),this.#mi.pluginMap[s]=n,t.tagAttrs&&(this.#mi.tagAttrs[s]=t.tagAttrs)}}"function"==typeof i.constructor.component&&this.#fi.push(function(t,e){return e&&(e=t.component?.(e))?{target:e,pluginName:t.key,options:t.options}:null}.bind(null,i.constructor));const e=i.constructor.options||{};if(this.#bi.forEach(((t,s)=>{if("function"==typeof i[s]){const n=i[s].bind(i);n.index=e[`eventIndex_${s}`]||e.eventIndex||0,t.push(n)}})),i.retainFormat){const t=i.retainFormat();this.#vi.set(t.query,{key:i.constructor.key,method:t.method})}}for(const t of this.#bi.values())t.sort(((t,e)=>t.index-e.index));(this.#it.get("buttons").has("pageBreak")||this.#it.get("buttons_sub")?.has("pageBreak"))&&this.#fi.push(function(t,e,s){return s&&Ht.utils.hasClass(s,"se-page-break")?{target:s,launcher:{destroy:s=>{const i=s.previousElementSibling||s.nextElementSibling;Ht.utils.removeItem(s),t.focusEdge(i),e.push(!1)}}}:null}.bind(null,this.#X.focusManager,this.#X.history)),this.#mi.regExp=new RegExp(`^(${this.#mi.tags.join("|")||"\\^"})$`,"i"),this.#mi.pluginRegExp=new RegExp(`^(${0===s.length?"\\^":s.join("|")})$`,"i"),this.#di=null,this.#ui=null}get(t){return this.#hi[t]}_destroy(){for(const t in this.#hi){const e=this.#hi[t];e._destroy?.(),e.editor=null}this.#hi=null,this.#mi=null,this.#fi=null,this.#bi?.clear(),this.#vi?.clear()}};class Os{#F;#X;#t;#it;#K;#J;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#it=this.#X.options,this.#K=this.#X.frameContext,this.#J=this.#X.frameOptions}focus(t){if(t&&this.#X.facade.changeFrameContext(t),"none"!==this.#K.get("wysiwygFrame").style.display){if(this.#t.set("_preventBlur",!1),this.#J.get("iframe")||!this.#K.get("wysiwyg").contains(this.#X.selection.getNode()))this.nativeFocus();else try{const t=this.#X.selection.getRange();if(t.startContainer===t.endContainer&&Ht.check.isWysiwygFrame(t.startContainer)){const e=t.commonAncestorContainer.children[t.startOffset];if(!this.#X.format.isLine(e)&&!this.#X.component.is(e)){const t=Ht.utils.createElement("BR"),s=Ht.utils.createElement(this.#it.get("defaultLine"),null,t);return this.#K.get("wysiwyg").insertBefore(s,e),void this.#X.selection.setRange(t,0,t,0)}}this.#X.selection.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}catch(t){console.warn("[SUNEDITOR.focus.warn] ",t),this.nativeFocus()}this.#t.mode.isBalloon&&this.#F._eventOrchestrator._toggleToolbarBalloon()}}focusEdge(t){this.#t.set("_preventBlur",!1),t||=this.#K.get("wysiwyg").lastElementChild;const e=this.#X.component.get(t);e?this.#X.component.select(e.target,e.pluginName):t?(3!==t.nodeType&&(t=Ht.query.getEdgeChild(t,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0)),t?this.#X.selection.setRange(t,t.textContent.length,t,t.textContent.length):this.nativeFocus()):this.focus()}nativeFocus(){this.#X.selection.__focus(),this.#X.selection.init()}blur(){this.#J.get("iframe")?this.#K.get("wysiwygFrame").blur():this.#K.get("wysiwyg").blur()}}const{NO_EVENT:Rs}=Et,zs={bold:["font-weight"],underline:["text-decoration"],italic:["font-style"],strike:["text-decoration"]};class Fs{#F;#X;#t;#K;#it;#Zs;#yi=null;#Ci=null;#wi=null;#_i=null;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#Zs=this.#X.eventManager}async execute(t,e){if(!this.#K.get("isReadOnly")||/copy|cut|selectAll|codeView|fullScreen|print|preview|showBlocks/.test(t))switch(t){case"selectAll":this.#xi();break;case"copy":{const t=this.#X.selection.getRange();if(t.collapsed)break;const e=Ht.utils.createElement("div",null,t.cloneContents());await this.#X.html.copy(e.innerHTML);break}case"newDocument":this.#X.html.set(`<${this.#it.get("defaultLine")}><br></${this.#it.get("defaultLine")}>`),this.#X.focusManager.focus(),this.#X.history.push(!1),this.#K.has("documentType_use_header")&&this.#K.get("documentType").reHeader();break;case"codeView":this.#X.viewer.codeView(!this.#K.get("isCodeView"));break;case"fullScreen":this.#X.viewer.fullScreen(!this.#K.get("isFullScreen"));break;case"indent":this.#X.format.indent();break;case"outdent":this.#X.format.outdent();break;case"undo":this.#X.history.undo();break;case"redo":this.#X.history.redo();break;case"removeFormat":this.#X.inline.remove(),this.#X.focusManager.focus();break;case"print":this.#X.viewer.print();break;case"preview":this.#X.viewer.preview();break;case"showBlocks":this.#X.viewer.showBlocks(!this.#K.get("isShowBlocks"));break;case"dir":this.#X.ui.setDir(this.#it.get("_rtl")?"ltr":"rtl");break;case"dir_ltr":this.#X.ui.setDir("ltr");break;case"dir_rtl":this.#X.ui.setDir("rtl");break;case"save":await this.#$i();break;case"copyFormat":this.#Si(e);break;case"pageBreak":this.#ki();break;case"pageUp":this.#K.get("documentType").pageUp();break;case"pageDown":this.#K.get("documentType").pageDown();break;default:this.#Ei(t)}}copyFormat(){if(this.#wi?.length)try{const t=[...this.#wi],e=t.pop();if(this.#X.inline.remove(),e){const s=this.#X.inline.apply(e,{stylesToModify:null,nodesToRemove:[e.nodeName],strictRemove:!1}),{parent:i,inner:n}=this.#X.nodeTransform.createNestedNode(t);s.parentNode.insertBefore(i,s),n.appendChild(s),this.#X.selection.setRange(s,Ht.check.isZeroWidth(s)?1:0,s,1)}if(this.#it.get("copyFormatKeepOn"))return;this.#_i()}catch(t){console.warn("[SUNEDITOR.copyFormat.error] ",t),this.#_i?.()||(this.#wi=null,this.#_i=null)}}#xi(){this.#X.ui.offCurrentController(),this.#X.menu.containerOff();const t=this.#K.get("wysiwyg");let e=null,s="";const i=this.#it.get("scopeSelectionTags"),n=this.#X.selection.getRange();if(!n.collapsed){let o=e=n.commonAncestorContainer,l=s=o.nodeName?.toLowerCase();if(0===n.startOffset&&n.endOffset===n.endContainer.textContent?.length){const t=o.parentElement;(Ht.check.isList(t)||Ht.check.isListCell(t))&&t.firstChild.contains?.(n.startContainer)&&t.lastChild?.contains(n.endContainer)&&(e=o=t.parentElement,s=o.nodeName?.toLowerCase())}for(l=o.nodeName?.toLowerCase();o&&(!o.nextSibling&&!o.previousSibling&&!i.includes(l)||Ht.check.isContentLess(l))&&o!==t;)o=o.parentElement,l=o.nodeName?.toLowerCase();i.includes(l)&&(e=o,s=l)}const o=i.filter((t=>t!==s));let l=Ht.query.getParentElement(e||this.#X.selection.getNode(),(t=>o.includes(t.nodeName?.toLowerCase())))||t,{first:r,last:a}=Ps(l);if(!r||!a)return;const c=Ht.check.isZeroWidth;for(;c(r)&&c(a)&&l!==t;)l=l.parentElement,({first:r,last:a}=Ps(Ht.query.getParentElement(l,(t=>o.includes(t.nodeName?.toLowerCase())))||t));if(!r||!a)return;let h=null;if(Ht.check.isMedia(r)||(h=this.#X.component.get(r))||Ht.check.isTableElements(r)){h||=this.#X.component.get(r);const t=Ht.utils.createElement("BR"),e=Ht.utils.createElement(this.#it.get("defaultLine"),null,t);r=h?h.container||h.cover:r,r.parentElement.insertBefore(e,r),r=t}if(Ht.check.isMedia(a)||(h=this.#X.component.get(a))||Ht.check.isTableElements(a)){h||=this.#X.component.get(a);const t=Ht.utils.createElement("BR"),e=Ht.utils.createElement(this.#it.get("defaultLine"),null,t);a=h?h.container||h.cover:a,a.parentElement.appendChild(e),a=t}this.#X.toolbar._showBalloon(this.#X.selection.setRange(r,0,a,a.textContent.length))}async#$i(){const t=this.#K;if(!t.get("isChanged"))return;const e=this.#X.html.get(),s=await this.#Zs.triggerEvent("onSave",{frameContext:t,data:e});if(s===Rs){const s=t.get("originElement");/^TEXTAREA$/i.test(s.nodeName)?s.value=e:s.innerHTML=e}else if(!1===s)return;t.set("isChanged",!1),t.set("savedIndex",this.#X.history.getRootStack()[this.#t.get("rootKey")].index),this.#X.commandDispatcher.applyTargets("save",(t=>{t.disabled=!0}))}#Si(t){if("function"==typeof this.#_i)return void this.#_i();const e=this.#K.get("wysiwyg");this.#wi=[...this.#F._eventOrchestrator.__cacheStyleNodes],this.#_i=this.#Ti.bind(this,this.#Zs,e,t),Ht.utils.addClass(e,"se-copy-format-cursor"),Ht.utils.addClass(t,"on"),this.#yi=this.#Zs.addGlobalEvent("keydown",(t=>{Nt.isEsc(t.code)&&this.#_i?.()})),this.#Ci=this.#Zs.addGlobalEvent("mousedown",(s=>{e.contains(s.target)||s.target===t||this.#_i?.()}))}#Ti(t,e,s){return this.#yi=t.removeGlobalEvent(this.#yi),this.#Ci=t.removeGlobalEvent(this.#Ci),this.#wi=null,this.#_i=null,Ht.utils.removeClass(e,"se-copy-format-cursor"),Ht.utils.removeClass(s,"on"),!0}#Ei(t){t=this.#it.get("_defaultTagCommand")[t.toLowerCase()]||t;let e=this.#it.get("convertTextTags")[t]||t;const s=this.#t.get("currentNodesMap"),i=s.includes(this.#it.get("_styleCommandMap")[e])?null:Ht.utils.createElement(e);/^sub$/i.test(e)&&s.includes("superscript")?e="sup":/^sup$/i.test(e)&&s.includes("subscript")&&(e="sub"),this.#X.inline.apply(i,{stylesToModify:zs[t]||null,nodesToRemove:[e],strictRemove:!1}),this.#X.focusManager.focus()}#ki(){const t=Ht.utils.createElement("DIV",{class:"se-component se-component-line-break se-page-break"});this.#X.component.insert(t,{skipCharCount:!0,insertBehavior:"line"});const e=t.nextElementSibling||this.#X.format.addLine(t);this.#X.selection.setRange(e,1,e,1),this.#X.history.push(!1)}}const Ps=function(t){const e=Ht.check.isContentLess;return{first:Ht.query.getEdgeChild(Ht.query.getEdgeChild(t,(t=>!e(t)),!1),(t=>0===t.childNodes.length||3===t.nodeType||G(t)||U(t)),!1)||t.firstChild,last:Ht.query.getEdgeChild(t.lastChild,(t=>0===t.childNodes.length||3===t.nodeType||G(t)||U(t)),!0)||t.lastChild}},Ds=".se-menu-list .se-toolbar-btn[data-command]",qs=["bold","underline","italic","strike","subscript","superscript","indent","outdent"],Ws=qs.concat(["undo","redo","save","fullScreen","showBlocks","codeView","dir","dir_ltr","dir_rtl"]);class Us{#X;#e;#it;#Mi;#Hi=new Map;#Li=qs;constructor(t){this.#X=t.$,this.#e=this.#X.context,this.#it=this.#X.options,this.#Mi=new Fs(t),this.allCommandButtons=new Map,this.subAllCommandButtons=new Map}get targets(){return this.#Hi}get activeCommands(){return this.#Li}run(t,e,s){if(e){if(/more/i.test(e)){const e=Ht.query.getParentElement(s,".se-toolbar"),i=Ht.utils.hasClass(e,"se-toolbar-sub")?this.#X.subToolbar:this.#X.toolbar;if(s!==i.currentMoreLayerActiveButton){const n=e.querySelector("."+t);n&&(i._moreLayerOn(s,n),i._showBalloon(),i._showInline()),Ht.utils.addClass(s,"on")}else i.currentMoreLayerActiveButton&&(i._moreLayerOff(),i._showBalloon(),i._showInline());return void this.#X.viewer._resetFullScreenHeight()}if(/container/.test(e)&&(null===this.#X.menu.targetMap[t]||s!==this.#X.menu.currentContainerActiveButton))return void this.#X.menu.containerOn(s);if(this.#X.ui.isButtonDisabled(s))return;if(/dropdown/.test(e)&&(null===this.#X.menu.targetMap[t]||s!==this.#X.menu.currentDropdownActiveButton))return void this.#X.menu.dropdownOn(s);if(/modal/.test(e))return void this.#X.plugins[t].open(s);/command/.test(e)?this.#X.plugins[t].action(s):/browser/.test(e)?this.#X.plugins[t].open(null):/popup/.test(e)&&this.#X.plugins[t].show()}else t&&this.#Mi.execute(t,s);/dropdown/.test(e)?this.#X.menu.dropdownOff():/command/.test(e)||(this.#X.menu.dropdownOff(),this.#X.menu.containerOff())}runFromTarget(t){if(Ht.check.isInputElement(t))return;const e=Ht.query.getCommandTarget(t);if(!e)return;const s=e.getAttribute("data-command"),i=e.getAttribute("data-type");(s||i)&&(e.disabled||this.run(s,i,t))}applyTargets(t,e){this.#Hi.has(t)&&this.#Hi.get(t).forEach(e)}registerTargets(t,e){if(!t||!e)return;(Ws.includes(t)||this.#X.plugins[t])&&(this.#Hi.get(t)?this.#Hi.get(t).includes(e)||this.#Hi.get(t).push(e):this.#Hi.set(t,[e]))}resetTargets(){this.#Hi=new Map,this._initCommandButtons()}_initCommandButtons(){const t=this.#e;this.#Ni(this.allCommandButtons,t.get("toolbar_buttonTray")),this.#Ni(this.subAllCommandButtons,t.get("toolbar_sub_buttonTray"))}_copyFormat(){this.#Mi.copyFormat()}#Ni(t,e){if(!e)return;const s=e.querySelectorAll(Ds),i=this.#it.get("shortcuts"),n=this.#it.get("_reverseCommandArray"),o=this.#X.shortcuts.keyMap,l=this.#X.shortcuts.reverseKeys;for(let e,r,a=0,c=s.length;a<c;a++)e=s[a],r=e.getAttribute("data-command"),t.set(r,e),this.registerTargets(r,e),Ut(r,e,i[r],o,n,l)}_destroy(){this.#Hi.clear(),this.allCommandButtons.clear(),this.subAllCommandButtons.clear(),this.#Li=null}}const Gs=`${Ds}:not([class~="se-code-view-enabled"]):not([data-type="MORE"])`,Zs=`${Ds}:not([class~="se-component-enabled"]):not([data-type="MORE"])`,{_w:js}=Et;function Ks(t){const e=Ht.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this._alertInner)&&this.alertClose()}function Ys(t){Nt.isEsc(t.code)&&this.alertClose()}const Xs=class{#F;#X;#t;#Gs;#st;#it;#e;#B;#K;#Zs;#Ai;#Bi;#Ii;#Vi;#Oi;#Ri=!1;#zi=null;#Fi=null;#Pi=[];#Di=[];#qi=!1;#Wi=null;#Ui=null;constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#Gs=this.#X.contextProvider,this.#st=this.#Gs.carrierWrapper,this.#it=this.#X.options,this.#e=this.#X.context,this.#B=this.#X.frameRoots,this.#K=this.#X.frameContext,this.#Zs=this.#X.eventManager;const e=function({lang:t,icons:e}){const s='<div><button class="close" data-command="close" title="'+t.close+'">'+e.cancel+"</button></div><div><span></span></div>";return Ht.utils.createElement("DIV",{class:"se-alert-content"},s)}(this.#Gs);this.alertModal=e,this.alertMessage=e.querySelector("span");const s=function(){const t='<div class="se-toast-container"><span></span></div>';return Ht.utils.createElement("DIV",{class:"se-toast"},t)}();this.toastPopup=s,this.toastContainer=s.querySelector(".se-toast-container"),this.toastMessage=s.querySelector("span"),this.#st.appendChild(s),this.#Ai=this.#st.querySelector(".se-alert"),this.#Bi=this.#st.querySelector(".se-alert .se-modal-inner"),this.#Bi.appendChild(e),this.#Ii=[Ys.bind(this),Ks.bind(this)],this.#Vi=!1,this.#Oi=this.#st.querySelector(".se-back-wrapper"),this.selectMenuOn=!1,this.opendControllers=[],this.controllerTargetContext=null,this._figureContainer=null}setEditorStyle(t,e){e||=this.#K;const s=e.get("options");s.set("editorStyle",t);const i=Mt._setDefaultOptionStyle(s,t);s.set("_defaultStyles",i),e.get("topArea").style.cssText=i.top;const n=e.get("code");n.style.cssText=s.get("_defaultStyles").frame,n.style.display="none",s.get("iframe")?(e.get("wysiwygFrame").style.cssText=i.frame,e.get("wysiwyg").style.cssText=i.editor):e.get("wysiwygFrame").style.cssText=i.frame+i.editor}setTheme(t){if("string"!=typeof t)return;const e=this.#it,s=e.get("_themeClass").trim();e.set("theme",t||""),e.set("_themeClass",t?` se-theme-${t}`:""),t=e.get("_themeClass").trim();const i=e=>{e&&(s&&Ht.utils.removeClass(e,s),t&&Ht.utils.addClass(e,t))};i(this.#st),this.#Gs.applyToRoots((t=>{i(t.get("topArea")),i(t.get("wysiwyg"))})),i(this.#e.get("statusbar_wrapper")),i(this.#e.get("toolbar_wrapper"))}setDir(t){const e="rtl"===t;if(this.#it.get("_rtl")!==e){try{this.#it.set("_rtl",e),this.offCurrentController();const s=this.#K,i=this.#X.pluginManager.plugins;for(const e in i)i[e].setDir?.(t);const n=this.#e.get("toolbar_wrapper"),o=this.#e.get("statusbar_wrapper");e?(this.#Gs.applyToRoots((t=>{Ht.utils.addClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),Ht.utils.addClass([this.#st,n,o],"se-rtl")):(this.#Gs.applyToRoots((t=>{Ht.utils.removeClass([t.get("topArea"),t.get("wysiwyg"),t.get("documentTypePageMirror")],"se-rtl")})),Ht.utils.removeClass([this.#st,n,o],"se-rtl"));const l=Ht.query.getListChildren(s.get("wysiwyg"),(t=>this.#X.format.isLine(t)&&!!(t.style.marginRight||t.style.marginLeft||t.style.textAlign)),null);for(let t,e,s,i=0;t=l[i];i++)t=l[i],s=t.style.marginRight,e=t.style.marginLeft,(s||e)&&(t.style.marginRight=e,t.style.marginLeft=s),s=t.style.textAlign,"left"===s?t.style.textAlign="right":"right"===s&&(t.style.textAlign="left");this.#Gi(e),s.has("documentType_use_header")&&(e?s.get("wrapper").appendChild(s.get("documentTypeInner")):s.get("wrapper").insertBefore(s.get("documentTypeInner"),s.get("wysiwygFrame"))),s.has("documentType_use_page")&&(e?s.get("wrapper").insertBefore(s.get("documentTypePage"),s.get("wysiwygFrame")):s.get("wrapper").appendChild(s.get("documentTypePage"))),this.#t.mode.isBalloon?this.#X.toolbar._showBalloon():this.#t.mode.isSubBalloon&&this.#X.subToolbar._showBalloon()}catch(t){this.#it.set("_rtl",!e),console.warn(`[SUNEDITOR.ui.setDir.fail] ${t.toString()}`)}this.#t.set("_lastSelectionNode",null),this.#F._eventOrchestrator.applyTagEffect()}}readOnly(t,e){const s=e?this.#B.get(e):this.#K;s.set("isReadOnly",!!t),this._toggleControllerButtons(!!t),t?(this.offCurrentController(),this.offCurrentModal(),this.#X.toolbar?.currentMoreLayerActiveButton?.disabled&&this.#X.toolbar._moreLayerOff(),this.#X.subToolbar?.currentMoreLayerActiveButton?.disabled&&this.#X.subToolbar._moreLayerOff(),this.#X.menu?.currentDropdownActiveButton?.disabled&&this.#X.menu.dropdownOff(),this.#X.menu?.currentContainerActiveButton?.disabled&&this.#X.menu.containerOff(),s.get("code").setAttribute("readOnly","true"),Ht.utils.addClass(s.get("wysiwyg"),"se-read-only")):(s.get("code").removeAttribute("readOnly"),Ht.utils.removeClass(s.get("wysiwyg"),"se-read-only")),this.#it.get("hasCodeMirror")&&this.#X.viewer._codeMirrorEditor("readonly",!!t,e)}disable(t){const e=t?this.#B.get(t):this.#K;this.#X.toolbar.disable(),this.offCurrentController(),this.offCurrentModal(),e.get("wysiwyg").setAttribute("contenteditable","false"),e.set("isDisabled",!0),this.#it.get("hasCodeMirror")?this.#X.viewer._codeMirrorEditor("readonly",!0,t):e.get("code").disabled=!0}enable(t){const e=t?this.#B.get(t):this.#K;this.#X.toolbar.enable(),e.get("wysiwyg").setAttribute("contenteditable","true"),e.set("isDisabled",!1),this.#it.get("hasCodeMirror")?this.#X.viewer._codeMirrorEditor("readonly",!1,t):e.get("code").disabled=!1}show(t){const e=(t?this.#B.get(t):this.#K).get("topArea").style;"none"===e.display&&(e.display="block")}hide(t){(t?this.#B.get(t):this.#K).get("topArea").style.display="none"}showLoading(t){(t?this.#B.get(t).get("container"):this.#st).querySelector(".se-loading-box").style.display="block"}hideLoading(t){(t?this.#B.get(t).get("container"):this.#st).querySelector(".se-loading-box").style.display="none"}alertOpen(t,e){this.alertMessage.textContent=t,Ht.utils.removeClass(this.alertModal,"se-alert-error|se-alert-success"),e&&Ht.utils.addClass(this.alertModal,`se-alert-${e}`),this.#Vi&&this.#Bi.addEventListener("click",this.#Ii[1]),this.#zi&&=this.#Zs.removeGlobalEvent(this.#zi),this.#zi=this.#Zs.addGlobalEvent("keydown",this.#Ii[0]),this.#Ai.style.display="block",Ht.utils.addClass(this.alertModal,"se-modal-show")}alertClose(){Ht.utils.removeClass(this.alertModal,"se-modal-show"),Ht.utils.removeClass(this.alertModal,"se-alert-*"),this.#Ai.style.display="none",this.#Vi&&this.#Bi.removeEventListener("click",this.#Ii[1]),this.#zi&&=this.#Zs.removeGlobalEvent(this.#zi)}showToast(t,e=1e3,s){Ht.utils.hasClass(this.toastContainer,"se-toast-show")&&this.closeToast(),Ht.utils.removeClass(this.toastPopup,"se-toast-error|se-toast-success"),s&&Ht.utils.addClass(this.toastPopup,`se-toast-${s}`),this.toastPopup.style.display="block",this.toastMessage.textContent=t,Ht.utils.addClass(this.toastContainer,"se-toast-show"),this.#Fi=js.setTimeout((()=>{this.closeToast()}),e)}closeToast(){this.#Fi&&js.clearTimeout(this.#Fi),this.#Fi=null,Ht.utils.removeClass(this.toastContainer,"se-toast-show"),this.toastPopup.style.display="none"}setControllerOnDisabledButtons(t){return t&&!this.#Ri?(this._toggleControllerButtons(!0),this.#Ri=!0):!t&&this.#Ri&&(this._toggleControllerButtons(!1),this.#Ri=!1),this.#Ri}onControllerContext(){this.controllerTargetContext=this.#K.get("topArea")}offControllerContext(){this.controllerTargetContext=null}enableBackWrapper(t){this.#Oi.style.cursor=t,this.#Oi.style.display="block"}disableBackWrapper(){this.#Oi.style.display="none",this.#Oi.style.cursor="default"}offCurrentController(){this.#X.component.__deselect()}offCurrentModal(){this.opendModal?.close()}getVisibleFigure(){return"block"===this._figureContainer?.style.display?this._figureContainer:null}setFigureContainer(t){this._figureContainer=t}preventToolbarHide(t){this.#qi=t}get isPreventToolbarHide(){return this.#qi}reset(t){t.set("_editorHeight",t.get("wysiwygFrame").offsetHeight),this.#Wi=t.get("lineBreaker_t"),this.#Ui=t.get("lineBreaker_b")}_offControllers(){const t=this.opendControllers,e=[];for(let s,i=0;i<t.length;i++)s=t[i],s.fixed?e.push(s):(s.inst.controllerClose?.(),s.form&&(s.form.style.display="none"));this.opendControllers=e,this.currentControllerName="",this.#t.set("_preventBlur",!1)}_syncScrollPosition(t){const e=t.scrollTop||t.scrollY||0,s=t.scrollLeft||t.scrollX||0;this.#t.mode.isBalloon?(this.#e.get("toolbar_main").style.top=this.#X.toolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_main").style.left=this.#X.toolbar.balloonOffset.left-s+"px"):this.#t.mode.isSubBalloon&&(this.#e.get("toolbar_sub_main").style.top=this.#X.subToolbar.balloonOffset.top-e+"px",this.#e.get("toolbar_sub_main").style.left=this.#X.subToolbar.balloonOffset.left-s+"px"),this.controllerTargetContext!==this.#K.get("topArea")&&this.offCurrentController(),this.#Zi(s,e)}_repositionControllers(){const t=this.opendControllers;if(0!==t.length){os.get("__dragMove")&&os.get("__dragMove")();for(let e=0;e<t.length;e++)t[e].notInCarrier||t[e].inst?._scrollReposition()}}#Zi(t,e){if(this.#Wi){const s=this.#Wi.style;if("none"!==s.display){const i=(this.#Wi.getAttribute("data-offset")||",").split(",");s.top=Lt.get(s.top,0)-(e-Lt.get(i[0],0))+"px",s.left=Lt.get(s.left,0)-(t-Lt.get(i[1],0))+"px",this.#Wi.setAttribute("data-offset",e+","+t)}}if(this.#Ui){const s=this.#Ui.style;if("none"!==s.display){const i=(this.#Ui.getAttribute("data-offset")||",").split(",");s.top=Lt.get(s.top,0)-(e-Lt.get(i[0],0))+"px",s[i[1]]=Lt.get(s[i[1]],0)-(t-Lt.get(i[2],0))+"px",this.#Ui.setAttribute("data-offset",e+","+i[1]+","+t)}}const s=this.opendControllers;for(let i=0;i<s.length;i++)s[i].notInCarrier&&(s[i].form.style.top=s[i].inst.__offset.top-e+"px",s[i].form.style.left=s[i].inst.__offset.left-t+"px")}_visibleControllers(t,e){const s=t?"":"hidden",i=e??s?"":"hidden",n=this.opendControllers;for(let t,e=0;e<n.length;e++)t=n[e],t.form&&(t.form.style.visibility=s);this.#Wi.style.visibility=i,this.#Ui.style.visibility=i}setCurrentControllerContext;#Gi(t){const e=this.#Gs.icons,s=this.#X.commandDispatcher?.targets;if(!s)return;const i=this.#X.shortcuts?.keyMap;this.#X.shortcuts?.reverseKeys?.forEach((t=>{const e=i?.get(t);e&&([e.command,e.r]=[e.r,e.command])})),this.#X.commandDispatcher.applyTargets("dir",(s=>{Ht.utils.changeTxt(s.querySelector(".se-tooltip-text"),this.#Gs.lang[t?"dir_ltr":"dir_rtl"]),Ht.utils.changeElement(s.firstElementChild,e[t?"dir_ltr":"dir_rtl"])})),t?(Ht.utils.addClass(s.get("dir_rtl"),"active"),Ht.utils.removeClass(s.get("dir_ltr"),"active")):(Ht.utils.addClass(s.get("dir_ltr"),"active"),Ht.utils.removeClass(s.get("dir_rtl"),"active"))}_initToggleButtons(){const t=this.#e;this.#Di=Mt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(Gs)),this.#Pi=Mt.nodeListToArray(t.get("toolbar_buttonTray").querySelectorAll(Zs)),this.#it.has("_subMode")&&(this.#Di=this.#Di.concat(Mt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(Gs))),this.#Pi=this.#Pi.concat(Mt.nodeListToArray(t.get("toolbar_sub_buttonTray").querySelectorAll(Zs))))}_toggleCodeViewButtons(t){Ht.utils.setDisabled(this.#Di,t)}_toggleControllerButtons(t){Ht.utils.setDisabled(this.#Pi,t)}isButtonDisabled(t){return!(!this.#K.get("isReadOnly")||!Ht.utils.arrayIncludes(this.#Pi,t))}_updatePlaceholder(t){t||=this.#K;const e=t.get("placeholder");if(e){if(t.get("isCodeView"))return void(e.style.display="none");this.#X.facade.isEmpty(t)?e.style.display="block":e.style.display="none"}}_syncFrameState(t){t&&(this._iframeAutoHeight(t),this._updatePlaceholder(t),t.has("documentType_use_page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0)))}_iframeAutoHeight(t){if(!t)return;const e=t.get("_iframeAuto");if(e)js.setTimeout((()=>{const s=e.offsetHeight,i=t.get("wysiwygFrame");if(!i)return;i.style.height=s+"px";const n=t.get("options");if(n?.get("iframe")){const t=n.get("maxHeight");t&&i.setAttribute("scrolling",s>Lt.get(t)?"auto":"no")}Et.isResizeObserverSupported||this._emitResizeEvent(t,s,null)}),0);else if(!Et.isResizeObserverSupported){const e=t.get("wysiwygFrame");e&&this._emitResizeEvent(t,e.offsetHeight,null)}}_emitResizeEvent(t,e,s){e=-1===e?s?.borderBoxSize&&s.borderBoxSize[0]?s.borderBoxSize[0].blockSize:s.contentRect.height+Lt.get(t.get("wwComputedStyle").getPropertyValue("padding-left"))+Lt.get(t.get("wwComputedStyle").getPropertyValue("padding-right")):e,t.get("_editorHeight")!==e&&(this.#Zs.triggerEvent("onResizeEditor",{height:e,prevHeight:t.get("_editorHeight"),frameContext:t,observerEntry:s}),t.set("_editorHeight",e)),t.has("documentType_use_page")&&t.get("documentType").resizePage()}init(){this.#Vi=!this.#Zs.addEvent(this.alertModal.querySelector('[data-command="close"]'),"click",this.alertClose.bind(this)),this._initToggleButtons()}_destroy(){this.#Fi&&js.clearTimeout(this.#Fi),this.#zi&&=this.#Zs.removeGlobalEvent(this.#zi),this.#Vi&&this.#Bi&&this.#Bi.removeEventListener("click",this.#Ii[1]),this.opendModal=null,this.opendBrowser=null,this.#Wi=null,this.#Ui=null,this.#Pi=null,this.#Di=null}};function Js(t){const e=t.$,s=t.store,i=e.contextProvider,n=e.eventManager,l=i.frameRoots,r=i.context,a=i.frameContext;let c,h,d,u,p=e.options.get("historyStackDelayTime"),g=null,m=!1,f=null;function v(i,o,l){l&&s.get("hasFocus")&&t._eventOrchestrator.applyTagEffect(),e.history.resetButtons(i.get("key"),o),n.triggerEvent("onChange",{frameContext:i,data:i.get("wysiwyg").innerHTML}),"block"===r.get("toolbar_main").style.display?e.toolbar._showBalloon():s.mode.isSubBalloon&&"block"===r.get("toolbar_sub_main").style.display&&e.subToolbar._showBalloon()}function b(t){const s=h[c],i=d[s];c+=t;const n=t<0&&s!==h[c]&&i.index>0?s:h[c],o=d[n];o.index+=t;const r=o.value[o.index];if(!r)return console.warn("[SunEditor.history.setContent.fail] History state desynchronized. Aborting undo/redo operation."),o.index-=t,void(c-=t);l.get(n).get("wysiwyg").innerHTML=r.content,s!==n&&t<0&&1===c?c=0:s!==n&&t>0&&1===o.index?c++:(t<0&&o.index<1||t>0&&o.index>o.value.length)&&(c+=t);let u=n,p=r;if(t<0&&c>0&&0===o.index){const e=h[c+t];if(e!==n){const t=d[e];u=e,p=t.value[t.index]}}e.facade.changeFrameContext(u),e.selection.setRange(ht(p.s.path,p.frame),p.s.offset,ht(p.e.path,p.frame),p.e.offset),e.focusManager.focus(),c<0?c=0:c>=h.length&&(c=h.length-1),e.ui.offCurrentController(),e.pluginManager.checkFileInfo(!1),e.char.display(),e.ui._syncFrameState(a),a.has("documentType_use_header")&&a.get("documentType").reHeader(),v(a,o.index,!0)}function y(t,e,s,i){let n,o;e?(n={path:ct(e.startContainer,null,null),offset:e.startOffset},o={path:ct(e.endContainer,null,null),offset:e.endOffset}):(n={path:[0,0],offset:[0,0]},o={path:0,offset:0}),c+=i,h[c]=s;const r=d[s];r.index+=i,r.value[r.index]={content:t,s:n,e:o,frame:l.get(s).get("wysiwyg")}}function C(t){d[t]={value:[],index:-1},u[t]=l.get(t).get("wysiwyg").innerHTML}function w(t,s){e.pluginManager.checkFileInfo(!1);const i=l.get(t),n=i.get("wysiwyg").innerHTML,o=d[t];!n||o.value[o.index]&&n===o.value[o.index].content||(h.length>c+1&&function(t){const s=[];for(let t=c+1,e=h.length;t<e;t++)s.includes(h[t])||s.push(h[t]);h=h.slice(0,c+1),t.value.splice(t.index+1),e.commandDispatcher.applyTargets("redo",(t=>{t.disabled=!0}));for(let t=0,e=s.length;t<e;t++)h.includes(s[t])||C(s[t])}(o),0===o.value.length&&function(t){c++,h[c]=t;const e=d[t];e.index=0,e.value[0]={content:u[t],s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0},frame:l.get(t).get("wysiwyg")}}(t),y(n,s,t,1),1===c&&e.commandDispatcher.applyTargets("undo",(t=>{t.disabled=!1})),e.char.display(),v(i,o.index,!1))}return{push(t,i){if(m)return;i=i||null===i?i:s.get("rootKey");const n=s.get("_range");o.setTimeout(e.ui._syncFrameState.bind(e.ui,l.get(i)),0);const r="number"==typeof t?t>0?t:0:t?p:0;r&&!g||(o.clearTimeout(g),r)?g=o.setTimeout((()=>{o.clearTimeout(g),g=null,w(i,n)}),r):w(i,n)},check(t,e){g&&(o.clearTimeout(g),g=null,w(t,e))},undo(){c>0&&b(-1)},redo(){h.length-1>c&&b(1)},overwrite(t){y(l.get(t||s.get("rootKey")).get("wysiwyg").innerHTML,null,s.get("rootKey"),0)},pause(){m=!0,f&&(o.clearTimeout(f),f=null),f=o.setTimeout((()=>{m=!1}),5e3)},resume(){f&&(o.clearTimeout(f),f=null),m=!1},reset(){e.commandDispatcher.applyTargets("undo",(t=>t.disabled=!0)),e.commandDispatcher.applyTargets("redo",(t=>t.disabled=!0)),e.commandDispatcher.applyTargets("save",(t=>t.disabled=!0)),i.applyToRoots((t=>t.set("historyIndex",-1))),i.applyToRoots((t=>t.set("isChanged",!1))),c=-1,h=[],d={},u={},m=!1;const t=i.rootKeys;for(let e=0,s=t.length;e<s;e++)C(t[e])},resetButtons(t,s){const i=!Lt.is(s),o=d[void 0===t?h[c]:t];s=i?o.index:s;const r=l.get(t),a=o.value.length-1;e.commandDispatcher.applyTargets("undo",(t=>{t.disabled=!(s>0&&s<=a)})),e.commandDispatcher.applyTargets("redo",(t=>{t.disabled=!(s>-1&&s<a)}));const u=r.get("savedIndex"),p=r.get("historyIndex"),g=u>-1?u!==s:i?o.index>0:s>0&&p!==s;r.set("historyIndex",s),r.set("isChanged",g),e.commandDispatcher.applyTargets("save",(t=>{t.disabled=!g})),n.triggerEvent("onResetButtons",{rootKey:t})},getRootStack:()=>d,resetDelayTime(t){p=t},_destroy(){g&&o.clearTimeout(g),f&&o.clearTimeout(f),c=h=d=u=null}}}const{_w:Qs}=Et;const ti=class{#F;#X;#t;#ji;#Ki;#e;#K;#it;#Zs;#Yi;#Xi;#Ji;#Qi="default";#tn=null;#en=null;constructor(t,{keyName:e,balloon:s,inline:i,balloonAlways:n,res:o}){this.#F=t,this.#X=t.$,this.#t=t.store,this.#ji=this.#X.icons,this.#Ki=this.#X.lang,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#Zs=this.#X.eventManager,this.isSub="toolbar_sub"===e,this.keyName={main:this.isSub?"toolbar_sub_main":"toolbar_main",buttonTray:this.isSub?"toolbar_sub_buttonTray":"toolbar_buttonTray",width:this.isSub?"toolbar_sub_width":"toolbar_width"},this.currentMoreLayerActiveButton=null,this.isSticky=!1,this.isBalloonMode=s,this.isInlineMode=i,this.isBalloonAlwaysMode=n,this.inlineToolbarAttr={top:"",width:"",isShow:!1},this.balloonOffset={top:0,left:0},this.#Yi=o,this.#Xi=o,this.#Ji="visualViewport"in Qs,this._setResponsive()}disable(){this._moreLayerOff(),this.#X.menu.dropdownOff(),this.#X.menu.containerOff(),Ht.utils.setDisabled(this.#e.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!0)}enable(){Ht.utils.setDisabled(this.#e.get(this.keyName.buttonTray).querySelectorAll(".se-menu-list .se-toolbar-btn[data-type]"),!1)}show(){this.isInlineMode?this._showInline():this.isBalloonMode?this._showBalloon():(this.#e.get(this.keyName.main).style.display="",this.isSub||(this.#K.get("_stickyDummy").style.display="")),this.isSub||this.resetResponsiveToolbar()}hide(){this.isInlineMode?(this.#e.get(this.keyName.main).style.display="none",this.#e.get(this.keyName.main).style.top="0px",this.inlineToolbarAttr.isShow=!1):(this.#e.get(this.keyName.main).style.display="none",this.isSub||(this.#K.get("_stickyDummy").style.display="none"),this.isBalloonMode&&(this.balloonOffset={top:0,left:0}))}resetResponsiveToolbar(){this.#X.menu.containerOff();const t=this.#en;if(t){let e=0;e=(this.isBalloonMode||this.isInlineMode)&&"auto"===this.#it.get("toolbar_width")||this.#t.mode.isSubBalloon&&"auto"===this.#it.get("toolbar_sub_width")?this.#K.get("topArea").offsetWidth:this.#e.get(this.keyName.main).offsetWidth;let s="default";for(let i=1,n=t.length;i<n;i++)if(e<t[i]){s=t[i]+"";break}this.#Qi!==s&&(this.#Qi=s,this.setButtons(this.#tn[s]))}}setButtons(t){this._moreLayerOff(),this.#X.menu.dropdownOff(),this.#X.menu.containerOff();const e=se(t,this.#X.plugins,this.#it,this.#ji,this.#Ki,!0);e.updateButtons.forEach((t=>ee(t.button,t.plugin,this.#ji,this.#Ki))),this.#e.get(this.keyName.main).replaceChild(e.buttonTray,this.#e.get(this.keyName.buttonTray)),this.#e.set(this.keyName.buttonTray,e.buttonTray),this.#sn(),this.#Zs.triggerEvent("onSetToolbarButtons",{buttonTray:e.buttonTray,frameContext:this.#K})}_resetSticky(){const t=this.#K.get("wrapper");if(!t)return;const e=this.#e.get(this.keyName.main),s=this.#it.get("toolbar_sticky");if(this.#K.get("isFullScreen")||0===e.offsetWidth||s<0)return;const i=this.#Ji?Qs.visualViewport.pageTop:Qs.scrollY,n=this.#K.get("_minHeight"),o=t.offsetHeight,l=this.#X.offset.getGlobal(this.#K.get("topArea")),r=i+s,a=(this.isBalloonMode||this.isInlineMode?l.top:this.#X.offset.getGlobal(this.#it.get("toolbar_container")).top)-(this.isInlineMode?e.offsetHeight:0),c=this.#it.get("toolbar_container")?l.top-i+o-n-s-e.offsetHeight:o+a+s-r-n;r<a?this.#in():c<0?(this.isSticky||this.#nn(1),e.style.top=1+c+this.#on()+"px"):this.#nn(1)}#sn(){this.#X.shortcuts._registerCustomShortcuts(),this.#X.commandDispatcher.resetTargets(),this.#X.ui._initToggleButtons(),this.#X.history.resetButtons(this.#K.get("key"),null),this._resetSticky(),this.#t.set("_lastSelectionNode",null),this.#X.viewer._setButtonsActive(),this.#t.get("hasFocus")&&this.#F._eventOrchestrator.applyTagEffect(),this.#K.get("isReadOnly")&&this.#X.ui.setControllerOnDisabledButtons(!0)}_setResponsive(){if(0===this.#Xi?.length)return void(this.#Xi=null);this.#Qi="default";const t=this.#en=[],e=this.#Yi,s=this.#tn={default:e[0]};for(let i,n,o=1,l=e.length;o<l;o++)n=e[o],i=1*n[0],t.push(i),s[i]=n[1];t.sort(((t,e)=>t-e)).unshift("default")}_showBalloon(t){if(!this.isBalloonMode)return;this.isSub&&this.resetResponsiveToolbar();const e=t||this.#X.selection.getRange(),s=this.#e.get(this.keyName.main),i=this.#X.selection.get();let n;if(this.isBalloonAlwaysMode&&e.collapsed)n=!0;else if(i.focusNode===i.anchorNode)n=i.focusOffset<i.anchorOffset;else{const t=Ht.query.getListChildNodes(e.commonAncestorContainer,null,null);n=Ht.utils.getArrayIndex(t,i.focusNode)<Ht.utils.getArrayIndex(t,i.anchorNode)}this._setBalloonOffset(n,e),this.#Zs.triggerEvent("onShowToolbar",{toolbar:s,mode:"balloon",frameContext:this.#K})}_setBalloonOffset(t,e){const s=this.#e.get(this.keyName.main),i=this.#K.get("topArea"),n=this.#X.offset.getGlobal(i).top;if(!this.#X.offset.setRangePosition(s,e,{position:t?"top":"bottom",addTop:n}))return void this.hide();if(this.#it.get("toolbar_container")){const t=i.parentElement;let e=this.#it.get("toolbar_container"),n=e.offsetLeft,o=e.offsetTop;for(;!e.parentElement.contains(t)&&!/^(BODY|HTML)$/i.test(e.parentElement.nodeName);)e=e.offsetParent,n+=e.offsetLeft,o+=e.offsetTop;s.style.left=s.offsetLeft-n+i.offsetLeft+"px",s.style.top=s.offsetTop-o+i.offsetTop+"px"}const o=this.#X.offset.getWWScroll();this.balloonOffset={top:s.offsetTop+o.top,left:s.offsetLeft+o.left,position:t?"top":"bottom"}}_showInline(){if(!this.isInlineMode)return;const t=this.#e.get(this.keyName.main);t.style.visibility="hidden",this.#in(),t.style.display="block",t.style.top="0px",this.inlineToolbarAttr.width=t.style.width=this.#it.get(this.keyName.width),this.inlineToolbarAttr.top=t.style.top=this.#X.offset.getGlobal(this.#K.get("topArea")).top-this.#X.offset.getGlobal(t).top-t.offsetHeight-1+"px",this._resetSticky(),this.inlineToolbarAttr.isShow=!0,this.#Zs.triggerEvent("onShowToolbar",{toolbar:t,mode:"inline",frameContext:this.#K}),t.style.visibility=""}_moreLayerOn(t,e){this._moreLayerOff(),this.currentMoreLayerActiveButton=t,e.style.display="block"}_moreLayerOff(){if(this.currentMoreLayerActiveButton){this.#e.get(this.keyName.main).querySelector("."+this.currentMoreLayerActiveButton.getAttribute("data-command")).style.display="none",Ht.utils.removeClass(this.currentMoreLayerActiveButton,"on"),this.currentMoreLayerActiveButton=null}}#nn(t){const e=this.#e.get(this.keyName.main);if(!this.isInlineMode){const t=this.#it.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#K.get("_stickyDummy");t.style.height=e.offsetHeight+"px",t.style.display="block"}const s=this.#it.get("toolbar_sticky")+t+this.#on();e.style.top=`${s}px`,e.style.width=this.isInlineMode?this.inlineToolbarAttr.width:e.offsetWidth+"px",Ht.utils.addClass(e,"se-toolbar-sticky"),this.isSticky=!0}#on(){return this.#Ji?Qs.visualViewport.offsetTop:0}#in(){(this.#it.get("toolbar_container")?this.#e.get("_stickyDummy"):this.#K.get("_stickyDummy")).style.display="none";const t=this.#e.get(this.keyName.main);t.style.top=this.isInlineMode?this.inlineToolbarAttr.top:"",t.style.width=this.isInlineMode?this.inlineToolbarAttr.width:"",this.#K.get("wrapper").style.marginTop="",Ht.utils.removeClass(t,"se-toolbar-sticky"),this.isSticky=!1}_destroy(){this._moreLayerOff()}};function ei(t){return/free$/.test(t)}const si=class{#X;#t;#Gs;#e;#Zs;#ln;#rn=[];#an=null;#cn=null;#hn=null;#dn=null;#un=null;constructor(t){this.#X=t.$,this.#t=t.store,this.#Gs=this.#X.contextProvider,this.#e=this.#X.context,this.#Zs=this.#X.eventManager,this.targetMap={},this.index=-1,this.menus=[],this.currentButton=null,this.currentDropdown=null,this.currentDropdownActiveButton=null,this.currentDropdownName="",this.currentDropdownType="",this.currentContainer=null,this.currentContainerActiveButton=null,this.currentContainerName="",this.currentDropdownPlugin=null,this.#ln={mousedown:this.#pn.bind(this),containerDown:this.containerOff.bind(this),keydown:this.#gn.bind(this),mousemove:this.#mn.bind(this),mouseout:this.#fn.bind(this)},this.#an=null,this.#cn=null,this.#hn=null,this.#dn=null,this.#un=null}initDropdownTarget({key:t,type:e},s){if(!t)throw Error("[SUNEDITOR.init.fail] The plugin's key is not added.");ei(e)||(s.setAttribute("data-key",t),this.#rn.push(t)),this.#e.get("menuTray").appendChild(s),this.targetMap[t]=s}dropdownOn(t){this.#Ve();const e=this.#vn(t);if(e){const s=Ht.query.getParentElement(e,".se-btn-tray").querySelector('[data-command="'+e.getAttribute("data-ref")+'"]');if(s)return this.#X.commandDispatcher.runFromTarget(s),void this.dropdownOn(t)}const s=this.currentButton=t,i=this.currentDropdownName=s.getAttribute("data-command");this.currentDropdownType=s.getAttribute("data-type");const n=this.currentDropdown=this.targetMap[i];this.currentDropdownActiveButton=s,this.#bn(s,n),this.#an=this.#Zs.addGlobalEvent("mousedown",this.#ln.mousedown,!1),this.#rn.includes(i)&&(this.menus=Mt.nodeListToArray(n.querySelectorAll("[data-command]")),this.menus.length>0&&(this.#cn=this.#Zs.addGlobalEvent("keydown",this.#ln.keydown,!1),n.addEventListener("mousemove",this.#ln.mousemove,!1),n.addEventListener("mouseout",this.#ln.mouseout,!1))),this.currentDropdownPlugin=this.#X.plugins[i],this.currentDropdownPlugin?.on(s),this.#t.set("_preventBlur",!0)}dropdownOff(){this.#Ve(),ei(this.currentDropdownType)&&this.currentDropdownPlugin?.off?.(),this.index=-1,this.menus=[],this.#dn=null,this.#un=null,this.currentButton=null,this.currentDropdown&&(this.currentDropdownName="",this.currentDropdownType="",this.currentDropdown.style.display="none",this.currentDropdown=null,this.currentDropdownActiveButton&&Ht.utils.removeClass(this.currentDropdownActiveButton.parentElement.children,"on"),this.currentDropdownActiveButton=null,this.#X.ui.preventToolbarHide(!1)),this.#t.set("_preventBlur",!1),this.currentDropdownPlugin=null}dropdownShow(){this.currentButton&&this.dropdownOn(this.currentButton)}dropdownHide(){this.currentDropdown&&(this.currentDropdown.style.display="none")}containerOn(t){this.#Ve(),this.currentContainerActiveButton=t;const e=this.currentContainerName=this.currentContainerActiveButton.getAttribute("data-command");this.#bn(t,this.currentContainer=this.targetMap[e]),this.#hn=this.#Zs.addGlobalEvent("mousedown",this.#ln.containerDown,!1),this.#X.plugins[e].on&&this.#X.plugins[e].on(t),this.#t.set("_preventBlur",!0)}containerOff(){this.#Ve(),this.currentContainer&&(this.currentContainerName="",this.currentContainer.style.display="none",this.currentContainer=null,Ht.utils.removeClass(this.currentContainerActiveButton,"on"),this.currentContainerActiveButton=null,this.#X.ui.preventToolbarHide(!1)),this.#t.set("_preventBlur",!1)}__resetMenuPosition(t,e){this.#X.offset.setRelPosition(e,this.#Gs.carrierWrapper,t.parentElement,Ht.query.getParentElement(t,".se-toolbar"))}__restoreMenuPosition(){this.#dn&&this.#un&&this.#bn(this.#dn,this.#un)}#bn(t,e){e.style.visibility="hidden",e.style.display="block",e.style.height="",Ht.utils.addClass(t.parentElement.children,"on"),this.#X.offset.setRelPosition(e,this.#Gs.carrierWrapper,t.parentElement,Ht.query.getParentElement(t,".se-toolbar")),e.style.visibility="",this.#dn=t,this.#un=e}#vn(t){const e=Ht.query.getParentElement(t,".se-more-layer");return e&&"block"!==e.style.display&&e.getAttribute("data-ref")?e:null}#cs(t){Ht.utils.removeClass(this.currentDropdown,"se-select-menu-mouse-move"),Ht.utils.addClass(this.currentDropdown,"se-select-menu-key-action"),t=this.index+t;const e=this.menus.length,s=this.index=t>=e?0:t<0?e-1:t;for(let t=0;t<e;t++)t===s?Ht.utils.addClass(this.menus[t],"on"):Ht.utils.removeClass(this.menus[t],"on")}#Ve(){this.#an&&=this.#Zs.removeGlobalEvent(this.#an),this.#hn&&=this.#Zs.removeGlobalEvent(this.#hn),this.#cn&&(this.#cn=this.#Zs.removeGlobalEvent(this.#cn),Ht.utils.removeClass(this.menus,"on"),Ht.utils.removeClass(this.currentDropdown,"se-select-menu-key-action|se-select-menu-mouse-move"),this.currentDropdown.removeEventListener("mousemove",this.#ln.mousemove,!1),this.currentDropdown.removeEventListener("mouseout",this.#ln.mouseout,!1))}#pn(t){const e=Ht.query.getEventTarget(t);Ht.query.getParentElement(e,".se-dropdown")||this.dropdownOff()}#fn(){this.index=-1}#gn(t){switch(t.code){case"ArrowUp":case"ArrowLeft":t.preventDefault(),t.stopPropagation(),this.#cs(-1);break;case"ArrowDown":case"ArrowRight":t.preventDefault(),t.stopPropagation(),this.#cs(1);break;case"Enter":case"Space":{if(this.index<0)break;const e=this.menus[this.index];if(!e||"function"!=typeof this.#X.plugins[this.currentDropdownName].action)return;t.preventDefault(),t.stopPropagation(),this.#X.plugins[this.currentDropdownName].action(e),this.dropdownOff();break}}}#mn(t){Ht.utils.addClass(this.currentDropdown,"se-select-menu-mouse-move"),Ht.utils.removeClass(this.currentDropdown,"se-select-menu-key-action");const e=this.menus.indexOf(t.target);-1!==e&&(this.index=1*e)}_destroy(){this.#Ve()}},{_w:ii,_d:ni}=Et;function oi(t){const e=ii.getComputedStyle(t).lineHeight;let s;if(Lt.is(e))s=Lt.get(e);else{const e=ii.getComputedStyle(t).fontSize;s=1.2*Lt.get(e)}return s}const li=class{#F;#X;#t;#ji;#Ki;#B;#e;#K;#it;#J;#Zs;#Xt;#yn="";#Cn="";#wn="";#_n="";#xn="";#$n="";#Sn="";#kn="";#En=0;#Tn=!1;#Mn=!1;#Hn=!1;#Ln=null;#Nn="";constructor(t){this.#F=t,this.#X=t.$,this.#t=t.store,this.#ji=this.#X.icons,this.#Ki=this.#X.lang,this.#B=this.#X.frameRoots,this.#e=this.#X.context,this.#K=this.#X.frameContext,this.#it=this.#X.options,this.#J=this.#X.frameOptions,this.#Zs=this.#X.eventManager,this.#Xt=new RegExp(`^(${this.#it.get("_disallowedExtraTag")})$`,"i")}codeView(t){const e=this.#K;if(void 0===t&&(t=!e.get("isCodeView")),t===e.get("isCodeView"))return;e.set("isCodeView",t),this.#X.ui.offCurrentController(),this.#X.ui.offCurrentModal();const s=e.get("codeWrapper"),i=e.get("code"),n=e.get("wysiwygFrame"),o=e.get("wrapper");t?(this.#An(),s.style.setProperty("display","flex","important"),n.style.display="none",e.get("isFullScreen")?i.style.height="100%":"auto"!==this.#J.get("height")||this.#it.get("hasCodeMirror")||(i.style.height=i.scrollHeight>0?i.scrollHeight+"px":"auto"),this.#it.get("hasCodeMirror")&&this._codeMirrorEditor("refresh",null,null),e.get("isFullScreen")||(this.#X.ui.preventToolbarHide(!0),this.#t.mode.isBalloon&&(this.#e.get("toolbar_arrow").style.display="none",this.#e.get("toolbar_main").style.left="",this.#t.mode.isInline=this.#X.toolbar.isInlineMode=!0,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!1,this.#X.toolbar._showInline())),this.#t.mode.isBalloon&&this.#X.subToolbar.hide(),function(t){const e=t.get("codeNumbers");if(!e)return;const s=oi(e),i=t.get("code").scrollHeight/s;let n="";for(let t=1;t<=i;t++)n+=`${t}\n`;const{padding:o,margin:l}=ii.getComputedStyle(t.get("code"));e.value=n,e.style.padding=o||"",e.style.margin=l||""}(e),this.#t.set("_range",null),i.focus(),Ht.utils.addClass(this.#X.commandDispatcher.targets.get("codeView"),"active"),Ht.utils.addClass(o,"se-code-view-status")):(Ht.check.isNonEditable(n)||this.#Bn(),n.scrollTop=0,s.style.setProperty("display","none","important"),n.style.display="block","auto"!==this.#J.get("height")||this.#it.get("hasCodeMirror")||(e.get("code").style.height="0px"),e.get("isFullScreen")||(this.#X.ui.preventToolbarHide(!1),/balloon/.test(this.#it.get("mode"))&&(this.#e.get("toolbar_arrow").style.display="",this.#t.mode.isInline=this.#X.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!0,this.#F._eventOrchestrator._hideToolbar())),this.#X.focusManager.nativeFocus(),Ht.utils.removeClass(this.#X.commandDispatcher.targets.get("codeView"),"active"),Ht.check.isNonEditable(n)||(this.#X.history.push(!1),this.#X.history.resetButtons(e.get("key"),null)),Ht.utils.removeClass(o,"se-code-view-status")),this.#X.ui._updatePlaceholder(e),this.#X.ui._toggleCodeViewButtons(t),e.has("documentType_use_header")&&(t?e.get("documentTypeInner").style.display="none":(e.get("documentTypeInner").style.display="",e.get("documentType").reHeader())),this.#Zs.triggerEvent("onToggleCodeView",{frameContext:e,is:e.get("isCodeView")})}fullScreen(t){const e=this.#K;if(void 0===t&&(t=!e.get("isFullScreen")),t===e.get("isFullScreen"))return;e.set("isFullScreen",t);const s=e.get("topArea"),i=this.#e.get("toolbar_main"),n=e.get("wrapper"),o=e.get("wysiwygFrame"),l=e.get("codeWrapper"),r=e.get("code"),a=e.get("codeNumbers"),c=this.#K.get("isCodeView"),h=this.#e.get("toolbar_arrow");this.#X.ui.offCurrentController();const d="none"===i.style.display||this.#t.mode.isInline&&!this.#X.toolbar.inlineToolbarAttr.isShow;if(t){this.#Nn=s.style.cssText,this.#Cn=n.style.cssText,this.#wn=o.style.cssText,this.#_n=l.style.cssText,this.#xn=r.style.cssText,this.#$n=a?.style.cssText,this.#Sn=i.style.cssText,h&&(this.#kn=h.style.cssText),(this.#t.mode.isBalloon||this.#t.mode.isInline)&&(h&&(h.style.display="none"),this.#Hn=this.#t.mode.isInline,this.#Mn=this.#t.mode.isBalloon,this.#t.mode.isInline=this.#X.toolbar.isInlineMode=!1,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=!1),this.#it.get("toolbar_container")&&(this.#Ln=i.parentElement,e.get("container").insertBefore(i,n)),s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.width="100%",s.style.maxWidth="100%",s.style.height="100%",s.style.zIndex="2147483639","none"!==e.get("_stickyDummy").style.display&&""!==e.get("_stickyDummy").style.display&&(this.#Tn=!0,e.get("_stickyDummy").style.display="none",Ht.utils.removeClass(i,"se-toolbar-sticky")),this.#yn=ni.body.style.overflow,ni.body.style.overflow="hidden",n.style.cssText=i.style.cssText="",o.style.cssText=(o.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+this.#J.get("_defaultStyles").editor+(c?"display: none;":""),l.style.cssText=(l.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0]+`display: ${c?"flex":"none"} !important;`,l.style.overflow="auto",l.style.height="100%",r.style.height="",i.style.width=o.style.height="100%",i.style.position="relative",i.style.display="block",this.#En=ii.innerHeight-i.offsetHeight,n.style.height=this.#En-(e.has("statusbar")?e.get("statusbar").offsetHeight:0)-this.#it.get("fullScreenOffset")+"px",this.#J.get("iframe")&&"auto"===this.#J.get("height")&&(n.style.overflow="auto",this.#X.ui._iframeAutoHeight(e)),e.get("topArea").style.marginTop=this.#it.get("fullScreenOffset")+"px";const t=this.#ji.reduction;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ht.utils.changeElement(e.firstElementChild,t),Ht.utils.addClass(e,"active")}))}else{o.style.cssText=this.#wn.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+(c?"display: none;":""),l.style.cssText=this.#_n.replace(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/,"")+`display: ${c?"flex":"none"} !important;`,r.style.cssText=this.#xn,a&&(a.style.cssText=this.#$n),i.style.cssText=this.#Sn,n.style.cssText=this.#Cn,s.style.cssText=this.#Nn,h&&(h.style.cssText=this.#kn),ni.body.style.overflow=this.#yn,"auto"!==this.#J.get("height")||this.#it.get("hasCodeMirror")||this._codeViewAutoHeight(e.get("code"),e.get("codeNumbers"),!0),this.#Ln&&(this.#Ln.appendChild(i),this.#Ln=null),this.#it.get("toolbar_sticky")>-1&&Ht.utils.removeClass(i,"se-toolbar-sticky"),this.#Tn&&!this.#it.get("toolbar_container")&&(this.#Tn=!1,e.get("_stickyDummy").style.display="block",Ht.utils.addClass(i,"se-toolbar-sticky")),this.#t.mode.isInline=this.#X.toolbar.isInlineMode=this.#Hn,this.#t.mode.isBalloon=this.#X.toolbar.isBalloonMode=this.#Mn,e.get("isCodeView")||(this.#t.mode.isInline?this.#X.toolbar._showInline():this.#t.mode.isBalloon&&this.#X.toolbar._showBalloon()),this.#X.toolbar._resetSticky(),e.get("topArea").style.marginTop="";const t=this.#ji.expansion;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ht.utils.changeElement(e.firstElementChild,t),Ht.utils.removeClass(e,"active")}))}d&&!e.get("isCodeView")&&this.#X.toolbar.hide(),this.#Zs.triggerEvent("onToggleFullScreen",{frameContext:e,is:e.get("isFullScreen")})}showBlocks(t){const e=this.#K;void 0===t&&(t=!e.get("isShowBlocks")),e.set("isShowBlocks",!!t),t?(Ht.utils.addClass(e.get("wysiwyg"),"se-show-block"),Ht.utils.addClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active")):(Ht.utils.removeClass(e.get("wysiwyg"),"se-show-block"),Ht.utils.removeClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active")),this.#X.ui._syncFrameState(e)}_setButtonsActive(){const t=this.#K;if(t.get("isCodeView")?Ht.utils.addClass(this.#X.commandDispatcher.targets.get("codeView"),"active"):Ht.utils.removeClass(this.#X.commandDispatcher.targets.get("codeView"),"active"),t.get("isFullScreen")){const t=this.#ji.reduction;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ht.utils.changeElement(e.firstElementChild,t),Ht.utils.addClass(e,"active")}))}else{const t=this.#ji.expansion;this.#X.commandDispatcher.applyTargets("fullScreen",(e=>{Ht.utils.changeElement(e.firstElementChild,t),Ht.utils.removeClass(e,"active")}))}t.get("isShowBlocks")?Ht.utils.addClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active"):Ht.utils.removeClass(this.#X.commandDispatcher.targets.get("showBlocks"),"active")}print(){const t=Ht.utils.createElement("IFRAME",{style:"display: none;"});ni.body.appendChild(t);const e=ii.getComputedStyle(this.#K.get("wysiwyg")).padding,s=this.#it.get("printTemplate")?this.#it.get("printTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#X.html.get()):this.#X.html.get(),i=Ht.query.getIframeDocument(t),n=this.#K.get("_wd"),o=this.#it.get("_rtl")?" se-rtl":"",l=`\n\t\t\t<style>\n\t\t\t\t@page {\n\t\t\t\t\tsize: A4;\n\t\t\t\t\tmargin: ${e};\n\t\t\t\t}\n\t\t\t</style>`;if(this.#J.get("iframe")){const t=this.#it.get("printClass")?'class="'+this.#it.get("printClass")+o+'"':this.#J.get("iframe_fullPage")?Ht.utils.getAttributesToString(n.body,["contenteditable"]):'class="'+this.#it.get("_editableClass")+o+'"';i.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n.head.innerHTML}\n\t\t\t\t\t\t${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${t} style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${s}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const t=ni.head.getElementsByTagName("link"),e=ni.head.getElementsByTagName("style");let n="";for(let e=0,s=t.length;e<s;e++)n+=t[e].outerHTML;for(let t=0,s=e.length;t<s;t++)n+=e[t].outerHTML;i.write(`\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${n}\n\t\t\t\t\t\t${l}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.#it.get("printClass")||this.#it.get("_editableClass"))+o}" style="padding: 0; padding-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0;">\n\t\t\t\t\t\t${s}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}this.#X.ui.showLoading(),ii.setTimeout((()=>{try{if(t.focus(),Et.isEdge||Et.isChromium||"StyleMedia"in Et._w)try{t.contentWindow.document.execCommand("print",!1,null)}catch(e){console.warn("[SUNEDITOR.print.warn]",e),t.contentWindow.print()}else t.contentWindow.print()}catch(t){throw Error(`[SUNEDITOR.print.fail] error: ${t.message}`)}finally{this.#X.ui.hideLoading(),Ht.utils.removeItem(t)}}),1e3)}preview(){this.#X.menu.dropdownOff(),this.#X.menu.containerOff(),this.#X.ui.offCurrentController(),this.#X.ui.offCurrentModal();const t=this.#it.get("previewTemplate")?this.#it.get("previewTemplate").replace(/\{\{\s*contents\s*\}\}/i,this.#X.html.get({withFrame:!0})):this.#X.html.get({withFrame:!0}),e=ii.open("","_blank"),s=this.#K.get("_wd"),i=this.#it.get("_rtl")?" se-rtl":"";if(this.#J.get("iframe")){const n=this.#it.get("printClass")?'class="'+this.#it.get("printClass")+i+'"':this.#J.get("iframe_fullPage")?Ht.utils.getAttributesToString(s.body,["contenteditable"]):'class="'+this.#it.get("_editableClass")+i+'"';e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t${s.head.innerHTML}\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\tbody {overflow:auto !important; height:auto !important;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body ${n}>\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}else{const s=ni.head.getElementsByTagName("link"),n=ni.head.getElementsByTagName("style");let o="";for(let t=0,e=s.length;t<e;t++)o+=s[t].outerHTML;for(let t=0,e=n.length;t<e;t++)o+=n[t].outerHTML;e.document.write(`<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<meta charset="utf-8" />\n\t\t\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">\n\t\t\t\t\t\t<title>${this.#Ki.preview}</title>\n\t\t\t\t\t\t${o}\n\t\t\t\t\t</head>\n\t\t\t\t\t<body class="${(this.#it.get("printClass")?this.#it.get("printClass"):this.#it.get("_editableClass"))+i}" style="height:auto">\n\t\t\t\t\t\t${t}\n\t\t\t\t\t</body>\n\t\t\t\t</html>`)}}_resetFullScreenHeight(){if(this.#K.get("isFullScreen"))return this.#En+=ii.innerHeight-this.#e.get("toolbar_main").offsetHeight-(this.#K.has("statusbar")?this.#K.get("statusbar").offsetHeight:0)-this.#En,this.#K.get("wrapper").style.height=this.#En+"px",!0}_codeMirrorEditor(t,e,s){const i=s?this.#B.get(s).get("options"):this.#J;switch(t){case"set":i.has("codeMirror5Editor")?i.get("codeMirror5Editor").getDoc().setValue(e):i.has("codeMirror6Editor")&&i.get("codeMirror6Editor").dispatch({changes:{from:0,to:i.get("codeMirror6Editor").state.doc.length,insert:e}});break;case"get":if(i.has("codeMirror5Editor"))return i.get("codeMirror5Editor").getDoc().getValue();if(i.has("codeMirror6Editor"))return i.get("codeMirror6Editor").state.doc.toString();break;case"readonly":i.has("codeMirror5Editor")?i.get("codeMirror5Editor").setOption("readOnly",e):i.has("codeMirror6Editor")&&(e?i.get("codeMirror6Editor").contentDOM.removeAttribute("contenteditable"):i.get("codeMirror6Editor").contentDOM.setAttribute("contenteditable",!0));break;case"refresh":i.has("codeMirror5Editor")&&i.get("codeMirror5Editor").refresh()}}_setCodeView(t){this.#it.get("hasCodeMirror")?this._codeMirrorEditor("set",t,null):this.#K.get("code").value=t}_getCodeView(){return this.#it.get("hasCodeMirror")?this._codeMirrorEditor("get",null,null):this.#K.get("code").value}_codeViewAutoHeight(t,e,s){s&&(t.style.height=t.scrollHeight+"px"),this.#In(e,t)}_scrollLineNumbers(t){t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft}#Bn(){const t=this._getCodeView();if(this.#J.get("iframe_fullPage")){const e=this.#K.get("_wd"),s=(new DOMParser).parseFromString(t,"text/html");if(!this.#Xt.test("script")){const t=s.head.children;for(let e=0,i=t.length;e<i;e++)/^script$/i.test(t[e].tagName)&&(s.head.removeChild(t[e]),e--,i--)}let i=s.head.innerHTML;s.head.querySelector('link[rel="stylesheet"]')&&("auto"!==this.#J.get("height")||s.head.querySelector("style"))||(i+=Mt._setIframeStyleLinks(this.#J.get("iframe_cssFileName"))+Mt._setAutoHeightStyle(this.#J.get("height"))),e.head.innerHTML=i,e.body.innerHTML=this.#X.html.clean(s.body.innerHTML,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#it.get("freeCodeViewMode")});const n=s.body.attributes;for(let t=0,s=n.length;t<s;t++)"contenteditable"!==n[t].name&&e.body.setAttribute(n[t].name,n[t].value);if(!Ht.utils.hasClass(e.body,"sun-editor-editable")){const t=this.#it.get("_editableClass").split(" ");for(let s=0;s<t.length;s++)Ht.utils.addClass(e.body,t[s])}}else this.#K.get("wysiwyg").innerHTML=t.length>0?this.#X.html.clean(t,{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.#it.get("freeCodeViewMode")}):"<"+this.#it.get("defaultLine")+"><br></"+this.#it.get("defaultLine")+">"}#An(){const t=this.#X.html._convertToCode(this.#K.get("wysiwyg"),!1);let e="";if(this.#J.get("iframe_fullPage")){const s=Ht.utils.getAttributesToString(this.#K.get("_wd").body,null);e="<!DOCTYPE html>\n<html>\n"+this.#K.get("_wd").head.outerHTML.replace(/>(?!\n)/g,">\n")+"<body "+s+">\n"+t+"</body>\n</html>"}else e=t;this._setCodeView(e)}#In(t,e){if(!t)return;const s=oi(t),i=Math.ceil(e.scrollHeight/s),n=(t.value.match(/\n/g)||[]).length;if(i>n){let e="";for(let t=n+1;t<=i;t++)e+=`${t}\n`;t.value+=e}}_destroy(){}};const ri=class{$;constructor(t){this.$=t.$}},{isMobile:ai,_w:ci}=Et;function hi(t){const e=Ht.query.getEventTarget(t);let s=e;this.$.store.mode.isBalloon&&!this.$.context.get("toolbar_sub_main")?.contains(s)&&this._hideToolbar_sub();const i=Ht.check.isInputElement(s);if(i?this.$.store.set("_preventBlur",!1):this.$.frameContext.get("wysiwyg").contains(this.$.selection.getNode())||this.$.focusManager.focus(),Ht.query.getParentElement(s,".se-dropdown"))t.stopPropagation(),this.$.ui.preventToolbarHide(!0);else{let n=s.getAttribute("data-command"),o=s.className;for(;s&&!n&&!/(se-menu-list|sun-editor-common|se-menu-tray)/.test(o);)s=s.parentElement,n=s.getAttribute("data-command"),o=s.className;if(i&&/^INPUT$/i.test(s?.getAttribute("data-type"))){if(this.$.store.set("_preventBlur",!0),this._inputFocus=!0,this.$.store.get("hasFocus")||this.applyTagEffect(),!Ht.check.isInputElement(e)||e.disabled)return;const t=this.$.plugins[n];if(!t)return;if(this.__inputBlurEvent&&this.__removeInput(),"function"==typeof t.toolbarInputChange&&(this.__inputPlugin={obj:t,target:e,value:e.value}),this.__inputBlurEvent=this.$.eventManager.addEvent(e,"blur",(s=>{if(!t.isInputActive)try{const i=e.value.trim();"function"==typeof t.toolbarInputChange&&i!==this.__inputPlugin.value&&t.toolbarInputChange({target:e,value:i,event:s})}finally{ci.setTimeout((()=>this._inputFocus=!1),0),this.__removeInput()}})),!t)return;"function"==typeof t.toolbarInputKeyDown&&(this.__inputKeyEvent=this.$.eventManager.addEvent(e,"keydown",(s=>{t.toolbarInputKeyDown({target:e,event:s})})))}else{if(this.__inputBlurEvent&&this.__inputPlugin){const e=this.__inputPlugin.target.value.trim();return e!==this.__inputPlugin.value&&this.__inputPlugin.obj.toolbarInputChange({target:this.__inputPlugin.target,value:e,event:t}),void this.__removeInput()}this.$.frameContext.get("isCodeView")||(ai?this.$.store.set("_preventBlur",!0):(t.preventDefault(),Et.isGecko&&n&&this.$.eventManager._injectActiveEvent(s)))}n!==this.$.menu.currentDropdownName&&n!==this.$.menu.currentContainerName||t.stopPropagation()}}function di(t){const e=Ht.query.getEventTarget(t),s=Ht.query.getCommandTarget(e);if(!s)return;let i=s,n="";for(;i&&!/se-menu-tray/.test(i.className)&&!n;)i=i.parentElement,n=i?.getAttribute("data-key");if(!n)return;const o=this.$.plugins[n];o&&"function"==typeof o.action&&(t.stopPropagation(),o.action(s))}function ui(t){const e=Ht.query.getEventTarget(t);this.$.commandDispatcher.runFromTarget(e)}const{_w:pi}=Et;async function gi(t,e){const s=Ht.query.getEventTarget(e);this.$.store.set("_mousedown",!0),this.__onDownEv&&mi.call(this),this.__onDownEv=this.$.eventManager.addGlobalEvent("mouseup",mi.bind(this)),t.get("isReadOnly")||Ht.check.isNonEditable(t.get("wysiwyg"))||(this.$.format._isExcludeSelectionElement(s)?e.preventDefault():(this._setSelectionSync(),pi.setTimeout(this.$.selection.init.bind(this.$.selection),0),!1!==await this.$.eventManager.triggerEvent("onMouseDown",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onMouseDown",{frameContext:t,event:e})&&(this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),/FIGURE/i.test(s?.nodeName)&&e.preventDefault())))}function mi(){this.$.store.set("_mousedown",!1),this.__onDownEv=this.$.eventManager.removeGlobalEvent(this.__onDownEv)}async function fi(t,e){!1!==await this.$.eventManager.triggerEvent("onMouseUp",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseUp",{frameContext:t,event:e})}async function vi(t,e){const s=Ht.query.getEventTarget(e);if(t.get("isReadOnly"))return e.preventDefault(),Ht.check.isAnchor(s)&&pi.open(s.href,s.target),!1;if(Ht.check.isNonEditable(t.get("wysiwyg")))return;if(!1===await this.$.eventManager.triggerEvent("onClick",{frameContext:t,event:e}))return;if(!1===await this._callPluginEventAsync("onClick",{frameContext:t,event:e}))return;const i=this.$.component.get(s);if(i)return e.preventDefault(),void this.$.component.select(i.target,i.pluginName);if(this.$.selection.init(),3===e.detail){const t=this.$.selection.getRange();this.$.format.isLine(t.endContainer)&&0===t.endOffset&&this.$.selection.setRange(t.startContainer,t.startOffset,t.startContainer,t.startContainer.textContent.length)}const n=this.$.selection.getNode(),o=this.$.format.getLine(n,null),l=this.$.format.getBlock(n,null);if(!o&&!Ht.check.isNonEditable(s)&&!Ht.check.isList(l)){const t=this.$.selection.getRange();if(this.$.format.getLine(t.startContainer)===this.$.format.getLine(t.endContainer))if(Ht.check.isList(l)){e.preventDefault();const t=n.nextElementSibling,s=Ht.utils.createElement("LI",null,n);l.insertBefore(s,t),this.$.focusManager.focus()}else Ht.check.isWysiwygFrame(n)||this.$.component.is(n)||Ht.check.isTableElements(n)&&!Ht.check.isTableCell(n)||null===this._setDefaultLine(this.$.format.isBlock(l)?"DIV":this.$.options.get("defaultLine"))||(e.preventDefault(),this.$.focusManager.focus())}this.$.commandDispatcher._copyFormat(),(this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&pi.setTimeout(this._toggleToolbarBalloon.bind(this),0)}function bi(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return!1;const s=Ht.query.getEventTarget(e);!1!==os.get("__overInfo")&&this.$.component.hoverSelect(s),this._callPluginEvent("onMouseMove",{frameContext:t,event:e})}async function yi(t,e){!1!==await this.$.eventManager.triggerEvent("onMouseLeave",{frameContext:t,event:e})&&await this._callPluginEventAsync("onMouseLeave",{frameContext:t,event:e})}async function Ci(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const s=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(Nt.isComposing(e))this._handledInBefore=!1;else{if(!this.$.char.test(s,!1))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!0}!1!==await this.$.eventManager.triggerEvent("onBeforeInput",{frameContext:t,event:e,data:s})&&await this._callPluginEventAsync("onBeforeInput",{frameContext:t,event:e,data:s})}async function wi(t,e){if(t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),e.stopPropagation(),!1;const s=this.$.selection.getRange(),i=this.$.selection.getNode(),n=this.$.format.getLine(i,null);if(!this.$.format.isNormalLine(n)&&!this.$.format.isBrLine(n)&&s.collapsed&&!this.$.component.is(i)&&!Ht.check.isList(i)){const t=this.$.format.getBlock(i,null);this._setDefaultLine(this.$.format.isBlock(t)?"DIV":this.$.options.get("defaultLine"))}this.$.selection.init();const o=(null===e.data?"":void 0===e.data?" ":e.data)||"";if(!this._handledInBefore&&!this.$.char.test(o,!0))return e.preventDefault(),e.stopPropagation(),!1;this._handledInBefore=!1,!1!==await this.$.eventManager.triggerEvent("onInput",{frameContext:t,event:e,data:o})&&(await this._callPluginEventAsync("onInput",{frameContext:t,event:e,data:o}),this.$.history.push(!0))}const _i={"event.prevent":({ctx:t})=>t.e.preventDefault(),"event.stop":({ctx:t})=>t.e.stopPropagation(),"event.prevent.stop":({ctx:t})=>{t.e.preventDefault(),t.e.stopPropagation()},"cache.styleNode":({ports:t})=>t.styleNodeCache(),"cache.formatAttrsTemp":({ports:t},{attrs:e})=>t.formatAttrsTempCache(e),"focusManager.nativeFocus":({ports:t})=>t.focusManager.nativeFocus(),"history.push":({ports:t},e)=>t.history.push(e),"documentType.refreshHeader":({ctx:t})=>{o.setTimeout((()=>{t.fc.get("documentType").reHeader()}),0)},"component.deselect":({ports:t})=>t.component.deselect(),"selection.setRange":({ports:t},{sc:e,so:s,ec:i,eo:n})=>t.selection.setRange(e,s,i,n),"format.removeBlock":({ports:t},{rangeEl:e,selectedFormats:s,newBlockElement:i,shouldDelete:n,skipHistory:o})=>t.format.removeBlock(e,{selectedFormats:s,newBlockElement:i,shouldDelete:n,skipHistory:o}),"dom.utils.removeItem":(t,{item:e})=>Ht.utils.removeItem(e),"select.component.fallback":({ports:t},{cmponentInfo:e})=>{!1===t.component.select(e.target,e.pluginName)&&t.focusManager.blur()}},xi={"del.format.removeAndMove":({ports:t},{container:e,formatEl:s})=>{const i=t.html.remove();if(i.commonCon!==i.container&&s.parentElement)if(s.contains(e)){const e=function(t){const e=t.lastChild,s=t.nextElementSibling;if(!s)return e;if(Ht.check.isZeroWidth(s))return Ht.utils.removeItem(s),e;const i=s.childNodes;for(;i[0];)t.appendChild(i[0]);return Ht.utils.removeItem(s),e}(s);t.selection.setRange(e,e.textContent.length,e,e.textContent.length)}else{const{focusNode:e,focusOffset:i}=function(t){const e=t.childNodes,s=t.previousElementSibling;let i=e[0],n=0;if(!s)return{focusNode:i,focusOffset:n};if(Ht.check.isZeroWidth(s))return Ht.utils.removeItem(s),{focusNode:i,focusOffset:n};if(e.length>1||e[0]?.textContent.length>0)for(;e[0];)s.appendChild(e[0]);else i=s.lastChild,n=i.textContent.length;return Ht.utils.removeItem(t),{focusNode:i,focusOffset:n}}(s);t.selection.setRange(e,i,e,i)}},"backspace.format.maintain":({ctx:t},{formatEl:e})=>{if(e.nodeName.toUpperCase()===t.options.get("defaultLine").toUpperCase()){e.innerHTML="<br>";const t=e.attributes;for(;t[0];)e.removeAttribute(t[0].name)}else e.parentNode.replaceChild(Ht.utils.createElement(t.options.get("defaultLine"),null,"<br>"),e)},"backspace.component.select":({ports:t},{selectionNode:e,range:s,fileComponentInfo:i})=>{let n=null;Ht.check.isBreak(e)?Ht.utils.removeItem(e):Ht.check.isBreak(n=s.startContainer.childNodes?.[s.startOffset])&&Ht.utils.removeItem(n),!1===t.component.select(i.target,i.pluginName)&&t.focusManager.blur()},"backspace.component.remove":({ports:t},{isList:e,sel:s,formatEl:i,fileComponentInfo:n})=>{e&&Ht.utils.removeItem(s),0===i.textContent.length&&Ht.utils.removeItem(i),!1===t.component.select(n.target,n.pluginName)&&t.focusManager.blur()},"backspace.list.mergePrev":({ports:t},{prev:e,formatEl:s,rangeEl:i})=>{let n=e===i.parentNode?i.previousSibling:e.lastChild;n||(n=Ht.utils.createTextNode(Tt.zeroWidthSpace),i.parentNode.insertBefore(n,i.parentNode.firstChild));const o=3===n.nodeType?n.textContent.length:1,l=s.childNodes;let r=n,a=l[0];for(;a=l[0];)e.insertBefore(a,r.nextSibling),r=a;Ht.utils.removeItem(s),0===i.children.length&&Ht.utils.removeItem(i),t.selection.setRange(n,o,n,o)},"backspace.list.removeNested":({ports:t},{range:e})=>{t.html.remove(),3===e.startContainer.nodeType&&t.selection.setRange(e.startContainer,e.startContainer.textContent.length,e.startContainer,e.startContainer.textContent.length)},"delete.component.select":({ports:t},{formatEl:e,fileComponentInfo:s})=>{if(Ht.check.isListCell(e)){const t=s.container.previousSibling;Ht.check.isZeroWidth(t)&&Ht.utils.removeItem(t)}else Ht.check.isZeroWidth(e)&&Ht.utils.removeItem(e);!1===t.component.select(s.target,s.pluginName)&&t.focusManager.blur()},"delete.component.selectNext":({ports:t,ctx:e},{formatEl:s,nextEl:i})=>{if(Ht.check.isZeroWidth(s)&&(Ht.utils.removeItem(s),Ht.check.isTable(i))){let e=Ht.query.getEdgeChild(i,Ht.check.isTableCell,!1);return e=e.firstElementChild||e,void t.selection.setRange(e,0,e,0)}const n=t.component.get(i);n?(e.e.stopPropagation(),!1===t.component.select(n.target,n.pluginName)&&t.focusManager.blur()):t.component.is(i)&&(e.e.stopPropagation(),Ht.utils.removeItem(i))},"delete.list.removeNested":({ports:t,ctx:e},{range:s,formatEl:i,rangeEl:n})=>{s.startContainer!==s.endContainer&&t.html.remove();const o=Ht.utils.arrayFind(i.children,Ht.check.isList)||i.nextElementSibling||n.parentElement.nextElementSibling;if(o&&(Ht.check.isList(o)||Ht.utils.arrayFind(o.children,Ht.check.isList))){let s,n;if(e.e.preventDefault(),Ht.check.isList(o)){const t=o.firstElementChild;for(n=t.childNodes,s=n[0];n[0];)i.insertBefore(n[0],o);Ht.utils.removeItem(t)}else{for(s=o.firstChild,n=o.childNodes;n[0];)i.appendChild(n[0]);Ht.utils.removeItem(o)}t.selection.setRange(s,0,s,0),t.history.push(!0)}},"tab.format.indent":({ports:t,ctx:e},{range:s,formatEl:i,shift:n})=>{const o=t.format.getLines(null),l=[],r=[],a=Ht.check.isListCell(o[0]),c=Ht.check.isListCell(o.at(-1));let h={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};for(let t,e=0,s=o.length;e<s;e++)if(t=o[e],Ht.check.isListCell(t)){if(!t.previousElementSibling&&!n)continue;l.push(t)}else r.push(t);if(l.length>0&&(h=t.listFormat.applyNested(l,n)),r.length>0)if(n){const t=r.length-1;for(let e,s=0;s<=t;s++){e=r[s].childNodes;for(let t,s=0,i=e.length;s<i&&(t=e[s],t);s++)if(!Ht.check.isZeroWidth(t)){/^\s{1,4}$/.test(t.textContent)?Ht.utils.removeItem(t):/^\s{1,4}/.test(t.textContent)&&(t.textContent=t.textContent.replace(/^\s{1,4}/,""));break}}const e=Ht.query.getEdgeChild(r[0],"text",!1),s=Ht.query.getEdgeChild(r[t],"text",!0);!a&&e&&(h.sc=e,h.so=0),!c&&s&&(h.ec=s,h.eo=s.textContent.length)}else if(1===r.length){let n=e.store.get("tabSize")+1;if(e.options.get("syncTabIndent")){const e=Ht.query.findTextIndexOnLine(i,s.startContainer,s.startOffset,(e=>t.component.is(e))),o=t.format.isLine(i.previousElementSibling)?Ht.query.findTabEndIndex(i.previousElementSibling,e,2):0;o>e&&(n=o-e)}const o=Ht.utils.createTextNode(new Array(n).join(" "));if(!t.html.insertNode(o,{afterNode:null,skipCharCount:!1}))return!1;a||(h.sc=o,h.so=o.length),c||(h.ec=o,h.eo=o.length)}else{const t=Ht.utils.createTextNode(new Array(e.store.get("tabSize")+1).join(" ")),s=r.length-1;for(let e,i=0;i<=s;i++)e=r[i].firstChild,e&&(Ht.check.isBreak(e)?r[i].insertBefore(t.cloneNode(!1),e):e.textContent=t.textContent+e.textContent);const i=Ht.query.getEdgeChild(r[0],"text",!1),n=Ht.query.getEdgeChild(r[s],"text",!0);!a&&i&&(h.sc=i,h.so=0),!c&&n&&(h.ec=n,h.eo=n.textContent.length)}t.selection.setRange(h.sc,h.so,h.ec,h.eo)},"enter.scrollTo":({ports:t},{range:e})=>{t.enterScrollTo(e)},"enter.line.addDefault":({ports:t,ctx:e},{formatEl:s})=>{const i=t.format.addLine(s,e.options.get("defaultLine")).firstChild;if(Ht.check.isBreak(i)){const e=Ht.utils.createTextNode(Tt.zeroWidthSpace);i.parentNode.insertBefore(e,i),t.selection.setRange(e,1,e,1)}else t.selection.setRange(i,0,i,0)},"enter.list.addItem":({ports:t},{formatEl:e,selectionNode:s})=>{const i=Ht.utils.createElement("BR"),n=Ht.utils.createElement("LI",null,i);e.parentNode.insertBefore(n,e.nextElementSibling),n.appendChild(s.nextSibling),t.selection.setRange(i,1,i,1)},"enter.format.exitEmpty":({ports:t,ctx:e},{formatEl:s,rangeEl:i})=>{let n=null;if(Ht.check.isListCell(i.parentElement)){const t=s.parentNode.parentElement;i=t.parentElement;const o=Ht.utils.createElement("LI");o.innerHTML="<br>",Ht.utils.copyTagAttributes(o,s,e.options.get("lineAttrReset")),n=o,i.insertBefore(n,t.nextElementSibling)}else{let o;o=Ht.check.isTableCell(i.parentElement)?"DIV":Ht.check.isList(i.parentElement)?"LI":t.format.isLine(i.nextElementSibling)?i.nextElementSibling.nodeName:t.format.isLine(i.previousElementSibling)?i.previousElementSibling.nodeName:e.options.get("defaultLine"),n=Ht.utils.createElement(o);const l=t.format.removeBlock(i,{selectedFormats:[s],newBlockElement:null,shouldDelete:!0,skipHistory:!0});l.cc.insertBefore(n,l.ec)}n.innerHTML="<br>",t.nodeTransform.removeAllParents(s,null,null),t.selection.setRange(n,1,n,1)},"enter.format.cleanBrAndZWS":({ports:t},{selectionNode:e,selectionFormat:s,brBlock:i,children:n,offset:o})=>{s?Ht.utils.removeItem(n[o-1]):Ht.utils.removeItem(e);const l=i.nextElementSibling,r=t.format.addLine(i,t.format.isLine(l)?l:null);Ht.utils.copyFormatAttributes(r,i),t.selection.setRange(r,1,r,1)},"enter.format.insertBrHtml":({ports:t},{brBlock:e,range:s,wSelection:i,offset:n})=>{t.html.insert(s.collapsed&&Ht.check.isBreak(s.startContainer.childNodes[s.startOffset-1])?"<br>":"<br><br>",{selectInserted:!1,skipCharCount:!0,skipCleaning:!0});let o=i.focusNode;const l=i.focusOffset;e===o&&(o=o.childNodes[l-n>1?l-1:l]),t.selection.setRange(o,1,o,1),t.setOnShortcutKey(!0)},"enter.format.insertBrNode":({ports:t},{wSelection:e})=>{const s=e.focusNode.nextSibling,i=Ht.utils.createElement("BR");t.html.insertNode(i,{afterNode:null,skipCharCount:!0});const n=i.previousSibling,o=i.nextSibling;Ht.check.isBreak(s)||Ht.check.isBreak(n)||o&&!Ht.check.isZeroWidth(o)?t.selection.setRange(o,0,o,0):(i.parentNode.insertBefore(i.cloneNode(!1),i),t.selection.setRange(i,1,i,1)),t.setOnShortcutKey(!0)},"enter.format.breakAtEdge":({ports:t,ctx:e},{formatEl:s,selectionNode:i,formatStartEdge:n,formatEndEdge:o})=>{const l=Ht.utils.createElement("BR"),r=Ht.utils.createElement(s.nodeName,null,l);Ht.utils.copyTagAttributes(r,s,e.options.get("lineAttrReset"));let a=l,c=i;do{if(!Ht.check.isBreak(c)&&1===c.nodeType){const t=c.cloneNode(!1);t.appendChild(a),a=t}c=c.parentElement}while(s!==c&&s.contains(c));if(r.appendChild(a),s.parentNode.insertBefore(r,n&&!o?s:s.nextElementSibling),o)t.selection.setRange(l,1,l,1);else{const e=s.firstChild||s;t.selection.setRange(e,0,e,0)}},"enter.format.breakWithSelection":({ports:t,ctx:e},{formatEl:s,range:i,formatStartEdge:n,formatEndEdge:o})=>{const l=t.format.getLine(i.startContainer,null)!==t.format.getLine(i.endContainer,null),r=s.cloneNode(!1);r.innerHTML="<br>";const a=i.commonAncestorContainer,c=a===i.startContainer&&a===i.endContainer&&Ht.check.isZeroWidth(a)?{container:a,offset:i.endOffset,prevContainer:a.previousElementSibling,commonCon:a}:t.html.remove();let h=t.format.getLine(c.container,null),d=0;if(!h)return void(Ht.check.isWysiwygFrame(c.container)&&(t.enterPrevent(e.e),e.fc.get("wysiwyg").appendChild(r),h=r,Ht.utils.copyTagAttributes(h,s,e.options.get("lineAttrReset")),t.selection.setRange(h,d,h,d)));const u=t.format.getBlock(c.container);if(h=h.contains(u)?Ht.query.getEdgeChild(u,(e=>Boolean(t.format.getLine(e))),!1):h,l){if(o&&!n)h.parentNode.insertBefore(r,c.prevContainer&&c.container!==c.prevContainer?h:h.nextElementSibling),h=r,d=0;else if(d=c.offset,n){const t=h.parentNode.insertBefore(r,h);o&&(h=t,d=0)}}else o&&n?(h.parentNode.insertBefore(r,c.prevContainer&&c.container===c.prevContainer?h.nextElementSibling:h),h=r,d=0):o?(h=h.parentNode.insertBefore(r,h.nextElementSibling),h=r,d=0):h=t.nodeTransform.split(c.container,c.offset,Ht.query.getNodeDepth(s));t.enterPrevent(e.e),Ht.utils.copyTagAttributes(h,s,e.options.get("lineAttrReset")),t.selection.setRange(h,d,h,d)},"enter.format.breakAtCursor":({ports:t,ctx:e},{formatEl:s,range:i})=>{let n=null;n=Ht.check.isZeroWidth(s)?t.format.addLine(s,s.cloneNode(!1)):t.nodeTransform.split(i.endContainer,i.endOffset,Ht.query.getNodeDepth(s)),t.enterPrevent(e.e),Ht.utils.copyTagAttributes(n,s,e.options.get("lineAttrReset")),t.selection.setRange(n,0,n,0)},"enter.figcaption.exitInList":({ports:t},{formatEl:e})=>{const s=t.format.addLine(e,null);t.selection.setRange(s,0,s,0)},"keydown.input.insertNbsp":({ports:t})=>{const e=t.html.insertNode(Ht.utils.createTextNode(" "),{afterNode:null,skipCharCount:!0});e&&t.selection.setRange(e,e.length,e,e.length)},"keydown.input.insertZWS":({ports:t})=>{const e=Ht.utils.createTextNode(Tt.zeroWidthSpace);t.html.insertNode(e,{afterNode:null,skipCharCount:!0}),t.selection.setRange(e,1,e,1)}};function $i(t){const e=t.selection.getRange(),s=e.startContainer,i=e.endContainer,n=t.format.getBlock(s),o=t.format.getBlock(i),l=Ht.check.isTableCell(n),r=Ht.check.isTableCell(o);if((l&&!n.previousElementSibling&&!n.parentElement.previousElementSibling||r&&!o.nextElementSibling&&!o.parentElement.nextElementSibling)&&n!==o){const s=Ht.query.getParentElement(e.commonAncestorContainer,Ht.check.isFigure)?.parentElement||e.commonAncestorContainer;if(l){if(r)return Ht.utils.removeItem(Ht.query.getParentElement(n,(t=>s===t.parentNode))),t.focusManager.nativeFocus(),!0;Ht.utils.removeItem(Ht.query.getParentElement(n,(t=>s===t.parentNode)))}else Ht.utils.removeItem(Ht.query.getParentElement(o,(t=>s===t.parentNode)))}const a=1===s.nodeType?Ht.query.getParentElement(s,".se-component"):null,c=1===i.nodeType?Ht.query.getParentElement(i,".se-component"):null;return a&&Ht.utils.removeItem(a),c&&Ht.utils.removeItem(c),!1}function Si(t,e,s){const i=s?e.startContainer:e.endContainer,n=s?e.startOffset:e.endOffset,o=s?"previousSibling":"nextSibling";let l;return 1===i.nodeType?(l=ki(t,i.childNodes[n],o,i),Ht.check.isComponentContainer(l)||Ht.check.isNonEditable(l)?l:null):(l=ki(t,i,o,i),Ht.check.isEdgePoint(i,n,s?"front":"end")&&(Ht.check.isComponentContainer(l)||Ht.check.isNonEditable(l))?l:null)}function ki(t,e,s,i){if(!e)return null;let n=e[s];if(!n){if(n=t.format.getLine(i),n=n?n[s]:null,!n||t.component.is(n))return null;n="previousSibling"===s?n.firstChild:n.lastChild}return n}const Ei=()=>({t:"event.prevent"}),Ti=()=>({t:"event.prevent.stop"}),Mi=()=>({t:"cache.styleNode"}),Hi=t=>({t:"cache.formatAttrsTemp",p:{attrs:t}}),Li=()=>({t:"component.deselect"}),Ni=()=>({t:"focusManager.nativeFocus"}),Ai=t=>({t:"history.push",p:t}),Bi=()=>({t:"documentType.refreshHeader"}),Ii=(t,e,s,i,n)=>({t:"format.removeBlock",p:{rangeEl:t,selectedFormats:e,newBlockElement:s,shouldDelete:i,skipHistory:n}}),Vi=t=>({t:"dom.utils.removeItem",p:{item:t}}),Oi=t=>({t:"select.component.fallback",p:{cmponentInfo:t}}),Ri=(t,e)=>({t:"del.format.removeAndMove",p:{container:t,formatEl:e}}),zi=t=>({t:"backspace.format.maintain",p:{formatEl:t}}),Fi=(t,e,s)=>({t:"backspace.component.select",p:{selectionNode:t,range:e,fileComponentInfo:s}}),Pi=(t,e,s,i)=>({t:"backspace.component.remove",p:{isList:t,sel:e,formatEl:s,fileComponentInfo:i}}),Di=(t,e,s)=>({t:"backspace.list.mergePrev",p:{prev:t,formatEl:e,rangeEl:s}}),qi=t=>({t:"backspace.list.removeNested",p:{range:t}}),Wi=(t,e)=>({t:"delete.component.select",p:{formatEl:t,fileComponentInfo:e}}),Ui=(t,e)=>({t:"delete.component.selectNext",p:{formatEl:t,nextEl:e}}),Gi=(t,e,s)=>({t:"delete.list.removeNested",p:{range:t,formatEl:e,rangeEl:s}}),Zi=(t,e,s)=>({t:"tab.format.indent",p:{range:t,formatEl:e,shift:s}}),ji=t=>({t:"enter.scrollTo",p:{range:t}}),Ki=t=>({t:"enter.line.addDefault",p:{formatEl:t}}),Yi=(t,e)=>({t:"enter.list.addItem",p:{formatEl:t,selectionNode:e}}),Xi=(t,e)=>({t:"enter.format.exitEmpty",p:{formatEl:t,rangeEl:e}}),Ji=(t,e,s,i,n)=>({t:"enter.format.cleanBrAndZWS",p:{selectionNode:t,selectionFormat:e,brBlock:s,children:i,offset:n}}),Qi=(t,e,s,i)=>({t:"enter.format.insertBrHtml",p:{brBlock:t,range:e,wSelection:s,offset:i}}),tn=t=>({t:"enter.format.insertBrNode",p:{wSelection:t}}),en=(t,e,s,i)=>({t:"enter.format.breakAtEdge",p:{formatEl:t,selectionNode:e,formatStartEdge:s,formatEndEdge:i}}),sn=(t,e,s,i)=>({t:"enter.format.breakWithSelection",p:{formatEl:t,range:e,formatStartEdge:s,formatEndEdge:i}}),nn=(t,e)=>({t:"enter.format.breakAtCursor",p:{formatEl:t,range:e}}),on=t=>({t:"enter.figcaption.exitInList",p:{formatEl:t}}),ln=()=>({t:"keydown.input.insertNbsp"}),rn=()=>({t:"keydown.input.insertZWS"});function an(t,e,s){const{format:i,component:n}=e,{fc:o,options:l,range:r,selectionNode:a}=s;let{formatEl:c}=s;const h=!r.collapsed||r.startContainer!==r.endContainer;if(t.push(Li()),t.push(Mi()),h&&$i(e))return t.push(Ti()),!0;if(!(i.isNormalLine(c)||i.isBrLine(c)||o.get("wysiwyg").firstElementChild||n.is(a)||null===function(t,e){return t.setDefaultLine(e)}(e,l.get("defaultLine"))))return t.push(Ti()),!1;if(i.isLine(c)&&h&&Ht.check.isEdgePoint(r.startContainer,r.startOffset,"front")&&(!r.startContainer.previousSibling||Ht.check.isZeroWidth(r.startContainer.previousSibling))&&i.getLine(r.startContainer)!==i.getLine(r.endContainer)&&(i.isLine(c.previousElementSibling)||Ht.check.isListCell(c)))return t.push(Ti()),t.push(Ri(r.startContainer,c)),t.push(Ai(!0)),!1;if(!h&&!c.previousElementSibling&&0===r.startOffset&&!a.previousSibling&&!Ht.check.isListCell(c)&&i.isLine(c)&&(!i.isBrLine(c)||i.isClosureBrLine(c)))return i.isClosureBlock(c.parentNode)?(t.push(Ti()),!1):(Ht.check.isWysiwygFrame(c.parentNode)&&c.childNodes.length<=1&&(!c.firstChild||Ht.check.isZeroWidth(c.textContent))&&(t.push(Ti()),t.push(zi(c))),t.push(Ni()),!1);const d=r.startContainer;if(c&&!c.previousElementSibling&&0===r.startOffset&&3===d.nodeType&&Ht.check.isZeroWidth(d)&&!0===function(t,e,s){let i=e.parentNode.previousSibling;const n=e.parentNode.nextSibling;i||(n?i=n:(i=Ht.utils.createElement("BR"),s.appendChild(i)));let o=e;for(;s.contains(o)&&!o.previousSibling;)o=o.parentNode;if(!s.contains(o))return e.textContent="",t.nodeTransform.removeAllParents(e,null,s),!0}(e,d,c))return!0;if(!h&&c&&(0===r.startOffset||a===c)){const s=a===c?Si(e,r,!0):Ht.check.isElement(a.previousSibling)?a.previousSibling:Ht.check.isEdgePoint(r.startContainer,r.startOffset)?Ht.query.getPreviousDeepestNode(r.startContainer):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(Ti()),t.push(Fi(a,r,e)),!0}}if(Si(e,r,!0))return t.push(Ti()),!0;!h&&i.isEdgeLine(r.startContainer,r.startOffset,"front")&&i.isLine(c.previousElementSibling)&&t.push(Hi(c.previousElementSibling.attributes)),c=i.getLine(r.startContainer,null);const u=i.getBlock(c,null),p=r.commonAncestorContainer;if(u&&c&&!Ht.check.isTableCell(u)&&!/^FIGCAPTION$/i.test(u.nodeName)){if(Ht.check.isListCell(c)&&Ht.check.isList(u)&&(Ht.check.isListCell(u.parentElement)||c.previousElementSibling)&&(a===c||3===a.nodeType&&(!a.previousSibling||Ht.check.isList(a.previousSibling)))&&(i.getLine(r.startContainer,null)!==i.getLine(r.endContainer,null)?u.contains(r.startContainer):0===r.startOffset&&r.collapsed)){if(r.startContainer!==r.endContainer)t.push(Ei()),t.push(qi(r)),t.push(Ai(!0));else{let e=c.previousElementSibling||u.parentElement;if(Ht.check.isListCell(e)){t.push(Ei());let s=e;if(!e.contains(c)&&Ht.check.isListCell(s)&&Ht.check.isList(s.lastElementChild)){for(s=s.lastElementChild.lastElementChild;Ht.check.isListCell(s)&&Ht.check.isList(s.lastElementChild);)s=s.lastElementChild&&s.lastElementChild.lastElementChild;e=s}t.push(Di(e,c,u)),t.push(Ai(!0))}}return!0}if(!h&&0===r.startOffset){let e=!0,s=p;for(;s&&s!==u&&!Ht.check.isWysiwygFrame(s);){if(s.previousSibling&&(1===s.previousSibling.nodeType||!Ht.check.isZeroWidth(s.previousSibling.textContent.trim()))){e=!1;break}s=s.parentNode}if(e&&u.parentNode)return t.push(Ei()),t.push(Ii(u,Ht.check.isListCell(c)?[c]:null,null,!1,!1)),t.push(Ai(!0)),!0}}if(!h&&c&&(0===r.startOffset||a===c&&c.childNodes[r.startOffset])){const e=Ht.check.isListCell(c),s=a===c?c.childNodes[r.startOffset]:a,i=(e?s:c).previousSibling,o=e||(3===p.nodeType||Ht.check.isBreak(p))&&!p.previousSibling&&0===r.startOffset;if(s&&(e||!s.previousSibling)&&(p&&n.is(p.previousSibling)||o&&n.is(i))){const o=n.get(i);return o?(t.push(Ti()),t.push(Pi(e,s,c,o))):n.is(i)&&(t.push(Ti()),t.push(Vi(i))),!0}if(s&&Ht.check.isNonEditable(s.previousSibling))return t.push(Ti()),t.push(Vi(s.previousSibling)),!0}return!0}const{isOSX_IOS:cn}=Et;async function hn(t,e){const s=[];switch(e.keyCode){case"Backspace":if(!1===an(s,t,e))return s;break;case"Delete":if(!1===function(t,e,s){const{format:i,component:n}=e,{range:o,selectionNode:l}=s;let{formatEl:r}=s;const a=!o.collapsed||o.startContainer!==o.endContainer;if(t.push(Li()),t.push(Mi()),a&&$i(e))return t.push(Ti()),!0;if(!a&&i.isEdgeLine(o.endContainer,o.endOffset,"end")&&!r.nextSibling)return t.push(Ti()),!1;if(i.isLine(r)&&a&&Ht.check.isEdgePoint(o.endContainer,o.endOffset,"end")&&(!o.endContainer.nextSibling||Ht.check.isZeroWidth(o.endContainer.nextSibling))&&i.getLine(o.startContainer)!==i.getLine(o.endContainer)&&(i.isLine(r.nextElementSibling)||Ht.check.isListCell(r)))return t.push(Ti()),t.push(Ri(o.endContainer,r)),t.push(Ai(!0)),!1;if(!a&&r&&(o.endOffset===o.endContainer.textContent.length||l===r)){const s=l===r?Si(e,o,!1):Ht.check.isElement(l.nextSibling)?l.nextSibling:Ht.check.isEdgePoint(o.endContainer,o.endOffset)?Ht.query.getNextDeepestNode(o.endContainer,null):null;if(n.is(s)){const e=n.get(s);if(e)return t.push(Ti()),t.push(Wi(r,e)),!0}}if(Si(e,o,!1))return t.push(Ti()),!0;if((i.isLine(l)||null===l.nextSibling||Ht.check.isZeroWidth(l.nextSibling)&&null===l.nextSibling.nextSibling)&&o.startOffset===l.textContent.length){const e=r.nextElementSibling;if(!e)return!0;if(n.is(e))return t.push(Ei()),t.push(Ui(r,e)),!0}if(!a&&(Ht.check.isEdgePoint(o.endContainer,o.endOffset)||l===r&&r.childNodes[o.startOffset])){const e=l===r&&r.childNodes[o.startOffset]||l;if(e&&Ht.check.isNonEditable(e.nextSibling))return t.push(Ti()),t.push(Vi(e.nextSibling)),!0;if(n.is(e))return t.push(Ti()),t.push(Vi(e)),!0}!a&&i.isEdgeLine(o.endContainer,o.endOffset,"end")&&i.isLine(r.nextElementSibling)&&t.push(Hi(r.attributes)),r=i.getLine(o.startContainer,null);const c=i.getBlock(r,null);return!(Ht.check.isListCell(r)&&Ht.check.isList(c)&&(l===r||3===l.nodeType&&(!l.nextSibling||Ht.check.isList(l.nextSibling))&&(i.getLine(o.startContainer,null)!==i.getLine(o.endContainer,null)?c.contains(o.endContainer):o.endOffset===l.textContent.length&&o.collapsed))&&(t.push(Gi(o,r,c)),0))}(s,t,e))return s;break;case"Tab":if(!1===function(t,e,s){const{options:i,selectionNode:n,range:o,formatEl:l,ctrl:r,alt:a,shift:c}=s;return!!i.get("tabDisable")||(t.push(Ei()),r||a||Ht.check.isWysiwygFrame(n)||(t.push(Zi(o,l,c)),t.push(Ai(!1))),!0)}(s,0,e))return s;break;case"Enter":if(!1===function(t,e,s){const{format:i,char:n,selection:o}=e,{frameOptions:l,range:r,formatEl:a,selectionNode:c,shift:h,e:d}=s,u=!r.collapsed||r.startContainer!==r.endContainer;t.push(Li());const p=i.getBrLine(c,null),g=i.getBlock(a,null);if("byte-html"===l.get("charCounter_type")){let e="";if(e=!h&&p||h?"<br>":"<"+a.nodeName+"><br></"+a.nodeName+">",!n.check(e))return t.push(Ei()),!1}if(!h){const s=!r.endContainer.nextSibling&&i.isEdgeLine(r.endContainer,r.endOffset,"end"),n=!r.startContainer.previousSibling&&i.isEdgeLine(r.startContainer,r.startOffset,"front");if(s&&(/^H[1-6]$/i.test(a.nodeName)||/^HR$/i.test(a.nodeName)))return e.enterPrevent(d),t.push(Ki(a)),t.push(ji(r)),!0;if(g&&a&&!Ht.check.isTableCell(g)&&!/^FIGCAPTION$/i.test(g.nodeName)){const s=o.getRange();if(Ht.check.isEdgePoint(s.endContainer,s.endOffset)&&Ht.check.isList(c.nextSibling))return e.enterPrevent(d),t.push(Yi(a,c)),t.push(ji(r)),!0;if((3!==s.commonAncestorContainer.nodeType||!s.commonAncestorContainer.nextElementSibling)&&Ht.check.isZeroWidth(a.innerText.trim())&&!Ht.check.isListCell(a.nextElementSibling))return e.enterPrevent(d),t.push(Xi(a,g)),!0}if(p||g===a&&i.isClosureBlock(g)&&i.isLine(a)){e.enterPrevent(d);const s=c===p,n=o.get(),l=c.childNodes,a=n.focusOffset,h=c.previousElementSibling,u=c.nextSibling;return!i.isClosureBrLine(p)&&l&&(s&&r.collapsed&&l.length-1<=a+1&&Ht.check.isBreak(l[a])&&(!l[a+1]||(!l[a+2]||Ht.check.isZeroWidth(l[a+2].textContent))&&3===l[a+1].nodeType&&Ht.check.isZeroWidth(l[a+1].textContent))&&a>0&&Ht.check.isBreak(l[a-1])||!s&&Ht.check.isZeroWidth(c.textContent)&&Ht.check.isBreak(h)&&(Ht.check.isBreak(h.previousSibling)||!Ht.check.isZeroWidth(h.previousSibling?.textContent))&&(!u||!Ht.check.isBreak(u)&&Ht.check.isZeroWidth(u.textContent)))?(t.push(Ji(c,s,p,l,a)),t.push(ji(r)),!0):(s?t.push(Qi(p,r,n,a)):t.push(tn(n)),t.push(ji(r)),!0)}if(r.collapsed&&(n||s))return e.enterPrevent(d),t.push(en(a,c,n,s)),t.push(ji(r)),!0;if(a)return t.push(Ei()),u?t.push(sn(a,r,n,s)):t.push(nn(a,r)),t.push(ji(r)),!0}return u?(t.push(ji(r)),!0):(g&&Ht.query.getParentElement(g,"FIGCAPTION")&&Ht.query.getParentElement(g,Ht.check.isList)&&(e.enterPrevent(d),t.push(on(a)),t.push(ji(r))),!0)}(s,t,e))return s}const{fc:i,keyCode:n,shift:o,alt:l,ctrl:r,range:a}=e;if(o&&(cn?l:r)&&Nt.isSpace(n))return s.push(Ti()),s.push(ln()),s;const c=!a.collapsed||a.startContainer!==a.endContainer;return r||l||c||Nt.isNonTextKey(n)||!Ht.check.isBreak(a.commonAncestorContainer)?!i.has("documentType_use_header")||!c||r||l||o||Nt.isDirectionKey(n)?(function(t,e,s){const{component:i}=e,{formatEl:n,range:o,selectionNode:l,keyCode:r}=s;let a=null;switch(r){case"ArrowUp":i.is(n.previousElementSibling)&&(a=i.get(n.previousElementSibling));break;case"ArrowLeft":if(Ht.check.isEdgePoint(l,o.startOffset,"front")){const t=l.previousElementSibling||Ht.query.getPreviousDeepestNode(l);t?i.is(t)&&(a=i.get(t)):i.is(n.previousElementSibling)&&(a=i.get(n.previousElementSibling))}break;case"ArrowDown":i.is(n.nextElementSibling)&&(a=i.get(n.nextElementSibling));break;case"ArrowRight":if(Ht.check.isEdgePoint(l,o.endOffset,"end")){const t=l.nextElementSibling||Ht.query.getNextDeepestNode(l);t?i.is(t)&&(a=i.get(t)):i.is(n.nextElementSibling)&&(a=i.get(n.nextElementSibling))}}a&&!a.options?.isInputComponent&&(t.push(Ei()),t.push(Oi(a)))}(s,t,e),s):(s.push(Bi()),s):(s.push(rn()),s)}const{_w:dn}=Et,un=new RegExp(Tt.zeroWidthSpace+"+",""),pn={ctrl:!1,alt:!1},gn=Object.preventExtensions({value:[]});async function mn(t,e){if(this.isComposing=Nt.isComposing(e))return!0;if(this.$.ui.selectMenuOn||!e.isTrusted)return;let s=this.$.selection.getNode();if(Ht.check.isInputElement(s))return;if(this.$.menu.currentDropdownName)return;const i=e.code,n=Nt.isShift(e),o=pn.ctrl=Nt.isCtrl(e),l=pn.alt=Nt.isAlt(e);if(!o&&t.get("isReadOnly")&&!Nt.isDirectionKey(i))return e.preventDefault(),!1;if(this.$.menu.dropdownOff(),this.$.store.mode.isBalloon?this._hideToolbar():this.$.store.mode.isSubBalloon&&this._hideToolbar_sub(),!1===await this.$.eventManager.triggerEvent("onKeyDown",{frameContext:t,event:e}))return;Nt.isEnter(i)&&this.$.format.isLine(this.$.selection.getRange()?.startContainer)&&(this.$.selection.resetRangeToTextNode(),s=this.$.selection.getNode());const r=this.$.selection.getRange(),a=this.$.format.getLine(s,null)||s;if(o&&!Nt.isNonTextKey(i)&&this.$.shortcuts.command(e,o,n,i,"",!1,null,null))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1;if(!o&&!Nt.isNonTextKey(i)&&this.$.format.isLine(a)&&r.collapsed&&Ht.check.isEdgePoint(r.startContainer,0,"front")){const t=r.startContainer.substringData?.(0,r.startOffset);if(t&&this.$.shortcuts.command(e,!1,n,i,t,!0,a,r))return this._onShortcutKey=!0,e.preventDefault(),e.stopPropagation(),!1}else this._onShortcutKey&&(this._onShortcutKey=!1);if(!1===await this._callPluginEventAsync("onKeyDown",{frameContext:t,event:e,range:r,line:a}))return;const c={e,fc:t,store:this.$.store,options:this.$.options,frameOptions:this.$.frameOptions,range:r,selectionNode:s,formatEl:a,keyCode:i,ctrl:o,alt:l,shift:n},h=function(t,{_styleNodes:e}){const{frameContext:s,ui:i,focusManager:n,selection:o,format:l,listFormat:r,component:a,html:c,nodeTransform:h,history:d,char:u,menu:p}=t.$;return{focusManager:{nativeFocus:()=>n.nativeFocus(),blur:()=>n.blur()},selection:{getRange:()=>o.getRange(),getNode:()=>o.getNode(),setRange:(t,e,s,i)=>o.setRange(t,e,s,i),get:()=>o.get()},format:{isLine:t=>l.isLine(t),getLine:(t,e)=>l.getLine(t,e),getLines:t=>l.getLines(t),getBrLine:(t,e)=>l.getBrLine(t,e),getBlock:(t,e)=>l.getBlock(t,e),isNormalLine:t=>l.isNormalLine(t),isBrLine:t=>l.isBrLine(t),isClosureBrLine:t=>l.isClosureBrLine(t),isClosureBlock:t=>l.isClosureBlock(t),isEdgeLine:(t,e,s)=>l.isEdgeLine(t,e,s),removeBlock:(t,e)=>l.removeBlock(t,e),addLine:(t,e)=>l.addLine(t,e)},listFormat:{applyNested:(t,e)=>r.applyNested(t,e)},component:{deselect:()=>a.deselect(),is:t=>a.is(t),get:t=>a.get(t),select:(t,e)=>a.select(t,e)},html:{remove:()=>c.remove(),insert:(t,e)=>c.insert(t,e),insertNode:(t,e)=>c.insertNode(t,e)},history:{push:t=>d.push(!!t)},nodeTransform:{removeAllParents:(t,e,s)=>h.removeAllParents(t,e,s),split:(t,e,s)=>h.split(t,e,s)},char:{check:t=>u.check(t)},menu:{dropdownOff:()=>p.dropdownOff()},setDefaultLine:e=>t._setDefaultLine(e),hideToolbar:()=>t._hideToolbar(),hideToolbar_sub:()=>t._hideToolbar_sub(),styleNodeCache:()=>e.value=t.__cacheStyleNodes,formatAttrsTempCache:e=>t._formatAttrsTemp=e,setOnShortcutKey:e=>t._onShortcutKey=e,enterScrollTo(e){i._iframeAutoHeight(s),b&&t.scrollparents.length>0||o.scrollTo(e,{behavior:"auto",block:"nearest",inline:"nearest"})},enterPrevent(e){e.preventDefault(),b&&(t.__focusTemp.focus({preventScroll:!0}),s.get("wysiwyg").focus({preventScroll:!0}))}}}(this,{_styleNodes:gn}),d=await hn(h,c);await async function(t,e){const s={..._i,...xi};for(const i of t){if("action.stop"===i.t)return!1;const t=s[i.t];if(t&&!1===await t(e,i.p))return!1}}(d,{ports:h,ctx:c})}async function fn(t,e){if(this._onShortcutKey||this.$.menu.currentDropdownName)return;const s=e.code,i=Nt.isCtrl(e),n=Nt.isAlt(e);if(i&&(pn.ctrl=!1),n&&(pn.alt=!1),t.get("isReadOnly"))return;const o=this.$.selection.getRange();let l=this.$.selection.getNode();if((this.$.store.mode.isBalloon||this.$.store.mode.isSubBalloon)&&((this.$.store.mode.isBalloonAlways||this.$.store.mode.isSubBalloonAlways)&&!Nt.isEsc(s)||!o.collapsed)){if(!this.$.store.mode.isBalloonAlways&&!this.$.store.mode.isSubBalloonAlways)return void(this.$.store.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.$.toolbar._showBalloon());Nt.isEsc(s)||this._showToolbarBalloonDelay()}if(Nt.isBackspace(s)&&Ht.check.isWysiwygFrame(l)&&""===l.textContent&&0===l.children.length){e.preventDefault(),e.stopPropagation(),l.innerHTML="";const i=this.$.store.get("currentNodes")[0],n=Ht.utils.createElement(this.$.format.isLine(i)&&!Ht.check.isListCell(i)?i:this.$.options.get("defaultLine"),null,"<br>");return l.appendChild(n),this.$.selection.setRange(n,0,n,0),this.applyTagEffect(),this.$.history.push(!1),void(t.has("documentType_use_header")&&Nt.isDocumentTypeObserverKey(s)&&t.get("documentType").reHeader())}const r=this.$.format.getLine(l,null),a=this.$.format.getBlock(l,null),c=this._formatAttrsTemp;if(r&&c){for(let t=0,e=c.length;t<e;t++)Nt.isEnter(s)&&/^id$/i.test(c[t].name)?r.removeAttribute("id"):r.setAttribute(c[t].name,c[t].value);this._formatAttrsTemp=null}this.$.format.isNormalLine(r)||this.$.format.isBrLine(r)||!o.collapsed||this.$.component.is(l)||Ht.check.isList(l)||null===this._setDefaultLine(this.$.format.isBlock(a)?"DIV":this.$.options.get("defaultLine"))||(l=this.$.selection.getNode());if(!pn.ctrl&&!pn.alt&&!Nt.isNonTextKey(s)&&3===l.nodeType&&Tt.zeroWidthRegExp.test(l.textContent)&&!(void 0!==e.isComposing?e.isComposing:this.isComposing)){let t=o.startOffset,e=o.endOffset;const s=(l.textContent.substring(0,e).match(un)||"").length;t=o.startOffset-s,e=o.endOffset-s,l.textContent=l.textContent.replace(Tt.zeroWidthRegExp,""),this.$.selection.setRange(l,t<0?0:t,l,e<0?0:e)}if(Nt.isRemoveKey(s)&&Ht.check.isZeroWidth(r?.textContent)&&!r.previousElementSibling&&!Ht.check.isListCell(r)){const t=this.$.options.get("retainStyleMode");"none"!==t&&gn.value?.length>0?"repeat"===t?this.__retainTimer?(this.__retainTimer=dn.clearTimeout(this.__retainTimer),this._clearRetainStyleNodes(r)):(this.__retainTimer=dn.setTimeout((()=>{this.__retainTimer=null}),0),this._retainStyleNodes(r,gn.value)):(this.__retainTimer=null,this._retainStyleNodes(r,gn.value)):this._clearRetainStyleNodes(r)}if(t.has("documentType_use_header"))if(Nt.isDocumentTypeObserverKey(s)){t.get("documentType").reHeader();const e=Ht.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}else{const e=Ht.query.getParentElement(l,(t=>1===t.nodeType));t.get("documentType").onChangeText(e)}!1!==await this.$.eventManager.triggerEvent("onKeyUp",{frameContext:t,event:e})&&!1!==await this._callPluginEventAsync("onKeyUp",{frameContext:t,event:e,range:o,line:r})&&Nt.isHistoryRelevantKey(s)&&this.$.history.push(!0)}const{_w:vn}=Et;function bn(t,e){const s=e.clipboardData;return!s||this._dataTransferAction("paste",e,s,t)}async function yn(t,e){const s=e.clipboardData;if(!1===await this.$.eventManager.triggerEvent("onCopy",{frameContext:t,event:e,clipboardData:s}))return e.preventDefault(),e.stopPropagation(),!1;const i=t.get("_ww").getSelection();this.__secopy=i.toString()}async function Cn(t,e){const s=e.clipboardData;if(!1===await this.$.eventManager.triggerEvent("onCut",{frameContext:t,event:e,clipboardData:s}))return e.preventDefault(),e.stopPropagation(),!1;const i=t.get("_ww").getSelection();this.__secopy=i.toString(),vn.setTimeout((()=>{this.$.history.push(!1)}),0)}const{_w:wn}=Et;function _n(t,e,s,i,n){const{sc:o,so:l,ec:r,eo:a}=this.$.selection.getDragEventLocationRange(n);if(!o)return;n.preventDefault();const c=t.get("_wd").createRange();c.setStart(o,l),c.setEnd(r,a);const h={y:0,x:0};if(s){const t=this.$.offset.getGlobal(s),e=i?this.$.context.get("toolbar_main").offsetHeight:0;h.y=t.top+e-wn.scrollY,h.x=t.left-wn.scrollX}const d=c.getBoundingClientRect();if(d.height>0){const s=t.get("wysiwygFrame");let i=0,n=0;/^iframe$/i.test(s.nodeName)&&(i=s.offsetLeft,n=s.offsetTop),e.style.left=`${d.right+wn.scrollX+h.x+i}px`,e.style.top=`${d.top+wn.scrollY+h.y-5+n}px`,e.style.height=`${d.height+10}px`,e.style.display="block"}else e.style.display="none"}function xn(t){t.style.display="none"}function $n(t,e,s){try{if(t.get("isReadOnly"))return s.preventDefault(),s.stopPropagation(),!1;const e=s.dataTransfer;if(!e)return!0;const{sc:i,so:n,ec:o,eo:l}=this.$.selection.getDragEventLocationRange(s);if(!i)return;if(Ht.query.getParentElement(i,".se-disable-pointer"))return void s.preventDefault();if(os.get("__dragContainer")){if(s.preventDefault(),os.get("__dragContainer").contains(s.target))return void this.$.component.deselect();const e=os.get("__dragContainer");return this.$.component.deselect(),this.$.selection.setRange(i,n,o,l),this.$.html.insertNode(e,{afterNode:null,skipCharCount:!0}),void(t.has("documentType_use_page")&&(t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML,t.get("documentType").rePage(!0)))}return this.$.html.remove(),this.$.selection.setRange(i,n,o,l),this._dataTransferAction("drop",s,e,t)}finally{e.style.display="none"}}class Sn{#X;constructor({$:t}){this.#X=t}execute(t){if(!this.#X.options.get("__lineFormatFilter"))return null;if(this.#X.pluginManager.fileInfo.pluginRegExp.test(this.#X.ui.currentControllerName))return;const e=this.#X.selection.getRange(),s=e.commonAncestorContainer,i=e.startContainer,n=e.endOffset,o=this.#X.format.getBlock(s,null);let l,r,a;if(o)return a=Ht.utils.createElement(t||this.#X.options.get("defaultLine")),a.innerHTML=o.innerHTML,0===a.childNodes.length&&(a.innerHTML=Tt.zeroWidthSpace),o.innerHTML=a.outerHTML,a=o.firstChild,l=a.childNodes[n]||Ht.query.getEdgeChildNodes(a,null).sc,l||(l=Ht.utils.createTextNode(Tt.zeroWidthSpace),a.insertBefore(l,a.firstChild)),r=l.textContent.length,void this.#X.selection.setRange(l,r,l,r);if(3===s.nodeType&&this.#X.component.is(s.parentElement)){const t=this.#X.component.get(s.parentElement);if(!t)return;const e=t.container;if(s.parentElement===e){const t=s.nextElementSibling?e:e.nextElementSibling,i=Ht.utils.createElement(this.#X.options.get("defaultLine"),null,s);return e.parentElement.insertBefore(i,t),void this.#X.focusManager.focusEdge(i)}return this.#X.component.select(t.target,t.pluginName),null}if(1===s.nodeType&&"true"===s.getAttribute("data-se-embed")){let t=s.nextElementSibling;return this.#X.format.isLine(t)||(t=this.#X.format.addLine(s,this.#X.options.get("defaultLine"))),void this.#X.selection.setRange(t.firstChild,0,t.firstChild,0)}if(!this.#X.format.isBlock(i)&&!Ht.check.isWysiwygFrame(i)||!this.#X.component.is(i.children[e.startOffset])&&!this.#X.component.is(i.children[e.startOffset-1])){if(Ht.query.getParentElement(s,Ht.check.isExcludeFormat))return null;if(this.#X.format.isBlock(s)&&s.childNodes.length<=1){let t=null;return 1===s.childNodes.length&&Ht.check.isBreak(s.firstChild)?t=s.firstChild:(t=Ht.utils.createTextNode(Tt.zeroWidthSpace),s.appendChild(t)),void this.#X.selection.setRange(t,1,t,1)}try{if(3===s.nodeType&&(a=Ht.utils.createElement(t||this.#X.options.get("defaultLine")),s.parentNode.insertBefore(a,s),a.appendChild(s)),Ht.check.isBreak(a.nextSibling)&&Ht.utils.removeItem(a.nextSibling),Ht.check.isBreak(a.previousSibling)&&Ht.utils.removeItem(a.previousSibling),Ht.check.isBreak(l)){const t=Ht.utils.createTextNode(Tt.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}}catch{return this.#X.frameContext.get("_wd").execCommand("formatBlock",!1,`<${t||this.#X.options.get("defaultLine")}>`),this.#X.store.set("_lastSelectionNode",null),void this.#X.selection.init()}if(a&&(Ht.check.isBreak(a.nextSibling)&&Ht.utils.removeItem(a.nextSibling),Ht.check.isBreak(a.previousSibling)&&Ht.utils.removeItem(a.previousSibling),Ht.check.isBreak(l))){const t=Ht.utils.createTextNode(Tt.zeroWidthSpace);l.parentNode.insertBefore(t,l),l=t}this.#X.store.set("_lastSelectionNode",null),i?this.#X.selection.setRange(i,1,i,1):this.#X.focusManager.nativeFocus()}}}class kn{#Vn;#X;#On;constructor(t){this.#Vn=t,this.#X=t.$,this.#On=new RegExp(`^(${Object.keys(this.#X.options.get("_defaultStyleTagMap")).join("|")})$`,"i")}update(t){if(t||=this.#X.selection.getNode(),t===this.#X.store.get("_lastSelectionNode"))return;this.#X.store.set("_lastSelectionNode",t);const e=this.#X.options.get("_rtl")?"marginRight":"marginLeft",s=this.#X.plugins,i=this.#X.commandDispatcher.targets,n=this.#On,o=this.#X.options.get("_styleCommandMap"),l=[],r=[],a=this.#X.options.get("_textStyleTags"),c=[],h=[],d=this.#X.commandDispatcher.activeCommands,u=d.length;let p="";if(this.#X.component.is(t)&&!this.#X.component.__selectionSelected){const e=this.#X.component.get(t);if(!e)return;return this.#X.store.set("_lastSelectionNode",null),void this.#X.component.select(e.target,e.pluginName)}for(;t.firstChild;)t=t.firstChild;const g=this.#X.frameContext,m=!g.get("isReadOnly");for(let g=t;!Ht.check.isWysiwygFrame(g)&&g;g=g.parentElement)if(1===g.nodeType&&!Ht.check.isBreak(g)){if(this.#Rn(g))return void this.#X.focusManager.blur();if(p=g.nodeName.toLowerCase(),r.push(p),a.includes(p)&&!this.#X.format.isLine(p)&&c.push(g),m)for(let t,e=0;e<u;e++)t=d[e],!l.includes(t)&&!h.includes(t)&&i.get(t)&&i.get(t).filter((e=>{const i=s[t]?.active(g,e);return void 0===i&&h.push(t),i})).length>0&&l.push(t);if(this.#X.format.isLine(g)){if(!l.includes("outdent")&&i.has("outdent")&&(Ht.check.isListCell(g)||g.style[e]&&Lt.get(g.style[e],0)>0)&&i.get("outdent").filter((t=>!Ht.check.isImportantDisabled(t)&&(t.disabled=!1,!0))).length>0&&l.push("outdent"),!l.includes("indent")&&i.has("indent")){const t=Ht.check.isListCell(g)&&!g.previousElementSibling;i.get("indent").filter((e=>!Ht.check.isImportantDisabled(e)&&(e.disabled=t,!0))).length>0&&l.push("indent")}}else n.test(p)&&(p=o[p]||p,l.push(p),Ht.utils.addClass(i.get(p),"active"))}return this.#zn(l),this.#Vn.__cacheStyleNodes=c.reverse(),this.#X.store.set("currentNodes",r.reverse()),this.#X.store.set("currentNodesMap",l),this.#X.frameOptions.get("statusbar_showPathLabel")&&g.get("navigation")&&(g.get("navigation").textContent=this.#X.options.get("_rtl")?this.#X.store.get("currentNodes").reverse().join(" < "):this.#X.store.get("currentNodes").join(" > ")),t}reset(){this.#zn([])}#zn(t){const e=this.#X.commandDispatcher.activeCommands,s=this.#X.commandDispatcher.targets,i=this.#X.plugins;for(let n,o,l,r=0,a=e.length;r<a;r++)if(n=e[r],!t.includes(n)&&(o=s.get(n))){l=i[n];for(let t,e=0,s=o.length;e<s;e++)t=o[e],t&&(l?l.active(null,t):/^outdent$/i.test(n)?Ht.check.isImportantDisabled(t)||(t.disabled=!0):/^indent$/i.test(n)?Ht.check.isImportantDisabled(t)||(t.disabled=!1):Ht.utils.removeClass(t,"active"))}}#Rn(t){return Ht.check.isElement(t)&&"true"===t.getAttribute("data-se-non-focus")}}const{_w:En,isMobile:Tn,isTouchDevice:Mn}=Et;const Hn=class extends ri{#t;#Gs;#e;#it;#Zs;#o;#Fn;#Pn;#Dn=null;#qn=null;#Wn=null;#Un=null;constructor(t){super(t),this.#t=this.$.store,this.#Gs=this.$.contextProvider,this.#e=this.$.context,this.#it=this.$.options,this.#Zs=this.$.eventManager,this.#o=this.$.toolbar,this.#Fn=this.$.ui,this.#Pn=this.$.menu,this.isComposing=!1,this.scrollparents=[],this.defaultLineManager=new Sn(this),this.selectionState=new kn(this),this._onShortcutKey=!1,this._handledInBefore=!1,this._wwFrameObserver=null,this._toolbarObserver=null,this._lineBreakComp=null,this._formatAttrsTemp=null,this._resizeClientY=0,this.__cacheStyleNodes=[],this.__onDownEv=null,this._inputFocus=!1,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__retainTimer=null,this.__eventDoc=null,this.__secopy=null}applyTagEffect(t){return this.selectionState.update(t)}_showToolbarBalloonDelay(){this.#Dn&&En.clearTimeout(this.#Dn),this.#Dn=En.setTimeout((()=>{En.clearTimeout(this.#Dn),this.#Dn=null,this.#t.mode.isSubBalloon?this.$.subToolbar._showBalloon():this.#o._showBalloon()}),250)}_toggleToolbarBalloon(){this.$.selection.init();const t=this.$.selection.getRange(),e=this.#it.has("_subMode");!(e?this.#t.mode.isSubBalloonAlways:this.#t.mode.isBalloonAlways)&&t.collapsed?e?this._hideToolbar_sub():this._hideToolbar():e?this.$.subToolbar._showBalloon(t):this.#o._showBalloon(t)}_hideToolbar(){this.#Fn.isPreventToolbarHide||this.$.frameContext.get("isFullScreen")||this.#o.hide()}_hideToolbar_sub(){this.$.subToolbar&&!this.#Fn.isPreventToolbarHide&&this.$.subToolbar.hide()}_setDefaultLine(t){return this.defaultLineManager.execute(t)}async _dataTransferAction(t,e,s,i){try{return this.#Fn.showLoading(),await this.#Gn(t,e,s,i),e.preventDefault(),e.stopPropagation(),!1}catch(t){console.warn("[SUNEDITOR.paste.error]",t)}finally{this.#Fn.hideLoading()}}async#Gn(t,e,s,i){e.preventDefault(),e.stopPropagation();let n=s.getData("text/plain"),o=s.getData("text/html");const l=!o,r=this.__secopy===n,a=/class=["']*Mso(Normal|List)/i.test(o)||/content=["']*Word.Document/i.test(o)||/content=["']*OneNote.File/i.test(o)||/content=["']*Excel.Sheet/i.test(o),c=r?"SE":a?"MS":"";if(l?o=Mt.htmlToEntity(n).replace(/\n/g,"<br>"):(o=o.replace(/^<html>\r?\n?<body>\r?\n?\x3C!--StartFragment-->|\x3C!--EndFragment-->\r?\n?<\/body>\r?\n?<\/html>$/g,""),a&&(o=o.replace(/\n/g," "),n=n.replace(/\n/g," "))),!r){if(this.#it.get("autoLinkify")){const t=(new DOMParser).parseFromString(o,"text/html");Ht.query.getListChildNodes(t.body,Mt.textToAnchor,null),o=t.body.innerHTML}}l||(o=this.$.html.clean(o,{forceFormat:!1,whitelist:null,blacklist:null}));const h=this.$.char.test("byte-html"===this.$.frameOptions.get("charCounter_type")?o:n,!1);if("paste"===t){const t=await this.#Zs.triggerEvent("onPaste",{frameContext:i,event:e,data:o,maxCharCount:h,from:c});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}if("drop"===t){const t=await this.#Zs.triggerEvent("onDrop",{frameContext:i,event:e,data:o,maxCharCount:h,from:c});if(!1===t)return!1;if("string"==typeof t){if(!t)return!1;o=t}}const d=s.files;if(d.length>0&&!a){for(let t=0,s=d.length;t<s;t++)await this._callPluginEventAsync("onFilePasteAndDrop",{frameContext:i,event:e,file:d[t]});return!1}if(!h)return!1;if(o){const t=(new DOMParser).parseFromString(o,"text/html");return!1!==await this._callPluginEventAsync("onPaste",{frameContext:i,event:e,data:o,doc:t})&&this.$.html.insert(o,{selectInserted:!1,skipCharCount:!0,skipCleaning:!0}),i.has("documentType_use_header")&&i.get("documentType").reHeader(),!1}}_addCommonEvents(){const t=hi.bind(this),e=ui.bind(this);this.#Zs.addEvent(this.#e.get("menuTray"),"mousedown",t,!1),this.#Zs.addEvent(this.#e.get("menuTray"),"click",di.bind(this),!0),this.#Zs.addEvent(this.#e.get("toolbar_main"),"mousedown",t,!1),this.#Zs.addEvent(this.#e.get("toolbar_main"),"click",e,!1),this.#it.has("_subMode")&&(this.#Zs.addEvent(this.#e.get("toolbar_sub_main"),"mousedown",t,!1),this.#Zs.addEvent(this.#e.get("toolbar_sub_main"),"click",e,!1)),this.#o._setResponsive(),Et.isResizeObserverSupported&&(this._toolbarObserver=new ResizeObserver((()=>{En.setTimeout((()=>{this.#o.resetResponsiveToolbar()}),0)})),this._wwFrameObserver=new ResizeObserver((t=>{En.setTimeout((()=>{t.forEach((t=>{this.#Fn._emitResizeEvent(this.$.frameRoots.get(t.target.getAttribute("data-root-key")),-1,t)}))}),0)}))),this.#it.get("closeModalOutsideClick")&&this.#Zs.addEvent(this.#Gs.carrierWrapper.querySelector(".se-modal .se-modal-inner"),"click",(t=>{t.target===this.#Gs.carrierWrapper.querySelector(".se-modal .se-modal-inner")&&this.#Fn.offCurrentModal()}),!1),this.#Zs.addEvent(En,"resize",this.#Zn.bind(this),!1),this.#Zs.addEvent(En.visualViewport,"resize",this.#jn.bind(this),!1),this.#Zs.addEvent(En,"scroll",this.#Kn.bind(this),!1),Mn&&this.#Zs.addEvent(En.visualViewport,"scroll",this.#Yn.bind(this),!1)}_addFrameEvents(t){const e=t.get("options").get("iframe"),s=e?t.get("_ww"):t.get("wysiwyg");t.set("eventWysiwyg",s);const i=t.get("code"),n=this.#Gs.carrierWrapper.querySelector(".se-drag-cursor"),o=bi.bind(this,t);this.#Zs.addEvent(s,"mousemove",o,!1),this.#Zs.addEvent(s,"mouseleave",yi.bind(this,t),!1),this.#Zs.addEvent(s,"mousedown",gi.bind(this,t),!1),this.#Zs.addEvent(s,"mouseup",fi.bind(this,t),!1),this.#Zs.addEvent(s,"click",vi.bind(this,t),!1),this.#Zs.addEvent(s,"beforeinput",Ci.bind(this,t),!1),this.#Zs.addEvent(s,"input",wi.bind(this,t),!1),this.#Zs.addEvent(s,"keydown",mn.bind(this,t),!1),this.#Zs.addEvent(s,"keyup",fn.bind(this,t),!1),this.#Zs.addEvent(s,"paste",bn.bind(this,t),!1),this.#Zs.addEvent(s,"copy",yn.bind(this,t),!1),this.#Zs.addEvent(s,"cut",Cn.bind(this,t),!1),this.#Zs.addEvent(s,"dragover",_n.bind(this,t,n,e?this.$.frameContext.get("topArea"):null,!this.#it.get("toolbar_container")&&!this.#t.mode.isBalloon&&!this.#t.mode.isInline),!1),this.#Zs.addEvent(s,"dragend",xn.bind(this,n),!1),this.#Zs.addEvent(s,"drop",$n.bind(this,t,n),!1),this.#Zs.addEvent(s,"scroll",this.#Xn.bind(this,t,s),{passive:!0,capture:!1}),this.#Zs.addEvent(s,"focus",this.#Jn.bind(this,t),!1),this.#Zs.addEvent(s,"blur",this.#Qn.bind(this,t),!1),this.#Zs.addEvent(i,"mousedown",this.#to.bind(this,t),!1);const l=t.get("wrapper").querySelector(".se-drag-handle");if(this.#Zs.addEvent(l,"wheel",(t=>{t.preventDefault(),this.$.component.deselect()}),!1),this.#Zs.addEvent(t.get("lineBreaker_t"),"pointerdown",this.#eo.bind(this,"t"),!1),this.#Zs.addEvent(t.get("lineBreaker_b"),"pointerdown",this.#eo.bind(this,"b"),!1),Mn&&this.#Zs.addEvent(s,"touchstart",o,{passive:!0,capture:!1}),!this.#it.get("hasCodeMirror")){const e=t.get("codeNumbers"),s=this.$.viewer._codeViewAutoHeight.bind(this.$.viewer,t.get("code"),e,"auto"===this.$.frameOptions.get("height"));this.#Zs.addEvent(i,"keydown",s,!1),this.#Zs.addEvent(i,"keyup",s,!1),this.#Zs.addEvent(i,"paste",s,!1),e&&this.#Zs.addEvent(i,"scroll",this.$.viewer._scrollLineNumbers.bind(i,e),!1)}t.has("statusbar")&&this.__addStatusbarEvent(t,t.get("options"));const r=this.#so.bind(this),a=Ht.query.getScrollParents(t.get("originElement"));for(const t of a)this.scrollparents.push(t),this.#Zs.addEvent(t,"scroll",r,!1);this.#Zs.addEvent(this.__focusTemp,"focus",(t=>t.preventDefault()),!1),this.__eventDoc!==t.get("_wd")&&(this.__eventDoc=t.get("_wd"),this.#Zs.addEvent(this.__eventDoc,"selectionchange",this.#io.bind(this,this.__eventDoc),!1))}__addStatusbarEvent(t,e){/\d+/.test(e.get("height"))&&e.get("statusbar_resizeEnable")?e.set("__statusbarEvent",this.#Zs.addEvent(t.get("statusbar"),"mousedown",this.#no.bind(this),!1)):Ht.utils.addClass(t.get("statusbar"),"se-resizing-none")}_removeAllEvents(){this.#Zs._init(),this._wwFrameObserver&&(this._wwFrameObserver.disconnect(),this._wwFrameObserver=null),this._toolbarObserver&&(this._toolbarObserver.disconnect(),this._toolbarObserver=null),this.#Dn&&(En.clearTimeout(this.#Dn),this.#Dn=null),this.__retainTimer&&(En.clearTimeout(this.__retainTimer),this.__retainTimer=null),this.#Wn&&=this.#Zs.removeGlobalEvent(this.#Wn),this.#Un&&=this.#Zs.removeGlobalEvent(this.#Un),this.#qn&&=this.#Zs.removeGlobalEvent(this.#qn),this._formatAttrsTemp=null,this.__cacheStyleNodes=null,this.__inputPlugin=null,this.__inputBlurEvent=null,this.__inputKeyEvent=null,this.__focusTemp=null,this.__eventDoc=null,this.__secopy=null,this._lineBreakComp=null,this.scrollparents=null}_setSelectionSync(){this.#Zs.removeGlobalEvent(this.#Wn),this.#Wn=this.#Zs.addGlobalEvent("mouseup",(()=>{this.$.selection.init(),this.#Zs.removeGlobalEvent(this.#Wn)}))}_retainStyleNodes(t,e){let s=e[0].cloneNode(!1);for(let t,i=1,n=e.length;i<n;i++)t=e[i].cloneNode(!1),s.appendChild(t),s=t;const{parent:i,inner:n}=this.$.nodeTransform.createNestedNode(e,null),o=Ht.utils.createTextNode(Tt.zeroWidthSpace);n.appendChild(o),t.innerHTML="",t.appendChild(i),this.$.selection.setRange(o,1,o,1)}_clearRetainStyleNodes(t){t.innerHTML="<br>",this.$.selection.setRange(t,0,t,0)}_callPluginEvent(t,e){return this.$.pluginManager.emitEvent(t,e)}async _callPluginEventAsync(t,e){return await this.$.pluginManager.emitEventAsync(t,e)}__removeInput(){this.#t.set("_preventBlur",!1),this._inputFocus=!1,this.__inputBlurEvent=this.#Zs.removeEvent(this.__inputBlurEvent),this.__inputKeyEvent=this.#Zs.removeEvent(this.__inputKeyEvent),this.__inputPlugin=null}__postFocusEvent(t,e){(this.#t.mode.isInline||this.#t.mode.isBalloonAlways)&&this.#o.show(),this.#t.mode.isSubBalloonAlways&&this.$.subToolbar.show(),this.#Zs.triggerEvent("onFocus",{frameContext:t,event:e}),this._callPluginEvent("onFocus",{frameContext:t,event:e})}__postBlurEvent(t,e){(this.#t.mode.isInline||this.#t.mode.isBalloon)&&this._hideToolbar(),this.#t.mode.isSubBalloon&&this._hideToolbar_sub(),this.#Zs.triggerEvent("onBlur",{frameContext:t,event:e}),this._callPluginEvent("onBlur",{frameContext:t,event:e})}__setViewportSize(){this.#t.set("currentViewportHeight",Lt.get(En.visualViewport.height,0))}#oo(){this.#Pn.currentDropdownActiveButton&&this.#Pn.currentDropdown&&this.#Pn.__resetMenuPosition(this.#Pn.currentDropdownActiveButton,this.#Pn.currentDropdown),this.#Fn._repositionControllers()}#lo(){Et.isResizeObserverSupported||(this.#o.resetResponsiveToolbar(),this.#it.get("_subMode")&&this.$.subToolbar.resetResponsiveToolbar());const t=this.#e.get("toolbar_main"),e="none"===t.style.display||this.#t.mode.isInline&&!this.#o.inlineToolbarAttr.isShow;if(0===t.offsetWidth&&!e)return;const s=this.#Fn.opendBrowser;if(s&&"block"===s.area.style.display&&(s.body.style.maxHeight=Ht.utils.getClientSize().h-s.header.offsetHeight-50+"px"),this.#Pn.currentDropdownActiveButton&&this.#Pn.currentDropdown&&this.#Pn.__resetMenuPosition(this.#Pn.currentDropdownActiveButton,this.#Pn.currentDropdown),this.$.viewer._resetFullScreenHeight())return;const i=this.$.frameContext;i.get("isCodeView")&&this.#t.mode.isInline?this.#o._showInline():(this.#Fn._iframeAutoHeight(i),this.#o.isSticky&&(this.#e.get("toolbar_main").style.width=i.get("topArea").offsetWidth-2+"px",this.#o._resetSticky()))}#Xn(t,e,s){this.#Fn._syncScrollPosition(e),this.#oo(),this._callPluginEvent("onScroll",{frameContext:t,event:s}),t.has("documentType_use_page")&&t.get("documentType").scrollPage(),this.#Zs.triggerEvent("onScroll",{frameContext:t,event:s})}#Jn(t,e){if(this.$.selection.__iframeFocus||t.get("isReadOnly")||t.get("isDisabled"))return e.preventDefault(),!1;this.#t.set("hasFocus",!0),this.$.component.__prevent=!1,this.#Zs.triggerEvent("onNativeFocus",{frameContext:t,event:e});const s=t.get("key");this._inputFocus?this.#t.mode.isInline&&En.setTimeout((()=>{this.#o._showInline()}),0):this.#t.get("rootKey")===s&&this.#t.get("_preventBlur")||this.#t.get("_preventFocus")||(this.#t.set("_preventFocus",!0),Ht.utils.removeClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#Fn._toggleCodeViewButtons(!1),this.$.facade.changeFrameContext(s),this.$.history.resetButtons(s,null),En.setTimeout((()=>{this.__postFocusEvent(t,e)}),0))}#Qn(t,e){t.get("isCodeView")||t.get("isReadOnly")||t.get("isDisabled")||(this.#t.set("hasFocus",!1),this.#t.set("_lastSelectionNode",null),this.#Zs.triggerEvent("onNativeBlur",{frameContext:t,event:e}),this._inputFocus||this.#t.get("_preventBlur")||(this.#t.set("_preventFocus",!1),this.selectionState.reset(),this.#t.set("currentNodes",[]),this.#t.set("currentNodesMap",[]),this.#Fn.offCurrentController(),this.#Gs.applyToRoots((t=>{t.get("navigation")&&(t.get("navigation").textContent="")})),this.$.history.check(t.get("key"),this.#t.get("_range")),this.__postBlurEvent(t,e)))}#no(t){t.stopPropagation(),this._resizeClientY=t.clientY,this.#Fn.enableBackWrapper("ns-resize"),this.#Un=this.#Zs.addGlobalEvent("mousemove",this.#ro.bind(this)),this.#qn=this.#Zs.addGlobalEvent("mouseup",this.#ao.bind(this))}#ro(t){const e=this.$.frameContext,s=e.get("wrapper").offsetHeight+(t.clientY-this._resizeClientY),i=s<e.get("_minHeight")?e.get("_minHeight"):s;e.get("wysiwygFrame").style.height=e.get("code").style.height=i+"px",this._resizeClientY=t.clientY,Et.isResizeObserverSupported||this.#Fn._emitResizeEvent(e,i,null)}#ao(){this.#Fn.disableBackWrapper(),this.#Un&&=this.#Zs.removeGlobalEvent(this.#Un),this.#qn&&=this.#Zs.removeGlobalEvent(this.#qn)}#eo(t,e){e.preventDefault();const s=this._lineBreakComp;if(!s)return;const i=Ht.check.isListCell(s.parentElement),n=Ht.utils.createElement(i?"BR":Ht.check.isTableCell(s.parentElement)?"DIV":this.#it.get("defaultLine"));if(i||(n.innerHTML="<br>"),"byte-html"!==this.$.frameOptions.get("charCounter_type")||this.$.char.check(n.outerHTML)){s.parentNode.insertBefore(n,"t"===t?s:s.nextSibling),this.$.component.deselect();try{const t=i?n:n.firstChild;this.$.selection.setRange(t,1,t,1),this.$.history.push(!1)}catch(t){console.warn("[SUNEDITOR.lineBreaker.error]",t)}}}#Zn(){this.#t.set("initViewportHeight",En.visualViewport.height),Tn||this.#Fn.offCurrentController(),this.#t.mode.isBalloon?this.#o.hide():this.#t.mode.isSubBalloon&&this.$.subToolbar.hide(),this.#lo()}#jn(){Tn&&this.#it.get("toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#Pn.__restoreMenuPosition()),this.#oo(),this.__setViewportSize()}#Kn(){this.#it.get("toolbar_sticky")>-1&&this.#o._resetSticky(),this.#t.mode.isBalloon&&"block"===this.#e.get("toolbar_main").style.display?this.#o._setBalloonOffset("top"===this.#o.balloonOffset.position):this.#t.mode.isSubBalloon&&"block"===this.#e.get("toolbar_sub_main").style.display&&this.$.subToolbar._setBalloonOffset("top"===this.$.subToolbar.balloonOffset.position),this.#oo(),this.$.frameContext.has("documentType_use_page")&&this.$.frameContext.get("documentType").scrollWindow()}#Yn(){this.#it.get("toolbar_sticky")>-1&&(this.#o._resetSticky(),this.#Pn.__restoreMenuPosition())}#io(t){let e=t.getSelection().anchorNode;this.#Gs.applyToRoots((t=>{if(e&&t.get("wysiwyg").contains(e)){if(t.get("isReadOnly")||t.get("isDisabled"))return;if(e=null,this.$.selection.init(),this.applyTagEffect(),t.has("documentType_use_header")){const e=Ht.query.getParentElement(this.$.selection.selectionNode,this.$.format.isLine.bind(this.$.format));t.get("documentType").on(e)}}}))}#so(){this.#Pn.dropdownOff(),this.#oo()}#to(t){this.$.facade.changeFrameContext(t.get("key")),Ht.utils.addClass(this.$.commandDispatcher.targets.get("codeView"),"active"),this.#Fn._toggleCodeViewButtons(!0)}};const Ln=class{#co=new Map;#ho=new Map;$=null;constructor(t,e){const{product:s,options:i}=e;this.store=new re(s),this.$={facade:t,store:this.store},this.#do(s,i),this.#uo(),this.#po(s),this.#go(),this.#mo(),this._eventOrchestrator=new Hn(this)}#do(t,e){const s=new he(t),i=new de(this,t,e);this.#co.set("contextProvider",s),this.#co.set("optionProvider",i),this.#co.set("instanceCheck",new ue(s.frameContext)),this.#co.set("eventManager",new fe(s,i,this.$))}#uo(){const t=this.#co.get("contextProvider"),e=this.#co.get("optionProvider");Object.assign(this.$,{contextProvider:t,optionProvider:e,instanceCheck:this.#co.get("instanceCheck"),eventManager:this.#co.get("eventManager"),frameRoots:t.frameRoots,context:t.context,options:e.options,icons:t.icons,lang:t.lang,frameContext:t.frameContext,frameOptions:e.frameOptions})}#po(t){this.#ho.set("offset",new ve(this)),this.#ho.set("selection",new ye(this)),this.#ho.set("html",new Qe(this)),this.#ho.set("nodeTransform",new ts(this)),this.#ho.set("format",new we(this)),this.#ho.set("inline",new xe(this)),this.#ho.set("listFormat",new Se(this)),this.#ho.set("char",new ss(this)),this.#ho.set("shortcuts",new is(this)),this.#ho.set("component",new Is(this)),this.#ho.set("pluginManager",new Vs(this,t)),this.#ho.set("focusManager",new Os(this)),this.#ho.set("ui",new Xs(this)),this.#ho.set("commandDispatcher",new Us(this)),this.#ho.set("toolbar",new ti(this,{keyName:"toolbar",balloon:this.store.mode.isBalloon,balloonAlways:this.store.mode.isBalloonAlways,inline:this.store.mode.isInline,res:t.responsiveButtons})),this.$.options.has("_subMode")&&this.#ho.set("subToolbar",new ti(this,{keyName:"toolbar_sub",balloon:this.store.mode.isSubBalloon,balloonAlways:this.store.mode.isSubBalloonAlways,inline:!1,res:t.responsiveButtons_sub})),this.#ho.set("menu",new si(this)),this.#ho.set("viewer",new li(this)),this.#ho.set("history",Js(this))}#mo(){for(const[,t]of this.#ho)"function"==typeof t?._init&&t._init()}#go(){const t=this.#ho.get("pluginManager");Object.assign(this.$,{offset:this.#ho.get("offset"),selection:this.#ho.get("selection"),format:this.#ho.get("format"),inline:this.#ho.get("inline"),listFormat:this.#ho.get("listFormat"),html:this.#ho.get("html"),nodeTransform:this.#ho.get("nodeTransform"),char:this.#ho.get("char"),component:this.#ho.get("component"),focusManager:this.#ho.get("focusManager"),pluginManager:t,plugins:t.plugins,ui:this.#ho.get("ui"),commandDispatcher:this.#ho.get("commandDispatcher"),history:this.#ho.get("history"),shortcuts:this.#ho.get("shortcuts"),toolbar:this.#ho.get("toolbar"),subToolbar:this.#ho.get("subToolbar"),menu:this.#ho.get("menu"),viewer:this.#ho.get("viewer")})}_destroy(){if(null===this.$)return;const t=[];for(const[e,s]of this.#ho)try{s?._destroy?.()}catch(s){t.push(`[Logic:${e}] ${s.message}`)}this.#ho.clear();try{this._eventOrchestrator?._removeAllEvents()}catch(e){t.push(`[EventOrchestrator] ${e.message}`)}this._eventOrchestrator=null;for(const[e,s]of this.#co)try{s?._destroy?.()}catch(s){t.push(`[Config:${e}] ${s.message}`)}this.#co.clear(),t.length>0&&console.warn("[CoreKernel._destroy] Cleanup completed with errors:",t),this.$=null,this.store._destroy(),this.store=null,this.facade=null}};const Nn=class{#F;$;constructor(t,e){const s=ie(t,e),i=new Ln(this,{product:s,options:e});this.#F=i,this.$=i.$,this.#fo(e).catch((t=>{console.error("[SUNEDITOR:E_CREATE_FAIL] Failed to create editor instance.",t)}))}isEmpty(t){const e=(t||this.$.frameContext).get("wysiwyg");return Ht.check.isZeroWidth(e.textContent)&&!e.querySelector(this.$.options.get("allowedEmptyTags"))&&(e.innerText.match(/\n/g)||"").length<=1}resetOptions(t){this.$.optionProvider.reset(t),this.$.store.set("_lastSelectionNode",null),this.#vo(this.$.frameRoots.get(this.$.store.get("rootKey")));for(const t of Object.values(this.$.plugins))t.init?.()}changeFrameContext(t){t!==this.$.store.get("rootKey")&&(this.$.store.set("rootKey",t),this.#vo(this.$.frameRoots.get(t)),this.$.toolbar._resetSticky())}destroy(){this.$.options.get("hasCodeMirror")&&this.$.contextProvider.applyToRoots((t=>{const e=t.get("options"),s=e.get("codeMirror6Editor"),i=e.get("codeMirror5Editor");s?s.destroy():i&&i.toTextArea()})),Ht.utils.removeItem(this.$.context.get("toolbar_wrapper")),Ht.utils.removeItem(this.$.context.get("toolbar_sub_wrapper")),Ht.utils.removeItem(this.$.context.get("statusbar_wrapper"));for(const t in this.events)this.events[t]=null;return this.events=null,this.#F._destroy(),null}#vo(t){this.$.contextProvider.reset(t),this.$.optionProvider.resetFrame(t.get("options")),this.$.ui.reset(t)}#bo(t){this.$.store.set("initViewportHeight",Et._w.visualViewport.height),this.#F._eventOrchestrator.__setViewportSize(),this.$.contextProvider.init(),this.#vo(this.$.frameRoots.get(this.$.store.get("rootKey"))),this.#ls(t),this.$.contextProvider.applyToRoots((t=>{this.#F._eventOrchestrator._addFrameEvents(t),this.#yo(t,t.get("options").get("value")),t.get("options").get("iframe")&&"auto"===t.get("options").get("height")&&this.$.ui._emitResizeEvent(t,t.get("wysiwygFrame").offsetHeight,null)})),this.#F._eventOrchestrator.__eventDoc=null,this.$.store._editorInitFinished=!0,this.$.pluginManager.checkFileInfo(!0),this.$.history.reset(),Et._w.setTimeout((()=>{if(this.$.context?.size){this.$.context.get("toolbar_main").style.visibility="",this.$.contextProvider.applyToRoots((t=>{this.#F._eventOrchestrator._wwFrameObserver&&this.#F._eventOrchestrator._wwFrameObserver.observe(t.get("wysiwygFrame")),this.#F._eventOrchestrator._toolbarObserver&&this.#F._eventOrchestrator._toolbarObserver.observe(t.get("_toolbarShadow")),this.$.ui._syncFrameState(t)}));for(const t of Object.values(this.$.plugins))t.init?.();this.$.selection.__init(),this.$.eventManager.triggerEvent("onload",{})}else console.warn("[SUNEDITOR:E_INIT_FAIL] Editor instance was destroyed before initialization completed. Check if destroy() was called.")}),0)}#yo(t,e){t.get("wysiwyg").innerHTML=this.$.html.clean("string"==typeof e?e:(/^TEXTAREA$/i.test(t.get("originElement").nodeName)?t.get("originElement").value:t.get("originElement").innerHTML)||"",{forceFormat:!0,whitelist:null,blacklist:null,_freeCodeViewMode:this.$.options.get("freeCodeViewMode")})||"<"+this.$.options.get("defaultLine")+"><br></"+this.$.options.get("defaultLine")+">",t.has("charCounter")&&(t.get("charCounter").textContent=String(this.$.char.getLength())),"document"===this.$.options.get("type")&&(t.set("documentType",new le(this.#F,t)),t.get("documentType").useHeader&&t.set("documentType_use_header",!0),t.get("documentType").usePage&&(t.set("documentType_use_page",!0),t.get("documentTypePageMirror").innerHTML=t.get("wysiwyg").innerHTML))}#ls(t){this.$.pluginManager.init(t),this.$.shortcuts._registerCustomShortcuts(),this.$.commandDispatcher._initCommandButtons(),this.$.ui.init()}#Co(t,e,s){t.contentDocument.documentElement.className="sun-editor",t.contentDocument.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'+Mt._setIframeStyleLinks(s.get("iframe_cssFileName"))+Mt._setAutoHeightStyle(s.get("height")),t.contentDocument.body.className=e.get("_editableClass"),t.contentDocument.body.setAttribute("contenteditable","true")}async#fo(t){this.#F._eventOrchestrator._addCommonEvents();const e=[];this.$.contextProvider.applyToRoots((t=>{const s=t.get("originElement"),i=t.get("topArea");if(s.style.display="none",i.style.display="block",s.parentNode.insertBefore(i,s.nextElementSibling),t.get("options").get("iframe")){const s=new Promise((e=>{this.$.eventManager.addEvent(t.get("wysiwygFrame"),"load",(({target:s})=>{this.#Co(s,this.$.optionProvider.options,t.get("options")),e()}))}));e.push(s)}})),this.$.contextProvider.applyToRoots((t=>{t.get("wrapper").appendChild(t.get("wysiwygFrame")),t.get("documentTypeInner")&&(this.$.options.get("_rtl")?t.get("wrapper").appendChild(t.get("documentTypeInner")):t.get("wrapper").insertBefore(t.get("documentTypeInner"),t.get("wysiwygFrame"))),t.get("documentTypePage")&&(this.$.options.get("_rtl")?t.get("wrapper").insertBefore(t.get("documentTypePage"),t.get("wysiwygFrame")):t.get("wrapper").appendChild(t.get("documentTypePage")),t.get("wrapper").appendChild(t.get("documentTypePageMirror")))})),e.length>0&&await Promise.all(e),this.#bo(t)}};const An=class{#X;#wo;constructor(t,e,s){this.#X=e,this.kind=t.constructor.key||t.constructor.name,this.#wo=Et.getXMLHttpRequest(),this.method=s?.method,this.url=s?.url,this.headers=s?.headers,this.data=s?.data,this.callBack=s?.callBack,this.errorCallBack=s?.errorCallBack,this.responseType=s?.responseType}call({method:t,url:e,headers:s,data:i,callBack:n,errorCallBack:o,responseType:l}){if(this.cancel(),t||=this.method,e=this.#_o(e||this.url),s||=this.headers,i||=this.data,n||=this.callBack,o||=this.errorCallBack,l||=this.responseType,"function"!=typeof n)throw new Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.callBack.fail] callBack is not a function`);const r=this.#wo;if(l&&(r.responseType=l),r.onreadystatechange=this.#xo.bind(this,r,n,o),r.open(t,e,!0),null!==s&&"object"==typeof s&&Object.keys(s).length>0)for(const t in s)r.setRequestHeader(t,s[t]);r.send(i)}asyncCall({method:t,url:e,headers:s,data:i,responseType:n}){this.cancel(),t||=this.method,e=this.#_o(e||this.url),s||=this.headers,i||=this.data,n||=this.responseType;const o=this.#wo;return n&&(o.responseType=n),new Promise(((n,l)=>{if(o.open(t,e,!0),null!==s&&"object"==typeof s&&Object.keys(s).length>0)for(const t in s)o.setRequestHeader(t,s[t]);o.onload=()=>{if(200===o.status)try{n(o)}finally{this.#X.ui.hideLoading()}else try{const t=o.responseText?JSON.parse(o.responseText):o;l(t)}finally{this.#X.ui.hideLoading()}},o.onerror=()=>{this.#X.ui.hideLoading(),l(new Error("Network error"))},o.send(i)}))}cancel(){this.#wo&&(this.#wo.onreadystatechange=null,this.#wo.onload=null,this.#wo.onerror=null,this.#wo.abort())}#_o(t){return t.replace(/([^:])\/+/g,"$1/").replace(/\/(\?|#|$)/,"$1")}async#xo(t,e,s){if(4===t.readyState)if(200===t.status)try{await e(t)}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.callBack.fail] ${t.message}`)}finally{this.#X.ui.hideLoading()}else{console.error(`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException]`,t);try{const e=t.responseText?JSON.parse(t.responseText):t;let i="";"function"==typeof s&&(i=await s(e,t));const n=`[SUNEDITOR.ApiManager[${this.kind}].upload.serverException] status: ${t.status}, response: ${i||e.errorMessage||t.responseText}`;this.#X.ui.alertOpen(n,"error")}catch(t){throw Error(`[SUNEDITOR.ApiManager[${this.kind}].upload.errorCallBack.fail] ${t.message}`)}finally{this.#X.ui.hideLoading()}}}};function Bn(t){const e=t.src.split("/").pop(),s=t.thumbnail||"",i=s||t.src,n=this.props?.map((e=>`data-${e}="${t[e]}"`)).join(" ")||"",o=`data-type="${t.type}" data-command="${t.src}" data-name="${t.name||e}" data-thumbnail="${s}" data-extension="${t.src.split(".").pop()}" ${n}`,l=`class="${s||"se-browser-empty-image"}" src="${i}" alt="${t.alt||e}" ${o}`;return`\n\t\t<div class="se-file-item-img">\n\t\t\t${this.thumbnail&&!s&&"image"!==t.type?`<div class="se-browser-empty-thumbnail" ${l}>${this.thumbnail(t)}</div>`:`<img class="${s||"se-browser-empty-image"}" ${l}>`}\n\t\t\t<div class="se-file-name-image se-file-name-back"></div>\n\t\t\t<div class="se-file-name-image">${t.name||e}</div>\n\t\t</div>`}const In=class{#X;#$o;#ln;#Vi=!1;#zi=null;constructor(t,e,s){this.#X=e,this.useSearch=s.useSearch??!0;const i=Ht.utils.createElement("DIV",{class:"se-browser sun-editor-common"+(s.className?` ${s.className}`:"")}),n=function(t,e){const s=t.lang,i=t.icons,n=`\n\t\t<div class="se-browser-content">\n\t\t\t<div class="se-browser-header">\n\t\t\t\t<button type="button" data-command="close" class="se-btn se-browser-close" class="close" title="${s.close}" aria-label="${s.close}">\n\t\t\t\t\t${i.cancel}\n\t\t\t\t</button>\n\t\t\t\t<span class="se-browser-title"></span>\n\t\t\t</div>\n\t\t\t<div class="se-browser-wrapper">\n\t\t\t\t<div class="se-browser-side"></div>\n\t\t\t\t<div class="se-browser-main"> \n\t\t\t\t\t<div class="se-browser-bar">\n\t\t\t\t\t\t<div class="se-browser-search">\n\t\t\t\t\t\t\t<button class="se-btn se-side-open-btn">${i.side_menu_hamburger}</button>\n\t\t\t\t\t\t\t${e?`\n\t\t\t\t\t\t\t\t\t\t<form class="se-browser-search-form">\n\t\t\t\t\t\t\t\t\t\t\t<input type="text" class="se-input-form" placeholder="${s.search}" aria-label="${s.search}">\n\t\t\t\t\t\t\t\t\t\t\t<button type="submit" class="se-btn" title="${s.search}" aria-label="${s.search}">${i.search}</button>\n\t\t\t\t\t\t\t\t\t\t</form>`:""}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="se-browser-body">\n\t\t\t\t\t\t<div class="se-browser-tags"></div>\n\t\t\t\t\t\t<div class="se-loading-box sun-editor-common"><div class="se-loading-effect"></div></div>\n\t\t\t\t\t\t<div class="se-browser-menus"></div>\n\t\t\t\t\t\t<div class="se-browser-list"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>`,o=Ht.utils.createElement("DIV",{class:"se-browser-inner"},n);return{html:o,header:o.querySelector(".se-browser-header"),titleArea:o.querySelector(".se-browser-title"),tagArea:o.querySelector(".se-browser-tags"),body:o.querySelector(".se-browser-body"),list:o.querySelector(".se-browser-list"),side:o.querySelector(".se-browser-side"),wrapper:o.querySelector(".se-browser-wrapper"),_loading:o.querySelector(".se-loading-box")}}(this.#X,this.useSearch),o=n.html;this.kind=t.constructor.key||t.constructor.name,this.host=t,this.area=i,this.header=n.header,this.titleArea=n.titleArea,this.tagArea=n.tagArea,this.body=n.body,this.list=n.list,this.side=n.side,this.wrapper=n.wrapper,this.#$o=n._loading,this.title=s.title,this.listClass=s.listClass||"se-preview-list",this.directData=s.data,this.url=s.url,this.urlHeader=s.headers,this.searchUrl=s.searchUrl,this.searchUrlHeader=s.searchUrlHeader,this.drawItemHandler=(s.drawItemHandler||Bn).bind({thumbnail:s.thumbnail,props:s.props||[]}),this.selectorHandler=s.selectorHandler,this.columnSize=s.columnSize||4,this.folderDefaultPath="",this.closeArrow=this.#X.icons.menu_arrow_right,this.openArrow=this.#X.icons.menu_arrow_down,this.icon_folder=this.#X.icons.side_menu_folder_item,this.icon_folder_item=this.#X.icons.side_menu_folder,this.icon_item=this.#X.icons.side_menu_item,this.items=[],this.folders={},this.tree={},this.data={},this.selectedTags=[],this.keyword="",this.sideInner=null,this.apiManager=new An(this,e,{method:"GET"}),this.#ln=t=>{Nt.isEsc(t.code)&&this.close()},i.appendChild(Ht.utils.createElement("DIV",{class:"se-browser-back"})),i.appendChild(o),this.#X.contextProvider.carrierWrapper.appendChild(i),this.#X.eventManager.addEvent(this.tagArea,"click",this.#So.bind(this)),this.#X.eventManager.addEvent(this.list,"click",this.#ko.bind(this)),this.#X.eventManager.addEvent(this.side,"click",this.#Eo.bind(this)),this.#X.eventManager.addEvent(o,"mousedown",this.#To.bind(this)),this.#X.eventManager.addEvent(o,"click",this.#Mo.bind(this)),this.#X.eventManager.addEvent(i.querySelector("form.se-browser-search-form"),"submit",this.#Ho.bind(this)),this.#X.eventManager.addEvent(this.sideOpenBtn=i.querySelector(".se-side-open-btn"),"click",this.#Lo.bind(this)),this.#X.eventManager.addEvent([this.header,i.querySelector(".se-browser-main")],"mousedown",this.#No.bind(this))}open(t={}){this.#Ne();const e=t.listClass||this.listClass;Ht.utils.hasClass(this.list,e)||(this.list.className="se-browser-list "+e),this.titleArea.textContent=t.title||this.title,this.area.style.display="block",this.#X.ui.opendBrowser=this,this.closeArrow=this.#X.options.get("_rtl")?this.#X.icons.menu_arrow_left:this.#X.icons.menu_arrow_right,this.directData?this.#Ao(this.directData):this.#Bo(t.url||this.url,t.urlHeader||this.urlHeader,!1),this.body.style.maxHeight=Ht.utils.getClientSize().h-(this.#X.offset.getGlobal(this.body).top-o.scrollY)-20+"px"}close(){this.#Ve(),this.apiManager.cancel(),this.area.style.display="none",this.selectedTags=[],this.items=[],this.folders={},this.tree={},this.data={},this.keyword="",this.list.innerHTML=this.tagArea.innerHTML=this.titleArea.textContent="",this.#X.ui.opendBrowser=null,this.sideInner=null,this.host.browserInit?.()}search(t){this.searchUrl?(this.keyword=t,this.#Bo(this.searchUrl+"?keyword="+t,this.searchUrlHeader,!1)):(this.keyword=t.toLowerCase(),this.#Io(this.items,!1))}tagfilter(t){const e=this.selectedTags;return 0===e.length?t:t.filter((t=>!Array.isArray(t.tag)||t.tag.some((t=>e.includes(t)))))}showBrowserLoading(){this.#$o.style.display="block"}closeBrowserLoading(){this.#$o.style.display="none"}#Bo(t,e,s){this.apiManager.call({method:"GET",url:t,headers:e,callBack:this.#Vo.bind(this),errorCallBack:this.#Oo.bind(this)}),s||(this.sideOpenBtn.style.display="none",this.showBrowserLoading())}#Io(t,e){const s=this.keyword,i=[],n=(t=this.tagfilter(t).filter((t=>t.name.toLowerCase().indexOf(s)>-1))).length,o=this.columnSize,l=o<=1?1:Math.round(n/o)||1,r=this.drawItemHandler;let a="",c='<div class="se-file-item-column">',h=1;for(let s,d,u=0;u<n;u++)if(s=t[u],d=s.tag?"string"==typeof s.tag?s.tag.split(","):s.tag:[],d=s.tag=d.map((t=>t.trim())),c+=r(s),(u+1)%l==0&&h<o&&u+1<n&&(h++,c+='</div><div class="se-file-item-column">'),e&&d.length>0)for(let t,e=0,s=d.length;e<s;e++)t=d[e],t&&!i.includes(t)&&(i.push(t),a+=`<a title="${t}" aria-label="${t}">${t}</a>`);c+="</div>",this.list.innerHTML=c,e&&(this.items=t,this.tagArea.innerHTML=a)}#Ne(){this.#Ve(),this.#zi=this.#X.eventManager.addGlobalEvent("keydown",this.#ln,!0)}#Ve(){this.#zi&&=this.#X.eventManager.removeGlobalEvent(this.#zi)}#Ao(t){if(Array.isArray(t))return t.length>0&&this.#Io(t,!0),!0;if("object"==typeof t){this.sideOpenBtn.style.display="",this.#Ro(t),this.side.innerHTML="";const e=this.sideInner=Ht.utils.createElement("div",null);if(this.#zo(this.tree,e),this.side.appendChild(e),this.folderDefaultPath){const t=e.querySelector(`[data-command="${this.folderDefaultPath}"]`);t.click(),this.folderDefaultPath.includes("/")&&(Ht.utils.removeClass(t.parentElement,"se-menu-hidden"),t.parentElement.previousElementSibling.querySelector("button").innerHTML=this.openArrow)}return!0}return!1}#Ro(t,e){let s=this.tree;if(t._data){this.data[e]=t._data,this.folderDefaultPath&&!t.default||(this.folderDefaultPath=e);const i=e.split("/"),n=i.length-1;i.forEach(((t,i)=>{s[t]||={children:{}},i===n?(s[t].key=e,s[t].name=this.folders[e].name):s=s[t].children}))}else e&&(s[e]={name:this.folders[e].name,children:{}});Object.entries(t).forEach((([t,s])=>{if("_data"===t||!s||"object"!=typeof s)return;const i=s,n=e?`${e}/${t}`:t;this.folders[n]={name:i.name||t,meta:i.meta||{}},this.#Ro(i,n)}))}#zo(t,e){for(const s in t){const i=t[s];if(i)if(Object.keys(i.children).length>0){const t=Ht.utils.createElement("div",i.key?{"data-command":i.key,"aria-label":i.name}:null,`<span class="se-menu-icon">${i.key?this.icon_folder:this.icon_folder_item}</span><span>${i.name}</span>`),s=Ht.utils.createElement("div",{class:"se-menu-folder"},t);t.insertBefore(Ht.utils.createElement("button",null,this.closeArrow),t.firstElementChild);const n=document.createElement("div");Ht.utils.addClass(n,"se-menu-child|se-menu-hidden"),this.#zo(i.children,n),s.appendChild(n),e.appendChild(s)}else{const t=Ht.utils.createElement("div",{"data-command":i.key,"aria-label":i.name,class:"se-menu-folder-item"},`<span class="se-menu-icon">${this.icon_item}</span><span>${i.name}</span>`);if(e===this.sideInner){const s=Ht.utils.createElement("div",{class:"se-menu-folder"},t);e.appendChild(s)}else e.appendChild(t)}}}#Vo(t){try{const e=JSON.parse(t.responseText),s=e.result;if(this.#Ao(s))return;e.nullMessage&&(this.list.innerHTML=e.nullMessage)}catch(t){throw Error(`[SUNEDITOR.browser.drawList.fail] cause: "${t.message}"`)}finally{this.closeBrowserLoading()}}#Oo(t,e){throw this.closeBrowserLoading(),Error(`[SUNEDITOR.browser.get.serverException] status: ${e.status}, response: ${t.errorMessage||e.responseText}`)}#So(t){const e=Ht.query.getEventTarget(t);if(!Ht.check.isAnchor(e))return;const s=e.textContent,i=this.tagArea.querySelector('a[title="'+s+'"]'),n=this.selectedTags.indexOf(s);n>-1?(this.selectedTags.splice(n,1),Ht.utils.removeClass(i,"on")):(this.selectedTags.push(s),Ht.utils.addClass(i,"on")),this.#Io(this.items,!1)}#ko(t){const e=Ht.query.getEventTarget(t);if(t.preventDefault(),t.stopPropagation(),e===this.list)return;const s=Ht.query.getCommandTarget(e);s&&(this.close(),this.selectorHandler(s))}#Eo(t){const e=Ht.query.getEventTarget(t);if(t.stopPropagation(),/^button$/i.test(e.nodeName)){const t=e.parentElement.parentElement.querySelector(".se-menu-child");return void(Ht.utils.hasClass(t,"se-menu-hidden")?(Ht.utils.removeClass(t,"se-menu-hidden"),e.innerHTML=this.openArrow):(Ht.utils.addClass(t,"se-menu-hidden"),e.innerHTML=this.closeArrow))}const s=Ht.query.getCommandTarget(e);if(!s||Ht.utils.hasClass(s,"active"))return;const i=this.data[s.getAttribute("data-command")];Ht.utils.removeClass(this.side.querySelectorAll(".active"),"active"),Ht.utils.addClass([s,Ht.query.getParentElement(s,".se-menu-folder")],"active"),this.tagArea.innerHTML="","string"==typeof i?this.#Bo(i,this.urlHeader,!0):this.#Io(i,!1)}#To(t){const e=Ht.query.getEventTarget(t);/se-browser-inner/.test(e.className)?this.#Vi=!0:this.#Vi=!1}#Mo(t){const e=Ht.query.getEventTarget(t);t.stopPropagation(),(/close/.test(e.getAttribute("data-command"))||this.#Vi)&&this.close()}#Ho(t){const e=t.currentTarget;t.preventDefault(),this.search(e.querySelector('input[type="text"]').value)}#Lo(t){const e=Ht.query.getEventTarget(t);Ht.utils.hasClass(e,"active")?(Ht.utils.removeClass(this.side,"se-side-show"),Ht.utils.removeClass(e,"active")):(Ht.utils.addClass(this.side,"se-side-show"),Ht.utils.addClass(e,"active"))}#No({target:t}){t!==this.sideOpenBtn&&Ht.utils.hasClass(this.sideOpenBtn,"active")&&(Ht.utils.removeClass(this.side,"se-side-show"),Ht.utils.removeClass(this.sideOpenBtn,"active"))}},{isTouchDevice:Vn}=Et,On=240,Rn=120,zn={hex:"#FFFFFF",r:255,g:255,b:255,h:0,s:1,l:1};let Fn,Pn=0,Dn=!1,qn=!1,Wn=120,Un=120,Gn=zn,Zn=!1;const{slider:jn,offscreenCanvas:Kn,offscreenCtx:Yn,wheel:Xn,wheelCtx:Jn,wheelPointer:Qn,gradientBar:to,gradientPointer:eo,fanalColorHex:so,fanalColorBackground:io}=function(){const t=document.createElement("canvas");t.width=On,t.height=On;const e=`\n\t<div class="se-hue-slider-container" style="width: 240px; height: 240px;">\n <canvas class="se-hue-wheel" width="240" height="240"></canvas>\n <div class="se-hue-wheel-pointer"></div>\n </div>\n <div class="se-hue-gradient-container">\n <canvas class="se-hue-gradient" width="240" height="28"></canvas>\n <div class="se-hue-gradient-pointer"></div>\n </div>\n <div class="se-hue-final-hex" style="width:240px; height: 28px;">\n\t\t<div style="flex: 3; line-height: 1.5;">${zn.hex}</div>\n\t\t<div style="flex: 1; height: 100%; border: 1px solid #fff; outline: 1px solid #000;"></div>\n\t</div>\n\t`,s=Ht.utils.createElement("DIV",{class:"se-hue-slider"},e),i=s.querySelector(".se-hue-wheel"),n=s.querySelector(".se-hue-gradient"),o=s.querySelector(".se-hue-final-hex").children;return{slider:s,offscreenCanvas:t,offscreenCtx:t.getContext("2d"),wheel:i,wheelCtx:i.getContext("2d"),wheelPointer:s.querySelector(".se-hue-wheel-pointer"),gradientBar:n,gradientPointer:s.querySelector(".se-hue-gradient-pointer"),fanalColorHex:o[0],fanalColorBackground:o[1]}}();function no(t){const{target:e,touches:s}=t,i=s[0].clientX,n=s[0].clientY;e===Xn?(t.preventDefault(),qn=!1,Dn=!0,ao(i,n)):e===to&&(t.preventDefault(),qn=!0,Dn=!1,co(i))}function oo(t){t.preventDefault();const{touches:e}=t,s=e[0].clientX,i=e[0].clientY;Dn?ao(s,i):qn&&co(s)}function lo({target:t,clientX:e,clientY:s}){t===Xn?(qn=!1,Dn=!0,ao(e,s)):t===to&&(qn=!0,Dn=!1,co(e))}function ro({clientX:t,clientY:e}){Dn?ao(t,e):qn&&co(t)}function ao(t,e){const s=Xn.getBoundingClientRect();t=t-s.left-Rn,e=e-s.top-Rn;const i=180*Math.atan2(e,t)/Math.PI,n=Math.min(Math.sqrt(t*t+e*e),Rn),o=Rn+n*Math.cos(i*Math.PI/180),l=Rn+n*Math.sin(i*Math.PI/180);Qn.style.left=`${o}px`,Qn.style.top=`${l}px`,function(t,e){Wn=t,Un=e,ho(uo())}(o,l),po()}function co(t){const e=to.getBoundingClientRect();let s=t-e.left;s=Math.max(14,Math.min(s,e.width-14)),eo.style.left=`${s}px`,function(t){const e=to.getBoundingClientRect();let s=t-e.left;s<0&&(s=0);s>e.width&&(s=e.width);const i=14;s>=to.width-i?s=to.width:s<=i&&(s=0);const n=1-s/e.width;Pn=n,fo()}(t),po()}function ho(t){const e=to.getContext("2d"),s=e.createLinearGradient(0,0,to.width,0);s.addColorStop(0,"black"),s.addColorStop(1,t.hex),e.fillStyle=s,e.fillRect(0,0,to.width,to.height)}function uo(){return mo(Yn)}function po(){Fn.color=Gn=mo(Jn),go(Gn.hex)}function go(t){io.style.backgroundColor=so.textContent=t}function mo(t){const e=t.getImageData(Wn,Un,1,1).data;let[s,i,n]=function([t,e,s]){t/=255,e/=255,s/=255;const i=Math.max(t,e,s),n=Math.min(t,e,s);let o,l;const r=(i+n)/2;if(i===n)o=l=0;else{const a=i-n;switch(l=r>.5?a/(2-i-n):a/(i+n),i){case t:o=(e-s)/a+(e<s?6:0);break;case e:o=(s-t)/a+2;break;case s:o=(t-e)/a+4}o/=6}return[bo(o),bo(l),bo(r)]}(e);const o=Wn-Rn,l=Un-Rn;Math.sqrt(o*o+l*l)<3&&(n=1-Pn),n>1&&(n=1),n<0&&(n=0);const{r,g:a,b:c}=function([t,e,s]){let i,n,o;if(0===e)i=n=o=s;else{const l=function(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t},r=s<.5?s*(1+e):s+e-s*e,a=2*s-r;i=l(a,r,t+1/3),n=l(a,r,t),o=l(a,r,t-1/3)}return{r:Math.round(255*i),g:Math.round(255*n),b:Math.round(255*o)}}([s,i,n]),h=`#${function({r:t,g:e,b:s}){let i=Math.floor(t).toString(16);t<16&&(i=`0${i}`);let n=Math.floor(e).toString(16);e<16&&(n=`0${n}`);let o=Math.floor(s).toString(16);s<16&&(o=`0${o}`);return`${i}${n}${o}`.toUpperCase()}({r,g:a,b:c})}`;return{hex:h,r,g:a,b:c,h:s,s:i,l:bo(n)}}function fo(){Jn.clearRect(0,0,On,On),Jn.drawImage(Kn,0,0),Jn.globalAlpha=Pn,Jn.fillStyle="black",Jn.beginPath(),Jn.arc(Rn,Rn,Rn,0,2*Math.PI),Jn.fill(),Jn.globalAlpha=1}function vo(t){return t*Math.PI/180}function bo(t){const e=Math.pow(10,10);return Math.round(t*e)/e}function yo(){!function(t){if(!t)return void console.warn("[HueSlider.fail] Context not found.");for(let e=0;e<=360;e+=.5)for(let s=0;s<=Rn;s+=1){t.beginPath();const i=50+(Rn-s)/Rn*50;t.fillStyle=`hsl(${e}, 100%, ${i}%)`;const n=Rn+Math.cos(vo(e))*s,o=Rn-Math.sin(vo(e))*s;t.arc(n,o,1.5,0,2*Math.PI),t.fill()}Zn=!0}(Yn),Zn&&fo()}yo();const Co=class{#X;#Fo;#Po;#Do;#qo;#Wo;#Uo;constructor(t,e,s={},i=""){if(this.#X=e,this.inst=t,this.ctx={wheelX:Wn,wheelY:Un,lightness:Pn,wheelPointerX:"50%",wheelPointerY:"50%",gradientPointerX:"calc(100% - 14px)",color:zn},this.isOpen=!1,this.controlle=null,this.#Fo=null,this.#Po=null,this.#Do=null,this.#qo=null,this.#Wo=null,this.#Uo=null,!s.isNewForm){const n=function({lang:t,icons:e},s){const i=Ht.utils.createElement("DIV",{class:`se-controller ${s}`},`\n\t\t<div class="se-hue"></div>\n\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t<button type="button" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}" data-command="submit">${e.checked}</button>\n\t\t\t<button type="button" class="se-btn se-btn-danger" title="${t.close}" aria-label="${t.close}" data-command="close">${e.cancel}</button>\n\t\t</div>\n\t`);return i}(e,i);this.circle=n.querySelector(".se-hue"),this.controller=new ps(this,e,n,{position:"bottom",isWWTarget:!1,parents:[t.form],parentsHide:!0,...s.controllerOptions})}}controllerAction(t){const e=t.getAttribute("data-command");"submit"===e?(this.inst.hueSliderAction?.(this.get()),this.close()):"close"===e&&this.close()}controllerClose(){this.init(),this.inst.hueSliderCancelAction?.()}get(){return Gn}open(t){this.attach(),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}close(){this.ctx={gradientPointerX:eo.style.left,wheelPointerX:Qn.style.left,wheelPointerY:Qn.style.top,wheelX:Wn,wheelY:Un,lightness:Pn,color:Fn?.color||""},this.controller.close()}attach(t){Zn||yo(),this.init(),(t||this.circle).appendChild(jn),Fn=this.ctx,Fn&&(Wn=Fn.wheelX,Un=Fn.wheelY,Pn=Fn.lightness,Qn.style.left=Fn.wheelPointerX,Qn.style.top=Fn.wheelPointerY,eo.style.left=Fn.gradientPointerX,go(Fn.color.hex),fo(),ho(uo())),Vn&&(this.#Wo=this.#X.eventManager.addGlobalEvent("touchstart",no,{passive:!1,capture:!0}),this.#Po=this.#X.eventManager.addGlobalEvent("touchmove",oo,!0),this.#Uo=this.#X.eventManager.addGlobalEvent("touchend",(()=>{Dn=!1,qn=!1}),!0)),this.#Fo=this.#X.eventManager.addGlobalEvent("mousedown",lo,{passive:!1,capture:!0}),this.#qo=this.#X.eventManager.addGlobalEvent("mousemove",ro,!0),this.#Do=this.#X.eventManager.addGlobalEvent("mouseup",(()=>{Dn=!1,qn=!1}),!0),this.isOpen=!0}init(){this.isOpen=!1,Dn=!1,qn=!1,this.#Fo&&=this.#X.eventManager.removeGlobalEvent(this.#Fo),this.#qo&&=this.#X.eventManager.removeGlobalEvent(this.#qo),this.#Do&&=this.#X.eventManager.removeGlobalEvent(this.#Do),this.#Wo&&=this.#X.eventManager.removeGlobalEvent(this.#Wo),this.#Po&&=this.#X.eventManager.removeGlobalEvent(this.#Po),this.#Uo&&=this.#X.eventManager.removeGlobalEvent(this.#Uo)}},wo=["#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6","#8b5cf6","#ec4899","#000000","#fca5a5","#fdba74","#fcd34d","#6ee7b7","#5eead4","#7dd3fc","#c4b5fd","#f9a8d4","#e5e7eb","#fee2e2","#ffedd5","#fef9c3","#dcfce7","#cffafe","#dbeafe","#ede9fe","#fce7f3","#f3f4f6","#f87171","#fb923c","#facc15","#4ade80","#22d3ee","#60a5fa","#a78bfa","#f472b6","#9ca3af","#b91c1c","#c2410c","#a16207","#15803d","#0e7490","#1d4ed8","#6d28d9","#be185d","#4b5563","#7f1d1d","#7c2d12","#713f12","#14532d","#164e63","#1e3a8a","#4c1d95","#831843","#1f2937"];function _o(t,e){const s=`<ul class="se-color-pallet${e?" se-list-horizontal":""}">`;let i=s;for(let n,o,l,r=0,a=t.length;r<a;r++)n=t[r],"string"==typeof n?(o=n,l=n):"object"==typeof n&&(o=n.value,l=n.name||o),r>0&&r%e==0&&(i+=`</ul>${s}`),i+=`<li><button type="button" data-value="${o}" title="${l}" aria-label="${l}" style="background-color:${o};"></button></li>`;return i+="</ul>",i}const xo=class{#X;constructor(t,e,s,i){this.#X=e,this.kind=t.constructor.key||t.constructor.name,this.host=t,this.form=i.form,this.target=function({lang:t,icons:e},{colorList:s,disableHEXInput:i,disableRemove:n,splitNum:o}){s||=wo,o=s===wo?9:o;let l="";for(let t,e=0,i=s.length,n=[];e<i;e++)t=s[e],t&&(("string"==typeof t||t.value)&&(n.push(t),e<i-1)||(n.length>0&&(l+=`<div class="se-selector-color">${_o(n,o)}</div>`,n=[]),"object"==typeof t&&(l+=`<div class="se-selector-color">${_o(t,o)}</div>`)));return l+=`\n\t\t<form class="se-form-group se-form-w0">\n\t\t\t${i?"":`<button type="button" class="se-btn __se_hue" title="${t.colorPicker}" aria-label="${t.colorPicker}">${e.color_palette}</button>`}\n\t\t\t<input type="text" class="se-color-input" ${i?"readonly":""} placeholder="${t.color}" />\n\t\t\t${i?"":`<button type="submit" class="se-btn se-btn-success" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>`}\n\t\t\t${n?"":`<button type="button" class="se-btn __se_remove" title="${t.remove}" aria-label="${t.remove}">${e.remove_color}</button>`}\n\t\t</form>`,Ht.utils.createElement("DIV",{class:"se-list-inner"},l)}(this.#X,i),this.targetButton=null,this.inputElement=this.target.querySelector(".se-color-input"),this.styleProperties=s,this.splitNum=i.splitNum||0,this.defaultColor=i.defaultColor||"",this.hueSliderOptions=i.hueSliderOptions,this.currentColor="",this.colorList=this.target.querySelectorAll("li button")||[],this.hueSlider=null;const n=(new DOMParser).parseFromString(this.#X.icons.color_checked,"image/svg+xml");this.checkedIcon=n.documentElement,i.disableHEXInput||(this.hueSlider=new Co(this,e,i.hueSliderOptions,"se-dropdown"),this.#X.eventManager.addEvent(this.target.querySelector(".__se_hue"),"click",this.#Go.bind(this)),this.#X.eventManager.addEvent(this.inputElement,"input",this.#Zo.bind(this)),this.#X.eventManager.addEvent(this.target.querySelector("form"),"submit",this.#jo.bind(this))),i.disableRemove||this.#X.eventManager.addEvent(this.target.querySelector(".__se_remove"),"click",this.#Ko.bind(this)),this.#X.eventManager.addEvent(this.target,"click",this.#Yo.bind(this)),this.form.appendChild(this.target)}init(t,e,s){this.targetButton=e,"function"!=typeof s&&(s=()=>!1);let i=("string"==typeof t?t:this.#Xo(t,s))||this.defaultColor;i=Mt.isHexColor(i)?i:Mt.rgb2hex(i)||i||"";const n=this.colorList;for(let t,e=0,s=n.length;e<s;e++)t=n[e],i.toLowerCase()===t.getAttribute("data-value").toLowerCase()?(t.appendChild(this.checkedIcon),Ht.utils.addClass(t,"active")):(Ht.utils.removeClass(t,"active"),t.contains(this.checkedIcon)&&Ht.utils.removeItem(this.checkedIcon));this.#Jo(this.#Qo(i))}setHexColor(t){this.currentColor=t,this.inputElement.style.borderColor=t}hueSliderClose(){this.hueSlider.close()}hueSliderAction(t){this.#Jo(t.hex)}hueSliderCancelAction(){this.form.style.display="block",this.host.colorPickerHueSliderClose?.()}#Jo(t){t=!t||/^#/.test(t)?t:"#"+t,this.inputElement.value=t,this.setHexColor.call(this,t)}#Xo(t,e){let s="";const i=this.styleProperties;for(;t&&!e(t)&&!Ht.check.isWysiwygFrame(t)&&0===s.length;)W(t)&&t.style[i]&&(s=t.style[i]),t=t.parentNode;return s}#Qo(t){if(!t||/^#/.test(t))return t;const e=Ht.utils.createElement("div",{style:"display: none; color: "+t}),s=Et._w.getComputedStyle(Et._d.body.appendChild(e)).color.match(/\d+/g).map((function(t){return parseInt(t,10)}));return Ht.utils.removeItem(e),s.length>=3?"#"+((1<<24)+(s[0]<<16)+(s[1]<<8)+s[2]).toString(16).substring(1):""}#Go(){this.hueSlider.open(this.targetButton),this.host.colorPickerHueSliderOpen?.()}#jo(t){t.preventDefault(),this.host.colorPickerAction?.(this.currentColor)}#Yo(t){const e=Ht.query.getEventTarget(t).getAttribute("data-value");e&&this.host.colorPickerAction?.(e)}#Ko(){this.host.colorPickerAction?.(null)}#Zo(t){const e=Ht.query.getEventTarget(t);this.setHexColor(e.value)}},{_w:$o}=Et,So={w:"ns-resize",h:"ew-resize",c:"nwse-resize",wRTL:"ns-resize",hRTL:"ew-resize",cRTL:"nesw-resize"};const ko=class{#X;#tl;#el;#sl;#Ii;#ve;#zi=null;#il=!1;#nl=null;#ol=null;#ll="";#rl=0;#al=0;#cl=null;#hl=null;constructor(t,e,s){this.#X=e,this.inst=t,this.kind=t.constructor.key||t.constructor.name,this.form=s,this.isUpdate=!1,this.focusElement=s.querySelector("[data-focus]"),this.#tl=this.#X.contextProvider.carrierWrapper.querySelector(".se-modal"),this.#el=this.#X.contextProvider.carrierWrapper.querySelector(".se-modal .se-modal-inner"),this.#Ii=[this.#dl.bind(this),this.#ul.bind(this)],this.#el.appendChild(s),this.#X.eventManager.addEvent(s.querySelector("form"),"submit",this.#Me.bind(this)),this.#il=!this.#X.eventManager.addEvent(s.querySelector('[data-command="close"]'),"click",this.close.bind(this)),(s.querySelector(".se-modal-resize-handle-w")||s.querySelector(".se-modal-resize-handle-h")||s.querySelector(".se-modal-resize-handle-c")||s.querySelector(".se-modal-resize-form"))&&!(this.#sl=s.querySelector(".se-modal-resize-form"))&&(this.#sl=s.querySelector(".se-modal-body"))&&(this.#X.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-w"),"mousedown",this.#pl.bind(this,"w")),this.#X.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-h"),"mousedown",this.#pl.bind(this,"h")),this.#X.eventManager.addEvent(s.querySelector(".se-modal-resize-handle-c"),"mousedown",this.#pl.bind(this,"c")),this.#ve={mousemove:this.#gl.bind(this),mouseup:this.#ml.bind(this)})}static CreateFileInput({icons:t,lang:e},{acceptedFormats:s,allowMultiple:i}){return`\n\t\t<div class="se-modal-form-files">\n\t\t\t<div class="se-flex-input-wrapper">\n\t\t\t\t<div class="se-input-form-abs">\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<div class="se-input-file-w">\n\t\t\t\t\t\t\t<div class="se-input-file-icon-up">${t.upload_tray}</div>\n\t\t\t\t\t\t\t<div class="se-input-file-icon-files">${t.file_plus}</div>\n\t\t\t\t\t\t\t<span class="se-input-file-cnt"></span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-form __se__file_input" data-focus type="file" accept="${s}"${i?' multiple="multiple"':""}/>\n\t\t\t</div>\n\t\t\t<button type="button" class="se-btn se-modal-files-edge-button se-file-remove se-tooltip" aria-label="${e.remove}">\n\t\t\t\t${t.selection_remove}\n\t\t\t\t${Ht.utils.createTooltipInner(e.remove)}\n\t\t\t</button>\n\t\t</div>`}static OnChangeFile(t,e){if(!t||!e)return;const s=t.querySelector(".se-input-file-cnt"),i=t.querySelector(".se-input-file-icon-up"),n=t.querySelector(".se-input-file-icon-files");e.length>1?(i.style.display="none",n.style.display="inline-block",s.style.display="",s.textContent=` ..${e.length}`):e.length>0?(i.style.display="none",n.style.display="none",s.style.display="block",s.textContent=e[0].name):(i.style.display="inline-block",n.style.display="none",s.style.display="",s.textContent="")}open(){if(this.#X.ui.offCurrentModal(),this.#fl(!0),this.#il&&(this.#nl&&this.#X.eventManager.removeEvent(this.#nl),this.#nl=this.#X.eventManager.addEvent(this.#el,"click",this.#Ii[1])),this.#zi&&=this.#X.eventManager.removeGlobalEvent(this.#zi),this.#zi=this.#X.eventManager.addGlobalEvent("keydown",this.#Ii[0]),this.isUpdate=this.kind===this.#X.ui.currentControllerName,this.#X.ui.opendModal=this,this.isUpdate||this.inst.modalInit?.(),this.inst.modalOn?.(this.isUpdate),Ht.utils.addClass(this.#tl,"se-backdrop-show"),Ht.utils.addClass(this.form,"se-modal-show"),this.#sl){const t=this.#vl(),{maxWidth:e,maxHeight:s}=$o.getComputedStyle(this.form),i=this.form.offsetWidth-t.width+"px",n=`${this.form.offsetTop+(this.form.offsetHeight-this.#sl.offsetHeight)}px`;e&&"string"==typeof this.#ll&&Ht.utils.setStyle(this.#sl,"max-width",`calc(${e} - ${i})`),s&&Ht.utils.setStyle(this.#sl,"max-height",`calc(${s} - ${n})`)}this.focusElement&&this.focusElement.focus()}close(){this.#Ve(),this.#fl(!1),$o.setTimeout((()=>{this.#X.ui.opendModal=null}),0),this.#il&&this.#nl&&(this.#X.eventManager.removeEvent(this.#nl),this.#nl=null),this.#zi&&=this.#X.eventManager.removeGlobalEvent(this.#zi),Ht.utils.removeClass(this.#tl,"se-backdrop-show"),Ht.utils.removeClass(this.form,"se-modal-show"),this.inst.modalInit?.(),this.inst.modalOff?.(this.isUpdate),this.isUpdate||this.#X.focusManager.focus()}#fl(t){const e=this.#X.ui.opendControllers;for(let s=0;s<e.length;s++)e[s].fixed=t,e[s].form.style.display=t?"none":"block"}#vl(){const t=this.#X.offset.getGlobal(this.#sl);return this.#rl=t.top,this.#al=t.left,t}#Ne(t){this.#Ve(),this.#X.ui.enableBackWrapper(So[t]),this.#cl=this.#X.eventManager.addGlobalEvent("mousemove",this.#ve.mousemove,!0),this.#hl=this.#X.eventManager.addGlobalEvent("mouseup",this.#ve.mouseup,!0)}#Ve(){this.#X.ui.disableBackWrapper(),this.#cl&&=this.#X.eventManager.removeGlobalEvent(this.#cl),this.#hl&&=this.#X.eventManager.removeGlobalEvent(this.#hl)}async#Me(t){t.preventDefault(),t.stopPropagation(),this.#X.ui.showLoading();try{const t=await this.inst.modalAction();!1===t?this.#X.ui.hideLoading():void 0===t?this.close():(this.close(),this.#X.ui.hideLoading())}catch(t){throw this.close(),this.#X.ui.hideLoading(),Error(`[SUNEDITOR.Modal[${this.kind}].warn] ${t.message}`)}}#ul(t){const e=Ht.query.getEventTarget(t);(/close/.test(e.getAttribute("data-command"))||e===this.#el)&&this.close()}#dl(t){Nt.isEsc(t.code)&&this.close()}#pl(t,e){this.#ol=Ht.query.getEventTarget(e),Ht.utils.addClass(this.#ol,"active"),this.#Ne(this.#ll=t+(this.#X.options.get("_rtl")?"RTL":""))}#gl(t){switch(this.#ll){case"w":case"wRTL":{const e=t.clientY-this.#rl-this.#sl.offsetHeight;this.#sl.style.height=this.#sl.offsetHeight+e+"px";break}case"h":{const e=t.clientX-this.#al-this.#sl.offsetWidth;this.#sl.style.width=this.#sl.offsetWidth+e+"px";break}case"hRTL":{const e=this.#al-t.clientX;this.#sl.style.width=this.#sl.offsetWidth+e+"px";break}case"c":{const e=t.clientX-this.#al-this.#sl.offsetWidth,s=t.clientY-this.#rl-this.#sl.offsetHeight;this.#sl.style.width=this.#sl.offsetWidth+e+"px",this.#sl.style.height=this.#sl.offsetHeight+s+"px";break}case"cRTL":{const e=this.#al-t.clientX,s=t.clientY-this.#rl-this.#sl.offsetHeight;this.#sl.style.width=this.#sl.offsetWidth+e+"px",this.#sl.style.height=this.#sl.offsetHeight+s+"px";break}}this.#vl(),this.inst.modalResize?.()}#ml(){Ht.utils.removeClass(this.#ol,"active"),this.#ol=null,this.#Ve()}};function Eo(t,e){const s=t.getAttribute(`data-se-${e}`);if(s)return s;const i=t.getAttribute(`data-${e}`);return i?(t.removeAttribute(`data-${e}`),t.setAttribute(`data-se-${e}`,i),i):null}const To=class{#X;constructor(t,e,s){this.#X=e,t.__fileManagement=this,this.kind=t.constructor.key||t.constructor.name,this.inst=t,this.query=s.query,this.loadEventName=s.loadEventName,this.actionEventName=s.actionEventName,this.infoList=[],this.infoIndex=0,this.uploadFileLength=0,this.__updateTags=[],this.apiManager=new An(this,null),this._resetInfo,this._checkInfo}upload(t,e,s,i,n){this.#X.ui.showLoading();let o=null;if("length"in s){o=new FormData;for(let t=0,e=s.length;t<e;t++)o.append("file-"+t,s[t]);this.uploadFileLength=s.length}else o=s.formData,this.uploadFileLength=s.size;this.apiManager.call({method:"POST",url:t,headers:e,data:o,callBack:i,errorCallBack:n})}async asyncUpload(t,e,s){this.#X.ui.showLoading();let i=null;if("length"in s){i=new FormData;for(let t=0,e=s.length;t<e;t++)i.append("file-"+t,s[t]);this.uploadFileLength=s.length}else i=s.formData,this.uploadFileLength=s.size;return await this.apiManager.asyncCall({method:"POST",url:t,headers:e,data:i})}setFileData(t,{name:e,size:s}){t&&(t.setAttribute("data-se-file-name",e),t.setAttribute("data-se-file-size",s+""))}getSize(){let t=0;for(let e=0,s=this.infoList.length;e<s;e++)t+=1*this.infoList[e].size;return t}_checkInfo(t){const e=[].slice.call(this.#X.frameContext.get("wysiwyg").querySelectorAll(this.query)),s=this.infoList;if(e.length===s.length){let t=!1;for(let i,n=0,o=s.length;n<o;n++)if(i=s[n],0===e.filter((function(t){return i.src===t.src&&i.index.toString()===Eo(t,"index")})).length){t=!0;break}if(!t)return}const i=[],n=[];for(let t=0,e=s.length;t<e;t++)n[t]=s[t].index;for(this.__updateTags=e;e.length>0;){const t=e.shift();Eo(t,"index")&&n.includes(Number(Eo(t,"index")))?i.push(Number(Eo(t,"index"))):(i.push(this.infoIndex),t.removeAttribute("data-se-index"),this.#bl(t,null))}if(t&&this.loadEventName)this.#X.eventManager.triggerEvent(this.loadEventName,{infoList:s});else for(let t,e=0;e<s.length;e++){if(t=s[e].index,i.includes(t))continue;s.splice(e,1);const n={element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};this.actionEventName&&this.#X.eventManager.triggerEvent(this.actionEventName,n),this.#X.eventManager.triggerEvent("onFileManagerAction",{...n,pluginName:this.kind}),e--}}_resetInfo(){const t={element:null,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind};for(let e=0,s=this.infoList.length;e<s;e++)this.actionEventName&&this.#X.eventManager.triggerEvent(this.actionEventName,{...t,index:this.infoList[e].index,pluginName:this.kind}),this.#X.eventManager.triggerEvent("onFileManagerAction",{...t,index:this.infoList[e].index,pluginName:this.kind});this.infoList=[],this.infoIndex=0}#yl(t){if(t>=0)for(let e=0,s=this.infoList.length;e<s;e++)if(t===this.infoList[e].index)return this.infoList.splice(e,1),void(this.actionEventName&&this.#X.eventManager.triggerEvent(this.actionEventName,{element:null,index:t,state:"delete",info:null,remainingFilesCount:0,pluginName:this.kind}))}#bl(t,e){let s=Number(Eo(t,"index")),i=null,n="";if(e||={name:Eo(t,"file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:Number(Eo(t,"file-size"))||0},s&&this.#X.store._editorInitFinished){n="update",s*=1;for(let t=0,e=this.infoList.length;t<e;t++)if(s===this.infoList[t].index){i=this.infoList[t];break}i||(s=this.infoIndex++,i={index:s},this.infoList.push(i)),i.src=t.src,i.name=Eo(t,"file-name"),i.size=Number(Eo(t,"file-size"))}else n="create",s=this.infoIndex++,t.setAttribute("data-se-index",s+""),t.setAttribute("data-se-file-name",e.name),t.setAttribute("data-se-file-size",e.size+""),i={src:t.src,index:s,name:e.name,size:e.size},this.infoList.push(i);i.element=t,i.delete=function(t,e){this.inst.componentDestroy?.(e),t(Number(Eo(e,"index")))}.bind(this,this.#yl.bind(this),t),i.select=function(t,e){e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"});const s=t.get(e);s?t.select(s.target,s.pluginName):this.inst.componentSelect?.(e)}.bind(this,this.#X.component,t);const o={element:t,index:s,state:n,info:i,remainingFilesCount:--this.uploadFileLength<0?0:this.uploadFileLength,pluginName:this.kind};this.actionEventName&&this.#X.eventManager.triggerEvent(this.actionEventName,o),this.#X.eventManager.triggerEvent("onFileManagerAction",{...o,pluginName:this.kind})}},{_w:Mo,NO_EVENT:Ho}=Et;const Lo=class{#X;#Cl;#wl;#_l;#xl;constructor(t,e,s){this.#X=t,this.openNewWindow=!!s.openNewWindow,this.relList=Array.isArray(s.relList)?s.relList:[],this.defaultRel=s.defaultRel||{},this.noAutoPrefix=!!s.noAutoPrefix,s.enableFileUpload&&(this.uploadUrl="string"==typeof s.uploadUrl?s.uploadUrl:null,this.uploadHeaders=s.uploadHeaders||null,this.uploadSizeLimit=Lt.get(s.uploadSizeLimit,0)||null,this.uploadSingleSizeLimit=Lt.get(s.uploadSingleSizeLimit,0)||null,this.input=Ht.utils.createElement("input",{type:"file",accept:s.acceptedFormats||"*"}),this.#X.eventManager.addEvent(this.input,"change",this.#$l.bind(this)),this.fileManager=new To(this,t,{query:"a[download]:not([data-se-file-download])",loadEventName:"onFileLoad",actionEventName:"onFileAction"}));const i=function(t,e,s){const i=t.lang,n=t.icons,o=e.textToDisplay?"":'style="display: none;"',l=e.title?"":'style="display: none;"';let r=`\n\t\t<div class="se-modal-body">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${i.link_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input data-focus class="se-input-form se-input-url" type="text" placeholder="${t.options.get("defaultUrlProtocol")||""}" />\n\t\t\t\t\t${e.enableFileUpload?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_upload_button" aria-label="${i.fileUpload}">\n\t\t\t\t\t\t\t\t\t${n.file_upload}\n\t\t\t\t\t\t\t\t\t${Ht.utils.createTooltipInner(i.fileUpload)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t\t<button type="button" class="se-btn se-tooltip se-modal-files-edge-button _se_bookmark_button" aria-label="${i.link_modal_bookmark}">\n\t\t\t\t\t\t${n.bookmark}\n\t\t\t\t\t\t${Ht.utils.createTooltipInner(i.link_modal_bookmark)}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div class="se-anchor-preview-form">\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_bookmark_icon">${n.bookmark}</span>\n\t\t\t\t\t<span class="se-svg se-anchor-preview-icon _se_anchor_download_icon">${n.download}</span>\n\t\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t\t</div>\n\t\t\t\t<label ${o}>${i.link_modal_text}</label>\n\t\t\t\t<input class="se-input-form _se_display_text" type="text" ${o} />\n\t\t\t\t<label ${l}>${i.title}</label>\n\t\t\t\t<input class="se-input-form _se_title" type="text" ${l} />\n\t\t\t</div>\n\t\t\t<div class="se-modal-form-footer">\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_check" /> ${i.link_modal_newWindowCheck}</label>\n\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_anchor_download" /> ${i.link_modal_downloadLinkCheck}</label>`;s.length>0&&(r+=`\n\t\t\t<div class="se-anchor-rel">\n\t\t\t\t<button type="button" class="se-btn se-tooltip se-anchor-rel-btn" title="${i.link_modal_relAttribute}" aria-label="${i.link_modal_relAttribute}">\n\t\t\t\t\t${n.link_rel}\n\t\t\t\t\t${Ht.utils.createTooltipInner(i.link_modal_relAttribute)}\n\t\t\t\t</button>\n\t\t\t\t<div class="se-anchor-rel-wrapper"><pre class="se-link-preview se-anchor-rel-preview"></pre></div>\n\t\t\t</div>\n\t\t</div>`);return r+="</div></div>",Ht.utils.createElement("DIV",null,r)}(t,s,this.relList);if(this.host=(Mo.location.origin+Mo.location.pathname).replace(/\/$/,""),this.urlInput=i.querySelector(".se-input-url"),this.displayInput=i.querySelector("._se_display_text"),this.titleInput=i.querySelector("._se_title"),this.newWindowCheck=i.querySelector("._se_anchor_check"),this.downloadCheck=i.querySelector("._se_anchor_download"),this.download=i.querySelector("._se_anchor_download_icon"),this.preview=i.querySelector(".se-link-preview"),this.bookmark=i.querySelector("._se_anchor_bookmark_icon"),this.bookmarkButton=i.querySelector("._se_bookmark_button"),this.currentRel=[],this.currentTarget=null,this.linkValue="",this.#wl=this.relList.length>0,this.#wl){this.relButton=i.querySelector(".se-anchor-rel-btn"),this.relPreview=i.querySelector(".se-anchor-rel-preview");const e=this.relList,s=(this.defaultRel.default||"").split(" "),n=[];for(let t,i=0,o=e.length;i<o;i++)t=e[i],n.push(Ht.utils.createElement("BUTTON",{type:"button",class:"se-btn-list"+(s.includes(t)?" se-checked":""),"data-command":t,title:t,"aria-label":t},t+'<span class="se-svg">'+this.#X.icons.checked+"</span>"));this.#_l=new ms(t,{checkList:!0,position:"right-middle",dir:"ltr"}),this.#_l.on(this.relButton,this.#Sl.bind(this)),this.#_l.create(n),this.#X.eventManager.addEvent(this.relButton,"click",this.#kl.bind(this))}this.#Cl=e,this.#Cl.querySelector(".se-anchor-editor").appendChild(i),this.#xl=new ms(t,{checkList:!1,position:"bottom-left",dir:"ltr"}),this.#xl.on(this.urlInput,this.#El.bind(this)),this.#X.eventManager.addEvent(this.newWindowCheck,"change",this.#Tl.bind(this)),this.#X.eventManager.addEvent(this.downloadCheck,"change",this.#Ml.bind(this)),this.#X.eventManager.addEvent(this.urlInput,"input",this.#Hl.bind(this)),this.#X.eventManager.addEvent(this.urlInput,"focus",this.#Ll.bind(this)),this.#X.eventManager.addEvent(this.bookmarkButton,"click",this.#Nl.bind(this)),this.#X.eventManager.addEvent(i.querySelector("._se_upload_button"),"click",(()=>this.input.click()))}set(t){this.currentTarget=t}on(t){if(t){if(this.currentTarget){const t=this.currentTarget.href;this.linkValue=this.preview.textContent=this.urlInput.value=this.#Al(t)?t.substring(t.lastIndexOf("#")):t,this.displayInput.value=this.currentTarget.textContent,this.titleInput.value=this.currentTarget.title,this.newWindowCheck.checked=!!/_blank/i.test(this.currentTarget.target),this.downloadCheck.checked=!!this.currentTarget.download}}else this.init(),this.displayInput.value=this.#X.selection.get().toString().trim(),this.newWindowCheck.checked=this.openNewWindow,this.titleInput.value="";this.#Bl(t&&this.currentTarget?this.currentTarget.rel:this.defaultRel.default||""),this.#Il(this.linkValue)}create(t){if(0===this.linkValue.length)return null;const e=this.linkValue,s=0===this.displayInput.value.length?e:this.displayInput.value,i=this.currentTarget||Ht.utils.createElement("A");return this.#Vl(i,e,s,this.titleInput.value,t),this.linkValue=this.preview.textContent=this.urlInput.value=this.displayInput.value="",i}init(){this.currentTarget=null,this.linkValue=this.preview.textContent=this.urlInput.value="",this.displayInput.value="",this.newWindowCheck.checked=!1,this.downloadCheck.checked=!1,this.#Bl(this.defaultRel.default||"")}#Vl(t,e,s,i,n){!this.#Al(e)&&this.downloadCheck.checked?t.setAttribute("download",s||e):t.removeAttribute("download"),this.newWindowCheck.checked?t.target="_blank":t.removeAttribute("target");const o=this.currentRel.join(" ");o?t.rel=o:t.removeAttribute("rel"),t.href=e,i?t.title=i:t.removeAttribute("title"),n?0===t.children.length&&(t.textContent=""):t.textContent=s}#Al(t){const e=Mo.location.href.replace(/\/$/,"");return 0===t.indexOf("#")||0===t.indexOf(e)&&t.indexOf("#")===(e.includes("#")?e.substring(0,e.indexOf("#")).length:e.length)}#Bl(t){if(!this.#wl)return;const e=this.currentRel=t?t.split(" "):[],s=this.#_l.form.querySelectorAll("button");for(let t,i=0,n=s.length;i<n;i++)t=s[i].getAttribute("data-command"),e.includes(t)?Ht.utils.addClass(s[i],"se-checked"):Ht.utils.removeClass(s[i],"se-checked");this.relPreview.title=this.relPreview.textContent=e.join(" "),e.length>0?Ht.utils.addClass(this.relButton,"on"):Ht.utils.removeClass(this.relButton,"on")}#Ol(t){const e=Ht.query.getListChildren(this.#X.frameContext.get("wysiwyg"),(t=>/h[1-6]/i.test(t.nodeName)||Ht.check.isAnchor(t)&&!!t.id),null);if(0===e.length)return;const s=new RegExp(`^${t.replace(/^#/,"")}`,"i"),i=[],n=[];for(let t,o=0,l=e.length;o<l;o++)t=e[o],s.test(t.textContent)&&(i.push(t),n.push(Ht.check.isAnchor(t)?`<div><span class="se-text-prefix-icon">${this.#X.icons.bookmark_anchor}</span>${t.id}</div>`:`<div style="${t.style.cssText}">${t.textContent}</div>`));0===i.length?this.#xl.close():(this.#xl.create(i,n),this.#xl.open(this.#X.options.get("_rtl")?"bottom-right":""))}#Il(t){const e=this.preview,s=this.#X.options.get("defaultUrlProtocol"),i=this.noAutoPrefix,n=/^(mailto:|tel:|sms:|https*:\/\/|#)/.test(t)||0===t.indexOf(s),o=!!s&&RegExp("^"+Tt.escapeStringRegexp(t.substring(0,s.length))).test(s);t=this.linkValue=e.textContent=t?i?t:!s||n||o?n?t:/^www\./.test(t)?"http://"+t:this.host+(/^\//.test(t)?"":"/")+t:s+t:"",this.#Al(t)?(this.bookmark.style.display="block",Ht.utils.addClass(this.bookmarkButton,"active")):(this.bookmark.style.display="none",Ht.utils.removeClass(this.bookmarkButton,"active")),!this.#Al(t)&&this.downloadCheck.checked?this.download.style.display="block":this.download.style.display="none"}#Rl(t){const e=this.currentRel;if(!t)return e.join(" ");if(/^only:/.test(t))return t=t.replace(/^only:/,"").trim(),this.currentRel=t.split(" "),t;const s=t.split(" ");for(let t=0,i=s.length;t<i;t++)e.includes(s[t])||e.push(s[t]);return e.join(" ")}#zl(t){if(!t)return this.currentRel.join(" ");/^only:/.test(t)&&(t=t.replace(/^only:/,"").trim());const e=this.currentRel.join(" ").replace(RegExp(t+"\\s*"),"");return this.currentRel=e.split(" "),e}#Fl(t){const e=t.result[0];this.linkValue=this.preview.textContent=this.urlInput.value=e.url,this.displayInput.value=e.name,this.downloadCheck.checked=!0,this.download.style.display="block"}async#Pl(t){const e=await this.#X.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===Ho?t.errorMessage:e||t.errorMessage;this.#X.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#Dl(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Pl(e):this.#Fl(e)}async#$l(t){const e=Ht.query.getEventTarget(t).files;if(!e[0])return;const s={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:e},i=async function(t,e,s){e=s||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Dl.bind(this),s),n=await this.#X.eventManager.triggerEvent("onFileUploadBefore",{info:s,handler:i});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&i(n),void(!0!==n&&n!==Ho||i(null)))}#kl(){this.#_l.open(this.#X.options.get("_rtl")?"left-middle":"")}#El(t){const e=t.id||"h_"+Math.random().toString().replace(/.+\./,"");t.id=e,this.urlInput.value="#"+e,this.#Il(this.urlInput.value),this.#xl.close(),this.urlInput.focus()}#Sl(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.currentRel,i=s.indexOf(e);-1===i?s.push(e):s.splice(i,1),this.relPreview.title=this.relPreview.textContent=s.join(", ")}#Hl(t){const e=Ht.query.getEventTarget(t).value.trim();this.#Il(e),this.#Al(e)?this.#Ol(e):this.#xl.close()}#Ll(){const t=this.urlInput.value;this.#Al(t)&&this.#Ol(t)}#Nl(){let t=this.urlInput.value;this.#Al(t)?(t=t.substring(1),this.bookmark.style.display="none",Ht.utils.removeClass(this.bookmarkButton,"active")):(t="#"+t,this.bookmark.style.display="block",Ht.utils.addClass(this.bookmarkButton,"active"),this.downloadCheck.checked=!1,this.download.style.display="none",this.#Ol(t)),this.urlInput.value=t,this.#Il(t),this.urlInput.focus()}#Tl(t){if("string"!=typeof this.defaultRel.check_new_window)return;Ht.query.getEventTarget(t).checked?this.#Bl(this.#Rl(this.defaultRel.check_new_window)):this.#Bl(this.#zl(this.defaultRel.check_new_window))}#Ml(t){Ht.query.getEventTarget(t).checked?(this.download.style.display="block",this.bookmark.style.display="none",Ht.utils.removeClass(this.bookmarkButton,"active"),this.linkValue=this.preview.textContent=this.urlInput.value=this.urlInput.value.replace(/^#+/,""),"string"==typeof this.defaultRel.check_bookmark&&this.#Bl(this.#Rl(this.defaultRel.check_bookmark))):(this.download.style.display="none","string"==typeof this.defaultRel.check_bookmark&&this.#Bl(this.#zl(this.defaultRel.check_bookmark)))}},No={init(t){return{create:(e,s)=>this.create(e,s,t)}},create(t,e,s){if("object"!=typeof e&&(e={}),s&&(e=[s,e].reduce(((t,e)=>(Object.entries(e).forEach((([e,s])=>{if("plugins"===e&&s&&t[e]){const i=Array.isArray(t[e])?t[e]:Object.values(t[e]),n=Array.isArray(s)?s:Object.values(s);t[e]=[...n.filter((t=>!i.includes(t))),...i]}else t[e]=s})),t)),{})),!t)throw Error('[SUNEDITOR.create.fail] The first parameter "target" is missing.');const i=[];if("string"==typeof t){const e=document.querySelector(t);if(!e)throw Error(`[SUNEDITOR.create.fail]-[document.querySelector(${t})] Cannot find target element. Make sure "${t}" is a valid selector and exists in the document.`);i.push({key:null,target:e})}else if(1===t.nodeType)i.push({key:null,target:t});else{let e;for(const s in t){if(e=t[s],!e.target||1!==e.target.nodeType)throw Error('[SUNEDITOR.create.fail] suneditor multi root requires textarea\'s element at the "target" property.');e.key=s,i.push(e)}}return new Nn(i,e)}};class Ao extends ri{static type="";static key="";static className="";static options={};constructor(t){super(t),this.title="",this.icon="",this.beforeItem=null,this.afterItem=null,this.replaceButton=null}}class Bo extends Ao{static type="browser";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}close(){throw new Error(`[${this.constructor.name}] Abstract method 'close()' must be implemented`)}}class Io extends Ao{static type="command";action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class Vo extends Ao{static type="dropdown";on(t){}action(t){throw new Error(`[${this.constructor.name}] Abstract method 'action()' must be implemented`)}}class Oo extends Ao{static type="dropdown-free";on(t){}off(){}}class Ro extends Ao{static type="field"}class zo extends Ao{static type="input";toolbarInputKeyDown(t){}toolbarInputChange(t){}}class Fo extends Ao{static type="modal";open(t){throw new Error(`[${this.constructor.name}] Abstract method 'open()' must be implemented`)}}class Po extends Ao{static type="popup";show(){throw new Error(`[${this.constructor.name}] Abstract method 'show()' must be implemented`)}}const Do=class extends Io{static key="blockquote";static className="";constructor(t){super(t),this.title=this.$.lang.tag_blockquote,this.icon="blockquote",this.quoteTag=Ht.utils.createElement("BLOCKQUOTE")}active(t,e){return/blockquote/i.test(t?.nodeName)?(Ht.utils.addClass(e,"active"),!0):(Ht.utils.removeClass(e,"active"),!1)}action(){const t=Ht.query.getParentElement(this.$.selection.getNode(),"blockquote");t?this.$.format.removeBlock(t,{selectedFormats:null,newBlockElement:null,shouldDelete:!1,skipHistory:!1}):this.$.format.applyBlock(this.quoteTag.cloneNode(!1))}},{_w:qo,_d:Wo}=Et;const Uo=class extends Io{static key="exportPDF";static className="se-component-enabled";constructor(t,e){super(t),this.title=this.$.lang.exportPDF,this.icon="PDF",this.apiUrl=e.apiUrl,this.fileName=e.fileName||"suneditor-pdf",this.apiUrl?this.apiManager=new An(this,this.$,{method:"POST",url:this.apiUrl,headers:{"Content-Type":"application/json"},responseType:"blob"}):console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.')}async action(){if(!this.apiUrl)return void console.warn('[SUNEDITOR.plugins.exportPDF.error] Requires exportPDF."apiUrl" options.');this.$.ui.showLoading();let t=null;try{const e=this.$.frameContext.get("documentTypePageMirror")||this.$.frameContext.get("wysiwygFrame"),s=Ht.utils.createElement("div",{class:e.className},e.innerHTML);t=Ht.utils.createElement("div",{style:"position: absolute; top: -10000px; left: -10000px; width: 21cm; columns: 21cm; height: auto;"},s);const i=qo.getComputedStyle(e).padding,n=Ht.utils.applyInlineStylesAll(s,!0,this.$.options.get("allUsedStyles"));if(n.style.padding=n.style.paddingTop=n.style.paddingBottom=n.style.paddingLeft=n.style.paddingRight="0",t.innerHTML=`\n\t\t\t\t<style>\n\t\t\t\t\t@page {\n\t\t\t\t\t\tsize: A4;\n\t\t\t\t\t\tmargin: ${i};\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t${n.outerHTML}`,Wo.body.appendChild(t),!1===await this.$.eventManager.triggerEvent("onExportPDFBefore",{target:t}))return;return void await this.#ql(t)}catch(t){console.error("[SUNEDITOR.plugins.exportPDF.error]",t.message)}finally{Ht.utils.removeItem(t),this.$.ui.hideLoading()}}async#ql(t){const e={fileName:this.fileName,htmlContent:t.innerHTML},s=await this.apiManager.asyncCall({data:JSON.stringify(e)});if(200!==s.status){const t=s.responseText?JSON.parse(s.responseText):s;throw Error(`[SUNEDITOR.plugins.exportPDF.error] ${t.errorMessage}`)}const i=new Blob([s.response],{type:"application/pdf"}),n=s.getResponseHeader("Content-Disposition"),o=URL.createObjectURL(i),l=(n.match(/filename="([^"]+)/)||[])[1]||this.fileName+".pdf",r=Ht.utils.createElement("A",{href:o,download:l,style:"display: none;"},null);try{Wo.body.appendChild(r),r.click()}finally{qo.setTimeout((()=>{Ht.utils.removeItem(r),URL.revokeObjectURL(o)}),100)}}},{NO_EVENT:Go}=Et;class Zo extends Io{static key="fileUpload";static className="";static options={eventIndex:1e4};static component(t){return Ht.check.isAnchor(t)&&t.hasAttribute("data-se-file-download")?t:null}#Wl;#Ul=null;constructor(t,e){super(t),this.title=this.$.lang.fileUpload,this.icon="file_upload",e.uploadUrl||console.warn('[SUNEDITOR.fileUpload.warn] "fileUpload" plugin must be have "uploadUrl" option.'),this.uploadUrl=e.uploadUrl,this.uploadHeaders=e.uploadHeaders,this.uploadSizeLimit=Lt.get(e.uploadSizeLimit,0),this.uploadSingleSizeLimit=Lt.get(e.uploadSingleSizeLimit,0),this.allowMultiple=!!e.allowMultiple,this.acceptedFormats="string"!=typeof e.acceptedFormats?"*":e.acceptedFormats.trim()||"*",this.as=e.as||"box",this.insertBehavior=e.insertBehavior,this.input=Ht.utils.createElement("input",{type:"file",accept:this.acceptedFormats}),this.allowMultiple&&this.input.setAttribute("multiple","multiple"),this.#Wl=this.acceptedFormats.split(", ");const s={"custom-download":{command:"download",title:this.$.lang.download,icon:"download",action:t=>{const e=t.getAttribute("href");e&&Ht.utils.createElement("A",{href:e},null).click()}},"custom-as":{command:"as",value:"link",title:this.$.lang.asLink,icon:"reduction",action:(t,e)=>{this.convertFormat(t,e)}}},i=(e.controls||[["custom-as","align","edit","custom-download","copy","remove"]]).map((t=>t.map((t=>t.startsWith("custom-")?s[t]:t))));if(this.figure=new Es(this,this.$,i,{}),this.fileManager=new To(this,this.$,{query:"a[download][data-se-file-download]",loadEventName:"onFileLoad",actionEventName:"onFileAction"}),/\bedit\b/.test(JSON.stringify(i))){const t=function({lang:t,icons:e}){const s=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" />\n\t\t\t\t<button type="submit" data-command="edit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return Ht.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.controller=new ps(this,this.$,t,{position:"bottom",disabled:!0},Zo.key),this.editInput=t.querySelector("input")}this.$.eventManager.addEvent(this.input,"change",this.#$l.bind(this))}action(){this.$.store.set("_preventBlur",!0),this.input.click()}onFilePasteAndDrop({file:t}){const e=t.type;this.#Wl.some((t=>!!t.startsWith("*")||(!!t.startsWith(e)||void 0)))&&(this.submitFile([t]),this.$.focusManager.focus())}controllerAction(t){const e=t.getAttribute("data-command");if(e){if("edit"===e){if(0===this.editInput.value.trim().length)return;this.#Ul.textContent=this.editInput.value}this.controller.close(),this.$.component.select(this.#Ul,Zo.key)}}componentSelect(t){this.#Ul=t;const e=this.figure.controller.form.querySelector('[data-command="__c__as"]');if(e)return Ht.check.isFigure(t.parentElement)?(e.innerHTML=this.$.icons.reduction+Ht.utils.createTooltipInner(this.$.lang.asLink),e.setAttribute("data-value","link"),void this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})):(e.innerHTML=this.$.icons.expansion+Ht.utils.createTooltipInner(this.$.lang.asBlock),e.setAttribute("data-value","box"),this.figure.controllerOpen(t,{isWWTarget:!0}),!0)}componentEdit(t){this.editInput.value=t.textContent,this.figure.controllerHide(),this.controller.open(t,null,{isWWTarget:!Ht.check.isFigure(t.parentElement),initMethod:null,addOffset:null}),this.editInput.focus()}async componentDestroy(t){if(!t)return;const e=Es.GetContainer(t),s=Ht.query.getParentElement(t,".se-component")||t;if(!1===await this.$.eventManager.triggerEvent("onFileDeleteBefore",{element:e.target,container:e,url:e.target.getAttribute("href")}))return;const i=this.$.component.isInline(s)?s.previousSibling||s.nextSibling:s.previousElementSibling||s.nextElementSibling;Ht.utils.removeItem(s),this.$.ui.offCurrentController(),this.$.focusManager.focusEdge(i),this.$.history.push(!1)}async submitFile(t){if(0===t.length)return;let e=0;const s=[],i=this.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++){if(n=t[l],o=n.size,i>0&&o>i){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===Go?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.fileUpload.fail] Size of uploadable total files: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.$.ui.alertOpen(s===Go?t:s||t,"error"),!1}const l={url:this.uploadUrl,uploadHeaders:this.uploadHeaders,files:s},r=async function(t,e,s){e=s||e;t(await this.fileManager.asyncUpload(e.url,e.uploadHeaders,e.files))}.bind(this,this.#Dl.bind(this),l),a=await this.$.eventManager.triggerEvent("onFileUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Go||r(null)))}convertFormat(t,e){if("link"===e){this.figure.close();const{container:e}=Es.GetContainer(t),s=e.nextElementSibling,i=e.parentElement;t.removeAttribute("data-se-non-focus"),t.setAttribute("contenteditable","false"),Ht.utils.addClass(t,"se-component|se-inline-component");const n=Ht.utils.createElement(this.$.options.get("defaultLine"),null,t);i.insertBefore(n,s),Ht.utils.removeItem(e)}else{this.$.selection.setRange(t,0,t,1);const e=this.$.html.remove(),s=this.$.nodeTransform.split(e.container,e.offset,0);s?.previousElementSibling&&Ht.check.isZeroWidth(s.previousElementSibling)&&Ht.utils.removeItem(s.previousElementSibling),t.setAttribute("data-se-non-focus","true"),t.removeAttribute("contenteditable"),Ht.utils.removeClass(t,"se-component|se-component-selected|se-inline-component");const i=Es.CreateContainer(t,"se-file-figure se-flex-component");(s||e.container).parentElement.insertBefore(i.container,s)}this.$.history.push(!1),this.$.component.select(t,Zo.key)}create(t,e,s){const i=e.name||t,n=Ht.utils.createElement("A",{href:t,title:i,download:i,"data-se-file-download":"",contenteditable:"false","data-se-non-focus":"true","data-se-non-link":"true"},i);if(this.fileManager.setFileData(n,e),"link"===this.as)return n.className="se-component se-inline-component",void this.$.component.insert(n,{scrollTo:!!s,insertBehavior:s?this.insertBehavior:null});const o=Es.CreateContainer(n);if(Ht.utils.addClass(o.container,"se-file-figure|se-flex-component"),this.$.component.insert(o.container,{scrollTo:!!s,insertBehavior:s?this.insertBehavior:null})){if(s)if(this.$.options.get("componentInsertBehavior"))this.$.component.select(n,Zo.key);else{const t=this.$.format.addLine(o.container,null);t&&this.$.selection.setRange(t,0,t,0)}}else this.$.focusManager.focus()}#Fl(t){t.result.forEach(((t,e,s)=>{this.create(t.url,{name:t.name,size:t.size},e===s.length-1)}))}async#Pl(t){const e=await this.$.eventManager.triggerEvent("onFileUploadError",{error:t});if(!1===e)return;const s=e===Go?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.fileUpload.error]",s)}#Dl(t){const e=JSON.parse(t.responseText);e.errorMessage?this.#Pl(e):this.#Fl(e)}async#$l(t){const e=Ht.query.getEventTarget(t);await this.submitFile(e.files)}}const jo=Zo;class Ko extends Io{static key="list_bulleted";static className="se-icon-flip-rtl";#Gl;constructor(t){super(t),this.title=this.$.lang.bulletedList,this.icon="list_bulleted",this.afterItem=Ht.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Ko.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.bulletedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${e=["disc","circle","square"],e.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ul style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}\n\t\t</ul>\n\t</div>`;var e;return Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#Gl=e.querySelectorAll("li button ul"),this.$.menu.initDropdownTarget({key:Ko.key,type:"dropdown"},e)}active(t,e){return Ht.check.isListCell(t)&&/^UL$/i.test(t.parentElement.nodeName)?(Ht.utils.addClass(e,"active"),!0):(Ht.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ul")?.style.listStyleType;Ht.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#Gl,e=this.$.format.getBlock(this.$.selection.getNode()),s=e?.style?e.style.listStyleType||"disc":"";for(let e,i=0,n=t.length;i<n;i++)e=t[i],s===e.style.listStyleType?Ht.utils.addClass(e.parentElement,"active"):Ht.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ht.check.isText(s)){const t=s.substringData(e.key.length,s.textContent.length-1);s.textContent=t}this.submit()}submit(t){const e=this.$.listFormat.apply(`ul:${t||""}`,null,!1);e&&this.$.selection.setRange(e.sc,e.so,e.ec,e.eo),this.$.focusManager.focus(),this.$.history.push(!1)}}const Yo=Ko;class Xo extends Io{static key="list_numbered";static className="se-icon-flip-rtl";#Gl;constructor(t){super(t),this.title=this.$.lang.numberedList,this.icon="list_numbered",this.afterItem=Ht.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Xo.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.numberedList}</span></span>`);const e=function(){const t=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t\t${Jo(["decimal","upper-roman","lower-roman"])}\n\t\t</ul>\n\t\t<ul class="se-list-basic se-list-horizontal se-list-carrier">\n\t\t${Jo(["lower-latin","upper-latin","lower-greek"])}\n\t\t</ul>\n\t</div>`;return Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},t)}();this.#Gl=e.querySelectorAll("li button ol"),this.$.menu.initDropdownTarget({key:Xo.key,type:"dropdown"},e)}active(t,e){return Ht.check.isListCell(t)&&/^OL$/i.test(t.parentElement.nodeName)?(Ht.utils.addClass(e,"active"),!0):(Ht.utils.removeClass(e,"active"),!1)}action(t){const e=this.$.format.getBlock(this.$.selection.getNode()),s=t?.querySelector("ol")?.style.listStyleType;Ht.check.isList(e)&&s?e.style.listStyleType=s:this.submit(s),this.$.menu.dropdownOff()}on(){const t=this.#Gl,e=this.$.format.getBlock(this.$.selection.getNode()),s=e?.style?e.style.listStyleType||"decimal":"";for(let e,i=0,n=t.length;i<n;i++)e=t[i],s===e.style.listStyleType?Ht.utils.addClass(e.parentElement,"active"):Ht.utils.removeClass(e.parentElement,"active")}shortcut({range:t,info:e}){const{startContainer:s}=t;if(Ht.check.isText(s)){const t=s.substringData(e.key.length,s.textContent.length-1);s.textContent=t}this.submit()}submit(t){const e=this.$.listFormat.apply(`ol:${t||""}`,null,!1);e&&this.$.selection.setRange(e.sc,e.so,e.ec,e.eo),this.$.focusManager.focus(),this.$.history.push(!1)}}function Jo(t){return t.map((t=>`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-icon-flip-rtl" data-command="${t}" title="${t}" aria-label="${t}">\n\t\t\t\t\t<ol style="list-style-type: ${t};">\n\t\t\t\t\t\t<li></li><li></li><li></li>\n\t\t\t\t\t</ol>\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t`)).join("")}const Qo=Xo,{debounce:tl}=Mt;const el=class extends Ro{static key="mention";static className="";#Zl=0;#jl=0;#Kl=null;constructor(t,e){super(t),this.title=this.$.lang.mention,this.icon="mention",this.triggerText=e.triggerText||"@",this.limitSize=e.limitSize||5,this.searchStartLength=e.searchStartLength||0,this.delayTime="number"==typeof e.delayTime?e.delayTime:200,this.directData=e.data,this.apiUrl=e.apiUrl?.replace(/\s/g,"").replace(/\{limitSize\}/i,String(this.limitSize))||"",this.apiManager=new An(this,this.$,{headers:e.apiHeaders}),this.cachingData=e.useCachingData??1?new Map:null,this.cachingFieldData=e.useCachingFieldData??1?[]:null;const s=Ht.utils.createElement("DIV",{class:"se-controller se-empty-controller"},"<div></div>");this.selectMenu=new ms(this.$,{position:"right-bottom",dir:"ltr",closeMethod:()=>this.controller.close()}),this.controller=new ps(this,this.$,s,{position:"bottom",initMethod:()=>{this.apiManager.cancel(),this.selectMenu.close()}},null),this.selectMenu.on(s.firstElementChild,this.#Yl.bind(this)),this.onInput=tl(this.onInput.bind(this),this.delayTime)}async onInput(){this.directData||this.apiManager.cancel();const t=this.$.selection.get();if(!t.rangeCount)return void this.selectMenu.close();const e=t.anchorNode,s=t.anchorOffset,i=e.textContent.substring(0,s),n=i.lastIndexOf(this.triggerText);if(n>-1){const t=i.substring(n+1,s),o=i[n-1]?.trim();if(!/\s/.test(t)&&(!o||Ht.check.isZeroWidth(o))){if(t.length<this.searchStartLength)return;const i=e.parentNode;if(Ht.check.isAnchor(i)&&!i.getAttribute("data-se-mention"))return;try{return await this.#Xl(t,e),this.#Zl=n,this.#Kl=e,void(this.#jl=s)}catch(t){console.warn("[SUNEDITOR.mention.api.file] ",t)}}}this.selectMenu.close()}async#Xl(t,e){const s=this.limitSize,i=t.toLowerCase();let n=null;if(this.cachingData&&(n=this.cachingData.get(t)),!n)if(this.directData)n=this.directData.filter((t=>t.key.toLowerCase().startsWith(i))).slice(0,s);else{const e=await this.apiManager.asyncCall({method:"GET",url:this.#Jl(t)});n=JSON.parse(e.responseText)}if(this.cachingFieldData){const t=new Set;n=this.cachingFieldData.concat(n).filter((({key:e})=>!t.has(e)&&(t.add(e),e.toLowerCase().startsWith(i)))).slice(0,s)}if(!n?.length)return this.selectMenu.close(),!1;const o=[],l=[];for(let t,e=0,s=n.length;e<s;e++)t=n[e],o.push(t),l.push(`<div class="se-mention-item"><span>${t.key}</span><span>${t.name}</span></div>`);return 0===o.length?(this.selectMenu.close(),!1):(this.controller.open(e,null,{isWWTarget:!0,initMethod:null,addOffset:null}),this.selectMenu.create(o,l),this.selectMenu.open(),this.selectMenu.setItem(0),this.cachingData&&this.cachingData.set(t,o),!0)}#Jl(t){return this.apiUrl.replace(/\{key\}/i,t)}#Yl(t){if(!t)return!1;let e=null;const{key:s,name:i,url:n}=t,o=this.#Kl.parentNode;if(Ht.check.isAnchor(o))e=o,e.setAttribute("data-se-mention",s),e.setAttribute("href",n),e.setAttribute("title",i),e.textContent=this.triggerText+s;else if(this.$.selection.setRange(this.#Kl,this.#Zl,this.#Kl,this.#jl),e=Ht.utils.createElement("A",{"data-se-mention":s,href:n,title:i,target:"_blank"},this.triggerText+s),!this.$.html.insertNode(e,{afterNode:null,skipCharCount:!1}))return!1;this.selectMenu.close();const l=Ht.utils.createTextNode(" ");e.parentNode.insertBefore(l,e.nextSibling),this.$.selection.setRange(l,1,l,1),this.cachingFieldData&&!this.cachingFieldData.some((e=>e.key===t.key))&&this.cachingFieldData.push(t)}};class sl extends Vo{static key="align";static className="";constructor(t,e){super(t),this.title=this.$.lang.align,this.icon=this.$.options.get("_rtl")?"align_right":"align_left";const s=function({lang:t,icons:e,options:s},i){const n=Array.isArray(i)?i:s.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let o="";for(let s,i,l=0;l<n.length;l++)s=n[l],i=t["align"+s.charAt(0).toUpperCase()+s.slice(1)],o+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${s}" title="${i}" aria-label="${i}">\n\t\t\t\t<span class="se-list-icon">${e["align_"+s]}</span>${i}\n\t\t\t</button>\n\t\t</li>`;return Ht.utils.createElement("div",{class:"se-dropdown se-list-layer se-list-align"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${o}</ul>\n\t\t</div>`)}(this.$,e.items),i=this._itemMenu=s.querySelector("ul");this.defaultDir="",this.alignIcons={justify:this.$.icons.align_justify,left:this.$.icons.align_left,right:this.$.icons.align_right,center:this.$.icons.align_center},this.alignList=i.querySelectorAll("li button"),this.$.menu.initDropdownTarget(sl,s)}active(t,e){const s=e.firstElementChild;if(t){if(this.$.format.isLine(t)){const i=t.style.textAlign;return i?(Ht.utils.changeElement(s,this.alignIcons[i]||this.alignIcons[this.defaultDir]),e.setAttribute("data-focus",i),!0):void 0}}else Ht.utils.changeElement(s,this.alignIcons[this.defaultDir]),e.removeAttribute("data-focus");return!1}on(t){const e=t.getAttribute("data-focus")||this.defaultDir;if(!e)return;const s=this.alignList;for(let t=0,i=s.length;t<i;t++)e===s[t].getAttribute("data-command")?Ht.utils.addClass(s[t],"active"):Ht.utils.removeClass(s[t],"active")}action(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.defaultDir,i=this.$.format.getLines();for(let t=0,n=i.length;t<n;t++)Ht.utils.setStyle(i[t],"textAlign",e===s?"":e);this.$.store.set("_lastSelectionNode",null),this.$.menu.dropdownOff(),this.$.focusManager.focus(),this.$.history.push(!1)}setDir(){const t=this.#Ql();if(this.defaultDir===t)return;this.defaultDir=t;const e=this._itemMenu.querySelector('[data-command="left"]'),s=this._itemMenu.querySelector('[data-command="right"]');if(e&&s){const t=e.parentElement,i=s.parentElement;t.appendChild(s),i.appendChild(e)}}init(){this.defaultDir=this.#Ql()}#Ql(){const t=this.$.frameContext.get("wwComputedStyle").getPropertyValue("text-align");return["left","center","right","justify"].includes(t)?t:this.$.options.get("_rtl")?"right":"left"}}const il=sl;class nl extends Vo{static key="font";static className="se-btn-select se-btn-tool-font";#tr;constructor(t,e){super(t),this.title=this.$.lang.font,this.inner='<span class="se-txt">'+this.$.lang.font+"</span>"+this.$.icons.arrow_down;const s=e.items||["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],i=function({lang:t},e){let s=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">\n\t\t\t\t\t${t.default}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li class="se-btn-list se-sub-list"><span></span></li>`;for(let t,i,n=0,o=e.length;n<o;n++)t=e[n],i=t.split(",")[0],s+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t}" data-txt="${i}" title="${i}" aria-label="${i}" style="font-family:${t};">${i}</button>\n\t\t\t</li>`;return s+="\n\t\t</ul>\n\t</div>",Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-family"},s)}(this.$,s);this.currentFont="",this.fontList=i.querySelectorAll("ul li button"),this.fontArray=s,this.#tr=i.querySelector(".se-sub-list span"),this.$.menu.initDropdownTarget(nl,i)}active(t,e){const s=e.querySelector(".se-txt"),i=e.parentNode.querySelector(".se-tooltip-text");let n="";if(t){if(this.$.format.isLine(t))return;if(n=Ht.utils.getStyle(t,"fontFamily")){const t=n.replace(/["']/g,"");return Ht.utils.changeTxt(s,t),Ht.utils.changeTxt(i,this.$.lang.font+" ("+t+")"),!0}}else{const t=this.$.store.get("hasFocus")?this.$.frameContext.get("wwComputedStyle").fontFamily:this.$.lang.font;Ht.utils.changeTxt(s,t),Ht.utils.changeTxt(i,this.$.store.get("hasFocus")?this.$.lang.font+(t?" ("+t+")":""):t)}return!1}on(t){const e=this.fontList,s=t.querySelector(".se-txt").textContent;if(s!==this.currentFont){let t=!1;for(let i=0,n=e.length;i<n;i++)s===(e[i].getAttribute("data-command")||"").replace(/'|"/g,"")?(Ht.utils.addClass(e[i],"active"),t=!0):Ht.utils.removeClass(e[i],"active");this.currentFont=s,t?this.#tr.style.display="none":(this.#tr.textContent=s,this.#tr.style.display="block")}}async action(t){let e=t.getAttribute("data-command");if(e){if(/[\s\d\W]/.test(e)&&!/^['"].*['"]$/.test(e)&&(e=`"${e}"`),!1===await this.$.eventManager.triggerEvent("onFontActionBefore",{value:e}))return;const t=Ht.utils.createElement("SPAN",{style:"font-family: "+e+";"});this.$.inline.apply(t,{stylesToModify:["font-family"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["font-family"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}}const ol=nl;class ll extends Oo{static key="fontColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.fontColor,this.icon="font_color";const s=Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new xo(this,this.$,"color",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(ll,s)}active(t,e){const s=e.querySelector(".se-svg-color-helper");if(!s)return;let i="";if(t){if(this.$.format.isLine(t))return;if(i=Ht.utils.getStyle(t,"color"))return s.style.color=i,!0}else s.style.color=i;return!1}on(t){this.colorPicker.init(this.$.selection.getNode(),t,(t=>this.$.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=Ht.utils.createElement("SPAN",{style:"color: "+t+";"});this.$.inline.apply(e,{stylesToModify:["color"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["color"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}}const rl=ll;class al extends Oo{static key="backgroundColor";static className="";constructor(t,e){super(t),this.title=this.$.lang.backgroundColor,this.icon="background_color";const s=Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},null);this.colorPicker=new xo(this,this.$,"backgroundColor",{form:s,colorList:e.items,splitNum:e.splitNum,disableHEXInput:e.disableHEXInput,hueSliderOptions:{controllerOptions:{isOutsideForm:!0}}}),this.$.menu.initDropdownTarget(al,s)}active(t,e){const s=e.querySelector("path.se-svg-color-helper");if(!s)return;let i="";if(t){if(this.$.format.isLine(t))return;if(i=Ht.utils.getStyle(t,"backgroundColor"))return s.style.color=i,!0}else s.style.color=i;return!1}on(t){this.colorPicker.init(this.$.selection.getNode(),t,(t=>this.$.format.isLine(t)))}off(){this.colorPicker.hueSliderClose()}colorPickerAction(t){if(t){const e=Ht.utils.createElement("SPAN",{style:"background-color: "+t+";"});this.$.inline.apply(e,{stylesToModify:["background-color"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["background-color"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}}const cl=al;class hl extends Vo{static key="hr";static className="";static component(t){return/^hr$/i.test(t?.nodeName)?t:null}constructor(t,e){super(t),this.title=this.$.lang.horizontalLine,this.icon="horizontal_line";const s=function({lang:t},e){const s=e||[{name:t.hr_solid,class:"__se__solid",style:null},{name:t.hr_dashed,class:"__se__dashed",style:null},{name:t.hr_dotted,class:"__se__dotted",style:null}];let i="";for(let t=0,e=s.length;t<e;t++)i+=`\n\t\t<li>\n\t\t\t<button type="button" class="se-btn se-btn-list" data-command="hr" title="${s[t].name}" aria-label="${s[t].name}">\n\t\t\t\t<hr${s[t].class?` class="${s[t].class}"`:""}${s[t].style?` style="${s[t].style}"`:""}/>\n\t\t\t</button>\n\t\t</li>`;return Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-line"},`\n\t\t<div class="se-list-inner">\n\t\t\t<ul class="se-list-basic">${i}</ul>\n\t\t</div>`)}(this.$,e.items);this.list=s.querySelectorAll("button"),this.$.menu.initDropdownTarget(hl,s)}componentSelect(t){Ht.utils.addClass(t,"on")}componentDeselect(t){Ht.utils.removeClass(t,"on")}componentDestroy(t){if(!t)return;const e=t.previousElementSibling||t.nextElementSibling;Ht.utils.removeItem(t),this.$.focusManager.focusEdge(e),this.$.history.push(!1)}shortcut({line:t,range:e}){const s=this.$.nodeTransform.split(e.endContainer,e.endOffset,0);this.submit("__se__solid"),Ht.utils.removeItem(t),this.$.selection.setRange(s,0,s,0)}action(t){const e=this.submit(t.firstElementChild.className),s=this.$.format.addLine(e);this.$.selection.setRange(s,1,s,1),this.$.menu.dropdownOff()}submit(t){const e=Ht.utils.createElement("hr",{class:t});return this.$.focusManager.focus(),this.$.component.insert(e,{insertBehavior:"line"}),e}}const dl=hl;class ul extends Vo{static key="list";static className="se-icon-flip-rtl";#Gl;#er;constructor(t){super(t),this.title=this.$.lang.list,this.icon="list_numbered";const e=function({lang:t,icons:e}){const s=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ol" title="${t.numberedList}" aria-label="${t.numberedList}">\n\t\t\t\t\t${e.list_numbered}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list se-tooltip se-icon-flip-rtl" data-command="ul" title="${t.bulletedList}" aria-label="${t.bulletedList}">\n\t\t\t\t\t${e.list_bulleted}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\t</div>`;return Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},s)}(this.$);this.#Gl=e.querySelectorAll("li button"),this.#er={bulleted:this.$.icons.list_bulleted,numbered:this.$.icons.list_numbered},this.$.menu.initDropdownTarget(ul,e)}active(t,e){const s=e.firstElementChild;if(Ht.check.isList(t)){const i=t.nodeName.toLowerCase();return e.setAttribute("data-focus",i),Ht.utils.addClass(e,"active"),/^ul$/.test(i)?Ht.utils.changeElement(s,this.#er.bulleted):Ht.utils.changeElement(s,this.#er.numbered),!0}return e.removeAttribute("data-focus"),Ht.utils.changeElement(s,this.#er.numbered),Ht.utils.removeClass(e,"active"),!1}on(t){const e=t.getAttribute("data-focus")||"",s=this.#Gl;for(let t=0,i=s.length;t<i;t++)e===s[t].getAttribute("data-command")?Ht.utils.addClass(s[t],"active"):Ht.utils.removeClass(s[t],"active")}action(t){const e=t.getAttribute("data-command"),s=t.getAttribute("data-value")||"",i=this.$.listFormat.apply(`${e}:${s}`,null,!1);i&&this.$.selection.setRange(i.sc,i.so,i.ec,i.eo),this.$.menu.dropdownOff(),this.$.history.push(!1)}}const pl=ul,gl=".se-table-resize-line",ml=".se-table-resize-line-prev",fl=".se-table-resize-row",vl=".se-table-resize-row-prev",bl=["none","solid","dotted","dashed","double","groove","ridge","inset","outset"],yl={all:"border_all",inside:"border_inside",horizon:"border_horizontal",vertical:"border_vertical",outside:"border_outside",left:"border_left",top:"border_top",right:"border_right",bottom:"border_bottom",none:"border_none"},Cl=["all","inside","horizon","vertical"],wl="borderLeft",_l="borderTop",xl="borderRight",$l="borderBottom",Sl=["#bbf7d0","#fde68a","#fecaca","#e9d5ff","#bfdbfe","#22c55e","#eab308","#ef4444","#a855f7","#3b82f6","#15803d","#ca8a04","#b91c1c","#7e22ce","#1d4ed8","#e5e7eb","#9ca3af","#6b7280","#374151","#000000"],kl={physical_cellCnt:0,logical_cellCnt:0,cellCnt:0,rowCnt:0,rowIndex:0,physical_cellIndex:0,logical_cellIndex:0,current_colSpan:0,current_rowSpan:0,isShiftPressed:!1,ref:null,figureElement:null,selectedTable:null,trElement:null,trElements:null,tdElement:null,fixedCell:null,selectedCell:null,selectedCells:null},{_w:El}=Et,Tl=new WeakMap,Ml=new WeakMap;function Hl(t){return/^(TD|TH|TR)$/i.test(t?.nodeName)}function Ll(t){return/^CAPTION$/i.test(t.nodeName)}function Nl(t,e){const s=t.clientX,i=Lt.get(El.getComputedStyle(e).width,0),n=e.getBoundingClientRect(),o=Math.round(s-n.left),l=o<=6;return{is:l||i-o<=6,isLeft:l,startX:s}}function Al(t,e){const s=t.clientY,i=Lt.get(El.getComputedStyle(e).height,0),n=e.getBoundingClientRect();return{is:Math.ceil(i+n.top-s)<=6,startY:s}}function Bl(t,e){return`<${t=t.toLowerCase()}><div><br></div></${t}>`.repeat(e)}function Il(t){return t=t.toLowerCase(),Ht.utils.createElement(t,null,"<div><br></div>")}function Vl(t,e,s){let i=Ml.get(t);return i||(i=function(t){const e=[],s=t.rows,i=[];for(let t=0,n=s.length;t<n;t++){const n=s[t].cells;e[t]=[];let o=0;for(let s=0,l=n.length;s<l;s++){for(;i[t]?.[o];)o++;e[t][s]=o;const l=n[s],r=l.colSpan||1,a=l.rowSpan||1;if(a>1)for(let e=1;e<a;e++){i[t+e]||(i[t+e]=[]);for(let s=0;s<r;s++)i[t+e][o+s]=!0}o+=r}}return e}(t),Ml.set(t,i)),i[e]?.[s]??0}function Ol(t,e){const s=Ht.utils.clone(t,!0),i=Array.from(t.querySelectorAll("td, th")),n=Array.from(s.querySelectorAll("td, th"));return{clonedTable:s,clonedSelectedCells:e.map((t=>{const e=i.indexOf(t);return e>-1?n[e]:null})).filter((t=>null!==t))}}function Rl(t){t&&(Tl.delete(t),Ml.delete(t))}function zl(t,e,s){const i=[];let n="";for(const o in yl){if(s.includes(o))continue;const l=yl[o];i.push(o),n+=`\n\t\t\t<button type="button" class="se-btn se-tooltip">\n\t\t\t\t${e[l]}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t[l]}</span>\n\t\t\t\t</span>\n\t\t\t</button>`}return{items:i,menus:Ht.utils.createElement("DIV",null,n).querySelectorAll("button")}}const Fl=class{#sr;#X;#L;constructor(t,{mergeButton:e,unmergeButton:s,splitButton:i,openCellMenuFunc:n,closeCellMenuFunc:o}){this.#sr=t,this.#X=t.$,this.#L=t.state,this.mergeButton=e,this.unmergeButton=s,this.splitButton=i;const l=(r=this.#X.lang,{items:["vertical","horizontal"],menus:Ht.utils.createElement("DIV",null,`\n\t\t<div title="${r.verticalSplit}" aria-label="${r.verticalSplit}">\n\t\t\t${r.verticalSplit}\n\t\t</div>\n\t\t<div title="${r.horizontalSplit}" aria-label="${r.horizontalSplit}">\n\t\t\t${r.horizontalSplit}\n\t\t</div>`).querySelectorAll("div")});var r;this.selectMenu_split=new ms(this.#X,{checkList:!1,position:"bottom-center",openMethod:n,closeMethod:o}),this.selectMenu_split.on(this.splitButton,this._OnSplitCells.bind(this)),this.selectMenu_split.create(l.items,l.menus)}get#ir(){return this.#sr.selectionService}openSplitMenu(){this.selectMenu_split.open()}mergeCells(t,e=!1){const s=t[0].closest("table");Rl(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:Ol(s,t);this.#sr.setTableInfo(i),t=n,this.#sr.setState("ref",null),this.#ir.setMultiCells(t[0],Ht.query.findVisualLastCell(t));const o=this.#L.ref,l=t[0];let r=null,a=null;const c=o.ce-o.cs+1;let h=o.re-o.rs+1,d="",u=null;for(let e,s,i=1,n=t.length;i<n;i++){e=t[i],u!==e.parentNode&&(u=e.parentNode),s=e.children;for(let t=0,e=s.length;t<e;t++)this.#X.format.isLine(s[t])&&Ht.check.isZeroWidth(s[t].textContent)&&Ht.utils.removeItem(s[t]);d+=e.innerHTML,Ht.utils.removeItem(e),0===u.cells.length&&(r?a=u:r=u,h-=1)}if(r){const t=this.#L.trElements,e=Ht.utils.getArrayIndex(t,r),s=Ht.utils.getArrayIndex(t,a||r),i=[];for(let n,o=0;o<=s;o++)if(n=t[o].cells,0!==n.length)for(let t,i,l=0,r=n.length;l<r;l++)t=n[l],i=t.rowSpan-1,i>0&&o+i>=e&&(t.rowSpan-=Lt.getOverlapRangeAtIndex(e,s,o,o+i));else i.push(t[o]);for(let t=0,e=i.length;t<e;t++)Ht.utils.removeItem(i[t])}l.innerHTML+=d,l.colSpan=c,l.rowSpan=h,e||(s.replaceWith(i),this.#sr._closeTableSelectInfo(),this.#sr._setController(l),this.#ir.focusCellEdge(l),this.#ir.initCellSelection(l),this.#sr.setState("ref",null),this.#sr.setState("selectedCells",[l]),this.#sr.setCellInfo(l,!0),this.setUnMergeButton(),this.setMergeSplitButton(),this.#sr.historyPush())}unmergeCells(t,e=!1){if(!t?.length)return;const s=t[0].closest("table");Rl(s);const{clonedTable:i,clonedSelectedCells:n}=e?{clonedTable:s,clonedSelectedCells:t}:Ol(s,t);this.#sr.setState("ref",null),this.#sr.setTableInfo(i);let o=(t=n)[0],l=Ht.query.findVisualLastCell(t),r=null;const a=o.closest("table"),c=a.rows;for(const e of t){const t=e.parentElement.rowIndex,s=e.cellIndex,i=e.rowSpan,n=e.colSpan;if(1===i&&1===n)continue;this.#sr.setCellInfo(e,!0);const a=e.innerHTML;e.remove();for(let h=0;h<i;h++){const i=c[t+h];for(let t=0;t<n;t++){const n=Il("td");0===h&&0===t?(o===e&&(o=n),l===e&&(l=n),n.innerHTML=a,i.insertBefore(n,i.cells[s])):(i.insertBefore(n,i.cells[s+t]),r=n)}}}this.#sr.setState("selectedCells",null),e||(s.replaceWith(i),this.#sr._closeTableSelectInfo(),this.#sr.setTableInfo(i),o!==l?(l=!r||l.closest("tr").rowIndex>r.closest("tr").rowIndex||l.cellIndex>r.cellIndex?l:r,this.#ir.setMultiCells(o,l),this.#sr.setState("selectedCells",Array.from(a.querySelectorAll(".se-selected-table-cell")))):this.#sr.setCellInfo(l,!0),this.#ir.initCellSelection(o),this.#sr.setState("selectedCell",l),this.setUnMergeButton(),this.#sr.controller_cell.resetPosition(l),this.#sr.historyPush())}findMergedCells(t){const e=[];return t?.forEach((t=>{t&&(t.rowSpan>1||t.colSpan>1)&&e.push(t)})),e}setMergeSplitButton(){this.#L.ref?(this.splitButton.style.display="none",this.mergeButton.style.display="block"):(this.splitButton.style.display="block",this.mergeButton.style.display="none")}setUnMergeButton(){this.findMergedCells(this.#L.selectedCells?.length?this.#L.selectedCells:[this.#L.fixedCell]).length>0?this.unmergeButton.disabled=!1:this.unmergeButton.disabled=!0}_OnSplitCells(t){Rl(this.#sr._element);const e="vertical"===t,s=this.#L.tdElement,i=this.#L.trElements,n=this.#L.trElement,o=this.#L.logical_cellIndex,l=this.#L.rowIndex,r=Il(s.nodeName);if(e){const t=s.colSpan;if(r.rowSpan=s.rowSpan,t>1)r.colSpan=Math.floor(t/2),s.colSpan=t-r.colSpan,n.insertBefore(r,s.nextElementSibling);else{let e=[],l=[];for(let n,r,a=0,c=this.#L.rowCnt;a<c;a++){n=i[a].cells,r=0;for(let i,c,h,d,u=0,p=n.length;u<p;u++){if(i=n[u],c=i.colSpan-1,h=i.rowSpan-1,d=u+r,l.length>0)for(let t,e=0;e<l.length;e++)t=l[e],t.row>a||(d>=t.index?(r+=t.cs,d+=t.cs,t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)):u===p-1&&(t.rs-=1,t.row=a+1,t.rs<1&&(l.splice(e,1),e--)));if(d<=o&&h>0&&e.push({index:d,cs:c+1,rs:h,row:-1}),i!==s&&d<=o&&d+c>=o+t-1){i.colSpan+=1;break}if(d>o)break;r+=c}l=l.concat(e).sort((function(t,e){return t.index-e.index})),e=[]}n.insertBefore(r,s.nextElementSibling)}}else{const t=s.rowSpan;if(r.colSpan=s.colSpan,t>1){r.rowSpan=Math.floor(t/2);const e=t-r.rowSpan,l=[],a=Ht.utils.getArrayIndex(i,n)+e;for(let t,e,s=0;s<a;s++){t=i[s].cells,e=0;for(let i,n,r,c=0,h=t.length;c<h&&(r=c+e,!(r>=o));c++)i=t[c],n=i.rowSpan-1,n>0&&n+s>=a&&r<o&&l.push({index:r,cs:i.colSpan}),e+=i.colSpan-1}const c=i[a],h=c.cells;let d=l.shift();for(let t,e,s,i,n=0,a=h.length,u=0;n<a;n++){if(s=n+u,t=h[n],e=t.colSpan-1,i=s+e+1,d&&i>=d.index&&(u+=d.cs,i+=d.cs,d=l.shift()),i>=o||n===a-1){c.insertBefore(r,t.nextElementSibling);break}u+=e}s.rowSpan=e}else{r.rowSpan=s.rowSpan;const t=Ht.utils.createElement("TR");t.appendChild(r);for(let t,e=0;e<l;e++){if(t=i[e].cells,0===t.length)return;for(let s=0,i=t.length;s<i;s++)e+t[s].rowSpan-1>=l&&(t[s].rowSpan+=1)}const e=this.#L.physical_cellIndex,o=n.cells;for(let t=0,s=o.length;t<s;t++)t!==e&&(o[t].rowSpan+=1);n.parentNode.insertBefore(t,n.nextElementSibling)}}this.selectMenu_split.close(),this.#ir.focusCellEdge(s),this.#ir.deleteStyleSelectedCells(),this.#X.history.push(!1),this.#sr._setController(s),this.#sr.setState("selectedCell",s),this.#sr.setState("fixedCell",s),this.#L.selectedCells?.length||this.#sr.setState("selectedCells",[s])}};const Pl=class{#sr;#L;constructor(t){this.#sr=t,this.#L=t.state}get#ir(){return this.#sr.selectionService}get#nr(){return this.#sr.gridService}get#or(){return this.#sr.cellService}copySelectedTableCells(t,e,s){t.preventDefault(),t.stopPropagation();const i=s[0].closest("table"),n=i.cloneNode(!1),o=Ht.utils.createElement("tbody");n.appendChild(o);const l=new Map;s.forEach((t=>{l.set(t,!0)}));const r=i.rows,a=r.length,c=Array.from(r[0].cells).reduce(((t,e)=>t+(e.colSpan||1)),0),h=Array.from({length:a},(()=>Array(c).fill(null)));for(let t=0;t<a;t++){const e=r[t].cells;for(let s=0,n=e.length;s<n;s++){const n=Vl(i,t,s),o=e[s],l=o.rowSpan||1,r=o.colSpan||1;for(let e=0;e<l;e++)for(let s=0;s<r;s++)h[t+e][n+s]=o}}for(let t=0;t<a;t++){let e;for(let s=0;s<c;s++){const i=h[t][s];if(!i||!l.has(i))continue;if(e||(e=Ht.utils.createElement("tr"),o.appendChild(e)),e.lastChild&&h[t][s-1]===i)continue;if(t>0&&h[t-1][s]===i)continue;const n=i.cloneNode(!0);let r=1,d=1;for(;t+r<a&&h[t+r][s]===i;)r++;for(;s+d<c&&h[t][s+d]===i;)d++;r>1&&(n.rowSpan=r),d>1&&(n.colSpan=d),e.appendChild(n)}}const d=Ht.utils.createElement("figure");d.className=e.className,d.appendChild(n);const u=`<html><body>\x3c!--StartFragment--\x3e${d.outerHTML}\x3c!--EndFragment--\x3e</body></html>`;t.clipboardData.setData("text/html",u)}pasteTableCellMatrix(t,e){if(!t||!e)return;Rl(e.closest("table"));const s=t.rows;let i=0;const n=[];for(let t=0;t<s.length;t++){const e=s[t].cells;let o=0;for(let s=0;s<e.length;s++){const l=e[s];for(;n[t]?.[o];)o++;const r=l.rowSpan||1,a=l.colSpan||1;0===o&&(i+=r);for(let e=0;e<r;e++)for(let s=0;s<a;s++)n[t+e]||(n[t+e]=[]),n[t+e][o+s]=!0;o+=a}}let o=0;for(let t=0,e=s[0].cells,i=e.length;t<i;t++){o+=e[t].colSpan||1}const l={rowCnt:i,logicalCellCnt:o};this.#ir.deleteStyleSelectedCells();const r=e.closest("table"),{clonedTable:a,clonedSelectedCells:c}=Ol(r,[e]),h=a;e=c[0];let d=h.rows;this.#sr.setTableInfo(h),this.#sr.setCellInfo(e,!0);const u={physicalCellCnt:this.#L.physical_cellCnt,logicalCellCnt:this.#L.logical_cellCnt,rowCnt:this.#L.rowCnt,rowIndex:this.#L.rowIndex,physicalCellIndex:this.#L.physical_cellIndex,logicalCellIndex:this.#L.logical_cellIndex,currentColSpan:this.#L.current_colSpan,currentRowSpan:this.#L.current_rowSpan},p=l.rowCnt-(u.rowCnt-(u.rowIndex+1))-1,g=l.logicalCellCnt-(u.logicalCellCnt-(u.logicalCellIndex+1))-1;if(u.rowCnt+=p,u.logicalCellCnt+=g,u.physicalCellCnt+=g,p>0||g>0){const t=d[d.length-1],e=t.cells[t.cells.length-1];for(let t=0;t<p;t++)this.#nr.editRow("down",e);for(let t=0;t<g;t++)this.#nr.editColumn("right",e);this.#sr.setState("trElements",d=h.rows)}const m=u.rowIndex,f=u.logicalCellIndex,v=f+l.logicalCellCnt-1,b=[],y=[];for(let t=0,e=m+l.rowCnt;t<e;t++){const e=d[t]?.cells;if(!e)continue;let s=0,i=0;for(let n=0;n<e.length;n++){for(;y[t]?.[s];)s++;const n=e[i++];if(!n)break;const o=n.colSpan||1,l=n.rowSpan||1,r=s,a=s+o-1;if(l>1||o>1)for(let e=1;e<l;e++){const i=t+e;y[i]||=[];for(let t=0;t<o;t++)y[i][s+t]=!0}r<=v&&a>=f&&(o>1||l>1)&&b.push(n),s+=o}}b.length>0&&(this.#or.unmergeCells(b,!0),this.#sr.setState("trElements",d=h.rows));const C=[],w=[],_=[];for(let t=0,e=l.rowCnt;t<e;t++){const e=s[t]?.cells;if(!e)break;let i=0;for(let s=0;s<e.length;s++){const n=e[s],o=n.colSpan||1,l=n.rowSpan||1;for(;w[t]?.[i];)i++;for(let e=1;e<l;e++){const s=t+e;w[s]||=[];for(let t=0;t<o;t++)w[s][i+t]=!0}if(o<=1&&l<=1){i+=o;continue}const r=i+u.logicalCellIndex,a=r+o-1,c=[];for(let e=u.rowIndex+t,s=e+l,i=0;e<s;e++,i++){const t=d[e].cells;let s=0,i=0;for(;i<t.length&&s<=a;){for(;_[e]?.[s];)s++;const n=t[i++],o=n.colSpan||1,l=n.rowSpan||1,h=s,d=s+o-1;if(l>1)for(let t=1;t<l;t++){const i=e+t;_[i]||=[];for(let t=0;t<o;t++)_[i][s+t]=!0}d>=r&&h<=a&&c.push(n),s+=o}}c.length>0&&C.push(c),i+=o}}if(C.length>0){for(const t of C)this.#sr.setState("ref",null),this.#sr.setState("trElements",h.rows),this.#or.mergeCells(t,!0);this.#sr.setState("trElements",d=h.rows)}const x=[],$=[];for(let t=0;t<l.rowCnt;t++){const e=d[u.rowIndex+t],i=s[t];if(!e||!i)break;const n=e.cells,o=i.cells;let l=0,r=0,a=0;for(;r<n.length&&a<o.length&&l<=v;){for(;$[t]?.[l];)l++;const e=n[r++],s=o[a];if(!e||!s)break;const i=e.colSpan||1,c=e.rowSpan||1;if(c>1)for(let e=1;e<c;e++){const s=t+e;$[s]||=[];for(let t=0;t<i;t++)$[s][l+t]=!0}l>=f&&l+i-1<=v&&(e.innerHTML=s.innerHTML,x.push(e),a++),l+=i}}return r.replaceWith(h),this.#sr._closeTableSelectInfo(),this.#sr.setTableInfo(h),this.#or.setMergeSplitButton(),this.#or.setUnMergeButton(),this.#ir.focusCellEdge(x[0]),this.#sr.historyPush(),x}};const Dl=class{#sr;#X;#L;constructor(t,{columnButton:e,rowButton:s,openCellMenuFunc:i,closeCellMenuFunc:n}){this.#sr=t,this.#X=t.$,this.#L=t.state;const o=(l=this.#X.lang,r=this.#X.icons,{items:["insert-left","insert-right","delete"],menus:Ht.utils.createElement("DIV",null,`\n\t\t<div title="${l.insertColumnBefore}" aria-label="${l.insertColumnBefore}">\n\t\t\t<span class="se-list-icon">${r.insert_column_left}</span><span class="se-txt">${l.insertColumnBefore}</span>\n\t\t</div>\n\t\t<div title="${l.insertColumnAfter}" aria-label="${l.insertColumnAfter}">\n\t\t\t<span class="se-list-icon">${r.insert_column_right}</span><span class="se-txt">${l.insertColumnAfter}</span>\n\t\t</div>\n\t\t<div title="${l.deleteColumn}" aria-label="${l.deleteColumn}">\n\t\t\t<span class="se-list-icon">${r.delete_column}</span><span class="se-txt">${l.deleteColumn}</span>\n\t\t</div>`).querySelectorAll("div")});var l,r;this.selectMenu_column=new ms(this.#X,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_column.on(e,this.#lr.bind(this)),this.selectMenu_column.create(o.items,o.menus);const a=function(t,e){return{items:["insert-above","insert-below","delete"],menus:Ht.utils.createElement("DIV",null,`\n\t\t<div title="${t.insertRowAbove}" aria-label="${t.insertRowAbove}">\n\t\t\t<span class="se-list-icon">${e.insert_row_above}</span><span class="se-txt">${t.insertRowAbove}</span>\n\t\t</div>\n\t\t<div title="${t.insertRowBelow}" aria-label="${t.insertRowBelow}">\n\t\t\t<span class="se-list-icon">${e.insert_row_below}</span><span class="se-txt">${t.insertRowBelow}</span>\n\t\t</div>\n\t\t<div title="${t.deleteRow}" aria-label="${t.deleteRow}">\n\t\t\t<span class="se-list-icon">${e.delete_row}</span><span class="se-txt">${t.deleteRow}</span>\n\t\t</div>`).querySelectorAll("div")}}(this.#X.lang,this.#X.icons);this.selectMenu_row=new ms(this.#X,{checkList:!1,position:"bottom-center",openMethod:i,closeMethod:n}),this.selectMenu_row.on(s,this.#rr.bind(this)),this.selectMenu_row.create(a.items,a.menus)}get#ir(){return this.#sr.selectionService}openColumnMenu(){this.selectMenu_column.open()}openRowMenu(){this.selectMenu_row.menus[0].style.display=this.selectMenu_row.menus[1].style.display=/^TH$/i.test(this.#L.tdElement?.nodeName)?"none":"",this.selectMenu_row.open()}editTable(t,e){const s=this.#sr._element,i="row"===t;if(i){const t=this.#L.trElement.parentElement;if(/^THEAD$/i.test(t.nodeName)){if("up"===e)return;if(!t.nextElementSibling||!/^TBODY$/i.test(t.nextElementSibling.nodeName))return void(e?s.innerHTML+="<tbody><tr>"+Bl("td",this.#L.logical_cellCnt)+"</tr></tbody>":(Ht.utils.removeItem(this.#L.figureElement),this.#sr._closeTableSelectInfo()))}}if(this.#L.ref){const t=this.#L.tdElement,s=this.#L.selectedCells;if(i)if(e)this.#sr.setCellInfo("up"===e?s[0]:s.at(-1),!0),this.editRow(e,null,t);else{let t=s[0].parentNode;const i=[s[0]];for(let e,n=1,o=s.length;n<o;n++)e=s[n],t!==e.parentNode&&(i.push(e),t=e.parentNode);for(let t=0,s=i.length;t<s;t++)this.#sr.setCellInfo(i[t],!0),this.editRow(e)}else{const i=s[0].parentNode;if(e){let n=null;for(let t=0,e=s.length-1;t<e;t++)if(i!==s[t+1].parentNode){n=s[t];break}this.#sr.setCellInfo("left"===e?s[0]:n||s[0],!0),this.editColumn(e,null,t)}else{const t=[s[0]];for(let e,n=1,o=s.length;n<o&&(e=s[n],i===e.parentNode);n++)t.push(e);for(let s=0,i=t.length;s<i;s++)this.#sr.setCellInfo(t[s],!0),this.editColumn(e)}}e||this.#sr.resetInfo()}else this[i?"editRow":"editColumn"](e);if(!e){const t=s.children;for(let e=0;e<t.length;e++)0===t[e].children.length&&(Ht.utils.removeItem(t[e]),e--);0===s.children.length&&Ht.utils.removeItem(s)}}editColumn(t,e,s){e&&this.#sr.setCellInfo(e,!0);const i=!t,n="left"===t,o=this.#L.current_colSpan,l=this.#L.logical_cellIndex+(i||n?0:o+1),r=this.#L.trElements;let a,c=[],h=[],d=0;const u=[],p=[];for(let t,e,s,n,g,m=0,f=this.#L.rowCnt;m<f;m++){t=r[m],a=l,n=!1,e=t.cells,g=0;for(let t,s,r,f,v=0,b=e.length;v<b&&(t=e[v],t);v++)if(s=t.rowSpan-1,r=t.colSpan-1,i){if(f=v+g,h.length>0){const t=!e[v+1];for(let e,s=0;s<h.length;s++)e=h[s],e.row>m||(f>=e.index?(g+=e.cs,f=v+g,e.rs-=1,e.row=m+1,e.rs<1&&(h.splice(s,1),s--)):t&&(e.rs-=1,e.row=m+1,e.rs<1&&(h.splice(s,1),s--)))}s>0&&c.push({rs:s,cs:r+1,index:f,row:-1}),f>=a&&f+r<=a+o?u.push(t):f<=a+o&&f+r>=a?t.colSpan-=Lt.getOverlapRangeAtIndex(l,l+o,f,f+r):s>0&&(f<a||f+r>a+o)&&p.push({cell:t,i:m,rs:m+s}),g+=r}else{if(v>=a)break;if(r>0){if(d<1&&r+v>=a){t.colSpan+=1,a=null,d=s+1;break}a-=r}if(!n){for(let t,e=0;e<h.length;e++)t=h[e],a-=t.cs,t.rs-=1,t.rs<1&&(h.splice(e,1),e--);n=!0}}if(h=h.concat(c).sort((function(t,e){return t.index-e.index})),c=[],!i){if(d>0){d-=1;continue}null!==a&&e.length>0&&(s=Il(e[0].nodeName),s=t.insertBefore(s,e[a]))}}const g=this.#sr._element.querySelector("colgroup");if(g){const t=g.querySelectorAll("col");if(i)Ht.utils.removeItem(t[a]);else{let e=0;for(let s,i=0,n=t.length;i<n;i++)s=Lt.get(t[i].style.width),s-=Math.round(s*n*.1/2),e+=s,t[i].style.width=`${s}%`;const s=Ht.utils.createElement("col",{style:`width:${100-e}%`});g.insertBefore(s,t[a])}}if(i){let t,e;for(let s,i=0,n=u.length;i<n;i++)s=u[i].parentNode,Ht.utils.removeItem(u[i]),0===s.cells.length&&(t||=Ht.utils.getArrayIndex(r,s),e=Ht.utils.getArrayIndex(r,s),Ht.utils.removeItem(s));for(let s,i=0,n=p.length;i<n;i++)s=p[i],s.cell.rowSpan=Lt.getOverlapRangeAtIndex(t,e,s.i,s.rs);this.#sr._closeController()}else this.#sr._setCellControllerPosition(s||this.#L.tdElement,!0);return s||this.#L.tdElement}editRow(t,e,s){this.#ir.deleteStyleSelectedCells(),e&&this.#sr.setCellInfo(e,!0);const i=!t,n="up"===t,o=this.#L.rowIndex,l=i||n?o:o+this.#L.current_rowSpan+1,r=i?-1:1,a=this.#L.trElements;let c=this.#L.logical_cellCnt;for(let t,e=0,s=o+(i?-1:0);e<=s;e++){if(t=a[e].cells,0===t.length)return;for(let s,i,n=0,o=t.length;n<o;n++)s=t[n].rowSpan,i=t[n].colSpan,s<2&&i<2||s+e>l&&l>e&&(t[n].rowSpan=s+r,c-=i)}if(i){const t=a[o+1];if(t){const e=[];let s=a[o].cells,i=0;for(let t,n,o=0,l=s.length;o<l;o++)t=s[o],n=o+i,i+=t.colSpan-1,t.rowSpan>1&&(t.rowSpan-=1,e.push({cell:t.cloneNode(!0),index:n}));if(e.length>0){let n=e.shift();s=t.cells,i=0;for(let o,l,r=0,a=s.length;r<a&&(o=s[r],l=r+i,i+=o.colSpan-1,!(l>=n.index)||(r--,i--,i+=n.cell.colSpan-1,t.insertBefore(n.cell,o),n=e.shift(),n));r++);if(n){t.appendChild(n.cell);for(let s=0,i=e.length;s<i;s++)t.appendChild(e[s].cell)}}}this.#sr._element.deleteRow(l)}else this.insertBodyRow(this.#sr._element,l,c);i?this.#sr._closeController():this.#sr._setCellControllerPosition(s||this.#L.tdElement,!0)}insertBodyRow(t,e,s){const i=t.insertRow(e);return i.innerHTML=Bl("td",s),i}#lr(t){switch(Rl(this.#sr._element),t){case"insert-left":this.editTable("cell","left");break;case"insert-right":this.editTable("cell","right");break;case"delete":this.editTable("cell",null)}this.#sr.historyPush()}#rr(t){switch(Rl(this.#sr._element),t){case"insert-above":this.editTable("row","up");break;case"insert-below":this.editTable("row","down");break;case"delete":this.editTable("row",null)}this.#sr.historyPush()}},{_w:ql}=Et;const Wl=class{#sr;#X;#L;#js;#ar=!1;#cr=null;#hr=null;constructor(t){this.#sr=t,this.#X=t.$,this.#L=t.state,this.#js={resize:null,resizeStop:null,resizeKeyDown:null}}get#ir(){return this.#sr.selectionService}isResizing(){return this.#ar}onResizeGuide(t,e){const s=Nl(t,e);if(s.is)return this.#sr._element&&(this.#sr._element.style.cursor=""),this.#Bs(),"block"===this.#cr?.style.display&&(this.#cr.style.display="none"),this.#cr=this.#X.frameContext.get("wrapper").querySelector(gl),this.#dr(Ht.query.getParentElement(e,Ht.check.isTable),e,this.#cr,s.isLeft),this.#cr.style.display="block",!1;return Al(t,e).is?(this.#Bs(),this.#sr._element=Ht.query.getParentElement(e,Ht.check.isTable),this.#sr._element.style.cursor="ns-resize","block"===this.#cr?.style.display&&(this.#cr.style.display="none"),this.#cr=this.#X.frameContext.get("wrapper").querySelector(fl),this.#ur(Ht.query.getParentElement(e,Ht.check.isTable),e,this.#cr),this.#cr.style.display="block",!1):void 0}offResizeGuide(){this.#pr()}readyResizeFromEdge(t,e){const s=Nl(t,e);if(s.is){try{this.#ir.deleteStyleSelectedCells(),this.#sr.setCellInfo(e,!0);const t=this.#L.logical_cellIndex+this.#L.current_colSpan-(s.isLeft?1:0);if(this.#X.ui.enableBackWrapper("ew-resize"),this.#cr||=this.#X.frameContext.get("wrapper").querySelector(gl),this.#hr=this.#X.frameContext.get("wrapper").querySelector(ml),t<0||t===this.#L.logical_cellCnt-1)return this._startFigureResizing(s.startX,t<0),this.#sr._editorEnable(!1),!1;const i=this.#sr._element.querySelector("colgroup").querySelectorAll("col")[t<0?0:t];this._startCellResizing(i,s.startX,Lt.get(ql.getComputedStyle(i).width,0),s.isLeft),this.#sr._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#sr._editorEnable(!0),this.#Bs()}finally{this.#sr.setState("fixedCell",null),this.#sr.setState("selectedCell",null),this.#sr.controller_table.hide(),this.#sr.controller_cell.hide()}return!1}const i=Al(t,e);if(i.is){try{let t=Ht.query.getParentElement(e,Ht.check.isTableRow),s=e.rowSpan;if(s>1)for(;Ht.check.isTableRow(t)&&s>1;)t=t.nextElementSibling,--s;this.#ir.deleteStyleSelectedCells(),this.#sr.setRowInfo(t),this.#X.ui.enableBackWrapper("ns-resize"),this.#cr||=this.#X.frameContext.get("wrapper").querySelector(fl),this.#hr=this.#X.frameContext.get("wrapper").querySelector(vl),this._startRowResizing(t,i.startY,Lt.get(ql.getComputedStyle(t).height,0)),this.#sr._editorEnable(!1)}catch(t){console.warn("[SUNEDITOR.plugins.table.error]",t),this.#sr._editorEnable(!0),this.#Bs()}finally{this.#sr.setState("fixedCell",null),this.#sr.setState("selectedCell",null),this.#sr.controller_table.hide(),this.#sr.controller_cell.hide()}return!1}}#gr(t){const e=t.querySelector("colgroup").querySelectorAll("col"),s=t.offsetWidth;e.forEach((t=>{const e=t.style.width;if(!e.endsWith("%")){const i=(t.offsetWidth||Lt.get(e,0))/s*100;t.style.width=i+"%"}}))}_startCellResizing(t,e,s,i){const n=this.#L.figureElement;Ht.utils.removeClass(n,"se-component-selected"),this.#gr(this.#sr._element),this.#dr(n,this.#L.tdElement,this.#hr,i),this.#hr.style.display="block";const o=t.style.width,l=t.nextElementSibling,r=l.style.width,a=Ht.utils.hasClass(this.#sr._element,"se-table-layout-fixed")?r:Mt.getWidthInPercentage(l||t);os.get("__dragHandler")&&(os.get("__dragHandler").style.display="none"),this.#mr(this.#fr.bind(this,t,l,n,this.#L.tdElement,this.#cr,i,e,s,Lt.get(o,0),Lt.get(a,0),this.#sr._element.offsetWidth),(()=>{this.#Bs(),this.#gr(this.#sr._element),this.#X.history.push(!0),this.#X.component.hoverSelect(this.#sr._element),this.#sr._editorEnable(!0)}),(e=>{this._stopResize(t,o,"width",e),this._stopResize(l,r,"width",e)}))}#fr(t,e,s,i,n,o,l,r,a,c,h,d){const u=(r+(d.clientX-l))/h*100;if(u>0){t.style.width=`${u}%`;const l=a-u;e.style.width=`${c+l}%`,this.#dr(s,i,n,o)}}_startRowResizing(t,e,s){const i=this.#L.figureElement;Ht.utils.removeClass(i,"se-component-selected"),this.#ur(i,t,this.#hr),this.#hr.style.display="block";const n=t.style.height;os.get("__dragHandler")&&(os.get("__dragHandler").style.display="none"),this.#mr(this.#vr.bind(this,t,i,this.#cr,e,s),(()=>{this.#Bs(),this.#X.history.push(!0),this.#X.component.hoverSelect(this.#sr._element),this.#sr._editorEnable(!0)}),this._stopResize.bind(this,t,n,"height"))}#vr(t,e,s,i,n,o){const l=n+(o.clientY-i);t.style.height=`${l}px`,this.#ur(e,t,s)}_startFigureResizing(t,e){const s=this.#L.figureElement;Ht.utils.removeClass(s,"se-component-selected"),this.#dr(s,s,this.#hr,e),this.#hr.style.display="block";const i=Mt.getWidthInPercentage(s);os.get("__dragHandler")&&(os.get("__dragHandler").style.display="none"),this.#mr(this.#br.bind(this,s,this.#cr,e,t,s.offsetWidth,Lt.get(i,0)),(()=>{this.#Bs(),Lt.get(s.style.width,0)>100&&(s.style.width="100%"),this.#X.history.push(!0),this.#X.component.hoverSelect(this.#sr._element),this.#sr._editorEnable(!0)}),this._stopResize.bind(this,s,s.style.width,"width"))}#br(t,e,s,i,n,o,l){const r=(n+(s?i-l.clientX:l.clientX-i))/n*o;r>0&&(t.style.width=`${r}%`,this.#dr(t,t,e,s))}#dr(t,e,s,i){const n=this.#X.offset.getLocal(e),o=this.#X.offset.getLocal(t);s.style.left=`${n.left+(i?0:e.offsetWidth)}px`,s.style.top=`${o.top}px`,s.style.height=`${t.offsetHeight}px`}#ur(t,e,s){const i=this.#X.offset.getLocal(e),n=this.#X.offset.getLocal(t);s.style.top=`${i.top+e.offsetHeight}px`,s.style.left=`${n.left}px`,s.style.width=`${t.offsetWidth}px`}_stopResize(t,e,s,i){Nt.isEsc(i.code)&&(this.#Bs(),this.#X.component.hoverSelect(this.#sr._element),this.#sr._editorEnable(!0),t.style[s]=e,"width"===s&&this.#X.component.select(this.#sr._element,this.#sr.constructor.key,{isInput:!0}))}#mr(t,e,s){this.#js.resize=this.#X.eventManager.addGlobalEvent("mousemove",t,!1),this.#js.resizeStop=this.#X.eventManager.addGlobalEvent("mouseup",e,!1),this.#js.resizeKeyDown=this.#X.eventManager.addGlobalEvent("keydown",s,!1),this.#ar=!0}#Bs(){this.#ar=!1,this.#X.ui.disableBackWrapper(),this.#pr(),this.#hr&&(this.#hr.style.display="none",this.#hr=null);const t=this.#js;for(const e in t)t[e]&&=this.#X.eventManager.removeGlobalEvent(t[e]);this.#ar=!1,this.#cr=null}#pr(){this.#cr&&(this.#cr.style.display="none",this.#cr=null),this.#sr._element&&(this.#sr._element.style.cursor="")}init(){this.#Bs()}};const Ul=class{#sr;#X;#L;#yr;#Cr;#wr;#_r;#js;#xr=null;constructor(t){this.#sr=t,this.#X=t.$,this.#L=t.state,this.#yr=this.#$r.bind(this),this.#Cr=this.#Sr.bind(this),this.#wr=this.#kr.bind(this),this.#_r=this.#Er.bind(this),this.#js={on:null,off:null,shiftOff:null,touchOff:null,resize:null,resizeStop:null,resizeKeyDown:null}}get#or(){return this.#sr.cellService}selectCells(t){const e=t[0],s=Ht.query.findVisualLastCell(t);return this.#xr=e.nodeName,this.setMultiCells(e,s),{fixedCell:e,selectedCell:s}}setMultiCells(t,e){const s=this.#L.selectedTable,i=s.rows;if(this.deleteStyleSelectedCells(),Ht.utils.addClass(t,"se-selected-table-cell"),t===e&&!this.#L.isShiftPressed)return;const n=function(t,e){const s=t.parentNode,i=e.parentNode;return`${s.rowIndex},${t.cellIndex}-${i.rowIndex},${e.cellIndex}`}(t,e);let o=Tl.get(s);const l=o?.get(n);if(l)return this.#sr.setState("ref",l),void this.#Tr(i,l);const r=this.#Mr(i,t,e);this.#sr.setState("ref",r),o||(o=new Map,Tl.set(s,o)),o.set(n,r),this.#Tr(i,r)}#Mr(t,e,s){let i=!0,n=[],o=[];const l={_i:0,cs:null,ce:null,rs:null,re:null};for(let r,a,c=0,h=t.length;c<h;c++){r=t[c].cells,a=0;for(let t,h,d,u,p=0,g=r.length;p<g;p++){if(t=r[p],d=t.colSpan-1,u=t.rowSpan-1,h=p+a,n.length>0)for(let t,e=0;e<n.length;e++)t=n[e],t.row>c||(h>=t.index?(a+=t.cs,h+=t.cs,t.rs-=1,t.row=c+1,t.rs<1&&(n.splice(e,1),e--)):p===g-1&&(t.rs-=1,t.row=c+1,t.rs<1&&(n.splice(e,1),e--)));if(i){if(t!==e&&t!==s||(l.cs=null!==l.cs&&l.cs<h?l.cs:h,l.ce=null!==l.ce&&l.ce>h+d?l.ce:h+d,l.rs=null!==l.rs&&l.rs<c?l.rs:c,l.re=null!==l.re&&l.re>c+u?l.re:c+u,l._i+=1),2===l._i){i=!1,n=[],o=[],c=-1;break}}else{const t=l.cs<h?l.cs:h,e=l.ce>h+d?l.ce:h+d,s=l.rs<c?l.rs:c,i=l.re>c+u?l.re:c+u;if(Lt.getOverlapRangeAtIndex(l.cs,l.ce,h,h+d)&&Lt.getOverlapRangeAtIndex(l.rs,l.re,c,c+u)&&(l.cs!==t||l.ce!==e||l.rs!==s||l.re!==i)){l.cs=t,l.ce=e,l.rs=s,l.re=i,c=-1,n=[],o=[];break}}u>0&&o.push({index:h,cs:d+1,rs:u,row:-1}),a+=t.colSpan-1}n=n.concat(o).sort(((t,e)=>t.index-e.index)),o=[]}return l}#Tr(t,e){let s=[],i=[];for(let n,o,l=0,r=t.length;l<r;l++){n=t[l].cells,o=0;for(let t,r,a,c,h=0,d=n.length;h<d;h++){if(t=n[h],a=t.colSpan-1,c=t.rowSpan-1,r=h+o,s.length>0)for(let t,e=0;e<s.length;e++)t=s[e],t.row>l||(r>=t.index?(o+=t.cs,r+=t.cs,t.rs-=1,t.row=l+1,t.rs<1&&(s.splice(e,1),e--)):h===d-1&&(t.rs-=1,t.row=l+1,t.rs<1&&(s.splice(e,1),e--)));Lt.getOverlapRangeAtIndex(e.cs,e.ce,r,r+a)&&Lt.getOverlapRangeAtIndex(e.rs,e.re,l,l+c)&&Ht.utils.addClass(t,"se-selected-table-cell"),c>0&&i.push({index:r,cs:a+1,rs:c,row:-1}),o+=t.colSpan-1}s=s.concat(i).sort(((t,e)=>t.index-e.index)),i=[]}}initCellSelection(t){this.#sr.setState("fixedCell",t),this.#L.selectedCells?.length||this.#sr.setState("selectedCells",[t]),this.#xr=t.nodeName,this.#sr.setState("selectedTable",Ht.query.getParentElement(t,"TABLE")),this.deleteStyleSelectedCells(),Ht.utils.addClass(t,"se-selected-cell-focus")}startCellSelection(t,e){this.#L.isShiftPressed||this.#L.ref||this.#Bs(),this.#sr.setState("isShiftPressed",e),this.initCellSelection(t),e?(this.#js.shiftOff=this.#X.eventManager.addGlobalEvent("keyup",this.#wr,!1),this.#js.on=this.#X.eventManager.addGlobalEvent("mousedown",this.#yr,!1)):this.#js.on=this.#X.eventManager.addGlobalEvent("mousemove",this.#yr,!1),this.#js.off=this.#X.eventManager.addGlobalEvent("mouseup",this.#Cr,!1),this.#js.touchOff=this.#X.eventManager.addGlobalEvent("touchmove",this.#_r,!1)}deleteStyleSelectedCells(){Ht.utils.removeClass([this.#L.fixedCell,this.#L.selectedCell],"se-selected-cell-focus");const t=this.#L.fixedCell?.closest("table");if(t){const e=t.querySelectorAll(".se-selected-table-cell");for(let t=0,s=e.length;t<s;t++)Ht.utils.removeClass(e[t],"se-selected-table-cell")}}recallStyleSelectedCells(){if(this.#L.selectedCells){const t=this.#L.selectedCells;for(let e=0,s=t.length;e<s;e++)Ht.utils.addClass(t[e],"se-selected-table-cell")}}focusCellEdge(t){Et.isMobile||this.#X.focusManager.focusEdge(t)}#$r(t){this.#X.store.set("_preventBlur",!0);const e=Ht.query.getParentElement(Ht.query.getEventTarget(t),Ht.check.isTableCell);if(this.#L.isShiftPressed){if(e===this.#L.fixedCell)return this.#sr.setState("isShiftPressed",!1),this.deleteStyleSelectedCells(),this.#sr._editorEnable(!0),void this.#Bs();this.#sr._editorEnable(!1)}else if(!this.#L.ref){if(e===this.#L.fixedCell)return;this.#sr._editorEnable(!1)}e&&e!==this.#L.selectedCell&&this.#xr===e.nodeName&&this.#L.selectedTable===Ht.query.getParentElement(e,"TABLE")&&(this.#sr.setState("selectedCell",e),this.setMultiCells(this.#L.fixedCell,this.#L.selectedCell))}#Sr(t){t.stopPropagation(),this.#L.isShiftPressed?this.#js.touchOff&&=this.#X.eventManager.removeGlobalEvent(this.#js.touchOff):(this.#sr._editorEnable(!0),this.#Bs());const e=this.#L.fixedCell;if(!e||!this.#L.selectedTable)return;if(this.#or.setMergeSplitButton(),this.#sr.setState("selectedCells",Array.from(this.#L.selectedTable.querySelectorAll(".se-selected-table-cell"))),this.#L.isShiftPressed)return;e&&this.#L.selectedCell&&(this.focusCellEdge(e),e===this.#L.selectedCell&&Ht.utils.removeClass(e,"se-selected-table-cell"));const s=this.#L.selectedCells?.length>0?this.#L.selectedCell:e;this.#sr._setController(s)}#kr(){if(this.#L.ref){this.#Bs(),this.#sr._editorEnable(!0),this.focusCellEdge(this.#L.fixedCell);const t=this.#L.selectedCells?.length>0?this.#L.selectedCell:this.#L.fixedCell;this.#sr._setController(t)}else this.#sr._closeController()}#Er(){this.#sr.resetInfo()}#Bs(){this.#X.ui.disableBackWrapper();const t=this.#js;for(const e in t)t[e]&&=this.#X.eventManager.removeGlobalEvent(t[e])}init(){this.#Bs()}},{_w:Gl}=Et;const Zl=class{#sr;#L;#X;constructor(t,{pluginOptions:e,controller_table:s}){this.#sr=t,this.#L=t.state,this.#X=t.$,this.sliderType="",this.resizeButton=s.querySelector("._se_table_resize"),this.resizeText=s.querySelector("._se_table_resize > span > span"),this.columnFixedButton=s.querySelector("._se_table_fixed_column"),this.headerButton=s.querySelector("._se_table_header"),this.captionButton=s.querySelector("._se_table_caption");const i=function({lang:t,icons:e,options:s}){const i=s.get("_rtl")?["right","center","left","justify"]:["left","center","right","justify"];let n="";for(let s,o,l=0;l<i.length;l++)s=i[l],o=t["align"+s.charAt(0).toUpperCase()+s.slice(1)],n+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align" data-value="${s}" title="${o}" aria-label="${o}">\n\t\t\t${e["align_"+s]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${o}</span>\n\t\t\t</span>\n\t\t</button>`;const o=["top","middle","bottom"];let l="";for(let s,i,n=0;n<o.length;n++)s=o[n],i=t["align"+s.charAt(0).toUpperCase()+s.slice(1)],l+=`\n\t\t<button type="button" class="se-btn se-tooltip" data-command="props_align_vertical" data-value="${s}" title="${i}" aria-label="${i}">\n\t\t\t${e["align_"+s]}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${i}</span>\n\t\t\t</span>\n\t\t</button>`;const r=`\n\t\t<div class="se-controller-content">\n\t\t\t<div class="se-controller-header">\n\t\t\t\t<button type="button" data-command="close_props" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t\t<span class="se-controller-title">${t.tableProperties}</span>\n\t\t\t</div>\n\t\t\t<div class="se-controller-body">\n\n\t\t\t\t<span>${t.border}</span>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onborder_format" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e[yl.all]}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_onborder_style" class="se-btn se-btn-select se-tooltip se-border-style">\n\t\t\t\t\t\t<span class="se-txt"></span>\n\t\t\t\t\t\t${e.arrow_down}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.border}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_border_color" placeholder="${t.color}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="border" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.color_palette}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.colorPicker}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-input-control __se__border_size" placeholder="${t.width}" />\n\t\t\t\t</div>\n\n\t\t\t\t<span>${t.color}</span>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="font" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.font_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.fontColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_font_color" placeholder="${t.fontColor}" />\n\t\t\t\t\t<button type="button" data-command="props_onpalette" data-value="back" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.background_color}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.backgroundColor}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<input type="text" class="se-color-input __se_back_color" placeholder="${t.backgroundColor}" />\n\t\t\t\t</div>\n\n\t\t\t\t<span>${t.font}</span>\n\t\t\t\t<div class="se-form-group se-form-w0">\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="bold" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.bold}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.bold}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="underline" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.underline}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.underline}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="italic" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.italic}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.italic}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t\t<button type="button" data-command="props_font_style" data-value="strike" class="se-btn se-tooltip">\n\t\t\t\t\t\t${e.strike}\n\t\t\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t\t\t<span class="se-tooltip-text">${t.strike}</span>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class="se-table-props-align">\n\t\t\t\t\t<span>${t.align} <span class="__se__a_table_t">( ${t.table} )</span></span>\n\t\t\t\t\t<div class="se-form-group se-form-w0 se-list-inner">\n\t\t\t\t\t\t<div class="__se__a_h">\n\t\t\t\t\t\t\t${n}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="__se__a_v">\n\t\t\t\t\t\t\t${l}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-form-group se-form-w0 se-form-flex-btn">\n\t\t\t\t<button type="button" class="se-btn se-btn-success" data-command="props_submit" title="${t.submitButton}" aria-label="${t.submitButton}">${e.checked}</button>\n\t\t\t\t<button type="button" class="se-btn se-btn-danger" data-command="revert" title="${t.revert}" aria-label="${t.revert}">${e.revert}</button>\n\t\t\t</div>\n\t\t</div>`,a=Ht.utils.createElement("DIV",{class:"se-controller se-table-props"},r);return{html:a,controller_props_title:a.querySelector(".se-controller-title"),borderButton:a.querySelector('[data-command="props_onborder_style"]'),borderFormatButton:a.querySelector('[data-command="props_onborder_format"]'),cell_alignment:a.querySelector(".se-table-props-align .__se__a_h"),cell_alignment_vertical:a.querySelector(".se-table-props-align .__se__a_v"),cell_alignment_table_text:a.querySelector(".se-table-props-align .__se__a_table_t"),border_style:a.querySelector('[data-command="props_onborder_style"] .se-txt'),border_color:a.querySelector(".__se_border_color"),border_width:a.querySelector(".__se__border_size"),back_color:a.querySelector(".__se_back_color"),font_color:a.querySelector(".__se_font_color"),palette_border_button:a.querySelector('[data-command="props_onpalette"][data-value="border"]'),font_bold:a.querySelector('[data-command="props_font_style"][data-value="bold"]'),font_underline:a.querySelector('[data-command="props_font_style"][data-value="underline"]'),font_italic:a.querySelector('[data-command="props_font_style"][data-value="italic"]'),font_strike:a.querySelector('[data-command="props_font_style"][data-value="strike"]')}}(this.#X),n=[this.#sr.controller_table,this.#sr.controller_cell];this.controller_props=new ps(this,this.#X,i.html,{position:"bottom",parents:n,isInsideForm:!0}),this.controller_props_title=i.controller_props_title;const o=Ht.utils.createElement("DIV",{class:"se-controller se-list-layer"},null);this.controller_colorPicker=new ps(this,this.#X,o,{position:"bottom",parents:[this.controller_props].concat(n),isInsideForm:!0,isWWTarget:!1,initMethod:()=>{this.colorPicker.hueSlider.close(),Ht.utils.removeClass(this.controller_colorPicker.currentTarget,"on")}}),this.colorPicker=new xo(this,this.#X,"",{form:o,colorList:e.colorList||Sl,splitNum:5,disableRemove:!0,hueSliderOptions:{controllerOptions:{isOutsideForm:!0,parents:[this.controller_colorPicker],parentsHide:!0}}});const l=function(){let t="";for(let e,s=0,i=bl.length;s<i;s++)e=bl[s],t+=`\n\t\t<div title="${e}" aria-label="${e}" style="padding: 0 12px;">\n\t\t\t<span class="se-txt">${e}</span>\n\t\t</div>`;const e=Ht.utils.createElement("DIV",null,t);return{items:bl,menus:e.querySelectorAll("div")}}(),r=i.borderButton;this.selectMenu_props_border=new ms(this.#X,{checkList:!1,position:"bottom-center"}),this.selectMenu_props_border.on(r,this.#Hr.bind(this)),this.selectMenu_props_border.create(l.items,l.menus);const a=zl(this.#X.lang,this.#X.icons,[]),c=i.borderFormatButton;this.selectMenu_props_border_format=new ms(this.#X,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:5}),this.selectMenu_props_border_format.on(c,this.#Lr.bind(this,"all")),this.selectMenu_props_border_format.create(a.items,a.menus);const h=zl(this.#X.lang,this.#X.icons,Cl);this.selectMenu_props_border_format_oneCell=new ms(this.#X,{checkList:!1,position:"bottom-left",dir:"ltr",splitNum:6}),this.selectMenu_props_border_format_oneCell.on(c,this.#Lr.bind(this,"outside")),this.selectMenu_props_border_format_oneCell.create(h.items,h.menus),this.maxText=this.#X.lang.maxSize,this.minText=this.#X.lang.minSize,this.propTargets={cell_alignment:i.cell_alignment,cell_alignment_vertical:i.cell_alignment_vertical,cell_alignment_table_text:i.cell_alignment_table_text,border_format:c,border_style:i.border_style,border_color:i.border_color,border_width:i.border_width,back_color:i.back_color,font_color:i.font_color,palette_border_button:i.palette_border_button,font_bold:i.font_bold,font_underline:i.font_underline,font_italic:i.font_italic,font_strike:i.font_strike},this._propsCache=[],this._currentFontStyles=[],this._propsAlignCache="",this._propsVerticalAlignCache="",this._typeCache=""}get#ir(){return this.#sr.selectionService}colorPickerAction(t){this.applyColorPicker(t)}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const s=t.getAttribute("data-value");switch(e){case"props_onborder_format":this.openBorderFormatMenu();break;case"props_onborder_style":this.openBorderStyleMenu();break;case"props_onpalette":this.openColorPalette(t,s);break;case"props_font_style":this.toggleFontStyle(s);break;case"props_submit":this.submitProps(t);break;case"props_align":this.setAlignProps(t.getAttribute("data-value"));break;case"props_align_vertical":this.setVerticalAlignProps(t.getAttribute("data-value"))}}openTableProps(t){this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.#X.lang.tableProperties,this.#Nr("table"),this.controller_props.open(t,this.#sr.controller_table.form,{isWWTarget:!1,initMethod:null,addOffset:null}))}openCellProps(t){this.controller_props.currentTarget===t&&"block"===this.controller_props.form?.style.display?this.controller_props.close():(this.controller_props_title.textContent=this.#X.lang.cellProperties,this.#Nr("cell"),this.controller_props.open(t,this.#sr.controller_cell.form,{isWWTarget:!1,initMethod:null,addOffset:null}))}openBorderFormatMenu(){1===this._propsCache.length?this.selectMenu_props_border_format_oneCell.open():this.selectMenu_props_border_format.open()}openBorderStyleMenu(){this.selectMenu_props_border.open()}openColorPalette(t,e){const{back_color:s,font_color:i,border_color:n}=this.propTargets,o="border"===e?n:"back"===e?s:i;this.controller_colorPicker.isOpen&&e===this.sliderType?this.controller_colorPicker.close():(this.sliderType=e,Ht.utils.addClass(t,"on"),this.colorPicker.init(o?.value||"",t),this.controller_colorPicker.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}))}toggleFontStyle(t){Ht.utils.toggleClass(this.propTargets[`font_${t}`],"on")}toggleHeader(){const t=this.headerButton,e=Ht.utils.hasClass(t,"active"),s=this.#sr._element;if(Rl(s),e)Ht.utils.removeItem(s.querySelector("thead"));else{const t=Ht.utils.createElement("THEAD");t.innerHTML="<tr>"+Bl("th",this.#L.logical_cellCnt)+"</tr>",s.insertBefore(t,s.querySelector("tbody"))}Ht.utils.toggleClass(t,"active"),/TH/i.test(this.#L.tdElement.nodeName)?this.#sr._closeController():this.#sr._setCellControllerPosition(this.#L.tdElement,!1)}toggleCaption(){const t=this.captionButton,e=Ht.utils.hasClass(t,"active"),s=this.#sr._element;if(e)Ht.utils.removeItem(s.querySelector("caption"));else{const t=Ht.utils.createElement("CAPTION",{class:`se-table-caption-${this.#sr.captionPosition}`});t.innerHTML="<div><br></div>",s.insertBefore(t,s.firstElementChild)}Ht.utils.toggleClass(t,"active"),this.#sr._setCellControllerPosition(this.#L.tdElement,!1)}resetHeaderButton(t){t.querySelector("thead")?Ht.utils.addClass(this.headerButton,"active"):Ht.utils.removeClass(this.headerButton,"active")}resetCaptionButton(t){t.querySelector("caption")?Ht.utils.addClass(this.captionButton,"active"):Ht.utils.removeClass(this.captionButton,"active")}resetPropsAlign(){const{cell_alignment:t}=this.propTargets,e=t.querySelector('[data-value="left"]'),s=t.querySelector('[data-value="right"]'),i=e.parentElement,n=s.parentElement;i.appendChild(s),n.appendChild(e)}revertProps(){const t=this._propsCache;for(let e=0,s=t.length;e<s;e++)t[e][0].style.cssText=t[e][1];this.#Ar(this.propTargets.cell_alignment,this._propsAlignCache,!0),this.#Ar(this.propTargets.cell_alignment_vertical,this._propsVerticalAlignCache,!0),Ht.check.isTable(t[0][0])&&this.#L.figureElement&&(this.#L.figureElement.style.float=this._propsAlignCache)}applyColorPicker(t){const e=this.propTargets[`${this.sliderType}_color`];e.style.borderColor=e.value=t,this.controller_colorPicker.close()}setAlignProps(t){this.#Ar(this.propTargets.cell_alignment,t,!1)}setVerticalAlignProps(t){this.#Ar(this.propTargets.cell_alignment_vertical,t,!1)}setTableLayout(t,e,s,i){if(t.includes("width")){const t=this.#L.figureElement;if(!t)return;let s,n;e?(s=this.#X.icons.reduction,n=this.minText,i||(t.style.width="100%")):(s=this.#X.icons.expansion,n=this.maxText,i||(t.style.width="max-content")),Ht.utils.changeElement(this.resizeButton.firstElementChild,s),Ht.utils.changeTxt(this.resizeText,n)}t.includes("column")&&(s?(Ht.utils.removeClass(this.#sr._element,"se-table-layout-auto"),Ht.utils.addClass(this.#sr._element,"se-table-layout-fixed"),Ht.utils.addClass(this.columnFixedButton,"active")):(Ht.utils.removeClass(this.#sr._element,"se-table-layout-fixed"),Ht.utils.addClass(this.#sr._element,"se-table-layout-auto"),Ht.utils.removeClass(this.columnFixedButton,"active")))}submitProps(t){try{t.disabled=!0;const e=this.#sr.controller_table.form.contains(this.controller_props.currentTarget),s=e?[this.#sr._element]:this.#L.selectedCells,i=s[0],n=Gl.getComputedStyle(i),{border_format:o,border_color:l,border_style:r,border_width:a,back_color:c,font_color:h,cell_alignment:d,cell_alignment_vertical:u}=this.propTargets,p=o.getAttribute("se-border-format")||"",g="all"!==p,m=("none"===r.textContent?"":r.textContent)||"",f="none"===p||!m,v=d.getAttribute("se-cell-align")||"",b=u.getAttribute("se-cell-align")||"",y=f?"":l.value.trim()||n.borderColor;let C=f?"":a.value.trim()||n.borderWidth;C+=Lt.is(C)?"px":"";const w=c.value.trim(),_=h.value.trim(),x=g&&!f&&C,$=`${C} ${m} ${y}`,S={left:[],top:[],right:[],bottom:[],middle:[],all:null};if(e){const t=i.style;this.#L.figureElement&&(this.#L.figureElement.style.float=v,this.#L.figureElement.style.verticalAlign=b),t.backgroundColor=w,t.color=_,this.#Br(t),x||(t.border=f?t.borderLeft=t.borderTop=t.borderRight=t.borderBottom="":$),S.left=S.top=S.right=S.bottom=s}else{const t=i.parentElement;let{rs:e,re:n,cs:o,ce:l}=this.#L.ref||{rs:t.rowIndex||0,re:t.rowIndex||0,cs:i.cellIndex||0,ce:i.cellIndex||0};const r=new Array(n-e+1).fill(0).map((()=>new Array(l-o+1).fill(0))),a=o;n-=e,e-=e,l-=o,o-=o;let c=t;for(let t,i,h,d,u,p=0,g=0,m=s.length,y=0;p<m;p++,g++){t=s[p],d=t.colSpan,u=t.rowSpan,h=t.cellIndex-a,c!==t.parentElement&&(y++,g=0,c=t.parentElement);let m=0;for(;m<=h;)h+=r[y][m]||0,m++;try{if(u>1){const t=u-1;for(let e=y;e<=y+t;e++)r[e][h]+=d-(y===e?1:0)}else d>1&&(r[y][h]+=d-1)}catch{}const C=y+u-1===n;y===e&&S.top.push(t),(y===n||C)&&S.bottom.push(t),h===o&&S.left.push(t),h!==l&&h+d-1!==l||S.right.push(t),C||y===e||y===n||h===o||h===l||S.middle.push(t),i=t.style,i.textAlign=v,i.verticalAlign=b,i.backgroundColor=w,i.color=_,this.#Br(i),x||(i.border=f?i.borderLeft=i.borderTop=i.borderRight=i.borderBottom="":$)}0===S.middle.length&&(S.middle=s)}S.all=s,x&&this.#Ir(S,p,$),this.#sr.historyPush(),this.controller_props.close(),this.#L.tdElement&&(this.#ir.recallStyleSelectedCells(),this.#sr.setCellInfo(this.#L.tdElement,!0),Ht.utils.addClass(this.#L.tdElement,"se-selected-cell-focus"))}catch(t){console.warn("[SUNEDITOR.plugins.table.setProps.error]",t)}finally{t.disabled=!1}}closeProps(){this.controller_props.close(),this.controller_colorPicker.close()}#Nr(t){this._typeCache=t;const e="table"===t,s=e?[this.#sr._element]:this.#L.selectedCells;if(!s?.[0])return;const{border_format:i,border_color:n,border_style:o,border_width:l,back_color:r,font_color:a,cell_alignment:c,cell_alignment_vertical:h,cell_alignment_table_text:d,font_bold:u,font_underline:p,font_italic:g,font_strike:m}=this.propTargets,{border:f,backgroundColor:v,color:b,textAlign:y,verticalAlign:C,fontWeight:w,textDecoration:_,fontStyle:x}=Gl.getComputedStyle(s[0]),$=this.#Vr(f);c.querySelector('[data-value="justify"]').style.display=e?"none":"",d.style.display=e?"":"none",h.style.display=e?"none":"";let S=Mt.rgb2hex($.c),k=$.s,E=$.w,T=Mt.rgb2hex(v),M=Mt.rgb2hex(b),H=/.+/.test(w),L=/underline/i.test(_),N=/line-through/i.test(_),A=/italic/i.test(x),B=e?this.#L.figureElement?.style.float:y,I=C;this._propsCache=[];const V=Gl.getComputedStyle(this.#X.eventManager.__focusTemp);for(let t,i,n=0;t=s[n];n++){const{cssText:s,border:n,backgroundColor:o,color:l,textAlign:r,verticalAlign:a,fontWeight:c,textDecoration:h,fontStyle:d}=t.style;if(this._propsCache.push([t,s]),i)continue;const{c:u,s:p,w:g}=this.#Vr(n);let m=o,f=l;m&&(this.#X.eventManager.__focusTemp.style.backgroundColor=m,m=V.backgroundColor),f&&(this.#X.eventManager.__focusTemp.style.color=f,f=V.color),S&&$.c!==u&&(S=""),k&&$.s!==p&&(k=""),E&&$.w!==g&&(E=""),T!==Mt.rgb2hex(m)&&(T=""),M!==Mt.rgb2hex(f)&&(M=""),B!==(e?this.#L.figureElement?.style.float:r)&&(B=""),I&&I!==a&&(I=""),H&&H!==/.+/.test(c)&&(H=!1),L&&L!==/underline/i.test(h)&&(L=!1),N&&N!==/line-through/i.test(h)&&(N=!1),A&&A!==/italic/i.test(d)&&(A=!1),S&&k&&E&&T&&M||(i=!0)}i.firstElementChild.innerHTML=this.#X.icons[yl[1===s.length?"outside":"all"]],i.setAttribute("se-border-format","all"),Ht.utils.removeClass(i,"active"),k||=bl[0],o.textContent=k,n.style.borderColor=n.value=S,l.value=E,this.#Or(k===bl[0]),r.value=r.style.borderColor=T,a.value=a.style.borderColor=M,H&&Ht.utils.addClass(u,"on"),L&&Ht.utils.addClass(p,"on"),N&&Ht.utils.addClass(m,"on"),A&&Ht.utils.addClass(g,"on"),this.#Ar(c,this._propsAlignCache=B,!0),this.#Ar(h,this._propsVerticalAlignCache=I,!0)}#Br(t){const{font_bold:e,font_italic:s,font_strike:i,font_underline:n}=this.propTargets;t.fontWeight=Ht.utils.hasClass(e,"on")?"bold":"",t.fontStyle=Ht.utils.hasClass(s,"on")?"italic":"",t.textDecoration=((Ht.utils.hasClass(i,"on")?"line-through ":"")+(Ht.utils.hasClass(n,"on")?"underline":"")).trim()}#Vr(t){const e=t.split(/\s(?![^()]*\))/);let s="",i="",n="";return 3===e.length?(s=e[0],i=e[1],n=e[2]):2===e.length?/\d/.test(e[0])?(s=e[0],i=e[1]):(i=e[0],n=e[1]):1===e.length&&(/\d/.test(e[0])?s=e[0]:i=e[0]),{w:s,s:i,c:Mt.rgb2hex(n)}}#Ir(t,e,s){const{left:i,top:n,right:o,bottom:l,all:r}=t;switch(e){case"inside":if(1===r.length)return;Ht.utils.setStyle(r.filter((t=>!l.includes(t))),$l,s),Ht.utils.setStyle(r.filter((t=>!o.includes(t))),xl,s);break;case"horizon":if(1===r.length)return;Ht.utils.setStyle(r.filter((t=>!l.includes(t))),$l,s);break;case"vertical":if(1===r.length)return;Ht.utils.setStyle(r.filter((t=>!o.includes(t))),xl,s);break;case"outside":Ht.utils.setStyle(i,wl,s),Ht.utils.setStyle(n,_l,s),Ht.utils.setStyle(o,xl,s),Ht.utils.setStyle(l,$l,s);break;case"left":Ht.utils.setStyle(i,wl,s);break;case"top":Ht.utils.setStyle(n,_l,s);break;case"right":Ht.utils.setStyle(o,xl,s);break;case"bottom":Ht.utils.setStyle(l,$l,s)}}#Or(t){const{border_color:e,border_width:s,palette_border_button:i}=this.propTargets;t?(e.disabled=!0,s.disabled=!0,i.disabled=!0,s.disabled=!0):(e.disabled=!1,s.disabled=!1,i.disabled=!1,s.disabled=!1)}#Ar(t,e,s){Ht.utils.removeClass(t.querySelectorAll("button"),"on"),s||t.getAttribute("se-cell-align")!==e?(Ht.utils.addClass(t.querySelector(`[data-value="${e}"]`),"on"),t.setAttribute("se-cell-align",e)):t.setAttribute("se-cell-align","")}#Hr(t){this.propTargets.border_style.textContent=t,this.#Or(t===bl[0]),this.selectMenu_props_border.close()}#Lr(t,e){const{border_format:s}=this.propTargets;s.setAttribute("se-border-format",e),s.firstElementChild.innerHTML=this.#X.icons[yl[e]],e!==t?Ht.utils.addClass(s,"active"):Ht.utils.removeClass(s,"active"),this.selectMenu_props_border_format.close(),this.selectMenu_props_border_format_oneCell.close()}init(){const{border_format:t,border_color:e,border_style:s,border_width:i,back_color:n,font_color:o,cell_alignment:l,cell_alignment_vertical:r,font_bold:a,font_underline:c,font_italic:h,font_strike:d}=this.propTargets;Ht.utils.removeClass([t,e,s,i,n,o,l,r,a,c,h,d],"on")}},{_w:jl,ON_OVER_COMPONENT:Kl}=Et;class Yl extends Oo{static key="table";static className="";static options={isInputComponent:!0};static component(t){return Ht.check.isTable(t)?t:null}#Rr;#zr;#Fr;#Pr;#Dr;#qr=[];#Wr=!0;#Ur=!1;#Gr=!1;constructor(t,e){super(t),this.title=this.$.lang.table,this.icon="table",this.figureScrollList=["se-scroll-figure-xy","se-scroll-figure-x","se-scroll-figure-y"],this.figureScroll="string"==typeof e.scrollType?e.scrollType.toLowerCase():"x",this.captionPosition="bottom"!==e.captionPosition?"top":"bottom",this.cellControllerTop="table"==("cell"!==e.cellControllerPosition?"table":"cell");const s=Ht.utils.createElement("DIV",{class:"se-dropdown se-selector-table"},'\n\t<div class="se-table-size">\n\t\t<div class="se-table-size-picker se-controller-table-picker"></div>\n\t\t<div class="se-table-size-highlighted"></div>\n\t\t<div class="se-table-size-unhighlighted"></div>\n\t</div>\n\t<div class="se-table-size-display">1 x 1</div>'),i=s.querySelector(".se-controller-table-picker"),n=function({lang:t,icons:e}){const s=`\n\t<div class="se-arrow se-arrow-down se-visible-hidden"></div>\n\t<div class="se-btn-group">\n\t\t<button type="button" data-command="openTableProperties" class="se-btn se-tooltip">\n\t\t\t${e.table_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableProperties}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="layout" class="se-btn se-tooltip _se_table_fixed_column">\n\t\t\t${e.fixed_column_width}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.fixedColumnWidth}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="header" class="se-btn se-tooltip _se_table_header">\n\t\t\t${e.table_header}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.tableHeader}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="caption" class="se-btn se-tooltip _se_table_caption">\n\t\t\t${e.caption}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.caption}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="resize" class="se-btn se-tooltip _se_table_resize">\n\t\t\t${e.reduction}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.minSize}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="copy" class="se-btn se-tooltip">\n\t\t\t${e.copy}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.copy}</span>\n\t\t\t</span>\n\t\t</button>\n\t\t<button type="button" data-command="remove" class="se-btn se-tooltip">\n\t\t\t${e.delete}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t</span>\n\t\t</button>\n\t</div>`;return Ht.utils.createElement("DIV",{class:"se-controller se-controller-table"},s)}(this.$),o=function({lang:t,icons:e},s){const i=`\n\t<div class="se-arrow se-arrow-${s?"down se-visible-hidden":"up"}"></div>\n <div class="se-btn-group">\n\t\t<button type="button" data-command="openCellProperties" class="se-btn se-tooltip">\n\t\t\t${e.cell_properties}\n\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t<span class="se-tooltip-text">${t.cellProperties}</span>\n\t\t\t</span>\n\t\t</button>\n <button type="button" data-command="oncolumn" class="se-btn se-tooltip">\n ${e.table_column}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.column}</span>\n </span>\n </button>\n <button type="button" data-command="onrow" class="se-btn se-tooltip">\n ${e.table_row}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.row}</span>\n </span>\n </button>\n <button type="button" data-command="merge" class="se-btn se-tooltip" style="display: none;">\n ${e.merge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.mergeCells}</span>\n </span>\n </button>\n <button type="button" data-command="onsplit" class="se-btn se-tooltip">\n ${e.split_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.splitCells}</span>\n </span>\n </button>\n\t\t<button type="button" data-command="unmerge" class="se-btn se-tooltip">\n ${e.unmerge_cell}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.unmergeCells}</span>\n </span>\n </button>\n </div>`,n=Ht.utils.createElement("DIV",{class:"se-controller se-controller-table-cell"},i);return{html:n,splitButton:n.querySelector('[data-command="onsplit"]'),columnButton:n.querySelector('[data-command="oncolumn"]'),rowButton:n.querySelector('[data-command="onrow"]'),mergeButton:n.querySelector('[data-command="merge"]'),unmergeButton:n.querySelector('[data-command="unmerge"]')}}(this.$,this.cellControllerTop);this.$.contextProvider.applyToRoots((t=>{t.get("wrapper").appendChild(Ht.utils.createElement("DIV",{class:gl.replace(/^\./,"")})),t.get("wrapper").appendChild(Ht.utils.createElement("DIV",{class:ml.replace(/^\./,"")})),t.get("wrapper").appendChild(Ht.utils.createElement("DIV",{class:fl.replace(/^\./,"")})),t.get("wrapper").appendChild(Ht.utils.createElement("DIV",{class:vl.replace(/^\./,"")}))})),this.cellControllerTop?(this.controller_cell=new ps(this,this.$,o.html,{position:"top"}),this.controller_table=new ps(this,this.$,n,{position:"top"}),this.controller_cell.sibling=this.controller_table.form,this.controller_table.sibling=this.controller_cell.form,this.controller_table.siblingMain=!0):(this.controller_table=new ps(this,this.$,n,{position:"top"}),this.controller_cell=new ps(this,this.$,o.html,{position:"bottom"})),this.figure=new Es(this,this.$,null,{}),this._element=null,this.state=kl,this.#Rr=s,this.#zr=s.querySelector(".se-table-size-highlighted"),this.#Fr=s.querySelector(".se-table-size-unhighlighted"),this.#Pr=s.querySelector(".se-table-size-display");const l=Xl.bind(this,!0),r=Xl.bind(this,!1),a={...o,openCellMenuFunc:l,closeCellMenuFunc:r};this.cellService=new Fl(this,a),this.clipboardService=new Pl(this),this.gridService=new Dl(this,a),this.resizeService=new Wl(this),this.selectionService=new Ul(this),this.styleService=new Zl(this,{pluginOptions:e,controller_table:n}),this.$.menu.initDropdownTarget(Yl,s),this.$.eventManager.addEvent(i,"mousemove",this.#Zr.bind(this)),this.$.eventManager.addEvent(i,"click",this.#jr.bind(this))}setState(t,e){this.state[t]=e}#Kr(){Object.assign(this.state,kl)}off(){this.#Yr()}componentSelect(t){if(this.#Xr(t),this.state.figureElement||this.setTableInfo(t),this.#Wr="100%"===this.state.figureElement?.style.width,this.#Ur=Ht.utils.hasClass(t,"se-table-layout-fixed")||"fixed"===t.style.tableLayout,this.styleService.setTableLayout(this.#Wr?"width|column":"width",this.#Wr,this.#Ur,!0),os.get("__overInfo")===Kl)return;if(!this.state.tdElement)return;this.setCellInfo(this.state.tdElement,!0);const e=this.state.selectedCells?.length>1,s=Ht.query.getParentElement(t,Ht.check.isFigure);this.controller_table.open(s,null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}),this.state.fixedCell&&(this.cellService.setUnMergeButton(),this.controller_cell.open(this.state.tdElement,this.cellControllerTop?s:null,{isWWTarget:!1,initMethod:null,addOffset:null,disabled:e}))}componentDeselect(){this.resetInfo()}componentDestroy(t){if(!t)return;const e=t.parentNode;Ht.utils.removeItem(t),this._closeTableSelectInfo(),e!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(e,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focus(),this.$.history.push(!1)}componentCopy({event:t,cloneContainer:e}){const s=e.querySelectorAll(".se-selected-table-cell");Ht.utils.removeClass(s,"se-selected-table-cell|se-selected-cell-focus"),s.length>0&&(this.clipboardService.copySelectedTableCells(t,e,s),this.$.ui.showToast(this.$.lang.message_copy_success,550))}onPaste({event:t,doc:e}){const s=Ht.query.getParentElement(Ht.query.getEventTarget(t),Ht.check.isTableCell);if(!s)return;const i=e.body;if(1!==i.childElementCount)return;const n=this.$.component.get(i.firstElementChild);if(n.pluginName!==Yl.key)return;const o=n.target,l=this.clipboardService.pasteTableCellMatrix(o,s),{fixedCell:r,selectedCell:a}=this.selectionService.selectCells(l);return this.setState("selectedCells",l),this.setState("fixedCell",r),this.setState("selectedCell",a),this.setState("selectedTable",Ht.query.getParentElement(r,"TABLE")),!1}retainFormat(){return{query:"table",method:t=>{const e=t.querySelector("colgroup");let s=Ht.check.isFigure(t.parentNode)?t.parentNode:null;if(!e){const e=t.rows,s=function(t){const e=t.rows;let s=0;for(let t=0,i=e.length;t<i;t++){const i=e[t].cells;let n=0;for(let t=0,e=i.length;t<e;t++)n+=i[t].colSpan;s=Math.max(s,n)}return s}(t),i=new Array(s).fill(null);for(let t,n=0,o=e.length;n<o;n++){const o=e[n].cells;t=o.length;let l=0;const r=new Array(s).fill(!1);for(let e=0;e<t;e++){const t=o[e],n=t.style.width,a=t.colSpan||1;for(;l<s&&r[l];)l++;if(l>=s)break;n&&!i[l]&&(i[l]=n);for(let t=0;t<a;t++){if(l+t>=s||!n)continue;r[l+t]=!0;const e=parseFloat(n);for(let t=0;t<a;t++){const o=l+t;if(o>=s)continue;const r=i[o];if(null===r)i[o]=`width: ${n};`;else{const t=parseFloat(r.replace("width: ","").replace(";",""));1===a&&e!==t&&(i[o]=`width: ${n};`)}}}l+=a}if(t===s)break}const n=[];for(let t=0;t<s;t++){const e=i[t]?` style="${i[t]}"`:"";n.push(`<col${e}>`)}const o=Ht.utils.createElement("colgroup",null,n.join(""));t.insertBefore(o,t.firstElementChild);for(let t=0;t<e.length;t++){const s=e[t].cells;for(let t=0;t<s.length;t++)Ht.utils.setStyle(s[t],"width","")}}s?Ht.utils.addClass(s,"se-flex-component|se-input-component"):(s=Ht.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"}),t.parentNode.insertBefore(s,t),s.appendChild(t));const i=t.style.width;if(i&&(s.style.width="auto"===i?"max-content":i,Ht.utils.setStyle(t,"width","")),this.figureScroll){const t=`se-scroll-figure-${this.figureScroll}`;Ht.utils.addClass(s,t),Ht.utils.removeClass(s,this.figureScrollList.filter((e=>e!==t)).join("|"))}else Ht.utils.removeClass(s,this.figureScrollList.join("|"))}}}setDir(){this.#Yr(),this.styleService.resetPropsAlign()}onMouseMove({event:t}){if(this.resizeService.isResizing())return;const e=Ht.query.getEventTarget(t),s=Ht.query.getParentElement(e,Hl);s&&1!==t.buttons?!1!==this.resizeService.onResizeGuide(t,s)&&(this._element&&(this._element.style.cursor=""),this.resizeService.offResizeGuide()):this.resizeService.offResizeGuide()}onMouseDown({event:t}){this.setState("ref",null),this.setState("selectedCell",null);const e=Ht.query.getEventTarget(t);if(this._element&&Ht.query.getParentElement(e,Ll))return void this._closeController();const s=Ht.query.getParentElement(e,Hl);s&&(this.cellControllerTop||this.controller_cell.hide(),!1!==this.resizeService.readyResizeFromEdge(t,s)&&(this.state.isShiftPressed&&s!==this.state.fixedCell||(this.selectionService.deleteStyleSelectedCells(),/^TR$/i.test(s.nodeName)||(this.#Gr=!1,this.selectionService.startCellSelection(s,!1)))))}onMouseUp(){this.setState("isShiftPressed",!1)}onMouseLeave(){this.resizeService.offResizeGuide()}onKeyDown({event:t,range:e,line:s}){this.setState("ref",null);const i=t.code,n=Nt.isTab(i);if(this.$.ui.selectMenuOn||this.resizeService.isResizing()||!n&&this.#Gr||Nt.isCtrl(t))return;if(this.cellControllerTop||this.controller_cell.hide(),this.#Gr=Nt.isShift(t),n){this.selectionService.deleteStyleSelectedCells();const i=Ht.query.getParentElement(s,Ht.check.isTableCell);if(i&&e.collapsed&&Ht.check.isEdgePoint(e.startContainer,e.startOffset)){this._closeController();const e=this.#Gr;this.setState("isShiftPressed",this.#Gr=!1);const s=Ht.query.getParentElement(i,"table"),n=Ht.query.getListChildren(s,Ht.check.isTableCell,null),o=e?Ht.utils.prevIndex(n,i):Ht.utils.nextIndex(n,i);if(o===n.length&&!e){if(!Ht.query.getParentElement(i,"thead")){const t=s.rows,e=this.gridService.insertBodyRow(s,t.length,this.state.cellCnt).querySelector("td div");this.$.selection.setRange(e,0,e,0)}return t.preventDefault(),t.stopPropagation(),!1}if(-1===o&&e)return!1;const l=n[o];if(!l)return;const r=l.firstElementChild||l;return this.$.selection.setRange(r,0,r,0),t.preventDefault(),t.stopPropagation(),!1}}let o=null;if(!Nt.isShift(t)){if(o=Ht.query.getParentElement(s,Ht.check.isTableCell),!Ht.utils.hasClass(o,"se-selected-cell-focus"))return;return this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#Jr(),void this._closeController()}return this.state.isShiftPressed||this.state.ref?void 0:(o||=Ht.query.getParentElement(s,Ht.check.isTableCell),o?(this.#Gr=t.shiftKey,this.setState("fixedCell",o),this._closeController(),this.selectionService.startCellSelection(o,this.#Gr),!1):void 0)}onKeyUp({line:t}){this.#Gr=!1,this.state.isShiftPressed&&Ht.query.getParentElement(t,Ht.check.isTableCell)===this.state.fixedCell&&(this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this.#Jr()),this.setState("isShiftPressed",!1)}onScroll(){this.resizeService.offResizeGuide()}controllerAction(t){const e=t.getAttribute("data-command");if(e){switch(e){case"header":this.styleService.toggleHeader(),this.historyPush();break;case"caption":this.styleService.toggleCaption(),this.historyPush();break;case"onsplit":this.cellService.openSplitMenu();break;case"oncolumn":this.gridService.openColumnMenu();break;case"onrow":this.gridService.openRowMenu();break;case"openTableProperties":this.styleService.openTableProps(t);break;case"openCellProperties":this.styleService.openCellProps(t);break;case"revert":this.styleService.revertProps();break;case"merge":this.cellService.mergeCells(this.state.selectedCells);break;case"unmerge":this.cellService.unmergeCells(this.state.selectedCells);break;case"resize":this.#Wr=!this.#Wr,this.styleService.setTableLayout("width",this.#Wr,this.#Ur,!1),this.historyPush(),jl.setTimeout((()=>{this.$.component.select(this._element,Yl.key,{isInput:!0})}),0);break;case"layout":this.#Ur=!this.#Ur,this.styleService.setTableLayout("column",this.#Wr,this.#Ur,!1),this.historyPush(),jl.setTimeout((()=>{this.$.component.select(this._element,Yl.key,{isInput:!0})}),0);break;case"copy":this.$.component.copy(this.state.figureElement);break;case"remove":this.componentDestroy(this.state.figureElement)}/(^revert|Properties$)/.test(e)||this.styleService.closeProps(),/^(remove|on|open)/.test(e)||this._setCellControllerPosition(this.state.tdElement,this.state.isShiftPressed)}}setCellInfo(t,e){const s=this.setTableInfo(t);if(s&&(this.setState("fixedCell",t),this.setState("trElement",t.parentNode),this.styleService.resetHeaderButton(s),this.styleService.resetCaptionButton(s),e||0===this.state.physical_cellCnt)){this.state.tdElement!==t&&this.setState("tdElement",t),this.state.selectedCells?.length||this.setState("selectedCells",[t]);const e=s.rows;this.setState("trElements",e);const i=t.cellIndex;let n=0;for(let t=0,s=e[0].cells,i=e[0].cells.length;t<i;t++)n+=s[t].colSpan;const o=this.state.trElement.rowIndex;this.setState("rowIndex",o),this.setState("rowCnt",e.length),this.setState("physical_cellCnt",this.state.trElement.cells.length),this.setState("logical_cellCnt",n),this.setState("cellCnt",n),this.setState("physical_cellIndex",i),this.setState("current_colSpan",this.state.tdElement.colSpan-1),this.setState("current_rowSpan",this.state.trElement.cells[i].rowSpan-1);const l=Vl(s,o,i);this.setState("logical_cellIndex",l)}}setRowInfo(t){const e=this.setTableInfo(t).rows;this.setState("trElements",e),this.setState("rowCnt",e.length),this.setState("rowIndex",t.rowIndex)}setTableInfo(t){const e=this._element=Ht.query.getParentElement(t,"TABLE");return this.setState("selectedTable",e),this.setState("figureElement",Ht.query.getParentElement(e,Ht.check.isFigure)||e),e}resetInfo(){this.#Jr(),this.selectionService.deleteStyleSelectedCells(),this._editorEnable(!0),this._element=null,this.#Kr(),this.#qr=[],this.#Wr=!1,this.#Ur=!1}historyPush(){this.selectionService.deleteStyleSelectedCells(),this.$.history.push(!1),this.selectionService.recallStyleSelectedCells()}_setController(t){if(!this.$.selection.get().isCollapsed&&!this.state.selectedCell)return void this.selectionService.deleteStyleSelectedCells();this.cellService.setUnMergeButton(),this.setState("tdElement",t),this.state.fixedCell===t&&Ht.utils.addClass(t,"se-selected-cell-focus"),this.state.selectedCells?.length||this.setState("selectedCells",[t]);const e=this.state.selectedTable||this._element||Ht.query.getParentElement(t,"TABLE");this.$.component.select(e,Yl.key,{isInput:!0})}_setCellControllerPosition(t,e){this.setCellInfo(t,e),this.cellControllerTop||this.controller_cell.resetPosition(t)}_editorEnable(t){const e=this.$.frameContext.get("wysiwyg");e.setAttribute("contenteditable",t.toString()),t?Ht.utils.removeClass(e,"se-disabled"):Ht.utils.addClass(e,"se-disabled")}_closeController(){this.controller_table.close(!0),this.controller_cell.close(!0)}_closeTableSelectInfo(){this.$.component.deselect(),this._closeController()}#Xr(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1})}#Yr(){if(!this.#zr)return;const t=this.#zr.style,e=this.#Fr.style;t.width="1em",t.height="1em",e.width="5em",e.height="5em",Ht.utils.changeTxt(this.#Pr,"1 x 1")}#Zr(t){t.stopPropagation();let e=Math.ceil(t.offsetX/18),s=Math.ceil(t.offsetY/18);e=e<1?1:e,s=s<1?1:s;const i=this.$.options.get("_rtl");i&&(e=11-e),this.#zr.style.width=e+"em",this.#zr.style.height=s+"em";const n=e<5?5:e>8?10:e+2,o=s<5?5:s>8?10:s+2;if(this.#Fr.style.width=n+"em",this.#Fr.style.height=o+"em",i){const t=n-(this.#Dr||5);if(0!==t){const e=Lt.get(this.#Rr.style.left);this.#Rr.style.left=e-18*t+"px",this.#Dr=n}}Ht.utils.changeTxt(this.#Pr,e+" x "+s),this.#qr=[e,s]}#jr(){const t=Ht.utils.createElement("TABLE"),e=this.#qr[0],s=this.#qr[1],i=`<tbody>${`<tr>${Bl("td",e)}</tr>`.repeat(s)}</tbody>`,n=`<colgroup>${`<col style="width: ${Lt.get(100/e,0)}%;">`.repeat(e)}</colgroup>`;t.innerHTML=n+i;let o="";this.figureScroll&&(o=` se-scroll-figure-${this.figureScroll}`);const l=Ht.utils.createElement("FIGURE",{class:"se-flex-component se-input-component"+o,style:"width: 100%;"});if(l.appendChild(t),this.#Wr=!0,this.$.component.insert(l,{insertBehavior:"none"})){this.#Yr(),this.$.menu.dropdownOff();const e=t.querySelector("td div");this.$.selection.setRange(e,0,e,0)}}#Jr(){this.resizeService.init(),this.selectionService.init(),this.styleService.init()}}function Xl(t){this.controller_cell.bringToTop(t)}const Jl=Yl;class Ql extends Vo{static key="blockStyle";static className="se-btn-select se-btn-tool-format";constructor(t,e){super(t),this.title=this.$.lang.formats,this.inner='<span class="se-txt">'+this.$.lang.formats+"</span>"+this.$.icons.arrow_down;const s=function({lang:t},e){const s=["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],i=e&&0!==e.length?e:s;let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let e,o,l,r,a,c,h,d=0,u=i.length;d<u;d++){if(e=i[d],"string"==typeof e){if(!s.includes(e))continue;o=e.toLowerCase(),l="blockquote"===o?"block":"pre"===o?"br-line":"line",a=/^h/.test(o)?o.match(/\d+/)[0]:"",r=t["tag_"+(a?"h":o)]+a,h="",c=""}else o=e.tag.toLowerCase(),l=e.command,r=e.name||o,h=e.class,c=h?' class="'+h+'"':"";n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${l}" data-value="${o}" data-class="${h}" title="${r}" aria-label="${r}">\n\t\t\t\t\t<${o}${c}>${r}</${o}>\n\t\t\t\t</button>\n\t\t\t</li>`}return n+="\n\t\t</ul>\n\t</div>",Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(this.$,e.items);this.formatList=s.querySelectorAll("li button"),this.currentFormat="",this.$.menu.initDropdownTarget(Ql,s)}active(t,e){let s=this.$.lang.formats;const i=e.querySelector(".se-txt");if(t){if(this.$.format.isLine(t)){const e=this.formatList,n=t.nodeName.toLowerCase(),o=(t.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let t,i=0,l=e.length;i<l;i++)if(t=e[i],n===t.getAttribute("data-value")&&o===t.getAttribute("data-class")){s=t.title;break}return Ht.utils.changeTxt(i,s),i.setAttribute("data-value",n),i.setAttribute("data-class",o),!0}}else Ht.utils.changeTxt(i,s);return!1}on(t){const e=this.formatList,s=t.querySelector(".se-txt"),i=(s.getAttribute("data-value")||"")+(s.getAttribute("data-class")||"");if(i!==this.currentFormat){for(let t,s=0,n=e.length;s<n;s++)t=e[s],i===t.getAttribute("data-value")+t.getAttribute("data-class")?Ht.utils.addClass(t,"active"):Ht.utils.removeClass(t,"active");this.currentFormat=i}}action(t){const e=t.getAttribute("data-command"),s=t.firstElementChild;"block"===e?this.$.format.applyBlock(s):"br-line"===e?this.$.format.setBrLine(s):this.$.format.setLine(s),this.$.menu.dropdownOff()}applyHeaderByShortcut({keyCode:t}){const e=t.match(/\d+$/)?.[0],s=Ht.utils.createElement(`H${e}`);this.$.format.setLine(s)}}const tr=Ql;class er extends Vo{static key="layout";static className="";constructor(t,e){super(t),this.title=this.$.lang.layout,this.icon="layout",this.selectedIndex=-1,this.items=e.items;const s=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.layout.warn] To use the "layout" plugin, please define the "layouts" option.');let e='\n\t<div class="se-dropdown se-list-inner">\n\t\t<ul class="se-list-basic">';for(let s,i=0,n=(t||[]).length;i<n;i++)s=t[i],e+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-value="${i}" title="${s.name}" aria-label="${s.name}">\n\t\t\t\t\t${s.name}\n\t\t\t\t</button>\n\t\t\t</li>`;return e+="\n\t\t</ul>\n\t</div>",Ht.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.$.menu.initDropdownTarget(er,s)}action(t){const e=Number(t.getAttribute("data-value")),s=this.items[this.selectedIndex=e];if(!s.html)throw this.$.menu.dropdownOff(),Error('[SUNEDITOR.layout.fail] cause : "layouts[i].html not found"');this.$.html.set(s.html),this.$.menu.dropdownOff()}}const sr=er;class ir extends Vo{static key="lineHeight";static className="";#tr;constructor(t,e){super(t),this.title=this.$.lang.lineHeight,this.icon="line_height";const s=function({lang:t},e){const s=e||[{text:"1",value:"1em"},{text:"1.2",value:"1.2em"},{text:"1.7",value:"1.7em"},{text:"2",value:"2em"}];let i=`\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list default_value" data-command="" title="${t.default}" aria-label="${t.default}">\n\t\t\t\t\t${t.default}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t\t<li class="se-btn-list se-sub-list"><span></span></li>`;for(let t,e=0,n=s.length;e<n;e++)t=s[e],i+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list" data-command="${t.value}" title="${t.text}" aria-label="${t.text}">\n\t\t\t\t\t${t.text}\n\t\t\t\t</button>\n\t\t\t</li>`;return i+="\n\t\t</ul>\n\t</div>",Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer"},i)}(this.$,e.items);this.sizeList=s.querySelectorAll("li button"),this.currentSize=null,this.#tr=s.querySelector(".se-sub-list span"),this.$.menu.initDropdownTarget(ir,s)}active(t,e){return this.$.format.isLine(t)&&t.style.lineHeight.length>0?(Ht.utils.addClass(e,"active"),!0):(Ht.utils.removeClass(e,"active"),!1)}on(){const t=this.$.format.getLine(this.$.selection.getNode()),e=t?t.style.lineHeight+"":"";if(e!==this.currentSize){let t=!1;const s=this.sizeList;for(let i=0,n=s.length;i<n;i++)e===s[i].getAttribute("data-command")?(Ht.utils.addClass(s[i],"active"),t=!0):Ht.utils.removeClass(s[i],"active");this.currentSize=e,t?this.#tr.style.display="none":(this.#tr.textContent=e,this.#tr.style.display="block")}}action(t){const e=t.getAttribute("data-command")||"",s=this.$.format.getLines();for(let t=0,i=s.length;t<i;t++)s[t].style.lineHeight=e;this.$.menu.dropdownOff(),this.$.store.set("_lastSelectionNode",null),this.$.history.push(!1)}}const nr=ir;class or extends Vo{static key="template";static className="";constructor(t,e){super(t),this.title=this.$.lang.template,this.icon="template",this.selectedIndex=-1,this.items=e.items;const s=function(t){t&&0!==t.length||console.warn('[SUNEDITOR.plugins.template.warn] To use the "template" plugin, please define the "templates" option.');let e='<div class="se-dropdown se-list-inner"><ul class="se-list-basic">';for(let s,i=0,n=(t||[]).length;i<n;i++)s=t[i],e+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-value="${i}" \n\t\t\t\ttitle="${s.name}" \n\t\t\t\taria-label="${s.name}"\n\t\t\t>\n\t\t\t\t${s.name}\n\t\t\t</button>\n\t\t</li>`;return e+="</ul></div>",Ht.utils.createElement("DIV",{class:"se-list-layer"},e)}(this.items);this.$.menu.initDropdownTarget(or,s)}action(t){const e=Number(t.getAttribute("data-value")),s=this.items[this.selectedIndex=e];if(!s.html)throw this.$.menu.dropdownOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.$.html.insert(s.html,{selectInserted:!1,skipCharCount:!1,skipCleaning:!1}),this.$.menu.dropdownOff()}}const lr=or;class rr extends Vo{static key="paragraphStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.paragraphStyle,this.icon="paragraph_style";const s=function({lang:t},e){const s={spaced:{name:t.menu_spaced,class:"__se__p-spaced",_class:""},bordered:{name:t.menu_bordered,class:"__se__p-bordered",_class:""},neon:{name:t.menu_neon,class:"__se__p-neon",_class:""}},i=e&&0!==e.length?e:["spaced","bordered","neon"];let n='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,o,l,r=0,a=i.length;r<a;r++){if(t=i[r],"string"==typeof t){const e=s[t.toLowerCase()];if(!e)continue;t=e}e=t.name,o=t.class?` class="${t.class}"`:"",l=t._class,n+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${l?" "+l:""}" data-command="${t.class}" title="${e}" aria-label="${e}">\n\t\t\t\t\t<div${o}>${e}</div>\n\t\t\t\t</button>\n\t\t\t</li>`}return n+="\n\t\t</ul>\n\t</div>",Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(this.$,e.items);this.classList=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget(rr,s)}on(){const t=this.classList,e=this.$.format.getLine(this.$.selection.getNode());for(let s=0,i=t.length;s<i;s++)Ht.utils.hasClass(e,t[s].getAttribute("data-command"))?Ht.utils.addClass(t[s],"active"):Ht.utils.removeClass(t[s],"active")}action(t){const e=t.getAttribute("data-command");let s=this.$.format.getLines();if(0===s.length&&(this.$.selection.getRangeAndAddLine(this.$.selection.getRange(),null),s=this.$.format.getLines(),0===s.length))return;const i=Ht.utils.hasClass(t,"active")?Ht.utils.removeClass:Ht.utils.addClass;for(let t=0,n=s.length;t<n;t++)i(s[t],e);this.$.menu.dropdownOff(),this.$.history.push(!1)}}const ar=rr;class cr extends Vo{static key="textStyle";static className="";constructor(t,e){super(t),this.title=this.$.lang.textStyle,this.icon="text_style";const s=function({lang:t},e){const s={code:{name:t.menu_code,class:"__se__t-code",tag:"code"},shadow:{name:t.menu_shadow,class:"__se__t-shadow",tag:"span"}},i=e||Object.keys(s);let n='<div class="se-list-inner"><ul class="se-list-basic">';for(let t,e,o,l,r,a,c=0,h=i.length;c<h;c++){if(t=i[c],l="",a="",r=[],"string"==typeof t){const e=s[t.toLowerCase()];if(!e)continue;t=e}o=t.name,e=t.tag||"span",l+=` class="${t.class}"`,a+=`.${t.class.trim().replace(/\s+/g,",.")}`,r.push("class"),a=a.replace(/,$/,""),n+=`\n\t\t<li>\n\t\t\t<button \n\t\t\t\ttype="button" \n\t\t\t\tclass="se-btn se-btn-list" \n\t\t\t\tdata-command="${e}" \n\t\t\t\tdata-value="${a}" \n\t\t\t\ttitle="${o}" \n\t\t\t\taria-label="${o}"\n\t\t\t>\n\t\t\t\t<${e}${l}>${o}</${e}>\n\t\t\t</button>\n\t\t</li>`}return n+="</ul></div>",Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-format"},n)}(this.$,e.items);this.styleList=s.querySelectorAll("li button"),this.$.menu.initDropdownTarget(cr,s)}on(){const t=this.styleList,e=this.$.selection.getNode();for(let s,i,n,o=0,l=t.length;o<l;o++){s=t[o],i=s.getAttribute("data-value").split(",");for(let t,o,l=0;l<i.length;l++){for(t=e,n=!1;t&&!this.$.format.isLine(t)&&!this.$.component.is(t);){if(t.nodeName.toLowerCase()===s.getAttribute("data-command").toLowerCase()&&(o=i[l],/^\./.test(o)?Ht.utils.hasClass(t,o.replace(/^\./,"")):t.style[o])){n=!0;break}t=t.parentNode}if(!n)break}n?Ht.utils.addClass(s,"active"):Ht.utils.removeClass(s,"active")}}action(t){const e=t.firstElementChild,s=e.style.cssText.replace(/:.+(;|$)/g,",").split(",");s.pop();const i=e.classList;for(let t=0,e=i.length;t<e;t++)s.push("."+i[t]);const n=Ht.utils.hasClass(t,"active")?null:e.cloneNode(!1),o=n?null:[e.nodeName];this.$.inline.apply(n,{stylesToModify:s,nodesToRemove:o,strictRemove:!0}),this.$.menu.dropdownOff()}}const hr=cr;const dr=class extends Fo{static key="link";static className="se-icon-flip-rtl";#Qr;constructor(t,e){super(t),this.title=this.$.lang.link,this.icon="link",e.textToDisplay=!0,e.title=!0;const s=function({lang:t,icons:e}){const s=`\n\t<form>\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.link_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-anchor-editor"></div>\n\t\t<div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n\t\t</div>\n\t</form>`;return Ht.utils.createElement("DIV",{class:"se-modal-content"},s)}(this.$),i=function({lang:t,icons:e}){const s=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<span><a target="_blank" href=""></a> </span>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.copy}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.copy}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="unlink" tabindex="-1" class="se-btn se-tooltip se-icon-flip-rtl">\n\t\t\t\t${e.unlink}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.unlink}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return Ht.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$),n="string"==typeof e.uploadUrl?e.uploadUrl:null;this.target=null,this.isUpdateState=!1,this.pluginOptions={...e,uploadUrl:n,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Lt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Lt.get(e.uploadSingleSizeLimit,0),acceptedFormats:"string"==typeof e.acceptedFormats?e.acceptedFormats.trim():null,enableFileUpload:!!n},this.anchor=new Lo(this.$,s,this.pluginOptions),this.modal=new ko(this,this.$,s),this.controller=new ps(this,this.$,i,{position:"bottom",disabled:!1}),this.#Qr=this.controller.form.querySelector("a")}active(t){if(Ht.check.isAnchor(t)&&!t.hasAttribute("data-se-non-link")){const e=this.#Qr,s=t.getAttribute("href");return e.href=s,e.textContent=e.title=t.textContent,e.target=s?.startsWith("#")?t.target:"_blank",Ht.utils.addClass(t,"on"),this.anchor.set(t),this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null}),this.target=t,!0}return this.controller.close(),!1}open(){this.modal.open()}modalOn(t){this.isUpdateState=t,this.anchor.on(t)}async modalAction(){const t=this.anchor.create(!1);if(null===t)return!1;if(this.isUpdateState){const t=this.controller.currentTarget.childNodes[0];this.$.selection.setRange(t,0,t,t.textContent.length)}else{const e=this.$.format.getLines();if(e.length>1){if(!this.$.html.insertNode(Ht.utils.createElement(e[0].nodeName,null,t),{afterNode:null,skipCharCount:!1}))return!0}else if(!this.$.html.insertNode(t,{afterNode:null,skipCharCount:!1}))return!0;this.$.selection.setRange(t.childNodes[0],0,t.childNodes[0],t.textContent.length)}return this.$.history.push(!1),!0}modalInit(){this.controller.close(),this.anchor.init()}controllerAction(t){const e=t.getAttribute("data-command");if(/update/.test(e))this.modal.open();else if(/copy/.test(e))this.$.html.copy(this.target);else if(/unlink/.test(e)){const t=Ht.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!1),e=Ht.query.getEdgeChild(this.controller.currentTarget,(function(t){return 0===t.childNodes.length||3===t.nodeType}),!0);this.$.selection.setRange(t,0,e,e.textContent.length),this.$.inline.apply(null,{stylesToModify:null,nodesToRemove:["A"],strictRemove:!1})}else Ht.utils.removeItem(this.controller.currentTarget),this.controller.currentTarget=null,this.$.focusManager.focus(),this.$.history.push(!1)}controllerClose(){Ht.utils.removeClass(this.controller.currentTarget,"on")}},ur="%",pr="px",gr={BLOCK:"block",INLINE:"inline"},mr="image/*";const fr=class{#sr;#X;#L;#ta;#ar;#ea;#sa;#ia={w:0,h:0};#na=null;#oa=null;#la=null;constructor(t,e){if(this.#sr=t,this.#X=t.$,this.#L=t.state,this.#ta=t.pluginOptions,this.#ar=this.#ta.canResize,this.#ea="auto"===this.#ta.defaultWidth?"":this.#ta.defaultWidth,this.#sa="auto"===this.#ta.defaultHeight?"":this.#ta.defaultHeight,this.#ar){this.#na=e.proportion,this.#oa=e.inputX,this.#la=e.inputY,this.#oa.value=this.#ta.defaultWidth,this.#la.value=this.#ta.defaultHeight;const t=this.#ra.bind(this);this.#X.eventManager.addEvent(this.#oa,"keyup",this.#aa.bind(this,"x")),this.#X.eventManager.addEvent(this.#la,"keyup",this.#aa.bind(this,"y")),this.#X.eventManager.addEvent(this.#oa,"change",t),this.#X.eventManager.addEvent(this.#la,"change",t),this.#X.eventManager.addEvent(this.#na,"change",t),this.#X.eventManager.addEvent(e.revertBtn,"click",this.#ca.bind(this))}}setInputSize(t,e){this.#oa.value="auto"===t?"":t,this.#L.onlyPercentage||(this.#la.value="auto"===e?"":e)}getInputSize(){return{w:this.#oa?.value||"",h:this.#la?.value||""}}setOriginSize(t,e){this.#ea=t,this.#sa=e}applySize(t,e){t||=this.#oa?.value||this.#ta.defaultWidth,e||=this.#la?.value||this.#ta.defaultHeight,this.#L.onlyPercentage&&(t?/%$/.test(t)||(t+=ur):t="100%"),this.#sr.figure.setSize(t,e)}on(){if(!this.#ar)return;const t=this.#ta.defaultWidth,e=this.#ta.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e)}ready(t,e,s){this.setInputSize(e,s);const i=this.#L.onlyPercentage&&this.#sr.figure.isVertical;this.#na.checked=!0,this.#oa.disabled=i,this.#la.disabled=i,this.#na.disabled=i,this.#ia=this.#na.checked?t.ratio:{w:0,h:0}}init(){this.#ia={w:0,h:0},this.#ar&&(this.setInputSize(this.#ta.defaultWidth,this.#ta.defaultHeight),this.#na.checked=!0)}#aa(t,e){if(Nt.isSpace(e.code))return void e.preventDefault();const s=e.target;if("x"===t&&this.#L.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#na.checked){const e=Es.CalcRatio(this.#oa.value,this.#la.value,this.#L.sizeUnit,this.#ia);"x"===t?this.#la.value=String(e.h):this.#oa.value=String(e.w)}}#ra(){this.#ia=this.#na.checked?Es.GetRatio(this.#oa.value,this.#la.value,this.#L.sizeUnit):{w:0,h:0}}#ca(){this.#L.onlyPercentage?this.#oa.value=Number(this.#ea)>100?"100":this.#ea:(this.#oa.value=this.#ea,this.#la.value=this.#sa)}},{NO_EVENT:vr}=Et;const br=class{#sr;#X;#ta;#ar;constructor(t){this.#sr=t,this.#X=t.$,this.#ta=t.pluginOptions,this.#ar=this.#ta.canResize,this._base64RenderIndex=0}get#ha(){return this.#sr.sizeService}serverUpload(t){if(!t.files)return;const e=this.#ta.uploadUrl;"string"==typeof e&&e.length>0?this.#sr.fileManager.upload(e,this.#ta.uploadHeaders,t.files,this.#da.bind(this,t),this.#Pl.bind(this)):this.#ua(t)}urlUpload(t){this.#sr.setState("produceIndex",0);const e=t.url;this.#sr.modal.isUpdate?this.#pa(e,t.element,t.files):this.#ga(e,t.anchor,t.inputWidth,t.inputHeight,t.align,t.files,t.alt,!0)}#ga(t,e,s,i,n,o,l,r){this.#sr.as!==gr.INLINE?this.#sr.create(t,e,s,i,n,o,l,r):this.#sr.createInline(t,e,s,i,o,l,r)}#pa(t,e,s){e.src=t,this.#sr.fileManager.setFileData(e,s),this.#X.component.select(e,this.#sr.constructor.key)}#Fl(t,e){this.#sr.setState("produceIndex",0);const s=e.result;for(let e,i=0,n=s.length;i<n;i++){if(e={name:s[i].name,size:s[i].size},t.isUpdate){this.#pa(s[i].url,t.element,e);break}this.#ga(s[i].url,t.anchor,t.inputWidth,t.inputHeight,t.align,e,t.alt,i===n-1)}}#ua(t){try{const{files:e,element:s,anchor:i,inputWidth:n,inputHeight:o,align:l,alt:r,isUpdate:a}=t,c=this.#sr.modal.isUpdate?1:e.length;if(0===c)return this.#X.ui.hideLoading(),void console.warn("[SUNEDITOR.image.base64.fail] cause : No applicable files");this._base64RenderIndex=c;const h=new Array(c);this.#ar&&this.#ha.setInputSize(n,o);for(let t,d,u=0,p=this.#ma.bind(this);u<c;u++)t=new FileReader,d=e[u],t.onload=function(t,e,s,a,c,d){h[d]={result:e.result,file:c},0==--this._base64RenderIndex&&(t(s,h,a,i,n,o,l,r),this.#X.ui.hideLoading())}.bind(this,p,t,a,s,d,u),t.readAsDataURL(d)}catch(t){throw this.#X.ui.hideLoading(),Error(`[SUNEDITOR.plugins.image._setBase64.fail] ${t.message}`)}}#ma(t,e,s,i,n,o,l,r){this.#sr.setState("produceIndex",0);for(let a=0,c=e.length;a<c;a++)t?this.#pa(e[a].result,s,e[a].file):this.#ga(e[a].result,i,n,o,l,e[a].file,r,a===c-1)}async#Pl(t){const e=await this.#X.eventManager.triggerEvent("onImageUploadError",{error:t}),s=e===vr?t.errorMessage:e||t.errorMessage;this.#X.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.image.error]",s)}async#da(t,e){if(await this.#X.eventManager.triggerEvent("imageUploadHandler",{xmlHttp:e,info:t})===vr){const s=JSON.parse(e.responseText);s.errorMessage?this.#Pl(s):this.#Fl(t,s)}}},{NO_EVENT:yr}=Et;const Cr=class extends Fo{static key="image";static className="";static component(t){const e=Ht.check.isFigure(t)||/^span$/i.test(t.nodeName)&&Ht.check.isComponentContainer(t)?t.firstElementChild:t;return/^IMG$/i.test(e?.nodeName)?e:Ht.check.isAnchor(e)&&/^IMG$/i.test(e?.firstElementChild?.nodeName)?e?.firstElementChild:null}#ar;#fa;#va=null;#ba="";#ya="none";#Ca="30%";#Ul=null;#wa=null;#_a=null;#xa=null;constructor(t,e){super(t),this.title=this.$.lang.image,this.icon="image",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth?Lt.is(e.defaultWidth)?e.defaultWidth+pr:e.defaultWidth:"auto",defaultHeight:e.defaultHeight?Lt.is(e.defaultHeight)?e.defaultHeight+pr:e.defaultHeight:"auto",percentageOnlySize:!!e.percentageOnlySize,createFileInput:void 0===e.createFileInput||e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Lt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Lt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?mr:e.acceptedFormats.trim()||mr,useFormatType:e.useFormatType??!0,defaultFormatType:[gr.BLOCK,gr.INLINE].includes(e.defaultFormatType)?e.defaultFormatType:gr.BLOCK,keepFormatType:e.keepFormatType??!1,insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?ur:pr,i=function({lang:t,icons:e,plugins:s},i){const n=i.createFileInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_file}</label>\n\t\t\t${ko.CreateFileInput({icons:e,lang:t},i)}\n\t\t</div>`:"",o=i.createUrlInput?`\n\t\t<div class="se-modal-form">\n\t\t\t<label>${t.image_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${s.imageGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.imageGallery}">\n\t\t\t\t\t\t\t${e.image_gallery}\n\t\t\t\t\t\t\t${Ht.utils.createTooltipInner(t.imageGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n\t\t\t<pre class="se-link-preview"></pre>\n\t\t</div>`:"",l=i.canResize?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-size-text">\n\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t<label class="size-h">${t.height}</label>\n\t\t\t</div>\n\t\t\t<input class="se-input-control _se_size_x" placeholder="auto" type="text" />\n\t\t\t<label class="se-modal-size-x">x</label>\n\t\t\t<input type="text" class="se-input-control _se_size_y" placeholder="auto" />\n\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_check_proportion" checked/> ${t.proportion}</label>\n\t\t\t<button type="button" aria-label="${t.revert}" class="se-btn se-tooltip se-modal-btn-revert">\n\t\t\t\t${e.revert}\n\t\t\t\t${Ht.utils.createTooltipInner(t.revert)}\n\t\t\t</button>\n\t\t</div>`:"",r=i.useFormatType?`\n\t\t<div class="se-modal-form">\n\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t<button type="button" data-command="asBlock" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_block}\n\t\t\t\t\t${Ht.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="asInline" class="se-btn se-tooltip" aria-label="${t.inlineStyle}">\n\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t${Ht.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>`:"",a=`\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn close" title="${t.close}" aria-label="${t.close}">${e.cancel}</button>\n\t\t\t<span class="se-modal-title">${t.image_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-tabs">\n\t\t\t<button type="button" class="_se_tab_link active" data-tab-link="image">${t.image}</button>\n\t\t\t<button type="button" class="_se_tab_link" data-tab-link="url">${t.link}</button>\n\t\t</div>\n\t\t<form method="post" enctype="multipart/form-data">\n\t\t\t<div class="_se_tab_content _se_tab_content_image">\n\t\t\t\t<div class="se-modal-body">\n\t\t\t\t\t${n}\n\t\t\t\t\t${o}\n\t\t\t\t\t<div class="se-modal-hr"></div>\n\t\t\t\t\t<div class="se-modal-form">\n\t\t\t\t\t\t<label>${t.image_modal_altText}</label><input class="se-input-form _se_image_alt" type="text" />\n\t\t\t\t\t</div>\n\t\t\t\t\t${l}\n\t\t\t\t\t${r}\n\t\t\t\t\t<div class="se-modal-form se-modal-form-footer">\n\t\t\t\t\t\t<label><input type="checkbox" class="se-modal-btn-check _se_image_check_caption" /> ${t.caption}</label>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="se-anchor-editor _se_tab_content _se_tab_content_url" style="display: none;">\n\t\t\t</div>\n\t\t\t<div class="se-modal-footer">\n\t\t\t\t<div class="se-figure-align">\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t\t<label><input type="radio" name="suneditor_image_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t\t</div>\n\t\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t\t</div>\n\t\t</form>`,c=Ht.utils.createElement("DIV",{class:"se-modal-content"},a);return{html:c,alignForm:c.querySelector(".se-figure-align"),fileModalWrapper:c.querySelector(".se-flex-input-wrapper"),imgInputFile:c.querySelector(".__se__file_input"),imgUrlFile:c.querySelector(".se-input-url"),altText:c.querySelector("._se_image_alt"),captionCheckEl:c.querySelector("._se_image_check_caption"),previewSrc:c.querySelector("._se_tab_content_image .se-link-preview"),tabs:c.querySelector(".se-modal-tabs"),galleryButton:c.querySelector(".__se__gallery"),proportion:c.querySelector("._se_check_proportion"),inputX:c.querySelector("._se_size_x"),inputY:c.querySelector("._se_size_y"),revertBtn:c.querySelector(".se-modal-btn-revert"),asBlock:c.querySelector('[data-command="asBlock"]'),asInline:c.querySelector('[data-command="asInline"]'),fileRemoveBtn:c.querySelector(".se-file-remove")}}(this.$,this.pluginOptions),n=this.pluginOptions.useFormatType?"as":"",o=e.controls||(this.pluginOptions.canResize?[[n,"resize_auto,100,75,50","rotate_l","rotate_r","mirror_h","mirror_v"],["edit","align","caption","revert","copy","remove"]]:[[n,"mirror_h","mirror_v","align","caption","edit","revert","copy","remove"]]);this.alignForm=i.alignForm,o.some((t=>t.includes("align")))||(this.alignForm.style.display="none");const l=this.$.plugins.link?this.$.plugins.link.pluginOptions:{};this.anchor=new Lo(this.$,i.html,{...l,textToDisplay:!1,title:!0}),this.modal=new ko(this,this.$,i.html),this.figure=new Es(this,this.$,o,{sizeUnit:s}),this.fileManager=new To(this,this.$,{query:"img",loadEventName:"onImageLoad",actionEventName:"onImageAction"}),this.state={sizeUnit:s,onlyPercentage:this.pluginOptions.percentageOnlySize,produceIndex:0},this.fileModalWrapper=i.fileModalWrapper,this.imgInputFile=i.imgInputFile,this.imgUrlFile=i.imgUrlFile,this.focusElement=this.imgInputFile||this.imgUrlFile,this.altText=i.altText,this.captionCheckEl=i.captionCheckEl,this.captionEl=this.captionCheckEl?.parentElement,this.previewSrc=i.previewSrc,this.as=gr.BLOCK,this.#ar=this.pluginOptions.canResize,this.#fa=!this.#ar||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.sizeService=new fr(this,i),this.uploadService=new br(this),this.$.eventManager.addEvent(i.tabs,"click",this.#$a.bind(this)),this.imgInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#Sa.bind(this)),this.imgUrlFile&&this.$.eventManager.addEvent(this.imgUrlFile,"input",this.#ka.bind(this)),this.imgInputFile&&this.imgUrlFile&&this.$.eventManager.addEvent(this.imgInputFile,"change",this.#Ea.bind(this));const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#Ta.bind(this)),this.pluginOptions.useFormatType&&(this.as=this.pluginOptions.defaultFormatType,this.asBlock=i.asBlock,this.asInline=i.asInline,this.$.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#Ma.bind(this)))}setState(t,e){this.state[t]=e}open(){this.state.produceIndex=0,this.modal.open()}retainFormat(){return{query:"img",method:t=>{const e=Es.GetContainer(t);if(e&&e.container&&(e.cover||e.inlineCover))return;const{w:s,h:i}=this.#Ha(t,!0);this.#La(s,i)}}}onFilePasteAndDrop({file:t}){/^image/.test(t.type)&&(this.submitFile([t]),this.$.focusManager.focus())}modalOn(t){t?this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.removeAttribute("multiple"):(this.sizeService.on(),this.imgInputFile&&this.pluginOptions.allowMultiple&&this.imgInputFile.setAttribute("multiple","multiple")),this.anchor.on(t)}async modalAction(){return this.#ya=this.modal.form.querySelector('input[name="suneditor_image_radio"]:checked').value,this.modal.isUpdate&&(this.#Na(),this.$.history.push(!1)),this.imgInputFile&&this.imgInputFile.files.length>0?await this.submitFile(this.imgInputFile.files):!!(this.imgUrlFile&&this.#ba.length>0)&&await this.submitURL(this.#ba)}modalInit(){ko.OnChangeFile(this.fileModalWrapper,[]),this.imgInputFile&&(this.imgInputFile.value=""),this.imgUrlFile&&(this.#ba=this.previewSrc.textContent=this.imgUrlFile.value=""),this.imgInputFile&&this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.altText.value="",this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]').checked=!0,this.captionCheckEl.checked=!1,this.#Ul=null,this.#$a("init"),this.sizeService.init(),this.pluginOptions.useFormatType&&this.#Aa((this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)===gr.INLINE),this.anchor.init()}componentSelect(t){this.#Ha(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#Ul,s=Ht.query.getParentElement(e,Es.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onImageDeleteBefore",{element:e,container:s,align:this.#ya,alt:this.altText.value,url:this.#ba})&&(Ht.utils.removeItem(s),this.modalInit(),n!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(i),this.$.history.push(!1))}async submitFile(t){if(0===t.length)return!1;let e=0;const s=[],i=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/image/i.test(n.type)){if(o=n.size,i>0&&o>i){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onImageUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===yr?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onImageUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.$.ui.alertOpen(s===yr?t:s||t,"error"),!1}const l={files:s,...this.#Ba()},r=function(t,e,s){t(e=s||e)}.bind(this,this.uploadService.serverUpload.bind(this.uploadService),l),a=await this.$.eventManager.triggerEvent("onImageUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==yr||r(null)))}async submitURL(t){if(!(t||=this.#ba))return!1;const e={name:t.split("/").pop(),size:0},s={url:t,files:e,...this.#Ba()},i=function(t,e,s){t(e=s||e)}.bind(this,this.uploadService.urlUpload.bind(this.uploadService),s),n=await this.$.eventManager.triggerEvent("onImageUploadBefore",{info:s,handler:i});return void 0===n||!1!==n&&(null!==n&&"object"==typeof n&&i(n),!0!==n&&n!==yr||i(null),!0)}create(t,e,s,i,n,o,l,r){const a=Ht.utils.createElement("IMG");a.src=t,a.alt=l,e=this.#Ia(a,e?e.cloneNode(!1):null);const c=Es.CreateContainer(e,"se-image-container"),h=c.cover,d=c.container;this.captionCheckEl.checked&&(this.#xa=Es.CreateCaption(h,this.$.lang.caption)),this.#Ul=a,this.#wa=h,this.#_a=d,this.figure.open(a,{nonResizing:this.#fa,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.sizeService.applySize(s,i),this.figure.setAlign(a,n),this.fileManager.setFileData(a,o),this.setState("produceIndex",this.state.produceIndex+1),a.onload=this.#Va.bind(this,a,this.#Ca,d),this.$.component.insert(d,{scrollTo:!!r,insertBehavior:r?null:"line"})}createInline(t,e,s,i,n,o,l){const r=Ht.utils.createElement("IMG");r.src=t,r.alt=o,e=this.#Ia(r,e?e.cloneNode(!1):null);const a=Es.CreateInlineContainer(e,"se-image-container").container;this.#Ul=r,this.#_a=a,this.figure.open(r,{nonResizing:this.#fa,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),this.sizeService.applySize(s,i),this.fileManager.setFileData(r,n),this.setState("produceIndex",this.state.produceIndex+1),r.onload=this.#Va.bind(this,r,this.#Ca,a),this.$.component.insert(a,{scrollTo:!!l,insertBehavior:l?null:"line"})}#Ha(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#fa,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.anchor.set(Ht.check.isAnchor(t.parentNode)?t.parentNode:null),this.#va=this.anchor.currentTarget,this.#Ul=t,this.#wa=s.cover,this.#_a=s.container,this.#xa=s.caption,this.#ya=s.align,t.style.float="",this.sizeService.setOriginSize(String(s.originWidth||s.w||""),String(s.originHeight||s.h||"")),this.altText.value=this.#Ul.alt,this.imgUrlFile&&(this.#ba=this.previewSrc.textContent=this.imgUrlFile.value=this.#Ul.src);(this.modal.form.querySelector('input[name="suneditor_image_radio"][value="'+this.#ya+'"]')||this.modal.form.querySelector('input[name="suneditor_image_radio"][value="none"]')).checked=!0,this.captionCheckEl.checked=!!this.#xa;const{dw:i,dh:n}=this.figure.getSize(t);return this.#ar?(this.sizeService.ready(s,i,n),this.pluginOptions.useFormatType&&this.#Aa(this.$.component.isInline(s.container)),{w:i,h:n}):{w:i,h:n}}#Ba(){const{w:t,h:e}=this.sizeService.getInputSize();return{element:this.#Ul,anchor:this.anchor.create(!0),inputWidth:t,inputHeight:e,align:this.#ya,isUpdate:this.modal.isUpdate,alt:this.altText.value}}#Aa(t){t?(Ht.utils.addClass(this.asInline,"on"),Ht.utils.removeClass(this.asBlock,"on"),this.as=gr.INLINE,this.alignForm&&(this.alignForm.style.display="none"),this.captionEl&&(this.captionEl.style.display="none")):(Ht.utils.addClass(this.asBlock,"on"),Ht.utils.removeClass(this.asInline,"on"),this.as=gr.BLOCK,this.alignForm&&(this.alignForm.style.display=""),this.captionEl&&(this.captionEl.style.display=""))}#Na(){const{w:t,h:e}=this.sizeService.getInputSize(),s=t||"auto",i=e||"auto";let n=this.#Ul;(this.as===gr.BLOCK&&!this.#wa||this.as===gr.INLINE&&this.#wa)&&(n=this.figure.convertAsFormat(n,this.as));const o=this.#wa,l=this.#_a===this.#wa?null:this.#_a;let r;const a=Lt.is(s)?s+this.state.sizeUnit:s,c=Lt.is(i)?i+this.state.sizeUnit:i;r=/%$/.test(n.style.width)?a!==l.style.width||c!==l.style.height:a!==n.style.width||c!==n.style.height,n.alt=this.altText.value;let h=!1;this.captionCheckEl.checked?this.#xa||(this.#xa=Es.CreateCaption(o,this.$.lang.caption),h=!0):this.#xa&&(Ht.utils.removeItem(this.#xa),this.#xa=null,h=!0);let d=!1;const u=this.anchor.create(!0);if(u)this.#va===u&&l.contains(u)||(this.#va=u.cloneNode(!1),o.insertBefore(this.#Ia(n,this.#va),this.#xa),d=!0);else if(null!==this.#va&&o.contains(this.#va)){const t=n.cloneNode(!0);o.removeChild(this.#va),o.insertBefore(t,this.#xa),n=t}d&&Ht.utils.removeItem(u),this.#ar&&r&&this.sizeService.applySize(s,i),(h||!this.state.onlyPercentage&&r)&&(/\d+/.test(n.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(s)||/auto|%$/.test(i)?this.figure.deleteTransform(n):this.#ar&&r&&this.figure.isVertical||this.figure.setTransform(n,s,i,0)),this.figure.setAlign(n,this.#ya),n.onload=()=>{this.componentSelect(n)}}#La(t,e){const{w:s,h:i}=this.sizeService.getInputSize();t||=s||"auto",e||=i||"auto";let n=this.#Ul,o=this.#wa,l=null,r=this.#_a===this.#wa?null:this.#_a,a=!1;if(!o||!r){a=!0,n=this.#Ul.cloneNode(!0);const e=this.pluginOptions.useFormatType&&"auto"!==t&&(/^span$/i.test(this.#Ul.parentElement?.nodeName)||this.$.format.isLine(this.#Ul.parentElement))?Es.CreateInlineContainer(n,"se-image-container"):Es.CreateContainer(n,"se-image-container");o=e.cover,r=e.container,l=e.inlineCover,this.figure.open(n,{nonResizing:!0,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0})}n.alt=this.altText.value;let c=!1;l||(this.captionCheckEl.checked?this.#xa&&!a||(this.#xa=Es.CreateCaption(o,this.$.lang.caption),c=!0):this.#xa&&(Ht.utils.removeItem(this.#xa),this.#xa=null,c=!0));let h=null;const d=this.anchor.create(!0);if(d)(this.#va!==d||a&&!r.contains(d))&&(this.#va=d.cloneNode(!1),o.insertBefore(this.#Ia(n,this.#va),this.#xa),h=this.#Ul);else if(null!==this.#va&&o.contains(this.#va)){const t=n.cloneNode(!0);o.removeChild(this.#va),o.insertBefore(t,this.#xa),n=t}a&&(n=this.#Ul,this.figure.retainFigureFormat(r,this.#Ul,h?d:null,this.fileManager),this.#Ul=n=r.querySelector("img"),this.#wa=o,this.#_a=r),n.style.width="",n.style.height="",n.removeAttribute("width"),n.removeAttribute("height"),this.sizeService.applySize(t,e),h&&(a?(Ht.utils.removeItem(h),0===Ht.query.getListChildren(d,(t=>/IMG/i.test(t.tagName)),null).length&&Ht.utils.removeItem(d)):Ht.utils.removeItem(d)),!c&&this.state.onlyPercentage||(/\d+/.test(n.style.height)||this.figure.isVertical&&this.captionCheckEl.checked)&&(/auto|%$/.test(t)||/auto|%$/.test(e)?this.figure.deleteTransform(n):this.figure.setTransform(n,t,e,0)),this.figure.setAlign(n,this.#ya)}#Ia(t,e){return e?(e.appendChild(t),e):t}#$a(t){const e=this.modal.form,s="string"==typeof t?e.querySelector("._se_tab_link"):Ht.query.getEventTarget(t);if(!/^BUTTON$/i.test(s.tagName))return!1;const i=s.getAttribute("data-tab-link");let n;const o=e.getElementsByClassName("_se_tab_content");for(n=0;n<o.length;n++)o[n].style.display="none";const l=e.getElementsByClassName("_se_tab_link");for(n=0;n<l.length;n++)Ht.utils.removeClass(l[n],"active");return e.querySelector("._se_tab_content_"+i).style.display="block",Ht.utils.addClass(s,"active"),"init"!==t&&("image"===i?this.focusElement.focus():"url"===i&&this.anchor.urlInput.focus()),!1}#Sa(){this.imgInputFile.value="",this.imgUrlFile&&(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),ko.OnChangeFile(this.fileModalWrapper,[])}#Ma({target:t}){this.#Aa("asInline"===t.getAttribute("data-command"))}#ka(t){const e=t.target.value.trim();this.#ba=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Ea({target:t}){this.imgInputFile.value?(this.imgUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.imgUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),ko.OnChangeFile(this.fileModalWrapper,t.files)}#Ta(){this.$.plugins.imageGallery.open(this.#Oa.bind(this))}#Oa(t){this.altText.value=t.getAttribute("data-value")||t.alt,this.#ba=this.previewSrc.textContent=this.imgUrlFile.value=t.getAttribute("data-command")||t.src,this.imgUrlFile.focus()}#Va(t,e,s){this.setState("produceIndex",this.state.produceIndex-1),delete t.onload,0===t.offsetWidth&&this.sizeService.applySize(e,""),0===this.state.produceIndex&&(this.$.component.applyInsertBehavior(s,null,this.pluginOptions.insertBehavior||this.$.options.get("componentInsertBehavior")),this.$.ui._iframeAutoHeight(this.$.frameContext),this.$.history.push(!1))}};const wr=class{#sr;#X;#L;#ta;#ar;#Ra;#za;#Fa;#ea;#sa;#ia={w:0,h:0};#na=null;#oa=null;#la=null;#Pa=null;constructor(t,e){if(this.#sr=t,this.#X=t.$,this.#L=t.state,this.#ta=t.pluginOptions,this.#ar=this.#ta.canResize,this.#Ra=this.#L.defaultRatio,this.#za="100%",this.#Fa=100*this.#ta.defaultRatio+"%",this.#ea="100%"===this.#ta.defaultWidth?"":this.#ta.defaultWidth,this.#sa=this.#ta.defaultHeight===this.#L.defaultRatio?"":this.#ta.defaultHeight,this.#ar){this.#na=e.proportion,this.frameRatioOption=e.frameRatioOption,this.#oa=e.inputX,this.#la=e.inputY,this.#oa.value=this.#ta.defaultWidth,this.#la.value=this.#ta.defaultHeight;const t=this.#ra.bind(this);this.#X.eventManager.addEvent(this.#oa,"keyup",this.#aa.bind(this,"x")),this.#X.eventManager.addEvent(this.#la,"keyup",this.#aa.bind(this,"y")),this.#X.eventManager.addEvent(this.#oa,"change",t),this.#X.eventManager.addEvent(this.#la,"change",t),this.#X.eventManager.addEvent(this.#na,"change",t),this.#X.eventManager.addEvent(this.frameRatioOption,"change",this.#Da.bind(this)),this.#X.eventManager.addEvent(e.revertBtn,"click",this.#ca.bind(this))}}setInputSize(t,e){this.#oa.value=t===this.#za?"":t,this.#L.onlyPercentage||(this.#la.value=e===this.#Fa?"":e)}getInputSize(){return{w:this.#oa?.value||"",h:this.#la?.value||""}}setOriginSize(t,e){this.#ea=t,this.#sa=e}applySize(t,e){t||=this.#oa?.value||this.#ta.defaultWidth,e||=this.#la?.value||this.#ta.defaultHeight,this.#L.onlyPercentage&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.#sr.figure.setSize(t,e)}resolveSize(t,e,s,i){t||=this.#za,e||=this.#Ra;const n=this.#sr.figure.getSize(s),o=n.w!==t||n.h!==e,l=!i||o;return l&&(this.#Pa!==this.frameRatioOption?.value&&this.#sr.figure.deleteTransform(),this.applySize(t,e)),{width:t,height:e,isChanged:l}}on(t){if(this.#ar){if(!t){const t=this.#ta.defaultWidth,e=this.#ta.defaultHeight;this.setInputSize(t,e),this.setOriginSize(t,e),this.#na.disabled=!0}this.#qa(this.#sr.figure.isVertical?"":this.#sa||this.#L.defaultRatio),this.#Pa=this.frameRatioOption?.value}}ready(t,e){const{dw:s,dh:i}=this.#sr.figure.getSize(e);this.setInputSize(s,i);const n=t.height||t.h||this.#sa||"";this.#qa(n)||(this.#la.value=String(this.#L.onlyPercentage?Lt.get(n,2):n));const o=this.#L.onlyPercentage&&this.#sr.figure.isVertical;this.#oa.disabled=o,this.#la.disabled=o,this.#na.checked=!t.isVertical,this.#na.disabled=o,this.#ia=this.#na.checked?t.ratio:{w:0,h:0}}init(){this.#ia={w:0,h:0},this.#ar&&(this.setInputSize(this.#ta.defaultWidth,this.#ta.defaultHeight),this.#na.checked=!1,this.#na.disabled=!0,this.#qa(this.#L.defaultRatio))}#ca(){this.#L.onlyPercentage?this.#oa.value=Number(this.#ea)>100?"100":this.#ea:(this.#oa.value=this.#ea,this.#la.value=this.#sa)}#qa(t){if(!this.frameRatioOption)return;let e=!1;const s=this.frameRatioOption.options;/%$/.test(t+"")||this.#L.onlyPercentage?t=Lt.get(t,2)/100+"":(!Lt.is(t)||Number(t)>=1)&&(t=""),this.#la.placeholder="";for(let i=0,n=s.length;i<n;i++)s[i].value===t?(e=s[i].selected=!0,this.#la.placeholder=t?100*Number(t)+"%":""):s[i].selected=!1;return e}#Da(t){const e=Ht.query.getEventTarget(t),s=e.options[e.selectedIndex].value;this.#Fa=this.#sr.figure.autoRatio.current=this.#Ra=s?100*Number(s)+"%":this.#Fa,this.#la.placeholder=s?100*Number(s)+"%":"",this.#la.value=""}#ra(){this.#ia=this.#na.checked?Es.GetRatio(this.#oa.value,this.#la.value,this.#L.sizeUnit):{w:0,h:0}}#aa(t,e){if(Nt.isSpace(e.code))return void e.preventDefault();const s=Ht.query.getEventTarget(e);if("x"===t&&this.#L.onlyPercentage&&Number(s.value)>100)s.value="100";else if(this.#na.checked&&!this.frameRatioOption?.value){const e=Es.CalcRatio(this.#oa.value,this.#la.value,this.#L.sizeUnit,this.#ia);"x"===t?this.#la.value=String(e.h):this.#oa.value=String(e.w)}"y"===t&&this.#qa(s.value||this.#L.defaultRatio)}},{NO_EVENT:_r}=Et;const xr=class{#sr;#X;#ta;constructor(t){this.#sr=t,this.#X=t.$,this.#ta=t.pluginOptions}serverUpload(t,e){if(!e)return;const s=this.#ta.uploadUrl;"string"==typeof s&&s.length>0&&this.#sr.fileManager.upload(s,this.#ta.uploadHeaders,e,this.#da.bind(this,t),this.#Pl.bind(this))}#Fl(t,e){const s=e.result,i=this.#sr.createVideoTag();for(let e=0,n=s.length;e<n;e++){const o=t.isUpdate?t.element:i.cloneNode(!1);this.#sr.create(o,s[e].url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,{name:s[e].name,size:s[e].size},e===n-1)}}async#Pl(t){const e=await this.#X.eventManager.triggerEvent("onVideoUploadError",{error:t}),s=e===_r?t.errorMessage:e||t.errorMessage;this.#X.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.video.error]",e)}async#da(t,e){if(await this.#X.eventManager.triggerEvent("videoUploadHandler",{xmlHttp:e,info:t})===_r){const s=JSON.parse(e.responseText);s.errorMessage?this.#Pl(s):this.#Fl(t,s)}}};const{_w:$r,NO_EVENT:Sr}=Et;class kr extends Fo{static key="video";static className="";static component(t){return/^(VIDEO)$/i.test(t?.nodeName)||/^(IFRAME)$/i.test(t?.nodeName)&&this.#Wa(t.src)?t:null}static#Wa(t){return t=t?.toLowerCase()||"",!(!this.#Ua.some((e=>t.endsWith(e)))&&!this.#Ga.some((e=>e.test(t))))}static#Ua=[".mp4",".avi",".mov",".webm",".flv",".mkv",".m4v",".ogv"];static#Ga=[/youtu\.?be/,/vimeo\.com\//,/dailymotion\.com\/video\//,/facebook\.com\/.+\/videos\//,/facebook\.com\/watch\/\?v=/,/twitter\.com\/.+\/status\//,/twitch\.tv\/videos\//,/twitch\.tv\/[^/]+$/,/tiktok\.com\/@[^/]+\/video\//,/instagram\.com\/p\//,/instagram\.com\/tv\//,/instagram\.com\/reel\//,/linkedin\.com\/posts\//,/\.(wistia\.com|wi\.st)\/(medias|embed)\//,/loom\.com\/share\//];#ar;#fa;#ba="";#ya="none";#Ul=null;#_a=null;constructor(t,e){super(t),this.title=this.$.lang.video,this.icon="video",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&Lt.get(e.defaultWidth,0)?Lt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Lt.get(e.defaultHeight,0)?Lt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Lt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Lt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"video/*":e.acceptedFormats.trim()||"video/*",defaultRatio:Lt.get(e.defaultRatio,4)||.5625,showRatioOption:void 0===e.showRatioOption||!!e.showRatioOption,ratioOptions:e.ratioOptions?e.ratioOptions:null,videoTagAttributes:e.videoTagAttributes||null,iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||"",insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?"%":"px",i=function({lang:t,icons:e,plugins:s},i){let n=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.video_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">`;if(i.createFileInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_file}</label>\n\t\t\t\t${ko.CreateFileInput({lang:t,icons:e},i)}\n\t\t\t</div>`),i.createUrlInput&&(n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<label>${t.video_modal_url}</label>\n\t\t\t\t<div class="se-modal-form-files">\n\t\t\t\t\t<input class="se-input-form se-input-url" type="text" data-focus />\n\t\t\t\t\t${s.videoGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.videoGallery}">\n\t\t\t\t\t\t\t\t${e.video_gallery}\n\t\t\t\t\t\t\t\t${Ht.utils.createTooltipInner(t.videoGallery)}\n\t\t\t\t\t\t\t\t</button>`:""}\n\t\t\t\t</div>\n\t\t\t\t<pre class="se-link-preview"></pre>\n\t\t\t</div>`),i.canResize){const s=i.ratioOptions||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285},{name:"9:16",value:1.78}],o=i.defaultRatio,l=i.percentageOnlySize,r=l?' style="display: none !important;"':"",a=i.showHeightInput?"":' style="display: none !important;"',c=i.showRatioOption?"":' style="display: none !important;"',h=l||i.showHeightInput||i.showRatioOption?"":' style="display: none !important;"';n+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t\t<label class="size-h"${a}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${c}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="100%"${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${h}>${l?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="${100*i.defaultRatio}%"\n\t\t\t\t${l?' type="number" min="1"':'type="text"'}${l?' max="100"':""}${a}/>\n\t\t\t\t<select class="se-input-select se-modal-ratio" title="${t.ratio}" aria-label="${t.ratio}"${c}>\n\t\t\t\t\t${a?"":'<option value=""> - </option>'} \n\t\t\t\t\t${s.map((t=>`<option value="${t.value}"${o.toString()===t.value.toString()?" selected":""}>${t.name}</option>`)).join("")}\n\t\t\t\t</select>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${r}${h}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}n+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_video_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const o=Ht.utils.createElement("DIV",{class:"se-modal-content"},n);return{html:o,alignForm:o.querySelector(".se-figure-align"),fileModalWrapper:o.querySelector(".se-flex-input-wrapper"),videoInputFile:o.querySelector(".__se__file_input"),videoUrlFile:o.querySelector(".se-input-url"),previewSrc:o.querySelector(".se-link-preview"),galleryButton:o.querySelector(".__se__gallery"),proportion:o.querySelector("._se_check_proportion"),frameRatioOption:o.querySelector(".se-modal-ratio"),inputX:o.querySelector("._se_size_x"),inputY:o.querySelector("._se_size_y"),revertBtn:o.querySelector(".se-modal-btn-revert"),fileRemoveBtn:o.querySelector(".se-file-remove")}}(this.$,this.pluginOptions),n=e.controls||(this.pluginOptions.canResize?[["resize_auto,75,50","align","edit","revert","copy","remove"]]:[["align","edit","copy","remove"]]);n.some((t=>t.includes("align")))||(i.alignForm.style.display="none");const o=100*this.pluginOptions.defaultRatio+"%";this.modal=new ko(this,this.$,i.html),this.figure=new Es(this,this.$,n,{sizeUnit:s,autoRatio:{current:o,default:o}}),this.fileManager=new To(this,this.$,{query:"iframe, video",loadEventName:"onVideoLoad",actionEventName:"onVideoAction"}),this.fileModalWrapper=i.fileModalWrapper,this.videoInputFile=i.videoInputFile,this.videoUrlFile=i.videoUrlFile,this.focusElement=this.videoUrlFile||this.videoInputFile,this.previewSrc=i.previewSrc,this.#ar=this.pluginOptions.canResize,this.#fa=!this.#ar||!this.pluginOptions.showHeightInput||this.pluginOptions.percentageOnlySize,this.query={youtube:{pattern:/youtu\.?be/i,action:t=>(t=this.convertUrlYoutube(t),Mt.addUrlQuery(t,this.pluginOptions.query_youtube)),tag:"iframe"},vimeo:{pattern:/vimeo\.com/i,action:t=>(t=this.convertUrlVimeo(t),Mt.addUrlQuery(t,this.pluginOptions.query_vimeo)),tag:"iframe"},...e.embedQuery};const l=[];for(const t in this.query)l.push(this.query[t].pattern);kr.#Ua=kr.#Ua.concat(this.pluginOptions.extensions||[]),kr.#Ga=kr.#Ga.concat(e.urlPatterns||[]),this.state={onlyPercentage:this.pluginOptions.percentageOnlySize,sizeUnit:s,defaultRatio:100*this.pluginOptions.defaultRatio+"%"},this.sizeService=new wr(this,i),this.uploadService=new xr(this);const r=i.galleryButton;r&&this.$.eventManager.addEvent(r,"click",this.#Ta.bind(this)),this.videoInputFile&&this.$.eventManager.addEvent(i.fileRemoveBtn,"click",this.#Sa.bind(this)),this.videoUrlFile&&this.$.eventManager.addEvent(this.videoUrlFile,"input",this.#ka.bind(this)),this.videoInputFile&&this.videoUrlFile&&this.$.eventManager.addEvent(this.videoInputFile,"change",this.#Ea.bind(this))}setState(t,e){this.state[t]=e}open(){this.modal.open()}retainFormat(){return{query:"iframe, video",method:async t=>{if(/^(iframe)$/i.test(t?.nodeName)&&!kr.#Wa(t.src))return;const e=Es.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Ha(t,!0);const s=this.$.format.getLine(t);s&&(this.#ya=s.style.textAlign||s.style.float),this.#Na(t)}}}onFilePasteAndDrop({file:t}){/^video/.test(t.type)&&(this.submitFile([t]),this.$.focusManager.focus())}modalOn(t){t?this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.removeAttribute("multiple"):this.videoInputFile&&this.pluginOptions.allowMultiple&&this.videoInputFile.setAttribute("multiple","multiple"),this.sizeService.on(t)}async modalAction(){this.#ya=this.modal.form.querySelector('input[name="suneditor_video_radio"]:checked').value;let t=!1;return this.videoInputFile&&this.videoInputFile.files.length>0?t=await this.submitFile(this.videoInputFile.files):this.videoUrlFile&&this.#ba.length>0&&(t=await this.submitURL(this.#ba)),t&&$r.setTimeout(this.$.component.select.bind(this.$.component,this.#Ul,kr.key),0),t}modalInit(){ko.OnChangeFile(this.fileModalWrapper,[]),this.videoInputFile&&(this.videoInputFile.value=""),this.videoUrlFile&&(this.#ba=this.previewSrc.textContent=this.videoUrlFile.value=""),this.videoInputFile&&this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,this.#fa=!1,this.sizeService.init()}componentSelect(t){this.#Ha(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#Ul,s=Ht.query.getParentElement(e,Es.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onVideoDeleteBefore",{element:e,container:s,align:this.#ya,url:this.#ba})&&(Ht.utils.removeItem(s),this.modalInit(),n!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(i),this.$.history.push(!1))}findProcessUrl(t){const e=this.query;for(const s in e){const i=e[s];if(i.pattern.test(t))return{origin:t,url:i.action(t),tag:i.tag}}return null}convertUrlYoutube(t){return/^http/.test(t)||(t="https://"+t),t=t.replace("watch?v=",""),/^\/\/.+\/embed\//.test(t)||(t=t.replace(t.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),t}convertUrlVimeo(t){return t.endsWith("/")&&(t=t.slice(0,-1)),t="https://player.vimeo.com/video/"+t.slice(t.lastIndexOf("/")+1)}addQuery(t,e){if(e.length>0)if(/\?/.test(t)){const s=t.split("?");t=s[0]+"?"+e+"&"+s[1]}else t+="?"+e;return t}create(t,e,s,i,n,o,l,r){let a=null;if(o){if((t=this.#Ul).src!==e){const s=this.findProcessUrl(e);if(/^iframe$/i.test(s?.tag)&&!/^iframe$/i.test(t.nodeName)){const s=this.createIframeTag();s.src=e,t.replaceWith(s),this.#Ul=t=s}else if(/^video$/i.test(s?.tag)&&!/^video$/i.test(t.nodeName)){const s=this.createVideoTag();s.src=e,t.replaceWith(s),this.#Ul=t=s}else t.src=e}a=this.#_a}else{t.src=e,this.#Ul=t;a=Es.CreateContainer(t,"se-video-container").container}this.#Ul=t,this.#_a=a,this.figure.open(t,{nonResizing:this.#fa,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const c=this.sizeService.resolveSize(s,i,t,o);s=c.width,i=c.height,this.figure.setAlign(t,n),this.fileManager.setFileData(t,l),o?(this.#ar&&c.isChanged&&this.figure.isVertical||this.figure.setTransform(t,s,i,0),this.$.history.push(!1)):this.$.component.insert(a,{scrollTo:!!r,insertBehavior:r?this.pluginOptions.insertBehavior:"line"})}createIframeTag(t){const e=Ht.utils.createElement("IFRAME");if(t)for(const s in t)e[s]=t[s];return this.#Za(e),e}createVideoTag(t){const e=Ht.utils.createElement("VIDEO");if(t)for(const s in t)e[s]=t[s];return this.#ja(e),e}async submitFile(t){if(0===t.length)return;let e=0;const s=[],i=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/video/i.test(n.type)){if(o=n.size,i>0&&o>i){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onVideoUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===Sr?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit,o=this.fileManager.getSize();if(n>0&&e+o>n){const t="[SUNEDITOR.videoUpload.fail] Size of uploadable total videos: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onVideoUploadError",{error:t,limitSize:n,currentSize:o,uploadSize:e});return this.$.ui.alertOpen(s===Sr?t:s||t,"error"),!1}const l={url:null,files:s,...this.#Ba()},r=function(t,e,s){t(e=s||e,e.files)}.bind(this,this.uploadService.serverUpload.bind(this.uploadService),l),a=await this.$.eventManager.triggerEvent("onVideoUploadBefore",{info:l,handler:r});return void 0===a||!1!==a&&(null!==a&&"object"==typeof a&&r(a),void(!0!==a&&a!==Sr||r(null)))}async submitURL(t){if(!(t=this.#ba))return!1;if(/^<iframe.*\/iframe>$/.test(t)){if(0===(t=(new DOMParser).parseFromString(t,"text/html").querySelector("iframe").src).length)return!1}const e=this.findProcessUrl(t);e&&(t=e.url);const s={name:t.split("/").pop(),size:0},i={url:t,files:s,...this.#Ba(),process:e},n=function(t,e){t=e||t,this.create(this[/^iframe$/i.test(t.process?.tag)?"createIframeTag":"createVideoTag"](),t.url,t.inputWidth,t.inputHeight,t.align,t.isUpdate,t.files,!0)}.bind(this,i),o=await this.$.eventManager.triggerEvent("onVideoUploadBefore",{info:i,handler:n});return void 0===o||!1!==o&&(null!==o&&"object"==typeof o&&n(o),!0!==o&&o!==Sr||n(null),!0)}#Ha(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#fa,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});this.#Ul=t,this.#_a=s.container,this.#ya=s.align,t.style.float="";const i=String(s.width||s.originWidth||s.w||""),n=String(s.height||s.originHeight||s.h||"");this.sizeService.setOriginSize(i,n),this.videoUrlFile&&(this.#ba=this.previewSrc.textContent=this.videoUrlFile.value=this.#Ul.src||this.#Ul.querySelector("source")?.src||"");(this.modal.form.querySelector('input[name="suneditor_video_radio"][value="'+this.#ya+'"]')||this.modal.form.querySelector('input[name="suneditor_video_radio"][value="none"]')).checked=!0,this.#ar&&this.sizeService.ready(s,t)}#Ba(){const{w:t,h:e}=this.sizeService.getInputSize();return{inputWidth:t,inputHeight:e,align:this.#ya,isUpdate:this.modal.isUpdate,element:this.#Ul}}#Na(t){if(!t)return;/^video$/i.test(t.nodeName)?this.#ja(t):/^iframe$/i.test(t.nodeName)&&this.#Za(t);const e=t,s=t.cloneNode(!0),i=Es.CreateContainer(s,"se-video-container"),n=i.container,o=Es.GetContainer(e)?.container?.querySelector("figcaption");let l=null;o&&(l=Ht.utils.createElement("figcaption"),l.innerHTML=o.innerHTML,Ht.utils.removeItem(o),i.cover.appendChild(l)),this.figure.open(s,{nonResizing:this.#fa,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const r=(s.getAttribute("data-se-size")||",").split(","),a=r[0]||e.width||"",c=r[1]||e.height||this.state.defaultRatio||"";this.sizeService.applySize(a,c);const h=this.$.format.getLine(e);return h&&(this.#ya=h.style.textAlign||h.style.float),this.figure.setAlign(s,this.#ya),this.figure.retainFigureFormat(n,this.#Ul,null,this.fileManager),s}#ja(t){t.setAttribute("controls","true");const e=this.pluginOptions.videoTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Za(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Sa(){this.videoInputFile.value="",this.videoUrlFile&&(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration=""),ko.OnChangeFile(this.fileModalWrapper,[])}#ka(t){const e=Ht.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#ba=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#ba=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Ta(){this.$.plugins.videoGallery.open(this.#Oa.bind(this))}#Oa(t){this.#ba=this.previewSrc.textContent=this.videoUrlFile.value=t.getAttribute("data-command")||t.src,this.videoUrlFile.focus()}#Ea(t){this.videoInputFile.value?(this.videoUrlFile.disabled=!0,this.previewSrc.style.textDecoration="line-through"):(this.videoUrlFile.disabled=!1,this.previewSrc.style.textDecoration="");const e=Ht.query.getEventTarget(t);ko.OnChangeFile(this.fileModalWrapper,e.files)}}const Er=kr,{NO_EVENT:Tr,ON_OVER_COMPONENT:Mr}=Et;class Hr extends Fo{static key="audio";static className="";static component(t){return/^AUDIO$/i.test(t?.nodeName)?t:null}#Ka;#Ya;#Xa="";#Ul=null;constructor(t,e){super(t),this.title=this.$.lang.audio,this.icon="audio",this.pluginOptions={defaultWidth:e.defaultWidth?Lt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight?Lt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",createFileInput:!!e.createFileInput,createUrlInput:void 0===e.createUrlInput||!e.createFileInput||e.createUrlInput,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Lt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Lt.get(e.uploadSingleSizeLimit,0),allowMultiple:!!e.allowMultiple,acceptedFormats:"string"!=typeof e.acceptedFormats||"*"===e.acceptedFormats.trim()?"audio/*":e.acceptedFormats.trim()||"audio/*",audioTagAttributes:e.audioTagAttributes||null,insertBehavior:e.insertBehavior};const s=function({lang:t,icons:e,plugins:s},i){let n=`\n <form method="post" enctype="multipart/form-data">\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.audio_modal_title}</span>\n </div>\n <div class="se-modal-body">`;i.createFileInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_file}</label>\n ${ko.CreateFileInput({lang:t,icons:e},i)}\n </div>`);i.createUrlInput&&(n+=`\n <div class="se-modal-form">\n <label>${t.audio_modal_url}</label>\n\t\t\t<div class="se-modal-form-files">\n\t\t\t\t<input class="se-input-form se-input-url" data-focus type="text" />\n\t\t\t\t${s.audioGallery?`<button type="button" class="se-btn se-tooltip se-modal-files-edge-button __se__gallery" aria-label="${t.audioGallery}">\n\t\t\t\t\t\t\t${e.audio_gallery}\n\t\t\t\t\t\t\t${Ht.utils.createTooltipInner(t.audioGallery)}\n\t\t\t\t\t\t\t</button>`:""}\n\t\t\t</div>\n <pre class="se-link-preview"></pre>\n </div>`);return n+=`\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n <span>${t.submitButton}</span>\n </button>\n </div>\n </form>`,Ht.utils.createElement("DIV",{class:"se-modal-content"},n)}(this.$,this.pluginOptions),i=function({lang:t,icons:e}){const s=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return Ht.utils.createElement("DIV",{class:"se-controller"},s)}(this.$);this.modal=new ko(this,this.$,s),this.controller=new ps(this,this.$,i,{position:"bottom",disabled:!0}),this.fileManager=new To(this,this.$,{query:"audio",loadEventName:"onAudioLoad",actionEventName:"onAudioAction"}),this.figure=new Es(this,this.$,null,{}),this.fileModalWrapper=s.querySelector(".se-flex-input-wrapper"),this.audioInputFile=s.querySelector(".__se__file_input"),this.audioUrlFile=s.querySelector(".se-input-url"),this.preview=s.querySelector(".se-link-preview"),this.#Ka=this.pluginOptions.defaultWidth,this.#Ya=this.pluginOptions.defaultHeight;const n=s.querySelector(".__se__gallery");n&&this.$.eventManager.addEvent(n,"click",this.#Ta.bind(this)),this.audioInputFile&&(this.$.eventManager.addEvent(s.querySelector(".se-modal-files-edge-button"),"click",this.#Sa.bind(this,this.audioUrlFile,this.preview)),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioInputFile,"change",this.#Ja.bind(this))),this.audioUrlFile&&this.$.eventManager.addEvent(this.audioUrlFile,"input",this.#ka.bind(this))}open(){this.modal.open()}retainFormat(){return{query:"audio",method:t=>{const e=Es.GetContainer(t);if(e&&e.container&&e.cover)return;this.#ja(t);const s=Es.CreateContainer(t.cloneNode(!0),"se-flex-component");this.figure.retainFigureFormat(s.container,t,null,this.fileManager)}}}onFilePasteAndDrop({file:t}){/^audio/.test(t.type)&&(this.submitFile([t]),this.$.focusManager.focus())}modalOn(t){t?this.#Ul?(this.#Xa=this.preview.textContent=this.audioUrlFile.value=this.#Ul.src,this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple")):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.removeAttribute("multiple"):this.audioInputFile&&this.pluginOptions.allowMultiple&&this.audioInputFile.setAttribute("multiple","multiple")}async modalAction(){return this.audioInputFile&&this.audioInputFile?.files.length>0?await this.submitFile(this.audioInputFile.files):!!(this.audioUrlFile&&this.#Xa.length>0)&&await this.submitURL(this.#Xa)}modalInit(){ko.OnChangeFile(this.fileModalWrapper,[]),this.audioInputFile&&(this.audioInputFile.value=""),this.audioUrlFile&&(this.#Xa=this.preview.textContent=this.audioUrlFile.value=""),this.audioInputFile&&this.audioUrlFile&&(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration="")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.audioUrlFile&&(this.#Xa=this.preview.textContent=this.audioUrlFile.value=this.#Ul.src),this.open();break;case"copy":{const t=Es.GetContainer(this.#Ul);this.$.component.copy(t.container);break}case"delete":this.componentDestroy(null)}}componentSelect(t){this.figure.open(t,{nonResizing:!0,nonSizeInfo:!0,nonBorder:!0,figureTarget:!0,infoOnly:!1}),this.#Ha(t)}async componentDestroy(t){const e=t||this.#Ul,s=Es.GetContainer(e),i=s.container||e,n=i.previousElementSibling||i.nextElementSibling;if(!1===await this.$.eventManager.triggerEvent("onAudioDeleteBefore",{element:e,container:s,url:e.getAttribute("src")}))return;const o=i.parentNode;Ht.utils.removeItem(i),this.modalInit(),this.controller.close(),o!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(o,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(n),this.$.history.push(!1)}async submitFile(t){if(0===t.length)return!1;let e=0;const s=[],i=this.pluginOptions.uploadSingleSizeLimit;for(let n,o,l=0,r=t.length;l<r;l++)if(n=t[l],/audio/i.test(n.type)){if(o=n.size,i>0&&o>i){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable single file: "+i/1e3+"KB",e=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t,limitSize:i,uploadSize:o,file:n});return this.$.ui.alertOpen(e===Tr?t:e||t,"error"),!1}s.push(n),e+=o}const n=this.pluginOptions.uploadSizeLimit;if(n>0&&e+this.fileManager.getSize()>n){const t="[SUNEDITOR.audioUpload.fail] Size of uploadable total audios: "+n/1e3+"KB",s=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t,limitSize:n,currentSize:this.fileManager.getSize(),uploadSize:e});return this.$.ui.alertOpen(s===Tr?t:s||t,"error"),!1}const o={files:s,isUpdate:this.modal.isUpdate,element:this.#Ul},l=function(t,e,s){t(s=e||s,s.files)}.bind(this,this.#Qa.bind(this),o),r=await this.$.eventManager.triggerEvent("onAudioUploadBefore",{info:o,handler:l});return void 0===r||!!r&&(null!==r&&"object"==typeof r&&l(r),!0!==r&&r!==Tr||l(null),!0)}async submitURL(t){if(0===t.length)return!1;const e={name:t.split("/").pop(),size:0},s={url:t,files:e,isUpdate:this.modal.isUpdate,element:this.#tc()},i=function(t,e,s){t((s=e||s).element,s.url,s.files,s.isUpdate,!0)}.bind(this,this.create.bind(this),s),n=await this.$.eventManager.triggerEvent("onAudioUploadBefore",{info:s,handler:i});return void 0===n||!!n&&(null!==n&&"object"==typeof n&&i(n),!0!==n&&n!==Tr||i(null),!0)}create(t,e,s,i,n){if(i){if(this.#Ul&&(t=this.#Ul),this.fileManager.setFileData(t,s),!t||t.src===e)return void this.$.component.select(t,Hr.key);t.src=e,this.$.component.select(t,Hr.key)}else{this.fileManager.setFileData(t,s),t.src=e;const i=Es.CreateContainer(t,"se-flex-component");if(!this.$.component.insert(i.container,{scrollTo:!!n,insertBehavior:n?this.pluginOptions.insertBehavior:"line"}))return void(n&&this.$.focusManager.focus());if(!this.$.options.get("componentInsertBehavior")){const t=this.$.format.addLine(i.container,null);t&&this.$.selection.setRange(t,0,t,0)}}i&&this.$.history.push(!1)}#Ha(t){os.get("__overInfo")!==Mr&&(this.#Ul=t,this.controller.open(t,null,{isWWTarget:!1,addOffset:null}))}#Fl(t,e){const s=e.result;for(let e,i,n=0,o=s.length;n<o;n++)i=t.isUpdate?t.element:this.#tc(),e={name:s[n].name,size:s[n].size},this.create(i,s[n].url,e,t.isUpdate,n===o-1)}#tc(){const t=this.#Ka,e=this.#Ya,s=Ht.utils.createElement("AUDIO",{style:(t?"width:"+t+"; ":"")+(e?"height:"+e+";":"")});return this.#ja(s),s}#ja(t){t.setAttribute("controls","true");const e=this.pluginOptions.audioTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#Qa(t,e){if(!e)return;const s=this.modal.isUpdate?[e[0]]:e;this.fileManager.upload(this.pluginOptions.uploadUrl,this.pluginOptions.uploadHeaders,s,this.#da.bind(this,t),this.#Pl.bind(this))}async#Pl(t){const e=await this.$.eventManager.triggerEvent("onAudioUploadError",{error:t}),s=e===Tr?t.errorMessage:e||t.errorMessage;this.$.ui.alertOpen(s,"error"),console.error("[SUNEDITOR.plugin.audio.error]",s)}async#da(t,e){if(await this.$.eventManager.triggerEvent("audioUploadHandler",{xmlHttp:e,info:t})===Tr){const s=JSON.parse(e.responseText);s.errorMessage?this.#Pl(s):this.#Fl(t,s)}}#ka(t){const e=Ht.query.getEventTarget(t).value.trim();this.#Xa=this.preview.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#Ta(){this.$.plugins.audioGallery.open(this.#Oa.bind(this))}#Oa(t){this.#Xa=this.preview.textContent=this.audioUrlFile.value=t.getAttribute("data-command")||t.src,this.audioUrlFile.focus()}#Sa(t,e){this.audioInputFile.value="",t&&(t.disabled=!1,e.style.textDecoration=""),ko.OnChangeFile(this.fileModalWrapper,[])}#Ja(t){const e=Ht.query.getEventTarget(t);this.audioInputFile.value?(this.audioUrlFile.disabled=!0,this.preview.style.textDecoration="line-through"):(this.audioUrlFile.disabled=!1,this.preview.style.textDecoration=""),ko.OnChangeFile(this.fileModalWrapper,e.files)}}const Lr=Hr,{_w:Nr,NO_EVENT:Ar}=Et;class Br extends Fo{static key="embed";static className="";static component(t){const e=t.children;let s="",i=null;if(Ht.check.isIFrame(t)&&(i=t,s=t.src),!s&&/^DIV$/i.test(t?.nodeName)&&Ht.check.isIFrame(e[0])&&(i=e[0],s=i.src),!s&&Ht.utils.hasClass(t,"se-embed-container")){i=Ht.query.getChildNode(t,(t=>t.src||t.href)),s=i?.src||i?.href}if(/^BLOCKQUOTE$/i.test(t?.nodeName)){const e=t.querySelector("a");if(e&&e.href)return i=t,s=e.href,this.#Wa(s)?i:null}return s?this.#Wa(s)?i:null:i}static#Wa(t){return t=t?.toLowerCase()||"",!!this.#Ga.some((e=>e.test(t)))}static#Ga=null;#za;#Fa;#ea;#sa;#ar;#ec;#fa;#ba="";#ya="none";#Ul=null;#wa=null;#_a=null;#ia={w:0,h:0};constructor(t,e){super(t),this.title=this.$.lang.embed,this.icon="embed",this.pluginOptions={canResize:void 0===e.canResize||e.canResize,showHeightInput:void 0===e.showHeightInput||!!e.showHeightInput,defaultWidth:e.defaultWidth&&Lt.get(e.defaultWidth,0)?Lt.is(e.defaultWidth)?e.defaultWidth+"px":e.defaultWidth:"",defaultHeight:e.defaultHeight&&Lt.get(e.defaultHeight,0)?Lt.is(e.defaultHeight)?e.defaultHeight+"px":e.defaultHeight:"",percentageOnlySize:!!e.percentageOnlySize,uploadUrl:"string"==typeof e.uploadUrl?e.uploadUrl:null,uploadHeaders:e.uploadHeaders||null,uploadSizeLimit:Lt.get(e.uploadSizeLimit,0),uploadSingleSizeLimit:Lt.get(e.uploadSingleSizeLimit,0),iframeTagAttributes:e.iframeTagAttributes||null,query_youtube:e.query_youtube||"",query_vimeo:e.query_vimeo||"",insertBehavior:e.insertBehavior};const s=this.pluginOptions.percentageOnlySize?"%":"px",i=function({lang:t,icons:e},s){let i=`\n\t<form method="post" enctype="multipart/form-data">\n\t\t<div class="se-modal-header">\n\t\t\t<button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n\t\t\t${e.cancel}\n\t\t\t</button>\n\t\t\t<span class="se-modal-title">${t.embed_modal_title}</span>\n\t\t</div>\n\t\t<div class="se-modal-body">\n\t\t\t<div class='se-modal-form'>\n\t\t\t\t<label>${t.embed_modal_source}</label>\n\t\t\t\t<input class='se-input-form se-input-url' type='text' data-focus />\n\t\t\t\t<pre class='se-link-preview'></pre>\n\t\t\t</div>`;if(s.canResize){const n=s.percentageOnlySize,o=n?' style="display: none !important;"':"",l=s.showHeightInput?"":' style="display: none !important;"',r=s.showRatioOption?"":' style="display: none !important;"',a=n||s.showHeightInput||s.showRatioOption?"":' style="display: none !important;"';i+=`\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-size-text">\n\t\t\t\t\t<label class="size-w">${t.width}</label>\n\t\t\t\t\t<label class="se-modal-size-x"> </label>\n\t\t\t\t\t<label class="size-h"${l}>${t.height}</label>\n\t\t\t\t\t<label class="size-h"${r}>(${t.ratio})</label>\n\t\t\t\t</div>\n\t\t\t\t<input class="se-input-control _se_size_x" placeholder="auto"${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}/>\n\t\t\t\t<label class="se-modal-size-x"${a}>${n?"%":"x"}</label>\n\t\t\t\t<input class="se-input-control _se_size_y" placeholder="auto"\n\t\t\t\t${n?' type="number" min="1"':'type="text"'}${n?' max="100"':""}${l}/>\n\t\t\t\t<button type="button" title="${t.revert}" aria-label="${t.revert}" class="se-btn se-modal-btn-revert">${e.revert}</button>\n\t\t\t</div>\n\t\t\t<div class="se-modal-form se-modal-form-footer"${o}${a}>\n\t\t\t\t<label>\n\t\t\t\t\t<input type="checkbox" class="se-modal-btn-check _se_check_proportion" /> \n\t\t\t\t\t<span>${t.proportion}</span>\n\t\t\t\t</label>\n\t\t\t</div>`}i+=`\n\t\t</div>\n\t\t<div class="se-modal-footer">\n\t\t\t<div class="se-figure-align">\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="none" checked>${t.basic}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="left">${t.left}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="center">${t.center}</label>\n\t\t\t\t<label><input type="radio" name="suneditor_embed_radio" class="se-modal-btn-radio" value="right">${t.right}</label>\n\t\t\t</div>\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}"><span>${t.submitButton}</span></button>\n\t\t</div>\n\t</form>`;const n=Ht.utils.createElement("DIV",{class:"se-modal-content"},i);return{html:n,figureAlignBtn:n.querySelector(".se-figure-align"),fileModalWrapper:n.querySelector(".se-flex-input-wrapper"),embedInput:n.querySelector(".se-input-url"),previewSrc:n.querySelector(".se-link-preview"),proportion:n.querySelector("._se_check_proportion"),inputX:n.querySelector("._se_size_x"),inputY:n.querySelector("._se_size_y"),revertBtn:n.querySelector(".se-modal-btn-revert")}}(this.$,this.pluginOptions),n=e.controls||(this.pluginOptions.canResize?[["resize_auto,75,50","align","edit","revert","copy","remove"]]:[["align","edit","copy","remove"]]);n.some((t=>t.includes("align")))||(i.figureAlignBtn.style.display="none"),this.modal=new ko(this,this.$,i.html),this.figure=new Es(this,this.$,n,{sizeUnit:s}),this.fileModalWrapper=i.fileModalWrapper,this.embedInput=i.embedInput,this.focusElement=this.embedInput,this.previewSrc=i.previewSrc,this.sizeUnit=s,this.proportion=null,this.inputX=null,this.inputY=null,this.#za=this.pluginOptions.defaultWidth,this.#Fa=this.pluginOptions.defaultHeight,this.#ea="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.#sa="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.#ar=this.pluginOptions.canResize,this.#ec=this.pluginOptions.percentageOnlySize,this.#fa=!this.#ar||!this.pluginOptions.showHeightInput||this.#ec,this.query={facebook:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:facebook\.com)\/(.+)/i,action:t=>`https://www.facebook.com/plugins/post.php?href=${encodeURIComponent(t)}&show_text=true&width=500`,tag:"iframe"},twitter:{pattern:/^(?:https?:\/\/)?(?:(?:www\.)?(?:twitter\.com|x\.com)\/(?:[^/?#]+\/)?status\/\d+(?:[/?#]|$)|platform\.twitter\.com\/embed\/Tweet\.html(?:[?#].*)?$)/i,action:t=>`https://platform.twitter.com/embed/Tweet.html?url=${encodeURIComponent(t)}`,tag:"iframe"},instagram:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:instagram\.com)\/p\/(.+)/i,action:t=>`https://www.instagram.com/p/${t.match(this.query.instagram.pattern)[1]}/embed`,tag:"iframe"},linkedin:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:linkedin\.com)\/(.+)\/(.+)/i,action:t=>`https://www.linkedin.com/embed/feed/update/${encodeURIComponent(t.split("/").pop())}`,tag:"iframe"},pinterest:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:pinterest\.com)\/pin\/(.+)/i,action:t=>`https://assets.pinterest.com/ext/embed.html?id=${t.match(this.query.pinterest.pattern)[1]}`,tag:"iframe"},spotify:{pattern:/(?:https?:\/\/)?(?:open\.)?(?:spotify\.com)\/(track|album|playlist|show|episode)\/(.+)/i,action:t=>{const e=t.match(this.query.spotify.pattern);return`https://open.spotify.com/embed/${e[1]}/${e[2]}`},tag:"iframe"},codepen:{pattern:/(?:https?:\/\/)?(?:www\.)?(?:codepen\.io)\/(.+)\/pen\/(.+)/i,action:t=>{const[,e,s]=t.match(this.query.codepen.pattern);return`https://codepen.io/${e}/embed/${s}`},tag:"iframe"},...e.embedQuery};const o=[];for(const t in this.query)o.push(this.query[t].pattern);Br.#Ga=o.concat(e.urlPatterns||[]),this.$.eventManager.addEvent(this.embedInput,"input",this.#ka.bind(this)),this.#ar&&(this.proportion=i.proportion,this.inputX=i.inputX,this.inputY=i.inputY,this.inputX.value=this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight,this.$.eventManager.addEvent(this.inputX,"keyup",this.#aa.bind(this,"x")),this.$.eventManager.addEvent(this.inputY,"keyup",this.#aa.bind(this,"y")),this.$.eventManager.addEvent(i.revertBtn,"click",this.#ca.bind(this)))}open(){this.modal.open()}retainFormat(){return{query:"iframe",method:async t=>{if(!Br.#Wa(t.src))return;const e=Es.GetContainer(t);if(e&&e.container&&e.cover)return;this.#Ha(t,!0);const s=this.$.format.getLine(t);s&&(this.#ya=s.style.textAlign||s.style.float),this.#Na(t)}}}modalOn(t){!t&&this.#ar?(this.inputX.value=this.#ea="auto"===this.pluginOptions.defaultWidth?"":this.pluginOptions.defaultWidth,this.inputY.value=this.#sa="auto"===this.pluginOptions.defaultHeight?"":this.pluginOptions.defaultHeight,this.proportion.disabled=!0):t&&(this.#ba=this.previewSrc.textContent=this.embedInput.value=this.#wa.getAttribute("data-se-origin")||"")}async modalAction(){this.#ya=this.modal.form.querySelector('input[name="suneditor_embed_radio"]:checked').value;let t=!1;return this.#ba.length>0&&(t=await this.submitSRC(this.#ba)),t&&Nr.setTimeout(this.$.component.select.bind(this.$.component,this.#Ul,Br.key),0),t}modalInit(){ko.OnChangeFile(this.fileModalWrapper,[]),this.#ba=this.previewSrc.textContent=this.embedInput.value="",this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]').checked=!0,this.#ia={w:0,h:0},this.#fa=!1,this.#ar&&(this.inputX.value=this.pluginOptions.defaultWidth===this.#za?"":this.pluginOptions.defaultWidth,this.inputY.value=this.pluginOptions.defaultHeight===this.#Fa?"":this.pluginOptions.defaultHeight,this.proportion.checked=!1,this.proportion.disabled=!0)}componentSelect(t){this.#Ha(t)}componentEdit(){this.modal.open()}async componentDestroy(t){const e=t||this.#Ul,s=Ht.query.getParentElement(e,Es.is)||e,i=s.previousElementSibling||s.nextElementSibling,n=s.parentNode;!1!==await this.$.eventManager.triggerEvent("onEmbedDeleteBefore",{element:e,container:s,align:this.#ya,url:this.#ba})&&(Ht.utils.removeItem(s),this.modalInit(),n!==this.$.frameContext.get("wysiwyg")&&this.$.nodeTransform.removeAllParents(n,(function(t){return 0===t.childNodes.length}),null),this.$.focusManager.focusEdge(i),this.$.history.push(!1))}findProcessUrl(t){const e=this.query;for(const s in e){const i=e[s];if(i.pattern.test(t))return{origin:t,url:i.action(t),tag:i.tag}}return null}async submitSRC(t){if(!(t||=this.#ba))return!1;let e=null;if(/^<iframe\s|^<blockquote\s/i.test(t)){const s=(new DOMParser).parseFromString(t,"text/html").body.children;if(0===s.length)return!1;e={children:s,...this.#Ba(),process:null}}else{const s=this.findProcessUrl(t);if(!s)return!1;t=s.url,e={...this.#Ba(),url:t,process:s}}const s=function(e,s,i){e(t,(s=i||s).process,s.url,s.children,s.inputWidth,s.inputHeight,s.align,s.isUpdate)}.bind(this,this.#sc.bind(this),e),i=await this.$.eventManager.triggerEvent("onEmbedInputBefore",{...e,handler:s});return void 0===i||!1!==i&&(null!==i&&"object"==typeof i&&s(i),!0!==i&&i!==Ar||s(null),!0)}#Ha(t,e=!1){if(!t)return;const s=this.figure.open(t,{nonResizing:this.#fa,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:e});if(this.#Ul=t,this.#wa=s.cover,this.#_a=s.container,this._caption=s.caption,this.#ya=s.align,!this.#wa?.getAttribute?.("data-se-origin")){const e=t?.getAttribute?.("src")||t?.querySelector?.("a")?.href;e&&Br.#Wa(e)&&this.#wa.setAttribute("data-se-origin",e)}t.style.float="",this.#ea=String(s.originWidth||s.w||""),this.#sa=String(s.originHeight||s.h||"");if((this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="'+this.#ya+'"]')||this.modal.form.querySelector('input[name="suneditor_embed_radio"][value="none"]')).checked=!0,!this.#ar)return;const i=this.#ec&&this.figure.isVertical,{dw:n,dh:o}=this.figure.getSize(t);this.inputX.value="auto"===n?"":n,this.inputY.value="auto"===o?"":o,this.proportion.checked=!0,this.inputX.disabled=!!i,this.inputY.disabled=!!i,this.proportion.disabled=!!i,this.#ia=this.proportion.checked?s.ratio:{w:0,h:0}}#ic(){const t=Ht.utils.createElement("IFRAME");return this.#Za(t),t}#nc(){return Ht.utils.createElement("BLOCKQUOTE")}#sc(t,e,s,i,n,o,l,r){let a=null,c=null,h=null,d=null;if(r){if(a=this.#Ul,a.src!==s){const t=this.findProcessUrl(s);if(/^iframe$/i.test(t?.tag)&&!/^iframe$/i.test(a.nodeName)){const t=this.#ic();t.src=s,a.replaceWith(t),a=t}else if(/^blockquote$/i.test(t?.tag)&&!/^blockquote$/i.test(a.nodeName)){const t=this.#nc();t.setAttribute("src",s),a.replaceWith(t),a=t}else a.src=s}h=this.#_a,c=Ht.query.getParentElement(a,"FIGURE")}else if(e){a=this.#ic(),a.src=s;const t=Es.CreateContainer(a,"se-embed-container");c=t.cover,h=t.container}else{a=i[0];const t=Es.CreateContainer(a,"se-embed-container");c=t.cover,h=t.container;const e=Array.from(i);for(const t of e)/^script$/i.test(t.nodeName)?d=Ht.utils.createElement("script",{src:t.getAttribute("src"),async:"true"},null):c.appendChild(t)}this.#Ul=a,this.#wa=c,this.#_a=h,this.figure.open(a,{nonResizing:this.#fa,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0}),n||=this.#za,o||=this.#Fa;const u=this.figure.getSize(a),p=u.w!==n||u.h!==o,g=!r||p;if(g&&this.#oc(n,o),this.figure.setAlign(a,l),c.setAttribute("data-se-origin",t),r)this.#ar&&g&&this.figure.isVertical||this.figure.setTransform(a,n,o,0),d||this.$.history.push(!1);else{if(this.$.component.insert(h,{skipHistory:!0,scrollTo:!1,insertBehavior:this.pluginOptions.insertBehavior}),d)try{this.$.history.pause(),d.onload=()=>{Ht.utils.removeItem(d),d=null},c.appendChild(d);const t=new MutationObserver((e=>{for(const s of e)if("childList"===s.type&&!a.parentElement){this.$.history.resume(),this.$.history.push(!1),t.disconnect();break}}));t.observe(this.$.frameContext.get("wysiwyg"),{subtree:!0,childList:!0})}catch(t){this.$.history.resume(),console.warn("[SUNEDITOR] Embed tag script load error.",t)}if(!this.$.options.get("componentInsertBehavior")){const t=this.$.format.addLine(h,null);t&&this.$.selection.setRange(t,0,t,0)}}}#Na(t){if(!t)return;this.#Za(t);const e=t;t=t.cloneNode(!0);const s=Es.CreateContainer(t,"se-embed-container").container;this.figure.open(t,{nonResizing:this.#fa,nonSizeInfo:!1,nonBorder:!1,figureTarget:!1,infoOnly:!0});const i=(t.getAttribute("data-se-size")||",").split(","),n=i[0]||e.width||"",o=i[1]||e.height||"";this.#oc(n,o);const l=this.$.format.getLine(e);return l&&(this.#ya=l.style.textAlign||l.style.float),this.figure.setAlign(t,this.#ya),this.figure.retainFigureFormat(s,this.#Ul,null,null),t}#oc(t,e){t||=this.inputX?.value||this.pluginOptions.defaultWidth,e||=this.inputY?.value||this.pluginOptions.defaultHeight,this.#ec&&(t?/%$/.test(t+"")||(t+="%"):t="100%"),this.figure.setSize(t,e)}#Ba(){return{inputWidth:this.inputX?.value||"",inputHeight:this.inputY?.value||"",align:this.#ya,isUpdate:this.modal.isUpdate,element:this.#Ul}}#Za(t){t.frameBorder="0",t.allowFullscreen=!0;const e=this.pluginOptions.iframeTagAttributes;if(e)for(const s in e)t.setAttribute(s,e[s])}#ka(t){const e=Ht.query.getEventTarget(t).value.trim();/^<iframe.*\/iframe>$/.test(e)?(this.#ba=e,this.previewSrc.textContent='<IFrame :src=".."></IFrame>'):this.#ba=this.previewSrc.textContent=e?this.$.options.get("defaultUrlProtocol")&&!e.includes("://")&&0!==e.indexOf("#")?this.$.options.get("defaultUrlProtocol")+e:e.includes("://")?e:"/"+e:""}#ca(){this.#ec?this.inputX.value=Number(this.#ea)>100?"100":this.#ea:(this.inputX.value=this.#ea,this.inputY.value=this.#sa)}#aa(t,e){if(Nt.isSpace(e.code))return void e.preventDefault();const s=Ht.query.getEventTarget(e);if("x"===t&&this.#ec&&Number(s.value)>100)s.value="100";else if(this.proportion.checked){const e=Es.CalcRatio(this.inputX.value,this.inputY.value,this.sizeUnit,this.#ia);"x"===t?this.inputY.value=String(e.h):this.inputX.value=String(e.w)}}}const Ir=Br,{_w:Vr,_d:Or}=Et;class Rr extends Fo{static key="math";static className="";static component(t){return Ht.utils.hasClass(t,"se-math|katex")&&Ht.check.isComponentContainer(t)?t:null}#Ul=null;constructor(t,e){super(t),this.title=this.$.lang.math,this.icon="math",this.katex=null,this.mathjax=null,(this.katex=this.#lc())||(this.mathjax=this.#rc())||console.warn('[SUNEDITOR.plugins.math.warn] The math plugin must need either "KaTeX" or "MathJax" library. Please add the katex or mathjax option. See: https://github.com/ARA-developer/suneditor/blob/develop/guide/external-libraries.md'),this.pluginOptions={formSize:{width:"460px",height:"14em",maxWidth:"",maxHeight:"",minWidth:"400px",minHeight:"40px",...e.formSize},canResize:e.canResize??!0,autoHeight:!!e.autoHeight,fontSizeList:e.fontSizeList||[{text:"1",value:"1em"},{text:"1.5",value:"1.5em"},{text:"2",value:"2em"},{text:"2.5",value:"2.5em"}],onPaste:"function"==typeof e.onPaste?e.onPaste:null},this.pluginOptions.autoHeight&&(this.pluginOptions.formSize.height=this.pluginOptions.formSize.minHeight),this.defaultFontSize=null;const s=function(t){const{$:e,pluginOptions:s,katex:i}=t,{lang:n,icons:o}=e,{formSize:l,fontSizeList:r,canResize:a,autoHeight:c}=s,{width:h,height:d,maxWidth:u,maxHeight:p,minWidth:g,minHeight:m}=l,f=a?c?"horizontal":"auto":"none";let v=r[0].value,b=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${n.close}" aria-label="${n.close}">\n ${o.cancel}\n </button>\n <span class="se-modal-title">${n.math_modal_title}</span>\n </div>\n <div class="se-modal-body">\n <div class="se-modal-form">\n <label>${n.math_modal_inputLabel} ${i?`(<a href="${Et.KATEX_WEBSITE}" target="_blank">KaTeX</a>)`:`(<a href="${Et.MATHJAX_WEBSITE}" target="_blank">MathJax</a>)`}</label>\n <textarea class="se-input-form se-math-exp se-modal-resize-form" type="text" data-focus style="width: ${h}; height: ${d}; min-width: ${g}; min-height: ${m}; resize: ${f};"></textarea>\n </div>\n <div class="se-modal-form">\n <label>${n.math_modal_fontSizeLabel}</label>\n <select class="se-input-select se-math-size">`;for(let t,e=0,s=r.length;e<s;e++)t=r[e],t.default&&(v=t.value),b+=`<option value="${t.value}"${t.default?" selected":""}>${t.text}</option>`;return b+=`</select>\n </div>\n <div class="se-modal-form">\n <label>${n.math_modal_previewLabel}</label>\n <p class="se-math-preview"></p>\n </div>\n </div>\n <div class="se-modal-footer">\n <button type="submit" class="se-btn-primary" title="${n.submitButton}" aria-label="${n.submitButton}">\n <span>${n.submitButton}</span>\n </button>\n </div>\n </form>`,t.defaultFontSize=v,Ht.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${u}; max-height: ${p};`},b)}(this),i=function({lang:t,icons:e}){const s=`\n <div class="se-arrow se-arrow-up"></div>\n <div class="link-content">\n <div class="se-btn-group">\n <button type="button" data-command="update" tabindex="-1" class="se-btn se-tooltip">\n ${e.edit}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.edit}</span>\n </span>\n </button>\n <button type="button" data-command="copy" tabindex="-1" class="se-btn se-tooltip">\n ${e.copy}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.copy}</span>\n </span>\n </button>\n <button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n ${e.delete}\n <span class="se-tooltip-inner">\n <span class="se-tooltip-text">${t.remove}</span>\n </span>\n </button>\n </div>\n </div>`;return Ht.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.modal=new ko(this,this.$,s),this.controller=new ps(this,this.$,i,{position:"bottom",disabled:!0}),this.textArea=s.querySelector(".se-math-exp"),this.previewElement=s.querySelector(".se-math-preview"),this.fontSizeElement=s.querySelector(".se-math-size"),this.isUpdateState=!1,this.previewElement.style.fontSize=this.defaultFontSize,this.$.eventManager.addEvent(this.textArea,"input",this.#ac.bind(this)),this.$.eventManager.addEvent(this.fontSizeElement,"change",function(t){this.fontSize=t.target.value}.bind(this.previewElement.style)),this.pluginOptions.onPaste&&this.$.eventManager.addEvent(this.textArea,"paste",this.pluginOptions.onPaste.bind(this))}open(){this.modal.open()}retainFormat(){return{query:".se-math, .katex, .MathJax",method:t=>{if(!this.katex&&!this.mathjax)return;const e=zr(t);if(!e)return;const s=Or.createRange().createContextualFragment(this.#cc(Mt.entityToHTML(this.#hc(e,!0))));t.innerHTML=s.querySelector(".se-math, .katex").innerHTML,t.setAttribute("contenteditable","false"),Ht.utils.addClass(t,"se-component|se-inline-component|se-disable-pointer|se-math"),this.katex?Ht.utils.addClass(t,"katex"):Ht.utils.removeClass(t,"katex"),this.mathjax&&this.#dc(this.mathjax)}}}modalOn(t){if(this.isUpdateState=t,t){if(this.controller.currentTarget){const t=this.controller.currentTarget,e=Mt.entityToHTML(this.#hc(zr(t),!0)),s=function(t){const e=t.getAttribute("data-se-type");if(e)return e;const s=t.getAttribute("data-font-size");return s?(t.removeAttribute("data-font-size"),t.setAttribute("data-se-type",s),s):null}(t)||"1em";this.textArea.value=e,this.fontSizeElement.value=s,this.previewElement.innerHTML=this.#cc(e),this.previewElement.style.fontSize=s}}else this.modalInit()}async modalAction(){if(0===this.textArea.value.trim().length||Ht.utils.hasClass(this.textArea,"se-error"))return this.textArea.focus(),!1;const t=this.textArea.value,e=this.previewElement.querySelector(".se-math, .katex");if(!e)return!1;if(Ht.utils.addClass(e,"se-component|se-inline-component|se-disable-pointer|se-math"),e.setAttribute("contenteditable","false"),e.setAttribute("data-se-value",Mt.htmlToEntity(this.#hc(t,!1))),e.setAttribute("data-se-type",this.fontSizeElement.value),e.style.fontSize=this.fontSizeElement.value,this.katex?(Ht.utils.addClass(e,"katex"),Ht.utils.removeClass(e,"MathJax")):Ht.utils.removeClass(e,"katex"),this.isUpdateState){Ht.query.getParentElement(this.controller.currentTarget,".se-component").replaceWith(e);const t=this.$.component.get(e);return this.$.component.select(t.target,t.pluginName),!0}{const t=this.$.format.getLines();if(t.length>1){const s=Ht.utils.createElement(t[0].nodeName,null,e);this.$.component.insert(s,{insertBehavior:"none",scrollTo:!1})}else this.$.component.insert(e,{insertBehavior:"none",scrollTo:!1})}this.mathjax&&this.#dc(this.mathjax);const s=this.$.selection.getNearRange(e);return s?this.$.selection.setRange(s.container,s.offset,s.container,s.offset):this.$.component.select(e,Rr.key),!0}modalInit(){this.textArea.value="",this.previewElement.innerHTML="",Ht.utils.removeClass(this.textArea,"se-error")}controllerAction(t){switch(t.getAttribute("data-command")){case"update":this.modal.open();break;case"copy":this.#uc(this.#Ul);break;case"delete":this.componentDestroy(this.controller.currentTarget)}}controllerClose(){this.#Ul=null}componentSelect(t){if(Ht.utils.hasClass(t,"se-math|katex")&&zr(t))return this.#Ul=t,void this.controller.open(t,null,{isWWTarget:!1,initMethod:null,addOffset:null})}async componentDestroy(t){Ht.utils.removeItem(t),this.controller.close(),this.$.focusManager.focus(),this.$.history.push(!1)}#cc(t){let e="";try{if(Ht.utils.removeClass(this.textArea,"se-error"),this.katex)e=this.katex.src.renderToString(t,{throwOnError:!0,displayMode:!0});else{if(!this.mathjax){const t=new Error('404 Not found. "KaTeX" or "MathJax" library');throw t.code="MATH_LIB_NOT_FOUND",t}e=this.mathjax.convert(t).outerHTML,/<mjx-merror/.test(e)?(Ht.utils.addClass(this.textArea,"se-error"),e=`<span class="se-math-error">${e}</span>`):e=`<span class="se-math">${e}</span>`}}catch(t){Ht.utils.addClass(this.textArea,"se-error"),e="MATH_LIB_NOT_FOUND"===t.code?`<span class="se-math-error">${t.message}</span>`:`<span class="se-math-error">Math syntax error. (Refer ${this.katex?`<a href="${Et.KATEX_WEBSITE}" target="_blank">KaTeX</a>`:`<a href="${Et.MATHJAX_WEBSITE}" target="_blank">MathJax</a>`})</span>`,console.warn("[SUNEDITOR.math.error] ",t.message)}return e}#hc(t,e){return t.replace(/\\{2}/g,e?"\\":"\\\\")}async#uc(t){if(navigator.clipboard&&t)try{const e=zr(t);await this.$.html.copy(e),Ht.utils.addClass(t,"se-copy"),Vr.setTimeout((()=>{Ht.utils.removeClass(t,"se-copy")}),120)}catch(t){console.error("[SUNEDITOR.math.copy.fail]",t)}}#ac(t){const e=Ht.query.getEventTarget(t);this.pluginOptions.autoHeight&&(e.style.height="5px",e.style.height=e.scrollHeight+5+"px"),this.previewElement.innerHTML=this.#cc(e.value),this.mathjax&&this.#dc(this.mathjax)}#dc(t){t.clear(),t.updateDocument()}#lc(){const t=this.$.options.get("externalLibs").katex;if(!t)return null;if(!t.src)return console.warn("[SUNEDITOR.math.katex.fail] The katex option is set incorrectly."),null;const e=[{throwOnError:!1},t.options||{}].reduce(((t,e)=>{for(const s in e)t[s]=e[s];return t}),{});return t.options=e,t}#rc(){const t=this.$.options.get("externalLibs").mathjax;if(!t)return null;this.$.frameOptions.get("iframe")&&console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is not supported in the iframe.");try{const e=t.browserAdaptor();t.RegisterHTMLHandler(e);const s=new t.TeX,i=new t.CHTML;return t.src.document(document,{InputJax:s,OutputJax:i})}catch(t){return console.warn("[SUNEDITOR.math.mathjax.fail] The MathJax option is set incorrectly.",t),null}}}function zr(t){const e=t.getAttribute("data-se-value");if(e)return e;const s=t.getAttribute("data-exp");return s?(t.removeAttribute("data-exp"),t.setAttribute("data-se-value",s),s):null}const Fr=Rr,{_w:Pr}=Et;const Dr=class extends Fo{static key="drawing";static className="";#tt;#pc;constructor(t,e){super(t),this.title=this.$.lang.drawing,this.icon="drawing",this.pluginOptions={outputFormat:e.outputFormat||"dataurl",useFormatType:e.useFormatType??!1,defaultFormatType:["block","inline"].includes(e.defaultFormatType)?e.defaultFormatType:"block",keepFormatType:e.keepFormatType??!1,lineWidth:e.lineWidth||5,lineReconnect:!!e.lineReconnect,lineCap:["butt","round","square"].includes(e.lineCap)?e.lineCap:"round",lineColor:e.lineColor||"",formSize:{width:"750px",height:"50vh",maxWidth:"",maxHeight:"",minWidth:"150px",minHeight:"100px",...e.formSize},canResize:e.canResize??!0,maintainRatio:e.maintainRatio??!0},this.$.plugins.image?"svg"!==this.pluginOptions.outputFormat||this.$.plugins.image.pluginOptions.uploadUrl||console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need the "image" plugin with the "uploadUrl" option. Please add the "image" plugin with the "uploadUrl" option.'):console.warn('[SUNEDITOR.plugins.drawing.warn] The drawing plugin must need either "image" plugin. Please add the "image" plugin.');const s=function({lang:t,icons:e},s){const{width:i,height:n,maxWidth:o,maxHeight:l,minWidth:r,minHeight:a}=s.formSize,c=`\n <form>\n <div class="se-modal-header">\n <button type="button" data-command="close" class="se-btn se-close-btn" title="${t.close}" aria-label="${t.close}">\n ${e.cancel}\n </button>\n <span class="se-modal-title">${t.drawing_modal_title}</span>\n </div>\n <div class="se-modal-body" style="width: ${i}; height: ${n}; min-width: ${r}; min-height: ${a};">\n <canvas class="se-drawing-canvas" style="width: 100%; height: 100%;"></canvas>\n\t\t\t${s.canResize?'<div class="se-modal-resize-handle-w"></div><div class="se-modal-resize-handle-h"></div><div class="se-modal-resize-handle-c"></div>':""}\n\t\t</div>\n\t\t<div class="se-modal-body-bottom">\n\t\t\t<div class="se-modal-form">\n\t\t\t\t<div class="se-modal-flex-form">\n\t\t\t\t\t${s.useFormatType?`\n\t\t\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asBlock" aria-label="${t.blockStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_block}\n\t\t\t\t\t\t\t\t\t${Ht.utils.createTooltipInner(t.blockStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="asInline" aria-label="${t.inlineStyle}">\n\t\t\t\t\t\t\t\t\t${e.as_inline}\n\t\t\t\t\t\t\t\t\t${Ht.utils.createTooltipInner(t.inlineStyle)}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</div>`:""}\n\t\t\t\t\t<div class="se-modal-flex-group">\n\t\t\t\t\t\t<button type="button" class="se-btn se-tooltip" data-command="remove" aria-label="${t.remove}">\n\t\t\t\t\t\t\t${e.eraser}\n\t\t\t\t\t\t\t${Ht.utils.createTooltipInner(t.remove)}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n <div class="se-modal-footer">\n\t\t\t<button type="submit" class="se-btn-primary" title="${t.submitButton}" aria-label="${t.submitButton}">\n\t\t\t\t<span>${t.submitButton}</span>\n\t\t\t</button>\n </div>\n </form>`;return Ht.utils.createElement("DIV",{class:"se-modal-content se-modal-responsive",style:`max-width: ${o}; max-height: ${l};`},c)}(this.$,this.pluginOptions);this.modal=new ko(this,this.$,s),this.as=this.pluginOptions.defaultFormatType,this.pluginOptions.useFormatType&&(this.asBlock=s.querySelector('[data-command="asBlock"]'),this.asInline=s.querySelector('[data-command="asInline"]'),this.$.eventManager.addEvent([this.asBlock,this.asInline],"click",this.#Ma.bind(this))),this.canvas=null,this.ctx=null,this.isDrawing=!1,this.points=[],this.paths=[],this.resizeObserver=null,this.#tt={touchstart:this.#gc.bind(this),touchmove:this.#mc.bind(this),mousedown:this.#fc.bind(this),mousemove:this.#vc.bind(this),mouseup:this.#bc.bind(this),mouseleave:this.#yc.bind(this),mouseenter:this.#Cc.bind(this)},this.#pc={touchstart:null,touchmove:null,mousedown:null,mousemove:null,mouseup:null,mouseleave:null,mouseenter:null},this.$.eventManager.addEvent(s.querySelector('[data-command="remove"]'),"click",this.#wc.bind(this))}open(){this.pluginOptions.useFormatType&&this.#Aa("inline"===(this.pluginOptions.keepFormatType?this.as:this.pluginOptions.defaultFormatType)),this.modal.open(),this.#_c()}modalOff(){this.#xc()}async modalAction(){if("svg"===this.pluginOptions.outputFormat){const t=this.#$c();this.$.plugins.image.modalInit(),this.$.plugins.image.submitFile(t)}else{const t=this.canvas.toDataURL(),e={name:"drawing",size:0};this.$.plugins.image.modalInit(),"inline"!==this.as?this.$.plugins.image.create(t,null,"auto","","none",e,""):this.$.plugins.image.createInline(t,null,"auto","","none",e,"")}return!0}#_c(){const t=this.canvas=this.modal.form.querySelector(".se-drawing-canvas");this.ctx=t.getContext("2d"),t.width=t.offsetWidth,t.height=t.offsetHeight,this.points=[],this.paths=[],this.#Sc(),this.#pc.touchstart=this.$.eventManager.addEvent(t,"touchstart",this.#tt.touchstart,{passive:!1,capture:!0}),this.#pc.touchmove=this.$.eventManager.addEvent(t,"touchmove",this.#tt.touchmove,!0),this.#pc.mousedown=this.$.eventManager.addEvent(t,"mousedown",this.#tt.mousedown,{passive:!1,capture:!0}),this.#pc.mousemove=this.$.eventManager.addEvent(t,"mousemove",this.#tt.mousemove,!0),this.#pc.mouseup=this.$.eventManager.addEvent(t,"mouseup",this.#tt.mouseup,!0),this.#pc.mouseleave=this.$.eventManager.addEvent(t,"mouseleave",this.#tt.mouseleave),this.#pc.mouseenter=this.$.eventManager.addEvent(t,"mouseenter",this.#tt.mouseenter),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),Et.isResizeObserverSupported&&(this.resizeObserver=new ResizeObserver((()=>{const e=t.width,s=t.height,i=t.offsetWidth,n=t.offsetHeight;t.width=i,t.height=n,e===t.width&&s===t.height||(this.pluginOptions.maintainRatio&&this.#kc(e,s,i,n),this.#Ec())})),this.resizeObserver.observe(t))}#xc(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.canvas&&(this.$.eventManager.removeEvent(this.#pc.mousedown),this.$.eventManager.removeEvent(this.#pc.mousemove),this.$.eventManager.removeEvent(this.#pc.mouseup),this.$.eventManager.removeEvent(this.#pc.mouseleave),this.$.eventManager.removeEvent(this.#pc.mouseenter)),this.canvas=null,this.ctx=null,this.points=[],this.paths=[],this.isDrawing=!1}#Sc(){this.ctx.lineWidth=this.pluginOptions.lineWidth,this.ctx.lineCap=this.pluginOptions.lineCap,this.ctx.strokeStyle=this.pluginOptions.lineColor||Pr.getComputedStyle(this.$.contextProvider.carrierWrapper).color}#Tc(){this.#Sc(),this.ctx.beginPath(),this.points.forEach((([t,e],s)=>{0===s?this.ctx.moveTo(t,e):this.ctx.lineTo(t,e)})),this.ctx.stroke()}#Ec(){this.#Sc(),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.paths.forEach((t=>{this.points=t,this.#Tc()})),this.points=[]}#kc(t,e,s,i){const n=s/t,o=i/e;this.paths=this.paths.map((t=>t.map((([t,e])=>[t*n,e*o]))))}#Mc(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.points=[],this.paths=[]}#Hc(){const t="http://www.w3.org/2000/svg",e=document.createElementNS(t,"svg");return e.setAttribute("width",this.canvas.width+""),e.setAttribute("height",this.canvas.height+""),e.setAttribute("viewBox",`0 0 ${this.canvas.width} ${this.canvas.height}`),e.setAttribute("xmlns",t),this.paths.forEach((s=>{const i=s.reduce(((t,[e,s],i)=>t+(0===i?`M ${e} ${s}`:` L ${e} ${s}`)),""),n=document.createElementNS(t,"path");n.setAttribute("d",i),n.setAttribute("fill","none"),n.setAttribute("stroke",String(this.ctx.strokeStyle)),n.setAttribute("stroke-width",this.ctx.lineWidth+""),e.appendChild(n)})),e}#$c(){const t=this.#Hc(),e=(new XMLSerializer).serializeToString(t),s=new Blob([e],{type:"image/svg+xml"}),i=new File([s],"drawing.svg",{type:"image/svg+xml"}),n=new DataTransfer;return n.items.add(i),n.files}#Lc(t){const{touches:e}=t,s=this.canvas.getBoundingClientRect();return{x:e[0].clientX-s.left,y:e[0].clientY-s.top}}#Aa(t){t?(Ht.utils.addClass(this.asInline,"on"),Ht.utils.removeClass(this.asBlock,"on"),this.as="inline"):(Ht.utils.addClass(this.asBlock,"on"),Ht.utils.removeClass(this.asInline,"on"),this.as="block")}#fc(t){t.preventDefault(),this.isDrawing=!0,this.points.push([t.offsetX,t.offsetY]),this.#Tc()}#vc(t){t.preventDefault(),this.isDrawing&&(this.points.push([t.offsetX,t.offsetY]),this.#Tc())}#gc(t){t.preventDefault();const{x:e,y:s}=this.#Lc(t);this.isDrawing=!0,this.points.push([e,s]),this.#Tc()}#mc(t){t.preventDefault();const{x:e,y:s}=this.#Lc(t);this.isDrawing&&(this.points.push([e,s]),this.#Tc())}#bc(){this.isDrawing=!1,this.points.length>0&&(this.paths.push([...this.points]),this.points=[])}#yc(){this.isDrawing&&(this.paths.push([...this.points]),this.pluginOptions.lineReconnect||(this.points=[],this.isDrawing=!1))}#Cc(t){if(1===t.buttons){if(this.isDrawing=!0,this.pluginOptions.lineReconnect){const e=this.paths.at(-1).at(-1);this.points.push([e[0],e[1]]),this.points.push([t.offsetX,t.offsetY])}else this.points.push([t.offsetX,t.offsetY]);this.#Tc()}}#wc(){this.#Mc()}#Ma(t){this.#Aa("asInline"===Ht.query.getEventTarget(t).getAttribute("data-command"))}};const qr=class extends Bo{static key="imageGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.imageGallery,this.icon="image_gallery",this.onSelectfunction=null,this.browser=new In(this,this.$,{title:this.$.lang.imageGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Nc.bind(this),columnSize:4,className:"se-image-gallery"}),this.width="auto"===this.$.plugins.image.pluginOptions.defaultWidth?"":this.$.plugins.image.pluginOptions.defaultWidth,this.height="auto"===this.$.plugins.image.pluginOptions.defaultHeight?"":this.$.plugins.image.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Nc(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.$.plugins.image.modalInit(),this.$.plugins.image.create(t.getAttribute("data-command"),null,this.width,this.height,"none",e,t.alt,!0)}}};const Wr=class extends Bo{static key="videoGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.videoGallery,this.icon="video_gallery",this.onSelectfunction=null;const s="string"==typeof e.thumbnail?e.thumbnail:this.$.icons.video_thumbnail;this.browser=new In(this,this.$,{title:this.$.lang.videoGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Nc.bind(this),columnSize:4,className:"se-video-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>s,props:["frame"]}),this.width="auto"===this.$.plugins.video.pluginOptions.defaultWidth?"":this.$.plugins.video.pluginOptions.defaultWidth,this.height="auto"===this.$.plugins.video.pluginOptions.defaultHeight?"":this.$.plugins.video.pluginOptions.defaultHeight}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Nc(t){if(this.onSelectfunction)this.onSelectfunction(t);else{let e=t.getAttribute("data-command");const s=this.$.plugins.video.findProcessUrl(e);s&&(e=s.url);const i={name:t.getAttribute("data-name"),size:0};this.$.plugins.video.modalInit(),this.$.plugins.video.create(this.$.plugins.video["iframe"===t.getAttribute("data-frame")?"createIframeTag":"createVideoTag"]({poster:t.getAttribute("data-thumbnail")}),e,null,this.width,this.height,!1,i,!0)}}};const Ur=class extends Bo{static key="audioGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.audioGallery,this.icon="audio_gallery",this.onSelectfunction=null;const s="string"==typeof e.thumbnail?e.thumbnail:this.$.icons.audio_thumbnail;this.browser=new In(this,this.$,{title:this.$.lang.audioGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Nc.bind(this),columnSize:4,className:"se-audio-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>s})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Nc(t){this.onSelectfunction?this.onSelectfunction(t):(this.$.plugins.audio.modalInit(),this.$.plugins.audio.submitURL(t.getAttribute("data-command")))}};const Gr=class extends Bo{static key="fileGallery";static className="";constructor(t,e){super(t),this.title=this.$.lang.fileGallery,this.icon="file_gallery",this.onSelectfunction=null;const s="string"==typeof e.thumbnail?e.thumbnail:this.$.icons.file_thumbnail;this.browser=new In(this,this.$,{title:this.$.lang.fileGallery,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Nc.bind(this),columnSize:4,className:"se-file-gallery",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:()=>s})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Nc(t){if(this.onSelectfunction)this.onSelectfunction(t);else{const e={name:t.getAttribute("data-name"),size:0};this.$.plugins.fileUpload.create(t.getAttribute("data-command"),e,!0)}}};const Zr=class extends Bo{static key="fileBrowser";static className="";constructor(t,e){super(t),this.title=this.$.lang.fileBrowser,this.icon="file_browser",this.onSelectfunction=null;const s={video:this.$.icons.video_thumbnail,audio:this.$.icons.audio_thumbnail,file:this.$.icons.file_thumbnail},i=this.$.icons.file_thumbnail;this.browser=new In(this,this.$,{title:this.$.lang.fileBrowser,data:e.data,url:e.url,headers:e.headers,selectorHandler:this.#Nc.bind(this),columnSize:4,className:"se-file-browser",thumbnail:"function"==typeof e.thumbnail?e.thumbnail:t=>s[t.type]||i,props:[...new Set((e.props??[]).concat(["frame"]))]})}open(t){this.onSelectfunction=t,this.browser.open()}close(){this.onSelectfunction=null,this.browser.close()}#Nc(t){if(this.onSelectfunction)this.onSelectfunction(t);else{switch(t.getAttribute("data-type")){case"image":this.$.plugins.imageGallery.browser.selectorHandler(t);break;case"video":this.$.plugins.videoGallery.browser.selectorHandler(t);break;case"audio":this.$.plugins.audioGallery.browser.selectorHandler(t);break;case"file":this.$.plugins.fileGallery.browser.selectorHandler(t)}}}},jr={text:{default:"13px",list:[{title:"XX-Small",size:"8px"},{title:"X-Small",size:"10px"},{title:"Small",size:"13px"},{title:"Medium",size:"16px"},{title:"Large",size:"18px"},{title:"X-Large",size:"24px"},{title:"XX-Large",size:"32px"}]},px:{default:13,inc:1,min:8,max:72,list:[8,10,13,15,18,20,22,26,28,36,48,72]},pt:{default:10,inc:1,min:6,max:72,list:[6,8,10,12,14,18,22,26,32]},em:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},rem:{default:1,inc:.1,min:.5,max:5,list:[.5,.75,1,1.25,1.5,1.75,2,2.5,3]},vw:{inc:.1,min:.5,max:10,list:[2,3.5,4,4.5,6,8]},vh:{default:1.5,inc:.1,min:.5,max:10,list:[1,1.5,2,2.5,3,3.5,4]},"%":{default:100,inc:1,min:50,max:200,list:[50,70,90,100,120,140,160,180,200]}};class Kr extends zo{static key="fontSize";static className="se-btn-select se-btn-input se-btn-tool-font-size";#Ac;constructor(t,e){super(t),this.unitMap={...jr,...e.unitMap||{}},this.sizeUnit=/text/.test(e.sizeUnit)?"":e.sizeUnit||this.$.options.get("fontSizeUnits")[0];const s=this.unitMap[this.sizeUnit||"text"],i=function({lang:t},e,s,i){const n=e.list,o=e.default,l=i?t.default:"";let r='\n\t<div class="se-list-inner">\n\t\t<ul class="se-list-basic">';for(let t,e,i,a,c,h=0,d=n.length;h<d;h++)t=n[h],"object"==typeof t?(e=t.title,i=t.size):e=i=t+s,a=o===i?" default_value":"",c=a&&l||e,r+=`\n\t\t\t<li>\n\t\t\t\t<button type="button" class="se-btn se-btn-list${a}" data-command="${i}" data-value="${e}" title="${c}" aria-label="${c}" style="font-size:${i};">${c}</button>\n\t\t\t</li>`;return r+="\n\t\t</ul>\n\t</div>",Ht.utils.createElement("DIV",{class:"se-dropdown se-list-layer se-list-font-size"},r)}(this.$,s,this.sizeUnit,e.showDefaultSizeLabel),n=!!this.sizeUnit&&(e.showIncDecControls??!1),o=!this.sizeUnit||(e.disableInput??!1);this.title=this.$.lang.fontSize,this.inner=!(o&&!n)&&(o?`<span class="se-txt se-not-arrow-text __se__font_size">${this.$.lang.fontSize}</span>`:`<input type="text" class="__se__font_size se-not-arrow-text" placeholder="${this.$.lang.fontSize}" />`),n?(this.beforeItem=Ht.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":Kr.key,"data-type":"command","data-value":"dec"},`${this.$.icons.minus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.decrease}</span></span>`),this.afterItem=Ht.utils.createElement("button",{class:"se-btn se-tooltip se-sub-btn","data-command":Kr.key,"data-type":"command","data-value":"inc"},`${this.$.icons.plus}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.increase}</span></span>`)):o?o&&!n&&(this.replaceButton=Ht.utils.createElement("button",{class:"se-btn se-tooltip se-btn-select se-btn-tool-font-size","data-command":Kr.key,"data-type":"dropdown"},`<span class="se-txt __se__font_size">${this.$.lang.fontSize}</span>${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.fontSize}</span></span>`),this.$.menu.initDropdownTarget({key:Kr.key,type:"dropdown"},i)):(this.afterItem=Ht.utils.createElement("button",{class:"se-btn se-tooltip se-sub-arrow-btn","data-command":Kr.key,"data-type":"dropdown"},`${this.$.icons.arrow_down}<span class="se-tooltip-inner"><span class="se-tooltip-text">${this.$.lang.fontSize}</span></span>`),this.$.menu.initDropdownTarget({key:Kr.key,type:"dropdown"},i)),this.currentSize="",this.sizeList=i.querySelectorAll("li button"),this.hasInputFocus=!1,this.isInputActive=!1,this.#Ac=o,this.$.menu.initDropdownTarget(Kr,i)}active(t,e){if(!Ht.utils.hasClass(e,"__se__font_size"))return!1;let s="";if(t){if(this.$.format.isLine(t))return;if(s=Ht.utils.getStyle(t,"fontSize"))return this.#Bc(e,s),!0}else this.#Bc(e,this.#Ic());return!1}toolbarInputKeyDown({target:t,event:e}){const s=e.code;if(this.#Ac||Nt.isSpace(s))return void e.preventDefault();if(!/^(ArrowUp|ArrowDown|Enter)$/.test(s))return;const{value:i,unit:n}=this.#Vc(t);if(!i)return;const o=Lt.get(i),l=this.unitMap[n];let r=o;switch(s){case"ArrowUp":r+=l.inc,r>l.max&&(r=o);break;case"ArrowDown":r-=l.inc,r<l.min&&(r=o)}e.preventDefault();try{this.isInputActive=!0;const e=this.#Bc(t,r+n);if(this.#Ac)return;const i=Ht.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.$.inline.apply(i,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null}),Nt.isEnter(s)||t.focus()}finally{this.isInputActive=!1}}toolbarInputChange({target:t,value:e,event:s}){if(!this.#Ac)try{this.isInputActive=!0;let{value:s,unit:i}=this.#Vc(e);const{max:n,min:o}=this.unitMap[i];s=s>n?n:s<o?o:s;const l=Ht.utils.createElement("SPAN",{style:"font-size: "+this.#Bc(t,s+i)+";"});this.$.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}finally{this.isInputActive=!1,s.preventDefault(),this.$.focusManager.focus()}}on(t){const{value:e,unit:s}=this.#Vc(t),i=e+s;if(i===this.currentSize)return;const n=this.sizeList;for(let t=0,e=n.length;t<e;t++)i===n[t].getAttribute("data-value")?Ht.utils.addClass(n[t],"active"):Ht.utils.removeClass(n[t],"active");this.currentSize=i}action(t){const e=t.getAttribute("data-command");if(e===Kr.key){const{value:e,unit:s}=this.#Vc(t);let i=Lt.get(e)+("inc"===t.getAttribute("data-value")?1:-1);const{min:n,max:o}=this.unitMap[s];i=i<n?n:i>o?o:i;const l=Ht.utils.createElement("SPAN",{style:"font-size: "+i+s+";"});this.$.inline.apply(l,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else if(e){const t=Ht.utils.createElement("SPAN",{style:"font-size: "+e+";"});this.$.inline.apply(t,{stylesToModify:["font-size"],nodesToRemove:null,strictRemove:null})}else this.$.inline.apply(null,{stylesToModify:["font-size"],nodesToRemove:["span"],strictRemove:!0});this.$.menu.dropdownOff()}#Ic(){return this.$.frameContext.get("wwComputedStyle").fontSize}#Vc(t){if(!(t="string"==typeof t?t:t.parentElement.querySelector(".__se__font_size")))return{unit:this.sizeUnit,value:this.sizeUnit?0:""};const e="string"==typeof t?t:Ht.check.isInputElement(t)?t.value:t.textContent,s=this.sizeUnit?e.split(/(\d+)/):[e,""];let i=(s.pop()||"").trim().toLowerCase();i=this.$.options.get("fontSizeUnits").includes(i)?i:this.sizeUnit;const n=s.pop();return{unit:i,value:i?Number(n):n}}#Bc(t,e){return(t=t.parentElement.querySelector(".__se__font_size"))?Ht.check.isInputElement(t)?t.value=String(e):t.textContent=String(this.sizeUnit?e:this.unitMap.text.list.find((t=>t.size===e))?.title||e):0}}const Yr=Kr;const Xr=class extends zo{static key="pageNavigator";static className="se-btn-input se-btn-tool-pageNavigator";constructor(t){super(t),this.title=this.$.lang.pageNumber,this.inner=Ht.utils.createElement("input",{type:"number",class:"se-not-arrow-text",placeholder:"1",value:"1",min:"1"},null),this.afterItem=Ht.utils.createElement("span",{class:"se-btn se-sub-btn"},""),this.pageNum=1,this.totalPages=1,this.$.eventManager.addEvent(this.inner,"change",this.#Oc.bind(this))}display(t,e){this.pageNum=t,this.totalPages=e,this.inner.value=String(t),this.afterItem.textContent=this.inner.max=String(e)}#Oc(t){if(!this.$.frameContext.has("documentType_use_page"))return;const e=Ht.query.getEventTarget(t),s=Number(e.value)||1;this.$.frameContext.get("documentType").pageGo(s)}},{_w:Jr}=Et;class Qr extends Po{static key="anchor";static className="";static component(t){return Ht.check.isAnchor(t)&&t.hasAttribute("id")&&t.hasAttribute("data-se-anchor")?t:null}#Ul=null;#Rc=null;constructor(t){super(t),this.title=this.$.lang.anchor,this.icon="bookmark_anchor";const e=(new DOMParser).parseFromString(this.$.icons.bookmark_anchor,"image/svg+xml");this.bookmarkIcon=e.documentElement;const s=function({lang:t,icons:e}){const s=`\n\t<div class="se-arrow se-arrow-up"></div>\n\t<div class="link-content">\n\t\t<div class="se-controller-display"></div>\n\t\t<div class="se-btn-group">\n\t\t\t<button type="button" data-command="edit" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.edit}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.edit}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t\t<button type="button" data-command="delete" tabindex="-1" class="se-btn se-tooltip">\n\t\t\t\t${e.delete}\n\t\t\t\t<span class="se-tooltip-inner">\n\t\t\t\t\t<span class="se-tooltip-text">${t.remove}</span>\n\t\t\t\t</span>\n\t\t\t</button>\n\t\t</div>\n\t</div>`;return Ht.utils.createElement("DIV",{class:"se-controller se-controller-link"},s)}(this.$);this.displayId=s.querySelector(".se-controller-display"),this.controllerSelect=new ps(this,this.$,s,{position:"bottom",disabled:!0},Qr.key);const i=function({lang:t,icons:e}){const s=`\n\t\t<div class="se-arrow se-arrow-up"></div>\n\t\t<form>\n\t\t\t<div class="se-controller-display">${t.id}</div>\n\t\t\t<div class="se-btn-group se-form-group">\n\t\t\t\t<input type="text" required />\n\t\t\t\t<button type="submit" data-command="submit" class="se-btn se-tooltip se-btn-success">\n\t\t\t\t\t${e.checked}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.save}</span></span>\n\t\t\t\t</button>\n\t\t\t\t<button type="button" data-command="cancel" class="se-btn se-tooltip se-btn-danger">\n\t\t\t\t\t${e.cancel}\n\t\t\t\t\t<span class="se-tooltip-inner"><span class="se-tooltip-text">${t.cancel}</span></span>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</form>\n\t\t`;return Ht.utils.createElement("DIV",{class:"se-controller se-controller-simple-input"},s)}(this.$);this.inputEl=i.querySelector("input"),this.controller=new ps(this,this.$,i,{position:"bottom",disabled:!0,parents:[this.controllerSelect.form],parentsHide:!0},Qr.key)}show(){this.controller.open(this.#Rc=this.$.selection.getRange()),Jr.setTimeout((()=>{this.inputEl.focus()}),0)}componentSelect(t){this.#Ul=t,this.displayId.textContent=t.getAttribute("id"),this.controllerSelect.open(t)}componentDeselect(){this.#ls()}controllerAction(t){const e=t.getAttribute("data-command");if(!e)return;const s=this.#Ul;switch(e){case"submit":if(this.controller.close(),s)s.id=this.inputEl.value,this.$.component.select(s,Qr.key);else{const t=this.inputEl.value.trim();if(!t)return void this.inputEl.focus();const e=Ht.utils.createElement("A",{id:t,"data-se-anchor":this.inputEl.value,"data-se-non-link":"true",contenteditable:"false",class:"se-component se-inline-component"});this.$.component.insert(e,{insertBehavior:"none",scrollTo:!1});const s=this.$.selection.getNearRange(e);s?this.$.selection.setRange(s.container,s.offset,s.container,s.offset):this.$.component.select(e,Qr.key),this.#ls()}break;case"cancel":this.controller.close(!s),this.#Rc&&this.$.selection.setRange(this.#Rc),this.#ls(),s&&this.componentSelect(s);break;case"edit":this.inputEl.value=this.displayId.textContent,this.controllerSelect.hide(),this.controller.open(s),this.inputEl.focus();break;case"delete":{const t=this.$.selection.getNearRange(s);Ht.utils.removeItem(s),this.controllerSelect.close(!0),t&&this.$.selection.setRange(t.container,t.offset,t.container,t.offset),this.#ls();break}}}#ls(){this.#Ul=null,this.#Rc=null,this.inputEl.value="",this.displayId.textContent=""}}const ta={blockquote:Do,exportPDF:Uo,fileUpload:jo,list_bulleted:Yo,list_numbered:Qo,mention:el,align:il,font:ol,fontColor:rl,backgroundColor:cl,list:pl,table:Jl,blockStyle:tr,hr:dl,layout:sr,lineHeight:nr,template:lr,paragraphStyle:ar,textStyle:hr,link:dr,image:Cr,video:Er,audio:Lr,embed:Ir,math:Fr,drawing:Dr,imageGallery:qr,videoGallery:Wr,audioGallery:Ur,fileGallery:Gr,fileBrowser:Zr,fontSize:Yr,pageNavigator:Xr,anchor:Qr};class ea{async modalAction(){return!0}modalOn(t){}modalInit(){}modalOff(t){}modalResize(){}}class sa{controllerAction(t){}controllerOn(t,e){}controllerClose(){}}class ia{browserInit(){}}class na{colorPickerAction(t){}colorPickerHueSliderOpen(){}colorPickerHueSliderClose(){}}class oa{hueSliderAction(){}hueSliderCancelAction(){}}class la{componentSelect(t){}componentDeselect(t){}componentEdit(t){}async componentDestroy(t){}componentCopy(t){}}const ra={contract:t,manager:e,ui:i};Object.defineProperty(window,"SUNEDITOR",{enumerable:!0,writable:!1,configurable:!1,value:{...No,plugins:ta,modules:ra,helper:Bt,interfaces:n}})})()})();
|