@ckeditor/ckeditor5-track-changes 33.0.0 → 34.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/build/track-changes.js +1 -1
- package/build/translations/az.js +1 -0
- package/build/translations/cs.js +1 -1
- package/build/translations/en-au.js +1 -1
- package/build/translations/gl.js +1 -1
- package/build/translations/hr.js +1 -1
- package/build/translations/id.js +1 -0
- package/build/translations/sk.js +1 -1
- package/lang/translations/az.po +387 -0
- package/lang/translations/cs.po +28 -28
- package/lang/translations/en-au.po +5 -5
- package/lang/translations/gl.po +3 -3
- package/lang/translations/hr.po +13 -13
- package/lang/translations/id.po +370 -0
- package/lang/translations/sk.po +57 -57
- package/package.json +3 -3
- package/src/commands/acceptallsuggestionscommand.js +1 -1
- package/src/commands/acceptselectedsuggestionscommand.js +1 -1
- package/src/commands/acceptsuggestioncommand.js +1 -1
- package/src/commands/discardallsuggestionscommand.js +1 -1
- package/src/commands/discardselectedsuggestionscommand.js +1 -1
- package/src/commands/discardsuggestioncommand.js +1 -1
- package/src/commands/trackchangescommand.js +1 -1
- package/src/integrations/alignment.js +1 -1
- package/src/integrations/basicstyles.js +1 -1
- package/src/integrations/blockquote.js +1 -1
- package/src/integrations/codeblock.js +1 -1
- package/src/integrations/comments.js +1 -1
- package/src/integrations/deletecommand.js +1 -1
- package/src/integrations/entercommand.js +1 -1
- package/src/integrations/font.js +1 -1
- package/src/integrations/heading.js +1 -1
- package/src/integrations/highlight.js +1 -1
- package/src/integrations/horizontalline.js +1 -1
- package/src/integrations/image.js +1 -1
- package/src/integrations/indent.js +1 -1
- package/src/integrations/inputcommand.js +1 -1
- package/src/integrations/link.js +1 -1
- package/src/integrations/list.js +1 -1
- package/src/integrations/mediaembed.js +1 -1
- package/src/integrations/mention.js +1 -1
- package/src/integrations/pagebreak.js +1 -1
- package/src/integrations/paragraph.js +1 -1
- package/src/integrations/removeformat.js +1 -1
- package/src/integrations/restrictededitingmode.js +1 -1
- package/src/integrations/shiftentercommand.js +1 -1
- package/src/integrations/standardeditingmode.js +1 -1
- package/src/integrations/table.js +1 -1
- package/src/integrations/tableclipboard.js +1 -1
- package/src/integrations/tableheadings.js +1 -1
- package/src/integrations/tablemergesplit.js +1 -1
- package/src/integrations/title.js +1 -1
- package/src/integrations/undo.js +1 -1
- package/src/integrations/utils.js +1 -1
- package/src/suggestion.js +1 -1
- package/src/suggestiondescriptionfactory.js +1 -1
- package/src/trackchanges.js +1 -1
- package/src/trackchangesdata.js +1 -1
- package/src/trackchangesediting.js +1 -1
- package/src/trackchangesui.js +1 -1
- package/src/ui/suggestioncontroller.js +1 -1
- package/src/ui/view/basesuggestionthreadview.js +1 -1
- package/src/ui/view/suggestionthreadview.js +1 -1
- package/src/utils/getselectedsuggestions.js +1 -1
- package/src/utils/hashobject.js +1 -1
- package/src/utils/normalizedescription.js +1 -1
- package/src/utils/sortsuggestions.js +1 -1
- package/theme/integrations/horizontalline.css +0 -15
- package/theme/integrations/image.css +0 -55
- package/theme/integrations/mediaembed.css +0 -19
- package/theme/integrations/pagebreak.css +0 -15
- package/theme/integrations/table.css +0 -147
- package/theme/suggestion.css +0 -87
- package/theme/suggestionmarker.css +0 -161
package/build/track-changes.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
/*!
|
|
3
3
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
4
4
|
* For licensing, see LICENSE.md.
|
|
5
|
-
*/(()=>{var e={596:e=>{e.exports='\x3c!--\n\n What you\'re currently looking at is the source code of a legally protected, proprietary software.\n CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,\n all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.\n\n Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n\n!--\x3e\n\n<svg viewBox="0 0 20 20" width="20" height="20" xmlns="http://www.w3.org/2000/svg"><g fill="#000" fill-rule="nonzero"><path d="M1 3.28C1 2.574 1.574 2 2.272 2h10.23c.703 0 1.272.573 1.272 1.28v12.768c0 .708-.574 1.281-1.271 1.281H2.272A1.276 1.276 0 0 1 1 16.049V3.28zm11.503 12.954c-.008 0-.006-12.77-.006-12.77 0-.003-10.225-.004-10.225-.004.007 0 .005 12.77.005 12.77 0 .003 10.226.004 10.226.004zm-8.31-9.58c0-.353.292-.64.636-.64h5.116c.351 0 .636.284.636.64a.641.641 0 0 1-.636.638H4.829a.636.636 0 0 1-.635-.639zm0 2.554c0-.352.292-.638.636-.638h5.116c.351 0 .636.283.636.638a.641.641 0 0 1-.636.639H4.829a.636.636 0 0 1-.635-.639zm0 2.555c0-.353.289-.639.633-.639h2.567c.35 0 .633.284.633.64a.639.639 0 0 1-.633.638H4.826a.634.634 0 0 1-.632-.639z"/><path d="M10.515 17.958l.154-.23c-.195-.099-.304-.193-.328-.28-.024-.09.001-.275.076-.552.062-.165.099-.296.111-.393.013-.159.013-.319 0-.478-.138-.41-.2-.686-.187-.83.013-.145.117-.335.313-.57l4.465-6.208c.356-.6 1.059-.56 2.11.119 1.051.68 1.443 1.271 1.177 1.771L14.53 17.14c-.105.271-.22.444-.347.516-.128.07-.399.118-.813.138a2.954 2.954 0 0 0-.487.21 2.044 2.044 0 0 0-.347.31c-.193.174-.332.262-.416.262-.064 0-.178-.05-.346-.15l-.204.27-1.056-.738h.001zm-.184.274l1.039.727-.259.34H9.614l.717-1.067z"/></g></svg>\n'},152:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(758),r=n.n(o)()((function(e){return e[1]}));r.push([e.id,".ck-content .ck-suggestion-marker-deletion.ck-widget.ck-horizontal-line{background-color:var(--ck-color-suggestion-widget-deletion-background)}.ck-content .ck-suggestion-marker-deletion.ck-widget.ck-horizontal-line.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-deletion-background-active)}.ck-content .ck-suggestion-marker-insertion.ck-widget.ck-horizontal-line{background-color:var(--ck-color-suggestion-widget-insertion-background)}.ck-content .ck-suggestion-marker-insertion.ck-widget.ck-horizontal-line.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-insertion-background-active)}",""]);const i=r},413:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(758),r=n.n(o)()((function(e){return e[1]}));r.push([e.id,".ck-content .ck-suggestion-marker-deletion.ck-widget.image{background-color:var(--ck-color-suggestion-widget-deletion-background)}.ck-content .ck-suggestion-marker-deletion.ck-widget.image img{opacity:.6}.ck-content .ck-suggestion-marker-deletion.ck-widget.image figcaption{background-color:var(--ck-color-suggestion-widget-deletion-background)}.ck-content .ck-suggestion-marker-deletion.ck-widget.image.ck-suggestion-marker--active,.ck-content .ck-suggestion-marker-deletion.ck-widget.image.ck-suggestion-marker--active figcaption{background-color:var(--ck-color-suggestion-widget-deletion-background-active)}.ck-content .ck-suggestion-marker-insertion.ck-widget.image,.ck-content .ck-suggestion-marker-insertion.ck-widget.image figcaption{background-color:var(--ck-color-suggestion-widget-insertion-background)}.ck-content .ck-suggestion-marker-insertion.ck-widget.image.ck-suggestion-marker--active,.ck-content .ck-suggestion-marker-insertion.ck-widget.image.ck-suggestion-marker--active figcaption{background-color:var(--ck-color-suggestion-widget-insertion-background-active)}.ck-content .ck-widget.image>figcaption.ck-suggestion-marker-deletion{background-color:var(--ck-color-suggestion-widget-deletion-background);border:none}.ck-content .ck-widget.image>figcaption.ck-suggestion-marker-deletion.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-deletion-background-active)}.ck-content .ck-widget.image>figcaption.ck-suggestion-marker-insertion{background-color:var(--ck-color-suggestion-widget-insertion-background);border:none}.ck-content .ck-widget.image>figcaption.ck-suggestion-marker-insertion.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-insertion-background-active)}",""]);const i=r},943:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(758),r=n.n(o)()((function(e){return e[1]}));r.push([e.id,".ck-content .ck-suggestion-marker-deletion.ck-widget.media{background-color:var(--ck-color-suggestion-widget-deletion-background)}.ck-content .ck-suggestion-marker-deletion.ck-widget.media .ck-media__wrapper{opacity:.6}.ck-content .ck-suggestion-marker-deletion.ck-widget.media.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-deletion-background-active)}.ck-content .ck-suggestion-marker-insertion.ck-widget.media{background-color:var(--ck-color-suggestion-widget-insertion-background)}.ck-content .ck-suggestion-marker-insertion.ck-widget.media.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-insertion-background-active)}",""]);const i=r},137:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(758),r=n.n(o)()((function(e){return e[1]}));r.push([e.id,".ck-content .ck-suggestion-marker-deletion.ck-widget.page-break{background-color:var(--ck-color-suggestion-widget-deletion-background)}.ck-content .ck-suggestion-marker-deletion.ck-widget.page-break.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-deletion-background-active)}.ck-content .ck-suggestion-marker-insertion.ck-widget.page-break{background-color:var(--ck-color-suggestion-widget-insertion-background)}.ck-content .ck-suggestion-marker-insertion.ck-widget.page-break.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-insertion-background-active)}",""]);const i=r},399:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(758),r=n.n(o)()((function(e){return e[1]}));r.push([e.id,":root{--ck-color-suggestion-widget-th-insertion-background:rgba(102,229,119,0.12);--ck-color-suggestion-widget-th-insertion-background-active:rgba(37,218,61,0.14);--ck-color-suggestion-widget-th-deletion-background:rgba(229,102,134,0.14);--ck-color-suggestion-widget-th-deletion-background-active:rgba(196,33,74,0.16)}.ck-content figure.table .ck-suggestion-marker-formatBlock{box-shadow:-3px 0 0 0 var(--ck-color-suggestion-marker-format-border)}.ck-content figure.table .ck-suggestion-marker-formatBlock.ck-suggestion-marker--active{box-shadow:-3px 0 0 0 var(--ck-color-suggestion-marker-format-border-active)}.ck-content .ck-suggestion-marker-insertion.table>table{border-color:var(--ck-color-suggestion-marker-insertion-border)}.ck-content .ck-suggestion-marker-insertion.table>table>tbody>tr>th,.ck-content .ck-suggestion-marker-insertion.table>table>thead>tr>th{background-color:var(--ck-color-suggestion-widget-th-insertion-background);border-color:var(--ck-color-suggestion-marker-insertion-border)}.ck-content .ck-suggestion-marker-insertion.table>table>tbody>tr>td{background-color:var(--ck-color-suggestion-widget-insertion-background);border-color:var(--ck-color-suggestion-marker-insertion-border)}.ck-content .ck-suggestion-marker-insertion.ck-suggestion-marker--active.table>table{border-color:var(--ck-color-suggestion-marker-insertion-border-active)}.ck-content .ck-suggestion-marker-insertion.ck-suggestion-marker--active.table>table>tbody>tr>th,.ck-content .ck-suggestion-marker-insertion.ck-suggestion-marker--active.table>table>thead>tr>th{background-color:var(--ck-color-suggestion-widget-th-insertion-background-active);border-color:var(--ck-color-suggestion-marker-insertion-border-active)}.ck-content .ck-suggestion-marker-insertion.ck-suggestion-marker--active.table>table>tbody>tr>td{background-color:var(--ck-color-suggestion-widget-insertion-background-active);border-color:var(--ck-color-suggestion-marker-insertion-border-active)}.ck-content .ck-suggestion-marker-deletion.table>table{border-color:var(--ck-color-suggestion-marker-deletion-border)}.ck-content .ck-suggestion-marker-deletion.table>table>tbody>tr>th,.ck-content .ck-suggestion-marker-deletion.table>table>thead>tr>th{background-color:var(--ck-color-suggestion-widget-th-deletion-background);border-color:var(--ck-color-suggestion-marker-deletion-border);text-decoration:none}.ck-content .ck-suggestion-marker-deletion.table>table>tbody>tr>td{background-color:var(--ck-color-suggestion-widget-deletion-background);border-color:var(--ck-color-suggestion-marker-deletion-border);text-decoration:none}.ck-content .ck-suggestion-marker-deletion.ck-suggestion-marker--active.table>table{border-color:var(--ck-color-suggestion-marker-deletion-border-active)}.ck-content .ck-suggestion-marker-deletion.ck-suggestion-marker--active.table>table>tbody>tr>th,.ck-content .ck-suggestion-marker-deletion.ck-suggestion-marker--active.table>table>thead>tr>th{background-color:var(--ck-color-suggestion-widget-th-deletion-background-active);border-color:var(--ck-color-suggestion-marker-deletion-border-active)}.ck-content .ck-suggestion-marker-deletion.ck-suggestion-marker--active.table>table>tbody>tr>td{background-color:var(--ck-color-suggestion-widget-deletion-background-active);border-color:var(--ck-color-suggestion-marker-deletion-border-active)}.ck-content .table th.ck-suggestion-marker-insertion{background-color:var(--ck-color-suggestion-widget-th-insertion-background)}.ck-content .table th.ck-suggestion-marker-insertion.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-th-insertion-background-active)}.ck-content .table th.ck-suggestion-marker-deletion{background-color:var(--ck-color-suggestion-widget-th-deletion-background);text-decoration:none}.ck-content .table th.ck-suggestion-marker-deletion.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-th-deletion-background-active)}.ck-content .table td.ck-suggestion-marker-insertion{background-color:var(--ck-color-suggestion-widget-insertion-background)}.ck-content .table td.ck-suggestion-marker-insertion.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-insertion-background-active)}.ck-content .table td.ck-suggestion-marker-deletion{background-color:var(--ck-color-suggestion-widget-deletion-background);text-decoration:none}.ck-content .table td.ck-suggestion-marker-deletion.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-deletion-background-active)}.ck-content .table td.ck-suggestion-marker-formatBlock,.ck-content .table td.ck-suggestion-marker-formatInline,.ck-content .table th.ck-suggestion-marker-formatBlock,.ck-content .table th.ck-suggestion-marker-formatInline{background-color:var(--ck-color-suggestion-widget-format-background);box-shadow:none}.ck-content .table td.ck-suggestion-marker-formatBlock.ck-suggestion-marker--active,.ck-content .table td.ck-suggestion-marker-formatInline.ck-suggestion-marker--active,.ck-content .table th.ck-suggestion-marker-formatBlock.ck-suggestion-marker--active,.ck-content .table th.ck-suggestion-marker-formatInline.ck-suggestion-marker--active{background-color:var(--ck-color-suggestion-widget-format-background-active);box-shadow:none}",""]);const i=r},477:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(758),r=n.n(o)()((function(e){return e[1]}));r.push([e.id,":root{--ck-color-comment-box-border:#f2de02;--ck-color-suggestion-box-deletion-border:#d85a79;--ck-color-suggestion-box-insertion-border:#5ad86b;--ck-color-suggestion-box-format-border:#5ac1d8}.ck .ck-suggestion{border-top-left-radius:var(--ck-border-radius)}.ck .ck-annotation{border-left:3px solid transparent}.ck .ck-suggestion--disabled-comments .ck-annotation{min-height:80px}.ck .ck-comment,.ck .ck-comment__input-container,.ck .ck-thread__comment-count{border-left:3px solid var(--ck-color-comment-box-border)}.ck .ck-suggestion-insertion .ck-suggestion{border-left-color:var(--ck-color-suggestion-box-insertion-border)}.ck .ck-suggestion-deletion .ck-suggestion{border-left-color:var(--ck-color-suggestion-box-deletion-border)}.ck .ck-suggestion-replace .ck-suggestion{border-left-color:var(--ck-color-suggestion-box-insertion-border)}.ck .ck-suggestion-format .ck-suggestion{border-left-color:var(--ck-color-suggestion-box-format-border)}.ck .ck-suggestion-wrapper{outline:0}.ck .ck-suggestion-type{font-weight:700}.ck .ck-suggestion-color{display:inline-block;width:14px;height:14px;border-radius:14px;vertical-align:text-bottom;margin:0 5px;box-shadow:0 0 0 1px #444}.ck .ck-suggestion-insertion .ck-comment,.ck .ck-suggestion-insertion .ck-comment__input-container,.ck .ck-suggestion-insertion .ck-thread__comment-count,.ck .ck-suggestion-replace .ck-comment,.ck .ck-suggestion-replace .ck-comment__input-container,.ck .ck-suggestion-replace .ck-thread__comment-count{border-left-color:var(--ck-color-suggestion-box-insertion-border)}.ck .ck-suggestion-deletion .ck-comment,.ck .ck-suggestion-deletion .ck-comment__input-container,.ck .ck-suggestion-deletion .ck-thread__comment-count{border-left-color:var(--ck-color-suggestion-box-deletion-border)}.ck .ck-suggestion-format .ck-comment,.ck .ck-suggestion-format .ck-comment__input-container,.ck .ck-suggestion-format .ck-thread__comment-count{border-left-color:var(--ck-color-suggestion-box-format-border)}",""]);const i=r},588:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var o=n(758),r=n.n(o)()((function(e){return e[1]}));r.push([e.id,':root{--ck-color-suggestion-marker-insertion-border:rgba(30,174,49,0.35);--ck-color-suggestion-marker-insertion-border-active:rgba(19,109,31,0.5);--ck-color-suggestion-marker-insertion-background:rgba(102,229,119,0.35);--ck-color-suggestion-marker-insertion-background-active:rgba(37,218,61,0.5);--ck-color-suggestion-marker-deletion-border:rgba(174,30,66,0.35);--ck-color-suggestion-marker-deletion-border-active:rgba(109,19,41,0.5);--ck-color-suggestion-marker-deletion-background:rgba(229,102,134,0.35);--ck-color-suggestion-marker-deletion-background-active:rgba(218,37,82,0.5);--ck-color-suggestion-marker-deletion-stroke:rgba(87,15,33,0.5);--ck-color-suggestion-marker-format-border:rgba(10,160,194,0.4);--ck-color-suggestion-marker-format-border-active:rgba(10,160,194,0.65);--ck-color-suggestion-widget-insertion-background:rgba(102,229,119,0.05);--ck-color-suggestion-widget-insertion-background-active:rgba(37,218,61,0.07);--ck-color-suggestion-widget-deletion-background:rgba(229,102,134,0.05);--ck-color-suggestion-widget-deletion-background-active:rgba(196,33,74,0.07);--ck-color-suggestion-widget-format-background:rgba(10,160,194,0.09);--ck-color-suggestion-widget-format-background-active:rgba(10,160,194,0.16)}.ck-content .ck-suggestion-marker-insertion{border-top:3px solid var(--ck-color-suggestion-marker-insertion-border);border-bottom:3px solid var(--ck-color-suggestion-marker-insertion-border);background:var(--ck-color-suggestion-marker-insertion-background)}.ck-content .ck-suggestion-marker-insertion.ck-suggestion-marker--active{border-color:var(--ck-color-suggestion-marker-insertion-border-active);background:var(--ck-color-suggestion-marker-insertion-background-active)}.ck-content .ck-suggestion-marker-insertion.ck-widget{background:none;text-decoration:none;border:3px solid var(--ck-color-suggestion-marker-insertion-border)}.ck-content .ck-suggestion-marker-insertion.ck-widget.ck-suggestion-marker--active{border-color:var(--ck-color-suggestion-marker-insertion-border-active)}.ck-content .ck-suggestion-marker-deletion{border-top:3px solid var(--ck-color-suggestion-marker-deletion-border);border-bottom:3px solid var(--ck-color-suggestion-marker-deletion-border);text-decoration:line-through;text-decoration-color:var(--ck-color-suggestion-marker-deletion-stroke);text-decoration-thickness:3px;background:var(--ck-color-suggestion-marker-deletion-background)}.ck-content .ck-suggestion-marker-deletion.ck-suggestion-marker--active{border-color:var(--ck-color-suggestion-marker-deletion-border-active);background:var(--ck-color-suggestion-marker-deletion-background-active)}.ck-content .ck-suggestion-marker-deletion.ck-widget{background:none;text-decoration:none;border:3px solid var(--ck-color-suggestion-marker-deletion-border)}.ck-content .ck-suggestion-marker-deletion.ck-widget.ck-suggestion-marker--active{border-color:var(--ck-color-suggestion-marker-deletion-border-active)}.ck-content .ck-suggestion-marker-merge:after{border-top:3px solid var(--ck-color-suggestion-marker-deletion-border);border-bottom:3px solid var(--ck-color-suggestion-marker-deletion-border);text-decoration:line-through;text-decoration-color:var(--ck-color-suggestion-marker-deletion-stroke);background:var(--ck-color-suggestion-marker-deletion-background);color:var(--ck-color-suggestion-marker-deletion-stroke);content:"¶"}.ck-content .ck-suggestion-marker-merge.ck-suggestion-marker--active:after{border-color:var(--ck-color-suggestion-marker-deletion-border-active);background:var(--ck-color-suggestion-marker-deletion-background-active)}.ck-content .ck-suggestion-marker-split:after{border-top:3px solid var(--ck-color-suggestion-marker-insertion-border);border-bottom:3px solid var(--ck-color-suggestion-marker-insertion-border);background:var(--ck-color-suggestion-marker-insertion-background);color:var(--ck-color-suggestion-marker-insertion-border);content:"¶"}.ck-content .ck-suggestion-marker-split.ck-suggestion-marker--active:after{border-color:var(--ck-color-suggestion-marker-insertion-border-active);background:var(--ck-color-suggestion-marker-insertion-background-active)}.ck-content .ck-suggestion-marker-formatInline{border-top:3px solid var(--ck-color-suggestion-marker-format-border);border-bottom:3px solid var(--ck-color-suggestion-marker-format-border)}.ck-content .ck-suggestion-marker-formatInline.ck-suggestion-marker--active{border-color:var(--ck-color-suggestion-marker-format-border-active)}.ck-content .ck-suggestion-marker-formatInline.ck-widget{background:none;border:3px solid var(--ck-color-suggestion-marker-format-border)}.ck-content .ck-suggestion-marker-formatInline.ck-widget.ck-suggestion-marker--active{border-color:var(--ck-color-suggestion-marker-format-border-active)}.ck-content .ck-suggestion-marker-formatBlock{border:0;background:none;box-shadow:-7px 0 0 0 var(--ck-color-base-background),-10px 0 0 0 var(--ck-color-suggestion-marker-format-border)}.ck-content .ck-suggestion-marker-formatBlock.ck-suggestion-marker--active{box-shadow:-5px 0 0 0 var(--ck-color-base-background),-8px 0 0 0 var(--ck-color-suggestion-marker-format-border-active)}.ck-content ol .ck-suggestion-marker-formatBlock,.ck-content ul .ck-suggestion-marker-formatBlock{box-shadow:-2px 0 0 0 var(--ck-color-base-background),-5px 0 0 0 var(--ck-color-suggestion-marker-format-border)}.ck-content ol .ck-suggestion-marker-formatBlock.ck-suggestion-marker--active,.ck-content ul .ck-suggestion-marker-formatBlock.ck-suggestion-marker--active{box-shadow:-2px 0 0 0 var(--ck-color-base-background),-5px 0 0 0 var(--ck-color-suggestion-marker-format-border-active)}',""]);const i=r},758:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,o){"string"==typeof e&&(e=[[null,e,""]]);var r={};if(o)for(var i=0;i<this.length;i++){var s=this[i][0];null!=s&&(r[s]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);o&&r[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},278:(e,t,n)=>{"use strict";var o,r=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},i=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function a(e){for(var t=-1,n=0;n<s.length;n++)if(s[n].identifier===e){t=n;break}return t}function c(e,t){for(var n={},o=[],r=0;r<e.length;r++){var i=e[r],c=t.base?i[0]+t.base:i[0],l=n[c]||0,g="".concat(c," ").concat(l);n[c]=l+1;var u=a(g),d={css:i[1],media:i[2],sourceMap:i[3]};-1!==u?(s[u].references++,s[u].updater(d)):s.push({identifier:g,updater:p(d,t),references:1}),o.push(g)}return o}function l(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var r=n.nc;r&&(o.nonce=r)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var s=i(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var g,u=(g=[],function(e,t){return g[e]=t,g.filter(Boolean).join("\n")});function d(e,t,n,o){var r=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,r);else{var i=document.createTextNode(r),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function m(e,t,n){var o=n.css,r=n.media,i=n.sourceMap;if(r?e.setAttribute("media",r):e.removeAttribute("media"),i&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var f=null,h=0;function p(e,t){var n,o,r;if(t.singleton){var i=h++;n=f||(f=l(t)),o=d.bind(null,n,i,!1),r=d.bind(null,n,i,!0)}else n=l(t),o=m.bind(null,n,t),r=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else r()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=r());var n=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var r=a(n[o]);s[r].references--}for(var i=c(e,t),l=0;l<n.length;l++){var g=a(n[l]);0===s[g].references&&(s[g].updater(),s.splice(g,1))}n=i}}}},417:(e,t,n)=>{e.exports=n(720)("./src/collaboration-core.js")},704:(e,t,n)=>{e.exports=n(79)("./src/core.js")},492:(e,t,n)=>{e.exports=n(79)("./src/engine.js")},331:(e,t,n)=>{e.exports=n(79)("./src/enter.js")},181:(e,t,n)=>{e.exports=n(79)("./src/typing.js")},273:(e,t,n)=>{e.exports=n(79)("./src/ui.js")},209:(e,t,n)=>{e.exports=n(79)("./src/utils.js")},995:(e,t,n)=>{e.exports=n(79)("./src/widget.js")},720:e=>{"use strict";e.exports=CKEditor5.collaborationDll},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={id:o,exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n.d(o,{BaseSuggestionThreadView:()=>Is,TrackChanges:()=>ea,TrackChangesData:()=>aa});var e=n(704),t=n(209),r=n(273),i=n(417),s=n(492),a=n(995);const c=["affectsData","refresh","_enabledCommands","value","forceDisabled","execute","TrackChangesCommand","isEnabled","_disableUnsupportedCommands","commands","editor","has"];var l,g;l=c,g=142,function(e){for(;--e;)l.push(l.shift())}(++g);const u=function(e,t){return c[e-=0]};class d extends e.Command{constructor(e,t){super(e),this[u("0x4")]=t,this.value=!1,this.refresh()}[u("0x3")](){this[u("0x9")]=!0}[u("0x7")](){this.value=!this[u("0x5")],this.value?this[u("0xa")]():this._enableCommands()}[u("0xa")](){for(const e of this[u("0x0")].commands[u("0xb")]())e[u("0x2")]&&!this[u("0x4")][u("0x1")](e)&&e[u("0x6")](u("0x8"))}_enableCommands(){for(const e of this[u("0x0")][u("0xb")][u("0xb")]())e[u("0x2")]&&!this[u("0x4")][u("0x1")](e)&&e.clearForceDisabled("TrackChangesCommand")}}const m=["refresh","isEnabled","get","TrackChangesEditing","acceptSuggestion","_suggestions","track-changes-accept-suggestion-not-found","plugins","execute"];var f,h;f=m,h=408,function(e){for(;--e;)f.push(f.shift())}(++h);const p=function(e,t){return m[e-=0]};class k extends e.Command{constructor(e,t){super(e),this[p("0x2")]=t,this.refresh()}[p("0x6")](){this[p("0x7")]=!0}[p("0x5")](e){const n=this[p("0x2")].get(e);if(!n)throw new t.CKEditorError(p("0x3"),this);this.editor[p("0x4")][p("0x8")](p("0x0"))[p("0x1")](n)}}const b=["refresh","discardSuggestion","get","_suggestions","plugins","TrackChangesEditing","isEnabled"];var x,y;x=b,y=276,function(e){for(;--e;)x.push(x.shift())}(++y);const v=function(e,t){return b[e-=0]};class C extends e.Command{constructor(e,t){super(e),this[v("0x0")]=t,this[v("0x4")]()}[v("0x4")](){this[v("0x3")]=!0}execute(e){const n=this[v("0x0")][v("0x6")](e);if(!n)throw new t.CKEditorError("track-changes-discard-suggestion-not-found",this);this.editor[v("0x1")][v("0x6")](v("0x2"))[v("0x5")](n)}}var _,E,T=["sort","deletion","type"];_=T,E=390,function(e){for(;--e;)_.push(_.shift())}(++E);var w=function(e,t){return T[e-=0]};function S(e){return e[w("0x0")](((e,t)=>w("0x1")==e[w("0x2")]&&w("0x1")!=t[w("0x2")]?-1:"deletion"!=e.type&&w("0x1")==t[w("0x2")]?1:0))}const R=["isEnabled","editor","change","refresh","model","_acceptSuggestionCommand","isInContent","execute","_suggestions","from","some","values"];var A,I;A=R,I=448,function(e){for(;--e;)A.push(A.shift())}(++I);const M=function(e,t){return R[e-=0]};class N extends e.Command{constructor(e,t,n){super(e),this[M("0x1")]=t,this[M("0x4")]=n,this.refresh()}[M("0xb")](){const e=this[M("0x1")];this.isEnabled=e[M("0x8")]&&Array[M("0x5")](this[M("0x4")][M("0x7")]())[M("0x6")]((e=>e[M("0x2")]))}[M("0x3")](){this[M("0x9")][M("0x0")][M("0xa")]((()=>{const e=S(Array[M("0x5")](this._suggestions[M("0x7")]()));for(const t of e)t.isInContent&&this[M("0x1")][M("0x3")](t.id)}))}}const F=["getRanges","getRange","add","isInContent","isCollapsed","isIntersecting","from","start","next","isTouching","getMarkers"];var P,O;P=F,O=355,function(e){for(;--e;)P.push(P.shift())}(++O);const L=function(e,t){return F[e-=0]};function B(e,t){const n=Array[L("0x3")](e[L("0x8")]()),o=new Set;for(const r of t)if(r[L("0x0")])for(const t of n)for(const n of r[L("0x7")]()){const i=n[L("0x9")]();(t[L("0x2")](i)||e[L("0x1")]&&!r.isMultiRange&&r[L("0x5")]&&i.end[L("0x6")](t[L("0x4")]))&&o[L("0xa")](r)}return o}const j=["editor","_suggestions","from","execute","size","selection","isEnabled","model","document","_acceptSuggestionCommand","_selectedSuggestions","refresh","change","values"];var D,U;D=j,U=410,function(e){for(;--e;)D.push(D.shift())}(++U);const H=function(e,t){return j[e-=0]};class V extends e.Command{constructor(e,t,n){super(e),this[H("0x5")]=t,this[H("0xb")]=n,this._selectedSuggestions=new Set,this[H("0x7")]()}[H("0x7")](){const e=this[H("0x5")],t=this[H("0xa")].model[H("0x4")][H("0x1")],n=Array.from(this[H("0xb")][H("0x9")]());this[H("0x6")]=B(t,n),this.isEnabled=e[H("0x2")]&&!!this[H("0x6")][H("0x0")]}[H("0xd")](){this[H("0xa")][H("0x3")][H("0x8")]((()=>{const e=S(Array[H("0xc")](this[H("0x6")]));for(const t of e)this._acceptSuggestionCommand[H("0xd")](t.id)}))}}const z=["some","from","editor","refresh","change","isEnabled","_suggestions","_discardSuggestionCommand","isInContent","values","execute"];var G,W;G=z,W=258,function(e){for(;--e;)G.push(G.shift())}(++W);const q=function(e,t){return z[e-=0]};class $ extends e.Command{constructor(e,t,n){super(e),this[q("0x2")]=t,this[q("0x1")]=n,this[q("0x9")]()}refresh(){const e=this[q("0x2")];this.isEnabled=e[q("0x0")]&&Array[q("0x7")](this._suggestions[q("0x4")]())[q("0x6")]((e=>e[q("0x3")]))}execute(){this[q("0x8")].model[q("0xa")]((()=>{for(const e of this[q("0x1")][q("0x4")]())e[q("0x3")]&&this._discardSuggestionCommand[q("0x5")](e.id)}))}}const K=["_discardSuggestionCommand","values","isEnabled","editor","_selectedSuggestions","model","refresh","change","size","from","_suggestions","execute"];var Z,X;Z=K,X=126,function(e){for(;--e;)Z.push(Z.shift())}(++X);const Q=function(e,t){return K[e-=0]};class J extends e.Command{constructor(e,t,n){super(e),this[Q("0x6")]=t,this[Q("0x4")]=n,this._selectedSuggestions=new Set,this.refresh()}[Q("0x0")](){const e=this._discardSuggestionCommand,t=this[Q("0x9")][Q("0xb")].document.selection,n=Array[Q("0x3")](this[Q("0x4")][Q("0x7")]());this[Q("0xa")]=B(t,n),this[Q("0x8")]=e.isEnabled&&!!this[Q("0xa")][Q("0x2")]}[Q("0x5")](){this[Q("0x9")][Q("0xb")][Q("0x1")]((()=>{for(const e of this[Q("0xa")])this[Q("0x6")][Q("0x5")](e.id)}))}}const Y=function(){this.__data__=[],this.size=0};const ee=function(e,t){return e===t||e!=e&&t!=t};const te=function(e,t){for(var n=e.length;n--;)if(ee(e[n][0],t))return n;return-1};var ne=Array.prototype.splice;const oe=function(e){var t=this.__data__,n=te(t,e);return!(n<0)&&(n==t.length-1?t.pop():ne.call(t,n,1),--this.size,!0)};const re=function(e){var t=this.__data__,n=te(t,e);return n<0?void 0:t[n][1]};const ie=function(e){return te(this.__data__,e)>-1};const se=function(e,t){var n=this.__data__,o=te(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};function ae(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}ae.prototype.clear=Y,ae.prototype.delete=oe,ae.prototype.get=re,ae.prototype.has=ie,ae.prototype.set=se;const ce=ae;const le=function(){this.__data__=new ce,this.size=0};const ge=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};const ue=function(e){return this.__data__.get(e)};const de=function(e){return this.__data__.has(e)};const me="object"==typeof global&&global&&global.Object===Object&&global;var fe="object"==typeof self&&self&&self.Object===Object&&self;const he=me||fe||Function("return this")();const pe=he.Symbol;var ke=Object.prototype,be=ke.hasOwnProperty,xe=ke.toString,ye=pe?pe.toStringTag:void 0;const ve=function(e){var t=be.call(e,ye),n=e[ye];try{e[ye]=void 0;var o=!0}catch(e){}var r=xe.call(e);return o&&(t?e[ye]=n:delete e[ye]),r};var Ce=Object.prototype.toString;const _e=function(e){return Ce.call(e)};var Ee=pe?pe.toStringTag:void 0;const Te=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ee&&Ee in Object(e)?ve(e):_e(e)};const we=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const Se=function(e){if(!we(e))return!1;var t=Te(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const Re=he["__core-js_shared__"];var Ae,Ie=(Ae=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||""))?"Symbol(src)_1."+Ae:"";const Me=function(e){return!!Ie&&Ie in e};var Ne=Function.prototype.toString;const Fe=function(e){if(null!=e){try{return Ne.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var Pe=/^\[object .+?Constructor\]$/,Oe=Function.prototype,Le=Object.prototype,Be=Oe.toString,je=Le.hasOwnProperty,De=RegExp("^"+Be.call(je).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Ue=function(e){return!(!we(e)||Me(e))&&(Se(e)?De:Pe).test(Fe(e))};const He=function(e,t){return null==e?void 0:e[t]};const Ve=function(e,t){var n=He(e,t);return Ue(n)?n:void 0};const ze=Ve(he,"Map");const Ge=Ve(Object,"create");const We=function(){this.__data__=Ge?Ge(null):{},this.size=0};const qe=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var $e=Object.prototype.hasOwnProperty;const Ke=function(e){var t=this.__data__;if(Ge){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return $e.call(t,e)?t[e]:void 0};var Ze=Object.prototype.hasOwnProperty;const Xe=function(e){var t=this.__data__;return Ge?void 0!==t[e]:Ze.call(t,e)};const Qe=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ge&&void 0===t?"__lodash_hash_undefined__":t,this};function Je(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Je.prototype.clear=We,Je.prototype.delete=qe,Je.prototype.get=Ke,Je.prototype.has=Xe,Je.prototype.set=Qe;const Ye=Je;const et=function(){this.size=0,this.__data__={hash:new Ye,map:new(ze||ce),string:new Ye}};const tt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const nt=function(e,t){var n=e.__data__;return tt(t)?n["string"==typeof t?"string":"hash"]:n.map};const ot=function(e){var t=nt(this,e).delete(e);return this.size-=t?1:0,t};const rt=function(e){return nt(this,e).get(e)};const it=function(e){return nt(this,e).has(e)};const st=function(e,t){var n=nt(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};function at(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}at.prototype.clear=et,at.prototype.delete=ot,at.prototype.get=rt,at.prototype.has=it,at.prototype.set=st;const ct=at;const lt=function(e,t){var n=this.__data__;if(n instanceof ce){var o=n.__data__;if(!ze||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new ct(o)}return n.set(e,t),this.size=n.size,this};function gt(e){var t=this.__data__=new ce(e);this.size=t.size}gt.prototype.clear=le,gt.prototype.delete=ge,gt.prototype.get=ue,gt.prototype.has=de,gt.prototype.set=lt;const ut=gt;const dt=function(e,t){for(var n=-1,o=null==e?0:e.length;++n<o&&!1!==t(e[n],n,e););return e};const mt=function(){try{var e=Ve(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();const ft=function(e,t,n){"__proto__"==t&&mt?mt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n};var ht=Object.prototype.hasOwnProperty;const pt=function(e,t,n){var o=e[t];ht.call(e,t)&&ee(o,n)&&(void 0!==n||t in e)||ft(e,t,n)};const kt=function(e,t,n,o){var r=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var a=t[i],c=o?o(n[a],e[a],a,n,e):void 0;void 0===c&&(c=e[a]),r?ft(n,a,c):pt(n,a,c)}return n};const bt=function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o};const xt=function(e){return null!=e&&"object"==typeof e};const yt=function(e){return xt(e)&&"[object Arguments]"==Te(e)};var vt=Object.prototype,Ct=vt.hasOwnProperty,_t=vt.propertyIsEnumerable;const Et=yt(function(){return arguments}())?yt:function(e){return xt(e)&&Ct.call(e,"callee")&&!_t.call(e,"callee")};const Tt=Array.isArray;const wt=function(){return!1};var St="object"==typeof exports&&exports&&!exports.nodeType&&exports,Rt=St&&"object"==typeof module&&module&&!module.nodeType&&module,At=Rt&&Rt.exports===St?he.Buffer:void 0;const It=(At?At.isBuffer:void 0)||wt;var Mt=/^(?:0|[1-9]\d*)$/;const Nt=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Mt.test(e))&&e>-1&&e%1==0&&e<t};const Ft=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Pt={};Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object Boolean]"]=Pt["[object DataView]"]=Pt["[object Date]"]=Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object WeakMap]"]=!1;const Ot=function(e){return xt(e)&&Ft(e.length)&&!!Pt[Te(e)]};const Lt=function(e){return function(t){return e(t)}};var Bt="object"==typeof exports&&exports&&!exports.nodeType&&exports,jt=Bt&&"object"==typeof module&&module&&!module.nodeType&&module,Dt=jt&&jt.exports===Bt&&me.process;const Ut=function(){try{var e=jt&&jt.require&&jt.require("util").types;return e||Dt&&Dt.binding&&Dt.binding("util")}catch(e){}}();var Ht=Ut&&Ut.isTypedArray;const Vt=Ht?Lt(Ht):Ot;var zt=Object.prototype.hasOwnProperty;const Gt=function(e,t){var n=Tt(e),o=!n&&Et(e),r=!n&&!o&&It(e),i=!n&&!o&&!r&&Vt(e),s=n||o||r||i,a=s?bt(e.length,String):[],c=a.length;for(var l in e)!t&&!zt.call(e,l)||s&&("length"==l||r&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Nt(l,c))||a.push(l);return a};var Wt=Object.prototype;const qt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Wt)};const $t=function(e,t){return function(n){return e(t(n))}};const Kt=$t(Object.keys,Object);var Zt=Object.prototype.hasOwnProperty;const Xt=function(e){if(!qt(e))return Kt(e);var t=[];for(var n in Object(e))Zt.call(e,n)&&"constructor"!=n&&t.push(n);return t};const Qt=function(e){return null!=e&&Ft(e.length)&&!Se(e)};const Jt=function(e){return Qt(e)?Gt(e):Xt(e)};const Yt=function(e,t){return e&&kt(t,Jt(t),e)};const en=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t};var tn=Object.prototype.hasOwnProperty;const nn=function(e){if(!we(e))return en(e);var t=qt(e),n=[];for(var o in e)("constructor"!=o||!t&&tn.call(e,o))&&n.push(o);return n};const on=function(e){return Qt(e)?Gt(e,!0):nn(e)};const rn=function(e,t){return e&&kt(t,on(t),e)};var sn="object"==typeof exports&&exports&&!exports.nodeType&&exports,an=sn&&"object"==typeof module&&module&&!module.nodeType&&module,cn=an&&an.exports===sn?he.Buffer:void 0,ln=cn?cn.allocUnsafe:void 0;const gn=function(e,t){if(t)return e.slice();var n=e.length,o=ln?ln(n):new e.constructor(n);return e.copy(o),o};const un=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t};const dn=function(e,t){for(var n=-1,o=null==e?0:e.length,r=0,i=[];++n<o;){var s=e[n];t(s,n,e)&&(i[r++]=s)}return i};const mn=function(){return[]};var fn=Object.prototype.propertyIsEnumerable,hn=Object.getOwnPropertySymbols;const pn=hn?function(e){return null==e?[]:(e=Object(e),dn(hn(e),(function(t){return fn.call(e,t)})))}:mn;const kn=function(e,t){return kt(e,pn(e),t)};const bn=function(e,t){for(var n=-1,o=t.length,r=e.length;++n<o;)e[r+n]=t[n];return e};const xn=$t(Object.getPrototypeOf,Object);const yn=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)bn(t,pn(e)),e=xn(e);return t}:mn;const vn=function(e,t){return kt(e,yn(e),t)};const Cn=function(e,t,n){var o=t(e);return Tt(e)?o:bn(o,n(e))};const _n=function(e){return Cn(e,Jt,pn)};const En=function(e){return Cn(e,on,yn)};const Tn=Ve(he,"DataView");const wn=Ve(he,"Promise");const Sn=Ve(he,"Set");const Rn=Ve(he,"WeakMap");var An="[object Map]",In="[object Promise]",Mn="[object Set]",Nn="[object WeakMap]",Fn="[object DataView]",Pn=Fe(Tn),On=Fe(ze),Ln=Fe(wn),Bn=Fe(Sn),jn=Fe(Rn),Dn=Te;(Tn&&Dn(new Tn(new ArrayBuffer(1)))!=Fn||ze&&Dn(new ze)!=An||wn&&Dn(wn.resolve())!=In||Sn&&Dn(new Sn)!=Mn||Rn&&Dn(new Rn)!=Nn)&&(Dn=function(e){var t=Te(e),n="[object Object]"==t?e.constructor:void 0,o=n?Fe(n):"";if(o)switch(o){case Pn:return Fn;case On:return An;case Ln:return In;case Bn:return Mn;case jn:return Nn}return t});const Un=Dn;var Hn=Object.prototype.hasOwnProperty;const Vn=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Hn.call(e,"index")&&(n.index=e.index,n.input=e.input),n};const zn=he.Uint8Array;const Gn=function(e){var t=new e.constructor(e.byteLength);return new zn(t).set(new zn(e)),t};const Wn=function(e,t){var n=t?Gn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)};var qn=/\w*$/;const $n=function(e){var t=new e.constructor(e.source,qn.exec(e));return t.lastIndex=e.lastIndex,t};var Kn=pe?pe.prototype:void 0,Zn=Kn?Kn.valueOf:void 0;const Xn=function(e){return Zn?Object(Zn.call(e)):{}};const Qn=function(e,t){var n=t?Gn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};const Jn=function(e,t,n){var o=e.constructor;switch(t){case"[object ArrayBuffer]":return Gn(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return Wn(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Qn(e,n);case"[object Map]":case"[object Set]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return $n(e);case"[object Symbol]":return Xn(e)}};var Yn=Object.create;const eo=function(){function e(){}return function(t){if(!we(t))return{};if(Yn)return Yn(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();const to=function(e){return"function"!=typeof e.constructor||qt(e)?{}:eo(xn(e))};const no=function(e){return xt(e)&&"[object Map]"==Un(e)};var oo=Ut&&Ut.isMap;const ro=oo?Lt(oo):no;const io=function(e){return xt(e)&&"[object Set]"==Un(e)};var so=Ut&&Ut.isSet;const ao=so?Lt(so):io;var co="[object Arguments]",lo="[object Function]",go="[object Object]",uo={};uo[co]=uo["[object Array]"]=uo["[object ArrayBuffer]"]=uo["[object DataView]"]=uo["[object Boolean]"]=uo["[object Date]"]=uo["[object Float32Array]"]=uo["[object Float64Array]"]=uo["[object Int8Array]"]=uo["[object Int16Array]"]=uo["[object Int32Array]"]=uo["[object Map]"]=uo["[object Number]"]=uo["[object Object]"]=uo["[object RegExp]"]=uo["[object Set]"]=uo["[object String]"]=uo["[object Symbol]"]=uo["[object Uint8Array]"]=uo["[object Uint8ClampedArray]"]=uo["[object Uint16Array]"]=uo["[object Uint32Array]"]=!0,uo["[object Error]"]=uo[lo]=uo["[object WeakMap]"]=!1;const mo=function e(t,n,o,r,i,s){var a,c=1&n,l=2&n,g=4&n;if(o&&(a=i?o(t,r,i,s):o(t)),void 0!==a)return a;if(!we(t))return t;var u=Tt(t);if(u){if(a=Vn(t),!c)return un(t,a)}else{var d=Un(t),m=d==lo||"[object GeneratorFunction]"==d;if(It(t))return gn(t,c);if(d==go||d==co||m&&!i){if(a=l||m?{}:to(t),!c)return l?vn(t,rn(a,t)):kn(t,Yt(a,t))}else{if(!uo[d])return i?t:{};a=Jn(t,d,c)}}s||(s=new ut);var f=s.get(t);if(f)return f;s.set(t,a),ao(t)?t.forEach((function(r){a.add(e(r,n,o,r,t,s))})):ro(t)&&t.forEach((function(r,i){a.set(i,e(r,n,o,i,t,s))}));var h=u?void 0:(g?l?En:_n:l?on:Jt)(t);return dt(h||t,(function(r,i){h&&(r=t[i=r]),pt(a,i,e(r,n,o,i,t,s))})),a};const fo=function(e){return mo(e,5)};const ho=function(e){return"symbol"==typeof e||xt(e)&&"[object Symbol]"==Te(e)};var po=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ko=/^\w*$/;const bo=function(e,t){if(Tt(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ho(e))||(ko.test(e)||!po.test(e)||null!=t&&e in Object(t))};function xo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var o=arguments,r=t?t.apply(this,o):o[0],i=n.cache;if(i.has(r))return i.get(r);var s=e.apply(this,o);return n.cache=i.set(r,s)||i,s};return n.cache=new(xo.Cache||ct),n}xo.Cache=ct;const yo=xo;var vo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Co=/\\(\\)?/g;const _o=function(e){var t=yo(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(vo,(function(e,n,o,r){t.push(o?r.replace(Co,"$1"):n||e)})),t}));const Eo=function(e,t){for(var n=-1,o=null==e?0:e.length,r=Array(o);++n<o;)r[n]=t(e[n],n,e);return r};var To=pe?pe.prototype:void 0,wo=To?To.toString:void 0;const So=function e(t){if("string"==typeof t)return t;if(Tt(t))return Eo(t,e)+"";if(ho(t))return wo?wo.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};const Ro=function(e){return null==e?"":So(e)};const Ao=function(e,t){return Tt(e)?e:bo(e,t)?[e]:_o(Ro(e))};const Io=function(e){if("string"==typeof e||ho(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};const Mo=function(e,t,n,o){if(!we(e))return e;for(var r=-1,i=(t=Ao(t,e)).length,s=i-1,a=e;null!=a&&++r<i;){var c=Io(t[r]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(r!=s){var g=a[c];void 0===(l=o?o(g,c,a):void 0)&&(l=we(g)?g:Nt(t[r+1])?[]:{})}pt(a,c,l),a=a[c]}return e};const No=function(e,t,n){return null==e?e:Mo(e,t,n)};const Fo=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const Po=function(e){return this.__data__.has(e)};function Oo(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ct;++t<n;)this.add(e[t])}Oo.prototype.add=Oo.prototype.push=Fo,Oo.prototype.has=Po;const Lo=Oo;const Bo=function(e,t){for(var n=-1,o=null==e?0:e.length;++n<o;)if(t(e[n],n,e))return!0;return!1};const jo=function(e,t){return e.has(t)};const Do=function(e,t,n,o,r,i){var s=1&n,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=i.get(e),g=i.get(t);if(l&&g)return l==t&&g==e;var u=-1,d=!0,m=2&n?new Lo:void 0;for(i.set(e,t),i.set(t,e);++u<a;){var f=e[u],h=t[u];if(o)var p=s?o(h,f,u,t,e,i):o(f,h,u,e,t,i);if(void 0!==p){if(p)continue;d=!1;break}if(m){if(!Bo(t,(function(e,t){if(!jo(m,t)&&(f===e||r(f,e,n,o,i)))return m.push(t)}))){d=!1;break}}else if(f!==h&&!r(f,h,n,o,i)){d=!1;break}}return i.delete(e),i.delete(t),d};const Uo=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n};const Ho=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var Vo=pe?pe.prototype:void 0,zo=Vo?Vo.valueOf:void 0;const Go=function(e,t,n,o,r,i,s){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new zn(e),new zn(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ee(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Uo;case"[object Set]":var c=1&o;if(a||(a=Ho),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;o|=2,s.set(e,t);var g=Do(a(e),a(t),o,r,i,s);return s.delete(e),g;case"[object Symbol]":if(zo)return zo.call(e)==zo.call(t)}return!1};var Wo=Object.prototype.hasOwnProperty;const qo=function(e,t,n,o,r,i){var s=1&n,a=_n(e),c=a.length;if(c!=_n(t).length&&!s)return!1;for(var l=c;l--;){var g=a[l];if(!(s?g in t:Wo.call(t,g)))return!1}var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var m=!0;i.set(e,t),i.set(t,e);for(var f=s;++l<c;){var h=e[g=a[l]],p=t[g];if(o)var k=s?o(p,h,g,t,e,i):o(h,p,g,e,t,i);if(!(void 0===k?h===p||r(h,p,n,o,i):k)){m=!1;break}f||(f="constructor"==g)}if(m&&!f){var b=e.constructor,x=t.constructor;b==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(m=!1)}return i.delete(e),i.delete(t),m};var $o="[object Arguments]",Ko="[object Array]",Zo="[object Object]",Xo=Object.prototype.hasOwnProperty;const Qo=function(e,t,n,o,r,i){var s=Tt(e),a=Tt(t),c=s?Ko:Un(e),l=a?Ko:Un(t),g=(c=c==$o?Zo:c)==Zo,u=(l=l==$o?Zo:l)==Zo,d=c==l;if(d&&It(e)){if(!It(t))return!1;s=!0,g=!1}if(d&&!g)return i||(i=new ut),s||Vt(e)?Do(e,t,n,o,r,i):Go(e,t,c,n,o,r,i);if(!(1&n)){var m=g&&Xo.call(e,"__wrapped__"),f=u&&Xo.call(t,"__wrapped__");if(m||f){var h=m?e.value():e,p=f?t.value():t;return i||(i=new ut),r(h,p,n,o,i)}}return!!d&&(i||(i=new ut),qo(e,t,n,o,r,i))};const Jo=function e(t,n,o,r,i){return t===n||(null==t||null==n||!xt(t)&&!xt(n)?t!=t&&n!=n:Qo(t,n,o,r,e,i))};const Yo=function(e,t){return Jo(e,t)};const er=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};const tr=function(e,t){for(var n=0,o=(t=Ao(t,e)).length;null!=e&&n<o;)e=e[Io(t[n++])];return n&&n==o?e:void 0};const nr=function(e,t,n){var o=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(n=n>r?r:n)<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(r);++o<r;)i[o]=e[o+t];return i};const or=function(e,t){return t.length<2?e:tr(e,nr(t,0,-1))};const rr=function(e,t){return t=Ao(t,e),null==(e=or(e,t))||delete e[Io(er(t))]};const ir=function(e,t){return null==e||rr(e,t)},sr=["push","from","clear","head","getItems","next","getMarkerNames","_onAccept","removeMarkers","previous","hasComments","isIntersectingWithRange","getContainedElement","onDiscard","delete","nodeBefore","set","nodeAfter","discard","map","_markerNames","add","getMarkers","isIntersecting","commentThread","setAttribute","getFirstRange","addMarkerName","change","getRange","substr","markers","type","subType","removeMarker","_onDiscard","getFirstMarker","_model","author","addRange","addMarker","getRanges","createdAt","filter","data","getMultiRangeId","length","_onAttributesChange","removeAttribute","size","attributes"];var ar,cr;ar=sr,cr=199,function(e){for(;--e;)ar.push(ar.shift())}(++cr);const lr=function(e,t){return sr[e-=0]};class gr{constructor(e,t){this.id=t.id,this[lr("0x25")]=t[lr("0x25")],this[lr("0x26")]=t[lr("0x26")]||null,this[lr("0x2b")]=t[lr("0x2b")],this[lr("0x31")]=null,this[lr("0x2a")]=e,this[lr("0xc")]=t.onAccept,this[lr("0x28")]=t[lr("0x12")],this._onAttributesChange=t.onAttributesChange,this[lr("0x19")]=new Set,this[lr("0x15")](lr("0x2f"),null),this[lr("0x15")](lr("0x4"),t[lr("0x4")]||{}),this.set(lr("0xe"),null),this[lr("0x15")](lr("0xa"),null),this[lr("0x15")]("commentThread",null),this[lr("0x15")]("_saved",!1),this.decorate("accept"),this.decorate("discard")}get[lr("0x8")](){let e=this;for(;e[lr("0xe")];)e=e[lr("0xe")];return e}get[lr("0xf")](){return!!this[lr("0x1d")]&&this[lr("0x1d")][lr("0x0")]>0}get isMultiRange(){return 0!=this[lr("0x19")][lr("0x3")]&&6==Array[lr("0x6")](this[lr("0x19")])[0].split(":")[lr("0x0")]}get isInContent(){return null!==this.getFirstMarker()}addMarkerName(e){this[lr("0x19")][lr("0x1a")](e)}[lr("0xb")](){return Array.from(this._markerNames)}getMarkers(){return this[lr("0xb")]()[lr("0x18")]((e=>this[lr("0x2a")][lr("0x24")].get(e)))[lr("0x30")]((e=>e))}[lr("0x29")](){return this.getMarkers()[0]||null}[lr("0xd")](){this[lr("0x2a")][lr("0x21")]((e=>{for(const t of this[lr("0x1b")]())e[lr("0x27")](t)})),this._markerNames[lr("0x7")]()}removeMarker(e){this._model[lr("0x21")]((t=>{t[lr("0x27")](e)})),this[lr("0x19")][lr("0x13")](e)}[lr("0x2c")](e){const t="suggestion:"+this[lr("0x25")]+":"+this[lr("0x26")]+":"+this.id+":"+this[lr("0x2b")].id+":"+gr[lr("0x32")]();this[lr("0x20")](t),this[lr("0x2a")].change((n=>{n[lr("0x2d")](t,{range:e,usingOperation:!0,affectsData:!0})}))}[lr("0x10")](e){for(const t of this[lr("0x2e")]())if(t[lr("0x1c")](e))return!0;return!1}getRanges(){return this[lr("0x1b")]().map((e=>e.getRange()))}[lr("0x9")](){return this[lr("0x2e")]().reduce(((e,t)=>[...e,...t[lr("0x9")]()]),[])}[lr("0x1f")](){return this.getFirstMarker()[lr("0x22")]()}[lr("0x11")](){const e=this.getRanges();if(1!=e.length)return null;const t=e[0],n=t.start[lr("0x16")],o=t.end[lr("0x14")];return n instanceof s.Element?n!=o?null:n:null}accept(){this._onAccept(this[lr("0x2e")](),this[lr("0x31")],this[lr("0x4")]),this[lr("0xd")]()}[lr("0x17")](){this[lr("0x28")](this.getRanges(),this[lr("0x31")],this[lr("0x4")]),this[lr("0xd")]()}getAllAdjacentSuggestions(){const e=[];let t=this[lr("0x8")];for(;t;)e[lr("0x5")](t),t=t[lr("0xa")];return e}[lr("0x1e")](e,t){const n=fo(this.attributes);No(n,e,t),Yo(n,this.attributes)||(this[lr("0x4")]=n,this._onAttributesChange(n))}[lr("0x2")](e){const t=fo(this[lr("0x4")]);ir(t,e),Yo(t,this.attributes)||(this[lr("0x4")]=t,this[lr("0x1")](this[lr("0x4")]))}toJSON(){return{id:this.id,type:this[lr("0x26")]?this[lr("0x25")]+":"+this[lr("0x26")]:this.type,authorId:this[lr("0x2b")].id,createdAt:this.createdAt,hasComments:this[lr("0xf")],data:this[lr("0x31")],attributes:this[lr("0x4")]}}static[lr("0x32")](){return(0,t.uid)()[lr("0x23")](1,5)}}(0,t.mix)(gr,t.ObservableMixin);class ur{constructor(e,t){this._customCallbacks=[],this._itemLabels=new Map,this._schema=e,this._locale=t}getDescriptions(e){const t=[];for(let n=0;n<e.length;n++){const o=e[n];if(!o.isInContent)continue;let r=!1;for(const e of this._customCallbacks){const n=e(o);if(n){n.type&&t.push(n),r=!0;break}}if(!r){this._addDescriptionItems(t,o);const r=e[n+1];if(r&&!o.getFirstRange().end.isEqual(r.getFirstRange().start)){const e=t[t.length-1],n="insertion"==o.type?"add":"remove";e&&"text"==e.type&&(e[n]+="\n")}}}return this._resolveDescriptionItems(t)}registerDescriptionCallback(e){this._customCallbacks.push(e)}registerElementLabel(e,t){this._itemLabels.set(e,t)}getItemLabel(e,t=1){const n=this._itemLabels.get(e)||e;return"function"==typeof n?n(t):1!==t?t+" "+n+"s":""+n}_addDescriptionItems(e,t){const n=t.getFirstRange().getWalker(),o="insertion"==t.type?"add":"remove";for(const t of n){const r=t.item,i=e[e.length-1];if(r.is("textProxy"))i&&i.type.indexOf("Container")>-1&&e.pop(),i&&"text"==i.type?i[o]+=r.data:e.push({type:"text",add:"add"==o?r.data:"",remove:"remove"==o?r.data:""});else if(this._schema.isObject(r)){if(i&&i.type.indexOf("Container")>-1&&e.pop(),"elementEnd"==t.type)continue;i&&i.type==o+"Object"&&i.name==r.name?i.quantity++:e.push({type:o+"Object",name:r.name,quantity:1}),n.skip((e=>!("elementEnd"==e.type&&e.item==r)))}else if(this._schema.checkChild(r,"$text")||r.is("element","softBreak")){if("add"==o&&"elementStart"==t.type||"remove"==o&&"elementEnd"==t.type)continue;if(i&&-1==i.type.indexOf("Container")){"text"==i.type&&(i[o]+="\n");continue}let n;if(n="add"==o?r.nextSibling&&!this._schema.isObject(r.nextSibling)?r.nextSibling:null:r.previousSibling&&!this._schema.isObject(r.previousSibling)?r.previousSibling:null,r.isEmpty||n&&n.isEmpty){const t=n&&n.isEmpty?n.name:r.name;i&&i.type==o+"EmptyContainer"&&i.name==t?i.quantity++:e.push({type:o+"EmptyContainer",name:t,quantity:1})}else e.push({type:o+"Container",name:r.name})}}}_resolveDescriptionItems(e){const{t}=this._locale,n=[];for(const o of e){switch(o.type){case"text":if(o.add=o.add.replace(/(\S)\u000A+(\S)/g,"$1 $2").replace(/\u000A/g,""),o.remove=o.remove.replace(/(\S)\u000A+(\S)/g,"$1 $2").replace(/\u000A/g,""),""!=o.add&&""!=o.remove){n.push({type:"replace",content:t({string:"*Replace:* %0 *with* %1",id:"REPLACE_TEXT"},['"'+o.remove+'"','"'+o.add+'"'])});continue}if(null!=o.add.match(/^ +$/)){n.push({type:"insertion",content:t("*Insert:* %0",t({string:"space",plural:"%0 spaces",id:"ELEMENT_SPACE"},o.add.length))});continue}if(null!=o.remove.match(/^ +$/)){n.push({type:"deletion",content:t("*Remove:* %0",t({string:"space",plural:"%0 spaces",id:"ELEMENT_SPACE"},o.remove.length))});continue}if(""!=o.add){n.push({type:"insertion",content:t("*Insert:* %0",'"'+o.add+'"')});continue}n.push({type:"deletion",content:t("*Remove:* %0",'"'+o.remove+'"')});continue;case"addEmptyContainer":case"addObject":n.push({type:"insertion",content:t("*Insert:* %0",this.getItemLabel(o.name,o.quantity))});continue;case"removeEmptyContainer":case"removeObject":n.push({type:"deletion",content:t("*Remove:* %0",this.getItemLabel(o.name,o.quantity))});continue;case"addContainer":n.push({type:"insertion",content:t("*Split:* %0",this.getItemLabel(o.name,o.quantity))});continue;case"removeContainer":n.push({type:"deletion",content:t("*Merge:* %0",this.getItemLabel(o.name,o.quantity))});continue}n.push(o)}return n}}var dr=n(278),mr=n.n(dr),fr=n(477),hr={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};mr()(fr.Z,hr);fr.Z.locals;var pr=n(588),kr={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};mr()(pr.Z,kr);pr.Z.locals;class br extends e.Plugin{afterInit(){const e=this.editor,{t}=e.locale;if(!e.plugins.has("AlignmentEditing"))return;const n=e.plugins.get("TrackChangesEditing");n.enableCommand("alignment",((t,o={})=>{let r=o.value;o.value||(r="ltr"===e.locale.contentLanguageDirection?"left":"right");const i=Array.from(this.editor.model.document.selection.getSelectedBlocks()).filter((e=>function(e,t,n){const o=e.getAttribute("alignment")||null;return t.checkAttribute(e,"alignment")&&n!=o}(e,this.editor.model.schema,r)));e.model.change((()=>{for(const e of i)n.markBlockFormat(e,{commandName:"alignment",commandParams:[{value:r}]})}))})),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:n}=e;if(n&&"alignment"==n.commandName){const e=n.commandParams[0].value;return{type:"format",content:t("*Format:* %0",function(e){switch(e){case"left":return t({string:"align to left",id:"FORMAT_ALIGN_TO_LEFT"});case"right":return t({string:"align to right",id:"FORMAT_ALIGN_TO_RIGHT"});case"center":return t({string:"align to center",id:"FORMAT_ALIGN_TO_CENTER"});case"justify":return t({string:"justify",id:"FORMAT_JUSTIFY_TEXT"})}}(e))}}}))}}const xr=["getItems","model","writer","markerName","elementEnd","item","isContent","type","name","get","insert","listItem","push","TrackChangesEditing","isAtEnd","markerRange","toViewElement","createUIElement","hasAttribute","nextSibling","addClass","ck-suggestion-marker--active","consumable","bindElementToMarker","getCustomProperty","activeMarkers"];var yr,vr;yr=xr,vr=181,function(e){for(;--e;)yr.push(yr.shift())}(++vr);const Cr=function(e,t){return xr[e-=0]};function _r(e,t,n){const o=[];for(const r of t[Cr("0x1")]())r[Cr("0x13")](e)&&o[Cr("0xd")](n.createRangeOn(r));return o}function Er(e){const t=[];if(e.is("element",Cr("0xc"))){let n=e[Cr("0x14")];for(;n&&n.is("element","listItem")&&n.getAttribute("listIndent")>0;)t[Cr("0xd")](n),n=n[Cr("0x14")]}return t}function Tr(e,t,{showActiveMarker:n=!0}={}){const o=e.plugins[Cr("0xa")](Cr("0xe"));return(r,i,s)=>{if(!s[Cr("0x17")].test(i[Cr("0x10")],r[Cr("0x9")]))return;const a=i[Cr("0x10")].getWalker(),c=i[Cr("0x10")].start,l=e[Cr("0x2")].schema;let g=null,u=null,d=!1,m=!1;for(const e of a){const t=e[Cr("0x6")];d=d||l[Cr("0x7")](t);const n=s.mapper[Cr("0x11")](t);if(n&&n[Cr("0x19")]("addHighlight"))return;Cr("0x5")==e[Cr("0x8")]&&l.isBlock(t)&&!l.isLimit(t)&&(t[Cr("0x14")]||c[Cr("0xf")]?g&&g.parent==t||(g=t,f(e.previousPosition),m=!0):u=u||e.previousPosition)}function f(e){const r=s[Cr("0x3")][Cr("0x12")]("span",{class:"ck-suggestion-marker-"+t}),a=s.mapper.toViewPosition(e);n&&o[Cr("0x0")].includes(i[Cr("0x4")])&&s[Cr("0x3")][Cr("0x15")](Cr("0x16"),r),s[Cr("0x3")][Cr("0xb")](a,r),s.mapper[Cr("0x18")](r,i[Cr("0x4")])}d||m||!u||f(u)}}const wr=["BoldEditing","ItalicEditing","UnderlineEditing","CodeEditing","StrikethroughEditing","SubscriptEditing","SuperscriptEditing"];class Sr extends e.Plugin{afterInit(){const e=this.editor,t=e.model,n=e.plugins.get("TrackChangesEditing"),{t:o}=e.locale;for(const o of wr){if(!e.plugins.has(o))continue;const r=o.slice(0,-7).toLowerCase(),i=e.commands.get(r);n.enableCommand(r,((e,o={})=>{const s=t.document.selection;if(s.isCollapsed)return void e(o);const a=void 0!==o.forceValue?o.forceValue:!i.value;t.change((()=>{const e=Array.from(s.getRanges());for(const o of e){const e=a?[o]:_r(r,o,t);for(const t of e)n.markInlineFormat(t,{commandName:r,commandParams:[{forceValue:a}]})}}))}))}function r(e,t){n._descriptionFactory.registerDescriptionCallback((n=>{const{data:r}=n;if(r&&r.commandName===e)return r.commandParams[0].forceValue?{type:"format",content:o("*Format:* %0",t)}:{type:"format",content:o("*Remove format:* %0",t)}}))}r("bold",o({string:"bold",id:"FORMAT_BOLD"})),r("italic",o({string:"italic",id:"FORMAT_ITALIC"})),r("underline",o({string:"underline",id:"FORMAT_UNDERLINE"})),r("code",o({string:"code",id:"FORMAT_CODE"})),r("strikethrough",o({string:"strikethrough",id:"FORMAT_STRIKETHROUGH"})),r("subscript",o({string:"subscript",id:"FORMAT_SUBSCRIPT"})),r("superscript",o({string:"superscript",id:"FORMAT_SUPERSCRIPT"}))}}class Rr extends e.Plugin{afterInit(){const e=this.editor,{t}=e.locale;if(!e.plugins.has("BlockQuoteEditing"))return;const n=e.plugins.get("TrackChangesEditing"),o=this.editor.commands.get("blockQuote");n.enableCommand("blockQuote",((t,r={})=>{const i=this.editor.model.document.selection,s=r&&void 0!==r.forceValue?r.forceValue:!o.value;let a=[];if(s){const t=Array.from(i.getSelectedBlocks()).filter((e=>Ar(e)||function(e,t){const n=t.checkChild(e.parent,"blockQuote"),o=t.checkChild(["$root","blockQuote"],e);return n&&o}(e,this.editor.model.schema)));a=Ir(t,e.model)}else{const t=Array.from(i.getSelectedBlocks()).filter((e=>Ar(e)));a=Ir(t,e.model)}e.model.change((()=>{for(const e of a)n.markBlockFormat(e,{commandName:"blockQuote",commandParams:[{forceValue:s}]})}))})),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:n}=e;if(n&&"blockQuote"==n.commandName){const e=t({string:"block quote",id:"ELEMENT_BLOCK_QUOTE"});return n.commandParams[0].forceValue?{type:"format",content:t("*Format:* %0",e)}:{type:"format",content:t("*Remove format:* %0",e)}}}))}}function Ar(e){return"blockQuote"==e.parent.name}function Ir(e,t){let n,o=0;const r=[],i=t.schema;for(;o<e.length;){const s=e[o],a=e[o+1];n||(n=t.createPositionBefore(s)),Mr(t,s,a)||(r.push(t.createRange(n,i.isObject(s)?t.createPositionAfter(s):t.createPositionAt(s,"end"))),n=null),o++}return r}function Mr(e,t,n){if(!n)return!1;const o=e.createPositionAfter(t),r=e.createPositionBefore(n),i=new s.TreeWalker({boundaries:e.createRange(o,r)});for(const t of i)if("text"==t.type||e.schema.isLimit(t.item))return!1;return!0}class Nr extends e.Plugin{afterInit(){const e=this.editor,{t}=e.locale;e.plugins.has("CodeBlock")&&e.plugins.get("TrackChangesEditing")._descriptionFactory.registerElementLabel("codeBlock",(e=>t({string:"code block",plural:"%0 code blocks",id:"ELEMENT_CODE_BLOCK"},e)))}}var Fr,Pr,Or=["enableCommand","get","requires","addCommentThread","editor","init","TrackChangesEditing"];Fr=Or,Pr=173,function(e){for(;--e;)Fr.push(Fr.shift())}(++Pr);var Lr=function(e,t){return Or[e-=0]};class Br extends e.Plugin{static get[Lr("0x4")](){return["CommentsEditing"]}[Lr("0x0")](){this[Lr("0x6")].plugins[Lr("0x3")](Lr("0x1"))[Lr("0x2")](Lr("0x5"))}}var jr=n(181);const Dr=["unbindElementFromMarkerName","markerName","downcastDispatcher","requires","lock","buffer","init","plugins","editing","rootName","writer","forward","createRange","batch","end","high","fromRange","start","detach","addMarker:suggestion:deletion","showSuggestionHighlights","unit","editor","getFirstRange","isCollapsed","selection","mapper","document","remove","merge","root","removeMarker:suggestion:deletion","unlock","enableCommand","setSelection","get","$graveyard","deleteForward","data","modifySelection","createSelection","model","uiElement","markerNameToElements","enqueueChange","options"];var Ur,Hr;Ur=Dr,Hr=196,function(e){for(;--e;)Ur.push(Ur.shift())}(++Hr);const Vr=function(e,t){return Dr[e-=0]};class zr extends e.Plugin{static get[Vr("0x25")](){return[jr.Delete]}[Vr("0x28")](){const e=this[Vr("0xa")],t=e[Vr("0x29")][Vr("0x17")]("TrackChangesEditing");t[Vr("0x15")]("delete");const n=e.commands[Vr("0x17")](Vr("0x19"));t.enableCommand(Vr("0x19"),((t,o={})=>{const r=e[Vr("0x1d")][Vr("0x1c")](e.model[Vr("0xf")][Vr("0xd")]);r[Vr("0xc")]&&e.model[Vr("0x1b")](r,{direction:Vr("0x2d"),unit:o[Vr("0x9")]});const i=r[Vr("0xb")](),a=s.LiveRange[Vr("0x4")](i);let c;t(o),c=Vr("0x18")==a[Vr("0x12")][Vr("0x2b")]?e[Vr("0x1d")][Vr("0x0")](i.start):e.model[Vr("0x0")](a[Vr("0x5")],a[Vr("0x2")]),a[Vr("0x6")](),e[Vr("0x1d")][Vr("0x20")](n.buffer[Vr("0x1")],(e=>{n[Vr("0x27")][Vr("0x26")](),e[Vr("0x16")](e.createRange(c[Vr("0x2")])),n.buffer[Vr("0x14")]()}))})),e[Vr("0x2a")][Vr("0x24")].on(Vr("0x7"),Tr(e,Vr("0x11")),{priority:Vr("0x3")}),e[Vr("0x1a")][Vr("0x24")].on(Vr("0x7"),((t,n,o)=>{o[Vr("0x21")][Vr("0x8")]&&Tr(e,Vr("0x11"),{showActiveMarker:!1})(t,n,o)}),{priority:"high"}),e[Vr("0x2a")][Vr("0x24")].on(Vr("0x13"),((e,t,n)=>{const o=n[Vr("0xe")][Vr("0x1f")](t[Vr("0x23")]);if(o)for(const e of o)e.is(Vr("0x1e"))&&(n.mapper[Vr("0x22")](e,t[Vr("0x23")]),n[Vr("0x2c")][Vr("0x10")](e))}),{priority:Vr("0x3")})}}var Gr=n(331);const Wr=["selection","split","ck-suggestion-marker-split","downcastDispatcher","schema","options","parent","get","model","enter","setSelection","editing","fromRange","high","detach","showSuggestionHighlights","unbindElementFromMarkerName","end","plugins","isAtEnd","isLimit","addMarker:suggestion:insertion","getFirstRange","createRange","mapper","start","enableCommand","TrackChangesEditing","requires","hasClass","change","markInsertion"];var qr,$r;qr=Wr,$r=412,function(e){for(;--e;)qr.push(qr.shift())}(++$r);const Kr=function(e,t){return Wr[e-=0]};class Zr extends e.Plugin{static get[Kr("0x0")](){return[Gr.Enter]}init(){const e=this.editor,t=e[Kr("0x16")][Kr("0xb")](Kr("0x1f"));t[Kr("0x1e")](Kr("0xd"),(n=>{e[Kr("0xc")][Kr("0x2")]((o=>{const r=e[Kr("0xc")].document[Kr("0x4")],i=r.getFirstPosition(),a=r.isCollapsed,c=s.LiveRange[Kr("0x10")](r[Kr("0x1a")]()),l=c.start[Kr("0xa")],g=c.end[Kr("0xa")],u=!(c[Kr("0x1d")].isAtStart&&c[Kr("0x15")][Kr("0x17")]),d=l==g,m=!(e[Kr("0xc")][Kr("0x8")].isLimit(l)||e[Kr("0xc")][Kr("0x8")][Kr("0x18")](g))&&(a||u&&d);if(n(),m){const n=e[Kr("0xc")].createPositionAt(i.parent.nextSibling,0),r=o.createRange(i,n);t[Kr("0x3")](r)}else o[Kr("0xe")](o[Kr("0x1b")](c[Kr("0x15")]));c[Kr("0x12")]()}))})),e[Kr("0xf")][Kr("0x7")].on(Kr("0x19"),Tr(e,Kr("0x5")),{priority:Kr("0x11")}),e[Kr("0xf")][Kr("0x7")].on("removeMarker:suggestion:insertion",((e,t,n)=>{const o=n.mapper.markerNameToElements(t.markerName);if(o)for(const e of o)e[Kr("0x1")](Kr("0x6"))&&(n[Kr("0x1c")][Kr("0x14")](e,t.markerName),n.writer.remove(e))}),{priority:Kr("0x11")}),e.data[Kr("0x7")].on("addMarker:suggestion:insertion",((t,n,o)=>{o[Kr("0x9")][Kr("0x13")]&&Tr(e,Kr("0x5"),{showActiveMarker:!1})(t,n,o)}),{priority:"high"})}}const Xr=[{pluginName:"FontSizeEditing",commandName:"fontSize"},{pluginName:"FontFamilyEditing",commandName:"fontFamily"},{pluginName:"FontColorEditing",commandName:"fontColor"},{pluginName:"FontBackgroundColorEditing",commandName:"fontBackgroundColor"}];class Qr extends e.Plugin{afterInit(){const{t:e}=this.editor.locale;for(const{pluginName:e,commandName:t}of Xr)this.editor.plugins.has(e)&&this._enableCommand(t);this.editor.plugins.get("TrackChangesEditing")._descriptionFactory.registerDescriptionCallback((t=>{const{data:n}=t;if(null!=n){if("fontSize"==n.commandName){const t=n.commandParams[0].value;if(t){const n=this.editor.plugins.get("FontSize").normalizeSizeOptions(this.editor.config.get("fontSize.options")).find((e=>e.model==t)).title,o=this.editor.locale._t(n).toLowerCase();return{type:"format",content:e("*Set font size:* %0",o)}}return{type:"format",content:e("*Reset font size*")}}if("fontFamily"==n.commandName){const t=n.commandParams[0].value;return t?{type:"format",content:e("*Set font family:* %0",t)}:{type:"format",content:e("*Reset font family*")}}if("fontColor"==n.commandName){const t=n.commandParams[0].value;if(t){const n=(0,r.normalizeColorOptions)(this.editor.config.get("fontColor.colors")).find((e=>e.model==t));let o=t,i="";return n&&(o=n.label,i=this.editor.locale._t(o).toLowerCase()),{type:"format",content:e("*Set font color:* %0",i).trim(),color:{value:t,title:i||o}}}return{type:"format",content:e("*Reset font color*")}}if("fontBackgroundColor"==n.commandName){const t=n.commandParams[0].value;if(t){const n=(0,r.normalizeColorOptions)(this.editor.config.get("fontBackgroundColor.colors")).find((e=>e.model==t));let o=t,i="";return n&&(o=n.label,i=this.editor.locale._t(o).toLowerCase()),{type:"format",content:e("*Set font background color:* %0",i).trim(),color:{value:t,title:i||o}}}return{type:"format",content:e("*Reset font background color*")}}}}))}_enableCommand(e){const t=this.editor;t.plugins.get("TrackChangesEditing").enableCommand(e,((n,o={})=>{const r=t.model.document.selection,i=o.value;r.isCollapsed?n(o):t.model.change((()=>{const n=Array.from(r.getRanges());for(const o of n){const n=i?[o]:_r(e,o,t.model);for(const o of n)t.plugins.get("TrackChangesEditing").markInlineFormat(o,{commandName:e,commandParams:[{value:i}]})}}))}))}}class Jr extends e.Plugin{afterInit(){const e=this.editor,{t}=e.locale,n=e.config.get("heading.options");if(!e.plugins.has("HeadingEditing"))return;const o=e.plugins.get("TrackChangesEditing");o.enableCommand("heading",((t,n)=>{const r=n.value,i=Array.from(this.editor.model.document.selection.getSelectedBlocks()).filter((e=>{return t=e,n=r,(o=this.editor.model.schema).checkChild(t.parent,n)&&!o.isObject(t)&&t.name!=n;var t,n,o}));e.model.change((()=>{for(const e of i)o.markBlockFormat(e,{commandName:"heading",commandParams:[n],formatGroupId:"blockName"},Er(e))}))}));for(const e of n)"paragraph"!=e.model&&o._descriptionFactory.registerElementLabel(e.model,(t=>{const n=Yr(e.model);return null!==n?r(t,n):i(t,e.title)}));function r(e,n){return t({string:"heading (level %1)",plural:"%0 headings (level %1)",id:"ELEMENT_HEADING"},[e,n])}function i(e,n){return t({string:"heading (%1)",plural:"%0 headings (%1)",id:"ELEMENT_HEADING_CUSTOM"},[e,n])}o._descriptionFactory.registerDescriptionCallback((e=>{const{type:o,data:s}=e;if("formatBlock"==o&&s&&"heading"==s.commandName){const e=s.commandParams[0].value,o=Yr(e);if(null!==o)return{type:"format",content:t("*Change to:* %0",r(1,o))};const a=n.find((t=>t.model===e)).title;return{type:"format",content:t("*Change to:* %0",i(1,a))}}}))}}function Yr(e){const t=e.match(/^heading(\d+)$/);return t?t[1]:null}class ei extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("HighlightEditing"))return;const t=e.plugins.get("TrackChangesEditing");t.enableCommand("highlight",((n,o={})=>{const r=e.model.document.selection,i=r.getAttribute("highlight");let s=o.value,a=[];if(r.isCollapsed){const t=r.getFirstPosition();if(!r.hasAttribute("highlight"))return void n(o);{const n=e=>e.item.getAttribute("highlight")===i,o=t.getLastMatchingPosition(n,{direction:"backward"}),r=t.getLastMatchingPosition(n);a=[e.model.createRange(o,r)],s==i&&(s=null)}}else for(const t of r.getRanges())s?a.push(t):a.push(..._r("highlight",t,e.model));e.model.change((()=>{for(const e of a)t.markInlineFormat(e,{commandName:"highlight",commandParams:[{value:s}]})}))}));const{t:n}=e.locale;t._descriptionFactory.registerDescriptionCallback((t=>{const{type:o,data:r}=t;if("formatInline"==o&&r&&"highlight"==r.commandName){const t=r.commandParams[0].value;if(t){const o=e.config.get("highlight.options").find((e=>e.model==t)),r=e.locale._t(o.title).toLowerCase();return{type:"format",content:n("*Set highlight:* %0",r),color:{value:o.color,title:o.title}}}return{type:"format",content:n("*Remove highlight*",n({string:"highlight",id:"FORMAT_HIGHLIGHT"}))}}}))}}var ti=n(152),ni={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};mr()(ti.Z,ni);ti.Z.locals;class oi extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("HorizontalLineEditing"))return;e.plugins.get("TrackChangesEditing").enableCommand("horizontalLine");const t=e.plugins.get("TrackChangesEditing"),{t:n}=e.locale;t._descriptionFactory.registerElementLabel("horizontalLine",(e=>n({string:"horizontal line",plural:"%0 horizontal lines",id:"ELEMENT_HORIZONTAL_LINE"},e))),e.conversion.for("dataDowncast").elementToStructure({model:"horizontalLine",view:(e,{writer:t,options:n})=>{if(!n.showSuggestionHighlights)return;const o=t.createContainerElement("div"),r=t.createEmptyElement("hr");return t.addClass("ck-horizontal-line",o),t.insert(t.createPositionAt(o,0),r),o},converterPriority:"high"})}}var ri=n(413),ii={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};mr()(ri.Z,ii);ri.Z.locals;class si extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("ImageEditing"))return;const n=e.plugins.get("TrackChangesEditing"),o=e.plugins.get("ImageUtils"),r={},{t:i}=e.locale;if(n.enableCommand("insertImage"),n._descriptionFactory.registerElementLabel("imageBlock",(e=>i({string:"image",plural:"%0 images",id:"ELEMENT_IMAGE"},e))),n._descriptionFactory.registerElementLabel("imageInline",(e=>i({string:"image",plural:"%0 images",id:"ELEMENT_INLINE_IMAGE"},e))),n._descriptionFactory.registerElementLabel("caption",i({string:"caption",id:"ELEMENT_CAPTION"})),e.plugins.has("ImageUploadEditing")&&n.enableCommand("uploadImage"),e.plugins.has("ImageBlockEditing")&&e.plugins.has("ImageInlineEditing")&&(n.enableCommand("imageTypeInline",((t,r)=>{const i=o.getClosestSelectedImageElement(e.model.document.selection);e.model.change((()=>{n.markBlockFormat(i,{commandName:"imageTypeInline",commandParams:[r]},[],"convertBlockImageToInline")}))})),n.enableCommand("imageTypeBlock",((t,r)=>{e.model.change((i=>{let a=o.getClosestSelectedImageElement(e.model.document.selection),c=i.createRangeOn(a);const l=s.LivePosition.fromPosition(c.start,"toPrevious"),g=s.LivePosition.fromPosition(c.end,"toNext");n.forceDefaultExecution((()=>t(r))),a=o.getClosestSelectedImageElement(e.model.document.selection),c=i.createRangeOn(a);const u=i.createRange(l,g);l.detach(),g.detach(),n.markBlockFormat(a,{commandName:"imageTypeInline"},[],"convertInlineImageToBlock"),u.start.isBefore(c.start)&&n.markInsertion(i.createRange(u.start,c.start),"convertInlineImageToBlock"),c.end.isBefore(u.end)&&n.markInsertion(i.createRange(c.end,u.end),"convertInlineImageToBlock")}))})),n._suggestionFactory.registerCustomCallback("formatBlock","convertInlineImageToBlock","join",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","convertInlineImageToBlock","accept",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","convertInlineImageToBlock","discard",n._suggestionFactory.getSuggestionCallback("formatBlock","","accept")),n._suggestionFactory.registerCustomCallback("insertion","convertInlineImageToBlock","join",(()=>{})),n._suggestionFactory.registerCustomCallback("insertion","convertInlineImageToBlock","discard",(([t])=>{const o=n._suggestionFactory.getSuggestionCallback("insertion","","discard");let r=t.start,i=t.end;const s=e.model.schema.getNearestSelectionRange(r,"backward"),a=e.model.schema.getNearestSelectionRange(i,"forward");s.isCollapsed&&(r=s.start),a.isCollapsed&&(i=a.end),o([e.model.createRange(r,i)])})),n._suggestionFactory.registerCustomCallback("formatBlock","convertInlineImageToBlock","chain",l),n._suggestionFactory.registerCustomCallback("insertion","convertInlineImageToBlock","chain",l)),e.plugins.has("ImageCaptionEditing")&&(n.enableCommand("toggleImageCaption",((t,r)=>{const i=e.plugins.get("ImageCaptionUtils");let s=o.getClosestSelectedImageElement(e.model.document.selection),a=i.getCaptionFromImageModelElement(s);e.model.change((()=>{if(a)return void n.markDeletion(e.model.createRangeOn(a));const c=o.isBlockImage(s);t(r),s=o.getClosestSelectedImageElement(e.model.document.selection),a=i.getCaptionFromImageModelElement(s),n.markInsertion(e.model.createRangeOn(a),c?null:"imageCaption")}))})),n._suggestionFactory.registerCustomCallback("insertion","imageCaption","chain",l)),e.plugins.has("ImageStyleEditing")){n.enableCommand("imageStyle",((r,i)=>{const s=e.plugins.get("Users").me,a=e.commands.get("imageStyle");let c=o.getClosestSelectedImageElement(e.model.document.selection),l=e.model.createRangeOn(c),g=a.value;if(g==i.value)return;const u={commandName:"imageStyle",commandParams:[i],formatGroupId:(0,t.uid)()};e.model.change((()=>{if(n.getSuggestions().filter((e=>e.isInContent&&s==e.author&&("formatBlock"==e.type||"formatInline"==e.type)&&("imageStylePreApply"==e.subType||"imageStylePostApply"==e.subType)&&e.getFirstRange().isEqual(l))).forEach((e=>n.discardSuggestion(e.head))),c=o.getClosestSelectedImageElement(e.model.document.selection),l=e.model.createRangeOn(c),a.refresh(),e.commands.get("imageTypeInline").refresh(),e.commands.get("imageTypeBlock").refresh(),g=a.value,g!=i.value)return o.isInlineImage(c)&&a.shouldConvertImageType(i.value,c)?(r(i),c=o.getClosestSelectedImageElement(e.model.document.selection),void n.markBlockFormat(c,{...u,commandReversedParams:[{value:g||null}]},[],"imageStylePreApply")):void(o.isBlockImage(c)?n.markBlockFormat(c,u,[],"imageStylePostApply"):n.markInlineFormat(l,u,"imageStylePostApply"))}))}));for(const t of e.plugins.get("ImageStyleEditing").normalizedStyles)r[t.name]=t.title.toLowerCase();n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePreApply","join",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePostApply","join",(()=>{})),n._suggestionFactory.registerCustomCallback("formatInline","imageStylePostApply","join",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePreApply","accept",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePreApply","discard",((e,t)=>{n._suggestionFactory.getSuggestionCallback("formatBlock","","accept")(e,{commandName:t.commandName,commandParams:t.commandReversedParams})})),n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePreApply","chain",l)}const a=[{type:"formatBlock",subType:"imageStylePreApply"},{type:"insertion",subType:"imageCaption"},{type:"formatBlock",subType:"convertInlineImageToBlock"},{type:"insertion",subType:"convertInlineImageToBlock"}];function c(e,t){const r=a.findIndex((({type:t,subType:n})=>e.type==t&&e.subType==n)),i=a.findIndex((({type:e,subType:n})=>t.type==e&&t.subType==n));if(r<0||i<0)return!1;const s=e.getFirstRange(),c=t.getFirstRange();if((0==r||1==r)&&2==i&&s.isIntersecting(c))return!0;if(2==r&&3==i){const e=n._findSuggestions(s,"insertion").filter((({suggestion:e,meta:t})=>t.isOwn&&"convertInlineImageToBlock"==e.subType));if(e.length>1&&c.end.isEqual(s.start))return!0;if(1==e.length&&(s.start.isEqual(c.end)||s.end.isEqual(c.start)))return!0}if(3==r&&3==i&&s.start.isBefore(c.start)){const e=s.end.nodeAfter,t=c.start.nodeBefore;return o.isBlockImage(e)&&e===t}return!1}function l(e,t){return c(e,t)?[e,t]:c(t,e)?[t,e]:null}e.model.document.registerPostFixer((()=>{let t=!1;const r=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:e,data:i}of r){const{group:r,type:s,subType:a,id:c}=n._splitMarkerName(e);if("suggestion"==r&&n.hasSuggestion(c)){if("formatBlock"==s&&("imageStylePreApply"==a||"imageStylePostApply"==a)){const e=n.getSuggestion(c);if(i.newRange){const r=e.getFirstRange().getContainedElement();if(o.isBlockImage(r))continue;n.discardSuggestion(e),t=!0}}if("insertion"==s&&"imageCaption"==a&&!i.newRange){const e=n.getSuggestion(c);e.next&&e.next.isInContent&&(n.discardSuggestion(e.next),t=!0)}}}return t})),e.plugins.has("ImageResize")&&n.enableCommand("resizeImage",((t,r)=>{const i=o.getClosestSelectedImageElement(e.model.document.selection);i.getAttribute("width")!=r.width&&e.model.change((()=>{n.markBlockFormat(i,{commandName:"resizeImage",commandParams:[r]})}))})),e.plugins.has("ImageTextAlternativeEditing")&&n.enableCommand("imageTextAlternative",((t,r)=>{const i=o.getClosestSelectedImageElement(e.model.document.selection);(i.hasAttribute("alt")?i.getAttribute("alt"):"")!=r.newValue&&e.model.change((()=>{n.markBlockFormat(i,{commandName:"imageTextAlternative",commandParams:[r]})}))})),n._descriptionFactory.registerDescriptionCallback((e=>{if(a.find((({type:t,subType:n})=>e.type==t&&e.subType==n)))return e.previous?{}:void 0})),n._descriptionFactory.registerDescriptionCallback((e=>{if("insertion"==e.type||"deletion"==e.type){const t=e.getContainedElement();if(t&&t.is("element","caption"))return{type:"insertion"==e.type?"addObject":"removeObject",name:t.name,quantity:1}}})),n._descriptionFactory.registerDescriptionCallback((e=>"formatBlock"==e.type&&"convertInlineImageToBlock"==e.subType?{type:"format",content:"Inline image to block image"}:"formatBlock"==e.type&&"convertBlockImageToInline"==e.subType?{type:"format",content:"Block image to inline image"}:void 0)),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t){if("imageStyle"==t.commandName){const e=t.commandParams[0].value;return n="side"===e?i({string:"side image",id:"FORMAT_SIDE_IMAGE"}):r[e]||e,{type:"format",content:i("*Format:* %0",n)}}if("imageTextAlternative"==t.commandName){const e=t.commandParams[0].newValue;return e?{type:"format",content:i("*Set image text alternative:* %0",'"'+e+'"')}:{type:"format",content:i("*Remove image text alternative*")}}if("resizeImage"==t.commandName){const e=t.commandParams[0].width;return e?{type:"format",content:i("*Set image width:* %0",e)}:{type:"format",content:i("*Reset image width*")}}}var n}))}}class ai extends e.Plugin{afterInit(){const e=this.editor,t=e.plugins.get("TrackChangesEditing");e.plugins.has("IndentEditing")&&(t.enableCommand("indent"),t.enableCommand("outdent"));const{t:n}=e.locale;if(e.plugins.has("IndentBlock")){for(const n of["indentBlock","outdentBlock"])t.enableCommand(n,(()=>{const o=Array.from(this.editor.model.document.selection.getSelectedBlocks()).filter((e=>this.editor.model.schema.checkAttribute(e,"blockIndent")));e.model.change((()=>{for(const e of o)t.markBlockFormat(e,{commandName:n,commandParams:[{value:""}],formatGroupId:"indentBlock"})}))}));t._descriptionFactory.registerDescriptionCallback((e=>{const{data:o}=e;if(!o)return;if("indentBlock"!=o.commandName&&"outdentBlock"!=o.commandName)return;const r=e.getItems()[0],i=t._descriptionFactory.getItemLabel(r.name);return"indentBlock"==o.commandName?{type:"format",content:n("*Indent:* %0",i)}:"outdentBlock"==o.commandName?{type:"format",content:n("*Outdent:* %0",i)}:void 0}))}}}var ci,li,gi=["requires","TrackChangesEditing","get","enableCommand","editor","plugins"];ci=gi,li=473,function(e){for(;--e;)ci.push(ci.shift())}(++li);var ui=function(e,t){return gi[e-=0]};class di extends e.Plugin{static get[ui("0x1")](){return[jr.Input]}init(){this[ui("0x5")][ui("0x0")][ui("0x3")](ui("0x2"))[ui("0x4")]("input")}}class mi extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("LinkEditing"))return;const t=e.plugins.get("TrackChangesEditing");t.enableCommand("link",((n,o)=>{const r=e.model.document.selection;let i=[];if(r.isCollapsed){if(!r.hasAttribute("linkHref"))return void n(o);{const t=(0,jr.findAttributeRange)(r.getFirstPosition(),"linkHref",r.getAttribute("linkHref"),e.model);i=[t]}}else i=Array.from(r.getRanges());e.model.change((()=>{for(const e of i)t.markInlineFormat(e,{commandName:"link",commandParams:[o]})}))})),t.enableCommand("unlink",(()=>{const n=this.editor.model,o=n.document.selection;n.change((()=>{let n=[];n=o.isCollapsed?[(0,jr.findAttributeRange)(o.getFirstPosition(),"linkHref",o.getAttribute("linkHref"),e.model)]:_r("linkHref",o.getFirstRange(),e.model);for(const e of n)t.markInlineFormat(e,{commandName:"unlink",commandParams:[]})}))})),t._descriptionFactory.registerDescriptionCallback((t=>{const{data:n}=t,{t:o}=e.locale;if(n)return"link"==n.commandName?{type:"format",content:o("*Set link:* %0",'"'+n.commandParams[0]+'"')}:"unlink"==n.commandName?{type:"format",content:o("*Remove link*")}:void 0}))}}class fi extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const t=e.plugins.get("TrackChangesEditing"),n=e.plugins.has("TodoListEditing");function o(n){return()=>{const o=e.model.document.selection,r=e.commands.get(n);if(r.value)return void e.execute("paragraph",{});const i=n.slice(0,-4),s=function(e,t,n){let o=Array.from(e).filter((e=>{return t=e,(o=n).checkChild(t.parent,"listItem")&&!o.isObject(t);var t,o}));o=o.filter((e=>!e.is("element","listItem")||e.getAttribute("listType")!=t));const r=new Set;for(const e of o)e.is("element","listItem")?r.add(hi(e)):r.add(e);return Array.from(r)}(o.getSelectedBlocks(),i,e.model.schema);e.model.change((()=>{for(const e of s)t.markBlockFormat(e,{commandName:n,commandParams:[{forceValue:!r.value}],formatGroupId:"blockName"},pi(e))}))}}function r(n){return()=>{const o=function(e){const t=(e=Array.from(e)).findIndex((e=>"listItem"!=e.name));return t>-1&&(e=e.slice(0,t)),e}(e.model.document.selection.getSelectedBlocks()),r=e.model.createRange(e.model.createPositionAt(o[0],"before"),e.model.createPositionAt(o[o.length-1],"end"));e.model.change((()=>{t.markBlockFormat(r,{commandName:n,commandParams:[],formatGroupId:"listIndent"},function(e){const t=new Set;for(const n of e){let e=n.nextSibling;for(;e&&e.getAttribute("listIndent")>n.getAttribute("listIndent");)t.add(e),e=e.nextSibling}return Array.from(t)}(o))}))}}t.enableCommand("numberedList",o("numberedList")),t.enableCommand("bulletedList",o("bulletedList")),n&&t.enableCommand("todoList",o("todoList")),t.enableCommand("indentList",r("indentList")),t.enableCommand("outdentList",r("outdentList")),n&&t.enableCommand("checkTodoList",(()=>{const n=e.commands.get("checkTodoList"),o=Array.from(n._selectedElements);o.filter((e=>e.getAttribute("todoListChecked")!=n.value)),e.model.change((()=>{for(const e of o)t.markBlockFormat(e,{commandName:"checkTodoList",commandParams:[{forceValue:!n.value}]})}))}));const{t:i}=e.locale;t._descriptionFactory.registerElementLabel("listItem",(e=>i({string:"list item",plural:"%0 list items",id:"ELEMENT_LIST_ITEM"},e))),t._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t){if("numberedList"==t.commandName||"bulletedList"==t.commandName||"todoList"==t.commandName)switch(t.commandName.replace("List","")){case"bulleted":return n(i({string:"bulleted list",id:"ELEMENT_BULLETED_LIST"}));case"numbered":return n(i({string:"numbered list",id:"ELEMENT_NUMBERED_LIST"}));case"todo":return n(i({string:"to-do list",id:"ELEMENT_TODO_LIST"}))}if("indentList"==t.commandName)return{type:"format",content:i("*Indent:* %0",i({string:"list item",id:"ELEMENT_LIST_ITEM"}))};if("outdentList"==t.commandName)return{type:"format",content:i("*Outdent:* %0",i({string:"list item",id:"ELEMENT_LIST_ITEM"}))};if("checkTodoList"==t.commandName)return t.commandParams[0].forceValue?{type:"format",content:i("*Check item*")}:{type:"format",content:i("*Uncheck item*")}}function n(e){return{type:"format",content:i("*Change to:* %0",e)}}}))}}function hi(e){const t=e.getAttribute("listIndent");if(0==t)return e;let n=e;for(;e.previousSibling&&e.previousSibling.is("element","listItem");){const o=e.previousSibling.getAttribute("listIndent");if(o==t)n=e.previousSibling;else if(o<t)break;e=e.previousSibling}return n}function pi(e){const t=[];if(e.is("element","listItem")&&e.getAttribute("listIndent")>0){let n=e.nextSibling;for(;n&&"listItem"==n.name&&n.getAttribute("listIndent")==e.getAttribute("listIndent");)t.push(n),n=n.nextSibling}return t}var ki=n(943),bi={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};mr()(ki.Z,bi);ki.Z.locals;class xi extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("MediaEmbedEditing"))return;const t=e.plugins.get("TrackChangesEditing"),{t:n}=e.locale;t.enableCommand("mediaEmbed"),t._descriptionFactory.registerElementLabel("media",(e=>n({string:"media item",plural:"%0 media items",id:"ELEMENT_MEDIA"},e))),e.conversion.for("dataDowncast").elementToElement({model:"media",view:(e,{writer:t,options:n})=>{if(n.showSuggestionHighlights)return t.createEmptyElement("div")},converterPriority:"high"}),e.data.downcastDispatcher.on("attribute:url:media",((e,t,n)=>{n.options.showSuggestionHighlights&&e.stop()}),{priority:"high"})}}const yi=["MentionEditing","mention","get","plugins","has","afterInit"];var vi,Ci;vi=yi,Ci=336,function(e){for(;--e;)vi.push(vi.shift())}(++Ci);const _i=function(e,t){return yi[e-=0]};class Ei extends e.Plugin{[_i("0x5")](){const e=this.editor;e[_i("0x3")][_i("0x4")](_i("0x0"))&&e.plugins[_i("0x2")]("TrackChangesEditing").enableCommand(_i("0x1"))}}var Ti=n(137),wi={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};mr()(Ti.Z,wi);Ti.Z.locals;class Si extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("PageBreakEditing"))return;e.plugins.get("TrackChangesEditing").enableCommand("pageBreak");const t=e.plugins.get("TrackChangesEditing"),{t:n}=e.locale;t._descriptionFactory.registerElementLabel("pageBreak",(e=>n({string:"page break",plural:"%0 page breaks",id:"ELEMENT_PAGE_BREAK"},e)))}}class Ri extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("Paragraph"))return;const{t}=e.locale,n=e.plugins.get("TrackChangesEditing");n._descriptionFactory.registerElementLabel("paragraph",(e=>t({string:"paragraph",plural:"%0 paragraphs",id:"ELEMENT_PARAGRAPH"},e))),n.enableCommand("paragraph",((t,o={})=>{const r=e.model.document,i=o.selection||r.selection,s=Array.from(i.getSelectedBlocks()).filter((e=>{return t=e,(n=this.editor.model.schema).checkChild(t.parent,"paragraph")&&!n.isObject(t)&&"paragraph"!=t.name;var t,n}));e.model.change((()=>{for(const e of s)n.markBlockFormat(e,{commandName:"paragraph",commandParams:[],formatGroupId:"blockName"},Er(e))}))})),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:n}=e;if(n&&"paragraph"==n.commandName)return{type:"format",content:t("*Change to:* %0",t({string:"paragraph",plural:"%0 paragraphs",id:"ELEMENT_PARAGRAPH"}))}})),n.enableCommand("insertParagraph"),e.editing.downcastDispatcher.on("addMarker:suggestion:insertion",Ai(e),{priority:"highest"}),e.data.downcastDispatcher.on("addMarker:suggestion:insertion",((t,n,o)=>{o.options.showSuggestionHighlights&&Ai(e,{showActiveMarker:!1})(t,n,o)}),{priority:"highest"});const o=n._descriptionFactory;o.registerDescriptionCallback((n=>{if("insertion"!==n.type)return;const{start:r,end:i}=n.getFirstRange();if(!r.isTouching(i)||!r.nodeAfter)return;const s=e.model.schema,a=r.nodeAfter;return s.isBlock(a)&&!s.isLimit(a)&&s.checkChild(a,"$text")?{type:"insertion",content:t("*Insert:* %0",o.getItemLabel(a.name,1))}:void 0}))}}function Ai(e,{showActiveMarker:t=!0}={}){return(n,o,r)=>{const i=e.plugins.get("TrackChangesEditing"),s=o.markerRange.start,a=o.markerRange.end,c=e.model.schema;if(!s.isTouching(a)||!s.nodeAfter)return;const l=s.nodeAfter;if(c.isBlock(l)&&!c.isLimit(l)&&c.checkChild(l,"$text")){if(!r.consumable.consume(o.markerRange,n.name))return;const e=r.writer.createUIElement("span",{class:"ck-suggestion-marker-split"}),s=r.mapper.toViewPosition(a);t&&i.activeMarkers.includes(o.markerName)&&r.writer.addClass("ck-suggestion-marker--active",e),r.writer.insert(s,e),r.mapper.bindElementToMarker(e,o.markerName)}}}class Ii extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("RemoveFormatEditing"))return;const t=e.plugins.get("TrackChangesEditing");t.enableCommand("removeFormat",(n=>{const o=e.model.document.selection;o.isCollapsed?n():e.model.change((()=>{const n=Array.from(o.getRanges());for(const o of n)for(const n of o.getItems())Mi(n,e.model.schema)&&t.markInlineFormat(e.model.createRangeOn(n),{commandName:"removeFormat",commandParams:[]})}))}));const{t:n}=e.locale;t._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t&&"removeFormat"==t.commandName)return{type:"format",content:n("*Remove all formatting*")}}))}}function Mi(e,t){for(const[n]of e.getAttributes()){const e=t.getAttributeProperties(n);if(e&&e.isFormatting)return!0}return!1}const Ni=["discardAllSuggestions","goToPreviousRestrictedEditingException","acceptAllSuggestions","discardSuggestion","discardSelectedSuggestions","get","goToNextRestrictedEditingException","trackChanges","enableCommand","plugins","RestrictedEditingModeEditing","editor"];var Fi,Pi;Fi=Ni,Pi=228,function(e){for(;--e;)Fi.push(Fi.shift())}(++Pi);const Oi=function(e,t){return Ni[e-=0]};class Li extends e.Plugin{afterInit(){const e=this[Oi("0xb")];if(!e[Oi("0x9")].has(Oi("0xa")))return;const t=e[Oi("0x9")][Oi("0x5")]("TrackChangesEditing");t.enableCommand(Oi("0x1")),t[Oi("0x8")](Oi("0x6"));const n=e.plugins[Oi("0x5")]("RestrictedEditingModeEditing");n[Oi("0x8")](Oi("0x7")),n.enableCommand("acceptSuggestion"),n[Oi("0x8")](Oi("0x3")),n[Oi("0x8")](Oi("0x2")),n.enableCommand(Oi("0x0")),n[Oi("0x8")]("acceptSelectedSuggestions"),n.enableCommand(Oi("0x4"))}}class Bi extends e.Plugin{static get requires(){return[Gr.ShiftEnter]}init(){const e=this.editor,t=e.plugins.get("TrackChangesEditing"),n=e.t;t.enableCommand("shiftEnter"),e.editing.downcastDispatcher.on("addMarker:suggestion:insertion",ji(e),{priority:"high"}),e.editing.downcastDispatcher.on("addMarker:suggestion:deletion",ji(e),{priority:"high"}),e.data.downcastDispatcher.on("addMarker:suggestion",((t,n,o)=>{o.options.showSuggestionHighlights&&ji(e,{showActiveMarker:!1})(t,n,o)})),t._descriptionFactory.registerElementLabel("softBreak",(e=>n({id:"ELEMENT_LINE_BREAK",string:"line break",plural:"%0 line breaks"},e)))}}function ji(e,{showActiveMarker:t=!0}={}){return(n,o,r)=>{const i=e.plugins.get("TrackChangesEditing");if(!r.consumable.test(o.markerRange,n.name))return;const s=e.model;for(const e of o.markerRange.getItems()){if(!e.is("element","softBreak"))continue;const n="deletion"==o.markerName.split(":")[1]?"merge":"split",a=r.writer.createUIElement("span",{class:"ck-suggestion-marker-"+n}),c=r.mapper.toViewPosition(s.createPositionBefore(e));t&&i.activeMarkers.includes(o.markerName)&&r.writer.addClass("ck-suggestion-marker--active",a),r.writer.insert(c,a),r.mapper.bindElementToMarker(a,o.markerName)}}}class Di extends e.Plugin{afterInit(){const e=this.editor,t=e.model;if(!e.plugins.has("StandardEditingModeEditing"))return;const n=e.plugins.get("TrackChangesEditing"),o="restrictedEditingException",r=e.commands.get(o);n.enableCommand(o,((e,i={})=>{const s=t.document.selection;if(s.isCollapsed)return void e(i);const a=void 0!==i.forceValue?i.forceValue:!r.value;t.change((()=>{const e=Array.from(s.getRanges());for(const r of e){const e=a?[r]:_r(o,r,t);for(const t of e)n.markInlineFormat(t,{commandName:o,commandParams:[{forceValue:a}]})}}))}));const i=e.t;n._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t&&t.commandName==o)return t.commandParams[0].forceValue?{type:"format",content:i({string:"*Enable in restricted editing mode*",id:"FORMAT_RESTRICTED_ENABLED"})}:{type:"format",content:i({string:"*Disable in restricted editing mode*",id:"FORMAT_RESTRICTED_DISABLED"})}}))}}var Ui=n(399),Hi={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};mr()(Ui.Z,Hi);Ui.Z.locals;class Vi extends e.Plugin{constructor(e){super(e),this._tablePostFixingSubtypes=["tableRow","tableColumn"]}afterInit(){const e=this.editor,t=e.model.document.selection;if(!e.plugins.has("TableEditing"))return;const{t:n}=e.locale,o=e.plugins.get("TrackChangesEditing"),r=e.plugins.get("TableUtils");o._descriptionFactory.registerElementLabel("table",(e=>n({string:"table",plural:"%0 tables",id:"ELEMENT_TABLE"},e))),this._setupColumnsRowsFixing(),o.enableCommand("insertTable"),o.enableCommand("selectTableRow"),o.enableCommand("selectTableColumn");for(const n of["insertTableRowAbove","insertTableRowBelow"]){const i=e.commands.get(n);o.enableCommand(n,(n=>{e.model.change((e=>{n();const s="above"===i.order,a=r.getSelectionAffectedTableCells(t),c=r.getRowIndexes(a),l=s?c.first-1:c.last+1,g=a[0].findAncestor("table"),u=r.createTableWalker(g,{startRow:l,endRow:l}),d=Array.from(u).map((t=>e.createRangeOn(t.cell)));o.markMultiRangeInsertion(d,"tableRow")}))}))}for(const n of["insertTableColumnLeft","insertTableColumnRight"]){const i=e.commands.get(n);o.enableCommand(n,(n=>{e.model.change((e=>{n();const s="left"===i.order,a=r.getSelectionAffectedTableCells(t),c=r.getColumnIndexes(a),l=s?c.first-1:c.last+1,g=a[0].findAncestor("table"),u=r.createTableWalker(g,{startRow:0,column:l,includeAllSlots:!1}),d=Array.from(u).map((t=>e.createRangeOn(t.cell)));o.markMultiRangeInsertion(d,"tableColumn")}))}))}for(const n of["removeTableRow","removeTableColumn"]){const i=n.substr(11),s=i.toLowerCase(),a=s.substr(0,3)+"span",c="table"+i,l="min"+i,g="max"+i;o.enableCommand(n,(()=>{e.model.change((e=>{const i=r.getSelectionAffectedTableCells(t),u=i[0].findAncestor("table");let d;if("removeTableRow"==n){const e=r.getRowIndexes(i);d={startRow:e.first,endRow:e.last,includeAllSlots:!0}}else{const e=r.getColumnIndexes(i);d={startColumn:e.first,endColumn:e.last,includeAllSlots:!0}}const m=r.createTableWalker(u,d),f=Array.from(m).map((({cell:e})=>e)),h=zi(f.filter((e=>e.hasAttribute(a)))),p=zi(f.filter((e=>!e.hasAttribute(a)))).map((t=>e.createRangeOn(t))),k=o.markMultiRangeDeletion(p,c);if(k&&("tableRow"==k.subType||"tableColumn"==k.subType)){const t=this._getSuggestionCoords(k);for(const n of h){const o=e.createRangeOn(n),i=r.getCellLocation(n),c=n.getAttribute(a)-1,u=t[l],d=t[g];u<=i[s]&&i[s]+c<=d&&k.addRange(o)}}}))}))}function i(n){const o=Array.from(t.getRanges()).map((e=>s.LiveRange.fromRange(e)));e.model.change((t=>{const r=t.batch;n=n.filter((e=>"$graveyard"!=e.root.rootName)),t.setSelection(n),e.commands.get("removeTableRow").refresh(),e.execute("removeTableRow",{forceDefaultExecution:!0}),e.model.enqueueChange((()=>{e.model.enqueueChange(r,(e=>{const t=o.filter((e=>"$graveyard"!=e.root.rootName));t.length>0&&e.setSelection(t);for(const e of o)e.detach()}))}))}))}function c(n){e.model.change((o=>{const r=Array.from(t.getRanges()).map((e=>s.LiveRange.fromRange(e))),i=[];for(const e of n)for(const t of e.getItems({shallow:!0}))i.push(t);for(const t of i)"$graveyard"!=t.root.rootName&&(o.setSelection(o.createPositionAt(t,0)),e.commands.get("removeTableColumn").refresh(),e.execute("removeTableColumn",{forceDefaultExecution:!0}));const a=r.filter((e=>"$graveyard"!=e.root.rootName));a.length>0&&o.setSelection(a);for(const e of r)e.detach()}))}function l(e,t){return t.every((t=>e.some((e=>e.end.isEqual(t.start)||t.end.isEqual(e.start)))))}function g(e,t){return e.some((e=>t.some((t=>e.end.isTouching(t.start)))))}e.data.downcastDispatcher.on("addMarker:suggestion",((e,t,n)=>{if(!n.options.showSuggestionHighlights)return;const o=t.item;if(!o)return;const r=n.mapper.toViewElement(o);function i(e){return Array.isArray(e)?e:[e]}r&&"tableCell"===o.name&&(0,a.setHighlightHandling)(r,n.writer,((e,t,n)=>n.addClass(i(t.classes),e)),((e,t,n)=>n.removeClass(i(t.classes),e)))}),{priority:"highest"}),o._descriptionFactory.registerDescriptionCallback((e=>{if("insertion"!=e.type&&"deletion"!=e.type)return;const t=e.getContainedElement();if(null!=t&&t.is("element","table")){if("insertion"==e.type){const t=e.getItems().filter((e=>e.is("textProxy"))).map((e=>e.data));if(t.length)return{type:"insertion",content:n("*Insert:* %0",n({string:"table *with text* %0",id:"ELEMENT_TABLE_WITH_TEXT"},'"'+t.join(" ")+'"'))}}if("deletion"==e.type){const t=e.getItems().filter((e=>e.is("textProxy"))).map((e=>e.data));if(t.length)return{type:"deletion",content:n("*Remove:* %0",n({string:"table *with text* %0",id:"ELEMENT_TABLE_WITH_TEXT"},'"'+t.join(" ")+'"'))}}}})),o._descriptionFactory.registerDescriptionCallback((e=>{if("tableRow"==e.subType){const t=e.getItems().filter((e=>e.is("textProxy"))).map((e=>e.data)),o=this._getSuggestionCoords(e),r=o.maxRow-o.minRow+1;if("insertion"==e.type)return t.length?{type:"insertion",content:n("*Insert:* %0",n({string:"table row *with text* %1",plural:"%0 table rows *with text* %1",id:"ELEMENT_TABLE_ROW_WITH_TEXT"},[r,'"'+t.join(" ")+'"']))}:{type:"insertion",content:n("*Insert:* %0",n({string:"table row",plural:"%0 table rows",id:"ELEMENT_TABLE_ROW"},r))};if("deletion"==e.type)return t.length?{type:"deletion",content:n("*Remove:* %0",n({string:"table row *with text* %1",plural:"%0 table rows *with text* %1",id:"ELEMENT_TABLE_ROW_WITH_TEXT"},[r,'"'+t.join(" ")+'"']))}:{type:"deletion",content:n("*Remove:* %0",n({string:"table row",plural:"%0 table rows",id:"ELEMENT_TABLE_ROW"},r))}}if("tableColumn"==e.subType){const t=e.getItems().filter((e=>e.is("textProxy"))).map((e=>e.data)),o=this._getSuggestionCoords(e),r=o.maxColumn-o.minColumn+1;if("insertion"==e.type)return t.length?{type:"insertion",content:n("*Insert:* %0",n({string:"table column *with text* %1",plural:"%0 table columns *with text* %1",id:"ELEMENT_TABLE_COLUMN_WITH_TEXT"},[r,'"'+t.join(" ")+'"']))}:{type:"insertion",content:n("*Insert:* %0",n({string:"table column",plural:"%0 table columns",id:"ELEMENT_TABLE_COLUMN"},r))};if("deletion"==e.type)return t.length?{type:"deletion",content:n("*Remove:* %0",n({string:"table column *with text* %1",plural:"%0 table columns *with text* %1",id:"ELEMENT_TABLE_COLUMN_WITH_TEXT"},[r,'"'+t.join(" ")+'"']))}:{type:"deletion",content:n("*Remove:* %0",n({string:"table column",plural:"%0 table columns",id:"ELEMENT_TABLE_COLUMN"},r))}}})),o._suggestionFactory.registerCustomCallback("insertion","tableRow","discard",i),o._suggestionFactory.registerCustomCallback("deletion","tableRow","accept",i),o._suggestionFactory.registerCustomCallback("insertion","tableColumn","discard",c),o._suggestionFactory.registerCustomCallback("deletion","tableColumn","accept",c),o._suggestionFactory.registerCustomCallback("insertion","tableColumn","join",l),o._suggestionFactory.registerCustomCallback("deletion","tableColumn","join",l),o._suggestionFactory.registerCustomCallback("insertion","tableRow","join",g),o._suggestionFactory.registerCustomCallback("deletion","tableRow","join",g)}_acceptFormatSuggestionCallbackFactory(){const e=this.editor,t=e.model.document.selection;return(n,o)=>{e.model.change((r=>{const{commandName:i,commandParams:a}=o;let c=n[0].end.nodeBefore;a&&a[0]&&!1===a[0].forceValue&&(c=n[0].start.nodeAfter);const l=r.createRangeIn(c);if("$graveyard"==l.root.rootName)return;const g=Array.from(t.getRanges()).map((e=>s.LiveRange.fromRange(e)));r.setSelection(l),e.commands.get(i).refresh(),a.push({forceDefaultExecution:!0}),e.execute(i,...a);const u=g.filter((e=>"$graveyard"!=e.root.rootName));u.length>0&&r.setSelection(u);for(const e of g)e.detach()}))}}_getCoordsForCells(e){const t=this.editor.plugins.get("TableUtils");let n=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER;for(const s of e){if("$graveyard"==s.root.rootName)continue;const{row:e,column:a}=t.getCellLocation(s),c=s.hasAttribute("rowspan")?s.getAttribute("rowspan")-1:0,l=s.hasAttribute("colspan")?s.getAttribute("colspan")-1:0;n=e<n?e:n,o=e+c>o?e+c:o,r=a<r?a:r,i=a+l>i?a+l:i}return{minRow:n,maxRow:o,minColumn:r,maxColumn:i}}_setupColumnsRowsFixing(){const e=this.editor,t=e.plugins.get("TrackChangesEditing"),n=e.plugins.get("TableUtils");this._tableSuggestions=new Set,e.model.document.on("change:data",(()=>{const n=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:e,data:o}of n){const{group:n,id:r,subType:i}=t._splitMarkerName(e);if("suggestion"!=n)continue;if(null!=o.oldRange)continue;const s=t.getSuggestion(r);this._tablePostFixingSubtypes.includes(i)&&this._tableSuggestions.add(s)}}),{priority:"low"});const o=(e,t)=>{let o=!1;const r=t.createRangeOn(e),i=e.findAncestor("table"),s=n.getCellLocation(e);for(const t of this._tableSuggestions){const n=t.subType,a=n.startsWith("tablePaste"),c=n.substr(a?10:5),l=c.toLowerCase(),g=l.substr(0,3)+"span",u="min"+c,d="max"+c;if(!t.isInContent)continue;if(i!=t.getFirstRange().start.findAncestor("table"))continue;if(t.isIntersectingWithRange(r))continue;const m=e.hasAttribute(g)?e.getAttribute(g)-1:0,f=this._getSuggestionCoords(t),h=f[u],p=f[d];h<=s[l]&&s[l]+m<=p&&(t.addRange(r),o=!0)}return o};e.model.document.registerPostFixer((t=>{let n=!1;for(const r of e.model.document.differ.getChanges())if("insert"==r.type)if("tableRow"==r.name)for(const e of r.position.nodeAfter.getChildren())n=n||o(e,t);else"tableCell"==r.name&&(n=n||o(r.position.nodeAfter,t));return n}))}_getSuggestionCoords(e){return this._getCoordsForCells(e.getRanges().map((e=>e.start.nodeAfter)))}}function zi(e){return Array.from(new Set(e).values())}class Gi extends e.Plugin{static get requires(){return[Vi]}afterInit(){const e=this.editor,t=e.model.document.selection;if(!e.plugins.has("TableEditing"))return;const{t:n}=e.locale,o=e.plugins.get("TrackChangesEditing"),r=e.plugins.get("TableUtils"),i=e.plugins.get(Vi);i._tablePostFixingSubtypes.push("mergeTableCells"),o.enableCommand("mergeTableCells",(()=>{const t=r.getSelectionAffectedTableCells(e.model.document.selection);e.model.change((()=>{o.markMultiRangeBlockFormat(t,{commandName:"mergeTableCells",commandParams:[]},[],"mergeTableCells")}))})),e.commands.get("mergeTableCells").on("execute",((t,n)=>{e.commands.get("trackChanges").value&&(n.length>0&&n[n.length-1]&&n[n.length-1].forceDefaultExecution||o._isForcedDefaultExecutionBlock||this._areSelectedCellsMergable()||t.stop())}),{priority:"highest"});for(const t of["mergeTableCellUp","mergeTableCellRight","mergeTableCellDown","mergeTableCellLeft"]){const n=e.commands.get(t);o.enableCommand(t,(()=>{const t=e.model.document.selection.getFirstPosition().getAncestors().find((e=>e.is("element","tableCell"))),r=n.value;e.model.change((()=>{o.markMultiRangeBlockFormat([t,r],{commandName:"mergeTableCells",commandParams:[]},[],"mergeTableCells")}))}))}for(const t of["splitTableCellVertically","splitTableCellHorizontally"]){const n=e.commands.get(t);o.enableCommand(t,(()=>{const i=r.getSelectionAffectedTableCells(e.model.document.selection)[0],s=i.findAncestor("table"),{column:a,row:c}=r.getCellLocation(i);let l=[];if("horizontally"==n.direction){const e=r.createTableWalker(s,{startRow:c,endRow:c,includeAllSlots:!0});l=Array.from(e).map((e=>e.cell))}else{const e=r.createTableWalker(s,{column:a,includeAllSlots:!0});l=Array.from(e).map((e=>e.cell))}e.model.change((e=>{o.markBlockFormat(e.createRangeOn(i),{commandName:t,commandParams:[]},l,t)}))}))}o._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t)return"mergeTableCells"==t.commandName?{type:"format",content:n("*Merge cells*")}:void 0})),o._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t)return"splitTableCellVertically"==t.commandName?{type:"format",content:n("*Split cell:* vertically")}:"splitTableCellHorizontally"==t.commandName?{type:"format",content:n("*Split cell:* horizontally")}:void 0}));const a=i._acceptFormatSuggestionCallbackFactory();for(const e of["mergeTableCellUp","mergeTableCellRight","mergeTableCellDown","mergeTableCellLeft"])o._suggestionFactory.registerCustomCallback("formatBlock",e,"accept",a);for(const e of["splitTableCellVertically","splitTableCellHorizontally"])o._suggestionFactory.registerCustomCallback("formatBlock",e,"accept",a);o._suggestionFactory.registerCustomCallback("formatBlock","mergeTableCells","accept",(n=>{e.model.change((o=>{const r=Array.from(t.getRanges()).map((e=>s.LiveRange.fromRange(e)));o.setSelection(n),e.commands.get("mergeTableCells").refresh(),e.execute("mergeTableCells",{forceDefaultExecution:!0});const i=r.filter((e=>"$graveyard"!=e.root.rootName));i.length>0&&o.setSelection(i);for(const e of r)e.detach()}))}));for(const t of["mergeTableCellUp","mergeTableCellDown","mergeTableCellLeft","mergeTableCellRight"]){const n=e.commands.get(t);n.on("set:isEnabled",((t,o,r)=>{if(r){const o=e.model.document.selection.getFirstPosition().getAncestors().find((e=>e.is("element","tableCell")));this._areMergableCells(n.value,o)||(t.return=!1,t.stop())}}),{priority:"low"})}}_areSelectedCellsMergable(){const e=this.editor.commands.get("mergeTableCells"),t=this.editor.plugins.get("TableUtils");if(!e.isEnabled)return!1;const n=t.getSelectionAffectedTableCells(this.editor.model.document.selection);for(const e of n)for(const t of n)if(e!=t&&!this._areMergableCells(e,t))return!1;return!0}_areMergableCells(e,t){const n=this.editor.plugins.get("TrackChangesEditing"),o=this.editor.model.createRangeOn(e),r=this.editor.model.createRangeOn(t),i=new Set,s=new Set;for(const e of n.getSuggestions())if(("insertion"==e.type||"deletion"==e.type||"mergeTableCells"==e.subType)&&e.isInContent)for(const t of e.getRanges())t.containsRange(o,!0)&&i.add(e.type+":"+e.author.id),t.containsRange(r,!0)&&s.add(e.type+":"+e.author.id);if(i.size!=s.size)return!1;for(const e of i)if(!s.has(e))return!1;return!0}}class Wi extends e.Plugin{static get requires(){return[Vi]}afterInit(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const{t}=e.locale,n=e.plugins.get("TrackChangesEditing"),o=e.plugins.get("TableUtils"),r=e.plugins.get(Vi);function i({showActiveMarker:e=!0,setDataAttribute:t=!0}={}){return(r,i,s)=>{const{type:a,id:c}=n._splitMarkerName(i.markerName),l=n.getSuggestion(c);if(!l.data||"setTableColumnHeader"!=l.data.commandName)return;if(i.item)return void r.stop();if(!s.consumable.consume(i.markerRange,r.name))return;const g=i.markerRange.start.nodeAfter,u=i.markerRange.end.nodeBefore,d=g.parent.parent,{column:m}=o.getCellLocation(g),{column:f}=o.getCellLocation(u);for(let r=m;r<=f;r++){const l=o.createTableWalker(d,{column:r,includeAllSlots:!1});for(const o of l){const r=o.cell,l=s.mapper.toViewElement(r);s.writer.addClass("ck-suggestion-marker-"+a,l),t&&s.writer.setAttribute("data-suggestion",c,l),s.mapper.bindElementToMarker(l,i.markerName),e&&(n.activeMarkers.includes(i.markerName)?s.writer.addClass("ck-suggestion-marker--active",l):s.writer.removeClass("ck-suggestion-marker--active",l))}}}}n.enableCommand("setTableRowHeader",((t,r)=>{const i=o.getSelectionAffectedTableCells(e.model.document.selection),s=o.getRowIndexes(i),a=i[0].findAncestor("table"),c=a.getAttribute("headingRows")||0,l=r&&null!==r.forceValue?r.forceValue:!e.commands.get("setTableRowHeader").value,g=l?s.last:s.first,u=a.getChild(g);let d;if(l){const t=a.getChild(c);if(u.index<t.index)return;d=e.model.createRange(e.model.createPositionBefore(t.getChild(0)),e.model.createPositionAfter(u.getChild(u.childCount-1)))}else{const t=a.getChild(c-1);if(!t)return;d=e.model.createRange(e.model.createPositionBefore(u.getChild(0)),e.model.createPositionAfter(t.getChild(t.childCount-1)))}e.model.change((()=>{n.markBlockFormat(d,{commandName:"setTableRowHeader",commandParams:[{forceValue:l}]},[],"setTableRowHeader")}))})),n.enableCommand("setTableColumnHeader",((t,o)=>{const r=e.plugins.get("TableUtils"),i=r.getSelectionAffectedTableCells(e.model.document.selection),s=r.getColumnIndexes(i),a=i[0].findAncestor("table"),c=a.getAttribute("headingColumns")||0,l=o&&null!==o.forceValue?o.forceValue:!e.commands.get("setTableColumnHeader").value;let g;const u=a.getChild(0),d=l?s.last:s.first,m=r.createTableWalker(a,{startRow:0,column:d,includeAllSlots:!1}),f=Array.from(m)[0].cell;if(l){const t=u.getChild(c);if(f.isBefore(t))return;g=e.model.createRange(e.model.createPositionBefore(t),e.model.createPositionAfter(f))}else{const t=u.getChild(c-1);if(!t)return;g=e.model.createRange(e.model.createPositionBefore(f),e.model.createPositionAfter(t))}e.model.change((()=>{n.markBlockFormat(g,{commandName:"setTableColumnHeader",commandParams:[{forceValue:l}]},[],"setTableColumnHeader")}))})),e.editing.downcastDispatcher.on("addMarker:suggestion",i(),{priority:"highest"}),e.data.downcastDispatcher.on("addMarker:suggestion",((e,t,n)=>{n.options.showSuggestionHighlights&&i({showActiveMarker:!1,setDataAttribute:!1})(e,t,n)}),{priority:"highest"}),e.editing.downcastDispatcher.on("removeMarker:suggestion",((e,t,o)=>{const{type:r,id:i}=n._splitMarkerName(t.markerName),s=n.getSuggestion(i);if(!s.data||"setTableColumnHeader"!=s.data.commandName)return;const a=o.mapper.markerNameToElements(t.markerName);if(a)for(const e of a)o.writer.removeClass("ck-suggestion-marker-"+r,e),o.writer.removeClass("ck-suggestion-marker--active",e),o.writer.removeAttribute("data-suggestion",e),o.mapper.unbindElementFromMarkerName(e,t.markerName)}),{priority:"highest"}),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:n}=e;if(n){if("setTableRowHeader"==n.commandName){const e=n.commandParams[0].forceValue;return o(t(e?{string:"header row",id:"FORMAT_HEADER_ROW"}:{string:"regular row",id:"FORMAT_REGULAR_ROW"}))}if("setTableColumnHeader"==n.commandName){const e=n.commandParams[0].forceValue;return o(t(e?{string:"header column",id:"FORMAT_HEADER_COLUMN"}:{string:"regular column",id:"FORMAT_REGULAR_COLUMN"}))}}function o(e){return{type:"format",content:t("*Format:* %0",e)}}}));const s=r._acceptFormatSuggestionCallbackFactory();n._suggestionFactory.registerCustomCallback("formatBlock","setTableRowHeader","accept",s),n._suggestionFactory.registerCustomCallback("formatBlock","setTableColumnHeader","accept",s)}}const qi=["tableCellBorderWidth","tableCellBorderColor","tableCellBorderStyle","tableCellHorizontalAlignment","tableCellVerticalAlignment","tableCellBackgroundColor","tableCellPadding"],$i=Object.fromEntries(qi.map((e=>[e,null])));class Ki extends e.Plugin{static get requires(){return[Vi]}afterInit(){const e=this.editor;if(!e.plugins.has("TableClipboard"))return;const{t:n}=e.locale,o=e.plugins.get("TrackChangesEditing"),r=e.plugins.get("TableUtils"),i=e.plugins.get(Vi),s=e.plugins.get("TableClipboard");i._tablePostFixingSubtypes.push("tablePasteRow","tablePasteColumn"),e.model.schema.register("tableCellSuggestion",{allowIn:"tableCell",allowContentOf:"tableCell",isLimit:!0}),e.conversion.elementToElement({model:"tableCellSuggestion",view:"suggestion-td"});let a=null;e.model.on("insertContent",((n,i)=>{const[c,l]=i,g=i[i.length-1];g&&g.forceDefaultExecution||o._isForcedDefaultExecutionBlock||this.editor.commands.get("trackChanges").value&&function(e,t,n,o,r){if(t&&!t.is("documentSelection"))return!1;const i=r.getTableIfOnlyTableInContent(e,n);if(!i||!Xi(i,null,o))return!1;const s=o.getSelectionAffectedTableCells(n.document.selection);if(!s.length)return!1;const a=s[0].findAncestor("table"),c=o.getRowIndexes(s),l=o.getColumnIndexes(s),g={startRow:c.first,endRow:c.last,startColumn:l.first,endColumn:l.last};return 1==s.length&&(g.endRow+=o.getRows(i)-1,g.endColumn+=o.getColumns(i)-1),Xi(a,g,o)}(c,l,e.model,r,s)&&(n.stop(),a={cells:[],insertionRanges:[],deletionRanges:[],rowInsertionRanges:[],rowInsertionIndexes:[],columnInsertionRanges:[],columnInsertionIndexes:[]},e.model.change((()=>{e.model.insertContent(i[0],i[1],i[2],i[3],{forceDefaultExecution:!0});const n=(0,t.uid)(),{rowInsertionRanges:r,columnInsertionRanges:s,insertionRanges:c,deletionRanges:l,cells:g}=a;r.length&&o.markMultiRangeInsertion(r,"tablePasteRow",{tablePasteChainId:n}),s.length&&o.markMultiRangeInsertion(s,"tablePasteColumn",{tablePasteChainId:n}),c.length&&o.markMultiRangeInsertion(c,"tablePaste",{tablePasteChainId:n,skipNestingCheck:!0}),l.length&&o.markMultiRangeDeletion(l,"tablePaste",{tablePasteChainId:n,skipNestingCheck:!0});const u=o.markMultiRangeBlockFormat(g.map((({element:e})=>e)),{formatGroupId:(0,t.uid)()},[],"tablePasteCell",{tablePasteChainId:n});if(u){const t=u.getMarkers(),n=[];for(const{element:o,attributes:r}of g){if(!r)continue;const i=e.model.createRangeOn(o),s=t.find((e=>e.getRange().isEqual(i)));s&&n.push([s.name,r])}n.length&&u.setAttribute("markerAttributes",Object.fromEntries(n))}a=null})))}),{priority:t.priorities.high+10}),e.plugins.get("TableClipboard").on("_replaceTableSlotCell",((e,t)=>{const[n,o,,r]=t;if(!a)return;e.stop();const i=n.cell,s=o,c=Zi(i),l=Zi(s);e.return=i;let g=null,u=null;if(l||c)if(c&&!l){r.remove(i.getChild(0));for(const e of Array.from(s.getChildren()))r.insert(e,i,"end");const e=a.rowInsertionIndexes.includes(n.row),t=a.columnInsertionIndexes.includes(n.column);e||t||(g=r.createRangeIn(i))}else l&&!c&&(u=r.createRangeIn(i));else{const e=r.createElement("tableCellSuggestion"),t=r.createElement("tableCellSuggestion");r.wrap(r.createRangeIn(i),t),r.insert(e,i,0);for(const t of Array.from(s.getChildren()))r.insert(t,e,"end");g=r.createRangeOn(e),u=r.createRangeOn(t)}const d=Array.from(s.getAttributes()).filter((([e])=>qi.includes(e)));a.cells.push({element:i,attributes:d.length?Object.fromEntries(d):null}),g&&a.insertionRanges.push(g),u&&a.deletionRanges.push(u)}),{priority:"high"}),r.on("insertColumns",((t,n)=>{const[o,i={}]=n;if(!a)return;const s=i.at||0,c=i.columns||1;a.columnInsertionIndexes=new Array(c).fill(s).map(((e,t)=>e+t));for(const{cell:t}of r.createTableWalker(o,{startColumn:s,endColumn:s+c-1}))a.columnInsertionRanges.push(e.model.createRangeOn(t))}),{priority:"low"}),r.on("insertRows",((t,n)=>{const[o,i={}]=n;if(!a)return;const s=i.at||0,c=i.rows||1;a.rowInsertionIndexes=new Array(c).fill(s).map(((e,t)=>e+t));for(const{cell:t}of r.createTableWalker(o,{startRow:s,endRow:s+c-1}))a.rowInsertionRanges.push(e.model.createRangeOn(t))}),{priority:"low"}),o._descriptionFactory.registerDescriptionCallback((e=>{if(e.subType&&e.subType.startsWith("tablePaste"))return e.previous?{}:{type:"insertion",content:n("*Replace table cells*")}}));const c=()=>{};for(const e of["tablePaste","tablePasteColumn","tablePasteRow","tablePasteCell"])o._suggestionFactory.registerCustomCallback("insertion",e,"join",c),o._suggestionFactory.registerCustomCallback("deletion",e,"join",c);o._suggestionFactory.registerCustomCallback("formatBlock","tablePasteCell","discard",c),o._suggestionFactory.registerCustomCallback("formatBlock","tablePasteCell","accept",((t,n,o)=>{const r=t.map((e=>e.getContainedElement())).filter((e=>e)),i=new Map(r.map((e=>[e,null])));if(a)for(const{element:e,attributes:t}of a.cells)t&&i.set(e,t);else if(o&&o.markerAttributes)for(const[t,n]of Object.entries(o.markerAttributes)){const o=e.model.markers.get(t),r=o?o.getRange().getContainedElement():null;r&&i.set(r,n)}e.model.change((e=>{for(const[t,n]of i)e.setAttributes({...$i,...n},t)}))}));const l=(t,n)=>{o._suggestionFactory.registerCustomCallback(t,"tablePaste",n,((r,i,s)=>{e.model.change((e=>{const a=[];for(const e of r){const t=e.start.nodeAfter;t.is("element","tableCellSuggestion")&&a.push(t)}o._suggestionFactory.getSuggestionCallback(t,null,n)(r,i,s);for(const t of a)"$graveyard"!=t.root.rootName&&e.unwrap(t)}))}))};l("insertion","accept"),l("insertion","discard"),l("deletion","accept"),l("deletion","discard"),o._suggestionFactory.registerCustomCallback("insertion","tablePasteRow","discard",(e=>{const t=e.map((e=>e.getContainedElement())),n=t[0].findAncestor("table"),{minRow:o,maxRow:s}=i._getCoordsForCells(t);r.removeRows(n,{at:o,rows:s-o+1})})),o._suggestionFactory.registerCustomCallback("insertion","tablePasteColumn","discard",(e=>{const t=e.map((e=>e.getContainedElement())),n=t[0].findAncestor("table"),{minColumn:o,maxColumn:s}=i._getCoordsForCells(t);r.removeColumns(n,{at:o,columns:s-o+1})}));const g=(e,t)=>{if(!t.subType||!t.subType.startsWith("tablePaste"))return;const n=t.attributes.tablePasteChainId,r=o.getSuggestions().filter((e=>e.isInContent&&e.attributes&&e.attributes.tablePasteChainId==n));r.length&&t.getAllAdjacentSuggestions().length!=r.length&&r.reduce(((e,t)=>(e.next=t,t.previous=e,t)))};function u(e,{showActiveMarker:t=!0}={}){const{id:n}=o._splitMarkerName(e.markerName),r=["ck-suggestion-marker","ck-suggestion-marker-insertion"],i=o.activeMarkers.includes(e.markerName);return i&&r.push("ck-suggestion-marker--active"),{classes:r,attributes:{"data-suggestion":n},priority:i&&t?3010:3e3}}o.on("suggestionLoaded",g,{priority:"high"}),o.on("suggestionUnloaded",g,{priority:"high"}),e.model.document.registerPostFixer((()=>{let t=!1;const n=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:r,data:i}of n){const{group:n,type:s,id:a}=o._splitMarkerName(r);if("suggestion"!=n||"deletion"!=s||i.oldRange)continue;if(!o.hasSuggestion(a))continue;const c=o.getSuggestion(a).getRanges(),l=e.plugins.get("Users").me;for(const e of o.getSuggestions())if(e.isInContent&&e.author==l&&"formatBlock"==e.type&&"tablePasteCell"==e.subType&&e.getRanges().every((e=>c.some((t=>t.containsRange(e,!0))))))for(const n of e.getAllAdjacentSuggestions())n.isInContent&&(n.discard(),t=!0)}return t})),e.model.document.registerPostFixer((t=>{const n=e.commands.get("redo");if(!n||!n._createdBatches.has(t.batch))return!1;let r=!1;const i=e.plugins.get("Users").me,s=e.model.document.differ.getChanges(),a=Array.from(e.model.document.differ.getChangedMarkers()).filter((({name:e,data:t})=>{const{group:n,subType:r,authorId:s}=o._splitMarkerName(e);return"suggestion"==n&&"tablePaste"==r&&s==i.id&&!t.oldRange}));for(const e of s){if("insert"!=e.type||"tableCellSuggestion"!=e.name||1!=e.length)continue;const n=t.createRange(e.position,e.position.getShiftedBy(1));if(!a.find((({data:e})=>e.newRange.isEqual(n))))for(const{name:e,data:o}of a)if(n.containsRange(o.newRange)){t.updateMarker(e,{range:n}),r=!0;break}}return r})),e.model.document.registerPostFixer((t=>{let n=!1;const r=e.plugins.get("Users").me,i=o.getSuggestions().filter((e=>e.isInContent&&e.author==r)),s=new Set,a=new Set;for(const e of i)if("tablePaste"==e.subType)for(const t of e.getMarkers()){const o=t.getRange().getContainedElement();if(o)if(o.is("element","tableCellSuggestion")&&Zi(o)){e.removeMarker(t.name),s.add(o),n=!0;const r=o.nextSibling,i=o.previousSibling,c=r&&r.is("element","tableCellSuggestion"),l=i&&i.is("element","tableCellSuggestion");c&&!s.has(r)&&a.add(r),l&&!s.has(i)&&a.add(i)}else o.is("element","paragraph")&&o.isEmpty&&(e.removeMarker(t.name),n=!0)}else if("tablePasteCell"==e.subType){if(!e.attributes||!e.attributes.tablePasteChainId)continue;const t=e.attributes.markerAttributes;if(t&&Object.keys(t).length)continue;const o=e.attributes.tablePasteChainId;let r=!0,s=!0;for(const t of i)if(t.subType&&t.subType.startsWith("tablePaste")){if(!t.attributes.tablePasteChainId){s=!1;break}if(t.id!=e.id&&t.attributes.tablePasteChainId==o){r=!1;break}}s&&r&&(e.removeMarkers(),n=!0)}for(const e of s)t.remove(e);for(const e of a)t.unwrap(e);return n})),e.conversion.for("editingDowncast").markerToHighlight({model:"suggestion:formatBlock:tablePasteCell",view:u,converterPriority:"high"}),e.conversion.for("dataDowncast").markerToHighlight({model:"suggestion:formatBlock:tablePasteCell",view:(e,t)=>{if(t.options.showSuggestionHighlights)return u(e,{showActiveMarker:!1})},converterPriority:"high"});const d=e.editing.view;this.listenTo(d.document,"clipboardOutput",((e,t)=>{const n=[];for(const e of d.createRangeIn(t.content).getItems())e.is("element","suggestion-td")&&n.push(e);d.change((e=>{for(const t of n)e.move(e.createRangeIn(t),e.createPositionBefore(t)),e.remove(t)}))}))}}function Zi(e){if(e.isEmpty)return!0;const t=e.getChild(0);return t.is("element","paragraph")&&t.isEmpty}function Xi(e,t={},n){for(const{isAnchor:o,cellHeight:r,cellWidth:i}of n.createTableWalker(e,{includeAllSlots:!0,...t}))if(!o||1!=r||1!=i)return!1;return!0}class Qi extends e.Plugin{afterInit(){const e=this.editor,t=e.t;if(!e.plugins.has("Title"))return;const n=e.plugins.get("TrackChangesEditing");n._descriptionFactory.registerElementLabel("title-content",(()=>t({id:"ELEMENT_TITLE",string:"title"}))),e.model.document.registerPostFixer((t=>{let o=!1;const r=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:i,data:s}of r){const{group:r}=n._splitMarkerName(i);if("suggestion"!==r||!s.newRange)continue;const a=s.newRange,c=a.end.nodeBefore;if(!c||!c.is("element","title-content"))continue;if(!a.start.isTouching(a.end))continue;const l=e.model.schema.getNearestSelectionRange(a.end,"forward");if(l&&l.isCollapsed){const e=t.createRange(a.start,l.start);e.isEqual(a)||(t.updateMarker(i,{range:e}),o=!0)}o||(t.removeMarker(i),o=!0)}return o}))}}const Ji=["afterInit","get","enableCommand","editor","redo","plugins","TrackChangesEditing","UndoEditing"];var Yi,es;Yi=Ji,es=344,function(e){for(;--e;)Yi.push(Yi.shift())}(++es);const ts=function(e,t){return Ji[e-=0]};class ns extends e.Plugin{[ts("0x0")](){const e=this[ts("0x3")],t=e[ts("0x5")][ts("0x1")](ts("0x6"));e[ts("0x5")].has(ts("0x7"))&&(t.enableCommand("undo"),t[ts("0x2")](ts("0x4")))}}const os=["object","charCodeAt","sign","keys","number","sort","isArray"];var rs,is;rs=os,is=205,function(e){for(;--e;)rs.push(rs.shift())}(++is);const ss=function(e,t){return os[e-=0]};function*as(e){e?"boolean"==typeof e?yield 1:Array[ss("0x4")](e)?yield*function*(e){for(const t of e)yield*as(t)}(e):ss("0x5")==typeof e?yield*cs(e):"string"==typeof e?yield*ls(e):ss("0x2")==typeof e&&(yield e):yield 0}function*cs(e){if(yield gs("{"),e){const t=Object[ss("0x1")](e)[ss("0x3")]();for(const n of t){yield*ls(n),yield gs(":");const t=e[n];yield*as(t)}}yield gs("}")}function*ls(e){yield gs('"');for(const t of e)yield gs(t);yield gs('"')}function gs(e){return e[ss("0x6")](0)}function us(e){return(e*=Math[ss("0x0")](e)).toString(36)}class ds extends e.Plugin{static get requires(){return["CommentsRepository",i.Users,e.PendingActions,br,Sr,Rr,Nr,Br,zr,Zr,Qr,Jr,ei,oi,si,ai,di,mi,fi,xi,Ei,Si,Ri,Ii,Li,Bi,Di,Vi,Gi,Wi,Ki,Qi,ns]}static get pluginName(){return"TrackChangesEditing"}constructor(e){function t(e){return e.map((e=>String.fromCharCode(e))).join("")}super(e),this.set("activeMarkers",[]),this.on("change:activeMarkers",((t,n,o,r)=>{this._model.change((()=>{for(const t of[...r,...o])this._model.markers.has(t)&&e.editing.reconvertMarker(t)}))})),this._descriptionFactory=new ur(this.editor.model.schema,this.editor.locale),this._adapter=null,this._suggestionFactory=new ms(this.editor),this._suggestions=new Map,this._commentsRepository=e.plugins.get("CommentsRepository"),this._enabledCommands=new Set,this._model=this.editor.model,this._suggestionState=new WeakMap,this._isForcedDefaultExecutionBlock=!1,this[t([95,101,120,101,99,117,116,101,83,117,103,103,101,115,116,105,111,110])]=t([52,48,52,52,48,54,49,56])}init(){const e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:"suggestion",view:e=>{const{id:t,type:n}=this._splitMarkerName(e.markerName),o=["ck-suggestion-marker","ck-suggestion-marker-"+n];let r=3e3;return this.activeMarkers.includes(e.markerName)&&(o.push("ck-suggestion-marker--active"),r=3010),"deletion"==n&&(r+=5),{classes:o,attributes:{"data-suggestion":t},priority:r}}}),e.conversion.for("dataDowncast").add((t=>{t.on("addMarker:suggestion",((t,n,o)=>{if(!o.options.showSuggestionHighlights)return;const r=n.item;if(!r)return;const i=o.mapper.toViewElement(r);e.model.schema.isObject(r)&&i&&!i.getCustomProperty("widget")&&i.is("containerElement")&&(0,a.toWidget)(i,o.writer)}),{priority:"high"})})),e.conversion.for("dataDowncast").markerToHighlight({model:"suggestion",view:(e,t)=>{if(!t.options.showSuggestionHighlights)return null;const{type:n}=this._splitMarkerName(e.markerName);return{classes:["ck-suggestion-marker","ck-suggestion-marker-"+n],priority:3e3}}});const n=({showActiveMarkers:t=!0}={})=>(n,o,r)=>{if(!o.item)return;if(o.item.is("selection"))return void r.consumable.consume(o.item,n.name);const i=r.mapper.toViewElement(o.item);if(!o.item.is("element")||!e.model.schema.isBlock(o.item)||i.getCustomProperty("addHighlight"))return;const{id:s}=this._splitMarkerName(o.markerName);r.writer.addClass(["ck-suggestion-marker","ck-suggestion-marker-formatBlock"],i),r.writer.setAttribute("data-suggestion",s,i),r.mapper.bindElementToMarker(i,o.markerName),t&&(this.activeMarkers.includes(o.markerName)?r.writer.addClass("ck-suggestion-marker--active",i):r.writer.removeClass("ck-suggestion-marker--active",i));for(const t of e.model.createRangeIn(o.item).getItems())r.consumable.consume(t,n.name);r.consumable.consume(o.item,n.name)};e.conversion.for("dataDowncast").add((e=>{e.on("addMarker:suggestion:formatBlock",((e,t,o)=>{o.options.showSuggestionHighlights&&n({showActiveMarkers:!1})(e,t,o)}),{priority:"highest"})})),e.conversion.for("dataDowncast").markerToData({model:"suggestion",view:(e,t)=>t.options.showSuggestionHighlights?null:{group:"suggestion",name:e.substr("suggestion".length+1)}}),e.conversion.for("upcast").elementToElement({view:{name:"suggestion",attribute:{id:/^\w/,suggestionType:/^\w/}},model:(e,{writer:t})=>{let n="suggestion:"+e.getAttribute("suggestion-type")+":"+e.getAttribute("id");return e.getAttribute("marker-count")&&(n+=":"+e.getAttribute("marker-count")),t.createElement("$marker",{"data-name":n})}}),e.conversion.for("upcast").dataToMarker({view:"suggestion"}),e.conversion.for("editingDowncast").add((e=>{e.on("addMarker:suggestion:formatBlock",n(),{priority:"high"})})),e.conversion.for("editingDowncast").add((e=>{e.on("removeMarker:suggestion:formatBlock",((e,t,n)=>{const o=n.mapper.markerNameToElements(t.markerName);if(o)for(const e of o)e.getCustomProperty("addHighlight")||(n.writer.removeClass(["ck-suggestion-marker","ck-suggestion-marker-formatBlock","ck-suggestion-marker--active"],e),n.writer.removeAttribute("data-suggestion",e),n.mapper.unbindElementFromMarkerName(e,t.markerName))}),{priority:"high"})})),e.model.document.registerPostFixer((t=>{let n=!1;const o=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:s,data:a}of o){const{group:o,type:c,id:l}=this._splitMarkerName(s);if("suggestion"!==o)continue;const g=this._suggestions.get(l);if(null!=a.newRange)if("formatInline"==c&&(n=n||ps(a.newRange,s,t,e.model.schema)),a.newRange.isCollapsed||"$graveyard"==a.newRange.root.rootName||"formatBlock"==c&&!bs(a.newRange)||"deletion"==c&&(hs(i=a.newRange)||(r=i).start.parent==r.end.nodeBefore&&r.start.isAtEnd))t.removeMarker(s),n=!0;else{if(!g||!g.isInContent)continue;n=!!this._joinWithAdjacentSuggestions(g)||n}}var r,i;return n})),e.model.document.registerPostFixer((t=>{let n=!1;for(const o of e.model.document.differ.getChanges()){if("insert"!=o.type)continue;const r=o.position.getShiftedBy(o.length);if(r.isAtEnd)for(const i of this._suggestions.values()){if(i.isMultiRange||!i.isInContent)continue;if("formatBlock"!=i.type)continue;const s=i.getFirstRange();if(s.start.parent!=s.end.parent&&s.end.isEqual(o.position)){const o=e.model.createRange(s.start,r);t.updateMarker(i.getFirstMarker(),{range:o}),n=!0}}}return n})),e.model.markers.on("update:suggestion",((e,t,n)=>{if(null==n){const{id:e}=this._splitMarkerName(t.name),n=this._suggestions.get(e);n&&n.addMarkerName(t.name)}})),e.model.document.on("change:data",(()=>{const t=Array.from(e.model.document.differ.getChangedMarkers());t.sort(((e,t)=>{const n=e.data.oldRange,o=t.data.oldRange;return null===n&&null===o?0:null===n&&null!==o?-1:null!==n&&null===o?1:n.start.isBefore(o.start)?-1:1}));const n=new Set;for(const{name:e,data:o}of t){const{group:t,id:r}=this._splitMarkerName(e);if("suggestion"===t&&(null===o.oldRange&&this._handleNewSuggestionMarker(e),null===o.newRange)){const e=this._suggestions.get(r);e.isInContent?n.add(e):this._removeSuggestion(e)}}for(const{name:e,data:o}of t){const{group:t,id:r}=this._splitMarkerName(e);if("suggestion"!==t)continue;const i=this._suggestions.get(r);null!=o.newRange&&null!=o.oldRange&&(this._refreshSuggestionsChain(i),n.add(i.head))}for(const e of n)this.fire("suggestionChanged",e);n.clear()})),e.model.on("applyOperation",((t,n)=>{const o=n[0];if(!this._suggestions.size)return;if(!o.isDocumentOperation)return;if(o.batch.isUndo||!o.batch.isLocal)return;let r,i;switch(o.type){case"insert":r=e.model.createPositionAt(o.position),i=r.getShiftedBy(o.howMany);break;case"split":r=e.model.createPositionAt(o.splitPosition),i=e.model.createPositionAt(o.moveTargetPosition);break;case"move":r=e.model.createPositionAt(o.targetPosition),i=r.getShiftedBy(o.howMany);break;default:return}const s=e.model.createRange(r,i);e.model.change((()=>{for(const{suggestion:e,meta:t}of this._findSuggestions(s)){if(e.isMultiRange)continue;if("formatInline"==e.type)continue;const n=e.data&&e.data.multipleBlocks;("formatBlock"!=e.type||"split"==o.type&&!n)&&(t.containsRangeInObject||"insertion"==e.type&&t.isOwn||e.getFirstRange().containsRange(s)&&this._breakSuggestionMarker(e,r,i))}}))}),{priority:"lowest"}),e.model.on("deleteContent",((t,n)=>{const o=n[0],r=n[1];if(r&&r.forceDefaultExecution)return;if(this._isForcedDefaultExecutionBlock)return;if(!this.trackChangesCommand.value)return;if(o.isCollapsed)return;const i=e.model.schema,{start:s,end:a}=o.getFirstRange(),c=s.nodeAfter&&i.isObject(s.nodeAfter)?null:i.getNearestSelectionRange(s,"forward"),l=a.nodeBefore&&i.isObject(a.nodeBefore)?null:i.getNearestSelectionRange(a,"backward"),g=e.model.createRange(c?c.start:s,l?l.end:a);e.model.change((t=>{this.markDeletion(g);const n=e.model.schema.getNearestSelectionRange(g.start);o.is("documentSelection")?t.setSelection(n):o.setTo(n)})),t.stop()}),{priority:t.priorities.normal+10}),e.model.on("insertContent",((t,n)=>{const o=n[n.length-1];o&&o.forceDefaultExecution||this._isForcedDefaultExecutionBlock||this.trackChangesCommand.value&&(e.model.change((()=>{let o=e.model.insertContent(n[0],n[1],n[2],n[3],{forceDefaultExecution:!0});if(!o)return;t.return=o.clone();const r=o.end.nodeBefore,i=e.model.schema;r&&i.isBlock(r)&&!i.isObject(r)&&(o=e.model.createRange(o.start,e.model.createPositionAt(r,"end"))),this.markInsertion(o)})),t.stop())}),{priority:"high"}),this.trackChangesCommand=new d(e,this._enabledCommands),this.editor.commands.add("trackChanges",this.trackChangesCommand),this.enableCommand("trackChanges");const o=new k(e,this._suggestions);e.commands.add("acceptSuggestion",o),this.enableCommand("acceptSuggestion");const r=new C(e,this._suggestions);e.commands.add("discardSuggestion",r),this.enableCommand("discardSuggestion"),e.commands.add("acceptAllSuggestions",new N(e,o,this._suggestions)),this.enableCommand("acceptAllSuggestions"),e.commands.add("discardAllSuggestions",new $(e,r,this._suggestions)),this.enableCommand("discardAllSuggestions"),e.commands.add("acceptSelectedSuggestions",new V(e,o,this._suggestions)),this.enableCommand("acceptSelectedSuggestions"),e.commands.add("discardSelectedSuggestions",new J(e,r,this._suggestions)),this.enableCommand("discardSelectedSuggestions");const i=e.plugins.get("CommentsRepository");this.listenTo(i,"addComment",((e,{threadId:t})=>{const n=this._suggestions.get(t);n&&n.commentThread&&1===n.commentThread.length&&this._updateSuggestionData(t,{hasComments:!0})}),{priority:"low"}),this.listenTo(i,"removeComment",((e,{threadId:t})=>{const n=this._suggestions.get(t);n&&n.commentThread&&!n.commentThread.length&&this._updateSuggestionData(t,{hasComments:!1})}),{priority:"low"})}set adapter(e){if(this._adapter)throw new t.CKEditorError("track-changes-adapter-already-set",this);this._adapter=e}get adapter(){return this._adapter}getSuggestions({skipNotAttached:e=!1,toJSON:t=!1}={}){const n=[];for(const t of this._suggestions.values())e&&!t.isInContent||n.push(t);return t?n.map((e=>e.toJSON())):n}getSuggestion(e){const n=this._suggestions.get(e);if(!n)throw new t.CKEditorError("track-changes-suggestion-not-found",this);return n}hasSuggestion(e){return this._suggestions.has(e)}addSuggestionData(e){const{id:t,authorId:n}=e,[o,r]=e.type.split(":"),i=this._suggestions.get(t)||this._createSuggestion(o,r,t,n);switch(this._addThreadToSuggestion(i),this._checkSuggestionCorrectness(i,o,r||null,n),i.createdAt=e.createdAt,e.data&&(i.data=e.data),e.attributes&&(i.attributes=e.attributes),this._adapter&&this._adapter.addSuggestion||(i._saved=!0),this._suggestionState.get(i)){case"notReady":this._suggestionState.set(i,"dataReady");break;case"markerReady":i.isInContent?(this._suggestionState.set(i,"ready"),this.fire("suggestionLoaded",i)):this._suggestionState.set(i,"removed")}return i}acceptSuggestion(e){this.forceDefaultExecution((()=>{this.editor.model.change((()=>{for(const t of e.getAllAdjacentSuggestions())t.accept()}))}))}discardSuggestion(e){this.forceDefaultExecution((()=>{this.editor.model.change((()=>{for(const t of e.getAllAdjacentSuggestions())t.discard()}))}))}enableCommand(e,n){const o=this.editor.commands.get(e);if(!o)throw new t.CKEditorError("track-changes-command-not-found",this,{commandName:e});this._enabledCommands.add(o),n&&o.on("execute",((e,t)=>{this.trackChangesCommand.value&&(this._isForcedDefaultExecutionBlock||t.length>0&&t[t.length-1]&&t[t.length-1].forceDefaultExecution||(n(((...e)=>o.execute(...e,{forceDefaultExecution:!0})),...t),e.stop()))}),{priority:"high"})}forceDefaultExecution(e){let n,o;const r=this._isForcedDefaultExecutionBlock;this._isForcedDefaultExecutionBlock=!0;try{n=e()}catch(e){o=e}return r||(this._isForcedDefaultExecutionBlock=!1),o&&t.CKEditorError.rethrowUnexpectedError(o,this),n}markInsertion(e,n=null,o={}){if(e.isCollapsed)return null;const r=this.editor.plugins.get("Users").me;for(const{suggestion:t,meta:o}of this._findSuggestions(e,"insertion"))if(o.isOwn){if(!o.isNextTo)return t;if(n==t.subType){const n=t.getFirstRange();return n.start.isEqual(e.end)?this._setSuggestionRange(t,this._model.createRange(e.start,n.end)):this._setSuggestionRange(t,this._model.createRange(n.start,e.end)),t}}const i=(0,t.uid)(),s=r.id,a=n?"insertion:"+n:"insertion",c=this._setSuggestionData({id:i,type:a,createdAt:new Date,authorId:s,attributes:o});return this._addSuggestionMarker(a,i,s,e),c}markMultiRangeInsertion(e,n="multi",o={}){const r=this.editor.plugins.get("Users").me,i=this._suggestionFactory.getSuggestionCallback("insertion",n,"join");for(const t of this.getSuggestions())if(t.author.id==r.id&&"insertion"==t.type&&t.subType==n&&(i(t.getRanges(),e)||i(e,t.getRanges()))){for(const n of e)t.addRange(n);return t}for(const t of e)for(const{suggestion:n,meta:o}of this._findSuggestions(t,"insertion")){if(!o.isOwn)continue;let t=!0;for(const o of n.getRanges())for(const n of e)if(!o.containsRange(n)){t=!1;break}if(t)return n}const s=(0,t.uid)(),a=r.id,c="insertion:"+n,l=this._setSuggestionData({id:s,type:c,createdAt:new Date,authorId:a,attributes:o});for(const t of e)this._addSuggestionMarker(c,s,a,t,gr.getMultiRangeId());return l}markInlineFormat(e,n,o=null,r={}){if(o=o||ks(n),e.isCollapsed)return;const i=this.editor.plugins.get("Users").me,s=[];for(const{suggestion:t,meta:n}of this._findSuggestions(e,"insertion"))n.isOwn&&!n.isInsideObject&&s.push(...t.getRanges());const a=function(e,t){const n=[];for(const o of t){const t=e.getIntersection(o);t&&n.push(t)}return n}(e,s),c=function(e,t){const n=[e];for(const e of t){let t=0;for(;t<n.length;){const o=n[t].getDifference(e);n.splice(t,1,...o),t+=o.length}}return n}(e,s);a.length&&this._model.change((()=>{for(const e of a){const t=this._suggestionFactory.getSuggestionCallback("formatInline",o,"accept");this.forceDefaultExecution((()=>t([e],n,r)))}}));for(const e of c){let s=null,a=e.start,c=e.end;for(const{suggestion:t,meta:n}of this._findSuggestions(e,"formatInline")){if(!n.isOwn)continue;if(t.subType!=o)continue;const r=t.getFirstRange();if(r.containsRange(e,!0))return;a=a.isBefore(r.start)?a:r.start,c=c.isAfter(r.end)?c:r.end,s?r.start.isBefore(s.getFirstRange().start)?(s.removeMarkers(),s=t):t.removeMarkers():s=t}const l=this._model.createRange(a,c);if(s)this._setSuggestionRange(s,l);else{const e=(0,t.uid)(),s=i.id;this._setSuggestionData({id:e,type:"formatInline:"+o,data:n,createdAt:new Date,authorId:s,attributes:r}),this._addSuggestionMarker("formatInline:"+o,e,s,l)}}}markBlockFormat(e,n,o=[],r=null,i={}){n.formatGroupId||(n.formatGroupId=n.commandName),n.multipleBlocks=e.is("range"),r=r||ks(n);const s=o.map((e=>xs(e,this._model))),a=e.is("range")?e:xs(e,this._model);s.push(a);let c=!0;for(const e of s)if(!this._rangeIsInLocalUserInsertion(e)){c=!1;break}if(c){const e=this._suggestionFactory.getSuggestionCallback("formatBlock",r,"accept");return void this.forceDefaultExecution((()=>e([a],n,i)))}let l=null,g=a.start,u=a.end;for(const{suggestion:e,meta:t}of this._findSuggestions(a,"formatBlock")){if(!t.isOwn||t.isNextTo||t.containsRangeInObject||t.isInsideObject)continue;if(e.data.formatGroupId!=n.formatGroupId)continue;const o=e.getFirstRange();if(e.subType==r){if(o.containsRange(a,!0))return;g=g.isBefore(o.start)?g:o.start,u=u.isAfter(o.end)?u:o.end,l?o.start.isBefore(l.getFirstRange().start)?(l.removeMarkers(),l=e):e.removeMarkers():l=e}else{const t=a.getIntersection(o);this._cutOutSuggestionMarker(e,t)}}const d=this.editor.plugins.get("Users").me,m=(0,t.uid)(),f=d.id;l?this._setSuggestionRange(l,this._model.createRange(g,u)):(this._setSuggestionData({id:m,type:"formatBlock:"+r,data:n,createdAt:new Date,authorId:f,attributes:i}),this._addSuggestionMarker("formatBlock:"+r,m,f,this._model.createRange(g,u)))}markMultiRangeBlockFormat(e,n,o=[],r=null,i={}){n.formatGroupId||(n.formatGroupId=n.commandName),n.multipleBlocks=!1,r=r||ks(n);const s=o.map((e=>xs(e,this._model))),a=e.map((e=>xs(e,this._model)));s.push(...a);let c=!0;for(const e of s)if(!this._rangeIsInLocalUserInsertion(e)){c=!1;break}if(c){const e=this._suggestionFactory.getSuggestionCallback("formatBlock",r,"accept");return void this.forceDefaultExecution((()=>e(a,n,i)))}const l=this.editor.plugins.get("Users").me;for(const e of this.getSuggestions()){if(e.author.id!=l.id)continue;if("formatBlock"!=e.type||e.data.formatGroupId!=n.formatGroupId)continue;const t=e.subType==r;for(let n=0;n<a.length;n++){const o=a[n];for(const r of e.getMarkers()){const i=r.getRange();if(o.isEqual(i)){t?(a.splice(n,1),n--):e.removeMarker(r.name);break}}}}if(0==a.length)return;const g=this._suggestionFactory.getSuggestionCallback("formatBlock",r,"join");for(const e of this.getSuggestions())if(e.author.id==l.id&&"formatBlock"==e.type&&e.data.formatGroupId==n.formatGroupId&&e.subType==r&&(g(e.getRanges(),a)||g(a,e.getRanges()))){for(const t of a)e.addRange(t);return e}const u=(0,t.uid)(),d=l.id,m="formatBlock:"+r,f=this._setSuggestionData({id:u,type:m,data:n,createdAt:new Date,authorId:d,attributes:i});for(const e of a)this._addSuggestionMarker(m,u,d,e,gr.getMultiRangeId());return f}markDeletion(e,n=null,o={}){if(e.isCollapsed)return null;const r=this.editor.plugins.get("Users").me,i=new s.LiveRange(e.start,e.end);for(const{suggestion:e,meta:t}of this._findSuggestions(i,"insertion"))if(t.isOwn&&!t.isNextTo)if(e.isMultiRange){const t=e.getRanges().filter((e=>"$graveyard"!=e.root.rootName));if(t.every((e=>i.containsRange(e,!0)))&&e.discard(),t.some((e=>e.containsRange(i,!0)))){const e=this._suggestionFactory.getSuggestionCallback("deletion",n,"accept");return this.forceDefaultExecution((()=>e([i],null,o))),null}}else{const t=i.getIntersection(e.getFirstRange());e._onDiscard([t],null,o)}if(i.detach(),i.isCollapsed||"$graveyard"==i.root.rootName)return null;let a=null,c=i.start,l=i.end;for(const{suggestion:e,meta:t}of this._findSuggestions(i,"deletion"))if(t.isOwn)if(e.isMultiRange){let t=!0;for(const n of e.getRanges()){if(n.containsRange(i,!0))return e;i.containsRange(n)||(t=!1)}t&&e.discard()}else{const t=e.getFirstRange();if(t.containsRange(i,!0))return e;c=c.isBefore(t.start)?c:t.start,l=l.isAfter(t.end)?l:t.end,a?t.start.isBefore(a.getFirstRange().start)?(a.removeMarkers(),a=e):e.removeMarkers():a=e}if(a)return this._setSuggestionRange(a,this._model.createRange(c,l)),a;{const e=(0,t.uid)(),i=this._model.createRange(c,l),s=r.id,a=n?"deletion:"+n:"deletion",g=this._setSuggestionData({id:e,type:a,createdAt:new Date,authorId:s,attributes:o});return this._addSuggestionMarker(a,e,s,i),g}}markMultiRangeDeletion(e,n="multi",o={}){const r=this.editor.plugins.get("Users").me,i=e.map((e=>new s.LiveRange(e.start,e.end))),a=new Set;for(const e of i)for(const{suggestion:t,meta:n}of this._findSuggestions(e,"insertion"))n.isOwn&&!n.isNextTo&&a.add(t);for(const t of a)if(t.isMultiRange){const r=t.getRanges();if((!t.attributes||!t.attributes.skipNestingCheck)&&r.every((e=>i.some((t=>t.containsRange(e,!0)))))&&t.discard(),i.every((e=>r.some((t=>t.containsRange(e,!0)))))){const t=this._suggestionFactory.getSuggestionCallback("deletion",n,"accept");return this.forceDefaultExecution((()=>t(e,null,o))),null}}else{const e=t.getFirstRange();if(i.some((t=>t.containsRange(e,!0)))&&t.discard(),i.every((t=>e.containsRange(t,!0)))){const e=this._suggestionFactory.getSuggestionCallback("deletion",n,"accept");return this.forceDefaultExecution((()=>e(i,null,o))),null}}const c=this._suggestionFactory.getSuggestionCallback("deletion",n,"join");let l=null;for(const e of this.getSuggestions())if(e.author.id==r.id&&e.isInContent&&"deletion"==e.type&&e.subType==n&&(c(e.getRanges(),i)||c(i,e.getRanges())))if(l){if(e.commentThread&&e.commentThread.length)continue;for(const t of e.getRanges())l.isIntersectingWithRange(t)||l.addRange(t);e.removeMarkers()}else{l=e;for(const t of i)e.isIntersectingWithRange(t)||e.addRange(t)}if(l)return l;a.clear();for(const e of i)for(const{suggestion:t,meta:n}of this._findSuggestions(e,"deletion"))n.isOwn&&a.add(t);for(const e of a){const t=e.getRanges();if((!o||!o.skipNestingCheck)&&i.every((e=>t.some((t=>t.containsRange(e,!0))))))return e;(!e.attributes||!e.attributes.skipNestingCheck)&&t.every((e=>i.some((t=>t.containsRange(e,!0)))))&&e.discard()}const g=(0,t.uid)(),u=r.id,d="deletion:"+n,m=this._setSuggestionData({id:g,type:d,createdAt:new Date,authorId:u,attributes:o});for(const e of i)e.detach(),e.isCollapsed||"$graveyard"==e.root.rootName||this._addSuggestionMarker(d,g,u,e,gr.getMultiRangeId());return m}_setSuggestionRange(e,t){const n=e.getFirstMarker();this._model.change((e=>{e.updateMarker(n,{range:t})}))}_addThreadToSuggestion(e){const t=e.id,n=this.editor.config.get("collaboration.channelId");this._commentsRepository.hasCommentThread(t)||this._commentsRepository.addCommentThread({channelId:n,threadId:t});const o=this._commentsRepository.getCommentThread(t);o.unbind("isRemovable"),o.isRemovable=!1,e.commentThread=o}_checkSuggestionCorrectness(e,n,o,r){if(e.type!=n||e.subType!=o||e.author.id!=r)throw this.editor.isReadOnly=!0,new t.CKEditorError("track-changes-suggestion-data-mismatch",this)}_cutOutSuggestionMarker(e,n){const o=e.getFirstRange();if(n.isEqual(o))e.removeMarkers();else if(o.containsRange(n)){const r=this._model.createPositionAt(n.start.nodeBefore,"end");this._setSuggestionRange(e,this._model.createRange(o.start,r));const i=(0,t.uid)(),s=e.author.id,a=e.type+":"+e.subType;this._setSuggestionData({id:i,type:a,createdAt:new Date,authorId:s,data:e.data,attributes:e.attributes});const c=this._model.createPositionAt(n.end.parent,"after"),l=this._model.createRange(c,o.end);this._addSuggestionMarker(a,i,s,l)}else if(o.containsPosition(n.start)){const t=this._model.createPositionAt(n.start.nodeBefore,"end");this._setSuggestionRange(e,this._model.createRange(o.start,t))}else{const t=this._model.createPositionAt(n.end.parent,"after");this._setSuggestionRange(e,this._model.createRange(t,o.end))}}_rangeIsInLocalUserInsertion(e){for(const{suggestion:t,meta:n}of this._findSuggestions(e,"insertion")){if(!n.isOwn)continue;const o=t.getRanges();for(const t of o)if(!e.getDifference(t).length)return!0}return!1}_getAuthorFromId(e){const n=this.editor.plugins.get("Users").getUser(e);if(!n)throw new t.CKEditorError("track-changes-user-not-found",this);return n}_createSuggestion(e,t,n,o){const r=this._getAuthorFromId(o),i=this._suggestionFactory.buildSuggestion(e,t,n,r,(e=>this._updateSuggestionData(n,{attributes:e})));return this.listenTo(i,"accept",(()=>{this._updateSuggestionData(n,{state:"accepted"})}),{priority:"high"}),this.listenTo(i,"discard",(()=>{this._updateSuggestionData(n,{state:"rejected"})}),{priority:"high"}),this._suggestions.set(n,i),this._suggestionState.set(i,"notReady"),i}_splitMarkerName(e){const t=e.split(":");return{group:t[0],type:t[1],subType:t.length>=5?t[2]:null,id:t.length<5?t[2]:t[3],authorId:t.length<5?t[3]:t[4],markerCount:6==t.length?t[5]:null}}_breakSuggestionMarker(e,n,o){const r=e.getFirstRange(),i=r.start,s=r.end;this._setSuggestionRange(e,this._model.createRange(i,n));const a=(0,t.uid)(),c=e.author.id,l=e.type+(e.subType?":"+e.subType:"");this._setSuggestionData({id:a,type:l,createdAt:new Date,authorId:c,originalSuggestionId:e.id,data:e.data}),"formatBlock"==e.type&&(o=this._model.createPositionBefore(o.parent)),this._addSuggestionMarker(l,a,c,this._model.createRange(o,s))}_findSuggestions(e,t=null){const n=[],o=this._model.schema,r=this.editor.plugins.get("Users").me;for(const i of this.getSuggestions())if(i.isInContent&&(!t||i.type==t))for(const t of i.getRanges()){const s=e.start.isEqual(t.end)||e.end.isEqual(t.start);if(s||e.getIntersection(t)){const a=e.containsRange(t)&&fs(o,t.start,e),c=t.containsRange(e)&&fs(o,e.start,t);n.push({suggestion:i,meta:{isOwn:r==i.author,isNextTo:s,isInsideObject:a,containsRangeInObject:c}});break}}return n}_addSuggestionMarker(e,t,n,o,r=null){this._model.change((i=>{let s="suggestion:"+e+":"+t+":"+n;r&&(s=s+":"+r),i.addMarker(s,{range:o,usingOperation:!0,affectsData:!0})}))}_removeSuggestion(e){const t=e.previous,n=e.next;e.previous=null,null!=t&&(t.next=null),e.next=null,null!=n&&(n.previous=null),"ready"==this._suggestionState.get(e)&&(this._suggestionState.set(e,"removed"),this.fire("suggestionUnloaded",e,t,n))}_setSuggestionData(e){const t=e.id,n=this.addSuggestionData(e);if(this._adapter&&this._adapter.addSuggestion){const o=this.editor.plugins.get("PendingActions"),r=n.hasComments,i=n.subType?n.type+":"+n.subType:n.type,s=this.editor.locale.t,a=o.add(s({string:"Unsaved change in suggestion.",id:"PENDING_ACTION_SUGGESTION"})),c={id:t,type:i,hasComments:r,data:e.data||null,originalSuggestionId:e.originalSuggestionId||null,attributes:n.attributes};this._adapter.addSuggestion(c).then((e=>{n._saved=!0,o.remove(a),e&&e.createdAt&&(this._suggestions.get(t).createdAt=e.createdAt)}))}return n}_updateSuggestionData(e,t){const n=this.editor.plugins.get("PendingActions"),o=this._suggestions.get(e);if(this._adapter&&this._adapter.updateSuggestion)if(o._saved){const o=this.editor.locale.t,r=n.add(o({string:"Unsaved change in suggestion.",id:"PENDING_ACTION_SUGGESTION"}));this._adapter.updateSuggestion(e,t).then((()=>{n.remove(r)}))}else o.on("change:_saved",(()=>{this._updateSuggestionData(e,t)}))}_getSuggestionData(e){if(!this._adapter||!this._adapter.getSuggestion)throw new t.CKEditorError("track-changes-adapter-missing-getsuggestion",this);return this._adapter.getSuggestion(e)}_handleNewSuggestionMarker(e){const{id:t,type:n,subType:o,authorId:r}=this._splitMarkerName(e),i=this._suggestions.get(t)||this._createSuggestion(n,o,t,r);switch(this._checkSuggestionCorrectness(i,n,o,r),this._suggestionState.get(i)){case"notReady":this._getSuggestionData(t).then((e=>{let n=Promise.resolve();e.hasComments&&(n=this._commentsRepository.fetchCommentThread({channelId:this.editor.config.get("collaboration.channelId"),threadId:t})),n.then((()=>{this.addSuggestionData(e)._saved=!0}))})),this._suggestionState.set(i,"markerReady");break;case"removed":this._updateSuggestionData(t,{state:"open"});case"dataReady":this._suggestionState.set(i,"ready"),this.fire("suggestionLoaded",i);break;case"ready":this.fire("suggestionChanged",i)}i.addMarkerName(e),this._refreshSuggestionsChain(i)}_refreshSuggestionsChain(e){if(e.isMultiRange)return;let t=!0,n=!0;for(const o of this.getSuggestions()){if(o.isMultiRange)continue;if(o==e||!o.isInContent)continue;if(o.author.id!=e.author.id)continue;const r=this._suggestionFactory.getSuggestionCallback(e.type,e.subType,"chain"),i=this._suggestionFactory.getSuggestionCallback(o.type,o.subType,"chain"),s=r(e,o),a=i(e,o);s&&a&&(s[1].commentThread&&s[1].commentThread.length||(s[0].next=s[1],s[1].previous=s[0],s[0]==e?n=!1:t=!1))}e.previous&&t&&(e.previous.next=null,e.previous=null),e.next&&n&&(e.next.previous=null,e.next=null)}_joinWithAdjacentSuggestions(e){for(const t of this._suggestions.values()){if(t==e||!t.isInContent)continue;if(t.type!=e.type||t.author.id!=e.author.id||t.subType!=e.subType)continue;const n=this._suggestionFactory.getSuggestionCallback(e.type,e.subType,"join");if(n(t.getRanges(),e.getRanges())){if(e.commentThread&&e.commentThread.length)continue;return this._joinSuggestions(t,e),!0}if(n(e.getRanges(),t.getRanges())){if(t.commentThread&&t.commentThread.length)continue;return this._joinSuggestions(e,t),!0}}return!1}_joinSuggestions(e,t){if(e.isMultiRange)for(const n of t.getRanges())e.addRange(n);else{const n=t.getFirstRange().end;this._setSuggestionRange(e,this._model.createRange(e.getFirstRange().start,n))}t.removeMarkers()}}(0,t.mix)(ds,t.EmitterMixin);class ms{constructor(e){this._editor=e,this._model=e.model,this._customCallbacks=new Map,this._defaultCallbacks=new Map,this._registerDefaultCallbacks()}buildSuggestion(e,t,n,o,r){return new gr(this._model,{type:e,subType:t,id:n,author:o,onAttributesChange:r,onAccept:(...n)=>this.getSuggestionCallback(e,t,"accept")(...n),onDiscard:(...n)=>this.getSuggestionCallback(e,t,"discard")(...n)})}registerCustomCallback(e,t,n,o){const r=e+":"+t+":"+n;this._customCallbacks.set(r,o)}getSuggestionCallback(e,t,n){const o=e+":"+t+":"+n;return this._customCallbacks.get(o)||this._defaultCallbacks.get(e+":"+n)}_registerDefaultCallbacks(){const e=()=>{},t=e=>{e.sort(((e,t)=>e.start.isBefore(t.start)?1:-1)),this._model.change((t=>{for(const n of e){let e;e=n.end.isAtEnd&&n.end.parent==n.start.nodeAfter?t.createSelection(n.start.nodeAfter,"on"):t.createSelection(n),this._model.deleteContent(e,{forceDefaultExecution:!0,doNotAutoparagraph:!0})}}))},n=(e,t)=>{this._model.change((n=>{const{commandName:o,commandParams:r=[]}=t,i=e[0];if("$graveyard"==i.root.rootName)return;const a=Array.from(this._model.document.selection.getRanges()).map((e=>s.LiveRange.fromRange(e)));hs(i)?n.setSelection(this._model.createRange(i.end)):n.setSelection(i);for(const e of this._editor.commands.commands())e.refresh();r.push({forceDefaultExecution:!0}),this._editor.execute(o,...r);const c=a.filter((e=>"$graveyard"!=e.root.rootName));c.length>0&&n.setSelection(c);for(const e of a)e.detach()}))},o=(e,t)=>1==e.length&&1==t.length&&e[0].end.isEqual(t[0].start),r=(e,t)=>ys(e,t,this._model)?[e,t]:ys(t,e,this._model)?[t,e]:null;this._defaultCallbacks.set("insertion:accept",e),this._defaultCallbacks.set("insertion:discard",t),this._defaultCallbacks.set("insertion:join",o),this._defaultCallbacks.set("insertion:chain",r),this._defaultCallbacks.set("deletion:accept",t),this._defaultCallbacks.set("deletion:discard",e),this._defaultCallbacks.set("deletion:join",o),this._defaultCallbacks.set("deletion:chain",r),this._defaultCallbacks.set("formatInline:accept",n),this._defaultCallbacks.set("formatInline:discard",e),this._defaultCallbacks.set("formatInline:join",o),this._defaultCallbacks.set("formatInline:chain",e),this._defaultCallbacks.set("formatBlock:accept",n),this._defaultCallbacks.set("formatBlock:discard",e),this._defaultCallbacks.set("formatBlock:join",o),this._defaultCallbacks.set("formatBlock:chain",e)}}function fs(e,t,n){for(const o of t.parent.getAncestors({includeSelf:!0,parentFirst:!0})){if(o.root==o)return!1;if(!n.containsItem(o))return!1;if(e.isObject(o)||e.isLimit(o))return!0}}function hs(e){return e.end.parent==e.start.nodeAfter&&e.end.isAtStart}function ps(e,t,n,o){const r=e=>!e.item.is("textProxy")&&!o.isObject(e.item),i=e.start.getLastMatchingPosition(r),s=e.end.getLastMatchingPosition(r,{direction:"backward"});return!(e.start.isEqual(i)&&e.end.isEqual(s)||(i.isBefore(s)?n.updateMarker(t,{range:n.createRange(i,s)}):n.removeMarker(t),0))}function ks(e){return function(e){let t=0,n=0;for(const o of cs(e))t=(t<<5)-t+o,t&=t,[t,n]=[n,t];return us(t)+us(n)}(e)}function bs(e){const t=e.start.nodeAfter;return t&&t.is("element")}function xs(e,t){const n=t.schema.isObject(e)||t.schema.isSelectable(e);return t.createRange(t.createPositionAt(e,"before"),n?t.createPositionAfter(e):t.createPositionAt(e,"end"))}function ys(e,t,n){const o=e.getFirstRange(),r=t.getFirstRange();if(o.end.isEqual(r.start))return!0;if(e.type!=t.type)return!1;if(!o.end.isTouching(r.start))return!1;const i=n.createRange(o.end,r.start).getWalker();for(const e of i)if(["elementStart","elementEnd"].includes(e.type)&&n.schema.isLimit(e.item))return!1;return!0}var vs,Cs,_s=["isEnabled","unbind","destroy","listenTo","_acceptCommand","_discardCommand","discardSuggestion","model","execute","acceptSuggestion","commentThreadController","bind","view","stopListening"];vs=_s,Cs=158,function(e){for(;--e;)vs.push(vs.shift())}(++Cs);var Es=function(e,t){return _s[e-=0]};class Ts{constructor(e,t,n,o,r){this[Es("0x3")]=e,this[Es("0x8")]=t,this[Es("0x6")]=r,this[Es("0x0")]=n,this._discardCommand=o,this[Es("0x8")][Es("0x7")](Es("0xa")).to(this._acceptCommand),this.listenTo(t,Es("0x5"),(()=>this[Es("0x5")]())),this[Es("0xd")](t,"discardSuggestion",(()=>this[Es("0x2")]()))}acceptSuggestion(){this[Es("0x0")][Es("0x4")](this[Es("0x3")].id)}[Es("0x2")](){this[Es("0x1")].execute(this.model.id)}[Es("0xc")](){this[Es("0x8")][Es("0xb")](Es("0xa")),this[Es("0x9")](),this[Es("0x6")][Es("0xc")]()}}(0,t.mix)(Ts,t.ObservableMixin);const ws=["element","locale","_localUser","_createCommentViews","isReadOnly","delegate","isActive","fire","editor","destroy","isDirty","CommentView","addComment","cancel","focus","_config","commentsListView","commentThread","showInput","updateComment","set","value","length","disabledSubmit","assign","bind","_createCommentThreadInputView","isEnabled","commentThreadInputView","disableComments","removeComment","_model","createdAt","hasDirtyComment","editorConfig"];var Ss,Rs;Ss=ws,Rs=328,function(e){for(;--e;)Ss.push(Ss.shift())}(++Rs);const As=function(e,t){return ws[e-=0]};class Is extends r.View{constructor(e,t,n,o){super(e),this[As("0x3")]=null,this[As("0xf")]=null,this[As("0x7")](As("0x1c"),!1),this[As("0x7")](As("0x13"),t.createdAt),this[As("0xc")](As("0x13")).to(t),this[As("0x7")]("descriptionParts",[]),this.set(As("0x20"),!1),this.set(As("0xe"),!1),this._model=t,this[As("0x18")]=n,this[As("0x2")]=o,o[As("0x10")]?this[As("0x7")](As("0x9"),1):this[As("0x19")]()}focus(){this[As("0x16")][As("0x1")]()}[As("0x1f")](){this[As("0x20")]=!1,this[As("0x3")]&&this[As("0x3")][As("0x1f")](),this[As("0xf")]&&this[As("0xf")][As("0x1f")](),super[As("0x1f")]()}[As("0x19")](){const{CommentsListView:e}=this._config;this[As("0x3")]=new e(this[As("0x17")],this[As("0x12")][As("0x4")],Object[As("0xb")]({CommentView:this[As("0x2")][As("0x21")]},this[As("0x2")])),this.commentsListView[As("0x1b")](As("0x11")).to(this),this[As("0x3")][As("0x1b")](As("0x6")).to(this),this[As("0x3")][As("0xc")](As("0x1c")).to(this),this[As("0x7")](As("0x9"),this[As("0x3")].length+1),this[As("0xc")](As("0x9")).to(this[As("0x3")],As("0x9"),(e=>e+1)),this[As("0xf")]=this[As("0xd")](),this.on(As("0x11"),(()=>this[As("0x1")]())),this[As("0xc")]("isDirty").to(this[As("0x3")],As("0x14"),this.commentThreadInputView.commentInputView,As("0x8"),((e,t)=>e||!!t))}[As("0xd")](){const{CommentThreadInputView:e}=this[As("0x2")],t=new e(this[As("0x17")],this[As("0x18")],this._config[As("0x15")]),n=t.commentInputView;return t[As("0xc")](As("0x5")).to(this,"isActive",this[As("0x12")][As("0x4")],As("0x1a"),n,As("0x8"),((e,t,n)=>!!n||e&&!t)),n.on("submit",((e,t)=>{this[As("0x1d")](As("0x22"),t),n[As("0x1e")].setData("")})),n.on(As("0x0"),(()=>this[As("0x1")]())),n[As("0xc")](As("0xa")).to(this[As("0x12")][As("0x4")],As("0x1a")),t}}class Ms extends Is{constructor(t,n,o,r){super(t,n,o,r);const{t:s}=t;this.set("type",""),this.bind("type").to(this,"descriptionParts",(e=>e&&e[0]?e[0].type:"")),this.bind("description").to(this,"descriptionParts",this,"isActive",((e,t)=>{let n="";for(const t of e)n+="<p>"+Ns(t.content,t.color)+"</p>";return t?n:(0,i.trimHtml)(n,{limit:140})})),this._descriptionElement=null,this.acceptButton=this._createButton(s("Accept suggestion"),e.icons.check,"ck-suggestion--accept","acceptSuggestion"),this.discardButton=this._createButton(s("Discard suggestion"),e.icons.cancel,"ck-suggestion--discard","discardSuggestion"),this.userView=new i.UserView(t,this._model.author),this.userView.extendTemplate({attributes:{class:["ck-suggestion__user","ck-annotation__user"]}}),this.setTemplate(this.getTemplate())}getTemplate(){const e=this.bindTemplate,t={tag:"div",attributes:{class:["ck-suggestion-wrapper",e.if("isActive","ck-suggestion-wrapper--active"),e.to("type",(e=>"ck-suggestion-"+e)),this._config.disableComments&&"ck-suggestion--disabled-comments"],"data-suggestion-id":this._model.id,"data-thread-id":this._model.commentThread.id,"data-author-id":this._model.author.id,tabindex:-1},children:[{tag:"div",attributes:{class:["ck-suggestion","ck-annotation"]},children:[this.userView,{tag:"div",attributes:{class:["ck-suggestion__main","ck-annotation__main"]},children:[{tag:"div",attributes:{class:["ck-suggestion__info","ck-annotation__info"]},children:[{tag:"span",children:[{text:this.userView.name}],attributes:{class:["ck-suggestion__info-name","ck-annotation__info-name"]}},{tag:"time",attributes:{datetime:e.to("createdAt"),class:["ck-comment__info-time","ck-annotation__info-time"]},children:[{text:e.to("createdAt",(e=>this._config.formatDateTime(e)))}]}]},{tag:"div",attributes:{class:["ck-suggestion__actions","ck-annotation__actions"]},children:[this.acceptButton,this.discardButton]},{tag:"div",attributes:{class:["ck-annotation__content-wrapper"]}}]}]}]};return this.commentsListView&&this.commentThreadInputView&&t.children.push(this.commentsListView,this.commentThreadInputView),t}render(){super.render(),this._descriptionElement=this.element.querySelector(".ck-annotation__content-wrapper"),this._descriptionElement.innerHTML=this.description,this.on("change:description",((e,t,n)=>{this._descriptionElement.innerHTML=n}))}_createButton(e,t,n,o){const i=new r.ButtonView(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),i.on("execute",(()=>{this.fire(o,this._model.id)})),i.bind("isEnabled").to(this),i}}function Ns(e,t){let n="";return n+=e.split("*").map(((e,t)=>t%2!=0?'<span class="ck-suggestion-type">'+Fs(e)+"</span>":Fs(e))).join(""),t&&(n+='<span class="ck-suggestion-color" style="background-color: '+t.value+'" title="'+t.title+'"></span>'),n}function Fs(e){const t=document.createElement("span");return t.innerText=e,t.innerHTML}var Ps=n(596),Os=n.n(Ps);const Ls=function(){return he.Date.now()};var Bs=/\s/;const js=function(e){for(var t=e.length;t--&&Bs.test(e.charAt(t)););return t};var Ds=/^\s+/;const Us=function(e){return e?e.slice(0,js(e)+1).replace(Ds,""):e};var Hs=/^[-+]0x[0-9a-f]+$/i,Vs=/^0b[01]+$/i,zs=/^0o[0-7]+$/i,Gs=parseInt;const Ws=function(e){if("number"==typeof e)return e;if(ho(e))return NaN;if(we(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=we(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Us(e);var n=Vs.test(e);return n||zs.test(e)?Gs(e.slice(2),n?2:8):Hs.test(e)?NaN:+e};var qs=Math.max,$s=Math.min;const Ks=function(e,t,n){var o,r,i,s,a,c,l=0,g=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=o,i=r;return o=r=void 0,l=t,s=e.apply(i,n)}function f(e){return l=e,a=setTimeout(p,t),g?m(e):s}function h(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=i}function p(){var e=Ls();if(h(e))return k(e);a=setTimeout(p,function(e){var n=t-(e-c);return u?$s(n,i-(e-l)):n}(e))}function k(e){return a=void 0,d&&o?m(e):(o=r=void 0,s)}function b(){var e=Ls(),n=h(e);if(o=arguments,r=this,c=e,n){if(void 0===a)return f(c);if(u)return clearTimeout(a),a=setTimeout(p,t),m(c)}return void 0===a&&(a=setTimeout(p,t)),s}return t=Ws(t)||0,we(n)&&(g=!!n.leading,i=(u="maxWait"in n)?qs(Ws(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d),b.cancel=function(){void 0!==a&&clearTimeout(a),l=0,o=c=r=a=void 0},b.flush=function(){return void 0===a?s:k(Ls())},b};class Zs extends e.Plugin{static get requires(){return[ds,i.Users,"CommentsRepository","Annotations","EditorAnnotations"]}static get pluginName(){return"TrackChangesUI"}constructor(e){super(e),this._suggestionToController=new Map,this._viewToController=new Map,this._debouncedHandlers=new Map;const t=this.editor.config;t.define("trackChanges.SuggestionThreadView",Ms),t.define("trackChanges.disableComments",!1),this._disableComments=t.get("trackChanges.disableComments")}init(){const e=this.editor,t=e.plugins.get(ds),n=e.plugins.get("Annotations"),o=e.plugins.get("EditorAnnotations"),r=e.plugins.get("CommentsRepository");e.ui.componentFactory.add("trackChanges",(e=>this._createUIButton(e))),o.addSourceCollector((()=>{const e=[];for(const[t,n]of Array.from(this._suggestionToController)){const o=t.getAllAdjacentSuggestions(),r=[];for(const e of o){if(!e.isInContent)continue;if(e.isMultiRange){r.push(...e.getRanges());continue}const t=e.getFirstRange();if(r.length>0){const e=r[0].getJoined(t);if(e){r[0]=e;continue}}r.push(t)}e.push([n.view,r])}return e})),this.listenTo(t,"suggestionLoaded",((e,t)=>{let n=!1;const r=Ks((e=>{n||e?n&&e&&(this._destroyController(t),o.refreshSelectedViews(),n=!1):(this._initializeController(t),o.refreshSelectedViews(),n=!0)}),10);this._debouncedHandlers.set(t,r),this.listenTo(t,"change:previous",((e,n,o,i)=>{t.isInContent&&(null==o?(this._updateController(i.head),r(!1)):(this._updateController(o.head),r(!0)))})),null===t.previous?r(!1):this._updateController(t.head)})),this.listenTo(t,"suggestionUnloaded",((e,t,n)=>{this.stopListening(t,"change:previous"),this._debouncedHandlers.get(t).cancel(),this._debouncedHandlers.delete(t);const o=n?n.head:t,r=this._suggestionToController.get(o);null!==n&&this._updateController(o),null===n&&r&&this._destroyController(t)})),this.listenTo(t,"suggestionChanged",((e,t)=>{this._updateController(t)})),this.listenTo(n,"change:activeAnnotations",((e,n,o)=>{const r=Array.from(o,(e=>e.innerView)).filter((e=>this._viewToController.has(e))),i=[];for(const e of r){const t=this._viewToController.get(e).model.getAllAdjacentSuggestions();i.push(...t.reduce(((e,t)=>[...e,...t.getMarkerNames()]),[]))}t.activeMarkers=i})),this.listenTo(r,"addComment",((e,{threadId:n,isFromAdapter:o})=>{if(o||!t.hasSuggestion(n))return;const r=t.getSuggestion(n);this._suggestionToController.get(r).view.focus()}),{priority:"lowest"})}_createUIButton(e){const n=(0,r.createDropdown)(e,r.SplitButtonView),o=this.editor.commands.get("trackChanges"),{t:i}=this.editor;n.buttonView.set({tooltip:i("Track changes"),label:i("Track changes"),icon:Os()}),n.buttonView.bind("isOn").to(o,"value"),n.buttonView.on("execute",(()=>o.execute()));const s=new t.Collection,a=[{type:"switchbutton",model:{withText:!0,label:i("Track changes"),commandName:"trackChanges"}},{type:"separator"},{type:"button",model:{withText:!0,label:i("Accept all suggestions"),commandName:"acceptAllSuggestions"}},{type:"button",model:{withText:!0,label:i("Accept all selected suggestions"),commandName:"acceptSelectedSuggestions"}},{type:"button",model:{withText:!0,label:i("Discard all suggestions"),commandName:"discardAllSuggestions"}},{type:"button",model:{withText:!0,label:i("Discard all selected suggestions"),commandName:"discardSelectedSuggestions"}}];for(const e of a){const t={type:e.type};if(e.model){const n=new r.Model(e.model),o=this.editor.commands.get(n.commandName);n.bind("isOn","isEnabled").to(o,"value","isEnabled"),t.model=n}s.add(t)}(0,r.addListToDropdown)(n,s);const c=a.filter((e=>null!=e.model)).map((e=>this.editor.commands.get(e.model.commandName)));return n.buttonView.actionView.unbind("isEnabled"),n.buttonView.arrowView.unbind("isEnabled"),n.buttonView.actionView.bind("isEnabled").to(o,"isEnabled"),n.buttonView.arrowView.bind("isEnabled").toMany(c,"isEnabled",((...e)=>e.some((e=>e)))),n.on("execute",(e=>this.editor.execute(e.source.commandName))),n}_initializeController(e){const t=this.editor,n=t.config,o=t.plugins.get("Annotations"),r=t.plugins.get("CommentsRepository"),s=e.getAllAdjacentSuggestions().filter((e=>e.isInContent)),a=t.plugins.get(i.Users).me,c=t.commands.get("acceptSuggestion"),l=t.commands.get("discardSuggestion"),g=n.get("trackChanges").SuggestionThreadView,{CommentsListView:u,CommentThreadInputView:d}=t.plugins.get("CommentsUI"),m=new g(t.locale,e,a,{disableComments:this._disableComments,editorConfig:n.get("comments.editorConfig"),maxCommentsWhenCollapsed:n.get("comments.maxCommentsWhenCollapsed"),maxThreadTotalWeight:n.get("comments.maxThreadTotalWeight"),maxCommentCharsWhenCollapsed:n.get("comments.maxCommentCharsWhenCollapsed"),formatDateTime:(0,i.getDateTimeFormatter)(n.get("locale")),CommentView:n.get("comments").CommentView,CommentsListView:u,CommentThreadInputView:d}),f=r.createCommentThreadController(e.commentThread,m),h=new Ts(e,m,c,l,f);m.descriptionParts=t.plugins.get("TrackChangesEditing")._descriptionFactory.getDescriptions(s),this._suggestionToController.set(e,h),this._viewToController.set(m,h);const p=o.createAnnotationView(this.editor.locale,m);p.bind("isDirty").to(m,"isDirty"),p.bind("length").to(m),p.bind("type").to(m,"type",(e=>"suggestion-"+e));const k=o.createAnnotation({view:p,target:()=>{const e=s[0].getFirstMarker();if(!e)return null;const n=e.getRange().getContainedElement();return n&&!t.editing.mapper.toViewElement(n)?null:(0,i.getMarkerDomElement)(t.editing,e)||null},type:()=>"suggestion-"+h.view.type});o.add(k);const b=t.plugins.get("PendingActions");let x;m.on("change:isDirty",((e,t,n)=>{if(n){const e=this.editor.locale.t;x=b.add(e({string:"Unsaved change in suggestion.",id:"PENDING_ACTION_SUGGESTION"}))}else b.remove(x),x=null}))}_destroyController(e){const t=this.editor.plugins.get("Annotations"),n=this._suggestionToController.get(e),o=n.view,r=t.getByInnerView(o);r&&t.remove(r),this._suggestionToController.delete(e),this._viewToController.delete(o),n.destroy(),o.destroy()}_updateController(e){if(!e.isInContent||!this._suggestionToController.has(e))return;const t=this.editor.plugins.get("TrackChangesEditing"),n=this._suggestionToController.get(e),o=e.getAllAdjacentSuggestions();n.view.descriptionParts=t._descriptionFactory.getDescriptions(o)}destroy(){super.destroy();for(const e of this._suggestionToController.keys())this._destroyController(e);for(const e of this._debouncedHandlers.values())e.cancel();this._debouncedHandlers.clear()}}var Xs,Qs,Js=["editor","addSuggestionData","adapter","pluginName","get","Comments","getSuggestion","plugins","getSuggestions"];Xs=Js,Qs=253,function(e){for(;--e;)Xs.push(Xs.shift())}(++Qs);var Ys=function(e,t){return Js[e-=0]};class ea extends e.Plugin{static get requires(){return[ds,Zs,Ys("0x4")]}static get[Ys("0x2")](){return"TrackChanges"}set adapter(e){this[Ys("0x8")][Ys("0x6")][Ys("0x3")](ds)[Ys("0x1")]=e}get adapter(){return this[Ys("0x8")][Ys("0x6")][Ys("0x3")](ds)[Ys("0x1")]}addSuggestion(e){return this[Ys("0x8")][Ys("0x6")].get(ds)[Ys("0x0")](e)}getSuggestions(e){return this.editor.plugins.get(ds)[Ys("0x7")](e)}[Ys("0x5")](e){return this[Ys("0x8")][Ys("0x6")][Ys("0x3")](ds)[Ys("0x5")](e)}}const ta=["useAnonymousUser","plugins","toolbar","set","TrackChangesDataGetter","Users","div","discardAllSuggestions","map","from","addSuggestionData","addUser","trackChangesData.editorCreator","createElement","destroy","requires","result","config","_adapter","pluginName","every","builtinPlugins","CommentsRepository","end","concat","getDataWithDiscardedSuggestions","find","initialData","getUser","function","getRootNames","RealTimeCollaborativeEditing","name","has","add","data","init","editorCreator","model","reduce","names","string","push","TrackChangesEditing","getSuggestions","extraPlugins","create","filter","trackChangesData","appendChild","TrackChangesData","execute","define","editor","constructor","get"];var na,oa;na=ta,oa=258,function(e){for(;--e;)na.push(na.shift())}(++oa);const ra=function(e,t){return ta[e-=0]},ia=[ra("0x31"),"context",ra("0x18")],sa=[ra("0x35"),"RealTimeCollaborativeComments","RealTimeCollaborativeTrackChanges","Autosave"];class aa extends e.Plugin{static get[ra("0x25")](){return[ds]}static get[ra("0x29")](){return ra("0x10")}init(){const e=this[ra("0x13")];if(e.config[ra("0x12")](ra("0x22"),(t=>e.constructor[ra("0xc")]("",t))),"function"!=typeof e[ra("0x27")][ra("0x15")](ra("0xe"))[ra("0x3")])throw new t.CKEditorError("track-changes-data-invalid-editor-creator")}getDataWithAcceptedSuggestions(e){return la(this[ra("0x13")],!0,e)}[ra("0x2f")](e){return la(this[ra("0x13")],!1,e)}}class ca extends e.Plugin{static get[ra("0x29")](){return ra("0x1a")}[ra("0x2")](){this[ra("0x26")]=ra("0x2d"),this[ra("0x13")][ra("0x17")][ra("0x15")](ra("0x2c"))[ra("0x28")]={getCommentThread:()=>new Promise((()=>{}))},this[ra("0x13")].plugins[ra("0x15")](ra("0x9"))[ra("0x28")]=null}}async function la(e,t,n){const o=function(e){const t={};for(const n of e[ra("0x27")][ra("0x6")]())ia.includes(n)||(t[n]=e[ra("0x27")][ra("0x15")](n));const n=e[ra("0x14")][ra("0x2b")]||[],o=t[ra("0xb")]||[];delete t[ra("0xb")];const r=n[ra("0x2e")](t.plugins).concat(o).map((e=>ra("0x7")==typeof e?n[ra("0x30")]((t=>t.pluginName==e)):e)),i=Array[ra("0x1f")](new Set(r));return t[ra("0x17")]=i[ra("0xd")]((e=>ga(e,new Set))),t[ra("0x17")].push(ca),t.plugins[ra("0x8")](ds),t}(e),r=document.createDocumentFragment(),i=e[ra("0x27")][ra("0x15")]("trackChangesData")[ra("0x3")],s=await i(o,(()=>function(e){const t=document[ra("0x23")](ra("0x1c"));return e[ra("0xf")](t),t}(r)));!function(e,t){const n=e[ra("0x4")].document[ra("0x34")]()[ra("0x5")](((t,n)=>(t[n]=e[ra("0x1")][ra("0x15")]({rootName:n}),t)),{}),o=e[ra("0x17")][ra("0x15")](ra("0x1b")).users[ra("0x1e")]((e=>({id:e.id}))),r=e[ra("0x17")][ra("0x15")](ra("0x9"))[ra("0xa")]({skipNotAttached:!0,toJSON:!0}),i=t[ra("0x17")][ra("0x15")]("Users"),s=t[ra("0x17")][ra("0x15")](ra("0x9"));for(const e of o)i[ra("0x32")](e.id)||i[ra("0x21")](e);i.me||i[ra("0x16")]();for(const e of r)s[ra("0x20")](e);t.data[ra("0x19")](n)}(e,s),s[ra("0x11")](t?"acceptAllSuggestions":ra("0x1d"));const a=s[ra("0x1")][ra("0x15")](n);return await s[ra("0x24")](),a}function ga(e,t){if(t[ra("0x37")](e))return!0;t[ra("0x0")](e);const n=ra("0x33")==typeof e?e.pluginName||e[ra("0x36")]:e;return(!n||!sa.includes(n))&&(!e.requires||e.requires[ra("0x2a")]((e=>ga(e,t))))}})(),(window.CKEditor5=window.CKEditor5||{}).trackChanges=o})();
|
|
5
|
+
*/(()=>{var e={596:e=>{e.exports='\x3c!--\n\n What you\'re currently looking at is the source code of a legally protected, proprietary software.\n CKEditor 5 Collaboration is licensed under a commercial license and protected by copyright law. Where not otherwise indicated,\n all CKEditor 5 Collaboration content is authored by CKSource engineers and consists of CKSource-owned intellectual property.\n\n Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.\n\n!--\x3e\n\n<svg viewBox="0 0 20 20" width="20" height="20" xmlns="http://www.w3.org/2000/svg"><g fill="#000" fill-rule="nonzero"><path d="M1 3.28C1 2.574 1.574 2 2.272 2h10.23c.703 0 1.272.573 1.272 1.28v12.768c0 .708-.574 1.281-1.271 1.281H2.272A1.276 1.276 0 0 1 1 16.049V3.28zm11.503 12.954c-.008 0-.006-12.77-.006-12.77 0-.003-10.225-.004-10.225-.004.007 0 .005 12.77.005 12.77 0 .003 10.226.004 10.226.004zm-8.31-9.58c0-.353.292-.64.636-.64h5.116c.351 0 .636.284.636.64a.641.641 0 0 1-.636.638H4.829a.636.636 0 0 1-.635-.639zm0 2.554c0-.352.292-.638.636-.638h5.116c.351 0 .636.283.636.638a.641.641 0 0 1-.636.639H4.829a.636.636 0 0 1-.635-.639zm0 2.555c0-.353.289-.639.633-.639h2.567c.35 0 .633.284.633.64a.639.639 0 0 1-.633.638H4.826a.634.634 0 0 1-.632-.639z"/><path d="M10.515 17.958l.154-.23c-.195-.099-.304-.193-.328-.28-.024-.09.001-.275.076-.552.062-.165.099-.296.111-.393.013-.159.013-.319 0-.478-.138-.41-.2-.686-.187-.83.013-.145.117-.335.313-.57l4.465-6.208c.356-.6 1.059-.56 2.11.119 1.051.68 1.443 1.271 1.177 1.771L14.53 17.14c-.105.271-.22.444-.347.516-.128.07-.399.118-.813.138a2.954 2.954 0 0 0-.487.21 2.044 2.044 0 0 0-.347.31c-.193.174-.332.262-.416.262-.064 0-.178-.05-.346-.15l-.204.27-1.056-.738h.001zm-.184.274l1.039.727-.259.34H9.614l.717-1.067z"/></g></svg>\n'},417:(e,t,n)=>{e.exports=n(720)("./src/collaboration-core.js")},704:(e,t,n)=>{e.exports=n(79)("./src/core.js")},492:(e,t,n)=>{e.exports=n(79)("./src/engine.js")},331:(e,t,n)=>{e.exports=n(79)("./src/enter.js")},181:(e,t,n)=>{e.exports=n(79)("./src/typing.js")},273:(e,t,n)=>{e.exports=n(79)("./src/ui.js")},209:(e,t,n)=>{e.exports=n(79)("./src/utils.js")},995:(e,t,n)=>{e.exports=n(79)("./src/widget.js")},720:e=>{"use strict";e.exports=CKEditor5.collaborationDll},79:e=>{"use strict";e.exports=CKEditor5.dll}},t={};function n(o){var s=t[o];if(void 0!==s)return s.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";n.r(o),n.d(o,{BaseSuggestionThreadView:()=>hr,TrackChanges:()=>jr,TrackChangesData:()=>Wr});var e=n(704),t=n(209),s=n(273),i=n(417),r=n(492),a=n(995);const c=["execute","value","_enabledCommands","clearForceDisabled","isEnabled","refresh","has","editor","_disableUnsupportedCommands","affectsData","forceDisabled","commands","TrackChangesCommand","_enableCommands"];var l,g;l=c,g=235,function(e){for(;--e;)l.push(l.shift())}(++g);const u=function(e,t){return c[e-=0]};class d extends e.Command{constructor(e,t){super(e),this[u("0x5")]=t,this[u("0x4")]=!1,this[u("0x8")]()}[u("0x8")](){this[u("0x7")]=!0}[u("0x3")](){this[u("0x4")]=!this[u("0x4")],this[u("0x4")]?this[u("0xb")]():this._enableCommands()}_disableUnsupportedCommands(){for(const e of this[u("0xa")][u("0x0")][u("0x0")]())e[u("0xc")]&&!this[u("0x5")][u("0x9")](e)&&e[u("0xd")](u("0x1"))}[u("0x2")](){for(const e of this[u("0xa")][u("0x0")][u("0x0")]())e[u("0xc")]&&!this[u("0x5")][u("0x9")](e)&&e[u("0x6")](u("0x1"))}}const m=["get","TrackChangesEditing","execute","acceptSuggestion","track-changes-accept-suggestion-not-found","isEnabled","_suggestions","refresh","plugins"];var h,f;h=m,f=414,function(e){for(;--e;)h.push(h.shift())}(++f);const p=function(e,t){return m[e-=0]};class b extends e.Command{constructor(e,t){super(e),this._suggestions=t,this[p("0x7")]()}[p("0x7")](){this[p("0x5")]=!0}[p("0x2")](e){const n=this[p("0x6")][p("0x0")](e);if(!n)throw new t.CKEditorError(p("0x4"),this);this.editor[p("0x8")][p("0x0")](p("0x1"))[p("0x3")](n)}}const x=["track-changes-discard-suggestion-not-found","isEnabled","execute","plugins","get","_suggestions","TrackChangesEditing","refresh"];var y,C;y=x,C=164,function(e){for(;--e;)y.push(y.shift())}(++C);const _=function(e,t){return x[e-=0]};class k extends e.Command{constructor(e,t){super(e),this[_("0x1")]=t,this.refresh()}[_("0x3")](){this[_("0x5")]=!0}[_("0x6")](e){const n=this[_("0x1")][_("0x0")](e);if(!n)throw new t.CKEditorError(_("0x4"),this);this.editor[_("0x7")].get(_("0x2")).discardSuggestion(n)}}var v,E,T=["deletion","type"];v=T,E=264,function(e){for(;--e;)v.push(v.shift())}(++E);var R=function(e,t){return T[e-=0]};function S(e){return e.sort(((e,t)=>R("0x0")==e[R("0x1")]&&R("0x0")!=t[R("0x1")]?-1:"deletion"!=e[R("0x1")]&&R("0x0")==t.type?1:0))}const w=["execute","editor","change","model","refresh","from","_acceptSuggestionCommand","_suggestions","isInContent","some","isEnabled","values"];var A,I;A=w,I=140,function(e){for(;--e;)A.push(A.shift())}(++I);const M=function(e,t){return w[e-=0]};class N extends e.Command{constructor(e,t,n){super(e),this[M("0xa")]=t,this[M("0xb")]=n,this[M("0x8")]()}[M("0x8")](){const e=this[M("0xa")];this[M("0x2")]=e[M("0x2")]&&Array.from(this[M("0xb")][M("0x3")]())[M("0x1")]((e=>e.isInContent))}[M("0x4")](){this[M("0x5")][M("0x7")][M("0x6")]((()=>{const e=S(Array[M("0x9")](this._suggestions[M("0x3")]()));for(const t of e)t[M("0x0")]&&this[M("0xa")][M("0x4")](t.id)}))}}const F=["getRange","from","isTouching","start","isCollapsed","add","isIntersecting","isInContent","getRanges","end"];var P,O;P=F,O=253,function(e){for(;--e;)P.push(P.shift())}(++O);const L=function(e,t){return F[e-=0]};function B(e,t){const n=Array[L("0x8")](e[L("0x5")]()),o=new Set;for(const s of t)if(s[L("0x4")])for(const t of n)for(const n of s.getMarkers()){const i=n[L("0x7")]();(t[L("0x3")](i)||e[L("0x1")]&&!s.isMultiRange&&s.next&&i[L("0x6")][L("0x9")](t[L("0x0")]))&&o[L("0x2")](s)}return o}const j=["refresh","change","_acceptSuggestionCommand","isEnabled","_selectedSuggestions","execute","model","editor","_suggestions","from","values"];var D,U;D=j,U=135,function(e){for(;--e;)D.push(D.shift())}(++U);const H=function(e,t){return j[e-=0]};class V extends e.Command{constructor(e,t,n){super(e),this[H("0xa")]=t,this[H("0x5")]=n,this[H("0x1")]=new Set,this[H("0x8")]()}[H("0x8")](){const e=this[H("0xa")],t=this.editor[H("0x3")].document.selection,n=Array[H("0x6")](this[H("0x5")][H("0x7")]());this[H("0x1")]=B(t,n),this.isEnabled=e[H("0x0")]&&!!this._selectedSuggestions.size}[H("0x2")](){this[H("0x4")][H("0x3")][H("0x9")]((()=>{const e=S(Array[H("0x6")](this[H("0x1")]));for(const t of e)this[H("0xa")][H("0x2")](t.id)}))}}const z=["model","change","some","_suggestions","isEnabled","isInContent","refresh","_discardSuggestionCommand","values","editor","execute"];var G,W;G=z,W=243,function(e){for(;--e;)G.push(G.shift())}(++W);const q=function(e,t){return z[e-=0]};class $ extends e.Command{constructor(e,t,n){super(e),this[q("0x6")]=t,this[q("0x2")]=n,this[q("0x5")]()}[q("0x5")](){const e=this[q("0x6")];this[q("0x3")]=e[q("0x3")]&&Array.from(this[q("0x2")][q("0x7")]())[q("0x1")]((e=>e[q("0x4")]))}[q("0x9")](){this[q("0x8")][q("0xa")][q("0x0")]((()=>{for(const e of this[q("0x2")][q("0x7")]())e[q("0x4")]&&this[q("0x6")].execute(e.id)}))}}const K=["from","editor","model","_discardSuggestionCommand","_selectedSuggestions","refresh","_suggestions","isEnabled","selection","document","values","size","execute"];var X,Q;X=K,Q=231,function(e){for(;--e;)X.push(X.shift())}(++Q);const J=function(e,t){return K[e-=0]};class Y extends e.Command{constructor(e,t,n){super(e),this[J("0x6")]=t,this[J("0x9")]=n,this[J("0x7")]=new Set,this[J("0x8")]()}[J("0x8")](){const e=this[J("0x6")],t=this[J("0x4")][J("0x5")][J("0xc")][J("0xb")],n=Array[J("0x3")](this[J("0x9")][J("0x0")]());this[J("0x7")]=B(t,n),this.isEnabled=e[J("0xa")]&&!!this[J("0x7")][J("0x1")]}[J("0x2")](){this.editor[J("0x5")].change((()=>{for(const e of this[J("0x7")])this[J("0x6")][J("0x2")](e.id)}))}}const Z=function(){this.__data__=[],this.size=0};const ee=function(e,t){return e===t||e!=e&&t!=t};const te=function(e,t){for(var n=e.length;n--;)if(ee(e[n][0],t))return n;return-1};var ne=Array.prototype.splice;const oe=function(e){var t=this.__data__,n=te(t,e);return!(n<0)&&(n==t.length-1?t.pop():ne.call(t,n,1),--this.size,!0)};const se=function(e){var t=this.__data__,n=te(t,e);return n<0?void 0:t[n][1]};const ie=function(e){return te(this.__data__,e)>-1};const re=function(e,t){var n=this.__data__,o=te(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};function ae(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}ae.prototype.clear=Z,ae.prototype.delete=oe,ae.prototype.get=se,ae.prototype.has=ie,ae.prototype.set=re;const ce=ae;const le=function(){this.__data__=new ce,this.size=0};const ge=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};const ue=function(e){return this.__data__.get(e)};const de=function(e){return this.__data__.has(e)};const me="object"==typeof global&&global&&global.Object===Object&&global;var he="object"==typeof self&&self&&self.Object===Object&&self;const fe=me||he||Function("return this")();const pe=fe.Symbol;var be=Object.prototype,xe=be.hasOwnProperty,ye=be.toString,Ce=pe?pe.toStringTag:void 0;const _e=function(e){var t=xe.call(e,Ce),n=e[Ce];try{e[Ce]=void 0;var o=!0}catch(e){}var s=ye.call(e);return o&&(t?e[Ce]=n:delete e[Ce]),s};var ke=Object.prototype.toString;const ve=function(e){return ke.call(e)};var Ee=pe?pe.toStringTag:void 0;const Te=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ee&&Ee in Object(e)?_e(e):ve(e)};const Re=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const Se=function(e){if(!Re(e))return!1;var t=Te(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const we=fe["__core-js_shared__"];var Ae,Ie=(Ae=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||""))?"Symbol(src)_1."+Ae:"";const Me=function(e){return!!Ie&&Ie in e};var Ne=Function.prototype.toString;const Fe=function(e){if(null!=e){try{return Ne.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var Pe=/^\[object .+?Constructor\]$/,Oe=Function.prototype,Le=Object.prototype,Be=Oe.toString,je=Le.hasOwnProperty,De=RegExp("^"+Be.call(je).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Ue=function(e){return!(!Re(e)||Me(e))&&(Se(e)?De:Pe).test(Fe(e))};const He=function(e,t){return null==e?void 0:e[t]};const Ve=function(e,t){var n=He(e,t);return Ue(n)?n:void 0};const ze=Ve(fe,"Map");const Ge=Ve(Object,"create");const We=function(){this.__data__=Ge?Ge(null):{},this.size=0};const qe=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t};var $e=Object.prototype.hasOwnProperty;const Ke=function(e){var t=this.__data__;if(Ge){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return $e.call(t,e)?t[e]:void 0};var Xe=Object.prototype.hasOwnProperty;const Qe=function(e){var t=this.__data__;return Ge?void 0!==t[e]:Xe.call(t,e)};const Je=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ge&&void 0===t?"__lodash_hash_undefined__":t,this};function Ye(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Ye.prototype.clear=We,Ye.prototype.delete=qe,Ye.prototype.get=Ke,Ye.prototype.has=Qe,Ye.prototype.set=Je;const Ze=Ye;const et=function(){this.size=0,this.__data__={hash:new Ze,map:new(ze||ce),string:new Ze}};const tt=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};const nt=function(e,t){var n=e.__data__;return tt(t)?n["string"==typeof t?"string":"hash"]:n.map};const ot=function(e){var t=nt(this,e).delete(e);return this.size-=t?1:0,t};const st=function(e){return nt(this,e).get(e)};const it=function(e){return nt(this,e).has(e)};const rt=function(e,t){var n=nt(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};function at(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}at.prototype.clear=et,at.prototype.delete=ot,at.prototype.get=st,at.prototype.has=it,at.prototype.set=rt;const ct=at;const lt=function(e,t){var n=this.__data__;if(n instanceof ce){var o=n.__data__;if(!ze||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new ct(o)}return n.set(e,t),this.size=n.size,this};function gt(e){var t=this.__data__=new ce(e);this.size=t.size}gt.prototype.clear=le,gt.prototype.delete=ge,gt.prototype.get=ue,gt.prototype.has=de,gt.prototype.set=lt;const ut=gt;const dt=function(e,t){for(var n=-1,o=null==e?0:e.length;++n<o&&!1!==t(e[n],n,e););return e};const mt=function(){try{var e=Ve(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();const ht=function(e,t,n){"__proto__"==t&&mt?mt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n};var ft=Object.prototype.hasOwnProperty;const pt=function(e,t,n){var o=e[t];ft.call(e,t)&&ee(o,n)&&(void 0!==n||t in e)||ht(e,t,n)};const bt=function(e,t,n,o){var s=!n;n||(n={});for(var i=-1,r=t.length;++i<r;){var a=t[i],c=o?o(n[a],e[a],a,n,e):void 0;void 0===c&&(c=e[a]),s?ht(n,a,c):pt(n,a,c)}return n};const xt=function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o};const yt=function(e){return null!=e&&"object"==typeof e};const Ct=function(e){return yt(e)&&"[object Arguments]"==Te(e)};var _t=Object.prototype,kt=_t.hasOwnProperty,vt=_t.propertyIsEnumerable;const Et=Ct(function(){return arguments}())?Ct:function(e){return yt(e)&&kt.call(e,"callee")&&!vt.call(e,"callee")};const Tt=Array.isArray;const Rt=function(){return!1};var St="object"==typeof exports&&exports&&!exports.nodeType&&exports,wt=St&&"object"==typeof module&&module&&!module.nodeType&&module,At=wt&&wt.exports===St?fe.Buffer:void 0;const It=(At?At.isBuffer:void 0)||Rt;var Mt=/^(?:0|[1-9]\d*)$/;const Nt=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Mt.test(e))&&e>-1&&e%1==0&&e<t};const Ft=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Pt={};Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object Boolean]"]=Pt["[object DataView]"]=Pt["[object Date]"]=Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object WeakMap]"]=!1;const Ot=function(e){return yt(e)&&Ft(e.length)&&!!Pt[Te(e)]};const Lt=function(e){return function(t){return e(t)}};var Bt="object"==typeof exports&&exports&&!exports.nodeType&&exports,jt=Bt&&"object"==typeof module&&module&&!module.nodeType&&module,Dt=jt&&jt.exports===Bt&&me.process;const Ut=function(){try{var e=jt&&jt.require&&jt.require("util").types;return e||Dt&&Dt.binding&&Dt.binding("util")}catch(e){}}();var Ht=Ut&&Ut.isTypedArray;const Vt=Ht?Lt(Ht):Ot;var zt=Object.prototype.hasOwnProperty;const Gt=function(e,t){var n=Tt(e),o=!n&&Et(e),s=!n&&!o&&It(e),i=!n&&!o&&!s&&Vt(e),r=n||o||s||i,a=r?xt(e.length,String):[],c=a.length;for(var l in e)!t&&!zt.call(e,l)||r&&("length"==l||s&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Nt(l,c))||a.push(l);return a};var Wt=Object.prototype;const qt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Wt)};const $t=function(e,t){return function(n){return e(t(n))}};const Kt=$t(Object.keys,Object);var Xt=Object.prototype.hasOwnProperty;const Qt=function(e){if(!qt(e))return Kt(e);var t=[];for(var n in Object(e))Xt.call(e,n)&&"constructor"!=n&&t.push(n);return t};const Jt=function(e){return null!=e&&Ft(e.length)&&!Se(e)};const Yt=function(e){return Jt(e)?Gt(e):Qt(e)};const Zt=function(e,t){return e&&bt(t,Yt(t),e)};const en=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t};var tn=Object.prototype.hasOwnProperty;const nn=function(e){if(!Re(e))return en(e);var t=qt(e),n=[];for(var o in e)("constructor"!=o||!t&&tn.call(e,o))&&n.push(o);return n};const on=function(e){return Jt(e)?Gt(e,!0):nn(e)};const sn=function(e,t){return e&&bt(t,on(t),e)};var rn="object"==typeof exports&&exports&&!exports.nodeType&&exports,an=rn&&"object"==typeof module&&module&&!module.nodeType&&module,cn=an&&an.exports===rn?fe.Buffer:void 0,ln=cn?cn.allocUnsafe:void 0;const gn=function(e,t){if(t)return e.slice();var n=e.length,o=ln?ln(n):new e.constructor(n);return e.copy(o),o};const un=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t};const dn=function(e,t){for(var n=-1,o=null==e?0:e.length,s=0,i=[];++n<o;){var r=e[n];t(r,n,e)&&(i[s++]=r)}return i};const mn=function(){return[]};var hn=Object.prototype.propertyIsEnumerable,fn=Object.getOwnPropertySymbols;const pn=fn?function(e){return null==e?[]:(e=Object(e),dn(fn(e),(function(t){return hn.call(e,t)})))}:mn;const bn=function(e,t){return bt(e,pn(e),t)};const xn=function(e,t){for(var n=-1,o=t.length,s=e.length;++n<o;)e[s+n]=t[n];return e};const yn=$t(Object.getPrototypeOf,Object);const Cn=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)xn(t,pn(e)),e=yn(e);return t}:mn;const _n=function(e,t){return bt(e,Cn(e),t)};const kn=function(e,t,n){var o=t(e);return Tt(e)?o:xn(o,n(e))};const vn=function(e){return kn(e,Yt,pn)};const En=function(e){return kn(e,on,Cn)};const Tn=Ve(fe,"DataView");const Rn=Ve(fe,"Promise");const Sn=Ve(fe,"Set");const wn=Ve(fe,"WeakMap");var An="[object Map]",In="[object Promise]",Mn="[object Set]",Nn="[object WeakMap]",Fn="[object DataView]",Pn=Fe(Tn),On=Fe(ze),Ln=Fe(Rn),Bn=Fe(Sn),jn=Fe(wn),Dn=Te;(Tn&&Dn(new Tn(new ArrayBuffer(1)))!=Fn||ze&&Dn(new ze)!=An||Rn&&Dn(Rn.resolve())!=In||Sn&&Dn(new Sn)!=Mn||wn&&Dn(new wn)!=Nn)&&(Dn=function(e){var t=Te(e),n="[object Object]"==t?e.constructor:void 0,o=n?Fe(n):"";if(o)switch(o){case Pn:return Fn;case On:return An;case Ln:return In;case Bn:return Mn;case jn:return Nn}return t});const Un=Dn;var Hn=Object.prototype.hasOwnProperty;const Vn=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Hn.call(e,"index")&&(n.index=e.index,n.input=e.input),n};const zn=fe.Uint8Array;const Gn=function(e){var t=new e.constructor(e.byteLength);return new zn(t).set(new zn(e)),t};const Wn=function(e,t){var n=t?Gn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)};var qn=/\w*$/;const $n=function(e){var t=new e.constructor(e.source,qn.exec(e));return t.lastIndex=e.lastIndex,t};var Kn=pe?pe.prototype:void 0,Xn=Kn?Kn.valueOf:void 0;const Qn=function(e){return Xn?Object(Xn.call(e)):{}};const Jn=function(e,t){var n=t?Gn(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)};const Yn=function(e,t,n){var o=e.constructor;switch(t){case"[object ArrayBuffer]":return Gn(e);case"[object Boolean]":case"[object Date]":return new o(+e);case"[object DataView]":return Wn(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Jn(e,n);case"[object Map]":case"[object Set]":return new o;case"[object Number]":case"[object String]":return new o(e);case"[object RegExp]":return $n(e);case"[object Symbol]":return Qn(e)}};var Zn=Object.create;const eo=function(){function e(){}return function(t){if(!Re(t))return{};if(Zn)return Zn(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();const to=function(e){return"function"!=typeof e.constructor||qt(e)?{}:eo(yn(e))};const no=function(e){return yt(e)&&"[object Map]"==Un(e)};var oo=Ut&&Ut.isMap;const so=oo?Lt(oo):no;const io=function(e){return yt(e)&&"[object Set]"==Un(e)};var ro=Ut&&Ut.isSet;const ao=ro?Lt(ro):io;var co="[object Arguments]",lo="[object Function]",go="[object Object]",uo={};uo[co]=uo["[object Array]"]=uo["[object ArrayBuffer]"]=uo["[object DataView]"]=uo["[object Boolean]"]=uo["[object Date]"]=uo["[object Float32Array]"]=uo["[object Float64Array]"]=uo["[object Int8Array]"]=uo["[object Int16Array]"]=uo["[object Int32Array]"]=uo["[object Map]"]=uo["[object Number]"]=uo["[object Object]"]=uo["[object RegExp]"]=uo["[object Set]"]=uo["[object String]"]=uo["[object Symbol]"]=uo["[object Uint8Array]"]=uo["[object Uint8ClampedArray]"]=uo["[object Uint16Array]"]=uo["[object Uint32Array]"]=!0,uo["[object Error]"]=uo[lo]=uo["[object WeakMap]"]=!1;const mo=function e(t,n,o,s,i,r){var a,c=1&n,l=2&n,g=4&n;if(o&&(a=i?o(t,s,i,r):o(t)),void 0!==a)return a;if(!Re(t))return t;var u=Tt(t);if(u){if(a=Vn(t),!c)return un(t,a)}else{var d=Un(t),m=d==lo||"[object GeneratorFunction]"==d;if(It(t))return gn(t,c);if(d==go||d==co||m&&!i){if(a=l||m?{}:to(t),!c)return l?_n(t,sn(a,t)):bn(t,Zt(a,t))}else{if(!uo[d])return i?t:{};a=Yn(t,d,c)}}r||(r=new ut);var h=r.get(t);if(h)return h;r.set(t,a),ao(t)?t.forEach((function(s){a.add(e(s,n,o,s,t,r))})):so(t)&&t.forEach((function(s,i){a.set(i,e(s,n,o,i,t,r))}));var f=u?void 0:(g?l?En:vn:l?on:Yt)(t);return dt(f||t,(function(s,i){f&&(s=t[i=s]),pt(a,i,e(s,n,o,i,t,r))})),a};const ho=function(e){return mo(e,5)};const fo=function(e){return"symbol"==typeof e||yt(e)&&"[object Symbol]"==Te(e)};var po=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,bo=/^\w*$/;const xo=function(e,t){if(Tt(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!fo(e))||(bo.test(e)||!po.test(e)||null!=t&&e in Object(t))};function yo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var o=arguments,s=t?t.apply(this,o):o[0],i=n.cache;if(i.has(s))return i.get(s);var r=e.apply(this,o);return n.cache=i.set(s,r)||i,r};return n.cache=new(yo.Cache||ct),n}yo.Cache=ct;const Co=yo;var _o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ko=/\\(\\)?/g;const vo=function(e){var t=Co(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(_o,(function(e,n,o,s){t.push(o?s.replace(ko,"$1"):n||e)})),t}));const Eo=function(e,t){for(var n=-1,o=null==e?0:e.length,s=Array(o);++n<o;)s[n]=t(e[n],n,e);return s};var To=pe?pe.prototype:void 0,Ro=To?To.toString:void 0;const So=function e(t){if("string"==typeof t)return t;if(Tt(t))return Eo(t,e)+"";if(fo(t))return Ro?Ro.call(t):"";var n=t+"";return"0"==n&&1/t==-Infinity?"-0":n};const wo=function(e){return null==e?"":So(e)};const Ao=function(e,t){return Tt(e)?e:xo(e,t)?[e]:vo(wo(e))};const Io=function(e){if("string"==typeof e||fo(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};const Mo=function(e,t,n,o){if(!Re(e))return e;for(var s=-1,i=(t=Ao(t,e)).length,r=i-1,a=e;null!=a&&++s<i;){var c=Io(t[s]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(s!=r){var g=a[c];void 0===(l=o?o(g,c,a):void 0)&&(l=Re(g)?g:Nt(t[s+1])?[]:{})}pt(a,c,l),a=a[c]}return e};const No=function(e,t,n){return null==e?e:Mo(e,t,n)};const Fo=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};const Po=function(e){return this.__data__.has(e)};function Oo(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ct;++t<n;)this.add(e[t])}Oo.prototype.add=Oo.prototype.push=Fo,Oo.prototype.has=Po;const Lo=Oo;const Bo=function(e,t){for(var n=-1,o=null==e?0:e.length;++n<o;)if(t(e[n],n,e))return!0;return!1};const jo=function(e,t){return e.has(t)};const Do=function(e,t,n,o,s,i){var r=1&n,a=e.length,c=t.length;if(a!=c&&!(r&&c>a))return!1;var l=i.get(e),g=i.get(t);if(l&&g)return l==t&&g==e;var u=-1,d=!0,m=2&n?new Lo:void 0;for(i.set(e,t),i.set(t,e);++u<a;){var h=e[u],f=t[u];if(o)var p=r?o(f,h,u,t,e,i):o(h,f,u,e,t,i);if(void 0!==p){if(p)continue;d=!1;break}if(m){if(!Bo(t,(function(e,t){if(!jo(m,t)&&(h===e||s(h,e,n,o,i)))return m.push(t)}))){d=!1;break}}else if(h!==f&&!s(h,f,n,o,i)){d=!1;break}}return i.delete(e),i.delete(t),d};const Uo=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n};const Ho=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n};var Vo=pe?pe.prototype:void 0,zo=Vo?Vo.valueOf:void 0;const Go=function(e,t,n,o,s,i,r){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!i(new zn(e),new zn(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ee(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=Uo;case"[object Set]":var c=1&o;if(a||(a=Ho),e.size!=t.size&&!c)return!1;var l=r.get(e);if(l)return l==t;o|=2,r.set(e,t);var g=Do(a(e),a(t),o,s,i,r);return r.delete(e),g;case"[object Symbol]":if(zo)return zo.call(e)==zo.call(t)}return!1};var Wo=Object.prototype.hasOwnProperty;const qo=function(e,t,n,o,s,i){var r=1&n,a=vn(e),c=a.length;if(c!=vn(t).length&&!r)return!1;for(var l=c;l--;){var g=a[l];if(!(r?g in t:Wo.call(t,g)))return!1}var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var m=!0;i.set(e,t),i.set(t,e);for(var h=r;++l<c;){var f=e[g=a[l]],p=t[g];if(o)var b=r?o(p,f,g,t,e,i):o(f,p,g,e,t,i);if(!(void 0===b?f===p||s(f,p,n,o,i):b)){m=!1;break}h||(h="constructor"==g)}if(m&&!h){var x=e.constructor,y=t.constructor;x==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof x&&x instanceof x&&"function"==typeof y&&y instanceof y||(m=!1)}return i.delete(e),i.delete(t),m};var $o="[object Arguments]",Ko="[object Array]",Xo="[object Object]",Qo=Object.prototype.hasOwnProperty;const Jo=function(e,t,n,o,s,i){var r=Tt(e),a=Tt(t),c=r?Ko:Un(e),l=a?Ko:Un(t),g=(c=c==$o?Xo:c)==Xo,u=(l=l==$o?Xo:l)==Xo,d=c==l;if(d&&It(e)){if(!It(t))return!1;r=!0,g=!1}if(d&&!g)return i||(i=new ut),r||Vt(e)?Do(e,t,n,o,s,i):Go(e,t,c,n,o,s,i);if(!(1&n)){var m=g&&Qo.call(e,"__wrapped__"),h=u&&Qo.call(t,"__wrapped__");if(m||h){var f=m?e.value():e,p=h?t.value():t;return i||(i=new ut),s(f,p,n,o,i)}}return!!d&&(i||(i=new ut),qo(e,t,n,o,s,i))};const Yo=function e(t,n,o,s,i){return t===n||(null==t||null==n||!yt(t)&&!yt(n)?t!=t&&n!=n:Jo(t,n,o,s,e,i))};const Zo=function(e,t){return Yo(e,t)};const es=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};const ts=function(e,t){for(var n=0,o=(t=Ao(t,e)).length;null!=e&&n<o;)e=e[Io(t[n++])];return n&&n==o?e:void 0};const ns=function(e,t,n){var o=-1,s=e.length;t<0&&(t=-t>s?0:s+t),(n=n>s?s:n)<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(s);++o<s;)i[o]=e[o+t];return i};const os=function(e,t){return t.length<2?e:ts(e,ns(t,0,-1))};const ss=function(e,t){return t=Ao(t,e),null==(e=os(e,t))||delete e[Io(es(t))]};const is=function(e,t){return null==e||ss(e,t)},rs=["subType","from","getAllAdjacentSuggestions","toJSON","removeMarker","next","accept","addMarkerName","head","type","removeAttribute","isMultiRange","nodeBefore","length","_onAttributesChange","data","clear","getContainedElement","previous","_model","onAccept","substr","getFirstRange","isIntersectingWithRange","getMarkerNames","isInContent","_onAccept","getRanges","commentThread","createdAt","removeMarkers","get","isIntersecting","onAttributesChange","setAttribute","set","hasComments","getFirstMarker","onDiscard","suggestion:","addMarker","map","start","author","addRange","_markerNames","_onDiscard","change","getItems","add","filter","split","getMultiRangeId","getMarkers","delete","attributes","push","getRange","nodeAfter","size"];var as,cs;as=rs,cs=210,function(e){for(;--e;)as.push(as.shift())}(++cs);const ls=function(e,t){return rs[e-=0]};class gs{constructor(e,t){this.id=t.id,this[ls("0x27")]=t[ls("0x27")],this.subType=t[ls("0x1e")]||null,this.author=t[ls("0xd")],this[ls("0x2d")]=null,this[ls("0x31")]=e,this[ls("0x38")]=t[ls("0x32")],this[ls("0x10")]=t[ls("0x8")],this._onAttributesChange=t[ls("0x3")],this._markerNames=new Set,this[ls("0x5")]("createdAt",null),this[ls("0x5")](ls("0x19"),t.attributes||{}),this[ls("0x5")](ls("0x30"),null),this[ls("0x5")](ls("0x23"),null),this.set(ls("0x3a"),null),this.set("_saved",!1),this.decorate(ls("0x24")),this.decorate("discard")}get[ls("0x26")](){let e=this;for(;e[ls("0x30")];)e=e[ls("0x30")];return e}get[ls("0x6")](){return!!this[ls("0x3a")]&&this.commentThread[ls("0x2b")]>0}get[ls("0x29")](){return 0!=this._markerNames[ls("0x1d")]&&6==Array[ls("0x1f")](this[ls("0xf")])[0][ls("0x15")](":")[ls("0x2b")]}get[ls("0x37")](){return null!==this.getFirstMarker()}addMarkerName(e){this[ls("0xf")][ls("0x13")](e)}[ls("0x36")](){return Array[ls("0x1f")](this[ls("0xf")])}[ls("0x17")](){return this[ls("0x36")]().map((e=>this[ls("0x31")].markers[ls("0x1")](e)))[ls("0x14")]((e=>e))}getFirstMarker(){return this.getMarkers()[0]||null}[ls("0x0")](){this._model[ls("0x11")]((e=>{for(const t of this[ls("0x17")]())e[ls("0x22")](t)})),this[ls("0xf")][ls("0x2e")]()}[ls("0x22")](e){this[ls("0x31")][ls("0x11")]((t=>{t.removeMarker(e)})),this._markerNames[ls("0x18")](e)}[ls("0xe")](e){const t=ls("0x9")+this[ls("0x27")]+":"+this.subType+":"+this.id+":"+this[ls("0xd")].id+":"+gs.getMultiRangeId();this[ls("0x25")](t),this._model[ls("0x11")]((n=>{n[ls("0xa")](t,{range:e,usingOperation:!0,affectsData:!0})}))}[ls("0x35")](e){for(const t of this[ls("0x39")]())if(t[ls("0x2")](e))return!0;return!1}getRanges(){return this.getMarkers()[ls("0xb")]((e=>e.getRange()))}[ls("0x12")](){return this[ls("0x39")]().reduce(((e,t)=>[...e,...t[ls("0x12")]()]),[])}[ls("0x34")](){return this[ls("0x7")]()[ls("0x1b")]()}[ls("0x2f")](){const e=this[ls("0x39")]();if(1!=e[ls("0x2b")])return null;const t=e[0],n=t[ls("0xc")][ls("0x1c")],o=t.end[ls("0x2a")];return n instanceof r.Element?n!=o?null:n:null}[ls("0x24")](){this._onAccept(this[ls("0x39")](),this[ls("0x2d")],this[ls("0x19")]),this[ls("0x0")]()}discard(){this[ls("0x10")](this[ls("0x39")](),this[ls("0x2d")],this.attributes),this[ls("0x0")]()}[ls("0x20")](){const e=[];let t=this.head;for(;t;)e[ls("0x1a")](t),t=t[ls("0x23")];return e}[ls("0x4")](e,t){const n=ho(this[ls("0x19")]);No(n,e,t),Zo(n,this[ls("0x19")])||(this[ls("0x19")]=n,this[ls("0x2c")](n))}[ls("0x28")](e){const t=ho(this[ls("0x19")]);is(t,e),Zo(t,this.attributes)||(this.attributes=t,this[ls("0x2c")](this[ls("0x19")]))}[ls("0x21")](){return{id:this.id,type:this[ls("0x1e")]?this[ls("0x27")]+":"+this.subType:this[ls("0x27")],authorId:this[ls("0xd")].id,createdAt:this[ls("0x3b")],hasComments:this[ls("0x6")],data:this[ls("0x2d")],attributes:this[ls("0x19")]}}static[ls("0x16")](){return(0,t.uid)()[ls("0x33")](1,5)}}(0,t.mix)(gs,t.ObservableMixin);class us{constructor(e,t){this._customCallbacks=[],this._itemLabels=new Map,this._schema=e,this._locale=t}getDescriptions(e){const t=[];for(let n=0;n<e.length;n++){const o=e[n];if(!o.isInContent)continue;let s=!1;for(const e of this._customCallbacks){const n=e(o);if(n){n.type&&t.push(n),s=!0;break}}if(!s){this._addDescriptionItems(t,o);const s=e[n+1];if(s&&!o.getFirstRange().end.isEqual(s.getFirstRange().start)){const e=t[t.length-1],n="insertion"==o.type?"add":"remove";e&&"text"==e.type&&(e[n]+="\n")}}}return this._resolveDescriptionItems(t)}registerDescriptionCallback(e){this._customCallbacks.push(e)}registerElementLabel(e,t){this._itemLabels.set(e,t)}getItemLabel(e,t=1){const n=this._itemLabels.get(e)||e;return"function"==typeof n?n(t):1!==t?t+" "+n+"s":""+n}_addDescriptionItems(e,t){const n=t.getFirstRange().getWalker(),o="insertion"==t.type?"add":"remove";for(const t of n){const s=t.item,i=e[e.length-1];if(s.is("textProxy"))i&&i.type.indexOf("Container")>-1&&e.pop(),i&&"text"==i.type?i[o]+=s.data:e.push({type:"text",add:"add"==o?s.data:"",remove:"remove"==o?s.data:""});else if(this._schema.isObject(s)){if(i&&i.type.indexOf("Container")>-1&&e.pop(),"elementEnd"==t.type)continue;i&&i.type==o+"Object"&&i.name==s.name?i.quantity++:e.push({type:o+"Object",name:s.name,quantity:1}),n.skip((e=>!("elementEnd"==e.type&&e.item==s)))}else if(this._schema.checkChild(s,"$text")||s.is("element","softBreak")){if("add"==o&&"elementStart"==t.type||"remove"==o&&"elementEnd"==t.type)continue;if(i&&-1==i.type.indexOf("Container")){"text"==i.type&&(i[o]+="\n");continue}let n;if(n="add"==o?s.nextSibling&&!this._schema.isObject(s.nextSibling)?s.nextSibling:null:s.previousSibling&&!this._schema.isObject(s.previousSibling)?s.previousSibling:null,s.isEmpty||n&&n.isEmpty){const t=n&&n.isEmpty?n.name:s.name;i&&i.type==o+"EmptyContainer"&&i.name==t?i.quantity++:e.push({type:o+"EmptyContainer",name:t,quantity:1})}else e.push({type:o+"Container",name:s.name})}}}_resolveDescriptionItems(e){const{t}=this._locale,n=[];for(const o of e){switch(o.type){case"text":if(o.add=o.add.replace(/(\S)\u000A+(\S)/g,"$1 $2").replace(/\u000A/g,""),o.remove=o.remove.replace(/(\S)\u000A+(\S)/g,"$1 $2").replace(/\u000A/g,""),""!=o.add&&""!=o.remove){n.push({type:"replace",content:t({string:"*Replace:* %0 *with* %1",id:"REPLACE_TEXT"},['"'+o.remove+'"','"'+o.add+'"'])});continue}if(null!=o.add.match(/^ +$/)){n.push({type:"insertion",content:t("*Insert:* %0",t({string:"space",plural:"%0 spaces",id:"ELEMENT_SPACE"},o.add.length))});continue}if(null!=o.remove.match(/^ +$/)){n.push({type:"deletion",content:t("*Remove:* %0",t({string:"space",plural:"%0 spaces",id:"ELEMENT_SPACE"},o.remove.length))});continue}if(""!=o.add){n.push({type:"insertion",content:t("*Insert:* %0",'"'+o.add+'"')});continue}n.push({type:"deletion",content:t("*Remove:* %0",'"'+o.remove+'"')});continue;case"addEmptyContainer":case"addObject":n.push({type:"insertion",content:t("*Insert:* %0",this.getItemLabel(o.name,o.quantity))});continue;case"removeEmptyContainer":case"removeObject":n.push({type:"deletion",content:t("*Remove:* %0",this.getItemLabel(o.name,o.quantity))});continue;case"addContainer":n.push({type:"insertion",content:t("*Split:* %0",this.getItemLabel(o.name,o.quantity))});continue;case"removeContainer":n.push({type:"deletion",content:t("*Merge:* %0",this.getItemLabel(o.name,o.quantity))});continue}n.push(o)}return n}}class ds extends e.Plugin{afterInit(){const e=this.editor,{t}=e.locale;if(!e.plugins.has("AlignmentEditing"))return;const n=e.plugins.get("TrackChangesEditing");n.enableCommand("alignment",((t,o={})=>{let s=o.value;o.value||(s="ltr"===e.locale.contentLanguageDirection?"left":"right");const i=Array.from(this.editor.model.document.selection.getSelectedBlocks()).filter((e=>function(e,t,n){const o=e.getAttribute("alignment")||null;return t.checkAttribute(e,"alignment")&&n!=o}(e,this.editor.model.schema,s)));e.model.change((()=>{for(const e of i)n.markBlockFormat(e,{commandName:"alignment",commandParams:[{value:s}]})}))})),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:n}=e;if(n&&"alignment"==n.commandName){const e=n.commandParams[0].value;return{type:"format",content:t("*Format:* %0",function(e){switch(e){case"left":return t({string:"align to left",id:"FORMAT_ALIGN_TO_LEFT"});case"right":return t({string:"align to right",id:"FORMAT_ALIGN_TO_RIGHT"});case"center":return t({string:"align to center",id:"FORMAT_ALIGN_TO_CENTER"});case"justify":return t({string:"justify",id:"FORMAT_JUSTIFY_TEXT"})}}(e))}}}))}}const ms=["isAtEnd","bindElementToMarker","writer","markerRange","toViewElement","type","push","isLimit","addClass","getAttribute","listItem","mapper","ck-suggestion-marker-","model","createUIElement","item","nextSibling","element","plugins","activeMarkers","addHighlight","markerName","getItems","getWalker","includes","toViewPosition","isContent","get","TrackChangesEditing","hasAttribute","insert","isBlock","span","elementEnd","test","schema","listIndent","previousPosition"];var hs,fs;hs=ms,fs=476,function(e){for(;--e;)hs.push(hs.shift())}(++fs);const ps=function(e,t){return ms[e-=0]};function bs(e,t,n){const o=[];for(const s of t[ps("0x2")]())s[ps("0x9")](e)&&o.push(n.createRangeOn(s));return o}function xs(e){const t=[];if(e.is(ps("0x23"),ps("0x1c"))){let n=e[ps("0x22")];for(;n&&n.is(ps("0x23"),ps("0x1c"))&&n[ps("0x1b")](ps("0x10"))>0;)t[ps("0x18")](n),n=n.nextSibling}return t}function ys(e,t,{showActiveMarker:n=!0}={}){const o=e[ps("0x24")][ps("0x7")](ps("0x8"));return(s,i,r)=>{if(!r.consumable[ps("0xe")](i[ps("0x15")],s.name))return;const a=i[ps("0x15")][ps("0x3")](),c=i.markerRange.start,l=e[ps("0x1f")][ps("0xf")];let g=null,u=null,d=!1,m=!1;for(const e of a){const t=e[ps("0x21")];d=d||l[ps("0x6")](t);const n=r[ps("0x1d")][ps("0x16")](t);if(n&&n.getCustomProperty(ps("0x0")))return;ps("0xd")==e[ps("0x17")]&&l[ps("0xb")](t)&&!l[ps("0x19")](t)&&(t.nextSibling||c[ps("0x12")]?g&&g.parent==t||(g=t,h(e[ps("0x11")]),m=!0):u=u||e[ps("0x11")])}function h(e){const s=r[ps("0x14")][ps("0x20")](ps("0xc"),{class:ps("0x1e")+t}),a=r[ps("0x1d")][ps("0x5")](e);n&&o[ps("0x25")][ps("0x4")](i.markerName)&&r[ps("0x14")][ps("0x1a")]("ck-suggestion-marker--active",s),r.writer[ps("0xa")](a,s),r[ps("0x1d")][ps("0x13")](s,i[ps("0x1")])}d||m||!u||h(u)}}const Cs=["BoldEditing","ItalicEditing","UnderlineEditing","CodeEditing","StrikethroughEditing","SubscriptEditing","SuperscriptEditing"];class _s extends e.Plugin{afterInit(){const e=this.editor,t=e.model,n=e.plugins.get("TrackChangesEditing"),{t:o}=e.locale;for(const o of Cs){if(!e.plugins.has(o))continue;const s=o.slice(0,-7).toLowerCase(),i=e.commands.get(s);n.enableCommand(s,((e,o={})=>{const r=t.document.selection;if(r.isCollapsed)return void e(o);const a=void 0!==o.forceValue?o.forceValue:!i.value;t.change((()=>{const e=Array.from(r.getRanges());for(const o of e){const e=a?[o]:bs(s,o,t);for(const t of e)n.markInlineFormat(t,{commandName:s,commandParams:[{forceValue:a}]})}}))}))}function s(e,t){n._descriptionFactory.registerDescriptionCallback((n=>{const{data:s}=n;if(s&&s.commandName===e)return s.commandParams[0].forceValue?{type:"format",content:o("*Format:* %0",t)}:{type:"format",content:o("*Remove format:* %0",t)}}))}s("bold",o({string:"bold",id:"FORMAT_BOLD"})),s("italic",o({string:"italic",id:"FORMAT_ITALIC"})),s("underline",o({string:"underline",id:"FORMAT_UNDERLINE"})),s("code",o({string:"code",id:"FORMAT_CODE"})),s("strikethrough",o({string:"strikethrough",id:"FORMAT_STRIKETHROUGH"})),s("subscript",o({string:"subscript",id:"FORMAT_SUBSCRIPT"})),s("superscript",o({string:"superscript",id:"FORMAT_SUPERSCRIPT"}))}}class ks extends e.Plugin{afterInit(){const e=this.editor,{t}=e.locale;if(!e.plugins.has("BlockQuoteEditing"))return;const n=e.plugins.get("TrackChangesEditing"),o=this.editor.commands.get("blockQuote");n.enableCommand("blockQuote",((t,s={})=>{const i=this.editor.model.document.selection,r=s&&void 0!==s.forceValue?s.forceValue:!o.value;let a=[];if(r){const t=Array.from(i.getSelectedBlocks()).filter((e=>vs(e)||function(e,t){const n=t.checkChild(e.parent,"blockQuote"),o=t.checkChild(["$root","blockQuote"],e);return n&&o}(e,this.editor.model.schema)));a=Es(t,e.model)}else{const t=Array.from(i.getSelectedBlocks()).filter((e=>vs(e)));a=Es(t,e.model)}e.model.change((()=>{for(const e of a)n.markBlockFormat(e,{commandName:"blockQuote",commandParams:[{forceValue:r}]})}))})),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:n}=e;if(n&&"blockQuote"==n.commandName){const e=t({string:"block quote",id:"ELEMENT_BLOCK_QUOTE"});return n.commandParams[0].forceValue?{type:"format",content:t("*Format:* %0",e)}:{type:"format",content:t("*Remove format:* %0",e)}}}))}}function vs(e){return"blockQuote"==e.parent.name}function Es(e,t){let n,o=0;const s=[],i=t.schema;for(;o<e.length;){const r=e[o],a=e[o+1];n||(n=t.createPositionBefore(r)),Ts(t,r,a)||(s.push(t.createRange(n,i.isObject(r)?t.createPositionAfter(r):t.createPositionAt(r,"end"))),n=null),o++}return s}function Ts(e,t,n){if(!n)return!1;const o=e.createPositionAfter(t),s=e.createPositionBefore(n),i=new r.TreeWalker({boundaries:e.createRange(o,s)});for(const t of i)if("text"==t.type||e.schema.isLimit(t.item))return!1;return!0}class Rs extends e.Plugin{afterInit(){const e=this.editor,{t}=e.locale;e.plugins.has("CodeBlock")&&e.plugins.get("TrackChangesEditing")._descriptionFactory.registerElementLabel("codeBlock",(e=>t({string:"code block",plural:"%0 code blocks",id:"ELEMENT_CODE_BLOCK"},e)))}}var Ss,ws,As=["enableCommand","CommentsEditing","get","plugins","requires","editor","addCommentThread","TrackChangesEditing"];Ss=As,ws=195,function(e){for(;--e;)Ss.push(Ss.shift())}(++ws);var Is=function(e,t){return As[e-=0]};class Ms extends e.Plugin{static get[Is("0x1")](){return[Is("0x6")]}init(){this[Is("0x2")][Is("0x0")][Is("0x7")](Is("0x4"))[Is("0x5")](Is("0x3"))}}var Ns=n(181);const Fs=["document","model","init","unlock","high","writer","addMarker:suggestion:deletion","mapper","start","get","markerNameToElements","forward","plugins","createSelection","setSelection","editing","fromRange","buffer","deleteForward","createRange","downcastDispatcher","detach","markerName","$graveyard","delete","removeMarker:suggestion:deletion","enableCommand","selection","batch","modifySelection","lock","getFirstRange","requires","data","options","end","unbindElementFromMarkerName","merge","uiElement"];var Ps,Os;Ps=Fs,Os=210,function(e){for(;--e;)Ps.push(Ps.shift())}(++Os);const Ls=function(e,t){return Fs[e-=0]};class Bs extends e.Plugin{static get[Ls("0x11")](){return[Ns.Delete]}[Ls("0x1a")](){const e=this.editor,t=e[Ls("0x24")][Ls("0x21")]("TrackChangesEditing");t[Ls("0xb")](Ls("0x9"));const n=e.commands[Ls("0x21")]("deleteForward");t[Ls("0xb")](Ls("0x3"),((t,o={})=>{const s=e[Ls("0x19")][Ls("0x25")](e[Ls("0x19")][Ls("0x18")][Ls("0xc")]);s.isCollapsed&&e.model[Ls("0xe")](s,{direction:Ls("0x23"),unit:o.unit});const i=s[Ls("0x10")](),a=r.LiveRange[Ls("0x1")](i);let c;t(o),c=Ls("0x8")==a.root.rootName?e.model[Ls("0x4")](i.start):e[Ls("0x19")].createRange(a[Ls("0x20")],a[Ls("0x14")]),a[Ls("0x6")](),e[Ls("0x19")].enqueueChange(n[Ls("0x2")][Ls("0xd")],(e=>{n[Ls("0x2")][Ls("0xf")](),e[Ls("0x26")](e[Ls("0x4")](c[Ls("0x14")])),n.buffer[Ls("0x1b")]()}))})),e[Ls("0x0")][Ls("0x5")].on(Ls("0x1e"),ys(e,Ls("0x16")),{priority:"high"}),e[Ls("0x12")][Ls("0x5")].on("addMarker:suggestion:deletion",((t,n,o)=>{o[Ls("0x13")].showSuggestionHighlights&&ys(e,Ls("0x16"),{showActiveMarker:!1})(t,n,o)}),{priority:"high"}),e[Ls("0x0")].downcastDispatcher.on(Ls("0xa"),((e,t,n)=>{const o=n[Ls("0x1f")][Ls("0x22")](t[Ls("0x7")]);if(o)for(const e of o)e.is(Ls("0x17"))&&(n.mapper[Ls("0x15")](e,t[Ls("0x7")]),n[Ls("0x1d")].remove(e))}),{priority:Ls("0x1c")})}}var js=n(331);const Ds=["enableCommand","editing","isAtEnd","showSuggestionHighlights","change","get","createRange","requires","isLimit","downcastDispatcher","data","selection","addMarker:suggestion:insertion","start","options","isCollapsed","high","removeMarker:suggestion:insertion","enter","init","end","ck-suggestion-marker-split","parent","model","setSelection","markerName","editor","split","getFirstRange","document","isAtStart","mapper","unbindElementFromMarkerName","schema","markerNameToElements","hasClass","nextSibling"];var Us,Hs;Us=Ds,Hs=336,function(e){for(;--e;)Us.push(Us.shift())}(++Hs);const Vs=function(e,t){return Ds[e-=0]};class zs extends e.Plugin{static get[Vs("0x4")](){return[js.Enter]}[Vs("0x10")](){const e=this[Vs("0x17")],t=e.plugins[Vs("0x2")]("TrackChangesEditing");t[Vs("0x22")](Vs("0xf"),(n=>{e[Vs("0x14")][Vs("0x1")]((o=>{const s=e[Vs("0x14")][Vs("0x1a")][Vs("0x8")],i=s.getFirstPosition(),a=s[Vs("0xc")],c=r.LiveRange.fromRange(s[Vs("0x19")]()),l=c[Vs("0xa")].parent,g=c[Vs("0x11")].parent,u=!(c[Vs("0xa")][Vs("0x1b")]&&c[Vs("0x11")][Vs("0x24")]),d=l==g,m=!(e[Vs("0x14")][Vs("0x1e")][Vs("0x5")](l)||e[Vs("0x14")][Vs("0x1e")][Vs("0x5")](g))&&(a||u&&d);if(n(),m){const n=e[Vs("0x14")].createPositionAt(i[Vs("0x13")][Vs("0x21")],0),s=o[Vs("0x3")](i,n);t.markInsertion(s)}else o[Vs("0x15")](o[Vs("0x3")](c[Vs("0x11")]));c.detach()}))})),e[Vs("0x23")][Vs("0x6")].on(Vs("0x9"),ys(e,Vs("0x18")),{priority:Vs("0xd")}),e[Vs("0x23")][Vs("0x6")].on(Vs("0xe"),((e,t,n)=>{const o=n[Vs("0x1c")][Vs("0x1f")](t[Vs("0x16")]);if(o)for(const e of o)e[Vs("0x20")](Vs("0x12"))&&(n[Vs("0x1c")][Vs("0x1d")](e,t[Vs("0x16")]),n.writer.remove(e))}),{priority:"high"}),e[Vs("0x7")][Vs("0x6")].on(Vs("0x9"),((t,n,o)=>{o[Vs("0xb")][Vs("0x0")]&&ys(e,Vs("0x18"),{showActiveMarker:!1})(t,n,o)}),{priority:"high"})}}const Gs=[{pluginName:"FontSizeEditing",commandName:"fontSize"},{pluginName:"FontFamilyEditing",commandName:"fontFamily"},{pluginName:"FontColorEditing",commandName:"fontColor"},{pluginName:"FontBackgroundColorEditing",commandName:"fontBackgroundColor"}];class Ws extends e.Plugin{afterInit(){const{t:e}=this.editor.locale;for(const{pluginName:e,commandName:t}of Gs)this.editor.plugins.has(e)&&this._enableCommand(t);this.editor.plugins.get("TrackChangesEditing")._descriptionFactory.registerDescriptionCallback((t=>{const{data:n}=t;if(null!=n){if("fontSize"==n.commandName){const t=n.commandParams[0].value;if(t){const n=this.editor.plugins.get("FontSize").normalizeSizeOptions(this.editor.config.get("fontSize.options")).find((e=>e.model==t)).title,o=this.editor.locale._t(n).toLowerCase();return{type:"format",content:e("*Set font size:* %0",o)}}return{type:"format",content:e("*Reset font size*")}}if("fontFamily"==n.commandName){const t=n.commandParams[0].value;return t?{type:"format",content:e("*Set font family:* %0",t)}:{type:"format",content:e("*Reset font family*")}}if("fontColor"==n.commandName){const t=n.commandParams[0].value;if(t){const n=(0,s.normalizeColorOptions)(this.editor.config.get("fontColor.colors")).find((e=>e.model==t));let o=t,i="";return n&&(o=n.label,i=this.editor.locale._t(o).toLowerCase()),{type:"format",content:e("*Set font color:* %0",i).trim(),color:{value:t,title:i||o}}}return{type:"format",content:e("*Reset font color*")}}if("fontBackgroundColor"==n.commandName){const t=n.commandParams[0].value;if(t){const n=(0,s.normalizeColorOptions)(this.editor.config.get("fontBackgroundColor.colors")).find((e=>e.model==t));let o=t,i="";return n&&(o=n.label,i=this.editor.locale._t(o).toLowerCase()),{type:"format",content:e("*Set font background color:* %0",i).trim(),color:{value:t,title:i||o}}}return{type:"format",content:e("*Reset font background color*")}}}}))}_enableCommand(e){const t=this.editor;t.plugins.get("TrackChangesEditing").enableCommand(e,((n,o={})=>{const s=t.model.document.selection,i=o.value;s.isCollapsed?n(o):t.model.change((()=>{const n=Array.from(s.getRanges());for(const o of n){const n=i?[o]:bs(e,o,t.model);for(const o of n)t.plugins.get("TrackChangesEditing").markInlineFormat(o,{commandName:e,commandParams:[{value:i}]})}}))}))}}class qs extends e.Plugin{afterInit(){const e=this.editor,{t}=e.locale,n=e.config.get("heading.options");if(!e.plugins.has("HeadingEditing"))return;const o=e.plugins.get("TrackChangesEditing");o.enableCommand("heading",((t,n)=>{const s=n.value,i=Array.from(this.editor.model.document.selection.getSelectedBlocks()).filter((e=>{return t=e,n=s,(o=this.editor.model.schema).checkChild(t.parent,n)&&!o.isObject(t)&&t.name!=n;var t,n,o}));e.model.change((()=>{for(const e of i)o.markBlockFormat(e,{commandName:"heading",commandParams:[n],formatGroupId:"blockName"},xs(e))}))}));for(const e of n)"paragraph"!=e.model&&o._descriptionFactory.registerElementLabel(e.model,(t=>{const n=$s(e.model);return null!==n?s(t,n):i(t,e.title)}));function s(e,n){return t({string:"heading (level %1)",plural:"%0 headings (level %1)",id:"ELEMENT_HEADING"},[e,n])}function i(e,n){return t({string:"heading (%1)",plural:"%0 headings (%1)",id:"ELEMENT_HEADING_CUSTOM"},[e,n])}o._descriptionFactory.registerDescriptionCallback((e=>{const{type:o,data:r}=e;if("formatBlock"==o&&r&&"heading"==r.commandName){const e=r.commandParams[0].value,o=$s(e);if(null!==o)return{type:"format",content:t("*Change to:* %0",s(1,o))};const a=n.find((t=>t.model===e)).title;return{type:"format",content:t("*Change to:* %0",i(1,a))}}}))}}function $s(e){const t=e.match(/^heading(\d+)$/);return t?t[1]:null}class Ks extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("HighlightEditing"))return;const t=e.plugins.get("TrackChangesEditing");t.enableCommand("highlight",((n,o={})=>{const s=e.model.document.selection,i=s.getAttribute("highlight");let r=o.value,a=[];if(s.isCollapsed){const t=s.getFirstPosition();if(!s.hasAttribute("highlight"))return void n(o);{const n=e=>e.item.getAttribute("highlight")===i,o=t.getLastMatchingPosition(n,{direction:"backward"}),s=t.getLastMatchingPosition(n);a=[e.model.createRange(o,s)],r==i&&(r=null)}}else for(const t of s.getRanges())r?a.push(t):a.push(...bs("highlight",t,e.model));e.model.change((()=>{for(const e of a)t.markInlineFormat(e,{commandName:"highlight",commandParams:[{value:r}]})}))}));const{t:n}=e.locale;t._descriptionFactory.registerDescriptionCallback((t=>{const{type:o,data:s}=t;if("formatInline"==o&&s&&"highlight"==s.commandName){const t=s.commandParams[0].value;if(t){const o=e.config.get("highlight.options").find((e=>e.model==t)),s=e.locale._t(o.title).toLowerCase();return{type:"format",content:n("*Set highlight:* %0",s),color:{value:o.color,title:o.title}}}return{type:"format",content:n("*Remove highlight*",n({string:"highlight",id:"FORMAT_HIGHLIGHT"}))}}}))}}class Xs extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("HorizontalLineEditing"))return;e.plugins.get("TrackChangesEditing").enableCommand("horizontalLine");const t=e.plugins.get("TrackChangesEditing"),{t:n}=e.locale;t._descriptionFactory.registerElementLabel("horizontalLine",(e=>n({string:"horizontal line",plural:"%0 horizontal lines",id:"ELEMENT_HORIZONTAL_LINE"},e))),e.conversion.for("dataDowncast").elementToStructure({model:"horizontalLine",view:(e,{writer:t,options:n})=>{if(!n.showSuggestionHighlights)return;const o=t.createContainerElement("div"),s=t.createEmptyElement("hr");return t.addClass("ck-horizontal-line",o),t.insert(t.createPositionAt(o,0),s),o},converterPriority:"high"})}}class Qs extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("ImageEditing"))return;const n=e.plugins.get("TrackChangesEditing"),o=e.plugins.get("ImageUtils"),s={},{t:i}=e.locale;if(n.enableCommand("insertImage"),n._descriptionFactory.registerElementLabel("imageBlock",(e=>i({string:"image",plural:"%0 images",id:"ELEMENT_IMAGE"},e))),n._descriptionFactory.registerElementLabel("imageInline",(e=>i({string:"image",plural:"%0 images",id:"ELEMENT_INLINE_IMAGE"},e))),n._descriptionFactory.registerElementLabel("caption",i({string:"caption",id:"ELEMENT_CAPTION"})),e.plugins.has("ImageUploadEditing")&&n.enableCommand("uploadImage"),e.plugins.has("ImageBlockEditing")&&e.plugins.has("ImageInlineEditing")&&(n.enableCommand("imageTypeInline",((t,s)=>{const i=o.getClosestSelectedImageElement(e.model.document.selection);e.model.change((()=>{n.markBlockFormat(i,{commandName:"imageTypeInline",commandParams:[s]},[],"convertBlockImageToInline")}))})),n.enableCommand("imageTypeBlock",((t,s)=>{e.model.change((i=>{let a=o.getClosestSelectedImageElement(e.model.document.selection),c=i.createRangeOn(a);const l=r.LivePosition.fromPosition(c.start,"toPrevious"),g=r.LivePosition.fromPosition(c.end,"toNext");n.forceDefaultExecution((()=>t(s))),a=o.getClosestSelectedImageElement(e.model.document.selection),c=i.createRangeOn(a);const u=i.createRange(l,g);l.detach(),g.detach(),n.markBlockFormat(a,{commandName:"imageTypeInline"},[],"convertInlineImageToBlock"),u.start.isBefore(c.start)&&n.markInsertion(i.createRange(u.start,c.start),"convertInlineImageToBlock"),c.end.isBefore(u.end)&&n.markInsertion(i.createRange(c.end,u.end),"convertInlineImageToBlock")}))})),n._suggestionFactory.registerCustomCallback("formatBlock","convertInlineImageToBlock","join",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","convertInlineImageToBlock","accept",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","convertInlineImageToBlock","discard",n._suggestionFactory.getSuggestionCallback("formatBlock","","accept")),n._suggestionFactory.registerCustomCallback("insertion","convertInlineImageToBlock","join",(()=>{})),n._suggestionFactory.registerCustomCallback("insertion","convertInlineImageToBlock","discard",(([t])=>{const o=n._suggestionFactory.getSuggestionCallback("insertion","","discard");let s=t.start,i=t.end;const r=e.model.schema.getNearestSelectionRange(s,"backward"),a=e.model.schema.getNearestSelectionRange(i,"forward");r.isCollapsed&&(s=r.start),a.isCollapsed&&(i=a.end),o([e.model.createRange(s,i)])})),n._suggestionFactory.registerCustomCallback("formatBlock","convertInlineImageToBlock","chain",l),n._suggestionFactory.registerCustomCallback("insertion","convertInlineImageToBlock","chain",l)),e.plugins.has("ImageCaptionEditing")&&(n.enableCommand("toggleImageCaption",((t,s)=>{const i=e.plugins.get("ImageCaptionUtils");let r=o.getClosestSelectedImageElement(e.model.document.selection),a=i.getCaptionFromImageModelElement(r);e.model.change((()=>{if(a)return void n.markDeletion(e.model.createRangeOn(a));const c=o.isBlockImage(r);t(s),r=o.getClosestSelectedImageElement(e.model.document.selection),a=i.getCaptionFromImageModelElement(r),n.markInsertion(e.model.createRangeOn(a),c?null:"imageCaption")}))})),n._suggestionFactory.registerCustomCallback("insertion","imageCaption","chain",l)),e.plugins.has("ImageStyleEditing")){n.enableCommand("imageStyle",((s,i)=>{const r=e.plugins.get("Users").me,a=e.commands.get("imageStyle");let c=o.getClosestSelectedImageElement(e.model.document.selection),l=e.model.createRangeOn(c),g=a.value;if(g==i.value)return;const u={commandName:"imageStyle",commandParams:[i],formatGroupId:(0,t.uid)()};e.model.change((()=>{if(n.getSuggestions().filter((e=>e.isInContent&&r==e.author&&("formatBlock"==e.type||"formatInline"==e.type)&&("imageStylePreApply"==e.subType||"imageStylePostApply"==e.subType)&&e.getFirstRange().isEqual(l))).forEach((e=>n.discardSuggestion(e.head))),c=o.getClosestSelectedImageElement(e.model.document.selection),l=e.model.createRangeOn(c),a.refresh(),e.commands.get("imageTypeInline").refresh(),e.commands.get("imageTypeBlock").refresh(),g=a.value,g!=i.value)return o.isInlineImage(c)&&a.shouldConvertImageType(i.value,c)?(s(i),c=o.getClosestSelectedImageElement(e.model.document.selection),void n.markBlockFormat(c,{...u,commandReversedParams:[{value:g||null}]},[],"imageStylePreApply")):void(o.isBlockImage(c)?n.markBlockFormat(c,u,[],"imageStylePostApply"):n.markInlineFormat(l,u,"imageStylePostApply"))}))}));for(const t of e.plugins.get("ImageStyleEditing").normalizedStyles)s[t.name]=t.title.toLowerCase();n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePreApply","join",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePostApply","join",(()=>{})),n._suggestionFactory.registerCustomCallback("formatInline","imageStylePostApply","join",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePreApply","accept",(()=>{})),n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePreApply","discard",((e,t)=>{n._suggestionFactory.getSuggestionCallback("formatBlock","","accept")(e,{commandName:t.commandName,commandParams:t.commandReversedParams})})),n._suggestionFactory.registerCustomCallback("formatBlock","imageStylePreApply","chain",l)}const a=[{type:"formatBlock",subType:"imageStylePreApply"},{type:"insertion",subType:"imageCaption"},{type:"formatBlock",subType:"convertInlineImageToBlock"},{type:"insertion",subType:"convertInlineImageToBlock"}];function c(e,t){const s=a.findIndex((({type:t,subType:n})=>e.type==t&&e.subType==n)),i=a.findIndex((({type:e,subType:n})=>t.type==e&&t.subType==n));if(s<0||i<0)return!1;const r=e.getFirstRange(),c=t.getFirstRange();if((0==s||1==s)&&2==i&&r.isIntersecting(c))return!0;if(2==s&&3==i){const e=n._findSuggestions(r,"insertion").filter((({suggestion:e,meta:t})=>t.isOwn&&"convertInlineImageToBlock"==e.subType));if(e.length>1&&c.end.isEqual(r.start))return!0;if(1==e.length&&(r.start.isEqual(c.end)||r.end.isEqual(c.start)))return!0}if(3==s&&3==i&&r.start.isBefore(c.start)){const e=r.end.nodeAfter,t=c.start.nodeBefore;return o.isBlockImage(e)&&e===t}return!1}function l(e,t){return c(e,t)?[e,t]:c(t,e)?[t,e]:null}e.model.document.registerPostFixer((()=>{let t=!1;const s=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:e,data:i}of s){const{group:s,type:r,subType:a,id:c}=n._splitMarkerName(e);if("suggestion"==s&&n.hasSuggestion(c)){if("formatBlock"==r&&("imageStylePreApply"==a||"imageStylePostApply"==a)){const e=n.getSuggestion(c);if(i.newRange){const s=e.getFirstRange().getContainedElement();if(o.isBlockImage(s))continue;n.discardSuggestion(e),t=!0}}if("insertion"==r&&"imageCaption"==a&&!i.newRange){const e=n.getSuggestion(c);e.next&&e.next.isInContent&&(n.discardSuggestion(e.next),t=!0)}}}return t})),e.plugins.has("ImageResize")&&n.enableCommand("resizeImage",((t,s)=>{const i=o.getClosestSelectedImageElement(e.model.document.selection);i.getAttribute("width")!=s.width&&e.model.change((()=>{n.markBlockFormat(i,{commandName:"resizeImage",commandParams:[s]})}))})),e.plugins.has("ImageTextAlternativeEditing")&&n.enableCommand("imageTextAlternative",((t,s)=>{const i=o.getClosestSelectedImageElement(e.model.document.selection);(i.hasAttribute("alt")?i.getAttribute("alt"):"")!=s.newValue&&e.model.change((()=>{n.markBlockFormat(i,{commandName:"imageTextAlternative",commandParams:[s]})}))})),n._descriptionFactory.registerDescriptionCallback((e=>{if(a.find((({type:t,subType:n})=>e.type==t&&e.subType==n)))return e.previous?{}:void 0})),n._descriptionFactory.registerDescriptionCallback((e=>{if("insertion"==e.type||"deletion"==e.type){const t=e.getContainedElement();if(t&&t.is("element","caption"))return{type:"insertion"==e.type?"addObject":"removeObject",name:t.name,quantity:1}}})),n._descriptionFactory.registerDescriptionCallback((e=>"formatBlock"==e.type&&"convertInlineImageToBlock"==e.subType?{type:"format",content:"Inline image to block image"}:"formatBlock"==e.type&&"convertBlockImageToInline"==e.subType?{type:"format",content:"Block image to inline image"}:void 0)),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t){if("imageStyle"==t.commandName){const e=t.commandParams[0].value;return n="side"===e?i({string:"side image",id:"FORMAT_SIDE_IMAGE"}):s[e]||e,{type:"format",content:i("*Format:* %0",n)}}if("imageTextAlternative"==t.commandName){const e=t.commandParams[0].newValue;return e?{type:"format",content:i("*Set image text alternative:* %0",'"'+e+'"')}:{type:"format",content:i("*Remove image text alternative*")}}if("resizeImage"==t.commandName){const e=t.commandParams[0].width;return e?{type:"format",content:i("*Set image width:* %0",e)}:{type:"format",content:i("*Reset image width*")}}}var n}))}}class Js extends e.Plugin{afterInit(){const e=this.editor,t=e.plugins.get("TrackChangesEditing");e.plugins.has("IndentEditing")&&(t.enableCommand("indent"),t.enableCommand("outdent"));const{t:n}=e.locale;if(e.plugins.has("IndentBlock")){for(const n of["indentBlock","outdentBlock"])t.enableCommand(n,(()=>{const o=Array.from(this.editor.model.document.selection.getSelectedBlocks()).filter((e=>this.editor.model.schema.checkAttribute(e,"blockIndent")));e.model.change((()=>{for(const e of o)t.markBlockFormat(e,{commandName:n,commandParams:[{value:""}],formatGroupId:"indentBlock"})}))}));t._descriptionFactory.registerDescriptionCallback((e=>{const{data:o}=e;if(!o)return;if("indentBlock"!=o.commandName&&"outdentBlock"!=o.commandName)return;const s=e.getItems()[0],i=t._descriptionFactory.getItemLabel(s.name);return"indentBlock"==o.commandName?{type:"format",content:n("*Indent:* %0",i)}:"outdentBlock"==o.commandName?{type:"format",content:n("*Outdent:* %0",i)}:void 0}))}}}var Ys,Zs,ei=["TrackChangesEditing","init","input","editor","plugins","enableCommand","get"];Ys=ei,Zs=250,function(e){for(;--e;)Ys.push(Ys.shift())}(++Zs);var ti=function(e,t){return ei[e-=0]};class ni extends e.Plugin{static get requires(){return[Ns.Input]}[ti("0x3")](){this[ti("0x5")][ti("0x6")][ti("0x1")](ti("0x2"))[ti("0x0")](ti("0x4"))}}class oi extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("LinkEditing"))return;const t=e.plugins.get("TrackChangesEditing");t.enableCommand("link",((n,o)=>{const s=e.model.document.selection;let i=[];if(s.isCollapsed){if(!s.hasAttribute("linkHref"))return void n(o);{const t=(0,Ns.findAttributeRange)(s.getFirstPosition(),"linkHref",s.getAttribute("linkHref"),e.model);i=[t]}}else i=Array.from(s.getRanges());e.model.change((()=>{for(const e of i)t.markInlineFormat(e,{commandName:"link",commandParams:[o]})}))})),t.enableCommand("unlink",(()=>{const n=this.editor.model,o=n.document.selection;n.change((()=>{let n=[];n=o.isCollapsed?[(0,Ns.findAttributeRange)(o.getFirstPosition(),"linkHref",o.getAttribute("linkHref"),e.model)]:bs("linkHref",o.getFirstRange(),e.model);for(const e of n)t.markInlineFormat(e,{commandName:"unlink",commandParams:[]})}))})),t._descriptionFactory.registerDescriptionCallback((t=>{const{data:n}=t,{t:o}=e.locale;if(n)return"link"==n.commandName?{type:"format",content:o("*Set link:* %0",'"'+n.commandParams[0]+'"')}:"unlink"==n.commandName?{type:"format",content:o("*Remove link*")}:void 0}))}}class si extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const t=e.plugins.get("TrackChangesEditing"),n=e.plugins.has("TodoListEditing");function o(n){return()=>{const o=e.model.document.selection,s=e.commands.get(n);if(s.value)return void e.execute("paragraph",{});const i=n.slice(0,-4),r=function(e,t,n){let o=Array.from(e).filter((e=>{return t=e,(o=n).checkChild(t.parent,"listItem")&&!o.isObject(t);var t,o}));o=o.filter((e=>!e.is("element","listItem")||e.getAttribute("listType")!=t));const s=new Set;for(const e of o)e.is("element","listItem")?s.add(ii(e)):s.add(e);return Array.from(s)}(o.getSelectedBlocks(),i,e.model.schema);e.model.change((()=>{for(const e of r)t.markBlockFormat(e,{commandName:n,commandParams:[{forceValue:!s.value}],formatGroupId:"blockName"},ri(e))}))}}function s(n){return()=>{const o=function(e){const t=(e=Array.from(e)).findIndex((e=>"listItem"!=e.name));return t>-1&&(e=e.slice(0,t)),e}(e.model.document.selection.getSelectedBlocks()),s=e.model.createRange(e.model.createPositionAt(o[0],"before"),e.model.createPositionAt(o[o.length-1],"end"));e.model.change((()=>{t.markBlockFormat(s,{commandName:n,commandParams:[],formatGroupId:"listIndent"},function(e){const t=new Set;for(const n of e){let e=n.nextSibling;for(;e&&e.getAttribute("listIndent")>n.getAttribute("listIndent");)t.add(e),e=e.nextSibling}return Array.from(t)}(o))}))}}t.enableCommand("numberedList",o("numberedList")),t.enableCommand("bulletedList",o("bulletedList")),n&&t.enableCommand("todoList",o("todoList")),t.enableCommand("indentList",s("indentList")),t.enableCommand("outdentList",s("outdentList")),n&&t.enableCommand("checkTodoList",(()=>{const n=e.commands.get("checkTodoList"),o=Array.from(n._selectedElements);o.filter((e=>e.getAttribute("todoListChecked")!=n.value)),e.model.change((()=>{for(const e of o)t.markBlockFormat(e,{commandName:"checkTodoList",commandParams:[{forceValue:!n.value}]})}))}));const{t:i}=e.locale;t._descriptionFactory.registerElementLabel("listItem",(e=>i({string:"list item",plural:"%0 list items",id:"ELEMENT_LIST_ITEM"},e))),t._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t){if("numberedList"==t.commandName||"bulletedList"==t.commandName||"todoList"==t.commandName)switch(t.commandName.replace("List","")){case"bulleted":return n(i({string:"bulleted list",id:"ELEMENT_BULLETED_LIST"}));case"numbered":return n(i({string:"numbered list",id:"ELEMENT_NUMBERED_LIST"}));case"todo":return n(i({string:"to-do list",id:"ELEMENT_TODO_LIST"}))}if("indentList"==t.commandName)return{type:"format",content:i("*Indent:* %0",i({string:"list item",id:"ELEMENT_LIST_ITEM"}))};if("outdentList"==t.commandName)return{type:"format",content:i("*Outdent:* %0",i({string:"list item",id:"ELEMENT_LIST_ITEM"}))};if("checkTodoList"==t.commandName)return t.commandParams[0].forceValue?{type:"format",content:i("*Check item*")}:{type:"format",content:i("*Uncheck item*")}}function n(e){return{type:"format",content:i("*Change to:* %0",e)}}}))}}function ii(e){const t=e.getAttribute("listIndent");if(0==t)return e;let n=e;for(;e.previousSibling&&e.previousSibling.is("element","listItem");){const o=e.previousSibling.getAttribute("listIndent");if(o==t)n=e.previousSibling;else if(o<t)break;e=e.previousSibling}return n}function ri(e){const t=[];if(e.is("element","listItem")&&e.getAttribute("listIndent")>0){let n=e.nextSibling;for(;n&&"listItem"==n.name&&n.getAttribute("listIndent")==e.getAttribute("listIndent");)t.push(n),n=n.nextSibling}return t}class ai extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("MediaEmbedEditing"))return;const t=e.plugins.get("TrackChangesEditing"),{t:n}=e.locale;t.enableCommand("mediaEmbed"),t._descriptionFactory.registerElementLabel("media",(e=>n({string:"media item",plural:"%0 media items",id:"ELEMENT_MEDIA"},e))),e.conversion.for("dataDowncast").elementToElement({model:"media",view:(e,{writer:t,options:n})=>{if(n.showSuggestionHighlights)return t.createEmptyElement("div")},converterPriority:"high"}),e.data.downcastDispatcher.on("attribute:url:media",((e,t,n)=>{n.options.showSuggestionHighlights&&e.stop()}),{priority:"high"})}}const ci=["editor","afterInit","MentionEditing","TrackChangesEditing","plugins","has","mention","get"];var li,gi;li=ci,gi=215,function(e){for(;--e;)li.push(li.shift())}(++gi);const ui=function(e,t){return ci[e-=0]};class di extends e.Plugin{[ui("0x2")](){const e=this[ui("0x1")];e[ui("0x5")][ui("0x6")](ui("0x3"))&&e[ui("0x5")][ui("0x0")](ui("0x4")).enableCommand(ui("0x7"))}}class mi extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("PageBreakEditing"))return;e.plugins.get("TrackChangesEditing").enableCommand("pageBreak");const t=e.plugins.get("TrackChangesEditing"),{t:n}=e.locale;t._descriptionFactory.registerElementLabel("pageBreak",(e=>n({string:"page break",plural:"%0 page breaks",id:"ELEMENT_PAGE_BREAK"},e)))}}class hi extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("Paragraph"))return;const{t}=e.locale,n=e.plugins.get("TrackChangesEditing");n._descriptionFactory.registerElementLabel("paragraph",(e=>t({string:"paragraph",plural:"%0 paragraphs",id:"ELEMENT_PARAGRAPH"},e))),n.enableCommand("paragraph",((t,o={})=>{const s=e.model.document,i=o.selection||s.selection,r=Array.from(i.getSelectedBlocks()).filter((e=>{return t=e,(n=this.editor.model.schema).checkChild(t.parent,"paragraph")&&!n.isObject(t)&&"paragraph"!=t.name;var t,n}));e.model.change((()=>{for(const e of r)n.markBlockFormat(e,{commandName:"paragraph",commandParams:[],formatGroupId:"blockName"},xs(e))}))})),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:n}=e;if(n&&"paragraph"==n.commandName)return{type:"format",content:t("*Change to:* %0",t({string:"paragraph",plural:"%0 paragraphs",id:"ELEMENT_PARAGRAPH"}))}})),n.enableCommand("insertParagraph"),e.editing.downcastDispatcher.on("addMarker:suggestion:insertion",fi(e),{priority:"highest"}),e.data.downcastDispatcher.on("addMarker:suggestion:insertion",((t,n,o)=>{o.options.showSuggestionHighlights&&fi(e,{showActiveMarker:!1})(t,n,o)}),{priority:"highest"});const o=n._descriptionFactory;o.registerDescriptionCallback((n=>{if("insertion"!==n.type)return;const{start:s,end:i}=n.getFirstRange();if(!s.isTouching(i)||!s.nodeAfter)return;const r=e.model.schema,a=s.nodeAfter;return r.isBlock(a)&&!r.isLimit(a)&&r.checkChild(a,"$text")?{type:"insertion",content:t("*Insert:* %0",o.getItemLabel(a.name,1))}:void 0}))}}function fi(e,{showActiveMarker:t=!0}={}){return(n,o,s)=>{const i=e.plugins.get("TrackChangesEditing"),r=o.markerRange.start,a=o.markerRange.end,c=e.model.schema;if(!r.isTouching(a)||!r.nodeAfter)return;const l=r.nodeAfter;if(c.isBlock(l)&&!c.isLimit(l)&&c.checkChild(l,"$text")){if(!s.consumable.consume(o.markerRange,n.name))return;const e=s.writer.createUIElement("span",{class:"ck-suggestion-marker-split"}),r=s.mapper.toViewPosition(a);t&&i.activeMarkers.includes(o.markerName)&&s.writer.addClass("ck-suggestion-marker--active",e),s.writer.insert(r,e),s.mapper.bindElementToMarker(e,o.markerName)}}}class pi extends e.Plugin{afterInit(){const e=this.editor;if(!e.plugins.has("RemoveFormatEditing"))return;const t=e.plugins.get("TrackChangesEditing");t.enableCommand("removeFormat",(n=>{const o=e.model.document.selection;o.isCollapsed?n():e.model.change((()=>{const n=Array.from(o.getRanges());for(const o of n)for(const n of o.getItems())bi(n,e.model.schema)&&t.markInlineFormat(e.model.createRangeOn(n),{commandName:"removeFormat",commandParams:[]})}))}));const{t:n}=e.locale;t._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t&&"removeFormat"==t.commandName)return{type:"format",content:n("*Remove all formatting*")}}))}}function bi(e,t){for(const[n]of e.getAttributes()){const e=t.getAttributeProperties(n);if(e&&e.isFormatting)return!0}return!1}const xi=["discardSelectedSuggestions","TrackChangesEditing","goToPreviousRestrictedEditingException","editor","enableCommand","acceptSelectedSuggestions","acceptSuggestion","discardSuggestion","trackChanges","afterInit","acceptAllSuggestions","plugins","has","get","RestrictedEditingModeEditing"];var yi,Ci;yi=xi,Ci=139,function(e){for(;--e;)yi.push(yi.shift())}(++Ci);const _i=function(e,t){return xi[e-=0]};class ki extends e.Plugin{[_i("0x5")](){const e=this[_i("0xe")];if(!e[_i("0x7")][_i("0x8")](_i("0xa")))return;const t=e[_i("0x7")][_i("0x9")](_i("0xc"));t.enableCommand(_i("0xd")),t[_i("0x0")]("goToNextRestrictedEditingException");const n=e[_i("0x7")][_i("0x9")]("RestrictedEditingModeEditing");n[_i("0x0")](_i("0x4")),n[_i("0x0")](_i("0x2")),n[_i("0x0")](_i("0x3")),n.enableCommand(_i("0x6")),n.enableCommand("discardAllSuggestions"),n.enableCommand(_i("0x1")),n[_i("0x0")](_i("0xb"))}}class vi extends e.Plugin{static get requires(){return[js.ShiftEnter]}init(){const e=this.editor,t=e.plugins.get("TrackChangesEditing"),n=e.t;t.enableCommand("shiftEnter"),e.editing.downcastDispatcher.on("addMarker:suggestion:insertion",Ei(e),{priority:"high"}),e.editing.downcastDispatcher.on("addMarker:suggestion:deletion",Ei(e),{priority:"high"}),e.data.downcastDispatcher.on("addMarker:suggestion",((t,n,o)=>{o.options.showSuggestionHighlights&&Ei(e,{showActiveMarker:!1})(t,n,o)})),t._descriptionFactory.registerElementLabel("softBreak",(e=>n({id:"ELEMENT_LINE_BREAK",string:"line break",plural:"%0 line breaks"},e)))}}function Ei(e,{showActiveMarker:t=!0}={}){return(n,o,s)=>{const i=e.plugins.get("TrackChangesEditing");if(!s.consumable.test(o.markerRange,n.name))return;const r=e.model;for(const e of o.markerRange.getItems()){if(!e.is("element","softBreak"))continue;const n="deletion"==o.markerName.split(":")[1]?"merge":"split",a=s.writer.createUIElement("span",{class:"ck-suggestion-marker-"+n}),c=s.mapper.toViewPosition(r.createPositionBefore(e));t&&i.activeMarkers.includes(o.markerName)&&s.writer.addClass("ck-suggestion-marker--active",a),s.writer.insert(c,a),s.mapper.bindElementToMarker(a,o.markerName)}}}class Ti extends e.Plugin{afterInit(){const e=this.editor,t=e.model;if(!e.plugins.has("StandardEditingModeEditing"))return;const n=e.plugins.get("TrackChangesEditing"),o="restrictedEditingException",s=e.commands.get(o);n.enableCommand(o,((e,i={})=>{const r=t.document.selection;if(r.isCollapsed)return void e(i);const a=void 0!==i.forceValue?i.forceValue:!s.value;t.change((()=>{const e=Array.from(r.getRanges());for(const s of e){const e=a?[s]:bs(o,s,t);for(const t of e)n.markInlineFormat(t,{commandName:o,commandParams:[{forceValue:a}]})}}))}));const i=e.t;n._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t&&t.commandName==o)return t.commandParams[0].forceValue?{type:"format",content:i({string:"*Enable in restricted editing mode*",id:"FORMAT_RESTRICTED_ENABLED"})}:{type:"format",content:i({string:"*Disable in restricted editing mode*",id:"FORMAT_RESTRICTED_DISABLED"})}}))}}class Ri extends e.Plugin{constructor(e){super(e),this._tablePostFixingSubtypes=["tableRow","tableColumn"]}afterInit(){const e=this.editor,t=e.model.document.selection;if(!e.plugins.has("TableEditing"))return;const{t:n}=e.locale,o=e.plugins.get("TrackChangesEditing"),s=e.plugins.get("TableUtils");o._descriptionFactory.registerElementLabel("table",(e=>n({string:"table",plural:"%0 tables",id:"ELEMENT_TABLE"},e))),this._setupColumnsRowsFixing(),o.enableCommand("insertTable"),o.enableCommand("selectTableRow"),o.enableCommand("selectTableColumn");for(const n of["insertTableRowAbove","insertTableRowBelow"]){const i=e.commands.get(n);o.enableCommand(n,(n=>{e.model.change((e=>{n();const r="above"===i.order,a=s.getSelectionAffectedTableCells(t),c=s.getRowIndexes(a),l=r?c.first-1:c.last+1,g=a[0].findAncestor("table"),u=s.createTableWalker(g,{startRow:l,endRow:l}),d=Array.from(u).map((t=>e.createRangeOn(t.cell)));o.markMultiRangeInsertion(d,"tableRow")}))}))}for(const n of["insertTableColumnLeft","insertTableColumnRight"]){const i=e.commands.get(n);o.enableCommand(n,(n=>{e.model.change((e=>{n();const r="left"===i.order,a=s.getSelectionAffectedTableCells(t),c=s.getColumnIndexes(a),l=r?c.first-1:c.last+1,g=a[0].findAncestor("table"),u=s.createTableWalker(g,{startRow:0,column:l,includeAllSlots:!1}),d=Array.from(u).map((t=>e.createRangeOn(t.cell)));o.markMultiRangeInsertion(d,"tableColumn")}))}))}for(const n of["removeTableRow","removeTableColumn"]){const i=n.substr(11),r=i.toLowerCase(),a=r.substr(0,3)+"span",c="table"+i,l="min"+i,g="max"+i;o.enableCommand(n,(()=>{e.model.change((e=>{const i=s.getSelectionAffectedTableCells(t),u=i[0].findAncestor("table");let d;if("removeTableRow"==n){const e=s.getRowIndexes(i);d={startRow:e.first,endRow:e.last,includeAllSlots:!0}}else{const e=s.getColumnIndexes(i);d={startColumn:e.first,endColumn:e.last,includeAllSlots:!0}}const m=s.createTableWalker(u,d),h=Array.from(m).map((({cell:e})=>e)),f=Si(h.filter((e=>e.hasAttribute(a)))),p=Si(h.filter((e=>!e.hasAttribute(a)))).map((t=>e.createRangeOn(t))),b=o.markMultiRangeDeletion(p,c);if(b&&("tableRow"==b.subType||"tableColumn"==b.subType)){const t=this._getSuggestionCoords(b);for(const n of f){const o=e.createRangeOn(n),i=s.getCellLocation(n),c=n.getAttribute(a)-1,u=t[l],d=t[g];u<=i[r]&&i[r]+c<=d&&b.addRange(o)}}}))}))}function i(n){const o=Array.from(t.getRanges()).map((e=>r.LiveRange.fromRange(e)));e.model.change((t=>{const s=t.batch;n=n.filter((e=>"$graveyard"!=e.root.rootName)),t.setSelection(n),e.commands.get("removeTableRow").refresh(),e.execute("removeTableRow",{forceDefaultExecution:!0}),e.model.enqueueChange((()=>{e.model.enqueueChange(s,(e=>{const t=o.filter((e=>"$graveyard"!=e.root.rootName));t.length>0&&e.setSelection(t);for(const e of o)e.detach()}))}))}))}function c(n){e.model.change((o=>{const s=Array.from(t.getRanges()).map((e=>r.LiveRange.fromRange(e))),i=[];for(const e of n)for(const t of e.getItems({shallow:!0}))i.push(t);for(const t of i)"$graveyard"!=t.root.rootName&&(o.setSelection(o.createPositionAt(t,0)),e.commands.get("removeTableColumn").refresh(),e.execute("removeTableColumn",{forceDefaultExecution:!0}));const a=s.filter((e=>"$graveyard"!=e.root.rootName));a.length>0&&o.setSelection(a);for(const e of s)e.detach()}))}function l(e,t){return t.every((t=>e.some((e=>e.end.isEqual(t.start)||t.end.isEqual(e.start)))))}function g(e,t){return e.some((e=>t.some((t=>e.end.isTouching(t.start)))))}e.data.downcastDispatcher.on("addMarker:suggestion",((e,t,n)=>{if(!n.options.showSuggestionHighlights)return;const o=t.item;if(!o)return;const s=n.mapper.toViewElement(o);function i(e){return Array.isArray(e)?e:[e]}s&&"tableCell"===o.name&&(0,a.setHighlightHandling)(s,n.writer,((e,t,n)=>n.addClass(i(t.classes),e)),((e,t,n)=>n.removeClass(i(t.classes),e)))}),{priority:"highest"}),o._descriptionFactory.registerDescriptionCallback((e=>{if("insertion"!=e.type&&"deletion"!=e.type)return;const t=e.getContainedElement();if(null!=t&&t.is("element","table")){if("insertion"==e.type){const t=e.getItems().filter((e=>e.is("textProxy"))).map((e=>e.data));if(t.length)return{type:"insertion",content:n("*Insert:* %0",n({string:"table *with text* %0",id:"ELEMENT_TABLE_WITH_TEXT"},'"'+t.join(" ")+'"'))}}if("deletion"==e.type){const t=e.getItems().filter((e=>e.is("textProxy"))).map((e=>e.data));if(t.length)return{type:"deletion",content:n("*Remove:* %0",n({string:"table *with text* %0",id:"ELEMENT_TABLE_WITH_TEXT"},'"'+t.join(" ")+'"'))}}}})),o._descriptionFactory.registerDescriptionCallback((e=>{if("tableRow"==e.subType){const t=e.getItems().filter((e=>e.is("textProxy"))).map((e=>e.data)),o=this._getSuggestionCoords(e),s=o.maxRow-o.minRow+1;if("insertion"==e.type)return t.length?{type:"insertion",content:n("*Insert:* %0",n({string:"table row *with text* %1",plural:"%0 table rows *with text* %1",id:"ELEMENT_TABLE_ROW_WITH_TEXT"},[s,'"'+t.join(" ")+'"']))}:{type:"insertion",content:n("*Insert:* %0",n({string:"table row",plural:"%0 table rows",id:"ELEMENT_TABLE_ROW"},s))};if("deletion"==e.type)return t.length?{type:"deletion",content:n("*Remove:* %0",n({string:"table row *with text* %1",plural:"%0 table rows *with text* %1",id:"ELEMENT_TABLE_ROW_WITH_TEXT"},[s,'"'+t.join(" ")+'"']))}:{type:"deletion",content:n("*Remove:* %0",n({string:"table row",plural:"%0 table rows",id:"ELEMENT_TABLE_ROW"},s))}}if("tableColumn"==e.subType){const t=e.getItems().filter((e=>e.is("textProxy"))).map((e=>e.data)),o=this._getSuggestionCoords(e),s=o.maxColumn-o.minColumn+1;if("insertion"==e.type)return t.length?{type:"insertion",content:n("*Insert:* %0",n({string:"table column *with text* %1",plural:"%0 table columns *with text* %1",id:"ELEMENT_TABLE_COLUMN_WITH_TEXT"},[s,'"'+t.join(" ")+'"']))}:{type:"insertion",content:n("*Insert:* %0",n({string:"table column",plural:"%0 table columns",id:"ELEMENT_TABLE_COLUMN"},s))};if("deletion"==e.type)return t.length?{type:"deletion",content:n("*Remove:* %0",n({string:"table column *with text* %1",plural:"%0 table columns *with text* %1",id:"ELEMENT_TABLE_COLUMN_WITH_TEXT"},[s,'"'+t.join(" ")+'"']))}:{type:"deletion",content:n("*Remove:* %0",n({string:"table column",plural:"%0 table columns",id:"ELEMENT_TABLE_COLUMN"},s))}}})),o._suggestionFactory.registerCustomCallback("insertion","tableRow","discard",i),o._suggestionFactory.registerCustomCallback("deletion","tableRow","accept",i),o._suggestionFactory.registerCustomCallback("insertion","tableColumn","discard",c),o._suggestionFactory.registerCustomCallback("deletion","tableColumn","accept",c),o._suggestionFactory.registerCustomCallback("insertion","tableColumn","join",l),o._suggestionFactory.registerCustomCallback("deletion","tableColumn","join",l),o._suggestionFactory.registerCustomCallback("insertion","tableRow","join",g),o._suggestionFactory.registerCustomCallback("deletion","tableRow","join",g)}_acceptFormatSuggestionCallbackFactory(){const e=this.editor,t=e.model.document.selection;return(n,o)=>{e.model.change((s=>{const{commandName:i,commandParams:a}=o;let c=n[0].end.nodeBefore;a&&a[0]&&!1===a[0].forceValue&&(c=n[0].start.nodeAfter);const l=s.createRangeIn(c);if("$graveyard"==l.root.rootName)return;const g=Array.from(t.getRanges()).map((e=>r.LiveRange.fromRange(e)));s.setSelection(l),e.commands.get(i).refresh(),a.push({forceDefaultExecution:!0}),e.execute(i,...a);const u=g.filter((e=>"$graveyard"!=e.root.rootName));u.length>0&&s.setSelection(u);for(const e of g)e.detach()}))}}_getCoordsForCells(e){const t=this.editor.plugins.get("TableUtils");let n=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER;for(const r of e){if("$graveyard"==r.root.rootName)continue;const{row:e,column:a}=t.getCellLocation(r),c=r.hasAttribute("rowspan")?r.getAttribute("rowspan")-1:0,l=r.hasAttribute("colspan")?r.getAttribute("colspan")-1:0;n=e<n?e:n,o=e+c>o?e+c:o,s=a<s?a:s,i=a+l>i?a+l:i}return{minRow:n,maxRow:o,minColumn:s,maxColumn:i}}_setupColumnsRowsFixing(){const e=this.editor,t=e.plugins.get("TrackChangesEditing"),n=e.plugins.get("TableUtils");this._tableSuggestions=new Set,e.model.document.on("change:data",(()=>{const n=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:e,data:o}of n){const{group:n,id:s,subType:i}=t._splitMarkerName(e);if("suggestion"!=n)continue;if(null!=o.oldRange)continue;const r=t.getSuggestion(s);this._tablePostFixingSubtypes.includes(i)&&this._tableSuggestions.add(r)}}),{priority:"low"});const o=(e,t)=>{let o=!1;const s=t.createRangeOn(e),i=e.findAncestor("table"),r=n.getCellLocation(e);for(const t of this._tableSuggestions){const n=t.subType,a=n.startsWith("tablePaste"),c=n.substr(a?10:5),l=c.toLowerCase(),g=l.substr(0,3)+"span",u="min"+c,d="max"+c;if(!t.isInContent)continue;if(i!=t.getFirstRange().start.findAncestor("table"))continue;if(t.isIntersectingWithRange(s))continue;const m=e.hasAttribute(g)?e.getAttribute(g)-1:0,h=this._getSuggestionCoords(t),f=h[u],p=h[d];f<=r[l]&&r[l]+m<=p&&(t.addRange(s),o=!0)}return o};e.model.document.registerPostFixer((t=>{let n=!1;for(const s of e.model.document.differ.getChanges())if("insert"==s.type)if("tableRow"==s.name)for(const e of s.position.nodeAfter.getChildren())n=n||o(e,t);else"tableCell"==s.name&&(n=n||o(s.position.nodeAfter,t));return n}))}_getSuggestionCoords(e){return this._getCoordsForCells(e.getRanges().map((e=>e.start.nodeAfter)))}}function Si(e){return Array.from(new Set(e).values())}class wi extends e.Plugin{static get requires(){return[Ri]}afterInit(){const e=this.editor,t=e.model.document.selection;if(!e.plugins.has("TableEditing"))return;const{t:n}=e.locale,o=e.plugins.get("TrackChangesEditing"),s=e.plugins.get("TableUtils"),i=e.plugins.get(Ri);i._tablePostFixingSubtypes.push("mergeTableCells"),o.enableCommand("mergeTableCells",(()=>{const t=s.getSelectionAffectedTableCells(e.model.document.selection);e.model.change((()=>{o.markMultiRangeBlockFormat(t,{commandName:"mergeTableCells",commandParams:[]},[],"mergeTableCells")}))})),e.commands.get("mergeTableCells").on("execute",((t,n)=>{e.commands.get("trackChanges").value&&(n.length>0&&n[n.length-1]&&n[n.length-1].forceDefaultExecution||o._isForcedDefaultExecutionBlock||this._areSelectedCellsMergable()||t.stop())}),{priority:"highest"});for(const t of["mergeTableCellUp","mergeTableCellRight","mergeTableCellDown","mergeTableCellLeft"]){const n=e.commands.get(t);o.enableCommand(t,(()=>{const t=e.model.document.selection.getFirstPosition().getAncestors().find((e=>e.is("element","tableCell"))),s=n.value;e.model.change((()=>{o.markMultiRangeBlockFormat([t,s],{commandName:"mergeTableCells",commandParams:[]},[],"mergeTableCells")}))}))}for(const t of["splitTableCellVertically","splitTableCellHorizontally"]){const n=e.commands.get(t);o.enableCommand(t,(()=>{const i=s.getSelectionAffectedTableCells(e.model.document.selection)[0],r=i.findAncestor("table"),{column:a,row:c}=s.getCellLocation(i);let l=[];if("horizontally"==n.direction){const e=s.createTableWalker(r,{startRow:c,endRow:c,includeAllSlots:!0});l=Array.from(e).map((e=>e.cell))}else{const e=s.createTableWalker(r,{column:a,includeAllSlots:!0});l=Array.from(e).map((e=>e.cell))}e.model.change((e=>{o.markBlockFormat(e.createRangeOn(i),{commandName:t,commandParams:[]},l,t)}))}))}o._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t)return"mergeTableCells"==t.commandName?{type:"format",content:n("*Merge cells*")}:void 0})),o._descriptionFactory.registerDescriptionCallback((e=>{const{data:t}=e;if(t)return"splitTableCellVertically"==t.commandName?{type:"format",content:n("*Split cell:* vertically")}:"splitTableCellHorizontally"==t.commandName?{type:"format",content:n("*Split cell:* horizontally")}:void 0}));const a=i._acceptFormatSuggestionCallbackFactory();for(const e of["mergeTableCellUp","mergeTableCellRight","mergeTableCellDown","mergeTableCellLeft"])o._suggestionFactory.registerCustomCallback("formatBlock",e,"accept",a);for(const e of["splitTableCellVertically","splitTableCellHorizontally"])o._suggestionFactory.registerCustomCallback("formatBlock",e,"accept",a);o._suggestionFactory.registerCustomCallback("formatBlock","mergeTableCells","accept",(n=>{e.model.change((o=>{const s=Array.from(t.getRanges()).map((e=>r.LiveRange.fromRange(e)));o.setSelection(n),e.commands.get("mergeTableCells").refresh(),e.execute("mergeTableCells",{forceDefaultExecution:!0});const i=s.filter((e=>"$graveyard"!=e.root.rootName));i.length>0&&o.setSelection(i);for(const e of s)e.detach()}))}));for(const t of["mergeTableCellUp","mergeTableCellDown","mergeTableCellLeft","mergeTableCellRight"]){const n=e.commands.get(t);n.on("set:isEnabled",((t,o,s)=>{if(s){const o=e.model.document.selection.getFirstPosition().getAncestors().find((e=>e.is("element","tableCell")));this._areMergableCells(n.value,o)||(t.return=!1,t.stop())}}),{priority:"low"})}}_areSelectedCellsMergable(){const e=this.editor.commands.get("mergeTableCells"),t=this.editor.plugins.get("TableUtils");if(!e.isEnabled)return!1;const n=t.getSelectionAffectedTableCells(this.editor.model.document.selection);for(const e of n)for(const t of n)if(e!=t&&!this._areMergableCells(e,t))return!1;return!0}_areMergableCells(e,t){const n=this.editor.plugins.get("TrackChangesEditing"),o=this.editor.model.createRangeOn(e),s=this.editor.model.createRangeOn(t),i=new Set,r=new Set;for(const e of n.getSuggestions())if(("insertion"==e.type||"deletion"==e.type||"mergeTableCells"==e.subType)&&e.isInContent)for(const t of e.getRanges())t.containsRange(o,!0)&&i.add(e.type+":"+e.author.id),t.containsRange(s,!0)&&r.add(e.type+":"+e.author.id);if(i.size!=r.size)return!1;for(const e of i)if(!r.has(e))return!1;return!0}}class Ai extends e.Plugin{static get requires(){return[Ri]}afterInit(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const{t}=e.locale,n=e.plugins.get("TrackChangesEditing"),o=e.plugins.get("TableUtils"),s=e.plugins.get(Ri);function i({showActiveMarker:e=!0,setDataAttribute:t=!0}={}){return(s,i,r)=>{const{type:a,id:c}=n._splitMarkerName(i.markerName),l=n.getSuggestion(c);if(!l.data||"setTableColumnHeader"!=l.data.commandName)return;if(i.item)return void s.stop();if(!r.consumable.consume(i.markerRange,s.name))return;const g=i.markerRange.start.nodeAfter,u=i.markerRange.end.nodeBefore,d=g.parent.parent,{column:m}=o.getCellLocation(g),{column:h}=o.getCellLocation(u);for(let s=m;s<=h;s++){const l=o.createTableWalker(d,{column:s,includeAllSlots:!1});for(const o of l){const s=o.cell,l=r.mapper.toViewElement(s);r.writer.addClass("ck-suggestion-marker-"+a,l),t&&r.writer.setAttribute("data-suggestion",c,l),r.mapper.bindElementToMarker(l,i.markerName),e&&(n.activeMarkers.includes(i.markerName)?r.writer.addClass("ck-suggestion-marker--active",l):r.writer.removeClass("ck-suggestion-marker--active",l))}}}}n.enableCommand("setTableRowHeader",((t,s)=>{const i=o.getSelectionAffectedTableCells(e.model.document.selection),r=o.getRowIndexes(i),a=i[0].findAncestor("table"),c=a.getAttribute("headingRows")||0,l=s&&null!==s.forceValue?s.forceValue:!e.commands.get("setTableRowHeader").value,g=l?r.last:r.first,u=a.getChild(g);let d;if(l){const t=a.getChild(c);if(u.index<t.index)return;d=e.model.createRange(e.model.createPositionBefore(t.getChild(0)),e.model.createPositionAfter(u.getChild(u.childCount-1)))}else{const t=a.getChild(c-1);if(!t)return;d=e.model.createRange(e.model.createPositionBefore(u.getChild(0)),e.model.createPositionAfter(t.getChild(t.childCount-1)))}e.model.change((()=>{n.markBlockFormat(d,{commandName:"setTableRowHeader",commandParams:[{forceValue:l}]},[],"setTableRowHeader")}))})),n.enableCommand("setTableColumnHeader",((t,o)=>{const s=e.plugins.get("TableUtils"),i=s.getSelectionAffectedTableCells(e.model.document.selection),r=s.getColumnIndexes(i),a=i[0].findAncestor("table"),c=a.getAttribute("headingColumns")||0,l=o&&null!==o.forceValue?o.forceValue:!e.commands.get("setTableColumnHeader").value;let g;const u=a.getChild(0),d=l?r.last:r.first,m=s.createTableWalker(a,{startRow:0,column:d,includeAllSlots:!1}),h=Array.from(m)[0].cell;if(l){const t=u.getChild(c);if(h.isBefore(t))return;g=e.model.createRange(e.model.createPositionBefore(t),e.model.createPositionAfter(h))}else{const t=u.getChild(c-1);if(!t)return;g=e.model.createRange(e.model.createPositionBefore(h),e.model.createPositionAfter(t))}e.model.change((()=>{n.markBlockFormat(g,{commandName:"setTableColumnHeader",commandParams:[{forceValue:l}]},[],"setTableColumnHeader")}))})),e.editing.downcastDispatcher.on("addMarker:suggestion",i(),{priority:"highest"}),e.data.downcastDispatcher.on("addMarker:suggestion",((e,t,n)=>{n.options.showSuggestionHighlights&&i({showActiveMarker:!1,setDataAttribute:!1})(e,t,n)}),{priority:"highest"}),e.editing.downcastDispatcher.on("removeMarker:suggestion",((e,t,o)=>{const{type:s,id:i}=n._splitMarkerName(t.markerName),r=n.getSuggestion(i);if(!r.data||"setTableColumnHeader"!=r.data.commandName)return;const a=o.mapper.markerNameToElements(t.markerName);if(a)for(const e of a)o.writer.removeClass("ck-suggestion-marker-"+s,e),o.writer.removeClass("ck-suggestion-marker--active",e),o.writer.removeAttribute("data-suggestion",e),o.mapper.unbindElementFromMarkerName(e,t.markerName)}),{priority:"highest"}),n._descriptionFactory.registerDescriptionCallback((e=>{const{data:n}=e;if(n){if("setTableRowHeader"==n.commandName){const e=n.commandParams[0].forceValue;return o(t(e?{string:"header row",id:"FORMAT_HEADER_ROW"}:{string:"regular row",id:"FORMAT_REGULAR_ROW"}))}if("setTableColumnHeader"==n.commandName){const e=n.commandParams[0].forceValue;return o(t(e?{string:"header column",id:"FORMAT_HEADER_COLUMN"}:{string:"regular column",id:"FORMAT_REGULAR_COLUMN"}))}}function o(e){return{type:"format",content:t("*Format:* %0",e)}}}));const r=s._acceptFormatSuggestionCallbackFactory();n._suggestionFactory.registerCustomCallback("formatBlock","setTableRowHeader","accept",r),n._suggestionFactory.registerCustomCallback("formatBlock","setTableColumnHeader","accept",r)}}const Ii=["tableCellBorderWidth","tableCellBorderColor","tableCellBorderStyle","tableCellHorizontalAlignment","tableCellVerticalAlignment","tableCellBackgroundColor","tableCellPadding"],Mi=Object.fromEntries(Ii.map((e=>[e,null])));class Ni extends e.Plugin{static get requires(){return[Ri]}afterInit(){const e=this.editor;if(!e.plugins.has("TableClipboard"))return;const{t:n}=e.locale,o=e.plugins.get("TrackChangesEditing"),s=e.plugins.get("TableUtils"),i=e.plugins.get(Ri),r=e.plugins.get("TableClipboard");i._tablePostFixingSubtypes.push("tablePasteRow","tablePasteColumn"),e.model.schema.register("tableCellSuggestion",{allowIn:"tableCell",allowContentOf:"tableCell",isLimit:!0}),e.conversion.elementToElement({model:"tableCellSuggestion",view:"suggestion-td"});let a=null;e.model.on("insertContent",((n,i)=>{const[c,l]=i,g=i[i.length-1];g&&g.forceDefaultExecution||o._isForcedDefaultExecutionBlock||this.editor.commands.get("trackChanges").value&&function(e,t,n,o,s){if(t&&!t.is("documentSelection"))return!1;const i=s.getTableIfOnlyTableInContent(e,n);if(!i||!Pi(i,null,o))return!1;const r=o.getSelectionAffectedTableCells(n.document.selection);if(!r.length)return!1;const a=r[0].findAncestor("table"),c=o.getRowIndexes(r),l=o.getColumnIndexes(r),g={startRow:c.first,endRow:c.last,startColumn:l.first,endColumn:l.last};return 1==r.length&&(g.endRow+=o.getRows(i)-1,g.endColumn+=o.getColumns(i)-1),Pi(a,g,o)}(c,l,e.model,s,r)&&(n.stop(),a={cells:[],insertionRanges:[],deletionRanges:[],rowInsertionRanges:[],rowInsertionIndexes:[],columnInsertionRanges:[],columnInsertionIndexes:[]},e.model.change((()=>{e.model.insertContent(i[0],i[1],i[2],i[3],{forceDefaultExecution:!0});const n=(0,t.uid)(),{rowInsertionRanges:s,columnInsertionRanges:r,insertionRanges:c,deletionRanges:l,cells:g}=a;s.length&&o.markMultiRangeInsertion(s,"tablePasteRow",{tablePasteChainId:n}),r.length&&o.markMultiRangeInsertion(r,"tablePasteColumn",{tablePasteChainId:n}),c.length&&o.markMultiRangeInsertion(c,"tablePaste",{tablePasteChainId:n,skipNestingCheck:!0}),l.length&&o.markMultiRangeDeletion(l,"tablePaste",{tablePasteChainId:n,skipNestingCheck:!0});const u=o.markMultiRangeBlockFormat(g.map((({element:e})=>e)),{formatGroupId:(0,t.uid)()},[],"tablePasteCell",{tablePasteChainId:n});if(u){const t=u.getMarkers(),n=[];for(const{element:o,attributes:s}of g){if(!s)continue;const i=e.model.createRangeOn(o),r=t.find((e=>e.getRange().isEqual(i)));r&&n.push([r.name,s])}n.length&&u.setAttribute("markerAttributes",Object.fromEntries(n))}a=null})))}),{priority:t.priorities.high+10}),e.plugins.get("TableClipboard").on("_replaceTableSlotCell",((e,t)=>{const[n,o,,s]=t;if(!a)return;e.stop();const i=n.cell,r=o,c=Fi(i),l=Fi(r);e.return=i;let g=null,u=null;if(l||c)if(c&&!l){s.remove(i.getChild(0));for(const e of Array.from(r.getChildren()))s.insert(e,i,"end");const e=a.rowInsertionIndexes.includes(n.row),t=a.columnInsertionIndexes.includes(n.column);e||t||(g=s.createRangeIn(i))}else l&&!c&&(u=s.createRangeIn(i));else{const e=s.createElement("tableCellSuggestion"),t=s.createElement("tableCellSuggestion");s.wrap(s.createRangeIn(i),t),s.insert(e,i,0);for(const t of Array.from(r.getChildren()))s.insert(t,e,"end");g=s.createRangeOn(e),u=s.createRangeOn(t)}const d=Array.from(r.getAttributes()).filter((([e])=>Ii.includes(e)));a.cells.push({element:i,attributes:d.length?Object.fromEntries(d):null}),g&&a.insertionRanges.push(g),u&&a.deletionRanges.push(u)}),{priority:"high"}),s.on("insertColumns",((t,n)=>{const[o,i={}]=n;if(!a)return;const r=i.at||0,c=i.columns||1;a.columnInsertionIndexes=new Array(c).fill(r).map(((e,t)=>e+t));for(const{cell:t}of s.createTableWalker(o,{startColumn:r,endColumn:r+c-1}))a.columnInsertionRanges.push(e.model.createRangeOn(t))}),{priority:"low"}),s.on("insertRows",((t,n)=>{const[o,i={}]=n;if(!a)return;const r=i.at||0,c=i.rows||1;a.rowInsertionIndexes=new Array(c).fill(r).map(((e,t)=>e+t));for(const{cell:t}of s.createTableWalker(o,{startRow:r,endRow:r+c-1}))a.rowInsertionRanges.push(e.model.createRangeOn(t))}),{priority:"low"}),o._descriptionFactory.registerDescriptionCallback((e=>{if(e.subType&&e.subType.startsWith("tablePaste"))return e.previous?{}:{type:"insertion",content:n("*Replace table cells*")}}));const c=()=>{};for(const e of["tablePaste","tablePasteColumn","tablePasteRow","tablePasteCell"])o._suggestionFactory.registerCustomCallback("insertion",e,"join",c),o._suggestionFactory.registerCustomCallback("deletion",e,"join",c);o._suggestionFactory.registerCustomCallback("formatBlock","tablePasteCell","discard",c),o._suggestionFactory.registerCustomCallback("formatBlock","tablePasteCell","accept",((t,n,o)=>{const s=t.map((e=>e.getContainedElement())).filter((e=>e)),i=new Map(s.map((e=>[e,null])));if(a)for(const{element:e,attributes:t}of a.cells)t&&i.set(e,t);else if(o&&o.markerAttributes)for(const[t,n]of Object.entries(o.markerAttributes)){const o=e.model.markers.get(t),s=o?o.getRange().getContainedElement():null;s&&i.set(s,n)}e.model.change((e=>{for(const[t,n]of i)e.setAttributes({...Mi,...n},t)}))}));const l=(t,n)=>{o._suggestionFactory.registerCustomCallback(t,"tablePaste",n,((s,i,r)=>{e.model.change((e=>{const a=[];for(const e of s){const t=e.start.nodeAfter;t.is("element","tableCellSuggestion")&&a.push(t)}o._suggestionFactory.getSuggestionCallback(t,null,n)(s,i,r);for(const t of a)"$graveyard"!=t.root.rootName&&e.unwrap(t)}))}))};l("insertion","accept"),l("insertion","discard"),l("deletion","accept"),l("deletion","discard"),o._suggestionFactory.registerCustomCallback("insertion","tablePasteRow","discard",(e=>{const t=e.map((e=>e.getContainedElement())),n=t[0].findAncestor("table"),{minRow:o,maxRow:r}=i._getCoordsForCells(t);s.removeRows(n,{at:o,rows:r-o+1})})),o._suggestionFactory.registerCustomCallback("insertion","tablePasteColumn","discard",(e=>{const t=e.map((e=>e.getContainedElement())),n=t[0].findAncestor("table"),{minColumn:o,maxColumn:r}=i._getCoordsForCells(t);s.removeColumns(n,{at:o,columns:r-o+1})}));const g=(e,t)=>{if(!t.subType||!t.subType.startsWith("tablePaste"))return;const n=t.attributes.tablePasteChainId,s=o.getSuggestions().filter((e=>e.isInContent&&e.attributes&&e.attributes.tablePasteChainId==n));s.length&&t.getAllAdjacentSuggestions().length!=s.length&&s.reduce(((e,t)=>(e.next=t,t.previous=e,t)))};function u(e,{showActiveMarker:t=!0}={}){const{id:n}=o._splitMarkerName(e.markerName),s=["ck-suggestion-marker","ck-suggestion-marker-insertion"],i=o.activeMarkers.includes(e.markerName);return i&&s.push("ck-suggestion-marker--active"),{classes:s,attributes:{"data-suggestion":n},priority:i&&t?3010:3e3}}o.on("suggestionLoaded",g,{priority:"high"}),o.on("suggestionUnloaded",g,{priority:"high"}),e.model.document.registerPostFixer((()=>{let t=!1;const n=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:s,data:i}of n){const{group:n,type:r,id:a}=o._splitMarkerName(s);if("suggestion"!=n||"deletion"!=r||i.oldRange)continue;if(!o.hasSuggestion(a))continue;const c=o.getSuggestion(a).getRanges(),l=e.plugins.get("Users").me;for(const e of o.getSuggestions())if(e.isInContent&&e.author==l&&"formatBlock"==e.type&&"tablePasteCell"==e.subType&&e.getRanges().every((e=>c.some((t=>t.containsRange(e,!0))))))for(const n of e.getAllAdjacentSuggestions())n.isInContent&&(n.discard(),t=!0)}return t})),e.model.document.registerPostFixer((t=>{const n=e.commands.get("redo");if(!n||!n._createdBatches.has(t.batch))return!1;let s=!1;const i=e.plugins.get("Users").me,r=e.model.document.differ.getChanges(),a=Array.from(e.model.document.differ.getChangedMarkers()).filter((({name:e,data:t})=>{const{group:n,subType:s,authorId:r}=o._splitMarkerName(e);return"suggestion"==n&&"tablePaste"==s&&r==i.id&&!t.oldRange}));for(const e of r){if("insert"!=e.type||"tableCellSuggestion"!=e.name||1!=e.length)continue;const n=t.createRange(e.position,e.position.getShiftedBy(1));if(!a.find((({data:e})=>e.newRange.isEqual(n))))for(const{name:e,data:o}of a)if(n.containsRange(o.newRange)){t.updateMarker(e,{range:n}),s=!0;break}}return s})),e.model.document.registerPostFixer((t=>{let n=!1;const s=e.plugins.get("Users").me,i=o.getSuggestions().filter((e=>e.isInContent&&e.author==s)),r=new Set,a=new Set;for(const e of i)if("tablePaste"==e.subType)for(const t of e.getMarkers()){const o=t.getRange().getContainedElement();if(o)if(o.is("element","tableCellSuggestion")&&Fi(o)){e.removeMarker(t.name),r.add(o),n=!0;const s=o.nextSibling,i=o.previousSibling,c=s&&s.is("element","tableCellSuggestion"),l=i&&i.is("element","tableCellSuggestion");c&&!r.has(s)&&a.add(s),l&&!r.has(i)&&a.add(i)}else o.is("element","paragraph")&&o.isEmpty&&(e.removeMarker(t.name),n=!0)}else if("tablePasteCell"==e.subType){if(!e.attributes||!e.attributes.tablePasteChainId)continue;const t=e.attributes.markerAttributes;if(t&&Object.keys(t).length)continue;const o=e.attributes.tablePasteChainId;let s=!0,r=!0;for(const t of i)if(t.subType&&t.subType.startsWith("tablePaste")){if(!t.attributes.tablePasteChainId){r=!1;break}if(t.id!=e.id&&t.attributes.tablePasteChainId==o){s=!1;break}}r&&s&&(e.removeMarkers(),n=!0)}for(const e of r)t.remove(e);for(const e of a)t.unwrap(e);return n})),e.conversion.for("editingDowncast").markerToHighlight({model:"suggestion:formatBlock:tablePasteCell",view:u,converterPriority:"high"}),e.conversion.for("dataDowncast").markerToHighlight({model:"suggestion:formatBlock:tablePasteCell",view:(e,t)=>{if(t.options.showSuggestionHighlights)return u(e,{showActiveMarker:!1})},converterPriority:"high"});const d=e.editing.view;this.listenTo(d.document,"clipboardOutput",((e,t)=>{const n=[];for(const e of d.createRangeIn(t.content).getItems())e.is("element","suggestion-td")&&n.push(e);d.change((e=>{for(const t of n)e.move(e.createRangeIn(t),e.createPositionBefore(t)),e.remove(t)}))}))}}function Fi(e){if(e.isEmpty)return!0;const t=e.getChild(0);return t.is("element","paragraph")&&t.isEmpty}function Pi(e,t={},n){for(const{isAnchor:o,cellHeight:s,cellWidth:i}of n.createTableWalker(e,{includeAllSlots:!0,...t}))if(!o||1!=s||1!=i)return!1;return!0}class Oi extends e.Plugin{afterInit(){const e=this.editor,t=e.t;if(!e.plugins.has("Title"))return;const n=e.plugins.get("TrackChangesEditing");n._descriptionFactory.registerElementLabel("title-content",(()=>t({id:"ELEMENT_TITLE",string:"title"}))),e.model.document.registerPostFixer((t=>{let o=!1;const s=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:i,data:r}of s){const{group:s}=n._splitMarkerName(i);if("suggestion"!==s||!r.newRange)continue;const a=r.newRange,c=a.end.nodeBefore;if(!c||!c.is("element","title-content"))continue;if(!a.start.isTouching(a.end))continue;const l=e.model.schema.getNearestSelectionRange(a.end,"forward");if(l&&l.isCollapsed){const e=t.createRange(a.start,l.start);e.isEqual(a)||(t.updateMarker(i,{range:e}),o=!0)}o||(t.removeMarker(i),o=!0)}return o}))}}const Li=["has","undo","plugins","UndoEditing","get","redo","TrackChangesEditing","afterInit"];var Bi,ji;Bi=Li,ji=388,function(e){for(;--e;)Bi.push(Bi.shift())}(++ji);const Di=function(e,t){return Li[e-=0]};class Ui extends e.Plugin{[Di("0x3")](){const e=this.editor,t=e[Di("0x6")][Di("0x0")](Di("0x2"));e[Di("0x6")][Di("0x4")](Di("0x7"))&&(t.enableCommand(Di("0x5")),t.enableCommand(Di("0x1")))}}const Hi=["number","isArray","charCodeAt","sort","sign","keys","object","toString","string","boolean"];var Vi,zi;Vi=Hi,zi=219,function(e){for(;--e;)Vi.push(Vi.shift())}(++zi);const Gi=function(e,t){return Hi[e-=0]};function*Wi(e){e?Gi("0x0")==typeof e?yield 1:Array[Gi("0x2")](e)?yield*function*(e){for(const t of e)yield*Wi(t)}(e):Gi("0x7")==typeof e?yield*qi(e):Gi("0x9")==typeof e?yield*$i(e):Gi("0x1")==typeof e&&(yield e):yield 0}function*qi(e){if(yield Ki("{"),e){const t=Object[Gi("0x6")](e)[Gi("0x4")]();for(const n of t){yield*$i(n),yield Ki(":");const t=e[n];yield*Wi(t)}}yield Ki("}")}function*$i(e){yield Ki('"');for(const t of e)yield Ki(t);yield Ki('"')}function Ki(e){return e[Gi("0x3")](0)}function Xi(e){return(e*=Math[Gi("0x5")](e))[Gi("0x8")](36)}class Qi extends e.Plugin{static get requires(){return["CommentsRepository",i.Users,e.PendingActions,ds,_s,ks,Rs,Ms,Bs,zs,Ws,qs,Ks,Xs,Qs,Js,ni,oi,si,ai,di,mi,hi,pi,ki,vi,Ti,Ri,wi,Ai,Ni,Oi,Ui]}static get pluginName(){return"TrackChangesEditing"}constructor(e){function t(e){return e.map((e=>String.fromCharCode(e))).join("")}super(e),this.set("activeMarkers",[]),this.on("change:activeMarkers",((t,n,o,s)=>{this._model.change((()=>{for(const t of[...s,...o])this._model.markers.has(t)&&e.editing.reconvertMarker(t)}))})),this._descriptionFactory=new us(this.editor.model.schema,this.editor.locale),this._adapter=null,this._suggestionFactory=new Ji(this.editor),this._suggestions=new Map,this._commentsRepository=e.plugins.get("CommentsRepository"),this._enabledCommands=new Set,this._model=this.editor.model,this._suggestionState=new WeakMap,this._isForcedDefaultExecutionBlock=!1,this[t([95,101,120,101,99,117,116,101,83,117,103,103,101,115,116,105,111,110])]=t([52,48,52,52,48,56,50,52])}init(){const e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:"suggestion",view:e=>{const{id:t,type:n}=this._splitMarkerName(e.markerName),o=["ck-suggestion-marker","ck-suggestion-marker-"+n];let s=3e3;return this.activeMarkers.includes(e.markerName)&&(o.push("ck-suggestion-marker--active"),s=3010),"deletion"==n&&(s+=5),{classes:o,attributes:{"data-suggestion":t},priority:s}}}),e.conversion.for("dataDowncast").add((t=>{t.on("addMarker:suggestion",((t,n,o)=>{if(!o.options.showSuggestionHighlights)return;const s=n.item;if(!s)return;const i=o.mapper.toViewElement(s);e.model.schema.isObject(s)&&i&&!i.getCustomProperty("widget")&&i.is("containerElement")&&(0,a.toWidget)(i,o.writer)}),{priority:"high"})})),e.conversion.for("dataDowncast").markerToHighlight({model:"suggestion",view:(e,t)=>{if(!t.options.showSuggestionHighlights)return null;const{type:n}=this._splitMarkerName(e.markerName);return{classes:["ck-suggestion-marker","ck-suggestion-marker-"+n],priority:3e3}}});const n=({showActiveMarkers:t=!0}={})=>(n,o,s)=>{if(!o.item)return;if(o.item.is("selection"))return void s.consumable.consume(o.item,n.name);const i=s.mapper.toViewElement(o.item);if(!o.item.is("element")||!e.model.schema.isBlock(o.item)||i.getCustomProperty("addHighlight"))return;const{id:r}=this._splitMarkerName(o.markerName);s.writer.addClass(["ck-suggestion-marker","ck-suggestion-marker-formatBlock"],i),s.writer.setAttribute("data-suggestion",r,i),s.mapper.bindElementToMarker(i,o.markerName),t&&(this.activeMarkers.includes(o.markerName)?s.writer.addClass("ck-suggestion-marker--active",i):s.writer.removeClass("ck-suggestion-marker--active",i));for(const t of e.model.createRangeIn(o.item).getItems())s.consumable.consume(t,n.name);s.consumable.consume(o.item,n.name)};e.conversion.for("dataDowncast").add((e=>{e.on("addMarker:suggestion:formatBlock",((e,t,o)=>{o.options.showSuggestionHighlights&&n({showActiveMarkers:!1})(e,t,o)}),{priority:"highest"})})),e.conversion.for("dataDowncast").markerToData({model:"suggestion",view:(e,t)=>t.options.showSuggestionHighlights?null:{group:"suggestion",name:e.substr("suggestion".length+1)}}),e.conversion.for("upcast").elementToElement({view:{name:"suggestion",attribute:{id:/^\w/,suggestionType:/^\w/}},model:(e,{writer:t})=>{let n="suggestion:"+e.getAttribute("suggestion-type")+":"+e.getAttribute("id");return e.getAttribute("marker-count")&&(n+=":"+e.getAttribute("marker-count")),t.createElement("$marker",{"data-name":n})}}),e.conversion.for("upcast").dataToMarker({view:"suggestion"}),e.conversion.for("editingDowncast").add((e=>{e.on("addMarker:suggestion:formatBlock",n(),{priority:"high"})})),e.conversion.for("editingDowncast").add((e=>{e.on("removeMarker:suggestion:formatBlock",((e,t,n)=>{const o=n.mapper.markerNameToElements(t.markerName);if(o)for(const e of o)e.getCustomProperty("addHighlight")||(n.writer.removeClass(["ck-suggestion-marker","ck-suggestion-marker-formatBlock","ck-suggestion-marker--active"],e),n.writer.removeAttribute("data-suggestion",e),n.mapper.unbindElementFromMarkerName(e,t.markerName))}),{priority:"high"})})),e.model.document.registerPostFixer((t=>{let n=!1;const o=Array.from(e.model.document.differ.getChangedMarkers());for(const{name:r,data:a}of o){const{group:o,type:c,id:l}=this._splitMarkerName(r);if("suggestion"!==o)continue;const g=this._suggestions.get(l);if(null!=a.newRange)if("formatInline"==c&&(n=n||er(a.newRange,r,t,e.model.schema)),a.newRange.isCollapsed||"$graveyard"==a.newRange.root.rootName||"formatBlock"==c&&!nr(a.newRange)||"deletion"==c&&(Zi(i=a.newRange)||(s=i).start.parent==s.end.nodeBefore&&s.start.isAtEnd))t.removeMarker(r),n=!0;else{if(!g||!g.isInContent)continue;n=!!this._joinWithAdjacentSuggestions(g)||n}}var s,i;return n})),e.model.document.registerPostFixer((t=>{let n=!1;for(const o of e.model.document.differ.getChanges()){if("insert"!=o.type)continue;const s=o.position.getShiftedBy(o.length);if(s.isAtEnd)for(const i of this._suggestions.values()){if(i.isMultiRange||!i.isInContent)continue;if("formatBlock"!=i.type)continue;const r=i.getFirstRange();if(r.start.parent!=r.end.parent&&r.end.isEqual(o.position)){const o=e.model.createRange(r.start,s);t.updateMarker(i.getFirstMarker(),{range:o}),n=!0}}}return n})),e.model.markers.on("update:suggestion",((e,t,n)=>{if(null==n){const{id:e}=this._splitMarkerName(t.name),n=this._suggestions.get(e);n&&n.addMarkerName(t.name)}})),e.model.document.on("change:data",(()=>{const t=Array.from(e.model.document.differ.getChangedMarkers());t.sort(((e,t)=>{const n=e.data.oldRange,o=t.data.oldRange;return null===n&&null===o?0:null===n&&null!==o?-1:null!==n&&null===o?1:n.start.isBefore(o.start)?-1:1}));const n=new Set;for(const{name:e,data:o}of t){const{group:t,id:s}=this._splitMarkerName(e);if("suggestion"===t&&(null===o.oldRange&&this._handleNewSuggestionMarker(e),null===o.newRange)){const e=this._suggestions.get(s);e.isInContent?n.add(e):this._removeSuggestion(e)}}for(const{name:e,data:o}of t){const{group:t,id:s}=this._splitMarkerName(e);if("suggestion"!==t)continue;const i=this._suggestions.get(s);null!=o.newRange&&null!=o.oldRange&&(this._refreshSuggestionsChain(i),n.add(i.head))}for(const e of n)this.fire("suggestionChanged",e);n.clear()})),e.model.on("applyOperation",((t,n)=>{const o=n[0];if(!this._suggestions.size)return;if(!o.isDocumentOperation)return;if(o.batch.isUndo||!o.batch.isLocal)return;let s,i;switch(o.type){case"insert":s=e.model.createPositionAt(o.position),i=s.getShiftedBy(o.howMany);break;case"split":s=e.model.createPositionAt(o.splitPosition),i=e.model.createPositionAt(o.moveTargetPosition);break;case"move":s=e.model.createPositionAt(o.targetPosition),i=s.getShiftedBy(o.howMany);break;default:return}const r=e.model.createRange(s,i);e.model.change((()=>{for(const{suggestion:e,meta:t}of this._findSuggestions(r)){if(e.isMultiRange)continue;if("formatInline"==e.type)continue;const n=e.data&&e.data.multipleBlocks;("formatBlock"!=e.type||"split"==o.type&&!n)&&(t.containsRangeInObject||"insertion"==e.type&&t.isOwn||e.getFirstRange().containsRange(r)&&this._breakSuggestionMarker(e,s,i))}}))}),{priority:"lowest"}),e.model.on("deleteContent",((t,n)=>{const o=n[0],s=n[1];if(s&&s.forceDefaultExecution)return;if(this._isForcedDefaultExecutionBlock)return;if(!this.trackChangesCommand.value)return;if(o.isCollapsed)return;const i=e.model.schema,{start:r,end:a}=o.getFirstRange(),c=r.nodeAfter&&i.isObject(r.nodeAfter)?null:i.getNearestSelectionRange(r,"forward"),l=a.nodeBefore&&i.isObject(a.nodeBefore)?null:i.getNearestSelectionRange(a,"backward"),g=e.model.createRange(c?c.start:r,l?l.end:a);e.model.change((t=>{this.markDeletion(g);const n=e.model.schema.getNearestSelectionRange(g.start);o.is("documentSelection")?t.setSelection(n):o.setTo(n)})),t.stop()}),{priority:t.priorities.normal+10}),e.model.on("insertContent",((t,n)=>{const o=n[n.length-1];o&&o.forceDefaultExecution||this._isForcedDefaultExecutionBlock||this.trackChangesCommand.value&&(e.model.change((()=>{let o=e.model.insertContent(n[0],n[1],n[2],n[3],{forceDefaultExecution:!0});if(!o)return;t.return=o.clone();const s=o.end.nodeBefore,i=e.model.schema;s&&i.isBlock(s)&&!i.isObject(s)&&(o=e.model.createRange(o.start,e.model.createPositionAt(s,"end"))),this.markInsertion(o)})),t.stop())}),{priority:"high"}),this.trackChangesCommand=new d(e,this._enabledCommands),this.editor.commands.add("trackChanges",this.trackChangesCommand),this.enableCommand("trackChanges");const o=new b(e,this._suggestions);e.commands.add("acceptSuggestion",o),this.enableCommand("acceptSuggestion");const s=new k(e,this._suggestions);e.commands.add("discardSuggestion",s),this.enableCommand("discardSuggestion"),e.commands.add("acceptAllSuggestions",new N(e,o,this._suggestions)),this.enableCommand("acceptAllSuggestions"),e.commands.add("discardAllSuggestions",new $(e,s,this._suggestions)),this.enableCommand("discardAllSuggestions"),e.commands.add("acceptSelectedSuggestions",new V(e,o,this._suggestions)),this.enableCommand("acceptSelectedSuggestions"),e.commands.add("discardSelectedSuggestions",new Y(e,s,this._suggestions)),this.enableCommand("discardSelectedSuggestions");const i=e.plugins.get("CommentsRepository");this.listenTo(i,"addComment",((e,{threadId:t})=>{const n=this._suggestions.get(t);n&&n.commentThread&&1===n.commentThread.length&&this._updateSuggestionData(t,{hasComments:!0})}),{priority:"low"}),this.listenTo(i,"removeComment",((e,{threadId:t})=>{const n=this._suggestions.get(t);n&&n.commentThread&&!n.commentThread.length&&this._updateSuggestionData(t,{hasComments:!1})}),{priority:"low"})}set adapter(e){if(this._adapter)throw new t.CKEditorError("track-changes-adapter-already-set",this);this._adapter=e}get adapter(){return this._adapter}getSuggestions({skipNotAttached:e=!1,toJSON:t=!1}={}){const n=[];for(const t of this._suggestions.values())e&&!t.isInContent||n.push(t);return t?n.map((e=>e.toJSON())):n}getSuggestion(e){const n=this._suggestions.get(e);if(!n)throw new t.CKEditorError("track-changes-suggestion-not-found",this);return n}hasSuggestion(e){return this._suggestions.has(e)}addSuggestionData(e){const{id:t,authorId:n}=e,[o,s]=e.type.split(":"),i=this._suggestions.get(t)||this._createSuggestion(o,s,t,n);switch(this._addThreadToSuggestion(i),this._checkSuggestionCorrectness(i,o,s||null,n),i.createdAt=e.createdAt,e.data&&(i.data=e.data),e.attributes&&(i.attributes=e.attributes),this._adapter&&this._adapter.addSuggestion||(i._saved=!0),this._suggestionState.get(i)){case"notReady":this._suggestionState.set(i,"dataReady");break;case"markerReady":i.isInContent?(this._suggestionState.set(i,"ready"),this.fire("suggestionLoaded",i)):this._suggestionState.set(i,"removed")}return i}acceptSuggestion(e){this.forceDefaultExecution((()=>{this.editor.model.change((()=>{for(const t of e.getAllAdjacentSuggestions())t.accept()}))}))}discardSuggestion(e){this.forceDefaultExecution((()=>{this.editor.model.change((()=>{for(const t of e.getAllAdjacentSuggestions())t.discard()}))}))}enableCommand(e,n){const o=this.editor.commands.get(e);if(!o)throw new t.CKEditorError("track-changes-command-not-found",this,{commandName:e});this._enabledCommands.add(o),n&&o.on("execute",((e,t)=>{this.trackChangesCommand.value&&(this._isForcedDefaultExecutionBlock||t.length>0&&t[t.length-1]&&t[t.length-1].forceDefaultExecution||(n(((...e)=>o.execute(...e,{forceDefaultExecution:!0})),...t),e.stop()))}),{priority:"high"})}forceDefaultExecution(e){let n,o;const s=this._isForcedDefaultExecutionBlock;this._isForcedDefaultExecutionBlock=!0;try{n=e()}catch(e){o=e}return s||(this._isForcedDefaultExecutionBlock=!1),o&&t.CKEditorError.rethrowUnexpectedError(o,this),n}markInsertion(e,n=null,o={}){if(e.isCollapsed)return null;const s=this.editor.plugins.get("Users").me;for(const{suggestion:t,meta:o}of this._findSuggestions(e,"insertion"))if(o.isOwn){if(!o.isNextTo)return t;if(n==t.subType){const n=t.getFirstRange();return n.start.isEqual(e.end)?this._setSuggestionRange(t,this._model.createRange(e.start,n.end)):this._setSuggestionRange(t,this._model.createRange(n.start,e.end)),t}}const i=(0,t.uid)(),r=s.id,a=n?"insertion:"+n:"insertion",c=this._setSuggestionData({id:i,type:a,createdAt:new Date,authorId:r,attributes:o});return this._addSuggestionMarker(a,i,r,e),c}markMultiRangeInsertion(e,n="multi",o={}){const s=this.editor.plugins.get("Users").me,i=this._suggestionFactory.getSuggestionCallback("insertion",n,"join");for(const t of this.getSuggestions())if(t.author.id==s.id&&"insertion"==t.type&&t.subType==n&&(i(t.getRanges(),e)||i(e,t.getRanges()))){for(const n of e)t.addRange(n);return t}for(const t of e)for(const{suggestion:n,meta:o}of this._findSuggestions(t,"insertion")){if(!o.isOwn)continue;let t=!0;for(const o of n.getRanges())for(const n of e)if(!o.containsRange(n)){t=!1;break}if(t)return n}const r=(0,t.uid)(),a=s.id,c="insertion:"+n,l=this._setSuggestionData({id:r,type:c,createdAt:new Date,authorId:a,attributes:o});for(const t of e)this._addSuggestionMarker(c,r,a,t,gs.getMultiRangeId());return l}markInlineFormat(e,n,o=null,s={}){if(o=o||tr(n),e.isCollapsed)return;const i=this.editor.plugins.get("Users").me,r=[];for(const{suggestion:t,meta:n}of this._findSuggestions(e,"insertion"))n.isOwn&&!n.isInsideObject&&r.push(...t.getRanges());const a=function(e,t){const n=[];for(const o of t){const t=e.getIntersection(o);t&&n.push(t)}return n}(e,r),c=function(e,t){const n=[e];for(const e of t){let t=0;for(;t<n.length;){const o=n[t].getDifference(e);n.splice(t,1,...o),t+=o.length}}return n}(e,r);a.length&&this._model.change((()=>{for(const e of a){const t=this._suggestionFactory.getSuggestionCallback("formatInline",o,"accept");this.forceDefaultExecution((()=>t([e],n,s)))}}));for(const e of c){let r=null,a=e.start,c=e.end;for(const{suggestion:t,meta:n}of this._findSuggestions(e,"formatInline")){if(!n.isOwn)continue;if(t.subType!=o)continue;const s=t.getFirstRange();if(s.containsRange(e,!0))return;a=a.isBefore(s.start)?a:s.start,c=c.isAfter(s.end)?c:s.end,r?s.start.isBefore(r.getFirstRange().start)?(r.removeMarkers(),r=t):t.removeMarkers():r=t}const l=this._model.createRange(a,c);if(r)this._setSuggestionRange(r,l);else{const e=(0,t.uid)(),r=i.id;this._setSuggestionData({id:e,type:"formatInline:"+o,data:n,createdAt:new Date,authorId:r,attributes:s}),this._addSuggestionMarker("formatInline:"+o,e,r,l)}}}markBlockFormat(e,n,o=[],s=null,i={}){n.formatGroupId||(n.formatGroupId=n.commandName),n.multipleBlocks=e.is("range"),s=s||tr(n);const r=o.map((e=>or(e,this._model))),a=e.is("range")?e:or(e,this._model);r.push(a);let c=!0;for(const e of r)if(!this._rangeIsInLocalUserInsertion(e)){c=!1;break}if(c){const e=this._suggestionFactory.getSuggestionCallback("formatBlock",s,"accept");return void this.forceDefaultExecution((()=>e([a],n,i)))}let l=null,g=a.start,u=a.end;for(const{suggestion:e,meta:t}of this._findSuggestions(a,"formatBlock")){if(!t.isOwn||t.isNextTo||t.containsRangeInObject||t.isInsideObject)continue;if(e.data.formatGroupId!=n.formatGroupId)continue;const o=e.getFirstRange();if(e.subType==s){if(o.containsRange(a,!0))return;g=g.isBefore(o.start)?g:o.start,u=u.isAfter(o.end)?u:o.end,l?o.start.isBefore(l.getFirstRange().start)?(l.removeMarkers(),l=e):e.removeMarkers():l=e}else{const t=a.getIntersection(o);this._cutOutSuggestionMarker(e,t)}}const d=this.editor.plugins.get("Users").me,m=(0,t.uid)(),h=d.id;l?this._setSuggestionRange(l,this._model.createRange(g,u)):(this._setSuggestionData({id:m,type:"formatBlock:"+s,data:n,createdAt:new Date,authorId:h,attributes:i}),this._addSuggestionMarker("formatBlock:"+s,m,h,this._model.createRange(g,u)))}markMultiRangeBlockFormat(e,n,o=[],s=null,i={}){n.formatGroupId||(n.formatGroupId=n.commandName),n.multipleBlocks=!1,s=s||tr(n);const r=o.map((e=>or(e,this._model))),a=e.map((e=>or(e,this._model)));r.push(...a);let c=!0;for(const e of r)if(!this._rangeIsInLocalUserInsertion(e)){c=!1;break}if(c){const e=this._suggestionFactory.getSuggestionCallback("formatBlock",s,"accept");return void this.forceDefaultExecution((()=>e(a,n,i)))}const l=this.editor.plugins.get("Users").me;for(const e of this.getSuggestions()){if(e.author.id!=l.id)continue;if("formatBlock"!=e.type||e.data.formatGroupId!=n.formatGroupId)continue;const t=e.subType==s;for(let n=0;n<a.length;n++){const o=a[n];for(const s of e.getMarkers()){const i=s.getRange();if(o.isEqual(i)){t?(a.splice(n,1),n--):e.removeMarker(s.name);break}}}}if(0==a.length)return;const g=this._suggestionFactory.getSuggestionCallback("formatBlock",s,"join");for(const e of this.getSuggestions())if(e.author.id==l.id&&"formatBlock"==e.type&&e.data.formatGroupId==n.formatGroupId&&e.subType==s&&(g(e.getRanges(),a)||g(a,e.getRanges()))){for(const t of a)e.addRange(t);return e}const u=(0,t.uid)(),d=l.id,m="formatBlock:"+s,h=this._setSuggestionData({id:u,type:m,data:n,createdAt:new Date,authorId:d,attributes:i});for(const e of a)this._addSuggestionMarker(m,u,d,e,gs.getMultiRangeId());return h}markDeletion(e,n=null,o={}){if(e.isCollapsed)return null;const s=this.editor.plugins.get("Users").me,i=new r.LiveRange(e.start,e.end);for(const{suggestion:e,meta:t}of this._findSuggestions(i,"insertion"))if(t.isOwn&&!t.isNextTo)if(e.isMultiRange){const t=e.getRanges().filter((e=>"$graveyard"!=e.root.rootName));if(t.every((e=>i.containsRange(e,!0)))&&e.discard(),t.some((e=>e.containsRange(i,!0)))){const e=this._suggestionFactory.getSuggestionCallback("deletion",n,"accept");return this.forceDefaultExecution((()=>e([i],null,o))),null}}else{const t=i.getIntersection(e.getFirstRange());e._onDiscard([t],null,o)}if(i.detach(),i.isCollapsed||"$graveyard"==i.root.rootName)return null;let a=null,c=i.start,l=i.end;for(const{suggestion:e,meta:t}of this._findSuggestions(i,"deletion"))if(t.isOwn)if(e.isMultiRange){let t=!0;for(const n of e.getRanges()){if(n.containsRange(i,!0))return e;i.containsRange(n)||(t=!1)}t&&e.discard()}else{const t=e.getFirstRange();if(t.containsRange(i,!0))return e;c=c.isBefore(t.start)?c:t.start,l=l.isAfter(t.end)?l:t.end,a?t.start.isBefore(a.getFirstRange().start)?(a.removeMarkers(),a=e):e.removeMarkers():a=e}if(a)return this._setSuggestionRange(a,this._model.createRange(c,l)),a;{const e=(0,t.uid)(),i=this._model.createRange(c,l),r=s.id,a=n?"deletion:"+n:"deletion",g=this._setSuggestionData({id:e,type:a,createdAt:new Date,authorId:r,attributes:o});return this._addSuggestionMarker(a,e,r,i),g}}markMultiRangeDeletion(e,n="multi",o={}){const s=this.editor.plugins.get("Users").me,i=e.map((e=>new r.LiveRange(e.start,e.end))),a=new Set;for(const e of i)for(const{suggestion:t,meta:n}of this._findSuggestions(e,"insertion"))n.isOwn&&!n.isNextTo&&a.add(t);for(const t of a)if(t.isMultiRange){const s=t.getRanges();if((!t.attributes||!t.attributes.skipNestingCheck)&&s.every((e=>i.some((t=>t.containsRange(e,!0)))))&&t.discard(),i.every((e=>s.some((t=>t.containsRange(e,!0)))))){const t=this._suggestionFactory.getSuggestionCallback("deletion",n,"accept");return this.forceDefaultExecution((()=>t(e,null,o))),null}}else{const e=t.getFirstRange();if(i.some((t=>t.containsRange(e,!0)))&&t.discard(),i.every((t=>e.containsRange(t,!0)))){const e=this._suggestionFactory.getSuggestionCallback("deletion",n,"accept");return this.forceDefaultExecution((()=>e(i,null,o))),null}}const c=this._suggestionFactory.getSuggestionCallback("deletion",n,"join");let l=null;for(const e of this.getSuggestions())if(e.author.id==s.id&&e.isInContent&&"deletion"==e.type&&e.subType==n&&(c(e.getRanges(),i)||c(i,e.getRanges())))if(l){if(e.commentThread&&e.commentThread.length)continue;for(const t of e.getRanges())l.isIntersectingWithRange(t)||l.addRange(t);e.removeMarkers()}else{l=e;for(const t of i)e.isIntersectingWithRange(t)||e.addRange(t)}if(l)return l;a.clear();for(const e of i)for(const{suggestion:t,meta:n}of this._findSuggestions(e,"deletion"))n.isOwn&&a.add(t);for(const e of a){const t=e.getRanges();if((!o||!o.skipNestingCheck)&&i.every((e=>t.some((t=>t.containsRange(e,!0))))))return e;(!e.attributes||!e.attributes.skipNestingCheck)&&t.every((e=>i.some((t=>t.containsRange(e,!0)))))&&e.discard()}const g=(0,t.uid)(),u=s.id,d="deletion:"+n,m=this._setSuggestionData({id:g,type:d,createdAt:new Date,authorId:u,attributes:o});for(const e of i)e.detach(),e.isCollapsed||"$graveyard"==e.root.rootName||this._addSuggestionMarker(d,g,u,e,gs.getMultiRangeId());return m}_setSuggestionRange(e,t){const n=e.getFirstMarker();this._model.change((e=>{e.updateMarker(n,{range:t})}))}_addThreadToSuggestion(e){const t=e.id,n=this.editor.config.get("collaboration.channelId");this._commentsRepository.hasCommentThread(t)||this._commentsRepository.addCommentThread({channelId:n,threadId:t});const o=this._commentsRepository.getCommentThread(t);o.unbind("isRemovable"),o.isRemovable=!1,e.commentThread=o}_checkSuggestionCorrectness(e,n,o,s){if(e.type!=n||e.subType!=o||e.author.id!=s)throw this.editor.enableReadOnlyMode("track-changes-suggestion-data-mismatch"),new t.CKEditorError("track-changes-suggestion-data-mismatch",this)}_cutOutSuggestionMarker(e,n){const o=e.getFirstRange();if(n.isEqual(o))e.removeMarkers();else if(o.containsRange(n)){const s=this._model.createPositionAt(n.start.nodeBefore,"end");this._setSuggestionRange(e,this._model.createRange(o.start,s));const i=(0,t.uid)(),r=e.author.id,a=e.type+":"+e.subType;this._setSuggestionData({id:i,type:a,createdAt:new Date,authorId:r,data:e.data,attributes:e.attributes});const c=this._model.createPositionAt(n.end.parent,"after"),l=this._model.createRange(c,o.end);this._addSuggestionMarker(a,i,r,l)}else if(o.containsPosition(n.start)){const t=this._model.createPositionAt(n.start.nodeBefore,"end");this._setSuggestionRange(e,this._model.createRange(o.start,t))}else{const t=this._model.createPositionAt(n.end.parent,"after");this._setSuggestionRange(e,this._model.createRange(t,o.end))}}_rangeIsInLocalUserInsertion(e){for(const{suggestion:t,meta:n}of this._findSuggestions(e,"insertion")){if(!n.isOwn)continue;const o=t.getRanges();for(const t of o)if(!e.getDifference(t).length)return!0}return!1}_getAuthorFromId(e){const n=this.editor.plugins.get("Users").getUser(e);if(!n)throw new t.CKEditorError("track-changes-user-not-found",this);return n}_createSuggestion(e,t,n,o){const s=this._getAuthorFromId(o),i=this._suggestionFactory.buildSuggestion(e,t,n,s,(e=>this._updateSuggestionData(n,{attributes:e})));return this.listenTo(i,"accept",(()=>{this._updateSuggestionData(n,{state:"accepted"})}),{priority:"high"}),this.listenTo(i,"discard",(()=>{this._updateSuggestionData(n,{state:"rejected"})}),{priority:"high"}),this._suggestions.set(n,i),this._suggestionState.set(i,"notReady"),i}_splitMarkerName(e){const t=e.split(":");return{group:t[0],type:t[1],subType:t.length>=5?t[2]:null,id:t.length<5?t[2]:t[3],authorId:t.length<5?t[3]:t[4],markerCount:6==t.length?t[5]:null}}_breakSuggestionMarker(e,n,o){const s=e.getFirstRange(),i=s.start,r=s.end;this._setSuggestionRange(e,this._model.createRange(i,n));const a=(0,t.uid)(),c=e.author.id,l=e.type+(e.subType?":"+e.subType:"");this._setSuggestionData({id:a,type:l,createdAt:new Date,authorId:c,originalSuggestionId:e.id,data:e.data}),"formatBlock"==e.type&&(o=this._model.createPositionBefore(o.parent)),this._addSuggestionMarker(l,a,c,this._model.createRange(o,r))}_findSuggestions(e,t=null){const n=[],o=this._model.schema,s=this.editor.plugins.get("Users").me;for(const i of this.getSuggestions())if(i.isInContent&&(!t||i.type==t))for(const t of i.getRanges()){const r=e.start.isEqual(t.end)||e.end.isEqual(t.start);if(r||e.getIntersection(t)){const a=e.containsRange(t)&&Yi(o,t.start,e),c=t.containsRange(e)&&Yi(o,e.start,t);n.push({suggestion:i,meta:{isOwn:s==i.author,isNextTo:r,isInsideObject:a,containsRangeInObject:c}});break}}return n}_addSuggestionMarker(e,t,n,o,s=null){this._model.change((i=>{let r="suggestion:"+e+":"+t+":"+n;s&&(r=r+":"+s),i.addMarker(r,{range:o,usingOperation:!0,affectsData:!0})}))}_removeSuggestion(e){const t=e.previous,n=e.next;e.previous=null,null!=t&&(t.next=null),e.next=null,null!=n&&(n.previous=null),"ready"==this._suggestionState.get(e)&&(this._suggestionState.set(e,"removed"),this.fire("suggestionUnloaded",e,t,n))}_setSuggestionData(e){const t=e.id,n=this.addSuggestionData(e);if(this._adapter&&this._adapter.addSuggestion){const o=this.editor.plugins.get("PendingActions"),s=n.hasComments,i=n.subType?n.type+":"+n.subType:n.type,r=this.editor.locale.t,a=o.add(r({string:"Unsaved change in suggestion.",id:"PENDING_ACTION_SUGGESTION"})),c={id:t,type:i,hasComments:s,data:e.data||null,originalSuggestionId:e.originalSuggestionId||null,attributes:n.attributes};this._adapter.addSuggestion(c).then((e=>{n._saved=!0,o.remove(a),e&&e.createdAt&&(this._suggestions.get(t).createdAt=e.createdAt)}))}return n}_updateSuggestionData(e,t){const n=this.editor.plugins.get("PendingActions"),o=this._suggestions.get(e);if(this._adapter&&this._adapter.updateSuggestion)if(o._saved){const o=this.editor.locale.t,s=n.add(o({string:"Unsaved change in suggestion.",id:"PENDING_ACTION_SUGGESTION"}));this._adapter.updateSuggestion(e,t).then((()=>{n.remove(s)}))}else o.on("change:_saved",(()=>{this._updateSuggestionData(e,t)}))}_getSuggestionData(e){if(!this._adapter||!this._adapter.getSuggestion)throw new t.CKEditorError("track-changes-adapter-missing-getsuggestion",this);return this._adapter.getSuggestion(e)}_handleNewSuggestionMarker(e){const{id:t,type:n,subType:o,authorId:s}=this._splitMarkerName(e),i=this._suggestions.get(t)||this._createSuggestion(n,o,t,s);switch(this._checkSuggestionCorrectness(i,n,o,s),this._suggestionState.get(i)){case"notReady":this._getSuggestionData(t).then((e=>{let n=Promise.resolve();e.hasComments&&(n=this._commentsRepository.fetchCommentThread({channelId:this.editor.config.get("collaboration.channelId"),threadId:t})),n.then((()=>{this.addSuggestionData(e)._saved=!0}))})),this._suggestionState.set(i,"markerReady");break;case"removed":this._updateSuggestionData(t,{state:"open"});case"dataReady":this._suggestionState.set(i,"ready"),this.fire("suggestionLoaded",i);break;case"ready":this.fire("suggestionChanged",i)}i.addMarkerName(e),this._refreshSuggestionsChain(i)}_refreshSuggestionsChain(e){if(e.isMultiRange)return;let t=!0,n=!0;for(const o of this.getSuggestions()){if(o.isMultiRange)continue;if(o==e||!o.isInContent)continue;if(o.author.id!=e.author.id)continue;const s=this._suggestionFactory.getSuggestionCallback(e.type,e.subType,"chain"),i=this._suggestionFactory.getSuggestionCallback(o.type,o.subType,"chain"),r=s(e,o),a=i(e,o);r&&a&&(r[1].commentThread&&r[1].commentThread.length||(r[0].next=r[1],r[1].previous=r[0],r[0]==e?n=!1:t=!1))}e.previous&&t&&(e.previous.next=null,e.previous=null),e.next&&n&&(e.next.previous=null,e.next=null)}_joinWithAdjacentSuggestions(e){for(const t of this._suggestions.values()){if(t==e||!t.isInContent)continue;if(t.type!=e.type||t.author.id!=e.author.id||t.subType!=e.subType)continue;const n=this._suggestionFactory.getSuggestionCallback(e.type,e.subType,"join");if(n(t.getRanges(),e.getRanges())){if(e.commentThread&&e.commentThread.length)continue;return this._joinSuggestions(t,e),!0}if(n(e.getRanges(),t.getRanges())){if(t.commentThread&&t.commentThread.length)continue;return this._joinSuggestions(e,t),!0}}return!1}_joinSuggestions(e,t){if(e.isMultiRange)for(const n of t.getRanges())e.addRange(n);else{const n=t.getFirstRange().end;this._setSuggestionRange(e,this._model.createRange(e.getFirstRange().start,n))}t.removeMarkers()}}(0,t.mix)(Qi,t.EmitterMixin);class Ji{constructor(e){this._editor=e,this._model=e.model,this._customCallbacks=new Map,this._defaultCallbacks=new Map,this._registerDefaultCallbacks()}buildSuggestion(e,t,n,o,s){return new gs(this._model,{type:e,subType:t,id:n,author:o,onAttributesChange:s,onAccept:(...n)=>this.getSuggestionCallback(e,t,"accept")(...n),onDiscard:(...n)=>this.getSuggestionCallback(e,t,"discard")(...n)})}registerCustomCallback(e,t,n,o){const s=e+":"+t+":"+n;this._customCallbacks.set(s,o)}getSuggestionCallback(e,t,n){const o=e+":"+t+":"+n;return this._customCallbacks.get(o)||this._defaultCallbacks.get(e+":"+n)}_registerDefaultCallbacks(){const e=()=>{},t=e=>{e.sort(((e,t)=>e.start.isBefore(t.start)?1:-1)),this._model.change((t=>{for(const n of e){let e;e=n.end.isAtEnd&&n.end.parent==n.start.nodeAfter?t.createSelection(n.start.nodeAfter,"on"):t.createSelection(n),this._model.deleteContent(e,{forceDefaultExecution:!0,doNotAutoparagraph:!0})}}))},n=(e,t)=>{this._model.change((n=>{const{commandName:o,commandParams:s=[]}=t,i=e[0];if("$graveyard"==i.root.rootName)return;const a=Array.from(this._model.document.selection.getRanges()).map((e=>r.LiveRange.fromRange(e)));Zi(i)?n.setSelection(this._model.createRange(i.end)):n.setSelection(i);for(const e of this._editor.commands.commands())e.refresh();s.push({forceDefaultExecution:!0}),this._editor.execute(o,...s);const c=a.filter((e=>"$graveyard"!=e.root.rootName));c.length>0&&n.setSelection(c);for(const e of a)e.detach()}))},o=(e,t)=>1==e.length&&1==t.length&&e[0].end.isEqual(t[0].start),s=(e,t)=>sr(e,t,this._model)?[e,t]:sr(t,e,this._model)?[t,e]:null;this._defaultCallbacks.set("insertion:accept",e),this._defaultCallbacks.set("insertion:discard",t),this._defaultCallbacks.set("insertion:join",o),this._defaultCallbacks.set("insertion:chain",s),this._defaultCallbacks.set("deletion:accept",t),this._defaultCallbacks.set("deletion:discard",e),this._defaultCallbacks.set("deletion:join",o),this._defaultCallbacks.set("deletion:chain",s),this._defaultCallbacks.set("formatInline:accept",n),this._defaultCallbacks.set("formatInline:discard",e),this._defaultCallbacks.set("formatInline:join",o),this._defaultCallbacks.set("formatInline:chain",e),this._defaultCallbacks.set("formatBlock:accept",n),this._defaultCallbacks.set("formatBlock:discard",e),this._defaultCallbacks.set("formatBlock:join",o),this._defaultCallbacks.set("formatBlock:chain",e)}}function Yi(e,t,n){for(const o of t.parent.getAncestors({includeSelf:!0,parentFirst:!0})){if(o.root==o)return!1;if(!n.containsItem(o))return!1;if(e.isObject(o)||e.isLimit(o))return!0}}function Zi(e){return e.end.parent==e.start.nodeAfter&&e.end.isAtStart}function er(e,t,n,o){const s=e=>!e.item.is("textProxy")&&!o.isObject(e.item),i=e.start.getLastMatchingPosition(s),r=e.end.getLastMatchingPosition(s,{direction:"backward"});return!(e.start.isEqual(i)&&e.end.isEqual(r)||(i.isBefore(r)?n.updateMarker(t,{range:n.createRange(i,r)}):n.removeMarker(t),0))}function tr(e){return function(e){let t=0,n=0;for(const o of qi(e))t=(t<<5)-t+o,t&=t,[t,n]=[n,t];return Xi(t)+Xi(n)}(e)}function nr(e){const t=e.start.nodeAfter;return t&&t.is("element")}function or(e,t){const n=t.schema.isObject(e)||t.schema.isSelectable(e);return t.createRange(t.createPositionAt(e,"before"),n?t.createPositionAfter(e):t.createPositionAt(e,"end"))}function sr(e,t,n){const o=e.getFirstRange(),s=t.getFirstRange();if(o.end.isEqual(s.start))return!0;if(e.type!=t.type)return!1;if(!o.end.isTouching(s.start))return!1;const i=n.createRange(o.end,s.start).getWalker();for(const e of i)if(["elementStart","elementEnd"].includes(e.type)&&n.schema.isLimit(e.item))return!1;return!0}var ir,rr,ar=["commentThreadController","_acceptCommand","destroy","discardSuggestion","model","unbind","view","execute","isEnabled","acceptSuggestion","_discardCommand","bind"];ir=ar,rr=180,function(e){for(;--e;)ir.push(ir.shift())}(++rr);var cr=function(e,t){return ar[e-=0]};class lr{constructor(e,t,n,o,s){this[cr("0x4")]=e,this[cr("0x6")]=t,this[cr("0x0")]=s,this[cr("0x1")]=n,this._discardCommand=o,this[cr("0x6")][cr("0xb")](cr("0x8")).to(this[cr("0x1")]),this.listenTo(t,cr("0x9"),(()=>this[cr("0x9")]())),this.listenTo(t,cr("0x3"),(()=>this[cr("0x3")]()))}[cr("0x9")](){this[cr("0x1")][cr("0x7")](this[cr("0x4")].id)}[cr("0x3")](){this[cr("0xa")][cr("0x7")](this[cr("0x4")].id)}[cr("0x2")](){this[cr("0x6")][cr("0x5")](cr("0x8")),this.stopListening(),this[cr("0x0")][cr("0x2")]()}}(0,t.mix)(lr,t.ObservableMixin);const gr=["showInput","addComment","fire","_createCommentThreadInputView","commentInputView","delegate","commentThreadInputView","bind","disableComments","commentThread","_createCommentViews","isEnabled","submit","editorConfig","destroy","removeComment","_localUser","focus","_config","set","value","element","isReadOnly","descriptionParts","isDirty","isActive","disabledSubmit","length","assign","commentsListView","createdAt","_model","locale"];var ur,dr;ur=gr,dr=159,function(e){for(;--e;)ur.push(ur.shift())}(++dr);const mr=function(e,t){return gr[e-=0]};class hr extends s.View{constructor(e,t,n,o){super(e),this[mr("0x2")]=null,this[mr("0xc")]=null,this[mr("0x19")](mr("0x1f"),!1),this[mr("0x19")](mr("0x3"),t[mr("0x3")]),this[mr("0xd")](mr("0x3")).to(t),this[mr("0x19")](mr("0x1d"),[]),this[mr("0x19")](mr("0x1e"),!1),this[mr("0x19")](mr("0x11"),!1),this[mr("0x4")]=t,this[mr("0x16")]=n,this[mr("0x18")]=o,o[mr("0xe")]?this.set("length",1):this[mr("0x10")]()}[mr("0x17")](){this[mr("0x1b")][mr("0x17")]()}[mr("0x14")](){this[mr("0x1e")]=!1,this.commentsListView&&this[mr("0x2")][mr("0x14")](),this[mr("0xc")]&&this[mr("0xc")][mr("0x14")](),super[mr("0x14")]()}[mr("0x10")](){const{CommentsListView:e}=this[mr("0x18")];this.commentsListView=new e(this[mr("0x5")],this[mr("0x4")][mr("0xf")],Object[mr("0x1")]({CommentView:this[mr("0x18")].CommentView},this._config)),this[mr("0x2")][mr("0xb")]("removeComment").to(this),this.commentsListView.delegate("updateComment").to(this),this[mr("0x2")][mr("0xd")](mr("0x1f")).to(this),this.set(mr("0x0"),this.commentsListView.length+1),this.bind("length").to(this.commentsListView,mr("0x0"),(e=>e+1)),this[mr("0xc")]=this[mr("0x9")](),this.on(mr("0x15"),(()=>this[mr("0x17")]())),this.bind(mr("0x1e")).to(this[mr("0x2")],"hasDirtyComment",this[mr("0xc")][mr("0xa")],mr("0x1a"),((e,t)=>e||!!t))}[mr("0x9")](){const{CommentThreadInputView:e}=this._config,t=new e(this[mr("0x5")],this[mr("0x16")],this[mr("0x18")][mr("0x13")]),n=t[mr("0xa")];return t[mr("0xd")](mr("0x6")).to(this,"isActive",this[mr("0x4")][mr("0xf")],mr("0x1c"),n,"value",((e,t,n)=>!!n||e&&!t)),n.on(mr("0x12"),((e,t)=>{this[mr("0x8")](mr("0x7"),t),n.editor.setData("")})),n.on("cancel",(()=>this[mr("0x17")]())),n[mr("0xd")](mr("0x20")).to(this._model[mr("0xf")],mr("0x1c")),t}}class fr extends hr{constructor(t,n,o,s){super(t,n,o,s);const{t:r}=t;this.set("type",""),this.bind("type").to(this,"descriptionParts",(e=>e&&e[0]?e[0].type:"")),this.bind("description").to(this,"descriptionParts",this,"isActive",((e,t)=>{let n="";for(const t of e)n+="<p>"+pr(t.content,t.color)+"</p>";return t?n:(0,i.trimHtml)(n,{limit:140})})),this._descriptionElement=null,this.acceptButton=this._createButton(r("Accept suggestion"),e.icons.check,"ck-suggestion--accept","acceptSuggestion"),this.discardButton=this._createButton(r("Discard suggestion"),e.icons.cancel,"ck-suggestion--discard","discardSuggestion"),this.userView=new i.UserView(t,this._model.author),this.userView.extendTemplate({attributes:{class:["ck-suggestion__user","ck-annotation__user"]}}),this.setTemplate(this.getTemplate())}getTemplate(){const e=this.bindTemplate,t={tag:"div",attributes:{class:["ck-suggestion-wrapper",e.if("isActive","ck-suggestion-wrapper--active"),e.to("type",(e=>"ck-suggestion-"+e)),this._config.disableComments&&"ck-suggestion--disabled-comments"],"data-suggestion-id":this._model.id,"data-thread-id":this._model.commentThread.id,"data-author-id":this._model.author.id,tabindex:-1},children:[{tag:"div",attributes:{class:["ck-suggestion","ck-annotation"]},children:[this.userView,{tag:"div",attributes:{class:["ck-suggestion__main","ck-annotation__main"]},children:[{tag:"div",attributes:{class:["ck-suggestion__info","ck-annotation__info"]},children:[{tag:"span",children:[{text:this.userView.name}],attributes:{class:["ck-suggestion__info-name","ck-annotation__info-name"]}},{tag:"time",attributes:{datetime:e.to("createdAt"),class:["ck-comment__info-time","ck-annotation__info-time"]},children:[{text:e.to("createdAt",(e=>this._config.formatDateTime(e)))}]}]},{tag:"div",attributes:{class:["ck-suggestion__actions","ck-annotation__actions"]},children:[this.acceptButton,this.discardButton]},{tag:"div",attributes:{class:["ck-annotation__content-wrapper"]}}]}]}]};return this.commentsListView&&this.commentThreadInputView&&t.children.push(this.commentsListView,this.commentThreadInputView),t}render(){super.render(),this._descriptionElement=this.element.querySelector(".ck-annotation__content-wrapper"),this._descriptionElement.innerHTML=this.description,this.on("change:description",((e,t,n)=>{this._descriptionElement.innerHTML=n}))}_createButton(e,t,n,o){const i=new s.ButtonView(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),i.on("execute",(()=>{this.fire(o,this._model.id)})),i.bind("isEnabled").to(this),i}}function pr(e,t){let n="";return n+=e.split("*").map(((e,t)=>t%2!=0?'<span class="ck-suggestion-type">'+br(e)+"</span>":br(e))).join(""),t&&(n+='<span class="ck-suggestion-color" style="background-color: '+t.value+'" title="'+t.title+'"></span>'),n}function br(e){const t=document.createElement("span");return t.innerText=e,t.innerHTML}var xr=n(596),yr=n.n(xr);const Cr=function(){return fe.Date.now()};var _r=/\s/;const kr=function(e){for(var t=e.length;t--&&_r.test(e.charAt(t)););return t};var vr=/^\s+/;const Er=function(e){return e?e.slice(0,kr(e)+1).replace(vr,""):e};var Tr=/^[-+]0x[0-9a-f]+$/i,Rr=/^0b[01]+$/i,Sr=/^0o[0-7]+$/i,wr=parseInt;const Ar=function(e){if("number"==typeof e)return e;if(fo(e))return NaN;if(Re(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Re(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Er(e);var n=Rr.test(e);return n||Sr.test(e)?wr(e.slice(2),n?2:8):Tr.test(e)?NaN:+e};var Ir=Math.max,Mr=Math.min;const Nr=function(e,t,n){var o,s,i,r,a,c,l=0,g=!1,u=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=o,i=s;return o=s=void 0,l=t,r=e.apply(i,n)}function h(e){return l=e,a=setTimeout(p,t),g?m(e):r}function f(e){var n=e-c;return void 0===c||n>=t||n<0||u&&e-l>=i}function p(){var e=Cr();if(f(e))return b(e);a=setTimeout(p,function(e){var n=t-(e-c);return u?Mr(n,i-(e-l)):n}(e))}function b(e){return a=void 0,d&&o?m(e):(o=s=void 0,r)}function x(){var e=Cr(),n=f(e);if(o=arguments,s=this,c=e,n){if(void 0===a)return h(c);if(u)return clearTimeout(a),a=setTimeout(p,t),m(c)}return void 0===a&&(a=setTimeout(p,t)),r}return t=Ar(t)||0,Re(n)&&(g=!!n.leading,i=(u="maxWait"in n)?Ir(Ar(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d),x.cancel=function(){void 0!==a&&clearTimeout(a),l=0,o=c=s=a=void 0},x.flush=function(){return void 0===a?r:b(Cr())},x};class Fr extends e.Plugin{static get requires(){return[Qi,i.Users,"CommentsRepository","Annotations","EditorAnnotations"]}static get pluginName(){return"TrackChangesUI"}constructor(e){super(e),this._suggestionToController=new Map,this._viewToController=new Map,this._debouncedHandlers=new Map;const t=this.editor.config;t.define("trackChanges.SuggestionThreadView",fr),t.define("trackChanges.disableComments",!1),this._disableComments=t.get("trackChanges.disableComments")}init(){const e=this.editor,t=e.plugins.get(Qi),n=e.plugins.get("Annotations"),o=e.plugins.get("EditorAnnotations"),s=e.plugins.get("CommentsRepository");e.ui.componentFactory.add("trackChanges",(e=>this._createUIButton(e))),o.addSourceCollector((()=>{const e=[];for(const[t,n]of Array.from(this._suggestionToController)){const o=t.getAllAdjacentSuggestions(),s=[];for(const e of o){if(!e.isInContent)continue;if(e.isMultiRange){s.push(...e.getRanges());continue}const t=e.getFirstRange();if(s.length>0){const e=s[0].getJoined(t);if(e){s[0]=e;continue}}s.push(t)}e.push([n.view,s])}return e})),this.listenTo(t,"suggestionLoaded",((e,t)=>{let n=!1;const s=Nr((e=>{n||e?n&&e&&(this._destroyController(t),o.refreshSelectedViews(),n=!1):(this._initializeController(t),o.refreshSelectedViews(),n=!0)}),10);this._debouncedHandlers.set(t,s),this.listenTo(t,"change:previous",((e,n,o,i)=>{t.isInContent&&(null==o?(this._updateController(i.head),s(!1)):(this._updateController(o.head),s(!0)))})),null===t.previous?s(!1):this._updateController(t.head)})),this.listenTo(t,"suggestionUnloaded",((e,t,n)=>{this.stopListening(t,"change:previous"),this._debouncedHandlers.get(t).cancel(),this._debouncedHandlers.delete(t);const o=n?n.head:t,s=this._suggestionToController.get(o);null!==n&&this._updateController(o),null===n&&s&&this._destroyController(t)})),this.listenTo(t,"suggestionChanged",((e,t)=>{this._updateController(t)})),this.listenTo(n,"change:activeAnnotations",((e,n,o)=>{const s=Array.from(o,(e=>e.innerView)).filter((e=>this._viewToController.has(e))),i=[];for(const e of s){const t=this._viewToController.get(e).model.getAllAdjacentSuggestions();i.push(...t.reduce(((e,t)=>[...e,...t.getMarkerNames()]),[]))}t.activeMarkers=i})),this.listenTo(s,"addComment",((e,{threadId:n,isFromAdapter:o})=>{if(o||!t.hasSuggestion(n))return;const s=t.getSuggestion(n);this._suggestionToController.get(s).view.focus()}),{priority:"lowest"})}_createUIButton(e){const n=(0,s.createDropdown)(e,s.SplitButtonView),o=this.editor.commands.get("trackChanges"),{t:i}=this.editor;n.buttonView.set({tooltip:i("Track changes"),label:i("Track changes"),icon:yr()}),n.buttonView.bind("isOn").to(o,"value"),n.buttonView.on("execute",(()=>o.execute()));const r=new t.Collection,a=[{type:"switchbutton",model:{withText:!0,label:i("Track changes"),commandName:"trackChanges"}},{type:"separator"},{type:"button",model:{withText:!0,label:i("Accept all suggestions"),commandName:"acceptAllSuggestions"}},{type:"button",model:{withText:!0,label:i("Accept all selected suggestions"),commandName:"acceptSelectedSuggestions"}},{type:"button",model:{withText:!0,label:i("Discard all suggestions"),commandName:"discardAllSuggestions"}},{type:"button",model:{withText:!0,label:i("Discard all selected suggestions"),commandName:"discardSelectedSuggestions"}}];for(const e of a){const t={type:e.type};if(e.model){const n=new s.Model(e.model),o=this.editor.commands.get(n.commandName);n.bind("isOn","isEnabled").to(o,"value","isEnabled"),t.model=n}r.add(t)}(0,s.addListToDropdown)(n,r);const c=a.filter((e=>null!=e.model)).map((e=>this.editor.commands.get(e.model.commandName)));return n.buttonView.actionView.unbind("isEnabled"),n.buttonView.arrowView.unbind("isEnabled"),n.buttonView.actionView.bind("isEnabled").to(o,"isEnabled"),n.buttonView.arrowView.bind("isEnabled").toMany(c,"isEnabled",((...e)=>e.some((e=>e)))),n.on("execute",(e=>this.editor.execute(e.source.commandName))),n}_initializeController(e){const t=this.editor,n=t.config,o=t.plugins.get("Annotations"),s=t.plugins.get("CommentsRepository"),r=e.getAllAdjacentSuggestions().filter((e=>e.isInContent)),a=t.plugins.get(i.Users).me,c=t.commands.get("acceptSuggestion"),l=t.commands.get("discardSuggestion"),g=n.get("trackChanges").SuggestionThreadView,{CommentsListView:u,CommentThreadInputView:d}=t.plugins.get("CommentsUI"),m=new g(t.locale,e,a,{disableComments:this._disableComments,editorConfig:n.get("comments.editorConfig"),maxCommentsWhenCollapsed:n.get("comments.maxCommentsWhenCollapsed"),maxThreadTotalWeight:n.get("comments.maxThreadTotalWeight"),maxCommentCharsWhenCollapsed:n.get("comments.maxCommentCharsWhenCollapsed"),formatDateTime:(0,i.getDateTimeFormatter)(n.get("locale")),CommentView:n.get("comments").CommentView,CommentsListView:u,CommentThreadInputView:d}),h=s.createCommentThreadController(e.commentThread,m),f=new lr(e,m,c,l,h);m.descriptionParts=t.plugins.get("TrackChangesEditing")._descriptionFactory.getDescriptions(r),this._suggestionToController.set(e,f),this._viewToController.set(m,f);const p=o.createAnnotationView(this.editor.locale,m);p.bind("isDirty").to(m,"isDirty"),p.bind("length").to(m),p.bind("type").to(m,"type",(e=>"suggestion-"+e));const b=o.createAnnotation({view:p,target:()=>{const e=r[0].getFirstMarker();if(!e)return null;const n=e.getRange().getContainedElement();return n&&!t.editing.mapper.toViewElement(n)?null:(0,i.getMarkerDomElement)(t.editing,e)||null},type:()=>"suggestion-"+f.view.type});o.add(b);const x=t.plugins.get("PendingActions");let y;m.on("change:isDirty",((e,t,n)=>{if(n){const e=this.editor.locale.t;y=x.add(e({string:"Unsaved change in suggestion.",id:"PENDING_ACTION_SUGGESTION"}))}else x.remove(y),y=null}))}_destroyController(e){const t=this.editor.plugins.get("Annotations"),n=this._suggestionToController.get(e),o=n.view,s=t.getByInnerView(o);s&&t.remove(s),this._suggestionToController.delete(e),this._viewToController.delete(o),n.destroy(),o.destroy()}_updateController(e){if(!e.isInContent||!this._suggestionToController.has(e))return;const t=this.editor.plugins.get("TrackChangesEditing"),n=this._suggestionToController.get(e),o=e.getAllAdjacentSuggestions();n.view.descriptionParts=t._descriptionFactory.getDescriptions(o)}destroy(){super.destroy();for(const e of this._suggestionToController.keys())this._destroyController(e);for(const e of this._debouncedHandlers.values())e.cancel();this._debouncedHandlers.clear()}}var Pr,Or,Lr=["getSuggestions","plugins","editor","Comments","getSuggestion","addSuggestion","addSuggestionData","get","adapter","requires"];Pr=Lr,Or=346,function(e){for(;--e;)Pr.push(Pr.shift())}(++Or);var Br=function(e,t){return Lr[e-=0]};class jr extends e.Plugin{static get[Br("0x3")](){return[Qi,Fr,Br("0x7")]}static get pluginName(){return"TrackChanges"}set adapter(e){this[Br("0x6")][Br("0x5")][Br("0x1")](Qi)[Br("0x2")]=e}get adapter(){return this.editor.plugins[Br("0x1")](Qi)[Br("0x2")]}[Br("0x9")](e){return this[Br("0x6")][Br("0x5")][Br("0x1")](Qi)[Br("0x0")](e)}[Br("0x4")](e){return this.editor[Br("0x5")][Br("0x1")](Qi)[Br("0x4")](e)}[Br("0x8")](e){return this[Br("0x6")][Br("0x5")].get(Qi)[Br("0x8")](e)}}const Dr=["add","string","extraPlugins","reduce","track-changes-data-invalid-editor-creator","data","names","toolbar","requires","trackChangesData.editorCreator","discardAllSuggestions","concat","has","find","getDataWithDiscardedSuggestions","init","getUser","push","plugins","context","document","config","CommentsRepository","div","result","addSuggestionData","editorCreator","users","RealTimeCollaborativeTrackChanges","model","pluginName","TrackChangesEditing","createDocumentFragment","appendChild","editor","createElement","execute","addUser","_adapter","getSuggestions","getRootNames","define","name","includes","get","TrackChangesData","Autosave","map","every","constructor","destroy","trackChangesData","Users","useAnonymousUser","function"];var Ur,Hr;Ur=Dr,Hr=250,function(e){for(;--e;)Ur.push(Ur.shift())}(++Hr);const Vr=function(e,t){return Dr[e-=0]},zr=["initialData",Vr("0x2c"),Vr("0x20")],Gr=["RealTimeCollaborativeEditing","RealTimeCollaborativeComments",Vr("0x35"),Vr("0x10")];class Wr extends e.Plugin{static get[Vr("0x21")](){return[Qi]}static get[Vr("0x0")](){return Vr("0xf")}[Vr("0x28")](){const e=this[Vr("0x4")];if(e[Vr("0x2e")][Vr("0xb")](Vr("0x22"),(t=>e[Vr("0x13")].create("",t))),Vr("0x18")!=typeof e[Vr("0x2e")].get(Vr("0x15"))[Vr("0x33")])throw new t.CKEditorError(Vr("0x1d"))}getDataWithAcceptedSuggestions(e){return $r(this[Vr("0x4")],!0,e)}[Vr("0x27")](e){return $r(this[Vr("0x4")],!1,e)}}class qr extends e.Plugin{static get[Vr("0x0")](){return"TrackChangesDataGetter"}[Vr("0x28")](){this[Vr("0x31")]="end",this.editor.plugins[Vr("0xe")](Vr("0x2f"))[Vr("0x8")]={getCommentThread:()=>new Promise((()=>{}))},this[Vr("0x4")][Vr("0x2b")].get(Vr("0x1"))[Vr("0x8")]=null}}async function $r(e,t,n){const o=function(e){const t={};for(const n of e[Vr("0x2e")][Vr("0x1f")]())zr[Vr("0xd")](n)||(t[n]=e[Vr("0x2e")][Vr("0xe")](n));const n=e[Vr("0x13")].builtinPlugins||[],o=t[Vr("0x1b")]||[];delete t.extraPlugins;const s=n.concat(t[Vr("0x2b")])[Vr("0x24")](o)[Vr("0x11")]((e=>Vr("0x1a")==typeof e?n[Vr("0x26")]((t=>t[Vr("0x0")]==e)):e)),i=Array.from(new Set(s));return t[Vr("0x2b")]=i.filter((e=>Kr(e,new Set))),t.plugins[Vr("0x2a")](qr),t.plugins[Vr("0x2a")](Qi),t}(e),s=document[Vr("0x2")](),i=e[Vr("0x2e")][Vr("0xe")](Vr("0x15")).editorCreator,r=await i(o,(()=>function(e){const t=document[Vr("0x5")](Vr("0x30"));return e[Vr("0x3")](t),t}(s)));!function(e,t){const n=e[Vr("0x36")][Vr("0x2d")][Vr("0xa")]()[Vr("0x1c")](((t,n)=>(t[n]=e[Vr("0x1e")][Vr("0xe")]({rootName:n}),t)),{}),o=e[Vr("0x2b")][Vr("0xe")]("Users")[Vr("0x34")][Vr("0x11")]((e=>({id:e.id}))),s=e.plugins[Vr("0xe")](Vr("0x1"))[Vr("0x9")]({skipNotAttached:!0,toJSON:!0}),i=t.plugins[Vr("0xe")](Vr("0x16")),r=t[Vr("0x2b")][Vr("0xe")]("TrackChangesEditing");for(const e of o)i[Vr("0x29")](e.id)||i[Vr("0x7")](e);i.me||i[Vr("0x17")]();for(const e of s)r[Vr("0x32")](e);t[Vr("0x1e")].set(n)}(e,r),r[Vr("0x6")](t?"acceptAllSuggestions":Vr("0x23"));const a=r[Vr("0x1e")][Vr("0xe")](n);return await r[Vr("0x14")](),a}function Kr(e,t){if(t[Vr("0x25")](e))return!0;t[Vr("0x19")](e);const n="function"==typeof e?e[Vr("0x0")]||e[Vr("0xc")]:e;return(!n||!Gr.includes(n))&&(!e[Vr("0x21")]||e[Vr("0x21")][Vr("0x12")]((e=>Kr(e,t))))}})(),(window.CKEditor5=window.CKEditor5||{}).trackChanges=o})();
|