diff --git a/README.md b/README.md index 8c4cc9f11..62c868214 100644 --- a/README.md +++ b/README.md @@ -374,8 +374,14 @@ popupDisplay : Size of background area when activating dialog window ('full'| resizingBar : Show the bottom resizing bar. If 'height' value is 'auto', it will not be resized. default: true {Boolean} showPathLabel : Displays the current node structure to resizingBar. default: true {Boolean} + +// Character count----------------------------------------------------------------------------------------------- charCounter : Shows the number of characters in the editor. If the maxCharCount option has a value, it becomes true. default: false {Boolean} +charCounterType : Defines the calculation method of the "charCounter" option. + ('char': character length, 'byte': binary data length) default: 'char' {String} +charCounterLabel: Text to be displayed in the "charCounter" area of the bottom bar. + Screen ex) 'charCounterLabel: ' 20 / 200 default: null {String} maxCharCount : The maximum number of characters allowed to be inserted into the editor. default: null {Number} // Width size---------------------------------------------------------------------------------------------------- @@ -572,6 +578,12 @@ templates : If you use a template plugin, add it. // ETC------------------------------------------------------------------------------------------------------------ placeholder : The placeholder text. default: null {String} +icons : You can redefine icons. default: null {Object} + ex) { + bold: 'B', + table: 'svg{width:16px;height:16px;margin:auto;fill:currentColor;display:block;text-align:center;float:none}.sun-editor .close>svg,.sun-editor .se-dialog-close>svg{width:10px;height:10px}.sun-editor .se-btn-select>svg{float:right;width:10px;height:10px}.sun-editor .se-btn-list>.se-list-icon{display:inline-block;width:16px;height:16px;margin:-1px 10px 0 0;vertical-align:middle}.sun-editor button>i:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;font-size:15px;line-height:2}.sun-editor .se-arrow,.sun-editor .se-arrow:after{position:absolute;display:block;width:0;height:0;border:11px solid transparent}.sun-editor .se-arrow.se-arrow-up{top:-11px;left:20px;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-up:after{top:1px;margin-left:-11px;content:" ";border-top-width:0;border-bottom-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-up:after{border-bottom-color:#fafafa}.sun-editor .se-arrow.se-arrow-down{top:0;left:0;margin-left:-11px;border-bottom-width:0;border-top-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-down:after{top:-12px;margin-left:-11px;content:" ";border-bottom-width:0;border-top-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-down:after{border-top-color:#fafafa}.sun-editor .se-container{position:relative;width:100%;height:100%}.sun-editor button{color:#000}.sun-editor .se-btn{float:left;width:34px;height:34px;border:0;border-radius:4px;margin:1px!important;padding:0;font-size:12px;line-height:27px}.sun-editor .se-btn:enabled:focus,.sun-editor .se-btn:enabled:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn-primary{color:#000;background-color:#c7deff;border:1px solid #80bdff;border-radius:4px}.sun-editor .se-btn-primary:focus,.sun-editor .se-btn-primary:hover{color:#000;background-color:#80bdff;border-color:#3f9dff;outline:0 none}.sun-editor .se-btn-primary:active{color:#fff;background-color:#3f9dff;border-color:#4592ff;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor .se-btn:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-btn:enabled.active:focus,.sun-editor .se-btn:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.on:focus,.sun-editor .se-btn:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-btn-list:disabled,.sun-editor .se-btn:disabled,.sun-editor button:disabled{cursor:not-allowed;background-color:inherit;color:#bdbdbd}.sun-editor .se-loading-box{position:absolute;display:none;width:100%;height:100%;top:0;left:0;background-color:#fff;opacity:.7;filter:alpha(opacity=70);z-index:2147483647}.sun-editor .se-loading-box .se-loading-effect{position:absolute;display:block;top:50%;left:50%;height:25px;width:25px;border-top:2px solid #07d;border-right:2px solid transparent;border-radius:50%;animation:spinner .8s linear infinite;margin:-25px 0 0 -25px}.sun-editor .se-toolbar{display:block;position:relative;height:auto;width:100%;overflow:visible;padding:4px 3px 0;margin:0;background-color:#fafafa;outline:1px solid #dadada;z-index:5}.sun-editor .se-toolbar-cover{position:absolute;display:none;font-size:36px;width:100%;height:100%;top:0;left:0;background-color:#fefefe;opacity:.5;filter:alpha(opacity=50);cursor:not-allowed;z-index:4}.sun-editor .se-toolbar-separator-vertical{display:inline-block;height:0;width:0;margin:2px;vertical-align:top}.sun-editor .se-toolbar.se-toolbar-balloon,.sun-editor .se-toolbar.se-toolbar-inline{display:none;position:absolute;z-index:2147483647;box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-toolbar.se-toolbar-balloon{width:auto}.sun-editor .se-toolbar.se-toolbar-sticky{position:fixed;top:0}.sun-editor .se-toolbar-sticky-dummy{display:none;position:static;z-index:-1}.sun-editor .se-btn-module{display:inline-block}.sun-editor .se-btn-module-border{border:1px solid #dadada;border-radius:4px}.sun-editor .se-btn-module-enter{display:block;width:100%;height:1px;margin-bottom:5px;background-color:transparent}.sun-editor .se-menu-list,.sun-editor .se-menu-list li{float:left;padding:0;margin:0}.sun-editor .se-menu-list li{position:relative}.sun-editor .se-btn-select{width:auto;display:flex;text-align:left;padding:4px 6px}.sun-editor .se-btn-select .txt{flex:auto;float:left;text-align:left}.sun-editor .se-btn-select.se-btn-tool-font{width:100px}.sun-editor .se-btn-select.se-btn-tool-format,.sun-editor .se-btn-select.se-btn-tool-size{width:80px}.sun-editor .se-list-layer{display:none;position:absolute;top:37px;z-index:4;left:1px;border:1px solid #bababa;border-radius:4px;padding:6px 0;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0 none}.sun-editor .se-list-layer .se-list-inner{padding:0;margin:0;overflow-x:initial;overflow-y:initial;overflow:visible}.sun-editor .se-list-layer button{margin:0;width:100%}.sun-editor .se-list-inner .se-list-basic{width:100%;padding:0}.sun-editor .se-list-inner .se-list-basic li{width:100%}.sun-editor .se-list-inner .se-list-basic li>button{min-width:100%;width:max-content}.sun-editor .se-list-inner .se-list-basic li button.active{background-color:#80bdff;border:1px solid #3f9dff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:active{background-color:#3f9dff;border:1px solid #4592ff;border-left:0;border-right:0;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor .se-btn-list{width:100%;height:auto;min-height:32px;max-height:100px;padding:0 14px;cursor:pointer;font-size:12px;line-height:normal;text-indent:0;text-decoration:none;text-align:left}.sun-editor .se-btn-list.default_value{background-color:#f3f3f3;border-top:1px dotted #b1b1b1;border-bottom:1px dotted #b1b1b1}.sun-editor .se-btn-list:focus,.sun-editor .se-btn-list:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn-list:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-list-layer .se-list-font-family{min-width:156px}.sun-editor .se-list-layer .se-list-font-family .default{border-bottom:1px solid #ccc}.sun-editor .se-list-layer .se-list-format{min-width:156px}.sun-editor .se-list-layer .se-list-format li{padding:0;width:100%}.sun-editor .se-list-layer .se-list-format .se-btn-list{line-height:100%}.sun-editor .se-list-layer .se-list-format .se-btn-list[data-value=h1]{height:40px}.sun-editor .se-list-layer .se-list-format .se-btn-list[data-value=h2]{height:34px}.sun-editor .se-list-layer .se-list-format div,.sun-editor .se-list-layer .se-list-format p{font-size:13px}.sun-editor .se-list-layer .se-list-format h1{font-size:2em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h2{font-size:1.5em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h3{font-size:1.17em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h4{font-size:1em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h5{font-size:.83em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h6{font-size:.67em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format blockquote{font-size:13px;color:#999;height:22px;margin:0;background-color:transparent;line-height:1.5;border-color:#b1b1b1;padding:0 0 0 7px;border-left:5px #b1b1b1;border-style:solid}.sun-editor .se-list-layer .se-list-format pre{font-size:13px;color:#666;padding:4px 11px;margin:0;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:4px}.sun-editor .se-list-layer .se-list-font-size{min-width:140px;max-height:300px;overflow-x:hidden;overflow-y:auto}.sun-editor .se-list-layer .se-list-line{width:125px}.sun-editor .se-list-layer .se-list-align{left:9px;width:125px}.sun-editor .se-list-layer .se-list-format div{padding:4px 2px}.sun-editor .se-selector-table{display:none;position:absolute;top:34px;left:1px;z-index:4;padding:5px 0;float:left;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.sun-editor .se-selector-table .se-table-size{font-size:18px;padding:0 5px}.sun-editor .se-selector-table .se-table-size-picker{position:absolute!important;z-index:3;font-size:18px;width:10em;height:10em;cursor:pointer}.sun-editor .se-selector-table .se-table-size-highlighted{position:absolute!important;z-index:2;font-size:18px;width:1em;height:1em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4QTZCNzMzN0I3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4QTZCNzMzNkI3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0MzYyNEUxRUI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0MzYyNEUxRkI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pl0yAuwAAABBSURBVDhPY/wPBAxUAGCDGvdBeWSAeicIDTfIXREiQArYeR9hEBOEohyMGkQYjBpEGAxjg6ib+yFMygCVvMbAAABj0hwMTNeKJwAAAABJRU5ErkJggg==") repeat}.sun-editor .se-selector-table .se-table-size-unhighlighted{position:relative!important;z-index:1;font-size:18px;width:5em;height:5em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat}.sun-editor .se-selector-table .se-table-size-display{padding-left:5px}.sun-editor .se-list-layer .se-selector-color{display:flex;width:max-content;max-width:270px;height:auto;padding:0;margin:auto}.sun-editor .se-list-layer .se-selector-color .se-color-pallet{width:100%;height:100%;padding:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet li{display:flex;float:left;position:relative;margin:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button{display:block;cursor:default;width:30px;height:30px;text-indent:-9999px}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button.active,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover{border:3px solid #fff}.sun-editor .se-submenu-form-group{display:flex;width:100%;height:auto;padding:4px}.sun-editor .se-submenu-form-group input{flex:auto;display:inline-block;width:auto;height:33px;color:#555;font-size:12px;margin:1px 0;padding:0;border-radius:.25rem;border:1px solid #ccc}.sun-editor .se-submenu-form-group input:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor .se-submenu-form-group button{float:right;width:34px;height:34px;margin:0 0 0 4px!important}.sun-editor .se-submenu-form-group button.se-btn{border:1px solid #ccc}.sun-editor .se-submenu-form-group>div{position:relative}.sun-editor .se-submenu-form-group .se-color-input{width:72px;text-transform:uppercase;border:none;border-bottom:2px solid #b1b1b1;outline:none}.sun-editor .se-submenu-form-group .se-color-input:focus{border-bottom:3px solid #b1b1b1}.sun-editor .se-wrapper{position:relative!important;width:100%;height:auto;overflow:hidden;z-index:1}.sun-editor .se-wrapper .se-wrapper-inner{width:100%;height:100%;min-height:65px;overflow-y:auto;overflow-x:auto;-webkit-overflow-scrolling:touch;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-wrapper .se-wrapper-inner:focus{outline:none}.sun-editor .se-wrapper .se-wrapper-code{background-color:#191919;color:#fff;font-size:13px;word-break:break-all;padding:4px;margin:0;resize:none!important}.sun-editor .se-wrapper .se-wrapper-wysiwyg{background-color:#fff;display:block}.sun-editor .se-wrapper .se-wrapper-code-mirror{font-size:13px}.sun-editor .se-wrapper .se-placeholder{position:absolute;display:none;white-space:nowrap;text-overflow:ellipsis;z-index:1;color:#b1b1b1;font-size:13px;line-height:1.5;top:0;left:0;right:0;overflow:hidden;margin-top:0;padding-top:16px;padding-left:16px;margin-left:0;padding-right:16px;margin-right:0;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-resizing-bar{display:flex;width:auto;height:auto;min-height:16px;border-top:1px solid #dadada;padding:0 4px;background-color:#fafafa;cursor:ns-resize}.sun-editor .se-resizing-bar.se-resizing-none{cursor:default}.sun-editor .se-resizing-back{position:absolute;display:none;cursor:default;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-resizing-bar .se-navigation{flex:auto;position:relative;width:auto;height:auto;color:#666;margin:0;padding:0;font-size:10px;font-weight:700;line-height:1.5;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper{flex:none;position:relative;display:block;width:auto;height:auto;margin:0;padding:0;font-size:10px;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper span{color:#999;font-size:13px;font-family:Helvetica Neue,sans-serif}.sun-editor .se-resizing-bar .se-char-counter.se-blink{color:#b94a48;animation:blinker .2s linear infinite}.sun-editor .se-dialog{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-dialog button,.sun-editor .se-dialog input,.sun-editor .se-dialog label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-dialog .se-dialog-back{background-color:#222;opacity:.5}.sun-editor .se-dialog .se-dialog-back,.sun-editor .se-dialog .se-dialog-inner{position:absolute;width:100%;height:100%;top:0;left:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{position:relative;width:auto;max-width:500px;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}@media screen and (max-width:509px){.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{width:100%}}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header{height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title{font-size:14px;font-weight:700;margin:0;padding:0;line-height:2.5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-body{position:relative;padding:15px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form{margin-bottom:10px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer{margin-top:10px;margin-bottom:0}.sun-editor .se-dialog .se-dialog-inner input:disabled{background-color:#f3f3f3}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text{width:100%}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h,.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w{width:70px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x{margin:0 8px;width:25px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary{display:inline-block;padding:6px 12px;margin:0 0 10px!important;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;border-radius:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer{padding:10px 15px 0;text-align:right;border-top:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div{float:left}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div>label{margin-top:5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio{margin-left:12px;margin-right:6px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check{margin-left:12px;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check{margin-left:0;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{width:auto}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control,.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{display:inline-block;height:34px;font-size:14px;text-align:center;line-height:1.42857143;color:#000;border:1px solid #ccc;border-radius:4px;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control{width:70px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form{display:block;width:100%;height:34px;font-size:14px;line-height:1.42857143;padding:0 4px;color:#000;border:1px solid #ccc;border-radius:4px;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form input:focus,.sun-editor .se-dialog .se-dialog-inner .se-dialog-form select:focus,.sun-editor .se-dialog .se-dialog-inner .se-dialog-form textarea:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-video-ratio{width:70px;margin-left:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form a{color:#004cff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert{border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-dialog-tabs{width:100%;height:25px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog-tabs button{background-color:#e5e5e5;border-right:1px solid #e5e5e5;float:left;outline:none;padding:2px 13px;transition:.3s}.sun-editor .se-dialog-tabs button:hover{background-color:#fff}.sun-editor .se-dialog-tabs button.active{background-color:#fff;border-bottom:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp{resize:vertical;height:4rem;border:1px solid #ccc;font-size:13px;padding:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select.se-math-size{width:6em;height:28px;margin-left:1em}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview{font-size:13px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview>span{display:inline-block;-webkit-box-shadow:0 0 0 .1rem #c7deff;box-shadow:0 0 0 .1rem #c7deff}.sun-editor .se-controller .se-arrow.se-arrow-up{border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-controller{position:absolute;display:none;overflow:visible;z-index:4;border:1px solid rgba(0,0,0,.25);border-radius:4px;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.sun-editor .se-controller .se-btn-group{position:relative;display:flex;vertical-align:middle;padding:2px 2px 2px 0;top:0;left:0}.sun-editor .se-controller .se-btn-group .se-btn-group-sub{left:50%;min-width:auto;width:max-content;display:none}.sun-editor .se-controller .se-btn-group .se-btn-group-sub button{margin:0;min-width:72px}.sun-editor .se-controller .se-btn-group button{position:relative;min-height:34px;height:auto;border:none;border-radius:4px;margin:0 0 0 2px;padding:5px 10px;font-size:12px;line-height:1.5;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation}.sun-editor .se-controller .se-btn-group button:focus:enabled,.sun-editor .se-controller .se-btn-group button:hover:enabled{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:active:enabled{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button span{display:block;padding:0;margin:0}.sun-editor .se-controller .se-btn-group button:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:focus,.sun-editor .se-controller .se-btn-group button:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:focus,.sun-editor .se-controller .se-btn-group button:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-controller-resizing{margin-top:-50px!important;padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-resizing .se-btn-group .se-btn-group-sub.se-resizing-align-list{left:57px}.sun-editor .se-resizing-container{position:absolute;display:none;z-index:4;border:1px solid #80bdff;background-color:transparent}.sun-editor .se-resizing-container .se-modal-resize{position:absolute;display:inline-block;background-color:#3f9dff;opacity:.3}.sun-editor .se-resizing-container .se-resize-dot{position:absolute;top:0;left:0;width:100%;height:100%}.sun-editor .se-resizing-container .se-resize-dot>span{position:absolute;width:7px;height:7px;background-color:#3f9dff;border:1px solid #4592ff}.sun-editor .se-resizing-container .se-resize-dot>span.tl{top:-5px;left:-5px;cursor:nw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.tr{top:-5px;right:-5px;cursor:ne-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bl{bottom:-5px;left:-5px;cursor:sw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.br{right:-5px;bottom:-5px;cursor:se-resize}.sun-editor .se-resizing-container .se-resize-dot>span.lw{left:-7px;bottom:50%;cursor:w-resize}.sun-editor .se-resizing-container .se-resize-dot>span.th{left:50%;top:-7px;cursor:n-resize}.sun-editor .se-resizing-container .se-resize-dot>span.rw{right:-7px;bottom:50%;cursor:e-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bh{right:50%;bottom:-7px;cursor:s-resize}.sun-editor .se-resizing-container .se-resize-display{position:absolute;right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#333;border-radius:4px}.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{width:auto}.sun-editor .se-controller-link,.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-link:after,.sun-editor .se-controller-link:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor .se-controller-link .link-content{padding:0;margin:0}.sun-editor .se-controller-link .link-content a{display:inline-block;color:#4592ff;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;margin-left:5px}.sun-editor .se-notice{position:relative;display:none;width:100%;height:auto;word-break:break-all;font-size:13px;color:#b94a48;background-color:#f2dede;padding:15px;margin:0;border:1px solid #eed3d7;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-notice button{float:right}.sun-editor .se-tooltip{position:relative;overflow:visible}.sun-editor .se-tooltip .se-tooltip-inner{visibility:hidden;position:absolute;display:block;width:auto;top:120%;left:50%;background:transparent;opacity:0;z-index:1;line-height:1.5;transition:opacity .5s;margin:0;padding:0;bottom:auto;float:none;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text{position:relative;display:inline-block;width:auto;left:-50%;font-size:.9em;margin:0;padding:4px 6px;border-radius:2px;background-color:#333;color:#fff;text-align:center;line-height:unset;white-space:nowrap;cursor:auto}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#333}.sun-editor .se-tooltip:hover .se-tooltip-inner{visibility:visible;opacity:1}@keyframes blinker{50%{opacity:0}}@keyframes spinner{to{transform:rotate(1turn)}}.sun-editor-editable{font-family:Helvetica Neue,sans-serif;font-size:13px;line-height:1.5;color:#333;text-align:left;background-color:#fff;word-break:break-all;word-wrap:break-word;padding:16px;margin:0}.sun-editor-editable *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor-editable audio,.sun-editor-editable figcaption,.sun-editor-editable figure,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable td,.sun-editor-editable th,.sun-editor-editable video{position:relative}.sun-editor-editable .__se__float-left{float:left}.sun-editor-editable .__se__float-right{float:right}.sun-editor-editable .__se__float-center{float:center}.sun-editor-editable .__se__float-none{float:none}.sun-editor-editable span{display:inline;vertical-align:baseline;margin:0;padding:0}.sun-editor-editable span.katex{display:inline-block}.sun-editor-editable[contenteditable=true] span.katex{outline:1px dashed #e1e1e1}.sun-editor-editable a{color:#004cff;text-decoration:none}.sun-editor-editable span[style~="color:"] a{color:inherit}.sun-editor-editable a:focus,.sun-editor-editable a:hover{cursor:pointer;color:#0093ff;text-decoration:underline}.sun-editor-editable pre{display:block;padding:8px;margin:0 0 10px;line-height:1.45;color:#666;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:2px;white-space:pre-wrap;word-wrap:break-word;overflow:visible}.sun-editor-editable ol{list-style-type:decimal}.sun-editor-editable ol,.sun-editor-editable ul{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}.sun-editor-editable ul{list-style-type:disc}.sun-editor-editable li{display:list-item;text-align:-webkit-match-parent;margin-bottom:5px}.sun-editor-editable ol ol,.sun-editor-editable ol ul,.sun-editor-editable ul ol,.sun-editor-editable ul ul{margin:0}.sun-editor-editable ol ol,.sun-editor-editable ul ol{list-style-type:lower-alpha}.sun-editor-editable ol ol ol,.sun-editor-editable ul ol ol,.sun-editor-editable ul ul ol{list-style-type:upper-roman}.sun-editor-editable ol ul,.sun-editor-editable ul ul{list-style-type:circle}.sun-editor-editable ol ol ul,.sun-editor-editable ol ul ul,.sun-editor-editable ul ul ul{list-style-type:square}.sun-editor-editable sub,.sun-editor-editable sup{font-size:75%;line-height:0}.sun-editor-editable sub{vertical-align:sub}.sun-editor-editable sup{vertical-align:super}.sun-editor-editable p{display:block;margin:0 0 10px}.sun-editor-editable div{display:block;margin:0;padding:0}.sun-editor-editable blockquote{display:block;font-family:inherit;font-size:inherit;color:#999;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding:0 5px 0 20px;border:solid #b1b1b1;border-width:0 0 0 5px}.sun-editor-editable blockquote blockquote{border-color:#c1c1c1}.sun-editor-editable blockquote blockquote blockquote{border-color:#d1d1d1}.sun-editor-editable blockquote blockquote blockquote blockquote{border-color:#e1e1e1}.sun-editor-editable h1{font-size:2em;margin-block-start:.67em;margin-block-end:.67em}.sun-editor-editable h1,.sun-editor-editable h2{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h2{font-size:1.5em;margin-block-start:.83em;margin-block-end:.83em}.sun-editor-editable h3{font-size:1.17em;margin-block-start:1em;margin-block-end:1em}.sun-editor-editable h3,.sun-editor-editable h4{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h4{font-size:1em;margin-block-start:1.33em;margin-block-end:1.33em}.sun-editor-editable h5{font-size:.83em;margin-block-start:1.67em;margin-block-end:1.67em}.sun-editor-editable h5,.sun-editor-editable h6{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h6{font-size:.67em;margin-block-start:2.33em;margin-block-end:2.33em}.sun-editor-editable hr{display:flex;border-width:1px 0 0;border-color:#000;border-image:initial;height:1px}.sun-editor-editable hr.__se__solid{border-style:solid none none}.sun-editor-editable hr.__se__dotted{border-style:dotted none none}.sun-editor-editable hr.__se__dashed{border-style:dashed none none}.sun-editor-editable table{display:table;table-layout:auto;border:1px solid #ccc;width:100%;max-width:100%;margin:0 0 10px;background-color:transparent;border-spacing:0;border-collapse:collapse}.sun-editor-editable table thead{border-bottom:2px solid #333}.sun-editor-editable table tr{border:1px solid #efefef}.sun-editor-editable table th{background-color:#f3f3f3}.sun-editor-editable table td,.sun-editor-editable table th{border:1px solid #e1e1e1;padding:.4em;background-clip:padding-box}.sun-editor-editable table td.se-table-selected-cell,.sun-editor-editable table th.se-table-selected-cell{border:1px double #4592ff;background-color:#f1f7ff}.sun-editor-editable.se-disabled *{user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor-editable .se-component{display:flex;padding:1px;margin:0 0 10px}.sun-editor-editable .se-component.__se__float-left{margin:0 20px 10px 0}.sun-editor-editable .se-component.__se__float-right{margin:0 0 10px 20px}.sun-editor-editable[contenteditable=true] .se-component{outline:1px dashed #e1e1e1}.sun-editor-editable audio,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable video{display:block;margin:0;padding:0;width:auto;height:auto;max-width:100%}.sun-editor-editable[contenteditable=true] figure:after{position:absolute;content:"";z-index:1;top:0;left:0;right:0;bottom:0;cursor:default;display:block;background:transparent}.sun-editor-editable[contenteditable=true] figure a,.sun-editor-editable[contenteditable=true] figure iframe,.sun-editor-editable[contenteditable=true] figure img{z-index:0}.sun-editor-editable[contenteditable=true] figure figcaption{display:block;z-index:2}.sun-editor-editable[contenteditable=true] figure figcaption:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor-editable .se-image-container,.sun-editor-editable .se-video-container{width:auto;height:auto;max-width:100%}.sun-editor-editable figure{display:block;outline:none;margin:0;padding:0}.sun-editor-editable figure figcaption{padding:1em .5em;margin:0;background-color:#f9f9f9;outline:none}.sun-editor-editable figure figcaption p{line-height:2;margin:0}.sun-editor-editable .se-image-container a img{padding:1px;margin:1px;outline:1px solid #4592ff}.sun-editor-editable .se-video-container iframe{outline:1px solid #9e9e9e;position:absolute;top:0;left:0;border:0;width:100%;height:100%}.sun-editor-editable .se-video-container figure{left:0;width:100%;max-width:100%}.sun-editor-editable.se-show-block div,.sun-editor-editable.se-show-block h1,.sun-editor-editable.se-show-block h2,.sun-editor-editable.se-show-block h3,.sun-editor-editable.se-show-block h4,.sun-editor-editable.se-show-block h5,.sun-editor-editable.se-show-block h6,.sun-editor-editable.se-show-block li,.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block p,.sun-editor-editable.se-show-block pre,.sun-editor-editable.se-show-block ul{border:1px dashed #3f9dff!important;padding:14px 8px 8px!important}.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block ul{border:1px dashed #d539ff!important}.sun-editor-editable.se-show-block pre{border:1px dashed #27c022!important}.se-show-block p{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPAQMAAAAF7dc0AAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAaSURBVAjXY/j/gwGCPvxg+F4BQiAGDP1HQQByxxw0gqOzIwAAAABJRU5ErkJggg==") no-repeat}.se-show-block div{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAPAQMAAAAxlBYoAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j//wcDDH+8XsHwDYi/hwNx1A8w/nYLKH4XoQYJAwCXnSgcl2MOPgAAAABJRU5ErkJggg==") no-repeat}.se-show-block h1{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAfSURBVAjXY/j/v4EBhr+9B+LzEPrDeygfhI8j1CBhAEhmJGY4Rf6uAAAAAElFTkSuQmCC") no-repeat}.se-show-block h2{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j/v4EBhr+dB+LtQPy9geEDEH97D8T3gbgdoQYJAwA51iPuD2haEAAAAABJRU5ErkJggg==") no-repeat}.se-show-block h3{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQPy9geHDeQgN5p9HqEHCADeWI+69VG2MAAAAAElFTkSuQmCC") no-repeat}.se-show-block h4{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPAQMAAADTSA1RAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j//wADDH97DsTXIfjDdiDdDMTfIRhZHRQDAKJOJ6L+K3y7AAAAAElFTkSuQmCC") no-repeat}.se-show-block h5{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAlSURBVAjXY/j/v4EBhr+1A/F+IO5vYPiwHUh/B2IQfR6hBgkDABlWIy5uM+9GAAAAAElFTkSuQmCC") no-repeat}.se-show-block h6{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQLy/geFDP5S9HSKOrA6KAR9GIza1ptJnAAAAAElFTkSuQmCC") no-repeat}.se-show-block li{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA7SURBVDhPYxgFcNDQ0PAfykQBIHEYhgoRB/BpwCfHBKWpBkaggYxQGgOgBzyQD1aLLA4TGwWDGjAwAACR3RcEU9Ui+wAAAABJRU5ErkJggg==") no-repeat}.se-show-block ol{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABHSURBVDhPYxgFcNDQ0PAfhKFcFIBLHCdA1oBNM0kGEmMAPgOZoDTVANUNxAqQvURMECADRiiNAWCagDSGGhyW4DRrMAEGBgAu0SX6WpGgjAAAAABJRU5ErkJggg==") no-repeat}.se-show-block ul{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVDhPYxgFDA0NDf+hTBSALI5LDQgwQWmqgVEDKQcsUBoF4ItFGEBXA+QzQpmDGjAwAAA8DQ4Lni6gdAAAAABJRU5ErkJggg==") no-repeat}.sun-editor-editable .__se__p-bordered,.sun-editor .__se__p-bordered{border-top:1px solid #b1b1b1;border-bottom:1px solid #b1b1b1;padding:4px 0}.sun-editor-editable .__se__p-spaced,.sun-editor .__se__p-spaced{letter-spacing:1px}.sun-editor-editable .__se__p-neon,.sun-editor .__se__p-neon{font-weight:200;font-style:italic;background:#000;color:#fff;padding:6px 4px;border:2px solid #fff;border-radius:6px;text-transform:uppercase;animation:neonFlicker 1.5s infinite alternate}@keyframes neonFlicker{0%,19%,21%,23%,25%,54%,56%,to{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 2px #f40,0 0 4px #f40,0 0 6px #f40,0 0 8px #f40,0 0 10px #f40;box-shadow:0 0 .5px #fff,inset 0 0 .5px #fff,0 0 2px #08f,inset 0 0 2px #08f,0 0 4px #08f,inset 0 0 4px #08f}20%,24%,55%{text-shadow:none;box-shadow:none}}.sun-editor-editable .__se__t-shadow,.sun-editor .__se__t-shadow{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 .2rem #999,0 0 .4rem #888,0 0 .6rem #777,0 0 .8rem #666,0 0 1rem #555} \ No newline at end of file +.sun-editor{width:auto;height:auto;box-sizing:border-box;font-family:Helvetica Neue,sans-serif;border:1px solid #dadada;text-align:left;background-color:#fff;color:#000;user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor *{box-sizing:border-box;-webkit-user-drag:none;overflow:visible}.sun-editor-common button,.sun-editor-common input,.sun-editor-common select,.sun-editor-common textarea{font-size:14px;line-height:1.5}.sun-editor-common blockquote,.sun-editor-common body,.sun-editor-common button,.sun-editor-common code,.sun-editor-common dd,.sun-editor-common div,.sun-editor-common dl,.sun-editor-common dt,.sun-editor-common fieldset,.sun-editor-common form,.sun-editor-common h1,.sun-editor-common h2,.sun-editor-common h3,.sun-editor-common h4,.sun-editor-common h5,.sun-editor-common h6,.sun-editor-common input,.sun-editor-common legend,.sun-editor-common li,.sun-editor-common ol,.sun-editor-common p,.sun-editor-common pre,.sun-editor-common select,.sun-editor-common td,.sun-editor-common textarea,.sun-editor-common th,.sun-editor-common ul{margin:0;padding:0;border:0}.sun-editor-common dl,.sun-editor-common li,.sun-editor-common menu,.sun-editor-common ol,.sun-editor-common ul{list-style:none!important}.sun-editor-common hr{margin:6px 0!important}.sun-editor textarea{resize:none;border:0;padding:0}.sun-editor button{border:0;background-color:transparent;touch-action:manipulation;cursor:pointer;outline:none}.sun-editor button,.sun-editor input,.sun-editor select,.sun-editor textarea{vertical-align:middle}.sun-editor button span{display:block;margin:0;padding:0}.sun-editor button .txt{display:block;margin-top:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sun-editor button *{pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-svg,.sun-editor button>svg{width:16px;height:16px;margin:auto;fill:currentColor;display:block;text-align:center;float:none}.sun-editor .close>svg,.sun-editor .se-dialog-close>svg{width:10px;height:10px}.sun-editor .se-btn-select>svg{float:right;width:10px;height:10px}.sun-editor .se-btn-list>.se-list-icon{display:inline-block;width:16px;height:16px;margin:-1px 10px 0 0;vertical-align:middle}.sun-editor button>i:before{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;font-size:15px;line-height:2}.sun-editor button>[class=se-icon-text]{font-size:20px;line-height:1}.sun-editor .se-arrow,.sun-editor .se-arrow:after{position:absolute;display:block;width:0;height:0;border:11px solid transparent}.sun-editor .se-arrow.se-arrow-up{top:-11px;left:20px;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-up:after{top:1px;margin-left:-11px;content:" ";border-top-width:0;border-bottom-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-up:after{border-bottom-color:#fafafa}.sun-editor .se-arrow.se-arrow-down{top:0;left:0;margin-left:-11px;border-bottom-width:0;border-top-color:rgba(0,0,0,.25)}.sun-editor .se-arrow.se-arrow-down:after{top:-12px;margin-left:-11px;content:" ";border-bottom-width:0;border-top-color:#fff}.sun-editor .se-toolbar .se-arrow.se-arrow-down:after{border-top-color:#fafafa}.sun-editor .se-container{position:relative;width:100%;height:100%}.sun-editor button{color:#000}.sun-editor .se-btn{float:left;width:34px;height:34px;border:0;border-radius:4px;margin:1px!important;padding:0;font-size:12px;line-height:27px}.sun-editor .se-btn:enabled:focus,.sun-editor .se-btn:enabled:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn-primary{color:#000;background-color:#c7deff;border:1px solid #80bdff;border-radius:4px}.sun-editor .se-btn-primary:focus,.sun-editor .se-btn-primary:hover{color:#000;background-color:#80bdff;border-color:#3f9dff;outline:0 none}.sun-editor .se-btn-primary:active{color:#fff;background-color:#3f9dff;border-color:#4592ff;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor .se-btn:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-btn:enabled.active:focus,.sun-editor .se-btn:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-btn:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn:enabled.on:focus,.sun-editor .se-btn:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-btn:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-btn-list:disabled,.sun-editor .se-btn:disabled,.sun-editor button:disabled{cursor:not-allowed;background-color:inherit;color:#bdbdbd}.sun-editor .se-loading-box{position:absolute;display:none;width:100%;height:100%;top:0;left:0;background-color:#fff;opacity:.7;filter:alpha(opacity=70);z-index:2147483647}.sun-editor .se-loading-box .se-loading-effect{position:absolute;display:block;top:50%;left:50%;height:25px;width:25px;border-top:2px solid #07d;border-right:2px solid transparent;border-radius:50%;animation:spinner .8s linear infinite;margin:-25px 0 0 -25px}.sun-editor .se-toolbar{display:block;position:relative;height:auto;width:100%;overflow:visible;padding:4px 3px 0;margin:0;background-color:#fafafa;outline:1px solid #dadada;z-index:5}.sun-editor .se-toolbar-cover{position:absolute;display:none;font-size:36px;width:100%;height:100%;top:0;left:0;background-color:#fefefe;opacity:.5;filter:alpha(opacity=50);cursor:not-allowed;z-index:4}.sun-editor .se-toolbar-separator-vertical{display:inline-block;height:0;width:0;margin:2px;vertical-align:top}.sun-editor .se-toolbar.se-toolbar-balloon,.sun-editor .se-toolbar.se-toolbar-inline{display:none;position:absolute;z-index:2147483647;box-shadow:0 3px 9px rgba(0,0,0,.5);-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5)}.sun-editor .se-toolbar.se-toolbar-balloon{width:auto}.sun-editor .se-toolbar.se-toolbar-sticky{position:fixed;top:0}.sun-editor .se-toolbar-sticky-dummy{display:none;position:static;z-index:-1}.sun-editor .se-btn-module{display:inline-block}.sun-editor .se-btn-module-border{border:1px solid #dadada;border-radius:4px}.sun-editor .se-btn-module-enter{display:block;width:100%;height:1px;margin-bottom:5px;background-color:transparent}.sun-editor .se-menu-list,.sun-editor .se-menu-list li{float:left;padding:0;margin:0}.sun-editor .se-menu-list li{position:relative}.sun-editor .se-btn-select{width:auto;display:flex;text-align:left;padding:4px 6px}.sun-editor .se-btn-select .txt{flex:auto;float:left;text-align:left}.sun-editor .se-btn-select.se-btn-tool-font{width:100px}.sun-editor .se-btn-select.se-btn-tool-format,.sun-editor .se-btn-select.se-btn-tool-size{width:80px}.sun-editor .se-list-layer{display:none;position:absolute;top:37px;z-index:4;left:1px;border:1px solid #bababa;border-radius:4px;padding:6px 0;background-color:#fff;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);outline:0 none}.sun-editor .se-list-layer .se-list-inner{padding:0;margin:0;overflow-x:initial;overflow-y:initial;overflow:visible}.sun-editor .se-list-layer button{margin:0;width:100%}.sun-editor .se-list-inner .se-list-basic{width:100%;padding:0}.sun-editor .se-list-inner .se-list-basic li{width:100%}.sun-editor .se-list-inner .se-list-basic li>button{min-width:100%;width:max-content}.sun-editor .se-list-inner .se-list-basic li button.active{background-color:#80bdff;border:1px solid #3f9dff;border-left:0;border-right:0}.sun-editor .se-list-inner .se-list-basic li button.active:active{background-color:#3f9dff;border:1px solid #4592ff;border-left:0;border-right:0;-webkit-box-shadow:inset 0 3px 5px #4592ff;box-shadow:inset 0 3px 5px #4592ff}.sun-editor .se-btn-list{width:100%;height:auto;min-height:32px;max-height:100px;padding:0 14px;cursor:pointer;font-size:12px;line-height:normal;text-indent:0;text-decoration:none;text-align:left}.sun-editor .se-btn-list.default_value{background-color:#f3f3f3;border-top:1px dotted #b1b1b1;border-bottom:1px dotted #b1b1b1}.sun-editor .se-btn-list:focus,.sun-editor .se-btn-list:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-btn-list:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-list-layer .se-list-font-family{min-width:156px}.sun-editor .se-list-layer .se-list-font-family .default{border-bottom:1px solid #ccc}.sun-editor .se-list-layer .se-list-format{min-width:156px}.sun-editor .se-list-layer .se-list-format li{padding:0;width:100%}.sun-editor .se-list-layer .se-list-format .se-btn-list{line-height:100%}.sun-editor .se-list-layer .se-list-format .se-btn-list[data-value=h1]{height:40px}.sun-editor .se-list-layer .se-list-format .se-btn-list[data-value=h2]{height:34px}.sun-editor .se-list-layer .se-list-format div,.sun-editor .se-list-layer .se-list-format p{font-size:13px}.sun-editor .se-list-layer .se-list-format h1{font-size:2em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h2{font-size:1.5em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h3{font-size:1.17em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h4{font-size:1em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h5{font-size:.83em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format h6{font-size:.67em;font-weight:700;color:#333}.sun-editor .se-list-layer .se-list-format blockquote{font-size:13px;color:#999;height:22px;margin:0;background-color:transparent;line-height:1.5;border-color:#b1b1b1;padding:0 0 0 7px;border-left:5px #b1b1b1;border-style:solid}.sun-editor .se-list-layer .se-list-format pre{font-size:13px;color:#666;padding:4px 11px;margin:0;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:4px}.sun-editor .se-list-layer .se-list-font-size{min-width:140px;max-height:300px;overflow-x:hidden;overflow-y:auto}.sun-editor .se-list-layer .se-list-line{width:125px}.sun-editor .se-list-layer .se-list-align{left:9px;width:125px}.sun-editor .se-list-layer .se-list-format div{padding:4px 2px}.sun-editor .se-selector-table{display:none;position:absolute;top:34px;left:1px;z-index:4;padding:5px 0;float:left;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.sun-editor .se-selector-table .se-table-size{font-size:18px;padding:0 5px}.sun-editor .se-selector-table .se-table-size-picker{position:absolute!important;z-index:3;font-size:18px;width:10em;height:10em;cursor:pointer}.sun-editor .se-selector-table .se-table-size-highlighted{position:absolute!important;z-index:2;font-size:18px;width:1em;height:1em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAADJmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4QTZCNzMzN0I3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4QTZCNzMzNkI3RUYxMUU4ODcwQ0QwMjM1NTgzRTJDNyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo0MzYyNEUxRUI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo0MzYyNEUxRkI3RUUxMUU4ODZGQzgwRjNBODgyNTdFOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pl0yAuwAAABBSURBVDhPY/wPBAxUAGCDGvdBeWSAeicIDTfIXREiQArYeR9hEBOEohyMGkQYjBpEGAxjg6ib+yFMygCVvMbAAABj0hwMTNeKJwAAAABJRU5ErkJggg==") repeat}.sun-editor .se-selector-table .se-table-size-unhighlighted{position:relative!important;z-index:1;font-size:18px;width:5em;height:5em;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC") repeat}.sun-editor .se-selector-table .se-table-size-display{padding-left:5px}.sun-editor .se-list-layer .se-selector-color{display:flex;width:max-content;max-width:270px;height:auto;padding:0;margin:auto}.sun-editor .se-list-layer .se-selector-color .se-color-pallet{width:100%;height:100%;padding:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet li{display:flex;float:left;position:relative;margin:0}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button{display:block;cursor:default;width:30px;height:30px;text-indent:-9999px}.sun-editor .se-list-layer .se-selector-color .se-color-pallet button.active,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:focus,.sun-editor .se-list-layer .se-selector-color .se-color-pallet button:hover{border:3px solid #fff}.sun-editor .se-submenu-form-group{display:flex;width:100%;height:auto;padding:4px}.sun-editor .se-submenu-form-group input{flex:auto;display:inline-block;width:auto;height:33px;color:#555;font-size:12px;margin:1px 0;padding:0;border-radius:.25rem;border:1px solid #ccc}.sun-editor .se-submenu-form-group input:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor .se-submenu-form-group button{float:right;width:34px;height:34px;margin:0 0 0 4px!important}.sun-editor .se-submenu-form-group button.se-btn{border:1px solid #ccc}.sun-editor .se-submenu-form-group>div{position:relative}.sun-editor .se-submenu-form-group .se-color-input{width:72px;text-transform:uppercase;border:none;border-bottom:2px solid #b1b1b1;outline:none}.sun-editor .se-submenu-form-group .se-color-input:focus{border-bottom:3px solid #b1b1b1}.sun-editor .se-wrapper{position:relative!important;width:100%;height:auto;overflow:hidden;z-index:1}.sun-editor .se-wrapper .se-wrapper-inner{width:100%;height:100%;min-height:65px;overflow-y:auto;overflow-x:auto;-webkit-overflow-scrolling:touch;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-wrapper .se-wrapper-inner:focus{outline:none}.sun-editor .se-wrapper .se-wrapper-code{background-color:#191919;color:#fff;font-size:13px;word-break:break-all;padding:4px;margin:0;resize:none!important}.sun-editor .se-wrapper .se-wrapper-wysiwyg{background-color:#fff;display:block}.sun-editor .se-wrapper .se-wrapper-code-mirror{font-size:13px}.sun-editor .se-wrapper .se-placeholder{position:absolute;display:none;white-space:nowrap;text-overflow:ellipsis;z-index:1;color:#b1b1b1;font-size:13px;line-height:1.5;top:0;left:0;right:0;overflow:hidden;margin-top:0;padding-top:16px;padding-left:16px;margin-left:0;padding-right:16px;margin-right:0;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-resizing-bar{display:flex;width:auto;height:auto;min-height:16px;border-top:1px solid #dadada;padding:0 4px;background-color:#fafafa;cursor:ns-resize}.sun-editor .se-resizing-bar.se-resizing-none{cursor:default}.sun-editor .se-resizing-back{position:absolute;display:none;cursor:default;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-resizing-bar .se-navigation{flex:auto;position:relative;width:auto;height:auto;color:#666;margin:0;padding:0;font-size:10px;font-weight:700;line-height:1.5;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper{flex:none;position:relative;display:block;width:auto;height:auto;margin:0;padding:0;color:#999;font-size:13px;background:transparent}.sun-editor .se-resizing-bar .se-char-counter-wrapper.se-blink{color:#b94a48;animation:blinker .2s linear infinite}.sun-editor .se-resizing-bar .se-char-counter-wrapper .se-char-label{margin-right:4px}.sun-editor .se-dialog{position:absolute;display:none;top:0;left:0;width:100%;height:100%;z-index:2147483647}.sun-editor .se-dialog button,.sun-editor .se-dialog input,.sun-editor .se-dialog label{font-size:14px;line-height:1.5;color:#111;margin:0}.sun-editor .se-dialog .se-dialog-back{background-color:#222;opacity:.5}.sun-editor .se-dialog .se-dialog-back,.sun-editor .se-dialog .se-dialog-inner{position:absolute;width:100%;height:100%;top:0;left:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{position:relative;width:auto;max-width:500px;margin:20px auto;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:4px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}@media screen and (max-width:509px){.sun-editor .se-dialog .se-dialog-inner .se-dialog-content{width:100%}}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header{height:50px;padding:6px 15px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-dialog-close{float:right;font-weight:700;text-shadow:0 1px 0 #fff;-webkit-appearance:none;filter:alpha(opacity=100);opacity:1}.sun-editor .se-dialog .se-dialog-inner .se-dialog-header .se-modal-title{font-size:14px;font-weight:700;margin:0;padding:0;line-height:2.5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-body{position:relative;padding:15px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form{margin-bottom:10px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer{margin-top:10px;margin-bottom:0}.sun-editor .se-dialog .se-dialog-inner input:disabled{background-color:#f3f3f3}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text{width:100%}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-h,.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-text .size-w{width:70px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-size-x{margin:0 8px;width:25px;text-align:center}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}.sun-editor .se-dialog .se-dialog-inner .se-dialog-content .se-btn-primary{display:inline-block;padding:6px 12px;margin:0 0 10px!important;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;border-radius:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer{padding:10px 15px 0;text-align:right;border-top:1px solid #e5e5e5}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div{float:left}.sun-editor .se-dialog .se-dialog-inner .se-dialog-footer>div>label{margin-top:5px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-radio{margin-left:12px;margin-right:6px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-check{margin-left:12px;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form-footer .se-dialog-btn-check{margin-left:0;margin-right:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{width:auto}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control,.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select{display:inline-block;height:34px;font-size:14px;text-align:center;line-height:1.42857143;color:#000;border:1px solid #ccc;border-radius:4px;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-control{width:70px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form{display:block;width:100%;height:34px;font-size:14px;line-height:1.42857143;padding:0 4px;color:#000;border:1px solid #ccc;border-radius:4px;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form input:focus,.sun-editor .se-dialog .se-dialog-inner .se-dialog-form select:focus,.sun-editor .se-dialog .se-dialog-inner .se-dialog-form textarea:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-video-ratio{width:70px;margin-left:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form a{color:#004cff}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert{border:1px solid #ccc}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-dialog .se-dialog-inner .se-dialog-btn-revert:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-dialog-tabs{width:100%;height:25px;border-bottom:1px solid #e5e5e5}.sun-editor .se-dialog-tabs button{background-color:#e5e5e5;border-right:1px solid #e5e5e5;float:left;outline:none;padding:2px 13px;transition:.3s}.sun-editor .se-dialog-tabs button:hover{background-color:#fff}.sun-editor .se-dialog-tabs button.active{background-color:#fff;border-bottom:0}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-form.se-math-exp{resize:vertical;height:4rem;border:1px solid #ccc;font-size:13px;padding:4px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-input-select.se-math-size{width:6em;height:28px;margin-left:1em}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview{font-size:13px}.sun-editor .se-dialog .se-dialog-inner .se-dialog-form .se-math-preview>span{display:inline-block;-webkit-box-shadow:0 0 0 .1rem #c7deff;box-shadow:0 0 0 .1rem #c7deff}.sun-editor .se-controller .se-arrow.se-arrow-up{border-bottom-color:rgba(0,0,0,.25)}.sun-editor .se-controller{position:absolute;display:none;overflow:visible;z-index:4;border:1px solid rgba(0,0,0,.25);border-radius:4px;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.sun-editor .se-controller .se-btn-group{position:relative;display:flex;vertical-align:middle;padding:2px;top:0;left:0}.sun-editor .se-controller .se-btn-group .se-btn-group-sub{left:50%;min-width:auto;width:max-content;display:none}.sun-editor .se-controller .se-btn-group .se-btn-group-sub button{margin:0;min-width:72px}.sun-editor .se-controller .se-btn-group button{position:relative;min-height:34px;height:auto;border:none;border-radius:4px;margin:1px;padding:5px 10px;font-size:12px;line-height:1.5;display:inline-block;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation}.sun-editor .se-controller .se-btn-group button:focus:enabled,.sun-editor .se-controller .se-btn-group button:hover:enabled{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:active:enabled{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button span{display:block;padding:0;margin:0}.sun-editor .se-controller .se-btn-group button:enabled.active{color:#4592ff;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:focus,.sun-editor .se-controller .se-btn-group button:enabled.active:hover{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.active:active{background-color:#d1d1d1;border-color:#c1c1c1;-webkit-box-shadow:inset 0 3px 5px #c1c1c1;box-shadow:inset 0 3px 5px #c1c1c1}.sun-editor .se-controller .se-btn-group button:enabled.on{background-color:#e1e1e1;border-color:#d1d1d1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:focus,.sun-editor .se-controller .se-btn-group button:enabled.on:hover{background-color:#d1d1d1;border-color:#c1c1c1;outline:0 none}.sun-editor .se-controller .se-btn-group button:enabled.on:active{background-color:#c1c1c1;border-color:#b1b1b1;-webkit-box-shadow:inset 0 3px 5px #b1b1b1;box-shadow:inset 0 3px 5px #b1b1b1}.sun-editor .se-controller-resizing{margin-top:-50px!important;padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-resizing .se-btn-group .se-btn-group-sub.se-resizing-align-list{left:57px}.sun-editor .se-resizing-container{position:absolute;display:none;z-index:4;border:1px solid #80bdff;background-color:transparent}.sun-editor .se-resizing-container .se-modal-resize{position:absolute;display:inline-block;background-color:#3f9dff;opacity:.3}.sun-editor .se-resizing-container .se-resize-dot{position:absolute;top:0;left:0;width:100%;height:100%}.sun-editor .se-resizing-container .se-resize-dot>span{position:absolute;width:7px;height:7px;background-color:#3f9dff;border:1px solid #4592ff}.sun-editor .se-resizing-container .se-resize-dot>span.tl{top:-5px;left:-5px;cursor:nw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.tr{top:-5px;right:-5px;cursor:ne-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bl{bottom:-5px;left:-5px;cursor:sw-resize}.sun-editor .se-resizing-container .se-resize-dot>span.br{right:-5px;bottom:-5px;cursor:se-resize}.sun-editor .se-resizing-container .se-resize-dot>span.lw{left:-7px;bottom:50%;cursor:w-resize}.sun-editor .se-resizing-container .se-resize-dot>span.th{left:50%;top:-7px;cursor:n-resize}.sun-editor .se-resizing-container .se-resize-dot>span.rw{right:-7px;bottom:50%;cursor:e-resize}.sun-editor .se-resizing-container .se-resize-dot>span.bh{right:50%;bottom:-7px;cursor:s-resize}.sun-editor .se-resizing-container .se-resize-display{position:absolute;right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:#fff;background-color:#333;border-radius:4px}.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{width:auto}.sun-editor .se-controller-link,.sun-editor .se-controller-table,.sun-editor .se-controller-table-cell{padding:0;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143}.sun-editor .se-controller-link:after,.sun-editor .se-controller-link:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor .se-controller-link .link-content{padding:0;margin:0}.sun-editor .se-controller-link .link-content a{display:inline-block;color:#4592ff;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;margin-left:5px}.sun-editor .se-notice{position:relative;display:none;width:100%;height:auto;word-break:break-all;font-size:13px;color:#b94a48;background-color:#f2dede;padding:15px;margin:0;border:1px solid #eed3d7;user-select:text;-o-user-select:text;-moz-user-select:text;-khtml-user-select:text;-webkit-user-select:text;-ms-user-select:text}.sun-editor .se-notice button{float:right}.sun-editor .se-tooltip{position:relative;overflow:visible}.sun-editor .se-tooltip .se-tooltip-inner{visibility:hidden;position:absolute;display:block;width:auto;top:120%;left:50%;background:transparent;opacity:0;z-index:1;line-height:1.5;transition:opacity .5s;margin:0;padding:0;bottom:auto;float:none;pointer-events:none;backface-visibility:hidden;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text{position:relative;display:inline-block;width:auto;left:-50%;font-size:.9em;margin:0;padding:4px 6px;border-radius:2px;background-color:#333;color:#fff;text-align:center;line-height:unset;white-space:nowrap;cursor:auto}.sun-editor .se-tooltip .se-tooltip-inner .se-tooltip-text:after{content:"";position:absolute;bottom:100%;left:50%;margin-left:-5px;border:5px solid transparent;border-bottom-color:#333}.sun-editor .se-tooltip:hover .se-tooltip-inner{visibility:visible;opacity:1}@keyframes blinker{50%{opacity:0}}@keyframes spinner{to{transform:rotate(1turn)}}.sun-editor-editable{font-family:Helvetica Neue,sans-serif;font-size:13px;line-height:1.5;color:#333;text-align:left;background-color:#fff;word-break:break-all;word-wrap:break-word;padding:16px;margin:0}.sun-editor-editable *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sun-editor-editable audio,.sun-editor-editable figcaption,.sun-editor-editable figure,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable td,.sun-editor-editable th,.sun-editor-editable video{position:relative}.sun-editor-editable .__se__float-left{float:left}.sun-editor-editable .__se__float-right{float:right}.sun-editor-editable .__se__float-center{float:center}.sun-editor-editable .__se__float-none{float:none}.sun-editor-editable span{display:inline;vertical-align:baseline;margin:0;padding:0}.sun-editor-editable span.katex{display:inline-block}.sun-editor-editable[contenteditable=true] span.katex{outline:1px dashed #e1e1e1}.sun-editor-editable a{color:#004cff;text-decoration:none}.sun-editor-editable span[style~="color:"] a{color:inherit}.sun-editor-editable a:focus,.sun-editor-editable a:hover{cursor:pointer;color:#0093ff;text-decoration:underline}.sun-editor-editable pre{display:block;padding:8px;margin:0 0 10px;line-height:1.45;color:#666;background-color:#f9f9f9;border:1px solid #e1e1e1;border-radius:2px;white-space:pre-wrap;word-wrap:break-word;overflow:visible}.sun-editor-editable ol{list-style-type:decimal}.sun-editor-editable ol,.sun-editor-editable ul{display:block;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding-inline-start:40px}.sun-editor-editable ul{list-style-type:disc}.sun-editor-editable li{display:list-item;text-align:-webkit-match-parent;margin-bottom:5px}.sun-editor-editable ol ol,.sun-editor-editable ol ul,.sun-editor-editable ul ol,.sun-editor-editable ul ul{margin:0}.sun-editor-editable ol ol,.sun-editor-editable ul ol{list-style-type:lower-alpha}.sun-editor-editable ol ol ol,.sun-editor-editable ul ol ol,.sun-editor-editable ul ul ol{list-style-type:upper-roman}.sun-editor-editable ol ul,.sun-editor-editable ul ul{list-style-type:circle}.sun-editor-editable ol ol ul,.sun-editor-editable ol ul ul,.sun-editor-editable ul ul ul{list-style-type:square}.sun-editor-editable sub,.sun-editor-editable sup{font-size:75%;line-height:0}.sun-editor-editable sub{vertical-align:sub}.sun-editor-editable sup{vertical-align:super}.sun-editor-editable p{display:block;margin:0 0 10px}.sun-editor-editable div{display:block;margin:0;padding:0}.sun-editor-editable blockquote{display:block;font-family:inherit;font-size:inherit;color:#999;margin-block-start:1em;margin-block-end:1em;margin-inline-start:0;margin-inline-end:0;padding:0 5px 0 20px;border:solid #b1b1b1;border-width:0 0 0 5px}.sun-editor-editable blockquote blockquote{border-color:#c1c1c1}.sun-editor-editable blockquote blockquote blockquote{border-color:#d1d1d1}.sun-editor-editable blockquote blockquote blockquote blockquote{border-color:#e1e1e1}.sun-editor-editable h1{font-size:2em;margin-block-start:.67em;margin-block-end:.67em}.sun-editor-editable h1,.sun-editor-editable h2{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h2{font-size:1.5em;margin-block-start:.83em;margin-block-end:.83em}.sun-editor-editable h3{font-size:1.17em;margin-block-start:1em;margin-block-end:1em}.sun-editor-editable h3,.sun-editor-editable h4{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h4{font-size:1em;margin-block-start:1.33em;margin-block-end:1.33em}.sun-editor-editable h5{font-size:.83em;margin-block-start:1.67em;margin-block-end:1.67em}.sun-editor-editable h5,.sun-editor-editable h6{display:block;margin-inline-start:0;margin-inline-end:0;font-weight:700}.sun-editor-editable h6{font-size:.67em;margin-block-start:2.33em;margin-block-end:2.33em}.sun-editor-editable hr{display:flex;border-width:1px 0 0;border-color:#000;border-image:initial;height:1px}.sun-editor-editable hr.__se__solid{border-style:solid none none}.sun-editor-editable hr.__se__dotted{border-style:dotted none none}.sun-editor-editable hr.__se__dashed{border-style:dashed none none}.sun-editor-editable table{display:table;table-layout:auto;border:1px solid #ccc;width:100%;max-width:100%;margin:0 0 10px;background-color:transparent;border-spacing:0;border-collapse:collapse}.sun-editor-editable table thead{border-bottom:2px solid #333}.sun-editor-editable table tr{border:1px solid #efefef}.sun-editor-editable table th{background-color:#f3f3f3}.sun-editor-editable table td,.sun-editor-editable table th{border:1px solid #e1e1e1;padding:.4em;background-clip:padding-box}.sun-editor-editable table td.se-table-selected-cell,.sun-editor-editable table th.se-table-selected-cell{border:1px double #4592ff;background-color:#f1f7ff}.sun-editor-editable.se-disabled *{user-select:none;-o-user-select:none;-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none}.sun-editor-editable .se-component{display:flex;padding:1px;margin:0 0 10px}.sun-editor-editable .se-component.__se__float-left{margin:0 20px 10px 0}.sun-editor-editable .se-component.__se__float-right{margin:0 0 10px 20px}.sun-editor-editable[contenteditable=true] .se-component{outline:1px dashed #e1e1e1}.sun-editor-editable audio,.sun-editor-editable iframe,.sun-editor-editable img,.sun-editor-editable video{display:block;margin:0;padding:0;width:auto;height:auto;max-width:100%}.sun-editor-editable[contenteditable=true] figure:after{position:absolute;content:"";z-index:1;top:0;left:0;right:0;bottom:0;cursor:default;display:block;background:transparent}.sun-editor-editable[contenteditable=true] figure a,.sun-editor-editable[contenteditable=true] figure iframe,.sun-editor-editable[contenteditable=true] figure img{z-index:0}.sun-editor-editable[contenteditable=true] figure figcaption{display:block;z-index:2}.sun-editor-editable[contenteditable=true] figure figcaption:focus{border-color:#80bdff;outline:0;-webkit-box-shadow:0 0 0 .2rem #c7deff;box-shadow:0 0 0 .2rem #c7deff}.sun-editor-editable .se-image-container,.sun-editor-editable .se-video-container{width:auto;height:auto;max-width:100%}.sun-editor-editable figure{display:block;outline:none;margin:0;padding:0}.sun-editor-editable figure figcaption{padding:1em .5em;margin:0;background-color:#f9f9f9;outline:none}.sun-editor-editable figure figcaption p{line-height:2;margin:0}.sun-editor-editable .se-image-container a img{padding:1px;margin:1px;outline:1px solid #4592ff}.sun-editor-editable .se-video-container iframe{outline:1px solid #9e9e9e;position:absolute;top:0;left:0;border:0;width:100%;height:100%}.sun-editor-editable .se-video-container figure{left:0;width:100%;max-width:100%}.sun-editor-editable.se-show-block div,.sun-editor-editable.se-show-block h1,.sun-editor-editable.se-show-block h2,.sun-editor-editable.se-show-block h3,.sun-editor-editable.se-show-block h4,.sun-editor-editable.se-show-block h5,.sun-editor-editable.se-show-block h6,.sun-editor-editable.se-show-block li,.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block p,.sun-editor-editable.se-show-block pre,.sun-editor-editable.se-show-block ul{border:1px dashed #3f9dff!important;padding:14px 8px 8px!important}.sun-editor-editable.se-show-block ol,.sun-editor-editable.se-show-block ul{border:1px dashed #d539ff!important}.sun-editor-editable.se-show-block pre{border:1px dashed #27c022!important}.se-show-block p{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPAQMAAAAF7dc0AAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAaSURBVAjXY/j/gwGCPvxg+F4BQiAGDP1HQQByxxw0gqOzIwAAAABJRU5ErkJggg==") no-repeat}.se-show-block div{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAPAQMAAAAxlBYoAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j//wcDDH+8XsHwDYi/hwNx1A8w/nYLKH4XoQYJAwCXnSgcl2MOPgAAAABJRU5ErkJggg==") no-repeat}.se-show-block h1{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAfSURBVAjXY/j/v4EBhr+9B+LzEPrDeygfhI8j1CBhAEhmJGY4Rf6uAAAAAElFTkSuQmCC") no-repeat}.se-show-block h2{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAmSURBVAjXY/j/v4EBhr+dB+LtQPy9geEDEH97D8T3gbgdoQYJAwA51iPuD2haEAAAAABJRU5ErkJggg==") no-repeat}.se-show-block h3{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQPy9geHDeQgN5p9HqEHCADeWI+69VG2MAAAAAElFTkSuQmCC") no-repeat}.se-show-block h4{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPAQMAAADTSA1RAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j//wADDH97DsTXIfjDdiDdDMTfIRhZHRQDAKJOJ6L+K3y7AAAAAElFTkSuQmCC") no-repeat}.se-show-block h5{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAlSURBVAjXY/j/v4EBhr+1A/F+IO5vYPiwHUh/B2IQfR6hBgkDABlWIy5uM+9GAAAAAElFTkSuQmCC") no-repeat}.se-show-block h6{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAPAQMAAAA4f7ZSAAAABlBMVEWAgID////n1o2sAAAAAnRSTlP/AOW3MEoAAAAiSURBVAjXY/j/v4EBhr+dB+LtQLy/geFDP5S9HSKOrA6KAR9GIza1ptJnAAAAAElFTkSuQmCC") no-repeat}.se-show-block li{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAYAAADkmO9VAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA7SURBVDhPYxgFcNDQ0PAfykQBIHEYhgoRB/BpwCfHBKWpBkaggYxQGgOgBzyQD1aLLA4TGwWDGjAwAACR3RcEU9Ui+wAAAABJRU5ErkJggg==") no-repeat}.se-show-block ol{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABHSURBVDhPYxgFcNDQ0PAfhKFcFIBLHCdA1oBNM0kGEmMAPgOZoDTVANUNxAqQvURMECADRiiNAWCagDSGGhyW4DRrMAEGBgAu0SX6WpGgjAAAAABJRU5ErkJggg==") no-repeat}.se-show-block ul{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAMCAYAAABiDJ37AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVDhPYxgFDA0NDf+hTBSALI5LDQgwQWmqgVEDKQcsUBoF4ItFGEBXA+QzQpmDGjAwAAA8DQ4Lni6gdAAAAABJRU5ErkJggg==") no-repeat}.sun-editor-editable .__se__p-bordered,.sun-editor .__se__p-bordered{border-top:1px solid #b1b1b1;border-bottom:1px solid #b1b1b1;padding:4px 0}.sun-editor-editable .__se__p-spaced,.sun-editor .__se__p-spaced{letter-spacing:1px}.sun-editor-editable .__se__p-neon,.sun-editor .__se__p-neon{font-weight:200;font-style:italic;background:#000;color:#fff;padding:6px 4px;border:2px solid #fff;border-radius:6px;text-transform:uppercase;animation:neonFlicker 1.5s infinite alternate}@keyframes neonFlicker{0%,19%,21%,23%,25%,54%,56%,to{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 2px #f40,0 0 4px #f40,0 0 6px #f40,0 0 8px #f40,0 0 10px #f40;box-shadow:0 0 .5px #fff,inset 0 0 .5px #fff,0 0 2px #08f,inset 0 0 2px #08f,0 0 4px #08f,inset 0 0 4px #08f}20%,24%,55%{text-shadow:none;box-shadow:none}}.sun-editor-editable .__se__t-shadow,.sun-editor .__se__t-shadow{text-shadow:-.2rem -.2rem 1rem #fff,.2rem .2rem 1rem #fff,0 0 .2rem #999,0 0 .4rem #888,0 0 .6rem #777,0 0 .8rem #666,0 0 1rem #555} \ No newline at end of file diff --git a/dist/suneditor.min.js b/dist/suneditor.min.js index e228061e2..1cc03b8a0 100644 --- a/dist/suneditor.min.js +++ b/dist/suneditor.min.js @@ -1 +1 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var l=t[i]={i:i,l:!1,exports:{}};return e[i].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(i,l,function(t){return e[t]}.bind(null,l));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="XJR1")}({"1kvd":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"dialog",add:function(e){const t=e.context;t.dialog={kind:"",updateModal:!1,_closeSignal:!1};let n=e.util.createElement("DIV");n.className="se-dialog sun-editor-common";let i=e.util.createElement("DIV");i.className="se-dialog-back",i.style.display="none";let l=e.util.createElement("DIV");l.className="se-dialog-inner",l.style.display="none",n.appendChild(i),n.appendChild(l),t.dialog.modalArea=n,t.dialog.back=i,t.dialog.modal=l,t.dialog.modal.addEventListener("mousedown",this.onMouseDown_dialog.bind(e)),t.dialog.modal.addEventListener("click",this.onClick_dialog.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},onMouseDown_dialog:function(e){/se-dialog-inner/.test(e.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},onClick_dialog:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(e,t){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.dialog.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=t,"full"===this.context.option.popupDisplay?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const n=this.context[e].focusElement;"function"==typeof this.plugins[e].on&&this.plugins[e].on.call(this,t),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",n&&n.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const e=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,this.plugins[e].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return void 0===t&&(e.SUNEDITOR_MODULES||(e.SUNEDITOR_MODULES={}),e.SUNEDITOR_MODULES.dialog=n),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"3FqI":function(e,t,n){},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",url:"Media embed URL, YouTube"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow"}};return void 0===t&&(e.SUNEDITOR_LANG||(e.SUNEDITOR_LANG={}),e.SUNEDITOR_LANG.en=n),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',attachment:'',map:'',magic_stick:'',empty_file:'',more_horizontal:'',more_vertical:''},l={name:"align",display:"submenu",add:function(e,t){const n=i,l=e.context;l.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let s=this.setSubmenu.call(e),o=s.querySelector("ul");o.addEventListener("click",this.pickup.bind(e)),l.align._alignList=o.querySelectorAll("li button"),e.initMenuTarget(this.name,t,s),s=null,o=null},setSubmenu:function(){const e=this.lang,t=i,n=this.util.createElement("DIV");return n.className="se-list-layer",n.innerHTML='
",n},active:function(e){const t=this.context.align.targetButton,n=t.querySelector("svg");if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeIcon(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeIcon(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e';for(let e,t=0,i=l.length;t0&&(o+='
'+n(s)+"
",s=[]),"object"==typeof e&&(o+='
'+n(e)+"
")));return o+='
",o},_makeColorList:function(e){let t="";t+='
    ';for(let n,i=0,l=e.length;i');return t+="
",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},o={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([s]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let i=this.setSubmenu.call(e);n.fontColor.colorInput=i.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),i.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),i.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),i.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=i.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},a={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([s]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let i=this.setSubmenu.call(e);n.hiliteColor.colorInput=i.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),i.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),i.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),i.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=i.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},r={name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:i.list_bullets,number:i.list_number}};let l=this.setSubmenu.call(e),s=l.querySelector("ul");s.addEventListener("click",this.pickup.bind(e)),n.list._list=s.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,s=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
",t},active:function(e){const t=this.context.list.targetButton,n=t.querySelector("svg"),i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeIcon(n,this.context.list.icons.bullets):i.changeIcon(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeIcon(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}c.appendChild(t),a||(u=c),a&&m===g&&!l.isRangeFormatElement(f)||(d||(d=c),s&&a&&m===g||a&&l.isList(g)&&g===r||c.parentNode!==m&&m.insertBefore(c,f)),l.removeItem(n),s&&null===h&&(h=c.children.length-1),a&&(l.getRangeFormatElement(g,p)!==l.getRangeFormatElement(r,p)||l.isList(g)&&l.isList(r)&&l.getElementDepth(g)!==l.getElementDepth(r))&&(c=l.createElement(e)),_&&0===_.children.length&&l.removeItem(_)}else l.removeItem(n);h&&(d=d.children[h]),o&&(g=c.children.length-1,c.innerHTML+=r.innerHTML,u=c.children[g],l.removeItem(r))}else{if(n)for(let e=0,t=i.length;e=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}const t=l.getRangeFormatElement(s),o=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(l);o||(r=l.createElement(e));for(let t,s,d=0,u=i.length;d0){const e=l.cloneNode(!1),t=l.childNodes,s=this.util.getPositionIndex(i);for(;t[s];)e.appendChild(t[s]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(o);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],s=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;s=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),o=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,s=0,c=n;s span > span"),n.table.headerButton=o.querySelector("._se_table_header"),o.addEventListener("mousedown",(function(e){e.stopPropagation()}),!1);let a=this.setController_tableEditor.call(e);n.table.resizeDiv=a,n.table.splitMenu=a.querySelector(".se-btn-group-sub"),n.table.mergeButton=a.querySelector("._se_table_merge_button"),n.table.splitButton=a.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=a.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=a.querySelector("._se_table_insert_row_b"),a.addEventListener("mousedown",(function(e){e.stopPropagation()}),!1),s.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),s.addEventListener("click",this.appendTable.bind(e)),a.addEventListener("click",this.onClick_tableController.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,l),n.element.relative.appendChild(a),n.element.relative.appendChild(o),l=null,s=null,a=null,o=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
1 x 1
',e},setController_table:function(){const e=this.lang,t=i,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
",n},setController_tableEditor:function(){const e=this.lang,t=i,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table-cell",n.innerHTML='
  • '+e.controller.VerticalSplit+'
  • '+e.controller.HorizontalSplit+"
",n},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l,this.insertComponent(e,!1);const s=e.querySelector("td div");this.setRange(s,0,s,0),this.plugins.table.reset_table_picker.call(this)},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

",t}{let n="";for(;t>0;)n+="<"+e+">

",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";let i=t<5?5:t>9?10:t+1,l=n<5?5:n>9?10:n+1;this.context.table.tableUnHighlight.style.width=i+"em",this.context.table.tableUnHighlight.style.height=l+"em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="5em",t.height="5em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;ts||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)));if(s===o&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,s="row"===e;if(s){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(s)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,s=l.length;no&&o>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[s+1];if(e){const t=[];let n=r[s].cells,i=0;for(let e,l,s=0,o=n.length;s1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let s,o,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,s),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!s[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+o?h.push(e):p<=t+o&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+o,p,p+r):n>0&&(pt+o)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&s.length>0&&(p=this.plugins.table.createCells.call(this,s[0].nodeName,0,!0),p=e.insertBefore(p,s[t]))}}if(l){let e,t;for(let n,l=0,s=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,o.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let o,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:s+1,rs:d,row:-1}),i!==l&&u<=a&&u+s>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=s}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}o.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(s,o)+n;for(let e,t,n=0;n=a));c++)l=e[c],s=l.rowSpan-1,s>0&&s+n>=r&&o=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||s===o-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=o.cells;for(let e=0,t=a.length;e0&&o+s>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,o,o+s));else s.push(e[o]);for(let e=0,t=s.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},resizeTable:function(){const e=this.context.table,t=e.resizeButton.querySelector("svg"),n=e.resizeText;let i,l,s;e._maxWidth?(i=e.icons.reduction,l=e.minText,s="100%"):(i=e.icons.expansion,l=e.maxText,s="auto"),this.util.changeIcon(t,i),this.util.changeTxt(n,l),e._element.style.width=s},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,s=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=s.length;e0)for(let e,t=0;td||(u>=e.index?(s+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(o){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){o=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==s){c.cs=e,c.ce=t,c.rs=n,c.re=s,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),s+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e";return n+="",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},u=n("1kvd"),h=n.n(u),g={name:"link",display:"dialog",add:function(e){e.addModule([h.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",(function(e){e.stopPropagation()}),!1),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=i,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.link.focusElement.value.trim().length)return!1;const e=this.context.link,t=e.focusElement.value,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);e.appendChild(n),this.insertNode(e)}else this.insertNode(n);this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}this.history.push(!1),e.focusElement.value="",e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.focus()}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){e?this.context.link._linkAnchor&&(this.context.dialog.updateModal=!0,this.context.link.focusElement.value=this.context.link._linkAnchor.href,this.context.link.linkAnchorText.value=this.context.link._linkAnchor.textContent,this.context.link.linkNewWindowCheck.checked=!!/_blank/i.test(this.context.link._linkAnchor.target)):(this.plugins.link.init.call(this),this.context.link.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},p=n("ee5k"),m=n.n(p),f={name:"image",display:"dialog",add:function(e){e.addModule([h.a,m.a]);const t=e.context;t.image={sizeUnit:t.option._imageSizeUnit,_linkElement:null,_container:null,_cover:null,_element:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_defaultSizeX:"auto",_defaultSizeY:"auto",_origin_w:"auto"===t.option.imageWidth?"":t.option.imageWidth,_origin_h:"",_altText:"",_caption:null,captionCheckEl:null,_linkValue:"",_align:"none",_captionChecked:!1,_proportionChecked:!0,_floatClassRegExp:"__se__float\\-[a-z]+",_xmlHttp:null,_captionShow:!0,_resizing:t.option.imageResizing,_rotation:t.option.imageRotation,_resizeDotHide:!t.option.imageHeightShow,_uploadFileLength:0,_onlyPercentage:t.option.imageSizeOnlyPercentage,_ratio:!1,_ratioX:1,_ratioY:1};let n=this.setDialog.call(e);t.image.modal=n,t.image.imgInputFile=n.querySelector("._se_image_file"),t.image.imgUrlFile=n.querySelector("._se_image_url"),t.image.focusElement=t.image.imgInputFile||t.image.imgUrlFile,t.image.altText=n.querySelector("._se_image_alt"),t.image.imgLink=n.querySelector("._se_image_link"),t.image.imgLinkNewWindowCheck=n.querySelector("._se_image_link_check"),t.image.captionCheckEl=n.querySelector("._se_image_check_caption"),t.image.modal.querySelector(".se-dialog-tabs").addEventListener("click",this.openTab.bind(e)),t.image.modal.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),t.image.imgInputFile&&t.image.imgUrlFile&&t.image.imgInputFile.addEventListener("change",this._fileInputChange.bind(t.image)),t.image.proportion={},t.image.inputX={},t.image.inputY={},t.option.imageResizing&&(t.image.proportion=n.querySelector("._se_image_check_proportion"),t.image.inputX=n.querySelector("._se_image_size_x"),t.image.inputY=n.querySelector("._se_image_size_y"),t.image.inputX.value=t.option.imageWidth,t.image.inputX.addEventListener("keyup",this.setInputSize.bind(e,"x")),t.image.inputY.addEventListener("keyup",this.setInputSize.bind(e,"y")),t.image.inputX.addEventListener("change",this.setRatio.bind(e)),t.image.inputY.addEventListener("change",this.setRatio.bind(e)),t.image.proportion.addEventListener("change",this.setRatio.bind(e)),n.querySelector(".se-dialog-btn-revert").addEventListener("click",this.sizeRevert.bind(e))),t.dialog.modal.appendChild(n),n=null},setDialog:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");n.className="se-dialog-content",n.style.display="none";let l='
'+t.dialogBox.imageBox.title+'
';if(e.imageFileInput&&(l+='
'),e.imageUrlInput&&(l+='
'),l+='
',e.imageResizing){const n=e.imageSizeOnlyPercentage,s=n?' style="display: none !important;"':"",o=e.imageHeightShow?"":' style="display: none !important;"';l+='
',n||!e.imageHeightShow?l+='
":l+='
",l+=' '+t.dialogBox.proportion+'
"}return l+='
",n.innerHTML=l,n},_fileInputChange:function(){this.imgInputFile.value?this.imgUrlFile.setAttribute("disabled",!0):this.imgUrlFile.removeAttribute("disabled")},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,s,o;for(s=t.getElementsByClassName("_se_tab_content"),l=0;l0){let t=0;const n=[];for(let i=0,l=e.length;i0){let e=0;const n=this._variable._imagesInfo;for(let t=0,i=n.length;ti){const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return this._imageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t})&&this.functions.noticeOpen(n),void this.closeLoading()}}this.context.image._uploadFileLength=n.length;const l=this.context.option.imageUploadUrl,s=this.context.option.imageUploadHeader,o=this.context.dialog.updateModal?1:n.length,a={linkValue:this.context.image._linkValue,linkNewWindow:this.context.image.imgLinkNewWindowCheck.checked,inputWidth:this.context.image.inputX.value,inputHeight:this.context.image.inputY.value,align:this.context.image._align,isUpdate:this.context.dialog.updateModal,currentImage:this.context.image._element};if(!this._imageUploadBefore(n,a))return;if("string"==typeof l&&l.length>0){const e=new FormData;for(let t=0;t0)for(let e in s)this.context.image._xmlHttp.setRequestHeader(e,s[e]);this.context.image._xmlHttp.send(e)}else for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},submit:function(e){const t=this.context.image,n=this.plugins.image;this.showLoading(),e.preventDefault(),e.stopPropagation(),t._linkValue=t.imgLink.value,t._altText=t.altText.value,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked,t._resizing&&(t._proportionChecked=t.proportion.checked);try{this.context.dialog.updateModal&&n.update_image.call(this,!1,!1,!1),t.imgInputFile&&t.imgInputFile.files.length>0?n.onRender_imgInput.call(this):t.imgUrlFile&&t.imgUrlFile.value.trim().length>0?n.onRender_imgUrl.call(this):this.closeLoading()}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},setImagesInfo:function(e,t){const n=this._variable._imagesInfo;let i=e.getAttribute("data-index"),l=null,s="";if(!i||this._imagesInfoInit)s="create",i=this._variable._imageIndex,this._variable._imageIndex++,e.setAttribute("data-index",i),e.setAttribute("data-file-name",t.name),e.setAttribute("data-file-size",t.size),l={src:e.src,index:1*i,name:t.name,size:t.size},n.push(l);else{s="update",i*=1;for(let e=0,t=n.length;e-1||(n.splice(t,1),this._imageUpload(null,e,"delete",null,0),t--);this.context.resizing._resize_plugin=""},_onload_image:function(e,t){t&&(this.plugins.image.setImagesInfo.call(this,e,t),this.history.push(!0))},create_image:function(e,t,n,i,l,s,o){const a=this.context.image;this.context.resizing._resize_plugin="image";let r=this.util.createElement("IMG");r.addEventListener("load",this.plugins.image._onload_image.bind(this,r,o)),r.src=e,r.alt=a._altText,r=this.plugins.image.onRender_link.call(this,r,t,n),r.setAttribute("data-rotate","0"),a._resizing&&r.setAttribute("data-proportion",a._proportionChecked);const c=this.plugins.resizing.set_cover.call(this,r),d=this.plugins.resizing.set_container.call(this,c,"se-image-container");a._captionChecked&&(a._caption=this.plugins.resizing.create_caption.call(this),a._caption.setAttribute("contenteditable",!1),c.appendChild(a._caption)),a._element=r,a._cover=c,a._container=d,this.plugins.image.applySize.call(this,i,l),this.plugins.image.setAlign.call(this,s,r,c,d),this.insertComponent(d,!0),this.context.resizing._resize_plugin=""},update_image:function(e,t,n){const i=this.context.image,l=i._linkValue;let s,o=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,o=i._element.cloneNode(!0),a=this.plugins.resizing.set_cover.call(this,o)),null===r&&(a=a.cloneNode(!0),c=!0,r=this.plugins.resizing.set_container.call(this,a,"se-image-container")),c&&(r.innerHTML="",r.appendChild(a));const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;if(s=/%$/.test(o.style.width)?d!==r.style.width||u!==r.style.height:d!==o.style.width||u!==o.style.height,o.alt=i._altText,i._captionChecked?i._caption||(i._caption=this.plugins.resizing.create_caption.call(this),a.appendChild(i._caption)):i._caption&&(this.util.removeItem(i._caption),i._caption=null),l.trim().length>0)if(null!==i._linkElement)i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",o.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,o,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=o;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),o=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),o=r.querySelector("img"),i._element=o,i._cover=a,i._container=r}!i._onlyPercentage&&s&&!e&&(/\d+/.test(o.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,o):this.plugins.resizing.setTransformSize.call(this,o,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));if(i._resizing&&(o.setAttribute("data-proportion",i._proportionChecked),s&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,o,null,null),e&&this.plugins.image.setImagesInfo.call(this,o,{name:o.getAttribute("data-file-name")||o.src.split("/").pop(),size:o.getAttribute("data-file-size")||0}),t){this.plugins.image.init.call(this);const e=this.plugins.resizing.call_controller_resize.call(this,o,"image");this.plugins.image.onModifyMode.call(this,o,e)}n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.image.setImagesInfo.bind(this,t,n))},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile.value=t._element.src,t._altText=t.altText.value=t._element.alt,t._linkValue=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},on:function(e){if(!e){const e=this.context.image;e.inputX.value=e._origin_w=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=e._origin_h="",e.inputY.disabled=!0,e.proportion.disabled=!0}},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value),t||(t=n.inputY.value),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n){const i=this.context.image;this.plugins.image.cancelPercentAttr.call(this),i._element.style.width=this.util.isNumber(e)?e+i.sizeUnit:e,i._element.style.height=this.util.isNumber(t)?t+i.sizeUnit:/%$/.test(t)?"":t,"center"===i._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||i._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,i)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;if(this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),this.focusEdge(l),i>=0){const e=this._variable._imagesInfo;for(let t=0,n=e.length;t'+i.cancel+''+t.dialogBox.videoBox.title+'
';if(e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],s=e.videoRatio,o=e.videoSizeOnlyPercentage,a=o?' style="display: none !important;"':"",r=e.videoHeightShow?"":' style="display: none !important;"',c=e.videoRatioShow?"":' style="display: none !important;"',d=o||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';l+='
"}return l+='
",n.innerHTML=l,n},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._videoRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},_onload_video:function(e){this.plugins.video.setVideosInfo.call(this,e)},submitAction:function(){if(0===this.context.video.focusElement.value.trim().length)return!1;this.context.resizing._resize_plugin="video";const e=this.context.video;let t=null,n=null,i=null,l=e.focusElement.value.trim();if(e._align=e.modal.querySelector('input[name="suneditor_video_radio"]:checked').value,/^$/.test(l))t=(new this._w.DOMParser).parseFromString(l,"text/html").querySelector("iframe");else{if(t=this.util.createElement("IFRAME"),/youtu\.?be/.test(l)&&(/^http/.test(l)||(l="https://"+l),l=l.replace("watch?v=",""),/^\/\/.+\/embed\//.test(l)||(l=l.replace(l.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),e._youtubeQuery.length>0))if(/\?/.test(l)){const t=l.split("?");l=t[0]+"?"+e._youtubeQuery+"&"+t[1]}else l+="?"+e._youtubeQuery;t.src=l}this.context.dialog.updateModal?(e._element.src!==t.src&&(e._element.src=t.src),i=e._container,n=this.util.getParentElement(e._element,"FIGURE"),t=e._element):(t.frameBorder="0",t.allowFullscreen=!0,t.addEventListener("load",this.plugins.video._onload_video.bind(this,t)),e._element=t,n=this.plugins.resizing.set_cover.call(this,t),i=this.plugins.resizing.set_container.call(this,n,"se-video-container"),this._variable._videosCnt++),e._cover=n,e._container=i;const s=this.plugins.resizing._module_getSizeX.call(this,e)!==(e.inputX.value||e._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,e)!==(e.inputY.value||e._videoRatio),o=!this.context.dialog.updateModal||s;e._resizing&&(this.context.video._proportionChecked=e.proportion.checked,t.setAttribute("data-proportion",e._proportionChecked));let a=!1;o&&(a=this.plugins.video.applySize.call(this)),a&&"center"===e._align||this.plugins.video.setAlign.call(this,null,t,n,i),this.context.dialog.updateModal?e._resizing&&this.context.resizing._rotateVertical&&o&&this.plugins.resizing.setTransformSize.call(this,t,null,null):this.insertComponent(i,!1),this.context.resizing._resize_plugin="",this.context.dialog.updateModal&&this.history.push(!1)},setVideosInfo:function(e){if(!e.getAttribute("data-origin")){const t=this.util.getParentElement(e,this.util.isMediaComponent),n=this.util.getParentElement(e,"FIGURE"),i=this.plugins.resizing._module_getSizeX.call(this,this.context.video,e,n,t),l=this.plugins.resizing._module_getSizeY.call(this,this.context.video,e,n,t);e.setAttribute("data-origin",i+","+l),e.setAttribute("data-size",i+","+l)}},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();try{this.plugins.video.submitAction.call(this)}finally{this.plugins.dialog.close.call(this),this.closeLoading()}return this.focus(),!1},_update_videoCover:function(e){if(!e)return;const t=this.context.video;e.frameBorder="0",e.allowFullscreen=!0,e.onload=e.addEventListener("load",this.plugins.video._onload_video.bind(this,e));const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!1);const i=t._cover=this.plugins.resizing.set_cover.call(this,e),l=t._container=this.plugins.resizing.set_container.call(this,i,"se-video-container"),s=n.querySelector("figcaption");let o=null;s&&(o=this.util.createElement("DIV"),o.innerHTML=s.innerHTML,this.util.removeItem(s));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0]||this.context.option.videoWidth,a[1]||""),n.parentNode.replaceChild(l,n),o&&n.parentNode.insertBefore(o,l.nextElementSibling)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l;let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.focusElement.value=t._element.src,t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},on:function(e){if(!e){const e=this.context.video;e.inputX.value=e._origin_w=this.context.option.videoWidth===e._defaultSizeX?"":this.context.option.videoWidth,e.inputY.value=e._origin_h="",e.proportion.disabled=!0}},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,s=i.length;l0||!n.style.width)&&t._update_videoCover.call(this,n);this.context.resizing._resize_plugin=""},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.video)},applySize:function(e,t){const n=this.context.video;return e||(e=n.inputX.value),t||(t=n.inputY.value),n._onlyPercentage||/%$/.test(e)||!e?(this.plugins.video.setPercentSize.call(this,e||"100%",t||n._videoRatio),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.video.setSize.call(this,e,t||n._defaultRatio,!1):this.plugins.video.setAutoSize.call(this),!1)},setSize:function(e,t,n){const i=this.context.video;e=this.util.getNumber(e,0),t=this.util.isNumber(t)?t+i.sizeUnit:t||"",i._element.style.width=e?e+i.sizeUnit:"",i._cover.style.paddingBottom=i._cover.style.height=t,/%$/.test(t)?i._element.style.height="":i._element.style.height=t,n||i._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,i)},setAutoSize:function(){this.plugins.video.setPercentSize.call(this,100,this.context.video._defaultRatio)},setOriginSize:function(e){const t=this.context.video;t._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,t._element),this.plugins.video.cancelPercentAttr.call(this);const n=((e?t._element.getAttribute("data-size"):"")||t._element.getAttribute("data-origin")||"").split(",");if(n){const e=n[0],i=n[1];t._onlyPercentage||/%$/.test(e)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.video.setPercentSize.call(this,e,i):this.plugins.video.setSize.call(this,e,i),this.plugins.resizing._module_saveCurrentSize.call(this,t)}},setPercentSize:function(e,t){const n=this.context.video;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||n._videoRatio:this.util.isNumber(t)?t+"%":t,n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=t,n._cover.style.paddingBottom=t,n._element.style.width="100%",n._element.style.height="100%",n._element.style.maxWidth="","center"===n._align&&this.plugins.video.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.video;e._cover.style.width="",e._cover.style.height="",e._cover.style.paddingBottom="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.video._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.video.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.video;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width,n.style.height=n.style.paddingBottom,n.style.paddingBottom=this.util.getNumber(this.util.getNumber(n.style.paddingBottom,2)/100*this.util.getNumber(n.style.width,2),2)+"%"):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width||"100%",n.style.paddingBottom=n.style.height),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.video;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},destroy:function(){this._variable._videosCnt--;const e=this.context.video._container;let t=e.previousElementSibling||e.nextElementSibling;this.util.removeItem(e),this.plugins.video.init.call(this),this.controllersOff(),this.focusEdge(t),this.history.push(!1)},init:function(){const e=this.context.video;e.focusElement.value="",e._origin_w=this.context.option.videoWidth,e._origin_h="",e.modal.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,e._resizing&&(e.inputX.value=this.context.option.videoWidth===e._defaultSizeX?"":this.context.option.videoWidth,e.inputY.value="",e.proportion.checked=!0,e.proportion.disabled=!0,this.plugins.video.setVideoRatioSelect.call(this,e._defaultRatio))}},b={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:l,font:{name:"font",display:"submenu",add:function(e,t){const n=e.context;n.font={targetText:t.querySelector(".txt"),targetTooltip:t.parentNode.querySelector(".se-tooltip-text"),_fontList:null,currentFont:""};let i=this.setSubmenu.call(e);i.querySelector(".se-list-font-family").addEventListener("click",this.pickup.bind(e)),n.font._fontList=i.querySelectorAll("ul li button"),e.initMenuTarget(this.name,t,i),i=null},setSubmenu:function(){const e=this.context.option,t=this.lang,n=this.util.createElement("DIV");let i,l,s,o;n.className="se-list-layer";let a=e.font?e.font:["Arial","Comic Sans MS","Courier New","Impact","Georgia","tahoma","Trebuchet MS","Verdana"],r='
  • ";for(s=0,o=a.length;s";return r+="
",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,s=e.fontSizeUnit,o=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ",t},appendHr:function(e){const t=this.util.createElement("HR");t.className=e,this.focus();let n=this.insertComponent(t,!1);this.setRange(n,0,n,0)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;n&&(this.plugins.horizontalRule.appendHr.call(this,"__se__"+n),this.submenuOff())}},list:r,table:c,formatBlock:{name:"formatBlock",display:"submenu",add:function(e,t){const n=e.context;n.formatBlock={targetText:t.querySelector(".txt"),targetTooltip:t.parentNode.querySelector(".se-tooltip-text"),_formatList:null,currentFormat:""};let i=this.setSubmenu.call(e);i.querySelector("ul").addEventListener("click",this.pickUp.bind(e)),n.formatBlock._formatList=i.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null},setSubmenu:function(){const e=this.context.option,t=this.lang.toolbar,n=this.util.createElement("DIV");n.className="se-submenu se-list-layer";const i=["p","div","blockquote","pre","h1","h2","h3","h4","h5","h6"],l=e.formats&&0!==e.formats.length?e.formats:i;let s='
      ';for(let e,n,o,a,r,c,d,u=0,h=l.length;u-1?(n=e.toLowerCase(),o="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),o=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),s+='
    • ";return s+="
    ",n.innerHTML=s,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,s=e.nodeName.toLowerCase(),o=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=a.isComponent(i),s=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),o=a.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(a.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,o?o.nextSibling:null),t=i.parentNode),r=n.nextSibling,r&&n.nodeName===r.nodeName&&a.isSameAttributes(n,r)&&(n.innerHTML+="
    "+r.innerHTML,a.removeItem(r)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!s||!c||/
    $/i.test(s)?s:s+"
    ")+c,0===u){t.insertBefore(n,i),r=i.nextSibling,r&&n.nodeName===r.nodeName&&a.isSameAttributes(n,r)&&(n.innerHTML+="
    "+r.innerHTML,a.removeItem(r));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&a.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,a.removeItem(n))}d||a.removeItem(i),s&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,o=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()).style.lineHeight+"";if(n!==e.currentSize){for(let e=0,i=t.length;e"}return s+="",t.innerHTML=s,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,s,o=0,a=t.length;o'+i.cancel+''+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},_renderMathExp:function(e){this.previewElement.innerHTML=this._renderer(e.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",t),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=function(e,n){if(e.classList.contains(n))return e;const i=e.parentNode;return i!==document.body?i.classList.contains(n)?i:void t(i,n):void 0},i=t(e._mathExp,"katex");i.parentNode.replaceChild(n,i),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);t.appendChild(n),this.insertNode(t)}else this.insertNode(n);const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=e._mathExp.getAttribute("data-exp"),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=e._renderer(t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.context.math._mathExp.getAttribute("data-exp"),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}}},v=n("P6u4"),y=n.n(v);const x={_d:document,_w:window,_tagConvertor:function(e){const t={b:"strong",i:"em",u:"ins",strike:"del",s:"del"};return e.replace(/(<\/?)(b|strong|i|em|u|ins|s|strike|del)\b\s*(?:[^>^<]+)?\s*(?=>)/gi,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":""","<":"<",">":">"};return e.replace(/&|\u00A0|'|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:"​",zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",s="js"===t?"src":"href";let o="(?:";for(let t=0,n=e.length;t0?i[0][s]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e?this.getIframeDocument(e):this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},isWysiwygDiv:function(e){return!(!e||1!==e.nodeType||!this.hasClass(e,"se-wrapper-wysiwyg")&&!/^BODY$/i.test(e.nodeName))},isFormatElement:function(e){return!(!e||1!==e.nodeType||!/^(P|DIV|H[1-6]|PRE|LI)$/i.test(e.nodeName)&&!this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)")||this.isComponent(e)||this.isWysiwygDiv(e))},isRangeFormatElement:function(e){return!(!e||1!==e.nodeType||!/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)&&!this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isFreeFormatElement:function(e){return!(!e||1!==e.nodeType||!/^PRE$/i.test(e.nodeName)&&!this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)")||this.isComponent(e)||this.isWysiwygDiv(e))},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;t0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const s=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==s;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const o=t&&/iframe/i.test(t.nodeName);return{left:n+(o?t.parentElement.offsetLeft:0),top:i-s.scrollTop+(o?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},removeItem:function(e){if(e)try{e.remove()}catch(t){e.parentNode.removeChild(e)}},removeItemAllParents:function(e,t,n){if(!e)return null;let i=null;return t||(t=function(e){if(e===n||this.isComponent(e))return!1;const t=e.textContent.trim();return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(this)),function e(n){if(!x.isWysiwygDiv(n)){const l=n.parentNode;l&&t(n)&&(i={sc:n.previousElementSibling,ec:n.nextElementSibling},x.removeItem(n),e(l))}}(e),i},detachNestedList:function(e,t){const n=this.__deleteNestedList(e);let i,l,s;if(n){i=n.cloneNode(!1),l=n.childNodes;const t=this.getPositionIndex(e);for(;l[t];)i.appendChild(l[t])}else i=e;if(t)s=this.getListChildren(i,function(e){return this.isListCell(e)&&!e.previousElementSibling}.bind(this));else{const t=this.getElementDepth(e)+2;s=this.getListChildren(e,function(e){return this.isListCell(e)&&!e.previousElementSibling&&this.getElementDepth(e)===t}.bind(this))}for(let e=0,t=s.length;e=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,o=l,l=c.cloneNode(!1),s=c.childNodes,o&&(this.isListCell(l)&&this.isList(o)&&o.firstElementChild&&(l.innerHTML=o.firstElementChild.innerHTML,x.removeItem(o.firstElementChild),o.children.length>0&&l.appendChild(o)),l.appendChild(o));s[a];)l.appendChild(s[a]);const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this;let l=null;return t&&t.length>0&&(l=this._w.Array.apply(null,new this._w.Array(t.length)).map(this._w.Number.prototype.valueOf,0)),function e(s,o,a){const r=s.childNodes;for(let c,d,u=0,h=r.length;u=0;){if(i.getArrayIndex(l.childNodes,n)!==e[a]){r=!1;break}n=c.parentNode,l=n.parentNode,a--}r&&(e.splice(o,1),e[o]=u)}}i.copyTagAttributes(c,s),s.parentNode.insertBefore(c,s),i.removeItem(s)}if(!d){1===c.nodeType&&e(c,o+1,u);break}if(c.nodeName===d.nodeName&&i.isSameAttributes(c,d)&&c.href===d.href){const e=c.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=c.lastChild,r=d.firstChild;if(s&&r){const e=3===s.nodeType&&3===r.nodeType;let i=s.textContent.length,c=s.previousSibling;for(;c&&3===c.nodeType;)i+=c.textContent.length,c=c.previousSibling;if(n>0&&3===s.nodeType&&3===r.nodeType&&(s.textContent.length>0||r.textContent.length>0)&&n--,t){let c=null;for(let d in t)if(c=t[d],c&&c[o]>u){if(o>0&&c[o-1]!==a)continue;c[o]-=1,c[o+1]>=0&&c[o]===u&&(c[o+1]+=n,e&&s&&3===s.nodeType&&r&&3===r.nodeType&&(l[d]+=i))}}}3===c.nodeType?c.textContent+=d.textContent:c.innerHTML+=d.innerHTML,i.removeItem(d),u--}else 1===c.nodeType&&e(c,o+1,u)}}(e,0,0),l},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e'}return n}()+("auto"===e.height?"":"");l.allowFullscreen=!0,l.frameBorder=0,l.addEventListener("load",(function(){this.setAttribute("scrolling","auto"),this.contentDocument.head.innerHTML=''+t,this.contentDocument.body.className="sun-editor-editable",this.contentDocument.body.setAttribute("contenteditable",!0)}))}else l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable";l.style.height=e.height,l.style.minHeight=e.minHeight,l.style.maxHeight=e.maxHeight;const s=document.createElement("TEXTAREA");s.className="se-wrapper-inner se-wrapper-code",s.style.display="none",s.style.height=e.height,s.style.minHeight=e.minHeight,s.style.maxHeight=e.maxHeight,"auto"===e.height&&(s.style.overflow="hidden");let o=null,a=null,r=null;if(e.resizingBar&&(o=document.createElement("DIV"),o.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",o.appendChild(a),e.charCounter)){const t=document.createElement("DIV");if(t.className="se-char-counter-wrapper",r=document.createElement("SPAN"),r.className="se-char-counter",r.textContent="0",t.appendChild(r),e.maxCharCount>0){const n=document.createElement("SPAN");n.textContent=" / "+e.maxCharCount,t.appendChild(n)}o.appendChild(t)}let c=null;return e.placeholder&&(c=document.createElement("SPAN"),c.className="se-placeholder",c.innerText=e.placeholder),{bottomBar:{resizingBar:o,navigation:a,charCounter:r},wysiwygFrame:l,codeView:s,placeholder:c}},_initOptions:function(e,t){t.lang=t.lang||y.a,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?C.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.stickyToolbar=/balloon/i.test(t.mode)?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?C.getNumber(t.stickyToolbar,0):-1,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.maxCharCount=C.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?C.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(C.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(C.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?C.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(C.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(C.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?C.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl=t.imageUploadUrl||null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?C.getNumber(t.imageUploadSizeLimit,0):null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&C.getNumber(t.videoWidth)?C.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"100%",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=C.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]]},_defaultButtons:function(e){const t=i;return{bold:["_se_command_bold",e.toolbar.bold+" (CTRL+B)","STRONG","",t.bold],underline:["_se_command_underline",e.toolbar.underline+" (CTRL+U)","INS","",t.underline],italic:["_se_command_italic",e.toolbar.italic+" (CTRL+I)","EM","",t.italic],strike:["_se_command_strike",e.toolbar.strike+" (CTRL+SHIFT+S)","DEL","",t.strike],subscript:["_se_command_subscript",e.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",e.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",e.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",e.toolbar.indent+" (CTRL+])","indent","",t.outdent],outdent:["_se_command_outdent",e.toolbar.outdent+" (CTRL+[)","outdent","",t.indent],fullScreen:["code-view-enabled",e.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["",e.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["code-view-enabled",e.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo",e.toolbar.undo+" (CTRL+Z)","undo","",t.undo],redo:["_se_command_redo",e.toolbar.redo+" (CTRL+Y / CTRL+SHIFT+Z)","redo","",t.redo],preview:["",e.toolbar.preview,"preview","",t.preview],print:["",e.toolbar.print,"print","",t.print],save:["_se_command_save",e.toolbar.save,"save","",t.save],blockquote:["",e.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",e.toolbar.font,"font","submenu",''+e.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",e.toolbar.formats,"formatBlock","submenu",''+e.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",e.toolbar.fontSize,"fontSize","submenu",''+e.toolbar.fontSize+""+t.arrow_down],fontColor:["",e.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",e.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",e.toolbar.align,"align","submenu",t.align_left],list:["",e.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",e.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",e.toolbar.table,"table","submenu",t.table],lineHeight:["",e.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",e.toolbar.template,"template","submenu",t.template],paragraphStyle:["",e.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",e.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",e.toolbar.link,"link","dialog",t.link],image:["",e.toolbar.image,"image","dialog",t.image],video:["",e.toolbar.video,"video","dialog",t.video],math:["",e.toolbar.math,"math","dialog",t.math]}},_createModuleGroup:function(e){const t=C.createElement("DIV");t.className="se-btn-module"+(e?"":" se-btn-module-border");const n=C.createElement("UL");return n.className="se-menu-list",t.appendChild(n),{div:t,ul:n}},_createButton:function(e,t,n,i,l,s){const o=C.createElement("LI"),a=C.createElement("BUTTON");return a.setAttribute("type","button"),a.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),a.setAttribute("data-command",n),a.setAttribute("data-display",i),l+=''+t+"",s&&a.setAttribute("disabled",!0),a.innerHTML=l,o.appendChild(a),{li:o,button:a}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const s=e.createElement("DIV");s.className="se-toolbar sun-editor-common";const o=this._defaultButtons(i),a={},r={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n0){for(let e=0;e":n),this.history.push(!0)},_nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(s.iframe)this._nativeFocus();else try{const e=this.getRange();if(e.startContainer===e.endContainer&&r.isWysiwygDiv(e.startContainer)){const e=r.createElement("P"),t=r.createElement("BR");e.appendChild(t),this.setRange(t,0,0,t)}else this.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}catch(e){this._nativeFocus()}u._applyTagEffects(),d._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(e){if(r.isComponent(e)){const t=e.querySelector("IMG"),n=e.querySelector("IFRAME");t?this.selectComponent(t,"image"):n&&this.selectComponent(n,"video")}else(e=r.getChildElement(e,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(e,e.textContent.length,e,e.textContent.length):this._nativeFocus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const l=this._wd.createRange();try{l.setStart(e,t),l.setEnd(n,i)}catch(e){this._nativeFocus()}const s=this.getSelection();s.removeAllRanges&&s.removeAllRanges(),s.addRange(l),this._editorRange()},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)t.indexOf(i)>-1?n[i].active.call(d,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active")},getRange:function(){return this._variable._range||this._createDefaultRange()},getSelection:function(){return this._ww.getSelection()},getSelectionNode:function(){return this._variable._selectionNode&&!r.isWysiwygDiv(this._variable._selectionNode)||this._editorRange(),this._variable._selectionNode||e.element.wysiwyg.firstChild},_editorRange:function(){const e=this.getSelection();let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){e.element.wysiwyg.focus();const t=this._wd.createRange();return e.element.wysiwyg.firstChild||this.execCommand("formatBlock",!1,"P"),t.setStart(e.element.wysiwyg.firstChild,0),t.setEnd(e.element.wysiwyg.firstChild,0),t},_resetRangeToTextNode:function(){const t=this.getRange();let n,i,l,s=t.startContainer,o=t.startOffset,a=t.endContainer,c=t.endOffset;if(n=r.isWysiwygDiv(s)?e.element.wysiwyg.firstChild:s,i=o,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n);e===r.getRangeFormatElement(e)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&(s===a&&(a=n,c=1),r.removeItem(s))}}if(s=n,o=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||s,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n);e===r.getRangeFormatElement(e)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&r.removeItem(a)}}a=n,c=i,this.setRange(s,o,a,c)},getSelectedElements:function(t){this._resetRangeToTextNode();let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return null;this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,s=n.commonAncestorContainer,o=r.getListChildren(s,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(s)||r.isRangeFormatElement(s)||o.unshift(r.getFormatElement(s)),i===l||1===o.length)return o;let a=r.getFormatElement(i),c=r.getFormatElement(l),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=o.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode()),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t){const n=this.removeNode();let i=null,l=this.getSelectionNode(),s=r.getFormatElement(l);if(r.isListCell(s))if(/^HR$/i.test(e.nodeName)){const t=r.createElement("LI"),n=r.createTextNode(r.zeroWidthSpace);t.appendChild(e),t.appendChild(n),s.parentNode.insertBefore(t,s.nextElementSibling),this.setRange(n,1,n,1)}else this.insertNode(e,l===s?null:n.container.nextSibling),e.nextSibling||e.parentNode.appendChild(r.createElement("BR")),i=r.createElement("LI"),s.parentNode.insertBefore(i,s.nextElementSibling);else{if(this.getRange().collapsed&&(3===n.container.nodeType||r.isBreak(n.container))){const e=r.getParentElement(n.container,function(e){return this.isRangeFormatElement(e)}.bind(r));i=r.splitElement(n.container,n.offset,e?r.getElementDepth(e)+1:0),i&&(s=i.previousSibling)}this.insertNode(e,s),i||(i=this.appendFormatTag(e,r.isFormatElement(s)?s:null))}return this.setRange(i,0,i,0),t||this.history.push(!1),i},selectComponent:function(e,t){if("image"===t){if(!d.plugins.image)return;d.removeRange(),d.callPlugin("image",(function(){const t=d.plugins.resizing.call_controller_resize.call(d,e,"image");d.plugins.image.onModifyMode.call(d,e,t),r.getParentElement(e,".se-image-container")||(d.plugins.image.openModify.call(d,!0),d.plugins.image.update_image.call(d,!0,!0,!0))}))}else if("video"===t){if(!d.plugins.video)return;d.removeRange(),d.callPlugin("video",(function(){const t=d.plugins.resizing.call_controller_resize.call(d,e,"video");d.plugins.video.onModifyMode.call(d,e,t)}))}},insertNode:function(e,t){const n=this.getRange(),i=n.startContainer,l=n.startOffset,s=n.endContainer,o=n.endOffset,a=n.commonAncestorContainer;let c=null,d=null;if(t)c=t.parentNode,t=t.nextSibling,d=!0;else if(c=i,3===i.nodeType&&(c=i.parentNode),n.collapsed)if(3===a.nodeType)t=a.textContent.length>o?a.splitText(o):a.nextSibling;else if(r.isBreak(c))t=c,c=c.parentNode;else{let n=c.childNodes[l];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(c.removeChild(i),t=null):t=null}else{if(i===s){t=this.isEdgePoint(s,o)?s.nextSibling:s.splitText(o);let e=i;this.isEdgePoint(i,l)||(e=i.splitText(l)),c.removeChild(e)}else for(this.removeNode(),c=a,t=s;t&&t.parentNode!==a;)t=t.parentNode}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(c)&&r.isComponent(e))if(r.isList(t))c=t,t=null;else if(!d&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container))?e.container:r.getFormatElement(e.container)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);c=i?n:n.parentNode,t=i?null:n.nextSibling}t===a&&r.isBreak(t)&&!r.isBreak(e)&&(t=t.nextSibling),c.insertBefore(e,t)}catch(t){c.appendChild(e)}finally{let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||3!==t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||3!==n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;return t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n)),{startOffset:i.length,endOffset:e.textContent.length-l.length}}if(!r.isBreak(e)&&r.isFormatElement(c)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t),this.history.push(!0)}},removeNode:function(){const e=this.getRange();let t,n=0,i=e.startContainer,l=e.endContainer;const s=e.startOffset,o=e.endOffset,a=e.commonAncestorContainer;let c=null,d=null;const u=r.getListChildNodes(a);let h=r.getArrayIndex(u,i),g=r.getArrayIndex(u,l);if(u.length>0&&h>-1&&g>-1){for(let e=h+1,t=i;e>=0;e--)u[e]===t.parentNode&&u[e].firstChild===t&&0===s&&(h=e,t=t.parentNode);for(let e=g-1,t=l;e>h;e--)u[e]===t.parentNode&&1===u[e].nodeType&&(u.splice(e,1),t=t.parentNode,--g)}else{if(0===u.length){if(r.isFormatElement(a)||r.isRangeFormatElement(a)||r.isFormatElement(a))return{container:a,offset:0};u.push(a),i=l=a}else if(i=l=u[0],r.isBreak(i))return{container:i,offset:0};h=g=0}function p(e){const t=r.getFormatElement(e);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n)}}}for(let e=h;e<=g;e++){const t=u[e];if(0===t.length||3===t.nodeType&&void 0===t.data)p(t);else if(t!==i)t!==l?p(t):(d=1===l.nodeType?r.createTextNode(l.textContent):r.createTextNode(l.substringData(o,l.length-o)),d.length>0?l.data=d.data:p(l));else if(1===i.nodeType?c=r.createTextNode(i.textContent):t===l?(c=r.createTextNode(i.substringData(0,s)+l.substringData(o,l.length-o)),n=s):c=r.createTextNode(i.substringData(0,s)),c.length>0?i.data=c.data:p(i),t===l)break}return t=l&&l.parentNode?l:i&&i.parentNode?i:e.endContainer||e.startContainer,this.setRange(t,n,t,n),this.history.push(!0),{container:t,offset:n}},applyRangeFormatElement:function(e){const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,s,o,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,s=t.indexOf(i),o=t.indexOf(l),t.splice(s,o-s+1),c=t.length}else;let n,i,l,s=t[t.length-1];n=r.isRangeFormatElement(s)||r.isFormatElement(s)?s:r.getRangeFormatElement(s)||r.getFormatElement(s),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let o=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,s,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],s=n.parentNode,s&&!e.contains(s))if(u=r.getElementDepth(n),r.isList(s)){if(null===a&&(p?(a=p,m=!0,p=null):a=s.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==s){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=s.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(s,c,null,!0,!0);o>=u?(o=u,l=_.cc,i=d(l,s,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(o=u,l=s,i=n.nextSibling),e.appendChild(n),l!==s&&(h=d(l,s),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const s=this.getRange(),o=s.startOffset,a=s.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const s=(b?n:l).childNodes;let o=n.cloneNode(!1),a=null,c=null;for(;s[0];)c=s[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(o)?o.appendChild(c):(o.childNodes.length>0&&(a||(a=o),t.insertBefore(o,i),o=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(o.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(o)&&r.isList(i))if(m){for(a=i;i;)o.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(o,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else t.insertBefore(o,i);a||(a=o)}return a}for(let l,s,o,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(o&&r.getElementDepth(l)!==r.getElementDepth(o)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),s=t.childNodes;for(;s[0]&&(!r.isList(s[0])||n);)l.appendChild(s[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(_){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),t?(h=l,u||(u=l)):u||(u=h=l))}const y=e.parentNode;let x=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,x),n?u=n.previousSibling:u||(u=e.previousSibling),x=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let C=null;if(i)C={cc:y,sc:u,ec:x,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);C={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return C;!i&&C&&(t?this.setRange(C.sc,o,C.ec,a):this.setRange(C.sc,0,C.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,s=null,o=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const s=!e,o=s&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(o&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&"false"===c.getAttribute("contenteditable"))return;if(l.collapsed&&!o&&1===c.nodeType&&!r.isBreak(c)){let e=null;const t=c.childNodes[d];t&&(t.nextSibling?e=r.isBreak(t)?t:t.nextSibling:(c.removeChild(t),e=null));const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d],d=0),r.isFormatElement(u)&&(u=u.childNodes[h],h=u.textContent.length),s&&(e=r.createElement("DIV"));const g=e.nodeName;if(!o&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let p,m={},f={},_="",b="",v="";if(t){for(let e,n=0,i=t.length;n0&&(c=l.replace(_,"").trim(),c!==l&&(y.v=!0));const d=t.className;let u="";return b&&d.length>0&&(u=d.replace(b,"").trim(),u!==d&&(y.v=!0)),(!s||!b&&d||!_&&l||c||u||!n)&&(c||u||t.nodeName!==g||a.Boolean(_)!==a.Boolean(l)||a.Boolean(b)!==a.Boolean(d))?(_&&l.length>0&&(t.style.cssText=c),t.style.cssText||t.removeAttribute("style"),b&&d.length>0&&(t.className=u.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==g&&!n?t:(y.v=!0,null)):(y.v=!0,null)},C=this.getSelectedElements();r.getFormatElement(c)||(c=r.getChildElement(C[0],(function(e){return 3===e.nodeType})),d=0),r.getFormatElement(u)||(u=r.getChildElement(C[C.length-1],(function(e){return 3===e.nodeType})),h=u.textContent.length);const w=r.getFormatElement(c)===r.getFormatElement(u),E=C.length-(w?0:1);p=e.cloneNode(!1);const N=o||s&&function(e,t){for(let n=0,i=e.length;n0&&(p=e.cloneNode(!1),f=this._nodeChange_endLine(C[E],p,x,u,h,o,s,y,S,T));for(let t=E-1;t>0;t--)p=e.cloneNode(!1),this._nodeChange_middleLine(C[t],p,x,o,s,y);p=e.cloneNode(!1),m=this._nodeChange_startLine(C[0],p,x,c,d,o,s,y,S,T),E<=0&&(f=m)}this.controllersOff(),this.setRange(m.container,m.offset,f.container,f.offset),this.history.push(!1)},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t){return t&&!e?this.getParentElement(t,function(e){return this._isMaintainedNode(e)}.bind(this)):null},_util_isMaintainedNode:function(e,t){return t&&!e&&3!==t.nodeType&&this._isMaintainedNode(t)},_nodeChange_oneLine:function(e,t,n,i,l,s,o,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===s.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(s.textContent.slice(o))){const e=m.childNodes;let n=!0;for(let t,l,o,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const s=i.childNodes;for(let i,o=0,a=s.length;o=S?L-S:N.data.length-S));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(s)||l.appendChild(s);const a=g(l);for(a&&(E=a),E&&(e=E),x=d,y=[],w="";x!==e&&x!==f&&null!==x;)i=p(x)?null:n(x),i&&1===x.nodeType&&A(x)&&(y.push(i),w+=x.style.cssText.substr(0,x.style.cssText.indexOf(":"))+"|"),x=x.parentNode;const c=y.pop()||o;for(C=x=c;y.length>0;)x=y.pop(),C.appendChild(x),C=x;if(t.appendChild(c),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),N=o,S=0,k=!0,x!==o&&x.appendChild(N),!v)continue}if(z||d!==T){if(k){if(1===d.nodeType&&!r.isBreak(d)){r._isIgnoreNodeChange(d)?(b.appendChild(d),o--,a--,u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(d,d);continue}x=d,y=[],w="";const s=[];for(;null!==x.parentNode&&x!==f&&x!==t;)i=z?x.cloneNode(!1):n(x),1===x.nodeType&&!r.isBreak(d)&&i&&A(x)&&(i&&(p(i)?E||s.push(i):y.push(i)),w+=x.style.cssText.substr(0,x.style.cssText.indexOf(":"))+"|"),x=x.parentNode;y=y.concat(s);const c=y.pop()||d;for(C=x=c;y.length>0;)x=y.pop(),C.appendChild(x),C=x;if(p(t.parentNode)&&!p(c)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),z||E||!p(c))c===d?l=z?b:t:z?(b.appendChild(c),l=x):(t.appendChild(c),l=x);else{t=t.cloneNode(!1);const e=c.childNodes;for(let n=0,i=e.length;n0?x:t}if(E&&3===d.nodeType)if(g(d)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}h=d.cloneNode(!1),l.appendChild(h),1!==d.nodeType||r.isBreak(d)||(m=h),e(d,m)}else{E=g(d);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){x=d,w="",y=[];const t=[];for(;x!==b&&x!==f&&null!==x;)1===x.nodeType&&A(x)&&(p(x)?t.push(x.cloneNode(!1)):y.push(x.cloneNode(!1)),w+=x.style.cssText.substr(0,x.style.cssText.indexOf(":"))+"|"),x=x.parentNode;for(y=y.concat(t),h=C=x=y.pop()||e;y.length>0;)x=y.pop(),C.appendChild(x),C=x;b.appendChild(h),x.textContent=e.data}if(E&&h){const e=g(h);e&&(E=e)}for(x=d,y=[],w="";x!==b&&x!==f&&null!==x;)i=p(x)?null:n(x),i&&1===x.nodeType&&A(x)&&(y.push(i),w+=x.style.cssText.substr(0,x.style.cssText.indexOf(":"))+"|"),x=x.parentNode;const s=y.pop()||l;for(C=x=s;y.length>0;)x=y.pop(),C.appendChild(x),C=x;E?((t=t.cloneNode(!1)).appendChild(s),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(s),T=l,L=l.data.length,z=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),x!==l&&x.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{startContainer:i,startOffset:l,endContainer:s,endOffset:o};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?N=T=t:(N=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(N=T=t)}r.removeEmptyNode(b,t),u&&(S=N.textContent.length,L=T.textContent.length);const B=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=N),L=B?T.textContent.length:L;const H={s:0,e:0},M=r.getNodePath(N,b,H),I=!T.parentNode;I&&(T=N);const R={s:0,e:0},D=r.getNodePath(T,b,I||B?null:R);S+=H.s,L=u?S:I?N.textContent.length:B?L+H.s:L+R.s;const O=r.mergeSameTags(b,[M,D],!0);return e.parentNode.replaceChild(b,e),N=r.getNodeFromPath(M,b),T=r.getNodeFromPath(D,b),{startContainer:N,startOffset:S+O[0],endContainer:T,endOffset:L+O[1]}},_nodeChange_startLine:function(e,t,n,i,l,s,o,a,c,d){let u=i.parentNode;for(;!(u.nextSibling||u.previousSibling||r.isFormatElement(u.parentNode)||r.isWysiwygDiv(u.parentNode))&&u.nodeName!==t.nodeName;)u=u.parentNode;if(!o&&u.nodeName===t.nodeName&&!r.isFormatElement(u)&&!u.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let e=!0,n=i.previousSibling;for(;n;){if(!r.onlyZeroWidthSpace(n)){e=!1;break}n=n.previousSibling}if(e)return r.copyTagAttributes(u,t),{container:i,offset:l}}a.v=!1;const h=e,g=[t],p=e.cloneNode(!1);let m,f,_,b,v=i,y=l,x=!1;if(function e(i,l){const s=i.childNodes;for(let i,o=0,a=s.length;o0,y=m.pop()||u;for(_=f=y;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t)),!b&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)f=m.pop(),_.appendChild(f),_=f;d!==l?(t.appendChild(d),l=f):l=t,r.isBreak(u)&&t.appendChild(u.cloneNode(!1)),e.appendChild(t),v=o,y=0,x=!0,l.appendChild(v)}}}(e,p),o&&!s&&!a.v)return{container:i,offset:l};if(s=s&&o)for(let e=0;e0&&c===d)return void(e.innerHTML=n.innerHTML)}s.v=!1;const o=e.cloneNode(!1),a=[t];let c=!0;if(function e(i,l){const s=i.childNodes;for(let i,d=0,u=s.length;d0&&(o.appendChild(t),t=t.cloneNode(!1)),o.appendChild(h),o.appendChild(t),a.push(t),l=t,d--,u--)}}(e,t),!c&&(!l||i||s.v)){if(o.appendChild(t),i&&l)for(let e=0;e0,v=m.pop()||a;for(_=f=v;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(v)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(v)){t=t.cloneNode(!1);const e=v.childNodes;for(let n=0,i=e.length;n0?f:t}else u?(t.insertBefore(v,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(x||a!==v)i=x?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),s=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const o=m.pop()||l;for(_=f=o;m.length>0;)f=m.pop(),_.appendChild(f),_=f;o!==l?(t.insertBefore(o,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=s,y=s.data.length,x=!0,l.insertBefore(v,l.firstChild)}}}(e,p),o&&!s&&!a.v)return{container:i,offset:l};if(s=s&&o)for(let e=0;e0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(s,a,o,c),this.history.push(!1)},toggleDisabledButtons:function(e){const t=this.codeViewDisabledButtons;for(let n=0,i=t.length;n0?e.element.code.scrollHeight+"px":"auto"),s.codeMirrorEditor&&s.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus()),this._checkPlaceholder()},_setCodeDataToEditor:function(){const t=this._getCodeView();if(s.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(s.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,l=e.element.editorArea,d=e.element.wysiwygFrame,h=e.element.code,g=this._variable;g.isFullScreen?(g.isFullScreen=!1,d.style.cssText=g._wysiwygOriginCssText,h.style.cssText=g._codeOriginCssText,i.style.cssText="",l.style.cssText=g._editorAreaOriginCssText,n.style.cssText=g._originCssText,o.body.style.overflow=g._bodyOverflow,s.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),g._fullScreenAttrs.sticky&&(g._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=g._fullScreenAttrs.inline,this._isBalloon=g._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),u.onScroll_window(),r.changeIcon(t.querySelector("svg"),c.expansion)):(g.isFullScreen=!0,g._fullScreenAttrs.inline=this._isInline,g._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(g._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),g._bodyOverflow=o.body.style.overflow,o.body.style.overflow="hidden",g._editorAreaOriginCssText=l.style.cssText,g._wysiwygOriginCssText=d.style.cssText,g._codeOriginCssText=h.style.cssText,l.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],h.style.cssText=(h.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=h.style.height="100%",i.style.position="relative",i.style.display="block",g.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,l.style.height=g.innerHeight_fullScreen+"px",r.changeIcon(t.querySelector("svg"),c.reduction),s.iframe&&"auto"===s.height&&(l.style.overflow="auto",this._iframeAutoHeight()))},print:function(){const t=r.createElement("IFRAME");t.style.display="none",o.body.appendChild(t);const n=r.getIframeDocument(t),i=this.getContents(!0);if(s.iframe){const t=r.getIframeDocument(e.element.wysiwygFrame),l=s.fullPage?r.getAttributesToString(t.body,["contenteditable"]):'class="sun-editor-editable"';n.write(""+t.head.innerHTML+""+i+"")}else{const e=r.createElement("DIV"),t=r.createElement("STYLE");t.innerHTML=r.getPageStyle(),e.className="sun-editor-editable",e.innerHTML=i,n.head.appendChild(t),n.body.appendChild(e)}try{if(t.focus(),-1!==a.navigator.userAgent.indexOf("MSIE")||o.documentMode||a.StyleMedia)try{t.contentWindow.document.execCommand("print",!1,null)}catch(e){t.contentWindow.print()}else t.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{r.removeItem(t)}},preview:function(){const t=this.getContents(!0),n=a.open("","_blank");if(n.mimeType="text/html",s.iframe){const i=r.getIframeDocument(e.element.wysiwygFrame),l=s.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';n.document.write(""+i.head.innerHTML+""+t+"")}else n.document.write(''+l.toolbar.preview+"'+t+"")},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),d._variable.isCodeView){const e=this.convertHTMLForCodeView(n);d._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,d.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const l=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=l.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},cleanHTML:function(e,t){const n=new this._w.RegExp("^(meta|script|link|style|[a-z]+:[a-z]+)$","i"),i=this._d.createRange().createContextualFragment(e).childNodes;let l="";for(let e,t=0,s=i.length;t"+e.textContent.trim()+"

    ":n.test(e.nodeName)||(l+=1===e.nodeType?e.outerHTML:3===e.nodeType?e.textContent:"");return l=l.replace(/<(script|style).*>(\n|.)*<\/(script|style)>/g,"").replace(this.editorTagsWhitelistRegExp,"").replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),n)for(let e=0,i=n.length;e^<]*)>/g,"")),l=r.htmlRemoveWhiteSpace(l),r._tagConvertor(l?t?l.replace("string"==typeof t?r.createTagsWhitelist(t):t,""):l:e)},addDocEvent:function(e,t,n){o.addEventListener(e,t,n),s.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){o.removeEventListener(e,t),s.iframe&&this._wd.removeEventListener(e,t)},convertContentsForEditor:function(e){let t="",n=this._d.createRange().createContextualFragment(e).childNodes;for(let e,i,l=0,s=n.length;l"+i.textContent.trim()+"

    "}else e=i.outerHTML||i.textContent;if(3===i.nodeType){const n=e.split(/\n/g);let i="";for(let e=0,l=n.length;e0&&(t+="

    "+i+"

    ")}else t+=r.htmlRemoveWhiteSpace(e)}return 0===t.length&&(t="

    "+((e=r._HTMLConvertor(e)).length>0?e:"
    ")+"

    "),r._tagConvertor(t.replace(this.editorTagsWhitelistRegExp,""))},convertHTMLForCodeView:function(e){let t="";const n=this._w.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),s="string"==typeof e?this._d.createRange().createContextualFragment(e):e;let o=1*this._variable.codeIndent;return o=o>0?new this._w.Array(o+1).join(" "):"",function e(s,a,c){const d=s.childNodes,u=i.test(s.nodeName),h=u?a:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",c=!l(g)||u||/^(TH|TD)$/i.test(s.nodeName)?"":"\n",3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^(HR)$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(c||(u?"":p))+(h||m?a:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,a+o,""),t+=(m?a:"")+""+(c||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(s,"","\n"),t.trim()+"\n"},_charCount:function(t,n){const i=e.element.charCounter;if(!i)return!0;(!t||t<0)&&(t=0);const l=s.maxCharCount;if(a.setTimeout((function(){i.textContent=e.element.wysiwyg.textContent.length})),l>0){let s=!1;const o=e.element.wysiwyg.textContent.length;if(o>l){d._editorRange();const e=d.getRange(),t=e.endOffset-1,n=d.getSelectionNode().textContent;d.getSelectionNode().textContent=n.slice(0,e.endOffset-1)+n.slice(e.endOffset,n.length),d.setRange(e.endContainer,t,e.endContainer,t),s=!0}else o+t>l&&(s=!0);if(s)return n&&!r.hasClass(i,"se-blink")&&(r.addClass(i,"se-blink"),a.setTimeout((function(){r.removeClass(i,"se-blink")}),600)),!1}return!0},_checkComponents:function(){this.plugins.image&&(this.initPlugins.image?this.plugins.image.checkImagesInfo.call(this):this.callPlugin("image",this.plugins.image.checkImagesInfo.bind(this))),this.plugins.video&&(this.initPlugins.video?this.plugins.video.checkVideosInfo.call(this):this.callPlugin("video",this.plugins.video.checkVideosInfo.bind(this)))},_resetComponents:function(){this._variable._imagesInfo=[],this._variable._imageIndex=0,this._variable._videosCnt=0},_setCodeView:function(t){s.codeMirrorEditor?s.codeMirrorEditor.getDoc().setValue(t):e.element.code.value=t},_getCodeView:function(){return s.codeMirrorEditor?s.codeMirrorEditor.getDoc().getValue():e.element.code.value},_init:function(i,l){this._ww=s.iframe?e.element.wysiwygFrame.contentWindow:a,this._wd=s.iframe?e.element.wysiwygFrame.contentDocument:o,s.iframe&&"auto"===s.height&&(this._iframeAuto=this._wd.body),this._allowHTMLComments=s._editorTagsWhitelist.indexOf("//")>-1,this.editorTagsWhitelistRegExp=r.createTagsWhitelist(s._editorTagsWhitelist.replace("|//","")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(s.pasteTagsWhitelist);const c=s.attributesWhitelist,g={};let p,m,f="";if(c){const e=a.Object.keys(c);for(let t,n=0,i=e.length;nr&&(c=c.slice(0,r),o&&o.setAttribute("disabled",!0)),c[r]=i?{contents:n,s:{path:l.getNodePath(i.startContainer,null,null),offset:i.startOffset},e:{path:l.getNodePath(i.endContainer,null,null),offset:i.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===r&&s&&s.removeAttribute("disabled"),e._checkComponents(),e._charCount(0,!1),t()}return{stack:c,push:function(t){n.setTimeout(e._resourcesStateChange),t&&!a||(n.clearTimeout(a),t)?a=n.setTimeout((function(){n.clearTimeout(a),a=null,u()}),350):u()},undo:function(){r>0&&(r--,d())},redo:function(){c.length-1>r&&(r++,d())},go:function(e){r=e<0?c.length-1:e,d()},reset:function(n){s&&s.setAttribute("disabled",!0),o&&o.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),c.splice(0),r=0,c[r]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_destroy:function(){a&&n.clearTimeout(a),c=null}}}(this,u._onChange_historyStack),this._initWysiwygArea(i,l),a.setTimeout(function(){if(this._checkComponents(),this._imagesInfoInit=!1,this._imagesInfoReset=!1,this.history.reset(!0),this._iframeAutoHeight(),this._checkPlaceholder(),"function"==typeof h.onload)return h.onload(this,i)}.bind(this))},_initWysiwygArea:function(t,n){s.defaultStyle&&(e.element.wysiwyg.style.cssText=s.defaultStyle),t?n&&(e.element.wysiwyg.innerHTML=n):e.element.wysiwyg.innerHTML=this.convertContentsForEditor(e.element.originElement.value)},_resourcesStateChange:function(){d._iframeAutoHeight(),d._checkPlaceholder()},_iframeAutoHeight:function(){this._iframeAuto&&(e.element.wysiwygFrame.style.height=this._iframeAuto.offsetHeight+"px")},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){const t=this.getRange().commonAncestorContainer,n=r.getRangeFormatElement(t);let i,l,s;if(n)return s=r.createElement(e||"P"),s.innerHTML=n.innerHTML,0===s.childNodes.length&&(s.innerHTML="
    "),n.innerHTML=s.outerHTML,s=n.firstElementChild,i=r.getEdgeChildNodes(s,null).sc,i||(i=r.createTextNode(r.zeroWidthSpace),s.insertBefore(i,s.firstChild)),l=i.textContent.length,void this.setRange(i,l,i,l);if(r.isRangeFormatElement(t)&&t.childNodes.length<=1){let e=null;1===t.childNodes.length&&r.isBreak(t.firstChild)?e=t.firstChild:(e=r.createElement("BR"),t.appendChild(e)),this.setRange(e,0,e,0)}if(this.execCommand("formatBlock",!1,e||"P"),i=r.getEdgeChildNodes(t,t),i=i?i.ec:t,s=r.getFormatElement(i),!s)return this.removeRange(),void this._editorRange();if(r.isBreak(s.nextSibling)&&r.removeItem(s.nextSibling),r.isBreak(s.previousSibling)&&r.removeItem(s.previousSibling),r.isBreak(i)){const e=r.createTextNode(r.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e}l=3===i.nodeType?i.textContent.length:1,this.setRange(i,l,i,l)}},u={_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|INS|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":n="STRONG";break;case"S":t&&(n="DEL");break;case"U":n="INS";break;case"I":n="EM";break;case"Z":n=t?"redo":"undo";break;case"Y":n="redo";break;case"[":n="outdent";break;case"]":n="indent"}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,l=this._onButtonsCheck,o=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(o.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===o.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(o.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):l.test(h)&&(o.push(h),r.addClass(i[h],"active"))}for(let e in i)o.indexOf(e)>-1||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),s.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},onMouseDown_toolbar:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^input|textarea$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/se-toolbar/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.focus(),d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if("false"===e.element.wysiwyg.getAttribute("contenteditable"))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}))}d._isBalloon&&u._hideToolbar(),h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if("false"===e.element.wysiwyg.getAttribute("contenteditable"))return;if(t.stopPropagation(),/^FIGURE$/i.test(n.nodeName)){const e=n.querySelector("IMG"),i=n.querySelector("IFRAME");if(e)return t.preventDefault(),void d.selectComponent(e,"image");if(i)return t.preventDefault(),void d.selectComponent(i,"video")}const i=r.getParentElement(n,"FIGCAPTION");if(i&&(!i.getAttribute("contenteditable")||"false"===i.getAttribute("contenteditable"))&&(t.preventDefault(),i.setAttribute("contenteditable",!0),i.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),i.removeEventListener("blur",e)};i.addEventListener("blur",e)}d._editorRange(),a.setTimeout(d._editorRange.bind(d));const l=d.getSelectionNode(),s=r.getFormatElement(l),o=r.getRangeFormatElement(l);if(!d.getRange().collapsed||s&&s!==o||"false"===n.getAttribute("contenteditable"))u._applyTagEffects();else{if(r.isList(o)){const e=r.createElement("LI"),t=l.nextElementSibling;e.appendChild(l),o.insertBefore(e,t)}else r.isWysiwygDiv(l)||r.isComponent(l)||d._setDefaultFormat(r.isRangeFormatElement(o)?"DIV":"P");t.preventDefault(),d.focus()}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();"table"===d.currentControllerName||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let s;if(d._isBalloonAlways&&n.collapsed)s=!0;else if(l.focusNode===l.anchorNode)s=l.focusOffseti.offsetWidth?i.offsetWidth-u:b";const e=m.attributes;for(;e[0];)m.removeAttribute(e[0].name);return d.execCommand("formatBlock",!1,"P"),!1}if(m&&c.startContainer===c.endContainer&&3===o.nodeType&&!r.isFormatElement(o.parentNode)&&(c.collapsed?1===o.textContent.length:c.endOffset-c.startOffset===o.textContent.length)){t.preventDefault();let e=null,n=o.parentNode.previousSibling;const i=o.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),m.appendChild(n))),r.removeItem(o.parentNode),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=c.commonAncestorContainer;if(m=r.getFormatElement(c.startContainer),f=r.getRangeFormatElement(m),f&&m&&!r.isCell(f)&&!/^FIGCAPTION$/i.test(f.nodeName)){if(r.isListCell(m)&&r.isList(f)&&(r.isListCell(f.parentNode)||m.previousElementSibling)&&(o===m||3===o.nodeType&&(!o.previousSibling||r.isList(o.previousSibling)))&&(r.getFormatElement(c.startContainer)!==r.getFormatElement(c.endContainer)?f.contains(c.startContainer):0===c.startOffset&&c.collapsed)){if(c.startContainer!==c.endContainer)t.preventDefault(),d.removeNode(),3===c.startContainer.nodeType&&d.setRange(c.startContainer,c.startContainer.textContent.length,c.startContainer,c.startContainer.textContent.length),d.history.push(!0);else{let e=m.previousElementSibling||f.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(m)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===f.parentNode?f.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),f.parentNode.insertBefore(i,f.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,s=m.childNodes;let o=i,a=s[0];for(;a=s[0];)e.insertBefore(a,o.nextSibling),o=a;r.removeItem(m),0===f.children.length&&r.removeItem(f),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!g&&0===c.startOffset){let e=!0,i=n;for(;i&&i!==f&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&f.parentNode){t.preventDefault(),d.detachRangeFormatElement(f,r.isListCell(m)?[m]:null,null,!1,!1),d.history.push(!0);break}}}if(!g&&0===c.startOffset&&(r.isComponent(n.previousSibling)||3===n.nodeType&&!n.previousSibling&&0===c.startOffset&&0===c.endOffset&&r.isComponent(m.previousSibling))){const e=m.previousSibling;r.removeItem(e);break}g&&u._rangedeleteAssistant(c.startContainer,c.endContainer);break;case 46:if(p){t.preventDefault(),t.stopPropagation(),d.plugins[p].destroy.call(d);break}if((r.isFormatElement(o)||null===o.nextSibling)&&c.startOffset===o.textContent.length){let e=m.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){t.preventDefault(),r.onlyZeroWidthSpace(m)&&r.removeItem(m),(r.hasClass(e,"se-component")||/^IMG$/i.test(e.nodeName))&&(t.stopPropagation(),r.hasClass(e,"se-image-container")||/^IMG$/i.test(e.nodeName)?(e=/^IMG$/i.test(e.nodeName)?e:e.querySelector("img"),d.selectComponent(e,"image")):r.hasClass(e,"se-video-container")&&d.selectComponent(e.querySelector("iframe"),"video"));break}}if(m=r.getFormatElement(c.startContainer),f=r.getRangeFormatElement(m),r.isListCell(m)&&r.isList(f)&&(o===m||3===o.nodeType&&(!o.nextSibling||r.isList(o.nextSibling))&&(r.getFormatElement(c.startContainer)!==r.getFormatElement(c.endContainer)?f.contains(c.endContainer):c.endOffset===o.textContent.length&&c.collapsed))){c.startContainer!==c.endContainer&&d.removeNode();let e=r.getArrayItem(m.children,r.isList,!1);if(e=e||m.nextElementSibling||f.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)m.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)m.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}g&&u._rangedeleteAssistant(c.startContainer,c.endContainer);break;case 9:if(t.preventDefault(),l||s||r.isWysiwygDiv(o))break;const _=!c.collapsed||d.isEdgePoint(c.startContainer,c.startOffset),b=d.getSelectedElements();o=d.getSelectionNode();const v=[];let y=[],x=r.isListCell(b[0]),C=r.isListCell(b[b.length-1]),w={sc:c.startContainer,so:c.startOffset,ec:c.endContainer,eo:c.endOffset};for(let e,t=0,n=b.length;t0&&_&&d.plugins.list)w=d.plugins.list.editInsideList.call(d,i,v);else{const e=r.getParentElement(o,r.isCell);if(e&&_){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let s=n[l];if(!s)break;s=s.firstElementChild||s,d.setRange(s,0,s,0);break}y=y.concat(v),x=C=null}if(y.length>0)if(i){const e=y.length-1;for(let t,n=0;n<=e;n++){t=y[n].childNodes;for(let e,n=0,i=t.length;n0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(o.textContent)&&r.isBreak(s)&&(r.isBreak(s.previousSibling)||!r.onlyZeroWidthSpace(s.previousSibling.textContent))&&(!a||!r.isBreak(a)&&r.onlyZeroWidthSpace(a.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(o);const t=d.appendFormatTag(E,r.isFormatElement(E.nextElementSibling)?E.nextElementSibling:null);r.copyFormatAttributes(t,E),d.setRange(t,1,t,1);break}if(e){h.insertHTML(c.collapsed&&r.isBreak(c.startContainer.childNodes[c.startOffset-1])?"
    ":"

    ",!0);let e=n.focusNode;const t=n.focusOffset;E===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(g)break;if(f&&m&&!r.isCell(f)&&!/^FIGCAPTION$/i.test(f.nodeName)){const e=d.getRange();if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(m.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(f.parentNode)){f=m.parentNode.parentNode.parentNode;const t=r.splitElement(m,null,r.getElementDepth(m)-2);e=r.createElement("LI"),f.insertBefore(e,t)}else{const t=r.isCell(f.parentNode)?"DIV":r.isList(f.parentNode)?"LI":r.isFormatElement(f.nextElementSibling)?f.nextElementSibling.nodeName:r.isFormatElement(f.previousElementSibling)?f.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(f,[m],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,m),r.removeItemAllParents(m,null),d.setRange(e,1,e,1);break}}if(f&&r.getParentElement(f,"FIGCAPTION")&&r.getParentElement(f,r.isList)&&(t.preventDefault(),m=d.appendFormatTag(m,null),d.setRange(m,0,m,0)),p){t.preventDefault(),t.stopPropagation();const n=e[p],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let s=null;r.isListCell(i.parentNode)?s=r.createElement("BR"):(s=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),s.innerHTML="
    "),i.parentNode.insertBefore(s,i),d.callPlugin(p,(function(){const e=d.plugins.resizing.call_controller_resize.call(d,n._element,p);d.plugins[p].onModifyMode.call(d,n._element,e)}))}}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(m,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}const _=!(l||s||g||u._nonTextKeyCode.test(n));if(_&&c.collapsed&&c.startContainer===c.endContainer&&r.isBreak(c.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null)}d._charCount(1,_)||_&&(t.preventDefault(),t.stopPropagation()),h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n,l=e.altKey;let s=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(s)&&""===s.textContent){e.preventDefault(),e.stopPropagation(),s.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",s.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),d._checkComponents(),void d.history.push(!1)}const o=r.getFormatElement(s),a=r.getRangeFormatElement(s);(o||!t.collapsed)&&o!==a||r.isComponent(s)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),s=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects(),d._checkComponents();const c=!i&&!l&&!u._nonTextKeyCode.test(n);if(c&&3===s.nodeType&&r.zeroWidthRegExp.test(s.textContent)){let e=t.startOffset,n=t.endOffset;const i=(s.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,s.textContent=s.textContent.replace(r.zeroWidthRegExp,""),d.setRange(s,e<0?0:e,s,n<0?0:n)}d._charCount(0,c)||1===e.key.length&&(e.preventDefault(),e.stopPropagation()),!i&&!l&&!u._historyIgnoreKeyCode.test(n)&&d.history.push(!0),h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._isBalloon&&u._hideToolbar(),h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!1,(d._isInline||d._isBalloon)&&u._hideToolbar(),h.onBlur&&h.onBlur(e,d))},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",o.addEventListener("mousemove",u._resize_editor),o.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",o.removeEventListener("mousemove",u._resize_editor),o.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+l?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+l+s.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=l&&u._onStickyToolbar()},_getStickyOffsetTop:function(){let t=e.element.topArea,n=0;for(;t;)n+=t.offsetTop,t=t.offsetParent;return n},_onStickyToolbar:function(){const t=e.element;d._isInline||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=s.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},onPaste_wysiwyg:function(e){const t=e.clipboardData;if(!t)return!0;const n=d._charCount(t.getData("text/plain").length,!0),i=d.cleanHTML(t.getData("text/html"),d.pasteTagsWhitelistRegExp);return("function"!=typeof h.onPaste||h.onPaste(e,i,n,d))&&n?void(i?(e.stopPropagation(),e.preventDefault(),h.insertHTML(i,!0)):d.history.push(!0)):(e.preventDefault(),e.stopPropagation(),!1)},onCut_wysiwyg:function(){a.setTimeout((function(){d._resourcesStateChange(),d._charCount(0,!1),d.history.push(!1)}))},onDragOver_wysiwyg:function(e){e.preventDefault()},onDrop_wysiwyg:function(t){const n=t.dataTransfer;if(!n)return!0;const i=n.files;if(i.length>0&&d.plugins.image)u._setDropLocationSelection(t),d.callPlugin("image",(function(){e.image.imgInputFile.files=i,d.plugins.image.onRender_imgInput.call(d),e.image.imgInputFile.files=null}));else{if(!d._charCount(n.getData("text/plain").length,!0))return t.preventDefault(),t.stopPropagation(),!1;{const e=d.cleanHTML(n.getData("text/html"),d.pasteTagsWhitelistRegExp);e&&(u._setDropLocationSelection(t),h.insertHTML(e,!0))}}h.onDrop&&h.onDrop(t,d)},_setDropLocationSelection:function(e){e.stopPropagation(),e.preventDefault();const t=d.getRange();d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(d.getContents(!0),d)},_rangedeleteAssistant:function(e,t){e=r.getParentElement(e,function(e){return e.getAttribute&&("false"===e.getAttribute("contenteditable")||this.isComponent(e))}.bind(r)),t=r.getParentElement(t,function(e){return e.getAttribute&&("false"===e.getAttribute("contenteditable")||this.isComponent(e))}.bind(r)),a.setTimeout(function(e,t){e&&(this.removeItem(e),e===t)||t&&this.removeItem(t)}.bind(r,e,t))},_addEvent:function(){const t=s.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u.onMouseDown_toolbar,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("dragover",u.onDragOver_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==s.height||s.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(s.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),s.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=s.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u.onMouseDown_toolbar),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("dragover",u.onDragOver_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)}},h={core:d,util:r,onload:null,onScroll:null,onMouseDown:null,onClick:null,onKeyDown:null,onKeyUp:null,onDrop:null,onChange:null,onPaste:null,onFocus:null,onBlur:null,showInline:null,showController:null,imageUploadHandler:null,onImageUploadBefore:null,onImageUpload:null,onImageUploadError:null,setOptions:function(i){u._removeEvent(),d.plugins=i.plugins||d.plugins;const o=[i,i].reduce((function(e,t){for(let n in t)if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:a.Object.keys(i).map((function(e){return i[e]})),l=l.length?l:a.Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}),r=w._setOptions(o,e,d.plugins,i);r.callButtons&&(t=r.callButtons,d.initPlugins={}),r.plugins&&(d.plugins=n=r.plugins);const c=e.element.wysiwyg.innerHTML,h=e.element,g={_top:h.topArea,_relative:h.relative,_toolBar:h.toolbar,_editorArea:h.editorArea,_wysiwygArea:h.wysiwygFrame,_codeArea:h.code,_placeholder:h.placeholder,_resizingBar:h.resizingBar,_navigation:h.navigation,_charCounter:h.charCounter,_loading:h.loading,_resizeBack:h.resizeBackground,_stickyDummy:h._stickyDummy,_arrow:h._arrow};s=o,d.lang=l=s.lang,d.context=e=E(e.element.originElement,g,s),d._imagesInfoReset=!0,d._init(!0,c),u._addEvent(),d._charCount(0,!1),u._offStickyToolbar(),u.onResize_window()},setDefaultStyle:function(t){"string"==typeof t&&t.trim().length>0?e.element.wysiwyg.style.cssText=t:e.element.wysiwyg.style.cssText.removeAttribute("style")},noticeOpen:function(e){d.notice.open.call(d,e)},noticeClose:function(){d.notice.close.call(d)},save:function(){e.element.originElement.value=d.getContents(!1)},getContext:function(){return e},getContents:function(e){return d.getContents(e)},getImagesInfo:function(){return d._variable._imagesInfo},insertImage:function(e){d.plugins.image&&e&&(d.initPlugins.image?d.plugins.image.submitAction.call(d,e):d.callPlugin("image",d.plugins.image.submitAction.bind(d,e)),d.focus())},insertHTML:function(e,t){if("string"==typeof e){t||(e=d.cleanHTML(e));try{const t=d._parser.parseFromString(e,"text/html").body.childNodes;let n,i;for(;n=t[0];)d.insertNode(n,i),i=n;const l=3===i.nodeType?i.textContent.length:1;d.setRange(i,l,i,l)}catch(t){d.execCommand("insertHTML",!1,e)}}else if(r.isComponent(e))d.insertComponent(e,!1);else{let t=null;(r.isFormatElement(e)||r.isMedia(e))&&(t=r.getFormatElement(d.getSelectionNode())),d.insertNode(e,t)}d.focus()},setContents:function(e){d.setContents(e)},appendContents:function(t){const n=d.convertContentsForEditor(t);if(d._variable.isCodeView)d._setCodeView(d._getCodeView()+"\n"+d.convertHTMLForCodeView(n));else{const t=r.createElement("DIV");t.innerHTML=n;const i=e.element.wysiwyg,l=t.children;for(let e=0,t=l.length;e
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n&&t?/%$/.test(t.style.width)?(this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n&&t?this.util.getNumber(n.style.paddingBottom)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t),l=this.util.getNumber(n);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,s=n.resizeDiv,o=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=o.top,u=o.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",s.style.top="0px",s.style.left="0px",s.style.width=r+"px",s.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e",e},set_cover:function(e){const t=this.util.createElement("FIGURE");return t.appendChild(e),t},set_container:function(e,t){const n=this.util.createElement("DIV");return n.className="se-component "+t,n.setAttribute("contenteditable",!1),n.appendChild(e),n},onClick_resizeButton:function(e){e.stopPropagation();const t=e.target,n=t.getAttribute("data-command")||t.parentNode.getAttribute("data-command");if(!n)return;const i=t.getAttribute("data-value")||t.parentNode.getAttribute("data-value"),l=this.context.resizing._resize_plugin,s=this.context[l],o=s._element,a=this.plugins[l];if(e.preventDefault(),"function"!=typeof this.plugins.resizing._closeAlignMenu||(this.plugins.resizing._closeAlignMenu(),"onalign"!==n)){switch(n){case"auto":a.setAutoSize.call(this),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"percent":let e=this.plugins.resizing._module_getSizeY.call(this,s);if(this.context.resizing._rotateVertical){const t=o.getAttribute("data-percentage");t&&(e=t.split(",")[1])}this.plugins.resizing.resetTransform.call(this,o),a.setPercentSize.call(this,100*i,e),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"mirror":const t=o.getAttribute("data-rotate")||"0";let n=o.getAttribute("data-rotateX")||"",r=o.getAttribute("data-rotateY")||"";"h"===i&&!this.context.resizing._rotateVertical||"v"===i&&this.context.resizing._rotateVertical?r=r?"":"180":n=n?"":"180",o.setAttribute("data-rotateX",n),o.setAttribute("data-rotateY",r),this.plugins.resizing._setTransForm(o,t,n,r);break;case"rotate":const c=this.context.resizing,d=1*o.getAttribute("data-rotate")+1*i,u=this._w.Math.abs(d)>=360?0:d;o.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,o,null,null),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"onalign":this.plugins.resizing.openAlignMenu.call(this);break;case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"caption":const g=!s._captionChecked;if(a.openModify.call(this,!0),s._captionChecked=s.captionCheckEl.checked=g,"image"===l?a.update_image.call(this,!1,!1,!1):"video"===l&&(this.context.dialog.updateModal=!0,a.submitAction.call(this)),g){const e=this.util.getChildElement(s._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):s._caption.focus(),this.controllersOff()}else a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l)),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,s=1*e.getAttribute("data-rotate");let o="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";o=90===s||-270===s?t:e}}e.style.transformOrigin=o,this.plugins.resizing._setTransForm(e,s.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),s="";if(/[1-9]/.test(t)&&(n||i))switch(s=n?"Y":"X",t){case"90":s=n&&i?"X":i?s:"";break;case"270":l*=-1,s=n&&i?"Y":n?s:"";break;case"-90":s=n&&i?"Y":n?s:"";break;case"-270":l*=-1,s=n&&i?"X":i?s:"";break;default:s=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(s?" translate"+s+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];e.stopPropagation(),e.preventDefault();const i=this.context.resizing._resize_plugin,l=this.context[i]._element,s=this.plugins[i];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const o=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const n=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",a),this.removeDocEvent("mouseup",o),this.removeDocEvent("keydown",o),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this),n&&this.history.push(!1)),s.onModifyMode.call(this,l,this.plugins.resizing.call_controller_resize.call(this,l,t._resize_plugin))}.bind(this),a=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",a),this.addDocEvent("mouseup",o),this.addDocEvent("keydown",o)},resizing_element:function(e,t,n,i){const l=i.clientX,s=i.clientY;let o=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?s-e._resizeClientY:e._resizeClientY-s),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",o=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=o,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(o)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(){const e=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let t=this._w.Math.round(e?this.context.resizing._resize_h:this.context.resizing._resize_w),n=this._w.Math.round(e?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!e&&!/%$/.test(t)){const e=16,i=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(t)>i&&(n=this._w.Math.round(n/t*i),t=i)}this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t,n,!1),this.plugins[this.context.resizing._resize_plugin].init.call(this)}};return void 0===t&&(e.SUNEDITOR_MODULES||(e.SUNEDITOR_MODULES={}),e.SUNEDITOR_MODULES.resizing=n),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)}}); \ No newline at end of file +!function(e){var t={};function n(i){if(t[i])return t[i].exports;var l=t[i]={i:i,l:!1,exports:{}};return e[i].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var l in e)n.d(i,l,function(t){return e[t]}.bind(null,l));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="XJR1")}({"1kvd":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"dialog",add:function(e){const t=e.context;t.dialog={kind:"",updateModal:!1,_closeSignal:!1};let n=e.util.createElement("DIV");n.className="se-dialog sun-editor-common";let i=e.util.createElement("DIV");i.className="se-dialog-back",i.style.display="none";let l=e.util.createElement("DIV");l.className="se-dialog-inner",l.style.display="none",n.appendChild(i),n.appendChild(l),t.dialog.modalArea=n,t.dialog.back=i,t.dialog.modal=l,t.dialog.modal.addEventListener("mousedown",this.onMouseDown_dialog.bind(e)),t.dialog.modal.addEventListener("click",this.onClick_dialog.bind(e)),t.element.relative.appendChild(n),n=null,i=null,l=null},onMouseDown_dialog:function(e){/se-dialog-inner/.test(e.target.className)?this.context.dialog._closeSignal=!0:this.context.dialog._closeSignal=!1},onClick_dialog:function(e){e.stopPropagation(),(/close/.test(e.target.getAttribute("data-command"))||this.context.dialog._closeSignal)&&this.plugins.dialog.close.call(this)},open:function(e,t){if(this.modalForm)return!1;this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null),this.plugins.dialog._bindClose=function(e){/27/.test(e.keyCode)&&this.plugins.dialog.close.call(this)}.bind(this),this._d.addEventListener("keydown",this.plugins.dialog._bindClose),this.context.dialog.updateModal=t,"full"===this.context.option.popupDisplay?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const n=this.context[e].focusElement;"function"==typeof this.plugins[e].on&&this.plugins[e].on.call(this,t),this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",n&&n.focus()},_bindClose:null,close:function(){this.plugins.dialog._bindClose&&(this._d.removeEventListener("keydown",this.plugins.dialog._bindClose),this.plugins.dialog._bindClose=null);const e=this.context.dialog.kind;this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.context.dialog.updateModal=!1,this.plugins[e].init.call(this),this.context.dialog.kind="",this.modalForm=null,this.focus()}};return void 0===t&&(e.SUNEDITOR_MODULES||(e.SUNEDITOR_MODULES={}),e.SUNEDITOR_MODULES.dialog=n),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"3FqI":function(e,t,n){},P6u4:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={toolbar:{default:"Default",save:"Save",font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Highlight Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",alignJustify:"Align justify",list:"List",orderList:"Ordered list",unorderList:"Unordered list",horizontalRule:"Horizontal line",hr_solid:"Solid",hr_dotted:"Dotted",hr_dashed:"Dashed",table:"Table",link:"Link",math:"Math",image:"Image",video:"Video",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header",tag_blockquote:"Quote",tag_pre:"Code",template:"Template",lineHeight:"Line height",paragraphStyle:"Paragraph style",textStyle:"Text style"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},mathBox:{title:"Math",inputLabel:"Mathematical Notation",fontSizeLabel:"Font Size",previewLabel:"Preview"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",altText:"Alternative text"},videoBox:{title:"Insert Video",url:"Media embed URL, YouTube"},caption:"Insert description",close:"Close",submitButton:"Submit",revertButton:"Revert",proportion:"Constrain proportions",basic:"Basic",left:"Left",right:"Right",center:"Center",width:"Width",height:"Height",size:"Size",ratio:"Ratio"},controller:{edit:"Edit",unlink:"Unlink",remove:"Remove",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",deleteRow:"Delete row",insertColumnBefore:"Insert column before",insertColumnAfter:"Insert column after",deleteColumn:"Delete column",resize100:"Resize 100%",resize75:"Resize 75%",resize50:"Resize 50%",resize25:"Resize 25%",autoSize:"Auto size",mirrorHorizontal:"Mirror, Horizontal",mirrorVertical:"Mirror, Vertical",rotateLeft:"Rotate left",rotateRight:"Rotate right",maxSize:"Max size",minSize:"Min size",tableHeader:"Table header",mergeCells:"Merge cells",splitCells:"Split Cells",HorizontalSplit:"Horizontal split",VerticalSplit:"Vertical split"},menu:{spaced:"Spaced",bordered:"Bordered",neon:"Neon",translucent:"Translucent",shadow:"Shadow"}};return void 0===t&&(e.SUNEDITOR_LANG||(e.SUNEDITOR_LANG={}),e.SUNEDITOR_LANG.en=n),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_LANG a window with a document");return l(e)}:l(i)},WUQj:function(e,t,n){},XJR1:function(e,t,n){"use strict";n.r(t);n("3FqI"),n("WUQj");var i={name:"colorPicker",add:function(e){const t=e.context;t.colorPicker={colorListHTML:"",_colorInput:"",_defaultColor:"#000",_styleProperty:"color",_currentColor:"",_colorList:[]};let n=this.createColorList(e,this._makeColorList);t.colorPicker.colorListHTML=n,n=null},createColorList:function(e,t){const n=e.context.option,i=e.lang,l=n.colorList&&0!==n.colorList.length?n.colorList:["#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"];let s=[],o='
    ';for(let e,n=0,i=l.length;n0&&(o+='
    '+t(s)+"
    ",s=[]),"object"==typeof e&&(o+='
    '+t(e)+"
    ")));return o+='
    ",o},_makeColorList:function(e){let t="";t+='
      ';for(let n,i=0,l=e.length;i');return t+="
    ",t},init:function(e,t){const n=this.plugins.colorPicker;let i=t||(n.getColorInNode.call(this,e)||this.context.colorPicker._defaultColor);i=n.isHexColor(i)?i:n.rgb2hex(i)||i;const l=this.context.colorPicker._colorList;if(l)for(let e=0,t=l.length;e=3&&"#"+((1<<24)+(n[0]<<16)+(n[1]<<8)+n[2]).toString(16).substr(1)}},l={name:"fontColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.fontColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.fontColor.colorInput=l.querySelector("._se_color_picker_input"),n.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.fontColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.fontColor;e._colorInput=t.colorInput,e._defaultColor="#333333",e._styleProperty="color",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"],null,null),this.submenuOff()}},s={name:"hiliteColor",display:"submenu",add:function(e,t){e.addModule([i]);const n=e.context;n.hiliteColor={previewEl:null,colorInput:null,colorList:null};let l=this.setSubmenu.call(e);n.hiliteColor.colorInput=l.querySelector("._se_color_picker_input"),n.hiliteColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(e)),l.querySelector("._se_color_picker_submit").addEventListener("click",this.submit.bind(e)),l.querySelector("._se_color_picker_remove").addEventListener("click",this.remove.bind(e)),l.addEventListener("click",this.pickup.bind(e)),n.hiliteColor.colorList=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null},setSubmenu:function(){const e=this.context.colorPicker.colorListHTML,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker,t=this.context.hiliteColor;e._colorInput=t.colorInput,e._defaultColor="#FFFFFF",e._styleProperty="backgroundColor",e._colorList=t.colorList,this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,e.target.value)},submit:function(){this.plugins.hiliteColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){e.preventDefault(),e.stopPropagation(),this.plugins.hiliteColor.applyColor.call(this,e.target.getAttribute("data-value"))},remove:function(){this.nodeChange(null,["background-color"],["span"],!0),this.submenuOff()},applyColor:function(e){if(!e)return;const t=this.util.createElement("SPAN");t.style.backgroundColor=e,this.nodeChange(t,["background-color"],null,null),this.submenuOff()}},o={name:"template",display:"submenu",add:function(e,t){e.context.template={};let n=this.setSubmenu.call(e);n.querySelector("ul").addEventListener("click",this.pickup.bind(e)),e.initMenuTarget(this.name,t,n),n=null},setSubmenu:function(){const e=this.context.option.templates;if(!e||0===e.length)throw Error('[SUNEDITOR.plugins.template.fail] To use the "template" plugin, please define the "templates" option.');const t=this.util.createElement("DIV");t.className="se-list-layer";let n='
      ';for(let t,i=0,l=e.length;i";return n+="
    ",t.innerHTML=n,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=this.context.option.templates[e.target.getAttribute("data-value")];if(!t.html)throw this.submenuOff(),Error('[SUNEDITOR.template.fail] cause : "templates[i].html not found"');this.setContents(t.html),this.submenuOff()}},a=n("1kvd"),r=n.n(a),c={name:"link",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.link={focusElement:null,linkNewWindowCheck:null,linkAnchorText:null,_linkAnchor:null};let n=this.setDialog.call(e);t.link.modal=n,t.link.focusElement=n.querySelector("._se_link_url"),t.link.linkAnchorText=n.querySelector("._se_link_text"),t.link.linkNewWindowCheck=n.querySelector("._se_link_check");let i=this.setController_LinkButton.call(e);t.link.linkController=i,t.link._linkAnchor=null,i.addEventListener("mousedown",(function(e){e.stopPropagation()}),!1),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e)),i.addEventListener("click",this.onClick_linkController.bind(e)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-link",n.innerHTML='
    ",n},open:function(){this.plugins.dialog.open.call(this,"link","link"===this.currentControllerName)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.link.focusElement.value.trim().length)return!1;const e=this.context.link,t=e.focusElement.value,n=e.linkAnchorText,i=0===n.value.length?t:n.value;if(this.context.dialog.updateModal){e._linkAnchor.href=t,e._linkAnchor.textContent=i,e._linkAnchor.target=e.linkNewWindowCheck.checked?"_blank":"";const n=e._linkAnchor.childNodes[0];this.setRange(n,0,n,n.textContent.length)}else{const n=this.util.createElement("A");n.href=t,n.textContent=i,n.target=e.linkNewWindowCheck.checked?"_blank":"";const l=this.getSelectedElements();if(l.length>1){const e=this.util.createElement(l[0].nodeName);e.appendChild(n),this.insertNode(e)}else this.insertNode(n);this.setRange(n.childNodes[0],0,n.childNodes[0],n.textContent.length)}this.history.push(!1),e.focusElement.value="",e.linkAnchorText.value=""}.bind(this);try{t()}finally{this.plugins.dialog.close.call(this),this.closeLoading(),this.focus()}return!1},active:function(e){if(e){if(this.util.isAnchor(e)&&null===e.getAttribute("data-image-link"))return this.controllerArray.indexOf(this.context.link.linkController)<0&&this.plugins.link.call_controller.call(this,e),!0}else this.controllerArray.indexOf(this.context.link.linkController)>-1&&this.controllersOff();return!1},on:function(e){e?this.context.link._linkAnchor&&(this.context.dialog.updateModal=!0,this.context.link.focusElement.value=this.context.link._linkAnchor.href,this.context.link.linkAnchorText.value=this.context.link._linkAnchor.textContent,this.context.link.linkNewWindowCheck.checked=!!/_blank/i.test(this.context.link._linkAnchor.target)):(this.plugins.link.init.call(this),this.context.link.linkAnchorText.value=this.getSelection().toString())},call_controller:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkController,n=t.querySelector("a");n.href=e.href,n.title=e.textContent,n.textContent=e.textContent;const i=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=i.top+e.offsetHeight+10+"px",t.style.left=i.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const l=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);l<0?(t.style.left=t.offsetLeft+l+"px",t.firstElementChild.style.left=20-l+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"link")},onClick_linkController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");if(t){if(e.preventDefault(),/update/.test(t)){const e=this.context.link;e.focusElement.value=e._linkAnchor.href,e.linkAnchorText.value=e._linkAnchor.textContent,e.linkNewWindowCheck.checked=!!/_blank/i.test(e._linkAnchor.target),this.plugins.dialog.open.call(this,"link",!0)}else if(/unlink/.test(t)){const e=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!1),t=this.util.getChildElement(this.context.link._linkAnchor,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0);this.setRange(e,0,t,t.textContent.length),this.nodeChange(null,null,["A"],!1)}else this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus(),this.history.push(!1);this.controllersOff()}},init:function(){const e=this.context.link;e.linkController.style.display="none",e._linkAnchor=null,e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}},d=n("ee5k"),u=n.n(d),h={blockquote:{name:"blockquote",display:"command",add:function(e,t){e.context.blockquote={targetButton:t,tag:e.util.createElement("BLOCKQUOTE")}},active:function(e){if(e){if(/blockquote/i.test(e.nodeName))return this.util.addClass(this.context.blockquote.targetButton,"active"),!0}else this.util.removeClass(this.context.blockquote.targetButton,"active");return!1},action:function(){const e=this.util.getParentElement(this.getSelectionNode(),"blockquote");e?this.detachRangeFormatElement(e,null,null,!1,!1):this.applyRangeFormatElement(this.context.blockquote.tag.cloneNode(!1))}},align:{name:"align",display:"submenu",add:function(e,t){const n=e.icons,i=e.context;i.align={targetButton:t,_alignList:null,currentAlign:"",icons:{justify:n.align_justify,left:n.align_left,right:n.align_right,center:n.align_center}};let l=this.setSubmenu.call(e),s=l.querySelector("ul");s.addEventListener("click",this.pickup.bind(e)),i.align._alignList=s.querySelectorAll("li button"),e.initMenuTarget(this.name,t,l),l=null,s=null},setSubmenu:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-list-layer",n.innerHTML='
    ",n},active:function(e){const t=this.context.align.targetButton,n=t.querySelector("svg");if(e){if(this.util.isFormatElement(e)){const i=e.style.textAlign;if(i)return this.util.changeIcon(n,this.context.align.icons[i]),t.setAttribute("data-focus",i),!0}}else this.util.changeIcon(n,this.context.align.icons.left),t.removeAttribute("data-focus");return!1},on:function(){const e=this.context.align,t=e._alignList,n=e.targetButton.getAttribute("data-focus")||"left";if(n!==e.currentAlign){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(s=0,o=a.length;s";return r+="",n.innerHTML=r,n},active:function(e){const t=this.context.font.targetText,n=this.context.font.targetTooltip;if(e){if(e.style&&e.style.fontFamily.length>0){const i=e.style.fontFamily.replace(/["']/g,"");return this.util.changeTxt(t,i),this.util.changeTxt(n,i),!0}}else{const e=this.lang.toolbar.font;this.util.changeTxt(t,e),this.util.changeTxt(n,e)}return!1},on:function(){const e=this.context.font,t=e._fontList,n=e.targetText.textContent;if(n!==e.currentFont){for(let e=0,i=t.length;e('+t.toolbar.default+")";for(let t,n=0,s=e.fontSizeUnit,o=i.length;n";return l+="",n.innerHTML=l,n},active:function(e){if(e){if(e.style&&e.style.fontSize.length>0)return this.util.changeTxt(this.context.fontSize.targetText,e.style.fontSize),!0}else this.util.changeTxt(this.context.fontSize.targetText,this.lang.toolbar.fontSize);return!1},on:function(){const e=this.context.fontSize,t=e._sizeList,n=e.targetText.textContent;if(n!==e.currentSize){for(let e=0,i=t.length;e
  • ",t},appendHr:function(e){const t=this.util.createElement("HR");t.className=e,this.focus();let n=this.insertComponent(t,!1);this.setRange(n,0,n,0)},horizontalRulePick:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=null;for(;!n&&!/UL/i.test(t.tagName);)n=t.getAttribute("data-value"),t=t.parentNode;n&&(this.plugins.horizontalRule.appendHr.call(this,"__se__"+n),this.submenuOff())}},list:{name:"list",display:"submenu",add:function(e,t){const n=e.context;n.list={targetButton:t,_list:null,currentList:"",icons:{bullets:e.icons.list_bullets,number:e.icons.list_number}};let i=this.setSubmenu.call(e),l=i.querySelector("ul");l.addEventListener("click",this.pickup.bind(e)),n.list._list=l.querySelectorAll("li button"),e.initMenuTarget(this.name,t,i),i=null,l=null},setSubmenu:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-submenu se-list-layer",t.innerHTML='
    ",t},active:function(e){const t=this.context.list.targetButton,n=t.querySelector("svg"),i=this.util;if(e){if(i.isList(e)){const l=e.nodeName;return t.setAttribute("data-focus",l),i.addClass(t,"active"),/UL/i.test(l)?i.changeIcon(n,this.context.list.icons.bullets):i.changeIcon(n,this.context.list.icons.number),!0}}else t.removeAttribute("data-focus"),i.changeIcon(n,this.context.list.icons.number),i.removeClass(t,"active");return!1},on:function(){const e=this.context.list,t=e._list,n=e.targetButton.getAttribute("data-focus")||"";if(n!==e.currentList){for(let e=0,i=t.length;e"),t.innerHTML+=n.outerHTML,e&&(t.innerHTML+="
    ")}else{const e=n.childNodes;for(;e[0];)t.appendChild(e[0])}c.appendChild(t),a||(u=c),a&&m===g&&!l.isRangeFormatElement(f)||(d||(d=c),s&&a&&m===g||a&&l.isList(g)&&g===r||c.parentNode!==m&&m.insertBefore(c,f)),l.removeItem(n),s&&null===h&&(h=c.children.length-1),a&&(l.getRangeFormatElement(g,p)!==l.getRangeFormatElement(r,p)||l.isList(g)&&l.isList(r)&&l.getElementDepth(g)!==l.getElementDepth(r))&&(c=l.createElement(e)),_&&0===_.children.length&&l.removeItem(_)}else l.removeItem(n);h&&(d=d.children[h]),o&&(g=c.children.length-1,c.innerHTML+=r.innerHTML,u=c.children[g],l.removeItem(r))}else{if(n)for(let e=0,t=i.length;e=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}const t=l.getRangeFormatElement(s),o=t&&t.tagName===e;let a,r;const c=function(e){return!this.isComponent(e)}.bind(l);o||(r=l.createElement(e));for(let t,s,d=0,u=i.length;d0){const e=l.cloneNode(!1),t=l.childNodes,s=this.util.getPositionIndex(i);for(;t[s];)e.appendChild(t[s]);n.appendChild(e)}0===l.children.length&&this.util.removeItem(l),this.util.mergeSameTags(o);const a=this.util.getEdgeChildNodes(t,n);return{cc:t.parentNode,sc:a.sc,ec:a.ec}},editInsideList:function(e,t){const n=(t=t||this.getSelectedElements().filter(function(e){return this.isListCell(e)}.bind(this.util))).length;if(0===n||!e&&!this.util.isListCell(t[0].previousElementSibling)&&!this.util.isListCell(t[n-1].nextElementSibling))return{sc:t[0],so:0,ec:t[n-1],eo:1};let i=t[0].parentNode,l=t[n-1],s=null;if(e){if(i!==l.parentNode&&this.util.isList(l.parentNode.parentNode)&&l.nextElementSibling)for(l=l.nextElementSibling;l;)t.push(l),l=l.nextElementSibling;s=this.plugins.list.editList.call(this,i.nodeName.toUpperCase(),t,!0)}else{let e=this.util.createElement(i.nodeName),o=t[0].previousElementSibling,a=l.nextElementSibling;const r={s:null,e:null,sl:i,el:i};for(let l,s=0,c=n;s span > span"),n.table.headerButton=s.querySelector("._se_table_header"),s.addEventListener("mousedown",(function(e){e.stopPropagation()}),!1);let o=this.setController_tableEditor.call(e);n.table.resizeDiv=o,n.table.splitMenu=o.querySelector(".se-btn-group-sub"),n.table.mergeButton=o.querySelector("._se_table_merge_button"),n.table.splitButton=o.querySelector("._se_table_split_button"),n.table.insertRowAboveButton=o.querySelector("._se_table_insert_row_a"),n.table.insertRowBelowButton=o.querySelector("._se_table_insert_row_b"),o.addEventListener("mousedown",(function(e){e.stopPropagation()}),!1),l.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(e)),l.addEventListener("click",this.appendTable.bind(e)),o.addEventListener("click",this.onClick_tableController.bind(e)),s.addEventListener("click",this.onClick_tableController.bind(e)),e.initMenuTarget(this.name,t,i),n.element.relative.appendChild(o),n.element.relative.appendChild(s),i=null,l=null,o=null,s=null},setSubmenu:function(){const e=this.util.createElement("DIV");return e.className="se-submenu se-selector-table",e.innerHTML='
    1 x 1
    ',e},setController_table:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table",n.innerHTML='
    ",n},setController_tableEditor:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-table-cell",n.innerHTML='
    • '+e.controller.VerticalSplit+'
    • '+e.controller.HorizontalSplit+"
    ",n},appendTable:function(){const e=this.util.createElement("TABLE"),t=this.plugins.table.createCells,n=this.context.table._tableXY[0];let i=this.context.table._tableXY[1],l="";for(;i>0;)l+=""+t.call(this,"td",n)+"",--i;l+="",e.innerHTML=l,this.insertComponent(e,!1);const s=e.querySelector("td div");this.setRange(s,0,s,0),this.plugins.table.reset_table_picker.call(this)},createCells:function(e,t,n){if(e=e.toLowerCase(),n){const t=this.util.createElement(e);return t.innerHTML="

    ",t}{let n="";for(;t>0;)n+="<"+e+">

    ",t--;return n}},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=this._w.Math.ceil(e.offsetX/18),n=this._w.Math.ceil(e.offsetY/18);t=t<1?1:t,n=n<1?1:n,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=n+"em";let i=t<5?5:t>9?10:t+1,l=n<5?5:n>9?10:n+1;this.context.table.tableUnHighlight.style.width=i+"em",this.context.table.tableUnHighlight.style.height=l+"em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+n),this.context.table._tableXY=[t,n]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="5em",t.height="5em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table,t=this.plugins.table;if(t._removeEvents.call(this),t._selectedTable){const e=t._selectedTable.querySelectorAll(".se-table-selected-cell");for(let t=0,n=e.length;t0)for(let e,t=0;ts||(u>=e.index?(i+=e.cs,u+=e.cs,e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=s+1,e.rs<1&&(r.splice(t,1),t--)));if(s===o&&h===l){n._logical_cellIndex=u;break}d>0&&a.push({index:u,cs:c+1,rs:d,row:-1}),i+=c}r=r.concat(a).sort((function(e,t){return e.index-t.index})),a=[]}a=null,r=null}},editTable:function(e,t){const n=this.plugins.table,i=this.context.table,l=i._element,s="row"===e;if(s){const e=i._trElement.parentNode;if(/^THEAD$/i.test(e.nodeName)){if("up"===t)return;if(!e.nextElementSibling||!/^TBODY$/i.test(e.nextElementSibling.nodeName))return void(l.innerHTML+=""+n.createCells.call(this,"td",i._logical_cellCnt,!1)+"")}}if(n._ref){const e=i._tdElement,l=n._selectedCells;if(s)if(t)n.setCellInfo.call(this,"up"===t?l[0]:l[l.length-1],!0),n.editRow.call(this,t,e);else{let e=l[0].parentNode;const i=[l[0]];for(let t,n=1,s=l.length;no&&o>t&&(e[l].rowSpan=n+a,c-=i)}if(i){const e=r[s+1];if(e){const t=[];let n=r[s].cells,i=0;for(let e,l,s=0,o=n.length;s1&&(e.rowSpan-=1,t.push({cell:e.cloneNode(!1),index:l}));if(t.length>0){let l=t.shift();n=e.cells,i=0;for(let s,o,a=0,r=n.length;a=l.index)||(a--,i--,i+=l.cell.colSpan-1,e.insertBefore(l.cell,s),l=t.shift(),l));a++);if(l){e.appendChild(l.cell);for(let n=0,i=t.length;n0){const e=!s[b+1];for(let t,n=0;n_||(p>=t.index?(f+=t.cs,p=b+f,t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)):e&&(t.rs-=1,t.row=_+1,t.rs<1&&(d.splice(n,1),n--)))}n>0&&c.push({rs:n,cs:r+1,index:p,row:-1}),p>=t&&p+r<=t+o?h.push(e):p<=t+o&&p+r>=t?e.colSpan-=i.getOverlapRangeAtIndex(a,a+o,p,p+r):n>0&&(pt+o)&&g.push({cell:e,i:_,rs:_+n}),f+=r}else{if(b>=t)break;if(r>0){if(u<1&&r+b>=t){e.colSpan+=1,t=null,u=n+1;break}t-=r}if(!m){for(let e,n=0;n0){u-=1;continue}null!==t&&s.length>0&&(p=this.plugins.table.createCells.call(this,s[0].nodeName,0,!0),p=e.insertBefore(p,s[t]))}}if(l){let e,t;for(let n,l=0,s=h.length;l1)c.colSpan=this._w.Math.floor(e/2),l.colSpan=e-c.colSpan,o.insertBefore(c,l.nextElementSibling);else{let t=[],n=[];for(let o,r,c=0,d=i._rowCnt;c0)for(let e,t=0;tc||(u>=e.index?(r+=e.cs,u+=e.cs,e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)):h===g-1&&(e.rs-=1,e.row=c+1,e.rs<1&&(n.splice(t,1),t--)));if(u<=a&&d>0&&t.push({index:u,cs:s+1,rs:d,row:-1}),i!==l&&u<=a&&u+s>=a+e-1){i.colSpan+=1;break}if(u>a)break;r+=s}n=n.concat(t).sort((function(e,t){return e.index-t.index})),t=[]}o.insertBefore(c,l.nextElementSibling)}}else{const e=l.rowSpan;if(c.colSpan=l.colSpan,e>1){c.rowSpan=this._w.Math.floor(e/2);const n=e-c.rowSpan,i=[],r=t.getArrayIndex(s,o)+n;for(let e,t,n=0;n=a));c++)l=e[c],s=l.rowSpan-1,s>0&&s+n>=r&&o=h.index&&(r+=h.cs,l+=h.cs,h=i.shift()),l>=a||s===o-1){d.insertBefore(c,e.nextElementSibling);break}r+=t}l.rowSpan=n}else{c.rowSpan=l.rowSpan;const e=t.createElement("TR");e.appendChild(c);for(let e,t=0;t=r&&(e[n].rowSpan+=1)}const n=i._physical_cellIndex,a=o.cells;for(let e=0,t=a.length;e0&&o+s>=i&&(e.rowSpan-=n.getOverlapRangeAtIndex(i,l,o,o+s));else s.push(e[o]);for(let e=0,t=s.length;e"+this.plugins.table.createCells.call(this,"th",this.context.table._logical_cellCnt,!1)+"",i.insertBefore(t,i.firstElementChild)}e.toggleClass(t,"active"),/TH/i.test(this.context.table._tdElement.nodeName)?this.controllersOff():this.plugins.table.setPositionControllerDiv.call(this,this.context.table._tdElement,!1)},resizeTable:function(){const e=this.context.table,t=e.resizeButton.querySelector("svg"),n=e.resizeText;let i,l,s;e._maxWidth?(i=e.icons.reduction,l=e.minText,s="100%"):(i=e.icons.expansion,l=e.maxText,s="auto"),this.util.changeIcon(t,i),this.util.changeTxt(n,l),e._element.style.width=s},setActiveButton:function(e,t){const n=this.context.table;/^TH$/i.test(e.nodeName)?(n.insertRowAboveButton.setAttribute("disabled",!0),n.insertRowBelowButton.setAttribute("disabled",!0)):(n.insertRowAboveButton.removeAttribute("disabled"),n.insertRowBelowButton.removeAttribute("disabled")),t&&e!==t?(n.splitButton.setAttribute("disabled",!0),n.mergeButton.removeAttribute("disabled")):(n.splitButton.removeAttribute("disabled"),n.mergeButton.setAttribute("disabled",!0))},_bindOnSelect:null,_bindOffSelect:null,_bindOffShift:null,_selectedCells:null,_shift:!1,_fixedCell:null,_fixedCellName:null,_selectedCell:null,_selectedTable:null,_ref:null,_toggleEditor:function(e){this.context.element.wysiwyg.setAttribute("contenteditable",e),e?this.util.removeClass(this.context.element.wysiwyg,"se-disabled"):this.util.addClass(this.context.element.wysiwyg,"se-disabled")},_offCellMultiSelect:function(e){e.stopPropagation();const t=this.plugins.table;t._shift?t._initBind&&(this._wd.removeEventListener("touchmove",t._initBind),t._initBind=null):(t._removeEvents.call(this),t._toggleEditor.call(this,!0)),t._fixedCell&&t._selectedTable&&(t.setActiveButton.call(this,t._fixedCell,t._selectedCell),t.call_controller_tableEdit.call(this,t._selectedCell||t._fixedCell),t._selectedCells=t._selectedTable.querySelectorAll(".se-table-selected-cell"),t._selectedCell&&t._fixedCell&&this.focusEdge(t._selectedCell),t._shift||(t._fixedCell=null,t._selectedCell=null,t._fixedCellName=null))},_onCellMultiSelect:function(e){this._antiBlur=!0;const t=this.plugins.table,n=this.util.getParentElement(e.target,this.util.isCell);if(t._shift)n===t._fixedCell?t._toggleEditor.call(this,!0):t._toggleEditor.call(this,!1);else if(!t._ref){if(n===t._fixedCell)return;t._toggleEditor.call(this,!1)}n&&n!==t._selectedCell&&t._fixedCellName===n.nodeName&&t._selectedTable===this.util.getParentElement(n,"TABLE")&&(t._selectedCell=n,t._setMultiCells.call(this,t._fixedCell,n))},_setMultiCells:function(e,t){const n=this.plugins.table,i=n._selectedTable.rows,l=this.util,s=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=s.length;e0)for(let e,t=0;td||(u>=e.index?(s+=e.cs,u+=e.cs,e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)):p===m-1&&(e.rs-=1,e.row=d+1,e.rs<1&&(a.splice(t,1),t--)));if(o){if(i!==e&&i!==t||(c.cs=null!==c.cs&&c.csu+h?c.ce:u+h,c.rs=null!==c.rs&&c.rsd+g?c.re:d+g,c._i+=1),2===c._i){o=!1,a=[],r=[],d=-1;break}}else if(l.getOverlapRangeAtIndex(c.cs,c.ce,u,u+h)&&l.getOverlapRangeAtIndex(c.rs,c.re,d,d+g)){const e=c.csu+h?c.ce:u+h,n=c.rsd+g?c.re:d+g;if(c.cs!==e||c.ce!==t||c.rs!==n||c.re!==s){c.cs=e,c.ce=t,c.rs=n,c.re=s,d=-1,a=[],r=[];break}l.addClass(i,"se-table-selected-cell")}g>0&&r.push({index:u,cs:h+1,rs:g,row:-1}),s+=i.colSpan-1}a=a.concat(r).sort((function(e,t){return e.index-t.index})),r=[]}},_removeEvents:function(){const e=this.plugins.table;e._initBind&&(this._wd.removeEventListener("touchmove",e._initBind),e._initBind=null),e._bindOnSelect&&(this._wd.removeEventListener("mousedown",e._bindOnSelect),this._wd.removeEventListener("mousemove",e._bindOnSelect),e._bindOnSelect=null),e._bindOffSelect&&(this._wd.removeEventListener("mouseup",e._bindOffSelect),e._bindOffSelect=null),e._bindOffShift&&(this._wd.removeEventListener("keyup",e._bindOffShift),e._bindOffShift=null)},_initBind:null,onTableCellMultiSelect:function(e,t){const n=this.plugins.table;n._removeEvents.call(this),this.controllersOff(),n._shift=t,n._fixedCell=e,n._fixedCellName=e.nodeName,n._selectedTable=this.util.getParentElement(e,"TABLE");const i=n._selectedTable.querySelectorAll(".se-table-selected-cell");for(let e=0,t=i.length;e-1?(n=e.toLowerCase(),o="blockquote"===n?"range":"pre"===n?"free":"replace",r=/^h/.test(n)?n.match(/\d+/)[0]:"",a=t["tag_"+(r?"h":n)]+r,d="",c=""):(n=e.tag.toLowerCase(),o=e.command,a=e.name||n,d=e.class,c=d?' class="'+d+'"':""),s+='
  • ";return s+="",n.innerHTML=s,n},active:function(e){let t=this.lang.toolbar.formats;const n=this.context.formatBlock.targetText,i=this.context.formatBlock.targetTooltip;if(e){if(this.util.isFormatElement(e)){const l=this.context.formatBlock._formatList,s=e.nodeName.toLowerCase(),o=(e.className.match(/(\s|^)__se__format__[^\s]+/)||[""])[0].trim();for(let e,n=0,i=l.length;n=0;u--)if(i=p[u],i!==(p[u+1]?p[u+1].parentNode:null)){if(d=a.isComponent(i),s=d?"":i.innerHTML.replace(/(?!>)\s+(?=<)|\n/g," "),o=a.getParentElement(i,(function(e){return e.parentNode===t})),(t!==i.parentNode||d)&&(a.isFormatElement(t)?(t.parentNode.insertBefore(n,t.nextSibling),t=t.parentNode):(t.insertBefore(n,o?o.nextSibling:null),t=i.parentNode),r=n.nextSibling,r&&n.nodeName===r.nodeName&&a.isSameAttributes(n,r)&&(n.innerHTML+="
    "+r.innerHTML,a.removeItem(r)),n=l.cloneNode(!1),h=!0),c=n.innerHTML,n.innerHTML=(h||!s||!c||/
    $/i.test(s)?s:s+"
    ")+c,0===u){t.insertBefore(n,i),r=i.nextSibling,r&&n.nodeName===r.nodeName&&a.isSameAttributes(n,r)&&(n.innerHTML+="
    "+r.innerHTML,a.removeItem(r));const e=n.previousSibling;e&&n.nodeName===e.nodeName&&a.isSameAttributes(n,e)&&(e.innerHTML+="
    "+n.innerHTML,a.removeItem(n))}d||a.removeItem(i),s&&(h=!1)}this.setRange(i,0,i,0)}else{for(let e,t,n=0,o=p.length;n('+t.toolbar.default+")";for(let e,t=0,n=i.length;t";return l+="",n.innerHTML=l,n},on:function(){const e=this.context.lineHeight,t=e._sizeList,n=this.util.getFormatElement(this.getSelectionNode()).style.lineHeight+"";if(n!==e.currentSize){for(let e=0,i=t.length;e"}return s+="",t.innerHTML=s,t},on:function(){const e=this.context.paragraphStyle._classList,t=this.util.getFormatElement(this.getSelectionNode());for(let n=0,i=e.length;n"}return l+="",t.innerHTML=l,t},on:function(){const e=this.util,t=this.context.textStyle._styleList,n=this.getSelectionNode();for(let i,l,s,o=0,a=t.length;o'+this.icons.cancel+''+t.dialogBox.imageBox.title+'
    ';if(e.imageFileInput&&(i+='
    '),e.imageUrlInput&&(i+='
    '),i+='
    ',e.imageResizing){const n=e.imageSizeOnlyPercentage,l=n?' style="display: none !important;"':"",s=e.imageHeightShow?"":' style="display: none !important;"';i+='
    ',n||!e.imageHeightShow?i+='
    ":i+='
    ",i+=' '+t.dialogBox.proportion+'
    "}return i+='
    ",n.innerHTML=i,n},_fileInputChange:function(){this.imgInputFile.value?this.imgUrlFile.setAttribute("disabled",!0):this.imgUrlFile.removeAttribute("disabled")},open:function(){this.plugins.dialog.open.call(this,"image","image"===this.currentControllerName)},openTab:function(e){const t=this.context.image.modal,n="init"===e?t.querySelector("._se_tab_link"):e.target;if(!/^BUTTON$/i.test(n.tagName))return!1;const i=n.getAttribute("data-tab-link");let l,s,o;for(s=t.getElementsByClassName("_se_tab_content"),l=0;l0){let t=0;const n=[];for(let i=0,l=e.length;i0){let e=0;const n=this._variable._imagesInfo;for(let t=0,i=n.length;ti){const n="[SUNEDITOR.imageUpload.fail] Size of uploadable total images: "+i/1e3+"KB";return this._imageUploadError(n,{limitSize:i,currentSize:e,uploadSize:t})&&this.functions.noticeOpen(n),void this.closeLoading()}}this.context.image._uploadFileLength=n.length;const l=this.context.option.imageUploadUrl,s=this.context.option.imageUploadHeader,o=this.context.dialog.updateModal?1:n.length,a={linkValue:this.context.image._linkValue,linkNewWindow:this.context.image.imgLinkNewWindowCheck.checked,inputWidth:this.context.image.inputX.value,inputHeight:this.context.image.inputY.value,align:this.context.image._align,isUpdate:this.context.dialog.updateModal,currentImage:this.context.image._element};if(!this._imageUploadBefore(n,a))return;if("string"==typeof l&&l.length>0){const e=new FormData;for(let t=0;t0)for(let e in s)this.context.image._xmlHttp.setRequestHeader(e,s[e]);this.context.image._xmlHttp.send(e)}else for(let e=0;e0){const i=this.util.createElement("A");return i.href=/^https?:\/\//.test(t)?t:"http://"+t,i.target=n?"_blank":"",i.setAttribute("data-image-link","image"),e.setAttribute("data-image-link",t),i.appendChild(e),i}return e},setInputSize:function(e,t){t&&32===t.keyCode?t.preventDefault():this.plugins.resizing._module_setInputSize.call(this,this.context.image,e)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.image)},submit:function(e){const t=this.context.image,n=this.plugins.image;this.showLoading(),e.preventDefault(),e.stopPropagation(),t._linkValue=t.imgLink.value,t._altText=t.altText.value,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked,t._resizing&&(t._proportionChecked=t.proportion.checked);try{this.context.dialog.updateModal&&n.update_image.call(this,!1,!1,!1),t.imgInputFile&&t.imgInputFile.files.length>0?n.onRender_imgInput.call(this):t.imgUrlFile&&t.imgUrlFile.value.trim().length>0?n.onRender_imgUrl.call(this):this.closeLoading()}catch(e){throw this.closeLoading(),Error('[SUNEDITOR.image.submit.fail] cause : "'+e.message+'"')}finally{this.plugins.dialog.close.call(this)}return!1},setImagesInfo:function(e,t){const n=this._variable._imagesInfo;let i=e.getAttribute("data-index"),l=null,s="";if(!i||this._imagesInfoInit)s="create",i=this._variable._imageIndex,this._variable._imageIndex++,e.setAttribute("data-index",i),e.setAttribute("data-file-name",t.name),e.setAttribute("data-file-size",t.size),l={src:e.src,index:1*i,name:t.name,size:t.size},n.push(l);else{s="update",i*=1;for(let e=0,t=n.length;e-1||(n.splice(t,1),this._imageUpload(null,e,"delete",null,0),t--);this.context.resizing._resize_plugin=""},_onload_image:function(e,t){t&&(this.plugins.image.setImagesInfo.call(this,e,t),this.history.push(!0))},create_image:function(e,t,n,i,l,s,o){const a=this.context.image;this.context.resizing._resize_plugin="image";let r=this.util.createElement("IMG");r.addEventListener("load",this.plugins.image._onload_image.bind(this,r,o)),r.src=e,r.alt=a._altText,r=this.plugins.image.onRender_link.call(this,r,t,n),r.setAttribute("data-rotate","0"),a._resizing&&r.setAttribute("data-proportion",a._proportionChecked);const c=this.plugins.resizing.set_cover.call(this,r),d=this.plugins.resizing.set_container.call(this,c,"se-image-container");a._captionChecked&&(a._caption=this.plugins.resizing.create_caption.call(this),a._caption.setAttribute("contenteditable",!1),c.appendChild(a._caption)),a._element=r,a._cover=c,a._container=d,this.plugins.image.applySize.call(this,i,l),this.plugins.image.setAlign.call(this,s,r,c,d),this.insertComponent(d,!0),this.context.resizing._resize_plugin=""},update_image:function(e,t,n){const i=this.context.image,l=i._linkValue;let s,o=i._element,a=i._cover,r=i._container,c=!1;null===a&&(c=!0,o=i._element.cloneNode(!0),a=this.plugins.resizing.set_cover.call(this,o)),null===r&&(a=a.cloneNode(!0),c=!0,r=this.plugins.resizing.set_container.call(this,a,"se-image-container")),c&&(r.innerHTML="",r.appendChild(a));const d=this.util.isNumber(i.inputX.value)?i.inputX.value+i.sizeUnit:i.inputX.value,u=this.util.isNumber(i.inputY.value)?i.inputY.value+i.sizeUnit:i.inputY.value;if(s=/%$/.test(o.style.width)?d!==r.style.width||u!==r.style.height:d!==o.style.width||u!==o.style.height,o.alt=i._altText,i._captionChecked?i._caption||(i._caption=this.plugins.resizing.create_caption.call(this),a.appendChild(i._caption)):i._caption&&(this.util.removeItem(i._caption),i._caption=null),l.trim().length>0)if(null!==i._linkElement)i._linkElement.href=l,i._linkElement.target=i.imgLinkNewWindowCheck.checked?"_blank":"",o.setAttribute("data-image-link",l);else{let e=this.plugins.image.onRender_link.call(this,o,l,this.context.image.imgLinkNewWindowCheck.checked);a.insertBefore(e,i._caption)}else if(null!==i._linkElement){const e=o;e.setAttribute("data-image-link","");let t=e.cloneNode(!0);a.removeChild(i._linkElement),a.insertBefore(t,i._caption),o=t}if(c){const e=this.util.isRangeFormatElement(i._element.parentNode)||this.util.isWysiwygDiv(i._element.parentNode)?i._element:/^A$/i.test(i._element.parentNode.nodeName)?i._element.parentNode:this.util.getFormatElement(i._element)||i._element;e.parentNode.replaceChild(r,e),o=r.querySelector("img"),i._element=o,i._cover=a,i._container=r}!i._onlyPercentage&&s&&!e&&(/\d+/.test(o.style.height)||this.context.resizing._rotateVertical&&i._captionChecked)&&(/%$/.test(i.inputX.value)||/%$/.test(i.inputY.value)?this.plugins.resizing.resetTransform.call(this,o):this.plugins.resizing.setTransformSize.call(this,o,this.util.getNumber(i.inputX.value,0),this.util.getNumber(i.inputY.value,0)));if(i._resizing&&(o.setAttribute("data-proportion",i._proportionChecked),s&&this.plugins.image.applySize.call(this)),this.plugins.image.setAlign.call(this,null,o,null,null),e&&this.plugins.image.setImagesInfo.call(this,o,{name:o.getAttribute("data-file-name")||o.src.split("/").pop(),size:o.getAttribute("data-file-size")||0}),t){this.plugins.image.init.call(this);const e=this.plugins.resizing.call_controller_resize.call(this,o,"image");this.plugins.image.onModifyMode.call(this,o,e)}n||this.history.push(!1)},update_src:function(e,t,n){t.src=e,this._w.setTimeout(this.plugins.image.setImagesInfo.bind(this,t,n))},onModifyMode:function(e,t){if(!e)return;const n=this.context.image;n._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._caption=this.util.getChildElement(n._cover,"FIGCAPTION"),n._align=e.getAttribute("data-align")||"none",t&&(n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l);let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):t&&(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.image;t.imgUrlFile.value=t._element.src,t._altText=t.altText.value=t._element.alt,t._linkValue=t.imgLink.value=null===t._linkElement?"":t._linkElement.href,t.imgLinkNewWindowCheck.checked=t._linkElement&&"_blank"===t._linkElement.target,t.modal.querySelector('input[name="suneditor_image_radio"][value="'+t._align+'"]').checked=!0,t._align=t.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,t._captionChecked=t.captionCheckEl.checked=!!t._caption,t._resizing&&this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.image),e||this.plugins.dialog.open.call(this,"image",!0)},on:function(e){if(!e){const e=this.context.image;e.inputX.value=e._origin_w=this.context.option.imageWidth===e._defaultSizeX?"":this.context.option.imageWidth,e.inputY.value=e._origin_h="",e.inputY.disabled=!0,e.proportion.disabled=!0}},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.image)},applySize:function(e,t){const n=this.context.image;return e||(e=n.inputX.value),t||(t=n.inputY.value),n._onlyPercentage&&e||/%$/.test(e)?(this.plugins.image.setPercentSize.call(this,e,t),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.image.setSize.call(this,e,t,!1):this.plugins.image.setAutoSize.call(this),!1)},setSize:function(e,t,n){const i=this.context.image;this.plugins.image.cancelPercentAttr.call(this),i._element.style.width=this.util.isNumber(e)?e+i.sizeUnit:e,i._element.style.height=this.util.isNumber(t)?t+i.sizeUnit:/%$/.test(t)?"":t,"center"===i._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n||i._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,i)},setAutoSize:function(){const e=this.context.image;this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this),e._element.style.maxWidth="",e._element.style.width="",e._element.style.height="",e._cover.style.width="",e._cover.style.height="",this.plugins.image.setAlign.call(this,null,null,null,null),e._element.setAttribute("data-percentage","auto,auto"),this.plugins.resizing._module_saveCurrentSize.call(this,e)},setOriginSize:function(){const e=this.context.image;e._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,e._element),this.plugins.image.cancelPercentAttr.call(this);const t=(e._element.getAttribute("data-origin")||"").split(","),n=t[0],i=t[1];t&&(e._onlyPercentage||/%$/.test(n)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.image.setPercentSize.call(this,n,i):this.plugins.image.setSize.call(this,n,i),this.plugins.resizing._module_saveCurrentSize.call(this,e))},setPercentSize:function(e,t){const n=this.context.image;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||"":this.util.isNumber(t)?t+"%":t;const i=/%$/.test(t);n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=i?t:"",n._element.style.width="100%",n._element.style.height=i?"":t,n._element.style.maxWidth="","center"===n._align&&this.plugins.image.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing.setCaptionPosition.call(this,n._element),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.image;e._cover.style.width="",e._cover.style.height="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.image._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.image.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.image;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width&&"auto"!==t.style.width?t.style.width||"100%":""),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.image;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},destroy:function(e){const t=e||this.context.image._element,n=this.util.getParentElement(t,this.util.isMediaComponent)||t,i=1*t.getAttribute("data-index");let l=n.previousElementSibling||n.nextElementSibling;if(this.util.removeItem(n),this.plugins.image.init.call(this),this.controllersOff(),this.focusEdge(l),i>=0){const e=this._variable._imagesInfo;for(let t=0,n=e.length;t'+this.icons.cancel+''+t.dialogBox.videoBox.title+'
    ';if(e.videoResizing){const n=e.videoRatioList||[{name:"16:9",value:.5625},{name:"4:3",value:.75},{name:"21:9",value:.4285}],l=e.videoRatio,s=e.videoSizeOnlyPercentage,o=s?' style="display: none !important;"':"",a=e.videoHeightShow?"":' style="display: none !important;"',r=e.videoRatioShow?"":' style="display: none !important;"',c=s||e.videoHeightShow||e.videoRatioShow?"":' style="display: none !important;"';i+='
    "}return i+='
    ",n.innerHTML=i,n},open:function(){this.plugins.dialog.open.call(this,"video","video"===this.currentControllerName)},setVideoRatio:function(e){const t=this.context.video,n=e.target.options[e.target.selectedIndex].value;t._defaultSizeY=t._videoRatio=n?100*n+"%":t._defaultSizeY,t.inputY.placeholder=n?100*n+"%":"",t.inputY.value=""},setInputSize:function(e,t){if(t&&32===t.keyCode)return void t.preventDefault();const n=this.context.video;this.plugins.resizing._module_setInputSize.call(this,n,e),"y"===e&&this.plugins.video.setVideoRatioSelect.call(this,t.target.value||n._videoRatio)},setRatio:function(){this.plugins.resizing._module_setRatio.call(this,this.context.video)},_onload_video:function(e){this.plugins.video.setVideosInfo.call(this,e)},submitAction:function(){if(0===this.context.video.focusElement.value.trim().length)return!1;this.context.resizing._resize_plugin="video";const e=this.context.video;let t=null,n=null,i=null,l=e.focusElement.value.trim();if(e._align=e.modal.querySelector('input[name="suneditor_video_radio"]:checked').value,/^$/.test(l))t=(new this._w.DOMParser).parseFromString(l,"text/html").querySelector("iframe");else{if(t=this.util.createElement("IFRAME"),/youtu\.?be/.test(l)&&(/^http/.test(l)||(l="https://"+l),l=l.replace("watch?v=",""),/^\/\/.+\/embed\//.test(l)||(l=l.replace(l.match(/\/\/.+\//)[0],"//www.youtube.com/embed/").replace("&","?&")),e._youtubeQuery.length>0))if(/\?/.test(l)){const t=l.split("?");l=t[0]+"?"+e._youtubeQuery+"&"+t[1]}else l+="?"+e._youtubeQuery;t.src=l}this.context.dialog.updateModal?(e._element.src!==t.src&&(e._element.src=t.src),i=e._container,n=this.util.getParentElement(e._element,"FIGURE"),t=e._element):(t.frameBorder="0",t.allowFullscreen=!0,t.addEventListener("load",this.plugins.video._onload_video.bind(this,t)),e._element=t,n=this.plugins.resizing.set_cover.call(this,t),i=this.plugins.resizing.set_container.call(this,n,"se-video-container"),this._variable._videosCnt++),e._cover=n,e._container=i;const s=this.plugins.resizing._module_getSizeX.call(this,e)!==(e.inputX.value||e._defaultSizeX)||this.plugins.resizing._module_getSizeY.call(this,e)!==(e.inputY.value||e._videoRatio),o=!this.context.dialog.updateModal||s;e._resizing&&(this.context.video._proportionChecked=e.proportion.checked,t.setAttribute("data-proportion",e._proportionChecked));let a=!1;o&&(a=this.plugins.video.applySize.call(this)),a&&"center"===e._align||this.plugins.video.setAlign.call(this,null,t,n,i),this.context.dialog.updateModal?e._resizing&&this.context.resizing._rotateVertical&&o&&this.plugins.resizing.setTransformSize.call(this,t,null,null):this.insertComponent(i,!1),this.context.resizing._resize_plugin="",this.context.dialog.updateModal&&this.history.push(!1)},setVideosInfo:function(e){if(!e.getAttribute("data-origin")){const t=this.util.getParentElement(e,this.util.isMediaComponent),n=this.util.getParentElement(e,"FIGURE"),i=this.plugins.resizing._module_getSizeX.call(this,this.context.video,e,n,t),l=this.plugins.resizing._module_getSizeY.call(this,this.context.video,e,n,t);e.setAttribute("data-origin",i+","+l),e.setAttribute("data-size",i+","+l)}},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();try{this.plugins.video.submitAction.call(this)}finally{this.plugins.dialog.close.call(this),this.closeLoading()}return this.focus(),!1},_update_videoCover:function(e){if(!e)return;const t=this.context.video;e.frameBorder="0",e.allowFullscreen=!0,e.onload=e.addEventListener("load",this.plugins.video._onload_video.bind(this,e));const n=this.util.getParentElement(e,this.util.isMediaComponent)||this.util.getParentElement(e,function(e){return this.isWysiwygDiv(e.parentNode)}.bind(this.util));t._element=e=e.cloneNode(!1);const i=t._cover=this.plugins.resizing.set_cover.call(this,e),l=t._container=this.plugins.resizing.set_container.call(this,i,"se-video-container"),s=n.querySelector("figcaption");let o=null;s&&(o=this.util.createElement("DIV"),o.innerHTML=s.innerHTML,this.util.removeItem(s));const a=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.plugins.video.applySize.call(this,a[0]||this.context.option.videoWidth,a[1]||""),n.parentNode.replaceChild(l,n),o&&n.parentNode.insertBefore(o,l.nextElementSibling)},onModifyMode:function(e,t){const n=this.context.video;n._element=e,n._cover=this.util.getParentElement(e,"FIGURE"),n._container=this.util.getParentElement(e,this.util.isMediaComponent),n._align=e.getAttribute("data-align")||"none",n._element_w=t.w,n._element_h=t.h,n._element_t=t.t,n._element_l=t.l;let i=n._element.getAttribute("data-size")||n._element.getAttribute("data-origin");i?(i=i.split(","),n._origin_w=i[0],n._origin_h=i[1]):(n._origin_w=t.w,n._origin_h=t.h)},openModify:function(e){const t=this.context.video;if(t.focusElement.value=t._element.src,t.modal.querySelector('input[name="suneditor_video_radio"][value="'+t._align+'"]').checked=!0,t._resizing){this.plugins.resizing._module_setModifyInputSize.call(this,t,this.plugins.video);const e=t._videoRatio=this.plugins.resizing._module_getSizeY.call(this,t);this.plugins.video.setVideoRatioSelect.call(this,e)||(t.inputY.value=t._onlyPercentage?this.util.getNumber(e,2):e)}e||this.plugins.dialog.open.call(this,"video",!0)},on:function(e){if(!e){const e=this.context.video;e.inputX.value=e._origin_w=this.context.option.videoWidth===e._defaultSizeX?"":this.context.option.videoWidth,e.inputY.value=e._origin_h="",e.proportion.disabled=!0}},setVideoRatioSelect:function(e){let t=!1;const n=this.context.video,i=n.videoRatioOption.options;/%$/.test(e)||n._onlyPercentage?e=this.util.getNumber(e,2)/100+"":(!this.util.isNumber(e)||1*e>=1)&&(e=""),n.inputY.placeholder="";for(let l=0,s=i.length;l0||!n.style.width)&&t._update_videoCover.call(this,n);this.context.resizing._resize_plugin=""},sizeRevert:function(){this.plugins.resizing._module_sizeRevert.call(this,this.context.video)},applySize:function(e,t){const n=this.context.video;return e||(e=n.inputX.value),t||(t=n.inputY.value),n._onlyPercentage||/%$/.test(e)||!e?(this.plugins.video.setPercentSize.call(this,e||"100%",t||n._videoRatio),!0):(e&&"auto"!==e||t&&"auto"!==t?this.plugins.video.setSize.call(this,e,t||n._defaultRatio,!1):this.plugins.video.setAutoSize.call(this),!1)},setSize:function(e,t,n){const i=this.context.video;e=this.util.getNumber(e,0),t=this.util.isNumber(t)?t+i.sizeUnit:t||"",i._element.style.width=e?e+i.sizeUnit:"",i._cover.style.paddingBottom=i._cover.style.height=t,/%$/.test(t)?i._element.style.height="":i._element.style.height=t,n||i._element.removeAttribute("data-percentage"),this.plugins.resizing._module_saveCurrentSize.call(this,i)},setAutoSize:function(){this.plugins.video.setPercentSize.call(this,100,this.context.video._defaultRatio)},setOriginSize:function(e){const t=this.context.video;t._element.removeAttribute("data-percentage"),this.plugins.resizing.resetTransform.call(this,t._element),this.plugins.video.cancelPercentAttr.call(this);const n=((e?t._element.getAttribute("data-size"):"")||t._element.getAttribute("data-origin")||"").split(",");if(n){const e=n[0],i=n[1];t._onlyPercentage||/%$/.test(e)&&(/%$/.test(i)||!/\d/.test(i))?this.plugins.video.setPercentSize.call(this,e,i):this.plugins.video.setSize.call(this,e,i),this.plugins.resizing._module_saveCurrentSize.call(this,t)}},setPercentSize:function(e,t){const n=this.context.video;t=!t||/%$/.test(t)||this.util.getNumber(t,0)?this.util.isNumber(t)?t+n.sizeUnit:t||n._videoRatio:this.util.isNumber(t)?t+"%":t,n._container.style.width=this.util.isNumber(e)?e+"%":e,n._container.style.height="",n._cover.style.width="100%",n._cover.style.height=t,n._cover.style.paddingBottom=t,n._element.style.width="100%",n._element.style.height="100%",n._element.style.maxWidth="","center"===n._align&&this.plugins.video.setAlign.call(this,null,null,null,null),n._element.setAttribute("data-percentage",e+","+t),this.plugins.resizing._module_saveCurrentSize.call(this,n)},cancelPercentAttr:function(){const e=this.context.video;e._cover.style.width="",e._cover.style.height="",e._cover.style.paddingBottom="",e._container.style.width="",e._container.style.height="",this.util.removeClass(e._container,this.context.video._floatClassRegExp),this.util.addClass(e._container,"__se__float-"+e._align),"center"===e._align&&this.plugins.video.setAlign.call(this,null,null,null,null)},setAlign:function(e,t,n,i){const l=this.context.video;e||(e=l._align),t||(t=l._element),n||(n=l._cover),i||(i=l._container),n.style.margin=e&&"none"!==e?"auto":"0",/%$/.test(t.style.width)&&"center"===e?(i.style.minWidth="100%",n.style.width=i.style.width,n.style.height=n.style.paddingBottom,n.style.paddingBottom=this.util.getNumber(this.util.getNumber(n.style.paddingBottom,2)/100*this.util.getNumber(n.style.width,2),2)+"%"):(i.style.minWidth="",n.style.width=this.context.resizing._rotateVertical?t.style.height||t.offsetHeight:t.style.width||"100%",n.style.paddingBottom=n.style.height),this.util.hasClass(i,"__se__float-"+e)||(this.util.removeClass(i,l._floatClassRegExp),this.util.addClass(i,"__se__float-"+e)),t.setAttribute("data-align",e)},resetAlign:function(){const e=this.context.video;e._element.setAttribute("data-align",""),e._align="none",e._cover.style.margin="0",this.util.removeClass(e._container,e._floatClassRegExp)},destroy:function(){this._variable._videosCnt--;const e=this.context.video._container;let t=e.previousElementSibling||e.nextElementSibling;this.util.removeItem(e),this.plugins.video.init.call(this),this.controllersOff(),this.focusEdge(t),this.history.push(!1)},init:function(){const e=this.context.video;e.focusElement.value="",e._origin_w=this.context.option.videoWidth,e._origin_h="",e.modal.querySelector('input[name="suneditor_video_radio"][value="none"]').checked=!0,e._resizing&&(e.inputX.value=this.context.option.videoWidth===e._defaultSizeX?"":this.context.option.videoWidth,e.inputY.value="",e.proportion.checked=!0,e.proportion.disabled=!0,this.plugins.video.setVideoRatioSelect.call(this,e._defaultRatio))}},math:{name:"math",display:"dialog",add:function(e){e.addModule([r.a]);const t=e.context;t.math={focusElement:null,previewElement:null,fontSizeElement:null,_mathExp:null,_renderer:null};let n=this.setDialog.call(e);t.math.modal=n,t.math.focusElement=n.querySelector(".se-math-exp"),t.math.previewElement=n.querySelector(".se-math-preview"),t.math.fontSizeElement=n.querySelector(".se-math-size"),t.math._renderer=function(e){return this.src.renderToString(e,this.options)}.bind(e.context.option.katex),t.math.focusElement.addEventListener("keyup",this._renderMathExp.bind(t.math),!1),t.math.focusElement.addEventListener("change",this._renderMathExp.bind(t.math),!1),t.math.fontSizeElement.addEventListener("change",function(e){this.fontSize=e.target.value}.bind(t.math.previewElement.style),!1);let i=this.setController_MathButton.call(e);t.math.mathController=i,t.math._mathExp=null,i.addEventListener("mousedown",(function(e){e.stopPropagation()}),!1),n.querySelector(".se-btn-primary").addEventListener("click",this.submit.bind(e),!1),i.addEventListener("click",this.onClick_mathController.bind(e)),t.dialog.modal.appendChild(n),t.element.relative.appendChild(i),n=null,i=null},setDialog:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-dialog-content",t.style.display="none",t.innerHTML='
    '+e.dialogBox.mathBox.title+'

    ",t},setController_MathButton:function(){const e=this.lang,t=this.util.createElement("DIV");return t.className="se-controller se-controller-link",t.innerHTML='
    ",t},open:function(){this.plugins.dialog.open.call(this,"math","math"===this.currentControllerName)},_renderMathExp:function(e){this.previewElement.innerHTML=this._renderer(e.target.value)},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();const t=function(){if(0===this.context.math.focusElement.value.trim().length)return!1;const e=this.context.math,t=e.focusElement.value,n=e.previewElement.querySelector(".katex");if(!n)return!1;if(n.setAttribute("contenteditable",!1),n.setAttribute("data-exp",t),n.setAttribute("data-font-size",e.fontSizeElement.value),n.style.fontSize=e.fontSizeElement.value,this.context.dialog.updateModal){const t=function(e,n){if(e.classList.contains(n))return e;const i=e.parentNode;return i!==document.body?i.classList.contains(n)?i:void t(i,n):void 0},i=t(e._mathExp,"katex");i.parentNode.replaceChild(n,i),this.setRange(n,0,n,1)}else{const e=this.getSelectedElements();if(e.length>1){const t=this.util.createElement(e[0].nodeName);t.appendChild(n),this.insertNode(t)}else this.insertNode(n);const t=this.util.createTextNode(this.util.zeroWidthSpace);n.parentNode.insertBefore(t,n.nextSibling),this.setRange(n,0,n,1)}return e.focusElement.value="",e.fontSizeElement.value="1em",e.previewElement.style.fontSize="1em",e.previewElement.innerHTML="",!0}.bind(this);try{t()&&(this.plugins.dialog.close.call(this),this.history.push(!1))}catch(e){this.plugins.dialog.close.call(this)}finally{this.closeLoading()}return!1},active:function(e){if(e){if(e.getAttribute("data-exp"))return this.controllerArray.indexOf(this.context.math.mathController)<0&&(this.setRange(e,0,e,1),this.plugins.math.call_controller.call(this,e)),!0}else this.controllerArray.indexOf(this.context.math.mathController)>-1&&this.controllersOff();return!1},on:function(e){if(e){const e=this.context.math;if(e._mathExp){const t=e._mathExp.getAttribute("data-exp"),n=e._mathExp.getAttribute("data-font-size")||"1em";this.context.dialog.updateModal=!0,e.focusElement.value=t,e.fontSizeElement.value=n,e.previewElement.innerHTML=e._renderer(t),e.previewElement.style.fontSize=n}}else this.plugins.math.init.call(this)},call_controller:function(e){this.context.math._mathExp=e;const t=this.context.math.mathController,n=this.util.getOffset(e,this.context.element.wysiwygFrame);t.style.top=n.top+e.offsetHeight+10+"px",t.style.left=n.left-this.context.element.wysiwygFrame.scrollLeft+"px",t.style.display="block";const i=this.context.element.wysiwygFrame.offsetWidth-(t.offsetLeft+t.offsetWidth);i<0?(t.style.left=t.offsetLeft+i+"px",t.firstElementChild.style.left=20-i+"px"):t.firstElementChild.style.left="20px",this.controllersOn(t,e,"math")},onClick_mathController:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.math.focusElement.value=this.context.math._mathExp.getAttribute("data-exp"),this.plugins.dialog.open.call(this,"math",!0)):(this.util.removeItem(this.context.math._mathExp),this.context.math._mathExp=null,this.focus(),this.history.push(!1)),this.controllersOff())},init:function(){const e=this.context.math;e.mathController.style.display="none",e._mathExp=null,e.focusElement.value="",e.previewElement.innerHTML=""}}},g={redo:'',undo:'',bold:'',underline:'',italic:'',strike:'',subscript:'',superscript:'',erase:'',indent:'',outdent:'',expansion:'',reduction:'',code_view:'',preview:'',print:'',template:'',line_height:'',paragraph_style:'',text_style:'',save:'',blockquote:'',arrow_down:'',align_justify:'',align_left:'',align_right:'',align_center:'',font_color:'',highlight_color:'',list_bullets:'',list_number:'',table:'',horizontal_rule:'',show_blocks:'',cancel:'',image:'',video:'',link:'',math:'',unlink:'',table_header:'',merge_cell:'',split_cell:'',caption:'',edit:'',delete:'',modify:'',revert:'',auto_size:'',insert_row_below:'',insert_row_above:'',insert_column_left:'',insert_column_right:'',delete_row:'',delete_column:'',rotate_left:'',rotate_right:'',mirror_horizontal:'',mirror_vertical:'',checked:'',attachment:'',map:'',magic_stick:'',empty_file:'',more_horizontal:'',more_vertical:''},p=n("P6u4"),m=n.n(p);const f={_d:document,_w:window,isIE:null!==window.navigator.userAgent.match(/(MSIE|Trident.*rv[ :])([0-9]+)/),isIE_Edge:null!==window.navigator.userAgent.match(/(MSIE|Trident.*rv[ :])([0-9]+)/)||window.navigator.appVersion.indexOf("Edge")>-1,_tagConvertor:function(e){const t={b:"strong",i:"em",u:"ins",strike:"del",s:"del"};return e.replace(/(<\/?)(b|strong|i|em|u|ins|s|strike|del)\b\s*(?:[^>^<]+)?\s*(?=>)/gi,(function(e,n,i){return n+("string"==typeof t[i]?t[i]:i)}))},_HTMLConvertor:function(e){const t={"&":"&"," ":" ","'":""","<":"<",">":">"};return e.replace(/&|\u00A0|'|<|>/g,(function(e){return"string"==typeof t[e]?t[e]:e}))},zeroWidthSpace:"​",zeroWidthRegExp:new RegExp(String.fromCharCode(8203),"g"),onlyZeroWidthRegExp:new RegExp("^"+String.fromCharCode(8203)+"+$"),onlyZeroWidthSpace:function(e){return"string"!=typeof e&&(e=e.textContent),""===e||this.onlyZeroWidthRegExp.test(e)},getXMLHttpRequest:function(){if(!this._w.ActiveXObject)return this._w.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},createElement:function(e){return this._d.createElement(e)},createTextNode:function(e){return this._d.createTextNode(e||"")},getIncludePath:function(e,t){let n="";const i=[],l="js"===t?"script":"link",s="js"===t?"src":"href";let o="(?:";for(let t=0,n=e.length;t0?i[0][s]:""),-1===n.indexOf(":/")&&"//"!==n.slice(0,2)&&(n=0===n.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+n:location.href.match(/^[^\?]*\/(?:)/)[0]+n),!n)throw"[SUNEDITOR.util.getIncludePath.fail] The SUNEDITOR installation path could not be automatically detected. (name: +"+name+", extension: "+t+")";return n},getPageStyle:function(e){let t="";const n=(e||this._d).styleSheets;for(let e,i=0,l=n.length;i-1||(i+=n[e].name+'="'+n[e].value+'" ');return i},getByteLength:function(e){const t=this._w.encodeURIComponent;let n,i;return this.isIE_Edge?(i=this._w.unescape(t(e.toString())).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n):(i=new this._w.TextEncoder("utf-8").encode(e.toString()).length,n=0,null!==t(e.toString()).match(/(%0A|%0D)/gi)&&(n=t(e.toString()).match(/(%0A|%0D)/gi).length),i+n)},isWysiwygDiv:function(e){return!(!e||1!==e.nodeType||!this.hasClass(e,"se-wrapper-wysiwyg")&&!/^BODY$/i.test(e.nodeName))},isFormatElement:function(e){return!(!e||1!==e.nodeType||!/^(P|DIV|H[1-6]|PRE|LI)$/i.test(e.nodeName)&&!this.hasClass(e,"(\\s|^)__se__format__replace_.+(\\s|$)|(\\s|^)__se__format__free_.+(\\s|$)")||this.isComponent(e)||this.isWysiwygDiv(e))},isRangeFormatElement:function(e){return!(!e||1!==e.nodeType||!/^(BLOCKQUOTE|OL|UL|FIGCAPTION|TABLE|THEAD|TBODY|TR|TH|TD)$/i.test(e.nodeName)&&!this.hasClass(e,"(\\s|^)__se__format__range_.+(\\s|$)"))},isFreeFormatElement:function(e){return!(!e||1!==e.nodeType||!/^PRE$/i.test(e.nodeName)&&!this.hasClass(e,"(\\s|^)__se__format__free_.+(\\s|$)")||this.isComponent(e)||this.isWysiwygDiv(e))},isComponent:function(e){return e&&(/se-component/.test(e.className)||/^(TABLE|HR)$/.test(e.nodeName))},isMediaComponent:function(e){return e&&/se-component/.test(e.className)},getFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&e.firstElementChild,this.isFormatElement(e)&&t(e))return e;e=e.parentNode}return null},getRangeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isRangeFormatElement(e)&&!/^(THEAD|TBODY|TR)$/i.test(e.nodeName)&&t(e))return e;e=e.parentNode}return null},getFreeFormatElement:function(e,t){if(!e)return null;for(t||(t=function(){return!0});e;){if(this.isWysiwygDiv(e))return null;if(this.isFreeFormatElement(e)&&t(e))return e;e=e.parentNode}return null},copyTagAttributes:function(e,t){t.style.cssText&&(e.style.cssText+=t.style.cssText);const n=t.classList;for(let t=0,i=n.length;t0&&!this.isBreak(e);)e=e.firstChild;for(;t&&1===t.nodeType&&t.childNodes.length>0&&!this.isBreak(t);)t=t.lastChild;return{sc:e,ec:t||e}}},getOffset:function(e,t){let n=0,i=0,l=3===e.nodeType?e.parentElement:e;const s=this.getParentElement(e,this.isWysiwygDiv.bind(this));for(;l&&!this.hasClass(l,"se-container")&&l!==s;)n+=l.offsetLeft,i+=l.offsetTop,l=l.offsetParent;const o=t&&/iframe/i.test(t.nodeName);return{left:n+(o?t.parentElement.offsetLeft:0),top:i-s.scrollTop+(o?t.parentElement.offsetTop:0)}},getOverlapRangeAtIndex:function(e,t,n,i){if(e<=i?tn)return 0;const l=(e>n?e:n)-(t0?" ":"")+t)},removeClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").trim(),e.className.trim()||e.removeAttribute("class")},toggleClass:function(e,t){if(!e)return;const n=new this._w.RegExp("(\\s|^)"+t+"(\\s|$)");n.test(e.className)?e.className=e.className.replace(n," ").trim():e.className+=" "+t,e.className.trim()||e.removeAttribute("class")},removeItem:function(e){if(e)try{e.remove()}catch(t){e.parentNode.removeChild(e)}},removeItemAllParents:function(e,t,n){if(!e)return null;let i=null;return t||(t=function(e){if(e===n||this.isComponent(e))return!1;const t=e.textContent.trim();return 0===t.length||/^(\n|\u200B)+$/.test(t)}.bind(this)),function e(n){if(!f.isWysiwygDiv(n)){const l=n.parentNode;l&&t(n)&&(i={sc:n.previousElementSibling,ec:n.nextElementSibling},f.removeItem(n),e(l))}}(e),i},detachNestedList:function(e,t){const n=this.__deleteNestedList(e);let i,l,s;if(n){i=n.cloneNode(!1),l=n.childNodes;const t=this.getPositionIndex(e);for(;l[t];)i.appendChild(l[t])}else i=e;if(t)s=this.getListChildren(i,function(e){return this.isListCell(e)&&!e.previousElementSibling}.bind(this));else{const t=this.getElementDepth(e)+2;s=this.getListChildren(e,function(e){return this.isListCell(e)&&!e.previousElementSibling&&this.getElementDepth(e)===t}.bind(this))}for(let e=0,t=s.length;e=0){e.splitText(t);const n=this.getNodeFromPath([a+1],i);this.onlyZeroWidthSpace(n)&&(n.data=this.zeroWidthSpace)}}else 1===e.nodeType&&(e.previousSibling?e=e.previousSibling:this.getElementDepth(e)===n&&(r=!1));let c=e;for(;this.getElementDepth(c)>n;)for(a=this.getPositionIndex(c)+1,c=c.parentNode,o=l,l=c.cloneNode(!1),s=c.childNodes,o&&(this.isListCell(l)&&this.isList(o)&&o.firstElementChild&&(l.innerHTML=o.firstElementChild.innerHTML,f.removeItem(o.firstElementChild),o.children.length>0&&l.appendChild(o)),l.appendChild(o));s[a];)l.appendChild(s[a]);const d=c.parentNode;return r&&(c=c.nextSibling),l?(this.mergeSameTags(l,null,!1),this.mergeNestedTags(l,function(e){return this.isList(e)}.bind(this)),l.childNodes.length>0?d.insertBefore(l,c):l=c,0===i.childNodes.length&&this.removeItem(i),l):c},mergeSameTags:function(e,t,n){const i=this;let l=null;return t&&t.length>0&&(l=this._w.Array.apply(null,new this._w.Array(t.length)).map(this._w.Number.prototype.valueOf,0)),function e(s,o,a){const r=s.childNodes;for(let c,d,u=0,h=r.length;u=0;){if(i.getArrayIndex(l.childNodes,n)!==e[a]){r=!1;break}n=c.parentNode,l=n.parentNode,a--}r&&(e.splice(o,1),e[o]=u)}}i.copyTagAttributes(c,s),s.parentNode.insertBefore(c,s),i.removeItem(s)}if(!d){1===c.nodeType&&e(c,o+1,u);break}if(c.nodeName===d.nodeName&&i.isSameAttributes(c,d)&&c.href===d.href){const e=c.childNodes;let n=0;for(let t=0,i=e.length;t0&&n++;const s=c.lastChild,r=d.firstChild;if(s&&r){const e=3===s.nodeType&&3===r.nodeType;let i=s.textContent.length,c=s.previousSibling;for(;c&&3===c.nodeType;)i+=c.textContent.length,c=c.previousSibling;if(n>0&&3===s.nodeType&&3===r.nodeType&&(s.textContent.length>0||r.textContent.length>0)&&n--,t){let c=null;for(let d in t)if(c=t[d],c&&c[o]>u){if(o>0&&c[o-1]!==a)continue;c[o]-=1,c[o+1]>=0&&c[o]===u&&(c[o+1]+=n,e&&s&&3===s.nodeType&&r&&3===r.nodeType&&(l[d]+=i))}}}3===c.nodeType?c.textContent+=d.textContent:c.innerHTML+=d.innerHTML,i.removeItem(d),u--}else 1===c.nodeType&&e(c,o+1,u)}}(e,0,0),l},mergeNestedTags:function(e,t){"string"==typeof t?t=function(e){return this.test(e.tagName)}.bind(new this._w.RegExp("^("+(t||".+")+")$","i")):"function"!=typeof t&&(t=function(){return!0}),function e(n){let i=n.children;if(1===i.length&&i[0].nodeName===n.nodeName&&t(n)){const e=i[0];for(i=e.children;i[0];)n.appendChild(i[0]);n.removeChild(e)}for(let t=0,i=n.children.length;t")},htmlRemoveWhiteSpace:function(e){return e?e.trim().replace(/<\/?(?!strong|span|font|b|var|i|em|u|ins|s|strike|del|sub|sup|mark|a|label)[^>^<]+>\s+(?=<)/gi,(function(e){return e.trim()})):""},sortByDepth:function(e,t){const n=t?1:-1,i=-1*n;e.sort(function(e,t){return this.isListCell(e)&&this.isListCell(t)?(e=this.getElementDepth(e))>(t=this.getElementDepth(t))?n:e'}return n}()+("auto"===e.height?"":"");l.allowFullscreen=!0,l.frameBorder=0,l.addEventListener("load",(function(){this.setAttribute("scrolling","auto"),this.contentDocument.head.innerHTML=''+t,this.contentDocument.body.className="sun-editor-editable",this.contentDocument.body.setAttribute("contenteditable",!0)}))}else l.setAttribute("contenteditable",!0),l.setAttribute("scrolling","auto"),l.className+=" sun-editor-editable";l.style.height=e.height,l.style.minHeight=e.minHeight,l.style.maxHeight=e.maxHeight;const s=document.createElement("TEXTAREA");s.className="se-wrapper-inner se-wrapper-code",s.style.display="none",s.style.height=e.height,s.style.minHeight=e.minHeight,s.style.maxHeight=e.maxHeight,"auto"===e.height&&(s.style.overflow="hidden");let o=null,a=null,r=null,c=null;if(e.resizingBar&&(o=document.createElement("DIV"),o.className="se-resizing-bar sun-editor-common",a=document.createElement("DIV"),a.className="se-navigation sun-editor-common",o.appendChild(a),e.charCounter)){if(r=document.createElement("DIV"),r.className="se-char-counter-wrapper",e.charCounterLabel){const t=document.createElement("SPAN");t.className="se-char-label",t.textContent=e.charCounterLabel,r.appendChild(t)}if(c=document.createElement("SPAN"),c.className="se-char-counter",c.textContent="0",r.appendChild(c),e.maxCharCount>0){const t=document.createElement("SPAN");t.textContent=" / "+e.maxCharCount,r.appendChild(t)}o.appendChild(r)}let d=null;return e.placeholder&&(d=document.createElement("SPAN"),d.className="se-placeholder",d.innerText=e.placeholder),{bottomBar:{resizingBar:o,navigation:a,charWrapper:r,charCounter:c},wysiwygFrame:l,codeView:s,placeholder:d}},_initOptions:function(e,t){t.lang=t.lang||m.a,t._defaultTagsWhitelist="string"==typeof t._defaultTagsWhitelist?t._defaultTagsWhitelist:"br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup",t._editorTagsWhitelist=t._defaultTagsWhitelist+("string"==typeof t.addTagsWhitelist&&t.addTagsWhitelist.length>0?"|"+t.addTagsWhitelist:""),t.pasteTagsWhitelist="string"==typeof t.pasteTagsWhitelist?t.pasteTagsWhitelist:t._editorTagsWhitelist,t.attributesWhitelist=t.attributesWhitelist&&"object"==typeof t.attributesWhitelist?t.attributesWhitelist:null,t.mode=t.mode||"classic",t.toolbarWidth=t.toolbarWidth?_.isNumber(t.toolbarWidth)?t.toolbarWidth+"px":t.toolbarWidth:"auto",t.stickyToolbar=/balloon/i.test(t.mode)?-1:void 0===t.stickyToolbar?0:/^\d+/.test(t.stickyToolbar)?_.getNumber(t.stickyToolbar,0):-1,t.iframe=t.fullPage||t.iframe,t.iframeCSSFileName=t.iframe?"string"==typeof t.iframeCSSFileName?[t.iframeCSSFileName]:t.iframeCSSFileName||["suneditor"]:null,t.codeMirror=t.codeMirror?t.codeMirror.src?t.codeMirror:{src:t.codeMirror}:null,t.display=t.display||("none"!==e.style.display&&e.style.display?e.style.display:"block"),t.popupDisplay=t.popupDisplay||"full",t.resizingBar=void 0===t.resizingBar?!/inline|balloon/i.test(t.mode):t.resizingBar,t.showPathLabel=!!t.resizingBar&&("boolean"!=typeof t.showPathLabel||t.showPathLabel),t.charCounter=t.maxCharCount>0||"boolean"==typeof t.charCounter&&t.charCounter,t.charCounterType="byte"===t.charCounterType?"byte":"char",t.charCounterLabel="string"==typeof t.charCounterLabel?t.charCounterLabel.trim():null,t.maxCharCount=_.isNumber(t.maxCharCount)&&t.maxCharCount>-1?1*t.maxCharCount:null,t.width=t.width?_.isNumber(t.width)?t.width+"px":t.width:e.clientWidth?e.clientWidth+"px":"100%",t.minWidth=(_.isNumber(t.minWidth)?t.minWidth+"px":t.minWidth)||"",t.maxWidth=(_.isNumber(t.maxWidth)?t.maxWidth+"px":t.maxWidth)||"",t.height=t.height?_.isNumber(t.height)?t.height+"px":t.height:e.clientHeight?e.clientHeight+"px":"auto",t.minHeight=(_.isNumber(t.minHeight)?t.minHeight+"px":t.minHeight)||"",t.maxHeight=(_.isNumber(t.maxHeight)?t.maxHeight+"px":t.maxHeight)||"",t.defaultStyle="string"==typeof t.defaultStyle?t.defaultStyle:"",t.font=t.font?t.font:null,t.fontSize=t.fontSize?t.fontSize:null,t.formats=t.formats?t.formats:null,t.colorList=t.colorList?t.colorList:null,t.lineHeights=t.lineHeights?t.lineHeights:null,t.paragraphStyles=t.paragraphStyles?t.paragraphStyles:null,t.textStyles=t.textStyles?t.textStyles:null,t.fontSizeUnit="string"==typeof t.fontSizeUnit&&t.fontSizeUnit.trim()||"px",t.imageResizing=void 0===t.imageResizing||t.imageResizing,t.imageHeightShow=void 0===t.imageHeightShow||!!t.imageHeightShow,t.imageWidth=t.imageWidth?_.isNumber(t.imageWidth)?t.imageWidth+"px":t.imageWidth:"auto",t.imageSizeOnlyPercentage=!!t.imageSizeOnlyPercentage,t._imageSizeUnit=t.imageSizeOnlyPercentage?"%":"px",t.imageRotation=void 0!==t.imageRotation?t.imageRotation:!(t.imageSizeOnlyPercentage||!t.imageHeightShow),t.imageFileInput=void 0===t.imageFileInput||t.imageFileInput,t.imageUrlInput=void 0===t.imageUrlInput||!t.imageFileInput||t.imageUrlInput,t.imageUploadHeader=t.imageUploadHeader||null,t.imageUploadUrl=t.imageUploadUrl||null,t.imageUploadSizeLimit=/\d+/.test(t.imageUploadSizeLimit)?_.getNumber(t.imageUploadSizeLimit,0):null,t.videoResizing=void 0===t.videoResizing||t.videoResizing,t.videoHeightShow=void 0===t.videoHeightShow||!!t.videoHeightShow,t.videoRatioShow=void 0===t.videoRatioShow||!!t.videoRatioShow,t.videoWidth=t.videoWidth&&_.getNumber(t.videoWidth)?_.isNumber(t.videoWidth)?t.videoWidth+"px":t.videoWidth:"100%",t.videoSizeOnlyPercentage=!!t.videoSizeOnlyPercentage,t._videoSizeUnit=t.videoSizeOnlyPercentage?"%":"px",t.videoRotation=void 0!==t.videoRotation?t.videoRotation:!(t.videoSizeOnlyPercentage||!t.videoHeightShow),t.videoRatio=_.getNumber(t.videoRatio,4)||.5625,t.videoRatioList=t.videoRatioList?t.videoRatioList:null,t.youtubeQuery=(t.youtubeQuery||"").replace("?",""),t.callBackSave=t.callBackSave?t.callBackSave:null,t.templates=t.templates?t.templates:null,t.placeholder="string"==typeof t.placeholder?t.placeholder:null,t.katex=t.katex?t.katex.src?t.katex:{src:t.katex}:null,t.buttonList=t.buttonList||[["undo","redo"],["bold","underline","italic","strike","subscript","superscript"],["removeFormat"],["outdent","indent"],["fullScreen","showBlocks","codeView"],["preview","print"]],this.icons=t.icons&&"object"==typeof t.icons?[g,t.icons].reduce((function(e,t){for(let n in t)e[n]=t[n];return e}),{}):g},_defaultButtons:function(e){const t=this.icons;return{bold:["_se_command_bold",e.toolbar.bold+" (CTRL+B)","STRONG","",t.bold],underline:["_se_command_underline",e.toolbar.underline+" (CTRL+U)","INS","",t.underline],italic:["_se_command_italic",e.toolbar.italic+" (CTRL+I)","EM","",t.italic],strike:["_se_command_strike",e.toolbar.strike+" (CTRL+SHIFT+S)","DEL","",t.strike],subscript:["_se_command_subscript",e.toolbar.subscript,"SUB","",t.subscript],superscript:["_se_command_superscript",e.toolbar.superscript,"SUP","",t.superscript],removeFormat:["",e.toolbar.removeFormat,"removeFormat","",t.erase],indent:["_se_command_indent",e.toolbar.indent+" (CTRL+])","indent","",t.outdent],outdent:["_se_command_outdent",e.toolbar.outdent+" (CTRL+[)","outdent","",t.indent],fullScreen:["code-view-enabled",e.toolbar.fullScreen,"fullScreen","",t.expansion],showBlocks:["",e.toolbar.showBlocks,"showBlocks","",t.show_blocks],codeView:["code-view-enabled",e.toolbar.codeView,"codeView","",t.code_view],undo:["_se_command_undo",e.toolbar.undo+" (CTRL+Z)","undo","",t.undo],redo:["_se_command_redo",e.toolbar.redo+" (CTRL+Y / CTRL+SHIFT+Z)","redo","",t.redo],preview:["",e.toolbar.preview,"preview","",t.preview],print:["",e.toolbar.print,"print","",t.print],save:["_se_command_save",e.toolbar.save,"save","",t.save],blockquote:["",e.toolbar.tag_blockquote,"blockquote","command",t.blockquote],font:["se-btn-select se-btn-tool-font",e.toolbar.font,"font","submenu",''+e.toolbar.font+""+t.arrow_down],formatBlock:["se-btn-select se-btn-tool-format",e.toolbar.formats,"formatBlock","submenu",''+e.toolbar.formats+""+t.arrow_down],fontSize:["se-btn-select se-btn-tool-size",e.toolbar.fontSize,"fontSize","submenu",''+e.toolbar.fontSize+""+t.arrow_down],fontColor:["",e.toolbar.fontColor,"fontColor","submenu",t.font_color],hiliteColor:["",e.toolbar.hiliteColor,"hiliteColor","submenu",t.highlight_color],align:["se-btn-align",e.toolbar.align,"align","submenu",t.align_left],list:["",e.toolbar.list,"list","submenu",t.list_number],horizontalRule:["btn_line",e.toolbar.horizontalRule,"horizontalRule","submenu",t.horizontal_rule],table:["",e.toolbar.table,"table","submenu",t.table],lineHeight:["",e.toolbar.lineHeight,"lineHeight","submenu",t.line_height],template:["",e.toolbar.template,"template","submenu",t.template],paragraphStyle:["",e.toolbar.paragraphStyle,"paragraphStyle","submenu",t.paragraph_style],textStyle:["",e.toolbar.textStyle,"textStyle","submenu",t.text_style],link:["",e.toolbar.link,"link","dialog",t.link],image:["",e.toolbar.image,"image","dialog",t.image],video:["",e.toolbar.video,"video","dialog",t.video],math:["",e.toolbar.math,"math","dialog",t.math]}},_createModuleGroup:function(e){const t=_.createElement("DIV");t.className="se-btn-module"+(e?"":" se-btn-module-border");const n=_.createElement("UL");return n.className="se-menu-list",t.appendChild(n),{div:t,ul:n}},_createButton:function(e,t,n,i,l,s){const o=_.createElement("LI"),a=_.createElement("BUTTON");return a.setAttribute("type","button"),a.setAttribute("class","se-btn"+(e?" "+e:"")+" se-tooltip"),a.setAttribute("data-command",n),a.setAttribute("data-display",i),l+=''+t+"",s&&a.setAttribute("disabled",!0),a.innerHTML=l,o.appendChild(a),{li:o,button:a}},_createToolBar:function(e,t,n,i){const l=e.createElement("DIV");l.className="se-toolbar-separator-vertical";const s=e.createElement("DIV");s.className="se-toolbar sun-editor-common";const o=this._defaultButtons(i),a={},r={};if(n){const e=n.length?n:Object.keys(n).map((function(e){return n[e]}));for(let t,n=0,i=e.length;n0){for(let e=0;e":n),this.history.push(!0)},_nativeFocus:function(){const t=r.getParentElement(this.getSelectionNode(),"figcaption");t?t.focus():e.element.wysiwyg.focus(),this._editorRange()},focus:function(){if("none"!==e.element.wysiwygFrame.style.display){if(l.iframe)this._nativeFocus();else try{const e=this.getRange();if(e.startContainer===e.endContainer&&r.isWysiwygDiv(e.startContainer)){const e=r.createElement("P"),t=r.createElement("BR");e.appendChild(t),this.setRange(t,0,0,t)}else this.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}catch(e){this._nativeFocus()}u._applyTagEffects(),d._isBalloon&&u._toggleToolbarBalloon()}},focusEdge:function(e){if(r.isComponent(e)){const t=e.querySelector("IMG"),n=e.querySelector("IFRAME");t?this.selectComponent(t,"image"):n&&this.selectComponent(n,"video")}else(e=r.getChildElement(e,(function(e){return 0===e.childNodes.length||3===e.nodeType}),!0))?this.setRange(e,e.textContent.length,e,e.textContent.length):this._nativeFocus()},setRange:function(e,t,n,i){if(!e||!n)return;t>e.textContent.length&&(t=e.textContent.length),i>n.textContent.length&&(i=n.textContent.length);const l=this._wd.createRange();try{l.setStart(e,t),l.setEnd(n,i)}catch(e){this._nativeFocus()}const s=this.getSelection();s.removeAllRanges&&s.removeAllRanges(),s.addRange(l),this._editorRange()},removeRange:function(){this._variable._range=null,this._variable._selectionNode=null,this.getSelection().removeAllRanges();const e=this.commandMap,t=this.activePlugins;for(let i in e)t.indexOf(i)>-1?n[i].active.call(d,null):e.OUTDENT&&/^OUTDENT$/i.test(i)?e.OUTDENT.setAttribute("disabled",!0):e.INDENT&&/^INDENT$/i.test(i)?e.INDENT.removeAttribute("disabled"):r.removeClass(e[i],"active")},getRange:function(){return this._variable._range||this._createDefaultRange()},getSelection:function(){return this._ww.getSelection()},getSelectionNode:function(){return this._variable._selectionNode&&!r.isWysiwygDiv(this._variable._selectionNode)||this._editorRange(),this._variable._selectionNode||e.element.wysiwyg.firstChild},_editorRange:function(){const e=this.getSelection();let t=null,n=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable._range=t,n=t.collapsed?t.commonAncestorContainer:e.extentNode||e.anchorNode,this._variable._selectionNode=n},_createDefaultRange:function(){e.element.wysiwyg.focus();const t=this._wd.createRange();return e.element.wysiwyg.firstChild||this.execCommand("formatBlock",!1,"P"),t.setStart(e.element.wysiwyg.firstChild,0),t.setEnd(e.element.wysiwyg.firstChild,0),t},_resetRangeToTextNode:function(){const t=this.getRange();let n,i,l,s=t.startContainer,o=t.startOffset,a=t.endContainer,c=t.endOffset;if(n=r.isWysiwygDiv(s)?e.element.wysiwyg.firstChild:s,i=o,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType;)n=n.childNodes[i]||n.nextElementSibling||n.nextSibling,i=0;let e=r.getFormatElement(n);e===r.getRangeFormatElement(e)&&(e=r.createElement(r.getParentElement(n,r.isCell)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,e&&(s===a&&(a=n,c=1),r.removeItem(s))}}if(s=n,o=i,n=r.isWysiwygDiv(a)?e.element.wysiwyg.lastChild:a,i=c,r.isBreak(n)||1===n.nodeType&&n.childNodes.length>0){const e=r.isBreak(n);if(!e){for(;n&&!r.isBreak(n)&&1===n.nodeType&&(l=n.childNodes,0!==l.length);)n=l[i>0?i-1:i]||!/FIGURE/i.test(l[0].nodeName)?l[0]:n.previousElementSibling||n.previousSibling||s,i=i>0?n.textContent.length:i;let e=r.getFormatElement(n);e===r.getRangeFormatElement(e)&&(e=r.createElement(r.isCell(e)?"DIV":"P"),n.parentNode.insertBefore(e,n),e.appendChild(n))}if(r.isBreak(n)){const t=r.createTextNode(r.zeroWidthSpace);n.parentNode.insertBefore(t,n),n=t,i=1,e&&r.removeItem(a)}}a=n,c=i,this.setRange(s,o,a,c)},getSelectedElements:function(t){this._resetRangeToTextNode();let n=this.getRange();if(r.isWysiwygDiv(n.startContainer)){const t=e.element.wysiwyg.children;if(0===t.length)return null;this.setRange(t[0],0,t[t.length-1],t[t.length-1].textContent.trim().length),n=this.getRange()}const i=n.startContainer,l=n.endContainer,s=n.commonAncestorContainer,o=r.getListChildren(s,(function(e){return t?t(e):r.isFormatElement(e)}));if(r.isWysiwygDiv(s)||r.isRangeFormatElement(s)||o.unshift(r.getFormatElement(s)),i===l||1===o.length)return o;let a=r.getFormatElement(i),c=r.getFormatElement(l),d=null,u=null;const h=function(e){return!r.isTable(e)||/^TABLE$/i.test(e.nodeName)};let g=r.getRangeFormatElement(a,h),p=r.getRangeFormatElement(c,h);r.isTable(g)&&r.isListCell(g.parentNode)&&(g=g.parentNode),r.isTable(p)&&r.isListCell(p.parentNode)&&(p=p.parentNode);const m=g===p;for(let e,t=0,n=o.length;t=0;n--)if(i[n].contains(i[e])){i.splice(e,1),e--,t--;break}return i},isEdgePoint:function(e,t){return 0===t||!e.nodeValue&&1===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendFormatTag:function(e,t){const n=r.getFormatElement(this.getSelectionNode()),i=t?"string"==typeof t?t:t.nodeName:r.isFormatElement(n)&&!r.isFreeFormatElement(n)?n.nodeName:"P",l=r.createElement(i);return l.innerHTML="
    ",(t&&"string"!=typeof t||!t&&r.isFormatElement(n))&&r.copyTagAttributes(l,t||n),r.isCell(e)?e.insertBefore(l,e.nextElementSibling):e.parentNode.insertBefore(l,e.nextElementSibling),l},insertComponent:function(e,t){const n=this.removeNode();let i=null,l=this.getSelectionNode(),s=r.getFormatElement(l);if(r.isListCell(s))if(/^HR$/i.test(e.nodeName)){const t=r.createElement("LI"),n=r.createTextNode(r.zeroWidthSpace);t.appendChild(e),t.appendChild(n),s.parentNode.insertBefore(t,s.nextElementSibling),this.setRange(n,1,n,1)}else this.insertNode(e,l===s?null:n.container.nextSibling),e.nextSibling||e.parentNode.appendChild(r.createElement("BR")),i=r.createElement("LI"),s.parentNode.insertBefore(i,s.nextElementSibling);else{if(this.getRange().collapsed&&(3===n.container.nodeType||r.isBreak(n.container))){const e=r.getParentElement(n.container,function(e){return this.isRangeFormatElement(e)}.bind(r));i=r.splitElement(n.container,n.offset,e?r.getElementDepth(e)+1:0),i&&(s=i.previousSibling)}this.insertNode(e,s),i||(i=this.appendFormatTag(e,r.isFormatElement(s)?s:null))}return this.setRange(i,0,i,0),t||this.history.push(!1),i},selectComponent:function(e,t){if("image"===t){if(!d.plugins.image)return;d.removeRange(),d.callPlugin("image",(function(){const t=d.plugins.resizing.call_controller_resize.call(d,e,"image");d.plugins.image.onModifyMode.call(d,e,t),r.getParentElement(e,".se-image-container")||(d.plugins.image.openModify.call(d,!0),d.plugins.image.update_image.call(d,!0,!0,!0))}))}else if("video"===t){if(!d.plugins.video)return;d.removeRange(),d.callPlugin("video",(function(){const t=d.plugins.resizing.call_controller_resize.call(d,e,"video");d.plugins.video.onModifyMode.call(d,e,t)}))}},insertNode:function(e,t){const n=this.getRange(),i=n.startContainer,l=n.startOffset,s=n.endContainer,o=n.endOffset,a=n.commonAncestorContainer;let c=null,d=null;if(t)c=t.parentNode,t=t.nextSibling,d=!0;else if(c=i,3===i.nodeType&&(c=i.parentNode),n.collapsed)if(3===a.nodeType)t=a.textContent.length>o?a.splitText(o):a.nextSibling;else if(r.isBreak(c))t=c,c=c.parentNode;else{let n=c.childNodes[l];const i=n&&3===n.nodeType&&r.onlyZeroWidthSpace(n)&&r.isBreak(n.nextSibling)?n.nextSibling:n;i?i.nextSibling?t=r.isBreak(i)&&!r.isBreak(e)?i:i.nextSibling:(c.removeChild(i),t=null):t=null}else{if(i===s){t=this.isEdgePoint(s,o)?s.nextSibling:s.splitText(o);let e=i;this.isEdgePoint(i,l)||(e=i.splitText(l)),c.removeChild(e)}else for(this.removeNode(),c=a,t=s;t&&t.parentNode!==a;)t=t.parentNode}try{if(r.isFormatElement(e)||r.isRangeFormatElement(e)||!r.isListCell(c)&&r.isComponent(e))if(r.isList(t))c=t,t=null;else if(!d&&!t){const e=this.removeNode(),n=3===e.container.nodeType?r.isListCell(r.getFormatElement(e.container))?e.container:r.getFormatElement(e.container)||e.container.parentNode:e.container,i=r.isWysiwygDiv(n)||r.isRangeFormatElement(n);c=i?n:n.parentNode,t=i?null:n.nextSibling}t===a&&r.isBreak(t)&&!r.isBreak(e)&&(t=t.nextSibling),c.insertBefore(e,t)}catch(t){c.appendChild(e)}finally{let t=1;if(3===e.nodeType){const t=e.previousSibling,n=e.nextSibling,i=!t||3!==t.nodeType||r.onlyZeroWidthSpace(t)?"":t.textContent,l=!n||3!==n.nodeType||r.onlyZeroWidthSpace(n)?"":n.textContent;return t&&i.length>0&&(e.textContent=i+e.textContent,r.removeItem(t)),n&&n.length>0&&(e.textContent+=l,r.removeItem(n)),{startOffset:i.length,endOffset:e.textContent.length-l.length}}if(!r.isBreak(e)&&r.isFormatElement(c)){let n=null;e.previousSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.insertBefore(n,e)),e.nextSibling||(n=r.createTextNode(r.zeroWidthSpace),e.parentNode.appendChild(n)),r._isIgnoreNodeChange(e)&&(e=e.nextSibling,t=0)}this.setRange(e,t,e,t),this.history.push(!0)}},removeNode:function(){const e=this.getRange();let t,n=0,i=e.startContainer,l=e.endContainer;const s=e.startOffset,o=e.endOffset,a=e.commonAncestorContainer;let c=null,d=null;const u=r.getListChildNodes(a);let h=r.getArrayIndex(u,i),g=r.getArrayIndex(u,l);if(u.length>0&&h>-1&&g>-1){for(let e=h+1,t=i;e>=0;e--)u[e]===t.parentNode&&u[e].firstChild===t&&0===s&&(h=e,t=t.parentNode);for(let e=g-1,t=l;e>h;e--)u[e]===t.parentNode&&1===u[e].nodeType&&(u.splice(e,1),t=t.parentNode,--g)}else{if(0===u.length){if(r.isFormatElement(a)||r.isRangeFormatElement(a)||r.isFormatElement(a))return{container:a,offset:0};u.push(a),i=l=a}else if(i=l=u[0],r.isBreak(i))return{container:i,offset:0};h=g=0}function p(e){const t=r.getFormatElement(e);if(r.removeItem(e),r.isListCell(t)){const e=r.getArrayItem(t.children,r.isList,!1);if(e){const n=e.firstElementChild,i=n.childNodes;for(;i[0];)t.insertBefore(i[0],e);r.removeItemAllParents(n)}}}for(let e=h;e<=g;e++){const t=u[e];if(0===t.length||3===t.nodeType&&void 0===t.data)p(t);else if(t!==i)t!==l?p(t):(d=1===l.nodeType?r.createTextNode(l.textContent):r.createTextNode(l.substringData(o,l.length-o)),d.length>0?l.data=d.data:p(l));else if(1===i.nodeType?c=r.createTextNode(i.textContent):t===l?(c=r.createTextNode(i.substringData(0,s)+l.substringData(o,l.length-o)),n=s):c=r.createTextNode(i.substringData(0,s)),c.length>0?i.data=c.data:p(i),t===l)break}return t=l&&l.parentNode?l:i&&i.parentNode?i:e.endContainer||e.startContainer,this.setRange(t,n,t,n),this.history.push(!0),{container:t,offset:n}},applyRangeFormatElement:function(e){const t=this.getSelectedElementsAndComponents(!1);if(!t||0===t.length)return;e:for(let e,n,i,l,s,o,a=0,c=t.length;a-1&&(l=n.lastElementChild,t.indexOf(l)>-1)){let e=null;for(;e=l.lastElementChild;)if(r.isList(e)){if(!(t.indexOf(e.lastElementChild)>-1))continue e;l=e.lastElementChild}i=n.firstElementChild,s=t.indexOf(i),o=t.indexOf(l),t.splice(s,o-s+1),c=t.length}else;let n,i,l,s=t[t.length-1];n=r.isRangeFormatElement(s)||r.isFormatElement(s)?s:r.getRangeFormatElement(s)||r.getFormatElement(s),r.isCell(n)?(i=null,l=n):(i=n.nextSibling,l=n.parentNode);let o=r.getElementDepth(n),a=null;const c=[],d=function(e,t,n){let i=null;if(e!==t&&!r.isTable(t)){if(t&&r.getElementDepth(e)===r.getElementDepth(t))return n;i=r.removeItemAllParents(t,null,e)}return i?i.ec:n};for(let n,s,u,h,g,p,m,f=0,_=t.length;f<_;f++)if(n=t[f],s=n.parentNode,s&&!e.contains(s))if(u=r.getElementDepth(n),r.isList(s)){if(null===a&&(p?(a=p,m=!0,p=null):a=s.cloneNode(!1)),c.push(n),g=t[f+1],f===_-1||g&&g.parentNode!==s){g&&n.contains(g.parentNode)&&(p=g.parentNode.cloneNode(!1));let t,f=s.parentNode;for(;r.isList(f);)t=r.createElement(f.nodeName),t.appendChild(a),a=t,f=f.parentNode;const _=this.detachRangeFormatElement(s,c,null,!0,!0);o>=u?(o=u,l=_.cc,i=d(l,s,_.ec),i&&(l=i.parentNode)):l===_.cc&&(i=_.ec),l!==_.cc&&(h=d(l,_.cc,h),i=void 0!==h?h:_.cc);for(let e=0,t=_.removeArray.length;e=u&&(o=u,l=s,i=n.nextSibling),e.appendChild(n),l!==s&&(h=d(l,s),void 0!==h&&(i=h));if(this.effectNode=null,r.mergeSameTags(e,null,!1),r.mergeNestedTags(e,function(e){return this.isList(e)}.bind(r)),i&&r.getElementDepth(i)>0&&(r.isList(i.parentNode)||r.isList(i.parentNode.parentNode))){const t=r.getParentElement(i,function(e){return this.isRangeFormatElement(e)&&!this.isList(e)}.bind(r)),n=r.splitElement(i,null,t?r.getElementDepth(t)+1:0);n.parentNode.insertBefore(e,n)}else l.insertBefore(e,i),d(e,i);const u=r.getEdgeChildNodes(e.firstElementChild,e.lastElementChild);t.length>1?this.setRange(u.sc,0,u.ec,u.ec.textContent.length):this.setRange(u.ec,u.ec.textContent.length,u.ec,u.ec.textContent.length),this.history.push(!1)},detachRangeFormatElement:function(e,t,n,i,l){const s=this.getRange(),o=s.startOffset,a=s.endOffset;let c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),d=e.parentNode,u=null,h=null,g=e.cloneNode(!1);const p=[],m=r.isList(n);let f=!1,_=!1,b=!1;function v(t,n,i,l){if(r.onlyZeroWidthSpace(n)&&(n.innerHTML=r.zeroWidthSpace),3===n.nodeType)return t.insertBefore(n,i),n;const s=(b?n:l).childNodes;let o=n.cloneNode(!1),a=null,c=null;for(;s[0];)c=s[0],!r._notTextNode(c)||r.isBreak(c)||r.isListCell(o)?o.appendChild(c):(o.childNodes.length>0&&(a||(a=o),t.insertBefore(o,i),o=n.cloneNode(!1)),t.insertBefore(c,i),a||(a=c));if(o.childNodes.length>0){if(r.isListCell(t)&&r.isListCell(o)&&r.isList(i))if(m){for(a=i;i;)o.appendChild(i),i=i.nextSibling;t.parentNode.insertBefore(o,t.nextElementSibling)}else{const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else t.insertBefore(o,i);a||(a=o)}return a}for(let l,s,o,a=0,y=c.length;a0&&(d.insertBefore(g,e),g=null),!m&&r.isListCell(l))if(o&&r.getElementDepth(l)!==r.getElementDepth(o)&&(r.isListCell(d)||r.getArrayItem(l.children,r.isList,!1))){const t=l.nextElementSibling,n=r.detachNestedList(l,!1);e===n&&t===l.nextElementSibling||(e=n,_=!0)}else{const t=l;l=r.createElement(i?t.nodeName:r.isList(e.parentNode)||r.isListCell(e.parentNode)?"LI":r.isCell(e.parentNode)?"DIV":"P");const n=r.isListCell(l),s=t.childNodes;for(;s[0]&&(!r.isList(s[0])||n);)l.appendChild(s[0]);r.copyFormatAttributes(l,t),b=!0}else l=l.cloneNode(!1);if(_){_=b=!1,c=r.getListChildNodes(e,(function(t){return t.parentNode===e})),g=e.cloneNode(!1),d=e.parentNode,a=-1,y=c.length;continue}i?(p.push(l),r.removeItem(c[a])):(n?(f||(d.insertBefore(n,e),f=!0),l=v(n,l,null,c[a])):l=v(d,l,e,c[a]),t?(h=l,u||(u=l)):u||(u=h=l))}const y=e.parentNode;let x=e.nextSibling;g&&g.children.length>0&&y.insertBefore(g,x),n?u=n.previousSibling:u||(u=e.previousSibling),x=e.nextSibling,0===e.children.length||0===e.textContent.length?r.removeItem(e):r.removeEmptyNode(e,null);let C=null;if(i)C={cc:y,sc:u,ec:x,removeArray:p};else{u||(u=h),h||(h=u);const e=r.getEdgeChildNodes(u,h.parentNode?u:h);C={cc:(e.sc||e.ec).parentNode,sc:e.sc,ec:e.ec}}if(this.effectNode=null,l)return C;!i&&C&&(t?this.setRange(C.sc,o,C.ec,a):this.setRange(C.sc,0,C.sc,0)),this.history.push(!1)},detachList:function(e,t){let n={},i=!1,l=!1,s=null,o=null;const a=function(e){return!this.isComponent(e)}.bind(r);for(let c,d,u,h,g=0,p=e.length;g0)&&t,n=!!(n&&n.length>0)&&n;const s=!e,o=s&&!n&&!t;let c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset;if(o&&l.collapsed&&r.isFormatElement(c.parentNode)&&r.isFormatElement(u.parentNode)||c===u&&1===c.nodeType&&"false"===c.getAttribute("contenteditable"))return;if(l.collapsed&&!o&&1===c.nodeType&&!r.isBreak(c)){let e=null;const t=c.childNodes[d];t&&(t.nextSibling?e=r.isBreak(t)?t:t.nextSibling:(c.removeChild(t),e=null));const n=r.createTextNode(r.zeroWidthSpace);c.insertBefore(n,e),this.setRange(n,1,n,1),l=this.getRange(),c=l.startContainer,d=l.startOffset,u=l.endContainer,h=l.endOffset}r.isFormatElement(c)&&(c=c.childNodes[d],d=0),r.isFormatElement(u)&&(u=u.childNodes[h],h=u.textContent.length),s&&(e=r.createElement("DIV"));const g=e.nodeName;if(!o&&c===u&&!n&&e){let t=c,n=0;const i=[],l=e.style;for(let e=0,t=l.length;e0){for(;!r.isFormatElement(t)&&!r.isWysiwygDiv(t);){for(let l=0;l=i.length)return}}let p,m={},f={},_="",b="",v="";if(t){for(let e,n=0,i=t.length;n0&&(c=l.replace(_,"").trim(),c!==l&&(y.v=!0));const d=t.className;let u="";return b&&d.length>0&&(u=d.replace(b,"").trim(),u!==d&&(y.v=!0)),(!s||!b&&d||!_&&l||c||u||!n)&&(c||u||t.nodeName!==g||a.Boolean(_)!==a.Boolean(l)||a.Boolean(b)!==a.Boolean(d))?(_&&l.length>0&&(t.style.cssText=c),t.style.cssText||t.removeAttribute("style"),b&&d.length>0&&(t.className=u.trim()),t.className.trim()||t.removeAttribute("class"),t.style.cssText||t.className||t.nodeName!==g&&!n?t:(y.v=!0,null)):(y.v=!0,null)},C=this.getSelectedElements();r.getFormatElement(c)||(c=r.getChildElement(C[0],(function(e){return 3===e.nodeType})),d=0),r.getFormatElement(u)||(u=r.getChildElement(C[C.length-1],(function(e){return 3===e.nodeType})),h=u.textContent.length);const w=r.getFormatElement(c)===r.getFormatElement(u),E=C.length-(w?0:1);p=e.cloneNode(!1);const N=o||s&&function(e,t){for(let n=0,i=e.length;n0&&(p=e.cloneNode(!1),f=this._nodeChange_endLine(C[E],p,x,u,h,o,s,y,S,T));for(let t=E-1;t>0;t--)p=e.cloneNode(!1),this._nodeChange_middleLine(C[t],p,x,o,s,y);p=e.cloneNode(!1),m=this._nodeChange_startLine(C[0],p,x,c,d,o,s,y,S,T),E<=0&&(f=m)}this.controllersOff(),this.setRange(m.container,m.offset,f.container,f.offset),this.history.push(!1)},_stripRemoveNode:function(e){const t=e.parentNode;if(!e||3===e.nodeType||!t)return;const n=e.childNodes;for(;n[0];)t.insertBefore(n[0],e);t.removeChild(e)},_util_getMaintainedNode:function(e,t){return t&&!e?this.getParentElement(t,function(e){return this._isMaintainedNode(e)}.bind(this)):null},_util_isMaintainedNode:function(e,t){return t&&!e&&3!==t.nodeType&&this._isMaintainedNode(t)},_nodeChange_oneLine:function(e,t,n,i,l,s,o,c,d,u,h,g,p){let m=i.parentNode;for(;!(m.nextSibling||m.previousSibling||r.isFormatElement(m.parentNode)||r.isWysiwygDiv(m.parentNode))&&m.nodeName!==t.nodeName;)m=m.parentNode;if(!d&&m===s.parentNode&&m.nodeName===t.nodeName&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))&&r.onlyZeroWidthSpace(s.textContent.slice(o))){const e=m.childNodes;let n=!0;for(let t,l,o,a,c=0,d=e.length;c0&&(n=t.test(e.style.cssText)),!n}if(function e(i,l){const s=i.childNodes;for(let i,o=0,a=s.length;o=S?L-S:N.data.length-S));if(E){const t=g(l);if(t&&t.parentNode!==e){let n=t,i=null;for(;n.parentNode!==e;){for(l=i=n.parentNode.cloneNode(!1);n.childNodes[0];)i.appendChild(n.childNodes[0]);n.appendChild(i),n=n.parentNode}n.parentNode.appendChild(t)}E=E.cloneNode(!1)}r.onlyZeroWidthSpace(s)||l.appendChild(s);const a=g(l);for(a&&(E=a),E&&(e=E),x=d,y=[],w="";x!==e&&x!==f&&null!==x;)i=p(x)?null:n(x),i&&1===x.nodeType&&A(x)&&(y.push(i),w+=x.style.cssText.substr(0,x.style.cssText.indexOf(":"))+"|"),x=x.parentNode;const c=y.pop()||o;for(C=x=c;y.length>0;)x=y.pop(),C.appendChild(x),C=x;if(t.appendChild(c),e.appendChild(t),E&&!g(T)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),N=o,S=0,k=!0,x!==o&&x.appendChild(N),!v)continue}if(z||d!==T){if(k){if(1===d.nodeType&&!r.isBreak(d)){r._isIgnoreNodeChange(d)?(b.appendChild(d),o--,a--,u||(t=t.cloneNode(!1),b.appendChild(t),_.push(t))):e(d,d);continue}x=d,y=[],w="";const s=[];for(;null!==x.parentNode&&x!==f&&x!==t;)i=z?x.cloneNode(!1):n(x),1===x.nodeType&&!r.isBreak(d)&&i&&A(x)&&(i&&(p(i)?E||s.push(i):y.push(i)),w+=x.style.cssText.substr(0,x.style.cssText.indexOf(":"))+"|"),x=x.parentNode;y=y.concat(s);const c=y.pop()||d;for(C=x=c;y.length>0;)x=y.pop(),C.appendChild(x),C=x;if(p(t.parentNode)&&!p(c)&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),z||E||!p(c))c===d?l=z?b:t:z?(b.appendChild(c),l=x):(t.appendChild(c),l=x);else{t=t.cloneNode(!1);const e=c.childNodes;for(let n=0,i=e.length;n0?x:t}if(E&&3===d.nodeType)if(g(d)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===b}.bind(r));E.appendChild(e),t=e.cloneNode(!1),_.push(t),b.appendChild(t)}else E=null}h=d.cloneNode(!1),l.appendChild(h),1!==d.nodeType||r.isBreak(d)||(m=h),e(d,m)}else{E=g(d);const e=r.createTextNode(1===T.nodeType?"":T.substringData(L,T.length-L)),l=r.createTextNode(v||1===T.nodeType?"":T.substringData(0,L));if(E?E=E.cloneNode(!1):p(t.parentNode)&&!E&&(t=t.cloneNode(!1),b.appendChild(t),_.push(t)),!r.onlyZeroWidthSpace(e)){x=d,w="",y=[];const t=[];for(;x!==b&&x!==f&&null!==x;)1===x.nodeType&&A(x)&&(p(x)?t.push(x.cloneNode(!1)):y.push(x.cloneNode(!1)),w+=x.style.cssText.substr(0,x.style.cssText.indexOf(":"))+"|"),x=x.parentNode;for(y=y.concat(t),h=C=x=y.pop()||e;y.length>0;)x=y.pop(),C.appendChild(x),C=x;b.appendChild(h),x.textContent=e.data}if(E&&h){const e=g(h);e&&(E=e)}for(x=d,y=[],w="";x!==b&&x!==f&&null!==x;)i=p(x)?null:n(x),i&&1===x.nodeType&&A(x)&&(y.push(i),w+=x.style.cssText.substr(0,x.style.cssText.indexOf(":"))+"|"),x=x.parentNode;const s=y.pop()||l;for(C=x=s;y.length>0;)x=y.pop(),C.appendChild(x),C=x;E?((t=t.cloneNode(!1)).appendChild(s),E.insertBefore(t,E.firstChild),b.appendChild(E),_.push(t),E=null):t.appendChild(s),T=l,L=l.data.length,z=!0,!c&&u&&(t=l,l.textContent=r.zeroWidthSpace),x!==l&&x.appendChild(T)}}}(e,b),d&&!c&&!h.v)return{startContainer:i,startOffset:l,endContainer:s,endOffset:o};if(c=c&&d)for(let e=0;e<_.length;e++){let t,n,i,l=_[e];if(u)t=r.createTextNode(r.zeroWidthSpace),b.replaceChild(t,l);else{const e=l.childNodes;for(n=e[0];e[0];)i=e[0],b.insertBefore(i,l);r.removeItem(l)}0===e&&(u?N=T=t:(N=n,T=i))}else{if(d)for(let e=0;e<_.length;e++)this._stripRemoveNode(_[e]);u&&(N=T=t)}r.removeEmptyNode(b,t),u&&(S=N.textContent.length,L=T.textContent.length);const B=c||0===T.textContent.length;r.isBreak(T)||0!==T.textContent.length||(r.removeItem(T),T=N),L=B?T.textContent.length:L;const H={s:0,e:0},M=r.getNodePath(N,b,H),I=!T.parentNode;I&&(T=N);const R={s:0,e:0},D=r.getNodePath(T,b,I||B?null:R);S+=H.s,L=u?S:I?N.textContent.length:B?L+H.s:L+R.s;const O=r.mergeSameTags(b,[M,D],!0);return e.parentNode.replaceChild(b,e),N=r.getNodeFromPath(M,b),T=r.getNodeFromPath(D,b),{startContainer:N,startOffset:S+O[0],endContainer:T,endOffset:L+O[1]}},_nodeChange_startLine:function(e,t,n,i,l,s,o,a,c,d){let u=i.parentNode;for(;!(u.nextSibling||u.previousSibling||r.isFormatElement(u.parentNode)||r.isWysiwygDiv(u.parentNode))&&u.nodeName!==t.nodeName;)u=u.parentNode;if(!o&&u.nodeName===t.nodeName&&!r.isFormatElement(u)&&!u.nextSibling&&r.onlyZeroWidthSpace(i.textContent.slice(0,l))){let e=!0,n=i.previousSibling;for(;n;){if(!r.onlyZeroWidthSpace(n)){e=!1;break}n=n.previousSibling}if(e)return r.copyTagAttributes(u,t),{container:i,offset:l}}a.v=!1;const h=e,g=[t],p=e.cloneNode(!1);let m,f,_,b,v=i,y=l,x=!1;if(function e(i,l){const s=i.childNodes;for(let i,o=0,a=s.length;o0,y=m.pop()||u;for(_=f=y;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(y)&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t)),!b&&d(y)){t=t.cloneNode(!1);const e=y.childNodes;for(let n=0,i=e.length;n0;)f=m.pop(),_.appendChild(f),_=f;d!==l?(t.appendChild(d),l=f):l=t,r.isBreak(u)&&t.appendChild(u.cloneNode(!1)),e.appendChild(t),v=o,y=0,x=!0,l.appendChild(v)}}}(e,p),o&&!s&&!a.v)return{container:i,offset:l};if(s=s&&o)for(let e=0;e0&&c===d)return void(e.innerHTML=n.innerHTML)}s.v=!1;const o=e.cloneNode(!1),a=[t];let c=!0;if(function e(i,l){const s=i.childNodes;for(let i,d=0,u=s.length;d0&&(o.appendChild(t),t=t.cloneNode(!1)),o.appendChild(h),o.appendChild(t),a.push(t),l=t,d--,u--)}}(e,t),!c&&(!l||i||s.v)){if(o.appendChild(t),i&&l)for(let e=0;e0,v=m.pop()||a;for(_=f=v;m.length>0;)f=m.pop(),_.appendChild(f),_=f;if(d(t.parentNode)&&!d(v)&&(t=t.cloneNode(!1),p.insertBefore(t,p.firstChild),g.push(t)),!b&&d(v)){t=t.cloneNode(!1);const e=v.childNodes;for(let n=0,i=e.length;n0?f:t}else u?(t.insertBefore(v,t.firstChild),l=f):l=t;if(b&&3===a.nodeType)if(c(a)){const e=r.getParentElement(l,function(e){return this._isMaintainedNode(e.parentNode)||e.parentNode===p}.bind(r));b.appendChild(e),t=e.cloneNode(!1),g.push(t),p.insertBefore(t,p.firstChild)}else b=null}if(x||a!==v)i=x?n(a):a.cloneNode(!1),i&&(l.insertBefore(i,l.firstChild),1!==a.nodeType||r.isBreak(a)||(u=i)),e(a,u);else{b=c(a);const e=r.createTextNode(1===v.nodeType?"":v.substringData(y,v.length-y)),s=r.createTextNode(1===v.nodeType?"":v.substringData(0,y));if(b){b=b.cloneNode(!1);const e=c(l);if(e&&e.parentNode!==p){let t=e,n=null;for(;t.parentNode!==p;){for(l=n=t.parentNode.cloneNode(!1);t.childNodes[0];)n.appendChild(t.childNodes[0]);t.appendChild(n),t=t.parentNode}t.parentNode.insertBefore(e,t.parentNode.firstChild)}b=b.cloneNode(!1)}else d(t.parentNode)&&!b&&(t=t.cloneNode(!1),p.appendChild(t),g.push(t));for(r.onlyZeroWidthSpace(e)||l.insertBefore(e,l.firstChild),f=l,m=[];f!==p&&null!==f;)i=d(f)?null:n(f),i&&1===f.nodeType&&m.push(i),f=f.parentNode;const o=m.pop()||l;for(_=f=o;m.length>0;)f=m.pop(),_.appendChild(f),_=f;o!==l?(t.insertBefore(o,t.firstChild),l=f):l=t,r.isBreak(a)&&t.appendChild(a.cloneNode(!1)),b?(b.insertBefore(t,b.firstChild),p.insertBefore(b,p.firstChild),b=null):p.insertBefore(t,p.firstChild),v=s,y=s.data.length,x=!0,l.insertBefore(v,l.firstChild)}}}(e,p),o&&!s&&!a.v)return{container:i,offset:l};if(s=s&&o)for(let e=0;e0&&this.plugins.list.editInsideList.call(this,l,i),this.effectNode=null,this.setRange(s,a,o,c),this.history.push(!1)},toggleDisabledButtons:function(e){const t=this.codeViewDisabledButtons;for(let n=0,i=t.length;n0?e.element.code.scrollHeight+"px":"auto"),l.codeMirrorEditor&&l.codeMirrorEditor.refresh(),this._variable.isCodeView=!0,this._variable.isFullScreen||(this._notHideToolbar=!0,this._isBalloon&&(e.element._arrow.style.display="none",e.element.toolbar.style.left="",this._isInline=!0,this._isBalloon=!1,u._showToolbarInline())),this._variable._range=null,e.element.code.focus()),this._checkPlaceholder()},_setCodeDataToEditor:function(){const t=this._getCodeView();if(l.fullPage){const e=this._parser.parseFromString(t,"text/html"),n=e.head.children;for(let t=0,i=n.length;t0?this.convertContentsForEditor(t):"


    "},_setEditorDataToCodeView:function(){const t=this.convertHTMLForCodeView(e.element.wysiwyg);let n="";if(l.fullPage){const e=r.getAttributesToString(this._wd.body,null);n="\n\n"+this._wd.head.outerHTML.replace(/>(?!\n)/g,">\n")+"\n"+t+"\n"}else n=t;e.element.code.style.display="block",e.element.wysiwygFrame.style.display="none",this._setCodeView(n)},toggleFullScreen:function(t){const n=e.element.topArea,i=e.element.toolbar,s=e.element.editorArea,d=e.element.wysiwygFrame,h=e.element.code,g=this._variable;g.isFullScreen?(g.isFullScreen=!1,d.style.cssText=g._wysiwygOriginCssText,h.style.cssText=g._codeOriginCssText,i.style.cssText="",s.style.cssText=g._editorAreaOriginCssText,n.style.cssText=g._originCssText,o.body.style.overflow=g._bodyOverflow,l.stickyToolbar>-1&&r.removeClass(i,"se-toolbar-sticky"),g._fullScreenAttrs.sticky&&(g._fullScreenAttrs.sticky=!1,e.element._stickyDummy.style.display="block",r.addClass(i,"se-toolbar-sticky")),this._isInline=g._fullScreenAttrs.inline,this._isBalloon=g._fullScreenAttrs.balloon,this._isInline&&u._showToolbarInline(),u.onScroll_window(),r.changeIcon(t.querySelector("svg"),c.expansion)):(g.isFullScreen=!0,g._fullScreenAttrs.inline=this._isInline,g._fullScreenAttrs.balloon=this._isBalloon,(this._isInline||this._isBalloon)&&(this._isInline=!1,this._isBalloon=!1),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="100%",n.style.zIndex="2147483647",""!==e.element._stickyDummy.style.display&&(g._fullScreenAttrs.sticky=!0,e.element._stickyDummy.style.display="none",r.removeClass(i,"se-toolbar-sticky")),g._bodyOverflow=o.body.style.overflow,o.body.style.overflow="hidden",g._editorAreaOriginCssText=s.style.cssText,g._wysiwygOriginCssText=d.style.cssText,g._codeOriginCssText=h.style.cssText,s.style.cssText=i.style.cssText="",d.style.cssText=(d.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],h.style.cssText=(h.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/)||[""])[0],i.style.width=d.style.height=h.style.height="100%",i.style.position="relative",i.style.display="block",g.innerHeight_fullScreen=a.innerHeight-i.offsetHeight,s.style.height=g.innerHeight_fullScreen+"px",r.changeIcon(t.querySelector("svg"),c.reduction),l.iframe&&"auto"===l.height&&(s.style.overflow="auto",this._iframeAutoHeight()))},print:function(){const e=r.createElement("IFRAME");e.style.display="none",o.body.appendChild(e);const t=r.getIframeDocument(e),n=this.getContents(!0),i=this._wd;if(l.iframe){const e=l.fullPage?r.getAttributesToString(i.body,["contenteditable"]):'class="sun-editor-editable"';t.write(""+i.head.innerHTML+""+n+"")}else{const e=r.createElement("DIV"),l=r.createElement("STYLE");l.innerHTML=r.getPageStyle(i),e.className="sun-editor-editable",e.innerHTML=n,t.head.appendChild(l),t.body.appendChild(e)}try{if(e.focus(),r.isIE_Edge||o.documentMode||a.StyleMedia)try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){throw Error("[SUNEDITOR.core.print.fail] error: "+e)}finally{r.removeItem(e)}},preview:function(){const e=this.getContents(!0),t=a.open("","_blank");t.mimeType="text/html";const n=this._wd;if(l.iframe){const i=l.fullPage?r.getAttributesToString(n.body,["contenteditable"]):'class="sun-editor-editable"';t.document.write(""+n.head.innerHTML+""+e+"")}else t.document.write(''+i.toolbar.preview+"'+e+"")},setContents:function(t){const n=this.convertContentsForEditor(t);if(this._resetComponents(),d._variable.isCodeView){const e=this.convertHTMLForCodeView(n);d._setCodeView(e)}else e.element.wysiwyg.innerHTML=n,d.history.push(!1)},getContents:function(t){const n=e.element.wysiwyg.innerHTML,i=r.createElement("DIV");i.innerHTML=n;const s=r.getListChildren(i,(function(e){return/FIGCAPTION/i.test(e.nodeName)}));for(let e=0,t=s.length;e"+this._wd.head.outerHTML+""+i.innerHTML+""}return i.innerHTML},cleanHTML:function(e,t){const n=new this._w.RegExp("^(meta|script|link|style|[a-z]+:[a-z]+)$","i"),i=this._d.createRange().createContextualFragment(e).childNodes;let l="";for(let e,t=0,s=i.length;t"+e.textContent.trim()+"":n.test(e.nodeName)||(l+=1===e.nodeType?e.outerHTML:3===e.nodeType?e.textContent:"");return l=l.replace(/\n/g,"").replace(/<(script|style).*>(\n|.)*<\/(script|style)>/g,"").replace(this.editorTagsWhitelistRegExp,"").replace("<__comment__>","\x3c!-- ").replace(""," --\x3e").replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g,function(e,t){let n=null;const i=this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z]+/)[0].toLowerCase()];if(n=i?e.match(i):e.match(this._attributesWhitelistRegExp),n)for(let e=0,i=n.length;e^<]*)>/g,"")),l=r.htmlRemoveWhiteSpace(l),r._tagConvertor(l?t?l.replace("string"==typeof t?r.createTagsWhitelist(t):t,""):l:e)},addDocEvent:function(e,t,n){o.addEventListener(e,t,n),l.iframe&&this._wd.addEventListener(e,t)},removeDocEvent:function(e,t){o.removeEventListener(e,t),l.iframe&&this._wd.removeEventListener(e,t)},convertContentsForEditor:function(e){let t="",n=this._d.createRange().createContextualFragment(e).childNodes;for(let e,i,l=0,s=n.length;l"+i.textContent.trim()+""}else e=i.outerHTML||i.textContent;if(3===i.nodeType){const n=e.split(/\n/g);let i="";for(let e=0,l=n.length;e0&&(t+="

    "+i+"

    ")}else t+=r.htmlRemoveWhiteSpace(e)}return 0===t.length?"

    "+((e=r._HTMLConvertor(e)).length>0?e:"
    ")+"

    ":(t=t.replace(this.editorTagsWhitelistRegExp,"").replace(/\n/g,"").replace("<__comment__>","\x3c!-- ").replace(""," --\x3e"),r._tagConvertor(t))},convertHTMLForCodeView:function(e){let t="";const n=this._w.RegExp,i=new n("^(BLOCKQUOTE|PRE|TABLE|THEAD|TBODY|TR|TH|TD|OL|UL|IMG|IFRAME|VIDEO|AUDIO|FIGURE|FIGCAPTION|HR|BR|CANVAS|SELECT)$","i"),l=r.isFormatElement.bind(r),s="string"==typeof e?this._d.createRange().createContextualFragment(e):e;let o=1*this._variable.codeIndent;return o=o>0?new this._w.Array(o+1).join(" "):"",function e(s,a,c){const d=s.childNodes,u=i.test(s.nodeName),h=u?a:"";for(let g,p,m,f=0,_=d.length;f<_;f++){if(g=d[f],m=i.test(g.nodeName),p=m?"\n":"",c=!l(g)||u||/^(TH|TD)$/i.test(s.nodeName)?"":"\n",8===g.nodeType){t+="\n\x3c!-- "+g.textContent.trim()+" --\x3e"+p;continue}if(3===g.nodeType){t+=r._HTMLConvertor(/^\n+$/.test(g.data)?"":g.data);continue}if(0===g.childNodes.length){t+=(/^(HR)$/i.test(g.nodeName)?"\n":"")+h+g.outerHTML+p;continue}g.innerHTML=g.innerHTML;const _=g.nodeName.toLowerCase();t+=(c||(u?"":p))+(h||m?a:"")+g.outerHTML.match(n("<"+_+"[^>]*>","i"))[0]+p,e(g,a+o,""),t+=(m?a:"")+""+(c||p||u||/^(TH|TD)$/i.test(g.nodeName)?"\n":"")}}(s,"","\n"),t.trim()+"\n"},_charCount:function(t){const n=e.element.charCounter,i=l.maxCharCount,s=e.element.wysiwyg;let o=0;if(t&&(o=d._getCharLength(t)),n&&a.setTimeout((function(){n.textContent=d._getCharLength(s.textContent)})),i>0){let t=!1;const n=d._getCharLength(s.textContent);if(n>i){if(t=!0,o>0){this._editorRange();const e=this.getRange(),t=e.endOffset-1,l=this.getSelectionNode().textContent,s=e.endOffset-(n-i);this.getSelectionNode().textContent=l.slice(0,s<0?0:s)+l.slice(e.endOffset,l.length),this.setRange(e.endContainer,t,e.endContainer,t)}}else n+o>i&&(t=!0);if(t){const t=e.element.charWrapper;if(t&&!r.hasClass(t,"se-blink")&&(r.addClass(t,"se-blink"),a.setTimeout((function(){r.removeClass(t,"se-blink")}),600)),o>0)return!1}}return!0},_getCharLength:function(e){return"byte"===l.charCounterType?r.getByteLength(e):e.length},_checkComponents:function(){this.plugins.image&&(this.initPlugins.image?this.plugins.image.checkImagesInfo.call(this):this.callPlugin("image",this.plugins.image.checkImagesInfo.bind(this))),this.plugins.video&&(this.initPlugins.video?this.plugins.video.checkVideosInfo.call(this):this.callPlugin("video",this.plugins.video.checkVideosInfo.bind(this)))},_resetComponents:function(){this._variable._imagesInfo=[],this._variable._imageIndex=0,this._variable._videosCnt=0},_setCodeView:function(t){l.codeMirrorEditor?l.codeMirrorEditor.getDoc().setValue(t):e.element.code.value=t},_getCodeView:function(){return l.codeMirrorEditor?l.codeMirrorEditor.getDoc().getValue():e.element.code.value},_init:function(i,s){this._ww=l.iframe?e.element.wysiwygFrame.contentWindow:a,this._wd=l.iframe?r.getIframeDocument(e.element.wysiwygFrame):o,l.iframe&&"auto"===l.height&&(this._iframeAuto=this._wd.body),this._allowHTMLComments=l._editorTagsWhitelist.indexOf("//")>-1,this.editorTagsWhitelistRegExp=r.createTagsWhitelist(l._editorTagsWhitelist.replace("|//","|__comment__")),this.pasteTagsWhitelistRegExp=r.createTagsWhitelist(l.pasteTagsWhitelist);const c=l.attributesWhitelist,g={};let p,m,f="";if(c)for(let e in c)"all"===e?f=c[e]+"|":g[e]=new a.RegExp("((?:"+c[e]+')s*=s*"[^"]*")',"ig");this._attributesWhitelistRegExp=new a.RegExp("((?:"+f+'contenteditable|colspan|rowspan|target|href|src|class|type|data-format|data-size|data-file-size|data-file-name|data-origin|data-align|data-image-link|data-rotate|data-proportion|data-percentage|origin-size)s*=s*"[^"]*")',"ig"),this._attributesTagsWhitelist=g,this.codeViewDisabledButtons=e.element.toolbar.querySelectorAll('.se-toolbar button:not([class~="code-view-enabled"])'),this._isInline=/inline/i.test(l.mode),this._isBalloon=/balloon|balloon-always/i.test(l.mode),this._isBalloonAlways=/balloon-always/i.test(l.mode),this.commandMap={STRONG:e.tool.bold,INS:e.tool.underline,EM:e.tool.italic,DEL:e.tool.strike,SUB:e.tool.subscript,SUP:e.tool.superscript,OUTDENT:e.tool.outdent,INDENT:e.tool.indent},this.activePlugins=[];for(let e in n)p=n[e],m=t[e],p.active&&m&&d.callPlugin(e,null,m);this._variable._originCssText=e.element.topArea.style.cssText,this._placeholder=e.element.placeholder,this.history=function(e,t){const n=window,i=e.context.element,l=e.util,s=e.context.tool.undo,o=e.context.tool.redo;let a=null,r=0,c=[];function d(){const n=c[r];i.wysiwyg.innerHTML=n.contents,e.setRange(l.getNodeFromPath(n.s.path,i.wysiwyg),n.s.offset,l.getNodeFromPath(n.e.path,i.wysiwyg),n.e.offset),e.focus(),0===r?(s&&s.setAttribute("disabled",!0),o&&o.removeAttribute("disabled")):r===c.length-1?(s&&s.removeAttribute("disabled"),o&&o.setAttribute("disabled",!0)):(s&&s.removeAttribute("disabled"),o&&o.removeAttribute("disabled")),e._checkComponents(),e._charCount(""),e._resourcesStateChange(),t()}function u(){const n=e.getContents(!0);if(c[r]&&n===c[r].contents)return;r++;const i=e._variable._range;c.length>r&&(c=c.slice(0,r),o&&o.setAttribute("disabled",!0)),c[r]=i?{contents:n,s:{path:l.getNodePath(i.startContainer,null,null),offset:i.startOffset},e:{path:l.getNodePath(i.endContainer,null,null),offset:i.endOffset}}:{contents:n,s:{path:[0,0],offset:[0,0]},e:{path:0,offset:0}},1===r&&s&&s.removeAttribute("disabled"),e._checkComponents(),e._charCount(""),t()}return{stack:c,push:function(t){n.setTimeout(e._resourcesStateChange),t&&!a||(n.clearTimeout(a),t)?a=n.setTimeout((function(){n.clearTimeout(a),a=null,u()}),350):u()},undo:function(){r>0&&(r--,d())},redo:function(){c.length-1>r&&(r++,d())},go:function(e){r=e<0?c.length-1:e,d()},reset:function(n){s&&s.setAttribute("disabled",!0),o&&o.setAttribute("disabled",!0),e.context.tool.save&&e.context.tool.save.setAttribute("disabled",!0),c.splice(0),r=0,c[r]={contents:e.getContents(!0),s:{path:[0,0],offset:0},e:{path:[0,0],offset:0}},n||t()},_destroy:function(){a&&n.clearTimeout(a),c=null}}}(this,u._onChange_historyStack),this._initWysiwygArea(i,s),a.setTimeout(function(){if(this._checkComponents(),this._imagesInfoInit=!1,this._imagesInfoReset=!1,this.history.reset(!0),this._iframeAutoHeight(),this._checkPlaceholder(),"function"==typeof h.onload)return h.onload(this,i)}.bind(this))},_initWysiwygArea:function(t,n){l.defaultStyle&&(e.element.wysiwyg.style.cssText=l.defaultStyle),t?n&&(e.element.wysiwyg.innerHTML=n):e.element.wysiwyg.innerHTML=this.convertContentsForEditor(e.element.originElement.value)},_resourcesStateChange:function(){d._iframeAutoHeight(),d._checkPlaceholder()},_iframeAutoHeight:function(){this._iframeAuto&&a.setTimeout((function(){e.element.wysiwygFrame.style.height=d._iframeAuto.offsetHeight+"px"}))},_checkPlaceholder:function(){if(this._placeholder){if(this._variable.isCodeView)return void(this._placeholder.style.display="none");const t=e.element.wysiwyg;!r.onlyZeroWidthSpace(t.textContent)||t.querySelector(".se-component, pre, blockquote, hr, li, table, img, iframe, video")||(t.innerText.match(/\n/g)||"").length>1?this._placeholder.style.display="none":this._placeholder.style.display="block"}},_setDefaultFormat:function(e){const t=this.getRange().commonAncestorContainer,n=r.getRangeFormatElement(t);let i,l,s;if(n)return s=r.createElement(e||"P"),s.innerHTML=n.innerHTML,0===s.childNodes.length&&(s.innerHTML="
    "),n.innerHTML=s.outerHTML,s=n.firstElementChild,i=r.getEdgeChildNodes(s,null).sc,i||(i=r.createTextNode(r.zeroWidthSpace),s.insertBefore(i,s.firstChild)),l=i.textContent.length,void this.setRange(i,l,i,l);if(r.isRangeFormatElement(t)&&t.childNodes.length<=1){let e=null;1===t.childNodes.length&&r.isBreak(t.firstChild)?e=t.firstChild:(e=r.createElement("BR"),t.appendChild(e)),this.setRange(e,0,e,0)}if(this.execCommand("formatBlock",!1,e||"P"),i=r.getEdgeChildNodes(t,t),i=i?i.ec:t,s=r.getFormatElement(i),!s)return this.removeRange(),void this._editorRange();if(r.isBreak(s.nextSibling)&&r.removeItem(s.nextSibling),r.isBreak(s.previousSibling)&&r.removeItem(s.previousSibling),r.isBreak(i)){const e=r.createTextNode(r.zeroWidthSpace);i.parentNode.insertBefore(e,i),i=e}l=3===i.nodeType?i.textContent.length:1,this.setRange(i,l,i,l)}},u={_directionKeyCode:new a.RegExp("^(8|13|3[2-9]|40|46)$"),_nonTextKeyCode:new a.RegExp("^(8|13|1[6-9]|20|27|3[3-9]|40|45|46|11[2-9]|12[0-3]|144|145)$"),_historyIgnoreKeyCode:new a.RegExp("^(1[6-9]|20|27|3[3-9]|40|45|11[2-9]|12[0-3]|144|145)$"),_onButtonsCheck:new a.RegExp("^(STRONG|INS|EM|DEL|SUB|SUP)$"),_frontZeroWidthReg:new a.RegExp(r.zeroWidthSpace+"+",""),_keyCodeShortcut:{65:"A",66:"B",83:"S",85:"U",73:"I",89:"Y",90:"Z",219:"[",221:"]"},_shortcutCommand:function(e,t){let n=null;switch(u._keyCodeShortcut[e]){case"A":n="selectAll";break;case"B":n="STRONG";break;case"S":t&&(n="DEL");break;case"U":n="INS";break;case"I":n="EM";break;case"Z":n=t?"redo":"undo";break;case"Y":n="redo";break;case"[":n="outdent";break;case"]":n="indent"}return!!n&&(d.commandHandler(d.commandMap[n],n),!0)},_applyTagEffects:function(){let t=d.getSelectionNode();if(t===d.effectNode)return;d.effectNode=t;const i=d.commandMap,s=this._onButtonsCheck,o=[],a=[],c=d.activePlugins,u=c.length;let h="";for(;t.firstChild;)t=t.firstChild;for(let e=t;!r.isWysiwygDiv(e)&&e;e=e.parentNode)if(1===e.nodeType&&!r.isBreak(e)){h=e.nodeName.toUpperCase(),a.push(h);for(let t,i=0;i0)&&(o.push("OUTDENT"),i.OUTDENT.removeAttribute("disabled")),-1===o.indexOf("INDENT")&&i.INDENT&&r.isListCell(e)&&!e.previousElementSibling&&(o.push("INDENT"),i.INDENT.setAttribute("disabled",!0))):s.test(h)&&(o.push(h),r.addClass(i[h],"active"))}for(let e in i)o.indexOf(e)>-1||(c.indexOf(e)>-1?n[e].active.call(d,null):i.OUTDENT&&/^OUTDENT$/i.test(e)?i.OUTDENT.setAttribute("disabled",!0):i.INDENT&&/^INDENT$/i.test(e)?i.INDENT.removeAttribute("disabled"):r.removeClass(i[e],"active"));d._variable.currentNodes=a.reverse(),l.showPathLabel&&(e.element.navigation.textContent=d._variable.currentNodes.join(" > "))},_cancelCaptionEdit:function(){this.setAttribute("contenteditable",!1),this.removeEventListener("blur",u._cancelCaptionEdit)},onMouseDown_toolbar:function(e){let t=e.target;if(d._bindControllersOff&&e.stopPropagation(),/^input|textarea$/i.test(t.nodeName)?d._antiBlur=!1:e.preventDefault(),r.getParentElement(t,".se-submenu"))e.stopPropagation(),d._notHideToolbar=!0;else{let n=t.getAttribute("data-command"),i=t.className;for(;!n&&!/se-menu-list/.test(i)&&!/se-toolbar/.test(i);)t=t.parentNode,n=t.getAttribute("data-command"),i=t.className;n!==d._submenuName&&n!==d._containerName||e.stopPropagation()}},onClick_toolbar:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,n=t.getAttribute("data-display"),i=t.getAttribute("data-command"),l=t.className;for(;!i&&!/se-menu-list/.test(l)&&!/se-toolbar/.test(l);)t=t.parentNode,i=t.getAttribute("data-command"),n=t.getAttribute("data-display"),l=t.className;(i||n)&&(t.disabled||(d.hasFocus||d.focus(),d._editorRange(),d.actionCall(i,n,t)))},onMouseDown_wysiwyg:function(t){if("false"===e.element.wysiwyg.getAttribute("contenteditable"))return;const n=r.getParentElement(t.target,r.isCell);if(n){const e=d.plugins.table;e&&n!==e._fixedCell&&!e._shift&&d.callPlugin("table",(function(){e.onTableCellMultiSelect.call(d,n,!1)}))}d._isBalloon&&u._hideToolbar(),h.onMouseDown&&h.onMouseDown(t,d)},onClick_wysiwyg:function(t){const n=t.target;if("false"===e.element.wysiwyg.getAttribute("contenteditable"))return;if(t.stopPropagation(),/^FIGURE$/i.test(n.nodeName)){const e=n.querySelector("IMG"),i=n.querySelector("IFRAME");if(e)return t.preventDefault(),void d.selectComponent(e,"image");if(i)return t.preventDefault(),void d.selectComponent(i,"video")}const i=r.getParentElement(n,"FIGCAPTION");if(i&&(!i.getAttribute("contenteditable")||"false"===i.getAttribute("contenteditable"))&&(t.preventDefault(),i.setAttribute("contenteditable",!0),i.focus(),d._isInline&&!d._inlineToolbarAttr.isShow)){u._showToolbarInline();const e=function(){u._hideToolbar(),i.removeEventListener("blur",e)};i.addEventListener("blur",e)}d._editorRange(),a.setTimeout(d._editorRange.bind(d));const l=d.getSelectionNode(),s=r.getFormatElement(l),o=r.getRangeFormatElement(l);if(!d.getRange().collapsed||s&&s!==o||"false"===n.getAttribute("contenteditable"))u._applyTagEffects();else{if(r.isList(o)){const e=r.createElement("LI"),t=l.nextElementSibling;e.appendChild(l),o.insertBefore(e,t)}else r.isWysiwygDiv(l)||r.isComponent(l)||d._setDefaultFormat(r.isRangeFormatElement(o)?"DIV":"P");t.preventDefault(),d.focus()}d._isBalloon&&a.setTimeout(u._toggleToolbarBalloon),h.onClick&&h.onClick(t,d)},_balloonDelay:null,_showToolbarBalloonDelay:function(){u._balloonDelay&&a.clearTimeout(u._balloonDelay),u._balloonDelay=a.setTimeout(function(){a.clearTimeout(this._balloonDelay),this._balloonDelay=null,this._showToolbarBalloon()}.bind(u),350)},_toggleToolbarBalloon:function(){d._editorRange();const e=d.getRange();"table"===d.currentControllerName||!d._isBalloonAlways&&e.collapsed?u._hideToolbar():u._showToolbarBalloon(e)},_showToolbarBalloon:function(t){if(!d._isBalloon)return;const n=t||d.getRange(),i=e.element.toolbar,l=d.getSelection();let s;if(d._isBalloonAlways&&n.collapsed)s=!0;else if(l.focusNode===l.anchorNode)s=l.focusOffseti.offsetWidth?i.offsetWidth-u:b";const e=m.attributes;for(;e[0];)m.removeAttribute(e[0].name);return d.execCommand("formatBlock",!1,"P"),!1}if(m&&c.startContainer===c.endContainer&&3===o.nodeType&&!r.isFormatElement(o.parentNode)&&(c.collapsed?1===o.textContent.length:c.endOffset-c.startOffset===o.textContent.length)){t.preventDefault();let e=null,n=o.parentNode.previousSibling;const i=o.parentNode.nextSibling;n||(i?(n=i,e=0):(n=r.createElement("BR"),m.appendChild(n))),r.removeItem(o.parentNode),e="number"==typeof e?e:3===n.nodeType?n.textContent.length:1,d.setRange(n,e,n,e);break}const n=c.commonAncestorContainer;if(m=r.getFormatElement(c.startContainer),f=r.getRangeFormatElement(m),f&&m&&!r.isCell(f)&&!/^FIGCAPTION$/i.test(f.nodeName)){if(r.isListCell(m)&&r.isList(f)&&(r.isListCell(f.parentNode)||m.previousElementSibling)&&(o===m||3===o.nodeType&&(!o.previousSibling||r.isList(o.previousSibling)))&&(r.getFormatElement(c.startContainer)!==r.getFormatElement(c.endContainer)?f.contains(c.startContainer):0===c.startOffset&&c.collapsed)){if(c.startContainer!==c.endContainer)t.preventDefault(),d.removeNode(),3===c.startContainer.nodeType&&d.setRange(c.startContainer,c.startContainer.textContent.length,c.startContainer,c.startContainer.textContent.length),d.history.push(!0);else{let e=m.previousElementSibling||f.parentNode;if(r.isListCell(e)){t.preventDefault();let n=e;if(!e.contains(m)&&r.isListCell(n)&&r.isList(n.lastElementChild)){for(n=n.lastElementChild.lastElementChild;r.isListCell(n)&&r.isList(n.lastElementChild);)n=n.lastElementChild&&n.lastElementChild.lastElementChild;e=n}let i=e===f.parentNode?f.previousSibling:e.lastChild;i||(i=r.createTextNode(r.zeroWidthSpace),f.parentNode.insertBefore(i,f.parentNode.firstChild));const l=3===i.nodeType?i.textContent.length:1,s=m.childNodes;let o=i,a=s[0];for(;a=s[0];)e.insertBefore(a,o.nextSibling),o=a;r.removeItem(m),0===f.children.length&&r.removeItem(f),d.setRange(i,l,i,l),d.history.push(!0)}}break}if(!g&&0===c.startOffset){let e=!0,i=n;for(;i&&i!==f&&!r.isWysiwygDiv(i);){if(i.previousSibling&&(1===i.previousSibling.nodeType||!r.onlyZeroWidthSpace(i.previousSibling.textContent.trim()))){e=!1;break}i=i.parentNode}if(e&&f.parentNode){t.preventDefault(),d.detachRangeFormatElement(f,r.isListCell(m)?[m]:null,null,!1,!1),d.history.push(!0);break}}}if(!g&&0===c.startOffset&&(r.isComponent(n.previousSibling)||3===n.nodeType&&!n.previousSibling&&0===c.startOffset&&0===c.endOffset&&r.isComponent(m.previousSibling))){const e=m.previousSibling;r.removeItem(e);break}g&&u._rangedeleteAssistant(c.startContainer,c.endContainer);break;case 46:if(p){t.preventDefault(),t.stopPropagation(),d.plugins[p].destroy.call(d);break}if((r.isFormatElement(o)||null===o.nextSibling)&&c.startOffset===o.textContent.length){let e=m.nextElementSibling;if(!e){t.preventDefault();break}if(r.isComponent(e)){t.preventDefault(),r.onlyZeroWidthSpace(m)&&r.removeItem(m),(r.hasClass(e,"se-component")||/^IMG$/i.test(e.nodeName))&&(t.stopPropagation(),r.hasClass(e,"se-image-container")||/^IMG$/i.test(e.nodeName)?(e=/^IMG$/i.test(e.nodeName)?e:e.querySelector("img"),d.selectComponent(e,"image")):r.hasClass(e,"se-video-container")&&d.selectComponent(e.querySelector("iframe"),"video"));break}}if(m=r.getFormatElement(c.startContainer),f=r.getRangeFormatElement(m),r.isListCell(m)&&r.isList(f)&&(o===m||3===o.nodeType&&(!o.nextSibling||r.isList(o.nextSibling))&&(r.getFormatElement(c.startContainer)!==r.getFormatElement(c.endContainer)?f.contains(c.endContainer):c.endOffset===o.textContent.length&&c.collapsed))){c.startContainer!==c.endContainer&&d.removeNode();let e=r.getArrayItem(m.children,r.isList,!1);if(e=e||m.nextElementSibling||f.parentNode.nextElementSibling,e&&(r.isList(e)||r.getArrayItem(e.children,r.isList,!1))){let n,i;if(t.preventDefault(),r.isList(e)){const t=e.firstElementChild;for(i=t.childNodes,n=i[0];i[0];)m.insertBefore(i[0],e);r.removeItem(t)}else{for(n=e.firstChild,i=e.childNodes;i[0];)m.appendChild(i[0]);r.removeItem(e)}d.setRange(n,0,n,0),d.history.push(!0)}break}g&&u._rangedeleteAssistant(c.startContainer,c.endContainer);break;case 9:if(t.preventDefault(),l||s||r.isWysiwygDiv(o))break;const _=!c.collapsed||d.isEdgePoint(c.startContainer,c.startOffset),b=d.getSelectedElements();o=d.getSelectionNode();const v=[];let y=[],x=r.isListCell(b[0]),C=r.isListCell(b[b.length-1]),w={sc:c.startContainer,so:c.startOffset,ec:c.endContainer,eo:c.endOffset};for(let e,t=0,n=b.length;t0&&_&&d.plugins.list)w=d.plugins.list.editInsideList.call(d,i,v);else{const e=r.getParentElement(o,r.isCell);if(e&&_){const t=r.getParentElement(e,"table"),n=r.getListChildren(t,r.isCell);let l=i?r.prevIdx(n,e):r.nextIdx(n,e);l!==n.length||i||(l=0),-1===l&&i&&(l=n.length-1);let s=n[l];if(!s)break;s=s.firstElementChild||s,d.setRange(s,0,s,0);break}y=y.concat(v),x=C=null}if(y.length>0)if(i){const e=y.length-1;for(let t,n=0;n<=e;n++){t=y[n].childNodes;for(let e,n=0,i=t.length;n0&&r.isBreak(i[l-1])||!e&&r.onlyZeroWidthSpace(o.textContent)&&r.isBreak(s)&&(r.isBreak(s.previousSibling)||!r.onlyZeroWidthSpace(s.previousSibling.textContent))&&(!a||!r.isBreak(a)&&r.onlyZeroWidthSpace(a.textContent)))){e?r.removeItem(i[l-1]):r.removeItem(o);const t=d.appendFormatTag(E,r.isFormatElement(E.nextElementSibling)?E.nextElementSibling:null);r.copyFormatAttributes(t,E),d.setRange(t,1,t,1);break}if(e){h.insertHTML(c.collapsed&&r.isBreak(c.startContainer.childNodes[c.startOffset-1])?"
    ":"

    ",!0);let e=n.focusNode;const t=n.focusOffset;E===e&&(e=e.childNodes[t-l>1?t-1:t]),d.setRange(e,1,e,1)}else{const e=n.focusNode.nextSibling,t=r.createElement("BR");d.insertNode(t,null);const i=t.previousSibling,l=t.nextSibling;r.isBreak(e)||r.isBreak(i)||l&&!r.onlyZeroWidthSpace(l)?d.setRange(l,0,l,0):(t.parentNode.insertBefore(t.cloneNode(!1),t),d.setRange(t,1,t,1))}u._onShortcutKey=!0;break}if(g)break;if(f&&m&&!r.isCell(f)&&!/^FIGCAPTION$/i.test(f.nodeName)){const e=d.getRange();if((3!==e.commonAncestorContainer.nodeType||!e.commonAncestorContainer.nextElementSibling)&&r.onlyZeroWidthSpace(m.innerText.trim())){t.preventDefault();let e=null;if(r.isListCell(f.parentNode)){f=m.parentNode.parentNode.parentNode;const t=r.splitElement(m,null,r.getElementDepth(m)-2);e=r.createElement("LI"),f.insertBefore(e,t)}else{const t=r.isCell(f.parentNode)?"DIV":r.isList(f.parentNode)?"LI":r.isFormatElement(f.nextElementSibling)?f.nextElementSibling.nodeName:r.isFormatElement(f.previousElementSibling)?f.previousElementSibling.nodeName:"P";e=r.createElement(t);const n=d.detachRangeFormatElement(f,[m],null,!0,!0);n.cc.insertBefore(e,n.ec)}e.innerHTML="
    ",r.copyFormatAttributes(e,m),r.removeItemAllParents(m,null),d.setRange(e,1,e,1);break}}if(f&&r.getParentElement(f,"FIGCAPTION")&&r.getParentElement(f,r.isList)&&(t.preventDefault(),m=d.appendFormatTag(m,null),d.setRange(m,0,m,0)),p){t.preventDefault(),t.stopPropagation();const n=e[p],i=n._container,l=i.previousElementSibling||i.nextElementSibling;let s=null;r.isListCell(i.parentNode)?s=r.createElement("BR"):(s=r.createElement(r.isFormatElement(l)?l.nodeName:"P"),s.innerHTML="
    "),i.parentNode.insertBefore(s,i),d.callPlugin(p,(function(){const e=d.plugins.resizing.call_controller_resize.call(d,n._element,p);d.plugins[p].onModifyMode.call(d,n._element,e)}))}}if(i&&/16/.test(n)){t.preventDefault(),t.stopPropagation();const e=d.plugins.table;if(e&&!e._shift&&!e._ref){const t=r.getParentElement(m,r.isCell);if(t)return void e.onTableCellMultiSelect.call(d,t,!0)}}if(!(l||s||g||u._nonTextKeyCode.test(n))&&c.collapsed&&c.startContainer===c.endContainer&&r.isBreak(c.commonAncestorContainer)){const e=r.createTextNode(r.zeroWidthSpace);d.insertNode(e,null)}h.onKeyDown&&h.onKeyDown(t,d)},onKeyUp_wysiwyg:function(e){if(u._onShortcutKey)return;d._editorRange();const t=d.getRange(),n=e.keyCode,i=e.ctrlKey||e.metaKey||91===n||92===n,l=e.altKey;let s=d.getSelectionNode();if(d._isBalloon&&(d._isBalloonAlways&&27!==n||!t.collapsed)){if(!d._isBalloonAlways)return void u._showToolbarBalloon();u._showToolbarBalloonDelay()}if(8===n&&r.isWysiwygDiv(s)&&""===s.textContent){e.preventDefault(),e.stopPropagation(),s.innerHTML="";const t=r.createElement(r.isFormatElement(d._variable.currentNodes[0])?d._variable.currentNodes[0]:"P");return t.innerHTML="
    ",s.appendChild(t),d.setRange(t,0,t,0),u._applyTagEffects(),d._checkComponents(),void d.history.push(!1)}const o=r.getFormatElement(s),a=r.getRangeFormatElement(s);if((o||!t.collapsed)&&o!==a||r.isComponent(s)||(d._setDefaultFormat(r.isRangeFormatElement(a)?"DIV":"P"),s=d.getSelectionNode()),u._directionKeyCode.test(n)&&u._applyTagEffects(),!i&&!l&&!u._nonTextKeyCode.test(n)&&3===s.nodeType&&r.zeroWidthRegExp.test(s.textContent)&&r.getByteLength(e.key)<3){let e=t.startOffset,n=t.endOffset;const i=(s.textContent.substring(0,n).match(u._frontZeroWidthReg)||"").length;e=t.startOffset-i,n=t.endOffset-i,s.textContent=s.textContent.replace(r.zeroWidthRegExp,""),d.setRange(s,e<0?0:e,s,n<0?0:n)}r.isIE&&/^(8|13|46)$/.test(n)&&(d._charCount(""),d._checkComponents(),d.history.push(!0)),h.onKeyUp&&h.onKeyUp(e,d)},onScroll_wysiwyg:function(e){d.controllersOff(),d._isBalloon&&u._hideToolbar(),h.onScroll&&h.onScroll(e,d)},onFocus_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!0,d._isInline&&u._showToolbarInline(),h.onFocus&&h.onFocus(e,d))},onBlur_wysiwyg:function(e){d._antiBlur||(d.hasFocus=!1,(d._isInline||d._isBalloon)&&u._hideToolbar(),h.onBlur&&h.onBlur(e,d))},onMouseDown_resizingBar:function(t){t.stopPropagation(),d._variable.resizeClientY=t.clientY,e.element.resizeBackground.style.display="block",o.addEventListener("mousemove",u._resize_editor),o.addEventListener("mouseup",(function t(){e.element.resizeBackground.style.display="none",o.removeEventListener("mousemove",u._resize_editor),o.removeEventListener("mouseup",t)}))},_resize_editor:function(t){const n=e.element.editorArea.offsetHeight+(t.clientY-d._variable.resizeClientY);e.element.wysiwygFrame.style.height=e.element.code.style.height=(n=n+s?(d._sticky||u._onStickyToolbar(),t.toolbar.style.top=n+s+l.stickyToolbar-i-d._variable.minResizingSize+"px"):i>=s&&u._onStickyToolbar()},_getStickyOffsetTop:function(){let t=e.element.topArea,n=0;for(;t;)n+=t.offsetTop,t=t.offsetParent;return n},_onStickyToolbar:function(){const t=e.element;d._isInline||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",r.addClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=d._isInline?d._inlineToolbarAttr.top:"",t.toolbar.style.width=d._isInline?d._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",r.removeClass(t.toolbar,"se-toolbar-sticky"),d._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},onPaste_wysiwyg:function(e){const t=e.clipboardData;if(!t)return!0;const n=d._charCount(t.getData("text/plain")),i=d.cleanHTML(t.getData("text/html"),d.pasteTagsWhitelistRegExp);return("function"!=typeof h.onPaste||h.onPaste(e,i,n,d))&&n?void(i?(e.stopPropagation(),e.preventDefault(),h.insertHTML(i,!0)):d.history.push(!0)):(e.preventDefault(),e.stopPropagation(),!1)},onCut_wysiwyg:function(){a.setTimeout((function(){d._resourcesStateChange()}))},onDragOver_wysiwyg:function(e){e.preventDefault()},onDrop_wysiwyg:function(t){const n=t.dataTransfer;if(!n)return!0;const i=n.files;if(i.length>0&&d.plugins.image)u._setDropLocationSelection(t),d.callPlugin("image",(function(){e.image.imgInputFile.files=i,d.plugins.image.onRender_imgInput.call(d),e.image.imgInputFile.files=null}));else{if(!d._charCount(n.getData("text/plain")))return t.preventDefault(),t.stopPropagation(),!1;{const e=d.cleanHTML(n.getData("text/html"),d.pasteTagsWhitelistRegExp);e&&(u._setDropLocationSelection(t),h.insertHTML(e,!0))}}h.onDrop&&h.onDrop(t,d)},_setDropLocationSelection:function(e){e.stopPropagation(),e.preventDefault();const t=d.getRange();d.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)},_onChange_historyStack:function(){u._applyTagEffects(),e.tool.save&&e.tool.save.removeAttribute("disabled"),h.onChange&&h.onChange(d.getContents(!0),d)},_rangedeleteAssistant:function(e,t){e=r.getParentElement(e,function(e){return e.getAttribute&&("false"===e.getAttribute("contenteditable")||this.isComponent(e))}.bind(r)),t=r.getParentElement(t,function(e){return e.getAttribute&&("false"===e.getAttribute("contenteditable")||this.isComponent(e))}.bind(r)),a.setTimeout(function(e,t){e&&(this.removeItem(e),e===t)||t&&this.removeItem(t)}.bind(r,e,t))},_addEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",u.onMouseDown_toolbar,!1),e.element.toolbar.addEventListener("click",u.onClick_toolbar,!1),t.addEventListener("mousedown",u.onMouseDown_wysiwyg,!1),t.addEventListener("click",u.onClick_wysiwyg,!1),t.addEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg,!1),t.addEventListener("keydown",u.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",u.onKeyUp_wysiwyg,!1),t.addEventListener("paste",u.onPaste_wysiwyg,!1),t.addEventListener("cut",u.onCut_wysiwyg,!1),t.addEventListener("dragover",u.onDragOver_wysiwyg,!1),t.addEventListener("drop",u.onDrop_wysiwyg,!1),t.addEventListener("scroll",u.onScroll_wysiwyg,!1),t.addEventListener("focus",u.onFocus_wysiwyg,!1),t.addEventListener("blur",u.onBlur_wysiwyg,!1),d.plugins.table&&t.addEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",u._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",u._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",u._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",u.onMouseDown_resizingBar,!1):r.addClass(e.element.resizingBar,"se-resizing-none")),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window),a.addEventListener("resize",u.onResize_window,!1),l.stickyToolbar>-1&&a.addEventListener("scroll",u.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?d._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",u.onMouseDown_toolbar),e.element.toolbar.removeEventListener("click",u.onClick_toolbar),t.removeEventListener("click",u.onClick_wysiwyg),t.removeEventListener(r.isIE?"textinput":"input",u.onInput_wysiwyg),t.removeEventListener("keydown",u.onKeyDown_wysiwyg),t.removeEventListener("keyup",u.onKeyUp_wysiwyg),t.removeEventListener("paste",u.onPaste_wysiwyg),t.removeEventListener("cut",u.onCut_wysiwyg),t.removeEventListener("dragover",u.onDragOver_wysiwyg),t.removeEventListener("drop",u.onDrop_wysiwyg),t.removeEventListener("scroll",u.onScroll_wysiwyg),t.removeEventListener("mousedown",u.onMouseDown_wysiwyg),t.removeEventListener("touchstart",u.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",u.onFocus_wysiwyg),t.removeEventListener("blur",u.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",u._codeViewAutoHeight),e.element.code.removeEventListener("keyup",u._codeViewAutoHeight),e.element.code.removeEventListener("paste",u._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",u.onMouseDown_resizingBar),a.removeEventListener("resize",u.onResize_window),a.removeEventListener("scroll",u.onScroll_window)}},h={core:d,util:r,onload:null,onScroll:null,onMouseDown:null,onClick:null,onInput:null,onKeyDown:null,onKeyUp:null,onDrop:null,onChange:null,onPaste:null,onFocus:null,onBlur:null,showInline:null,showController:null,imageUploadHandler:null,onImageUploadBefore:null,onImageUpload:null,onImageUploadError:null,setOptions:function(s){u._removeEvent(),d.plugins=s.plugins||d.plugins;const o=[s,s].reduce((function(e,t){for(let n in t)if("plugins"===n&&t[n]&&e[n]){let i=e[n],l=t[n];i=i.length?i:a.Object.keys(i).map((function(e){return i[e]})),l=l.length?l:a.Object.keys(l).map((function(e){return l[e]})),e[n]=l.filter((function(e){return-1===i.indexOf(e)})).concat(i)}else e[n]=t[n];return e}),{}),r=b._setOptions(o,e,d.plugins,s);r.callButtons&&(t=r.callButtons,d.initPlugins={}),r.plugins&&(d.plugins=n=r.plugins);const c=e.element.wysiwyg.innerHTML,h=e.element,g={_top:h.topArea,_relative:h.relative,_toolBar:h.toolbar,_editorArea:h.editorArea,_wysiwygArea:h.wysiwygFrame,_codeArea:h.code,_placeholder:h.placeholder,_resizingBar:h.resizingBar,_navigation:h.navigation,_charCounter:h.charCounter,_charWrapper:h.charWrapper,_loading:h.loading,_resizeBack:h.resizeBackground,_stickyDummy:h._stickyDummy,_arrow:h._arrow};l=o,d.lang=i=l.lang,d.context=e=v(e.element.originElement,g,l),d._imagesInfoReset=!0,d._init(!0,c),u._addEvent(),d._charCount(""),u._offStickyToolbar(),u.onResize_window()},setDefaultStyle:function(t){"string"==typeof t&&t.trim().length>0?e.element.wysiwyg.style.cssText=t:e.element.wysiwyg.style.cssText.removeAttribute("style")},noticeOpen:function(e){d.notice.open.call(d,e)},noticeClose:function(){d.notice.close.call(d)},save:function(){e.element.originElement.value=d.getContents(!1)},getContext:function(){return e},getContents:function(e){return d.getContents(e)},getImagesInfo:function(){return d._variable._imagesInfo},insertImage:function(e){d.plugins.image&&e&&(d.initPlugins.image?d.plugins.image.submitAction.call(d,e):d.callPlugin("image",d.plugins.image.submitAction.bind(d,e)),d.focus())},insertHTML:function(e,t){if("string"==typeof e){t||(e=d.cleanHTML(e));try{const t=d._parser.parseFromString(e,"text/html").body.childNodes;let n,i;for(;n=t[0];)d.insertNode(n,i),i=n;const l=3===i.nodeType?i.textContent.length:1;d.setRange(i,l,i,l)}catch(t){d.execCommand("insertHTML",!1,e)}}else if(r.isComponent(e))d.insertComponent(e,!1);else{let t=null;(r.isFormatElement(e)||r.isMedia(e))&&(t=r.getFormatElement(d.getSelectionNode())),d.insertNode(e,t)}d.focus()},setContents:function(e){d.setContents(e)},appendContents:function(t){const n=d.convertContentsForEditor(t);if(d._variable.isCodeView)d._setCodeView(d._getCodeView()+"\n"+d.convertHTMLForCodeView(n));else{const t=r.createElement("DIV");t.innerHTML=n;const i=e.element.wysiwyg,l=t.children;for(let e=0,t=l.length;e
    ",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n&&t?/%$/.test(t.style.width)?(this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n&&t?this.util.getNumber(n.style.paddingBottom)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t),l=this.util.getNumber(n);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,s=n.resizeDiv,o=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=o.top,u=o.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",s.style.top="0px",s.style.left="0px",s.style.width=r+"px",s.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e",e},set_cover:function(e){const t=this.util.createElement("FIGURE");return t.appendChild(e),t},set_container:function(e,t){const n=this.util.createElement("DIV");return n.className="se-component "+t,n.setAttribute("contenteditable",!1),n.appendChild(e),n},onClick_resizeButton:function(e){e.stopPropagation();const t=e.target,n=t.getAttribute("data-command")||t.parentNode.getAttribute("data-command");if(!n)return;const i=t.getAttribute("data-value")||t.parentNode.getAttribute("data-value"),l=this.context.resizing._resize_plugin,s=this.context[l],o=s._element,a=this.plugins[l];if(e.preventDefault(),"function"!=typeof this.plugins.resizing._closeAlignMenu||(this.plugins.resizing._closeAlignMenu(),"onalign"!==n)){switch(n){case"auto":a.setAutoSize.call(this),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"percent":let e=this.plugins.resizing._module_getSizeY.call(this,s);if(this.context.resizing._rotateVertical){const t=o.getAttribute("data-percentage");t&&(e=t.split(",")[1])}this.plugins.resizing.resetTransform.call(this,o),a.setPercentSize.call(this,100*i,e),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"mirror":const t=o.getAttribute("data-rotate")||"0";let n=o.getAttribute("data-rotateX")||"",r=o.getAttribute("data-rotateY")||"";"h"===i&&!this.context.resizing._rotateVertical||"v"===i&&this.context.resizing._rotateVertical?r=r?"":"180":n=n?"":"180",o.setAttribute("data-rotateX",n),o.setAttribute("data-rotateY",r),this.plugins.resizing._setTransForm(o,t,n,r);break;case"rotate":const c=this.context.resizing,d=1*o.getAttribute("data-rotate")+1*i,u=this._w.Math.abs(d)>=360?0:d;o.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,o,null,null),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"onalign":this.plugins.resizing.openAlignMenu.call(this);break;case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"caption":const g=!s._captionChecked;if(a.openModify.call(this,!0),s._captionChecked=s.captionCheckEl.checked=g,"image"===l?a.update_image.call(this,!1,!1,!1):"video"===l&&(this.context.dialog.updateModal=!0,a.submitAction.call(this)),g){const e=this.util.getChildElement(s._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):s._caption.focus(),this.controllersOff()}else a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l)),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),a.onModifyMode.call(this,o,this.plugins.resizing.call_controller_resize.call(this,o,l));break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,s=1*e.getAttribute("data-rotate");let o="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";o=90===s||-270===s?t:e}}e.style.transformOrigin=o,this.plugins.resizing._setTransForm(e,s.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),s="";if(/[1-9]/.test(t)&&(n||i))switch(s=n?"Y":"X",t){case"90":s=n&&i?"X":i?s:"";break;case"270":l*=-1,s=n&&i?"Y":n?s:"";break;case"-90":s=n&&i?"Y":n?s:"";break;case"-270":l*=-1,s=n&&i?"X":i?s:"";break;default:s=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(s?" translate"+s+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];e.stopPropagation(),e.preventDefault();const i=this.context.resizing._resize_plugin,l=this.context[i]._element,s=this.plugins[i];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const o=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const n=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",a),this.removeDocEvent("mouseup",o),this.removeDocEvent("keydown",o),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this),n&&this.history.push(!1)),s.onModifyMode.call(this,l,this.plugins.resizing.call_controller_resize.call(this,l,t._resize_plugin))}.bind(this),a=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",a),this.addDocEvent("mouseup",o),this.addDocEvent("keydown",o)},resizing_element:function(e,t,n,i){const l=i.clientX,s=i.clientY;let o=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?s-e._resizeClientY:e._resizeClientY-s),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",o=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=o,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(o)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(){const e=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let t=this._w.Math.round(e?this.context.resizing._resize_h:this.context.resizing._resize_w),n=this._w.Math.round(e?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!e&&!/%$/.test(t)){const e=16,i=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(t)>i&&(n=this._w.Math.round(n/t*i),t=i)}this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t,n,!1),this.plugins[this.context.resizing._resize_plugin].init.call(this)}};return void 0===t&&(e.SUNEDITOR_MODULES||(e.SUNEDITOR_MODULES={}),e.SUNEDITOR_MODULES.resizing=n),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)}}); \ No newline at end of file diff --git a/index.d.ts b/index.d.ts index 0c2c1a587..887daec56 100644 --- a/index.d.ts +++ b/index.d.ts @@ -103,10 +103,22 @@ declare module 'suneditor' { * Displays the current node structure to resizingBar */ showPathLabel?: boolean; + /** + * Character count + * =============== + */ /** * Shows the number of characters in the editor */ charCounter?: boolean; + /** + * Defines the calculation method of the "charCounter" option + */ + charCounterType?: String; + /** + * Text to be displayed in the "charCounter" area of the bottom bar. + */ + charCounterLabel?: String; /** * The maximum number of characters allowed to be inserted into the editor */ @@ -292,6 +304,10 @@ declare module 'suneditor' { * The placeholder text */ placeholder?: string; + /** + * You can redefine icons. + */ + icons?: Record; } export type FormatTagName = diff --git a/package.json b/package.json index 8cf1df3bd..7ce264dee 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "sideEffects": [ "./src/assets/css/*.css" ], - "version": "2.27.1", + "version": "2.28.0", "description": "Pure JavaScript based WYSIWYG web editor", "main": "src/suneditor.js", "keywords": [ diff --git a/sample/html/customPlugins.html b/sample/html/customPlugins.html index e20f063da..0ed6c410d 100644 --- a/sample/html/customPlugins.html +++ b/sample/html/customPlugins.html @@ -12,6 +12,8 @@ + + ' + + wDoc.head.innerHTML + + '' + '' + '' + contentsHTML + '' + '' @@ -3694,7 +3694,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { const contents = util.createElement('DIV'); const style = util.createElement('STYLE'); - style.innerHTML = util.getPageStyle(); + style.innerHTML = util.getPageStyle(wDoc); contents.className = 'sun-editor-editable'; contents.innerHTML = contentsHTML; @@ -3705,7 +3705,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { try { iframe.focus(); // IE or Edge - if (_w.navigator.userAgent.indexOf('MSIE') !== -1 || !!_d.documentMode || !!_w.StyleMedia) { + if (util.isIE_Edge || !!_d.documentMode || !!_w.StyleMedia) { try { iframe.contentWindow.document.execCommand('print', false, null); } catch (e) { @@ -3729,15 +3729,15 @@ export default function (context, pluginCallButtons, plugins, lang, options) { const contentsHTML = this.getContents(true); const windowObject = _w.open('', '_blank'); windowObject.mimeType = 'text/html'; + const wDoc = this._wd; if (options.iframe) { - const wDocument = util.getIframeDocument(context.element.wysiwygFrame); - const arrts = options.fullPage ? util.getAttributesToString(wDocument.body, ['contenteditable']) : 'class="sun-editor-editable"'; + const arrts = options.fullPage ? util.getAttributesToString(wDoc.body, ['contenteditable']) : 'class="sun-editor-editable"'; windowObject.document.write('' + '' + '' + - wDocument.head.innerHTML + + wDoc.head.innerHTML + '' + '' + '' + contentsHTML + '' + @@ -3750,7 +3750,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { '' + '' + '' + lang.toolbar.preview + '' + - '' + + '' + '' + '' + contentsHTML + '' + '' @@ -3817,15 +3817,18 @@ export default function (context, pluginCallButtons, plugins, lang, options) { for (let i = 0, len = domTree.length, t; i < len; i++) { t = domTree[i]; if (t.nodeType === 8 && this._allowHTMLComments) { - cleanHTML += '

    ' + t.textContent.trim() + '

    '; + cleanHTML += '<__comment__>' + t.textContent.trim() + ''; } else if (!tagsAllowed.test(t.nodeName)) { cleanHTML += t.nodeType === 1 ? t.outerHTML : t.nodeType === 3 ? t.textContent : ''; } } cleanHTML = cleanHTML + .replace(/\n/g, '') .replace(/<(script|style).*>(\n|.)*<\/(script|style)>/g, '') .replace(this.editorTagsWhitelistRegExp, '') + .replace('<__comment__>', '') .replace(/(<[a-zA-Z0-9]+)[^>]*(?=>)/g, function (m, t) { let v = null; const tAttr = this._attributesTagsWhitelist[t.match(/(?!<)[a-zA-Z]+/)[0].toLowerCase()]; @@ -3889,7 +3892,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { if (t.nodeType === 8) { if (this._allowHTMLComments) { - baseHtml = '

    ' + t.textContent.trim() + '

    '; + baseHtml = '<__comment__>' + t.textContent.trim() + ''; } else { continue; } @@ -3911,10 +3914,16 @@ export default function (context, pluginCallButtons, plugins, lang, options) { if (returnHTML.length === 0) { contents = util._HTMLConvertor(contents); - returnHTML = '

    ' + (contents.length > 0 ? contents : '
    ') + '

    '; + return '

    ' + (contents.length > 0 ? contents : '
    ') + '

    '; } - return util._tagConvertor(returnHTML.replace(this.editorTagsWhitelistRegExp, '')); + returnHTML = returnHTML + .replace(this.editorTagsWhitelistRegExp, '') + .replace(/\n/g, '') + .replace('<__comment__>', ''); + + return util._tagConvertor(returnHTML); }, /** @@ -3943,11 +3952,14 @@ export default function (context, pluginCallButtons, plugins, lang, options) { br = nodeRegTest ? '\n' : ''; lineBR = isFormatElement(node) && !elementRegTest && !/^(TH|TD)$/i.test(element.nodeName) ? '\n' : ''; + if (node.nodeType === 8) { + returnHTML += '\n' + br; + continue; + } if (node.nodeType === 3) { returnHTML += util._HTMLConvertor((/^\n+$/.test(node.data) ? '' : node.data)); continue; } - if (node.childNodes.length === 0) { returnHTML += (/^(HR)$/i.test(node.nodeName) ? '\n' : '') + elementIndent + node.outerHTML + br; continue; @@ -3966,53 +3978,66 @@ export default function (context, pluginCallButtons, plugins, lang, options) { /** * @description The current number of characters is counted and displayed. - * @param {Number} nextCharCount Length of character to be added. + * @param {String} inputText Text added. * @returns {Boolean} * @private */ - _charCount: function (nextCharCount, blink) { + _charCount: function (inputText) { const charCounter = context.element.charCounter; - if (!charCounter) return true; - if (!nextCharCount || nextCharCount < 0) nextCharCount = 0; - const maxCharCount = options.maxCharCount; + const wysiwyg = context.element.wysiwyg; + let nextCharCount = 0; + if (!!inputText) nextCharCount = core._getCharLength(inputText); - _w.setTimeout(function () { - charCounter.textContent = context.element.wysiwyg.textContent.length; - }); + if (charCounter) { + _w.setTimeout(function () { charCounter.textContent = core._getCharLength(wysiwyg.textContent); }); + } if (maxCharCount > 0) { let over = false; - const count = context.element.wysiwyg.textContent.length; + const count = core._getCharLength(wysiwyg.textContent); if (count > maxCharCount) { - core._editorRange(); - const range = core.getRange(); - const endOff = range.endOffset - 1; - const text = core.getSelectionNode().textContent; - - core.getSelectionNode().textContent = text.slice(0, range.endOffset - 1) + text.slice(range.endOffset, text.length); - core.setRange(range.endContainer, endOff, range.endContainer, endOff); over = true; + if (nextCharCount > 0) { + this._editorRange(); + const range = this.getRange(); + const endOff = range.endOffset - 1; + const text = this.getSelectionNode().textContent; + const slicePosition = range.endOffset - (count - maxCharCount); + + this.getSelectionNode().textContent = text.slice(0, slicePosition < 0 ? 0 : slicePosition) + text.slice(range.endOffset, text.length); + this.setRange(range.endContainer, endOff, range.endContainer, endOff); + } } else if ((count + nextCharCount) > maxCharCount) { over = true; } if (over) { - if (blink && !util.hasClass(charCounter, 'se-blink')) { - util.addClass(charCounter, 'se-blink'); + const charWrapper = context.element.charWrapper; + if (charWrapper && !util.hasClass(charWrapper, 'se-blink')) { + util.addClass(charWrapper, 'se-blink'); _w.setTimeout(function () { - util.removeClass(charCounter, 'se-blink'); + util.removeClass(charWrapper, 'se-blink'); }, 600); } - return false; + if (nextCharCount > 0) return false; } } return true; }, + /** + * @description Method used only in "_charCount". + * Depending on the option, the length of the character is taken. + * @param {String} text Text content + */ + _getCharLength: function (text) { + return options.charCounterType === 'byte' ? util.getByteLength(text) : text.length; + }, + /** * @description Check the components such as image and video and modify them according to the format. * @private @@ -4068,24 +4093,22 @@ export default function (context, pluginCallButtons, plugins, lang, options) { */ _init: function (reload, _initHTML) { this._ww = options.iframe ? context.element.wysiwygFrame.contentWindow : _w; - this._wd = options.iframe ? context.element.wysiwygFrame.contentDocument : _d; + this._wd = options.iframe ? util.getIframeDocument(context.element.wysiwygFrame) : _d; if (options.iframe && options.height === 'auto') this._iframeAuto = this._wd.body; this._allowHTMLComments = options._editorTagsWhitelist.indexOf('//') > -1; - this.editorTagsWhitelistRegExp = util.createTagsWhitelist(options._editorTagsWhitelist.replace('|//', '')); + this.editorTagsWhitelistRegExp = util.createTagsWhitelist(options._editorTagsWhitelist.replace('|//', '|__comment__')); this.pasteTagsWhitelistRegExp = util.createTagsWhitelist(options.pasteTagsWhitelist); const _attr = options.attributesWhitelist; const tagsAttr = {}; let allAttr = ''; if (!!_attr) { - const _attrKeys = _w.Object.keys(_attr); - for (let i = 0, len = _attrKeys.length, a; i < len; i++) { - a = _attrKeys[i]; - if (a === 'all') { - allAttr = _attr[a] + '|'; + for (let k in _attr) { + if (k === 'all') { + allAttr = _attr[k] + '|'; } else { - tagsAttr[a] = new _w.RegExp('((?:' + _attr[a] + ')\s*=\s*"[^"]*")', 'ig'); + tagsAttr[k] = new _w.RegExp('((?:' + _attr[k] + ')\s*=\s*"[^"]*")', 'ig'); } } } @@ -4174,7 +4197,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { */ _iframeAutoHeight: function () { if (this._iframeAuto) { - context.element.wysiwygFrame.style.height = this._iframeAuto.offsetHeight + 'px'; + _w.setTimeout(function () { context.element.wysiwygFrame.style.height = core._iframeAuto.offsetHeight + 'px'; }); } }, @@ -4717,11 +4740,32 @@ export default function (context, pluginCallButtons, plugins, lang, options) { } }, + onInput_wysiwyg: function (e) { + core._editorRange(); + + const range = core.getRange(); + const selectRange = !range.collapsed || range.startContainer !== range.endContainer; + const data = (e.data === null ? '' : e.data === undefined ? ' ' : e.data) || ''; + + if (!core._charCount(data)) { + e.preventDefault(); + e.stopPropagation(); + } + + // component check + if (selectRange || !data) core._checkComponents(); + + // history stack + core.history.push(true); + + if (functions.onInput) functions.onInput(e, core); + }, + _onShortcutKey: false, onKeyDown_wysiwyg: function (e) { const keyCode = e.keyCode; const shift = e.shiftKey; - const ctrl = e.ctrlKey || e.metaKey; + const ctrl = e.ctrlKey || e.metaKey || keyCode === 91 || keyCode === 92; const alt = e.altKey; core.submenuOff(); @@ -5215,25 +5259,18 @@ export default function (context, pluginCallButtons, plugins, lang, options) { } const textKey = !ctrl && !alt && !selectRange && !event._nonTextKeyCode.test(keyCode); - if (textKey && range.collapsed && range.startContainer === range.endContainer && util.isBreak(range.commonAncestorContainer)) { const zeroWidth = util.createTextNode(util.zeroWidthSpace); core.insertNode(zeroWidth, null); } - if (!core._charCount(1, textKey)) { - if (textKey) { - e.preventDefault(); - e.stopPropagation(); - } - } - if (functions.onKeyDown) functions.onKeyDown(e, core); }, onKeyUp_wysiwyg: function (e) { if (event._onShortcutKey) return; core._editorRange(); + const range = core.getRange(); const keyCode = e.keyCode; const ctrl = e.ctrlKey || e.metaKey || keyCode === 91 || keyCode === 92; @@ -5279,10 +5316,8 @@ export default function (context, pluginCallButtons, plugins, lang, options) { event._applyTagEffects(); } - core._checkComponents(); - const textKey = !ctrl && !alt && !event._nonTextKeyCode.test(keyCode); - if (textKey && selectionNode.nodeType === 3 && util.zeroWidthRegExp.test(selectionNode.textContent)) { + if (textKey && selectionNode.nodeType === 3 && util.zeroWidthRegExp.test(selectionNode.textContent) && util.getByteLength(e.key) < 3) { let so = range.startOffset, eo = range.endOffset; const frontZeroWidthCnt = (selectionNode.textContent.substring(0, eo).match(event._frontZeroWidthReg) || '').length; so = range.startOffset - frontZeroWidthCnt; @@ -5291,16 +5326,12 @@ export default function (context, pluginCallButtons, plugins, lang, options) { core.setRange(selectionNode, so < 0 ? 0 : so, selectionNode, eo < 0 ? 0 : eo); } - if (!core._charCount(0, textKey)) { - if (e.key.length === 1) { - e.preventDefault(); - e.stopPropagation(); - } - } - - // history stack - const historyKey = !ctrl && !alt && !event._historyIgnoreKeyCode.test(keyCode); - if (historyKey) { + // --IE (backspace, enter, delete) input event not working + if(util.isIE && /^(8|13|46)$/.test(keyCode)) { + core._charCount(''); + // component check + core._checkComponents(); + // history stack core.history.push(true); } @@ -5438,7 +5469,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { const clipboardData = e.clipboardData; if (!clipboardData) return true; - const maxCharCount = core._charCount(clipboardData.getData('text/plain').length, true); + const maxCharCount = core._charCount(clipboardData.getData('text/plain')); const cleanData = core.cleanHTML(clipboardData.getData('text/html'), core.pasteTagsWhitelistRegExp); if (typeof functions.onPaste === 'function' && !functions.onPaste(e, cleanData, maxCharCount, core)) { @@ -5466,9 +5497,6 @@ export default function (context, pluginCallButtons, plugins, lang, options) { onCut_wysiwyg: function () { _w.setTimeout(function () { core._resourcesStateChange(); - core._charCount(0, false); - // history stack - core.history.push(false); }); }, @@ -5490,7 +5518,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { context.image.imgInputFile.files = null; }); // check char count - } else if (!core._charCount(dataTransfer.getData('text/plain').length, true)) { + } else if (!core._charCount(dataTransfer.getData('text/plain'))) { e.preventDefault(); e.stopPropagation(); return false; @@ -5544,6 +5572,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { /** editor area */ eventWysiwyg.addEventListener('mousedown', event.onMouseDown_wysiwyg, false); eventWysiwyg.addEventListener('click', event.onClick_wysiwyg, false); + eventWysiwyg.addEventListener(util.isIE ? 'textinput' : 'input', event.onInput_wysiwyg, false); eventWysiwyg.addEventListener('keydown', event.onKeyDown_wysiwyg, false); eventWysiwyg.addEventListener('keyup', event.onKeyUp_wysiwyg, false); eventWysiwyg.addEventListener('paste', event.onPaste_wysiwyg, false); @@ -5592,6 +5621,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { context.element.toolbar.removeEventListener('click', event.onClick_toolbar); eventWysiwyg.removeEventListener('click', event.onClick_wysiwyg); + eventWysiwyg.removeEventListener(util.isIE ? 'textinput' : 'input', event.onInput_wysiwyg); eventWysiwyg.removeEventListener('keydown', event.onKeyDown_wysiwyg); eventWysiwyg.removeEventListener('keyup', event.onKeyUp_wysiwyg); eventWysiwyg.removeEventListener('paste', event.onPaste_wysiwyg); @@ -5636,6 +5666,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { onScroll: null, onMouseDown: null, onClick: null, + onInput: null, onKeyDown: null, onKeyUp: null, onDrop: null, @@ -5757,6 +5788,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { _resizingBar: el.resizingBar, _navigation: el.navigation, _charCounter: el.charCounter, + _charWrapper: el.charWrapper, _loading: el.loading, _resizeBack: el.resizeBackground, _stickyDummy: el._stickyDummy, @@ -5770,7 +5802,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { core._imagesInfoReset = true; core._init(true, _initHTML); event._addEvent(); - core._charCount(0, false); + core._charCount(''); event._offStickyToolbar(); event.onResize_window(); @@ -5973,13 +6005,13 @@ export default function (context, pluginCallButtons, plugins, lang, options) { util.removeItem(context.element.topArea); /** remove object reference */ - _w.Object.keys(core).forEach(function(key) {delete core[key];}); - _w.Object.keys(event).forEach(function(key) {delete event[key];}); - _w.Object.keys(context).forEach(function(key) {delete context[key];}); - _w.Object.keys(pluginCallButtons).forEach(function(key) {delete pluginCallButtons[key];}); + for (var k in core) { delete core[k]; } + for (var k in event) { delete event[k]; } + for (var k in context) { delete context[k]; } + for (var k in pluginCallButtons) { delete pluginCallButtons[k]; } /** remove user object */ - _w.Object.keys(this).forEach(function(key) {delete this[key];}.bind(this)); + for (var k in this) { delete this[k]; } }, /** @@ -6029,7 +6061,7 @@ export default function (context, pluginCallButtons, plugins, lang, options) { /** initialize core and add event listeners */ core._init(false, null); event._addEvent(); - core._charCount(0, false); + core._charCount(''); // functionss core.functions = functions; diff --git a/src/lib/history.js b/src/lib/history.js index 08c5115ba..6584e730c 100644 --- a/src/lib/history.js +++ b/src/lib/history.js @@ -36,7 +36,7 @@ export default function (core, change) { } core._checkComponents(); - core._charCount(0, false); + core._charCount(''); core._resourcesStateChange(); // onChange @@ -78,7 +78,7 @@ export default function (core, change) { if (stackIndex === 1 && undo) undo.removeAttribute('disabled'); core._checkComponents(); - core._charCount(0, false); + core._charCount(''); // onChange change(); } diff --git a/src/lib/util.js b/src/lib/util.js index 67351a3a3..e9c7cd5de 100755 --- a/src/lib/util.js +++ b/src/lib/util.js @@ -13,6 +13,8 @@ const util = { _d: document, _w: window, + isIE: window.navigator.userAgent.match(/(MSIE|Trident.*rv[ :])([0-9]+)/) !== null, + isIE_Edge: (window.navigator.userAgent.match(/(MSIE|Trident.*rv[ :])([0-9]+)/) !== null) || (window.navigator.appVersion.indexOf('Edge') > -1), /** * @description Removes attribute values such as style and converts tags that do not conform to the "html5" standard. @@ -156,12 +158,12 @@ const util = { /** * @description Returns the CSS text that has been applied to the current page. - * @param {Element|null} iframe To get the CSS text of an iframe, send an iframe object. (context.element.wysiwygFrame) + * @param {Element|null} doc To get the CSS text of an document(core._wd). If null get the current document. * @returns {String} */ - getPageStyle: function (iframe) { + getPageStyle: function (doc) { let cssText = ''; - const sheets = (iframe ? this.getIframeDocument(iframe) : this._d).styleSheets; + const sheets = (doc || this._d).styleSheets; for (let i = 0, len = sheets.length, rules; i < len; i++) { try { @@ -209,6 +211,36 @@ const util = { return attrString; }, + /** + * @descriptionGets Get the length in bytes of a string. + * referencing code: "https://github.com/shaan1974/myrdin/blob/master/expressions/string.js#L11" + * @param {String} text String text + * @returns {Number} + */ + getByteLength: function(text) { + const encoder = this._w.encodeURIComponent; + let cr, cl; + if (this.isIE_Edge) { + cl = this._w.unescape(encoder(text.toString())).length; + cr = 0; + + if (encoder(text.toString()).match(/(%0A|%0D)/gi) !== null) { + cr = encoder(text.toString()).match(/(%0A|%0D)/gi).length; + } + + return cl + cr; + } else { + cl = (new this._w.TextEncoder('utf-8').encode(text.toString())).length; + cr = 0; + + if (encoder(text.toString()).match(/(%0A|%0D)/gi) !== null) { + cr = encoder(text.toString()).match(/(%0A|%0D)/gi).length; + } + + return cl + cr; + } + }, + /** * @description It is judged whether it is the edit region top div element or iframe's body tag. * @param {Element} element The element to check diff --git a/src/plugins/dialog/image.js b/src/plugins/dialog/image.js index d4e829142..9fe0972f6 100644 --- a/src/plugins/dialog/image.js +++ b/src/plugins/dialog/image.js @@ -9,7 +9,6 @@ import dialog from '../modules/dialog'; import resizing from '../modules/resizing'; -import _icons from '../../assets/defaultIcons'; export default { name: 'image', @@ -106,7 +105,7 @@ export default { let html = '' + '
    ' + '' + '' + lang.dialogBox.imageBox.title + '' + '
    ' + @@ -162,7 +161,7 @@ export default { '' + '' + ' ' + lang.dialogBox.proportion + '' + - '' + + '' + '' ; } @@ -305,7 +304,7 @@ export default { this.context.image._xmlHttp = this.util.getXMLHttpRequest(); this.context.image._xmlHttp.onreadystatechange = this.plugins.image.callBack_imgUpload.bind(this, info); this.context.image._xmlHttp.open('post', imageUploadUrl, true); - if(imageUploadHeader !== null && typeof imageUploadHeader === 'object' && Object.keys(imageUploadHeader).length > 0){ + if(imageUploadHeader !== null && typeof imageUploadHeader === 'object' && this._w.Object.keys(imageUploadHeader).length > 0){ for(let key in imageUploadHeader){ this.context.image._xmlHttp.setRequestHeader(key, imageUploadHeader[key]); } diff --git a/src/plugins/dialog/link.js b/src/plugins/dialog/link.js index d435bc817..a3df18ffb 100644 --- a/src/plugins/dialog/link.js +++ b/src/plugins/dialog/link.js @@ -8,7 +8,6 @@ 'use strict'; import dialog from '../modules/dialog'; -import _icons from '../../assets/defaultIcons'; export default { name: 'link', @@ -62,7 +61,7 @@ export default { '